Documentation
¶
Index ¶
- func BytesToKey(salt, data []byte, h hash.Hash, keyLen, blockLen int) (key, iv []byte)
- func BytesToKeyAES256CBC(salt, data []byte) (key []byte, iv []byte)
- func BytesToKeyAES256CBCMD5(salt, data []byte) (key []byte, iv []byte)
- func DecryptCryptoJsAesMsg(password string, ciphertext string) ([]byte, error)
- func Md5String(inputs ...string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToKey ¶
From https://github.com/walkert/go-evp . BytesToKey implements the Openssl EVP_BytesToKey logic. It takes the salt, data, a hash type and the key/block length used by that type. As such it differs considerably from the openssl method in C.
func BytesToKeyAES256CBC ¶
BytesToKeyAES256CBC implements the SHA256 version of EVP_BytesToKey using AES CBC
func BytesToKeyAES256CBCMD5 ¶
BytesToKeyAES256CBCMD5 implements the MD5 version of EVP_BytesToKey using AES CBC
func DecryptCryptoJsAesMsg ¶
Decrypt a CryptoJS.AES.encrypt(msg, password) encrypted msg. ciphertext is the result of CryptoJS.AES.encrypt(), which is the base64 string of "Salted__" + [8 bytes random salt] + [actual ciphertext]. actual ciphertext is padded (make it's length align with block length) using Pkcs7. CryptoJS use a OpenSSL-compatible EVP_BytesToKey to derive (key,iv) from (password,salt), using md5 as hash type and 32 / 16 as length of key / block. See: https://stackoverflow.com/questions/35472396/how-does-cryptojs-get-an-iv-when-none-is-specified , https://stackoverflow.com/questions/64797987/what-is-the-default-aes-config-in-crypto-js
Types ¶
This section is empty.