Lien Li 5 лет назад
Родитель
Сommit
13e5b3938b
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      miniprogram/encryptor/encryptor.go

+ 3 - 3
miniprogram/encryptor/encryptor.go

@@ -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
 	}