kmscrypto

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2021 License: Apache-2.0 Imports: 6 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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