Package encrypt provides simplified utilities to encrypt and decrypt data using standard libraries.
const ( // AES128Bits is the number of bits in an AES-128 key. AES128Bits = 128 // AES192Bits is the number of bits in an AES-192 key. AES192Bits = 192 // AES256Bits is the number of bits in an AES-256 key. AES256Bits = 256 // RSA2048Bits is the number of bits in a 2048-bit RSA key. RSA2048Bits = 2048 )
DecodeString is a simple wrapper for base64 decoding.
EncodeToString is a simple wrapper for base64 encoding.
GenerateAESKey generates a new AES key for the given number of bits. The returned key will be base64 encoded.
GenerateRSAKeys generates a new public and private (in that order of returned values) key.
Decryptor decrypts data.
Encryptor encrypts data.
NewRSAEncryptor returns a new RSA Encryptor with the given public key.
Transformer is both an Encryptor and Decryptor.
NewAESTransformer creates a new AES Transformer with the given base64 encoded key.
NewRSATransformer returns a new RSA Transformer with the given private key.