3DES解密
(crypted, key, iv []byte)
| 59 | |
| 60 | // 3DES解密 |
| 61 | func TripleDesDecrypt(crypted, key, iv []byte) ([]byte, error) { |
| 62 | block, err := des.NewTripleDESCipher(key) |
| 63 | if err != nil { |
| 64 | return nil, err |
| 65 | } |
| 66 | blockMode := cipher.NewCBCDecrypter(block, iv) |
| 67 | origData := make([]byte, len(crypted)) |
| 68 | blockMode.CryptBlocks(origData, crypted) |
| 69 | origData = PKCS5UnPadding(origData) |
| 70 | return origData, nil |
| 71 | } |
| 72 | |
| 73 | //AES解密 |
| 74 | func AesDecryptCBC(encrypted []byte, key []byte) (decrypted []byte) { |
no test coverage detected