Bläddra i källkod

:edit 修改加密返回报文

fly 3 månader sedan
förälder
incheckning
1739616905
1 ändrade filer med 2 tillägg och 2 borttagningar
  1. 2 2
      algorithm/encryption/AesCBCWithPadding.go

+ 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解密函数