This commit is contained in:
parent
341534b610
commit
67a5932e27
|
@ -74,7 +74,10 @@ func (cryptoService *CryptoService) EncryptByAES(msg []byte) (encryptedBytes []b
|
|||
|
||||
func (cryptoService *CryptoService) DecryptByAES(encryptedBytes []byte) (decryptedBytes []byte, err error) {
|
||||
//CBC解密
|
||||
block, _ := aes.NewCipher(cryptoService.aesPriKey) // 分组秘钥
|
||||
block, err := aes.NewCipher(cryptoService.aesPriKey) // 分组秘钥
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
blockSize := block.BlockSize() // 获取秘钥块的长度
|
||||
blockMode := cipher.NewCBCDecrypter(block, cryptoService.aesPriKey[:blockSize]) // 加密模式
|
||||
decryptedBytes = make([]byte, len(encryptedBytes)) // 创建数组
|
||||
|
|
Loading…
Reference in New Issue