9 func (s *OssCryptoBucketSuite) TestMasterRsaError(c *C) {
11 masterRsaCipher, _ := CreateMasterRsa(matDesc, RandLowStr(100), rsaPrivateKey)
12 _, err := masterRsaCipher.Encrypt([]byte("123"))
15 masterRsaCipher, _ = CreateMasterRsa(matDesc, rsaPublicKey, RandLowStr(100))
16 _, err = masterRsaCipher.Decrypt([]byte("123"))
19 testPrivateKey := rsaPrivateKey
20 []byte(testPrivateKey)[100] = testPrivateKey[90]
21 masterRsaCipher, _ = CreateMasterRsa(matDesc, rsaPublicKey, testPrivateKey)
22 _, err = masterRsaCipher.Decrypt([]byte("123"))
25 masterRsaCipher, _ = CreateMasterRsa(matDesc, rsaPublicKey, rsaPrivateKey)
27 var cipherData CipherData
28 err = cipherData.RandomKeyIv(aesKeySize/2, ivSize/4)
31 masterRsaCipher, _ = CreateMasterRsa(matDesc, rsaPublicKey, rsaPrivateKey)
32 v := masterRsaCipher.(MasterRsaCipher)
34 v.PublicKey = strings.Replace(rsaPublicKey, "PUBLIC KEY", "CERTIFICATE", -1)
35 _, err = v.Encrypt([]byte("HELLOW"))
38 v.PrivateKey = strings.Replace(rsaPrivateKey, "PRIVATE KEY", "CERTIFICATE", -1)
39 _, err = v.Decrypt([]byte("HELLOW"))