Documentation ¶
Index ¶
- func AesGcmDecrypt(key, ciphertext, additionalData []byte) (plaintext []byte, err error)
- func AesGcmDecryptWithNonce(key, ciphertext, nonce, additionalData []byte) (plaintext []byte, err error)
- func AesGcmEncrypt(key, plaintext, additionalData []byte) (ciphertext []byte, err error)
- func AesGcmEncryptWithNonce(key, plaintext, additionalData []byte) (ciphertext, nonce []byte, err error)
- func GenerateAes256Key() ([]byte, error)
- func PrefixAppend000Length(b []byte) ([]byte, error)
- func PrefixUnAppend000Length(b []byte) (under, remains []byte, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AesGcmDecrypt ¶
AesGcmDecrypt similar to AesGcmDecryptWithNonce, but ciphertext is nonce-contained.
func AesGcmDecryptWithNonce ¶
func AesGcmDecryptWithNonce(key, ciphertext, nonce, additionalData []byte) (plaintext []byte, err error)
AesGcmDecryptWithNonce takes an decryption key, a ciphertext and the corresponding nonce and decrypts it with AES256 in GCM mode. Returns the plaintext string.
func AesGcmEncrypt ¶
AesGcmEncrypt similar with AesGcmEncryptWithNonce, return nonce-contained ciphertext. Use AesGcmDecrypt to decrypt.
func AesGcmEncryptWithNonce ¶
func AesGcmEncryptWithNonce(key, plaintext, additionalData []byte) (ciphertext, nonce []byte, err error)
AesGcmEncryptWithNonce takes an encryption key and a plaintext string and encrypts it with AES256 in GCM mode, which provides authenticated encryption. Returns the ciphertext and the used nonce.
func GenerateAes256Key ¶
GenerateAes256Key generate 256-bit aes symmetric key.
func PrefixAppend000Length ¶
PrefixAppend000Length max byte length is 999. []byte(b) -> 000[]byte(b)
func PrefixUnAppend000Length ¶
PrefixUnAppend000Length 000[]byte(b)[]byte(a) -> []byte(b), []byte(a)
Types ¶
This section is empty.