Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecryptAesCbc ¶
DecryptAesCbc returns a decrypted text.
key := "key..."
cipherText := "cipher text..."
// decrypt the cipher text
cipherText, err := aes.DecryptAesCbc(key, cipherText)
if err != nil {
panic(err)
}
func EncryptAesCbc ¶
EncryptAesCbc returns a cipher text.
saltSize := 16
salt, err := libcrypto.GenerateSalt(saltSize)
if err != nil {
t.Errorf("Failed to generate salt: %v", err)
}
// compute a 256-bit password hash with salt and 100000 iterations
key := hash.Pbkdf2Hash256("password", salt, 100000)
clearText := "test to encrypt"
// encrypt the clear text
cipherText, err := aes.EncryptAesCbc(key, clearText)
if err != nil {
panic(err)
}
func PKCS5Padding ¶
PKCS5Padding returns a padded text.
func PKCS5Trimming ¶
PKCS5Trimming returns a encrypted bytes without padding.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.