|
|
@@ -74,8 +74,8 @@ func pkcs7Unpad(data []byte, blockSize int) ([]byte, error) {
|
|
|
return data[:len(data)-n], nil
|
|
|
}
|
|
|
|
|
|
-// getCipherText returns slice of the cipher text
|
|
|
-func getCipherText(sessionKey, encryptedData, iv string) ([]byte, error) {
|
|
|
+// GetCipherText returns slice of the cipher text
|
|
|
+func GetCipherText(sessionKey, encryptedData, iv string) ([]byte, error) {
|
|
|
aesKey, err := base64.StdEncoding.DecodeString(sessionKey)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
@@ -103,7 +103,7 @@ func getCipherText(sessionKey, encryptedData, iv string) ([]byte, error) {
|
|
|
|
|
|
// Decrypt 解密数据
|
|
|
func (encryptor *Encryptor) Decrypt(sessionKey, encryptedData, iv string) (*PlainData, error) {
|
|
|
- cipherText, err := getCipherText(sessionKey, encryptedData, iv)
|
|
|
+ cipherText, err := GetCipherText(sessionKey, encryptedData, iv)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|