kmscrypto

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2021 License: AGPL-3.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesGcmDecrypt

func AesGcmDecrypt(key, ciphertext, additionalData []byte) (plaintext []byte, err error)

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

func AesGcmEncrypt(key, plaintext, additionalData []byte) (ciphertext []byte, err error)

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

func GenerateAes256Key() ([]byte, error)

GenerateAes256Key generate 256-bit aes symmetric key.

func PrefixAppend000Length

func PrefixAppend000Length(b []byte) ([]byte, error)

PrefixAppend000Length max byte length is 999. []byte(b) -> 000[]byte(b)

func PrefixUnAppend000Length

func PrefixUnAppend000Length(b []byte) (under, remains []byte, err error)

PrefixUnAppend000Length 000[]byte(b)[]byte(a) -> []byte(b), []byte(a)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL