Documentation
¶
Overview ¶
Package encrypt is a wrapper around crypto/aes and crypto/rsa.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateKeys ¶
func GenerateKeys() (EncryptionKey, DecryptionKey, error)
GenerateKeys creates a pair of keys for encryption/decryption
Types ¶
type DecryptionKey ¶
type DecryptionKey interface {
// Decrypt decrypts ciphertext that was encrypted with corresponding encryption key.
Decrypt(CipherText) ([]byte, error)
// Encode encodes the decryption key.
Encode() string
}
DecryptionKey is used for decrypting ciphertexts encrypted with corresponding encryption key.
func NewDecryptionKey ¶
func NewDecryptionKey(text string) (DecryptionKey, error)
NewDecryptionKey creates a decryptionKey from its string representation
type EncryptionKey ¶
type EncryptionKey interface {
// Encrypt encrypts message.
Encrypt([]byte) (CipherText, error)
// Encode encodes the encryption key.
Encode() string
}
EncryptionKey is used for encrypting messages.
func NewEncryptionKey ¶
func NewEncryptionKey(text string) (EncryptionKey, error)
NewEncryptionKey creates encryptionKey from string representation
type SymmetricKey ¶
type SymmetricKey interface {
// Encrypt encrypts message.
Encrypt([]byte) (CipherText, error)
// Decrypt decrypts ciphertext that was encrypted with the key.
Decrypt(CipherText) ([]byte, error)
}
SymmetricKey is used for both encrypting and decrypting messages.
func NewSymmetricKey ¶
func NewSymmetricKey(key []byte) (SymmetricKey, error)
NewSymmetricKey creates a symmetric key for encryption/decryption.
Click to show internal directories.
Click to hide internal directories.