Эх сурвалжийг харах

:edit 修改加密返回报文

fly 3 сар өмнө
parent
commit
1ad90ef292

+ 2 - 2
algorithm/encryption/AesCBCWithPadding.go

@@ -49,9 +49,9 @@ func (a *AesCBCWithPadding) Encrypt(plaintext []byte) ([]byte, error) {
 	ciphertext := make([]byte, aes.BlockSize+len(plaintext))
 	copy(ciphertext[:aes.BlockSize], a.iv)
 	mode := cipher.NewCBCEncrypter(block, a.iv)
-	mode.CryptBlocks(ciphertext, plaintext)
+	mode.CryptBlocks(ciphertext[aes.BlockSize:], plaintext)
 
-	return ciphertext, nil
+	return ciphertext[aes.BlockSize:], nil
 }
 
 // AES解密函数