Documentation ¶
Index ¶
- Constants
- Variables
- func GCMDecrypt(key AESKey, ciphertext []byte) ([]byte, error)
- func GCMEncrypt(key AESKey, plaintext []byte) ([]byte, error)
- func RSADecrypt(ciphertext []byte, privateKey *rsa.PrivateKey) ([]byte, error)
- func RSAEncrypt(msg []byte, pub *rsa.PublicKey) ([]byte, error)
- type AESIV
- type AESKey
Constants ¶
View Source
const ( // AESKeySize - Always use 256 bit keys AESKeySize = 16 // GCMNonceSize - 96 bit nonces for GCM GCMNonceSize = 12 )
Variables ¶
View Source
var ( // ErrInvalidKeyLength - Invalid key length ErrInvalidKeyLength = errors.New("Invalid length") )
Functions ¶
func GCMDecrypt ¶
GCMDecrypt - Decrypt GCM ciphertext
func GCMEncrypt ¶
GCMEncrypt - Encrypt using AES GCM
func RSADecrypt ¶
func RSADecrypt(ciphertext []byte, privateKey *rsa.PrivateKey) ([]byte, error)
RSADecrypt - Decrypt ciphertext with rsa private key
Types ¶
type AESKey ¶
type AESKey [AESKeySize]byte
AESKey - 256 bit key
func AESKeyFromBytes ¶
AESKeyFromBytes - Convert byte slice to AESKey
func RandomAESKey ¶
func RandomAESKey() AESKey
RandomAESKey - Generate random ID of randomIDSize bytes
Click to show internal directories.
Click to hide internal directories.