Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AESBitSize ¶
type AESBitSize int
AESBitSize is the bit size option for AES encryption
const ( AES128 AESBitSize = iota AES192 AES256 )
func (AESBitSize) KeySize ¶
func (a AESBitSize) KeySize() int
KeySize is the size of key required for the given bit size
AES-128 = 16 characters AES-192 = 24 characters AES-256 = 32 characters
type AESEncryptor ¶
type AESEncryptor struct {
// contains filtered or unexported fields
}
func NewAESEncryptor ¶
func NewAESEncryptor(bitSize AESBitSize) *AESEncryptor
NewAESEncryptor generates a new AES encryptor
func (*AESEncryptor) Decrypt ¶
func (e *AESEncryptor) Decrypt(encryptedBytes []byte, key []byte) ([]byte, error)
Decrypt decrypts a []byte using a given key.
func (*AESEncryptor) Encrypt ¶
func (e *AESEncryptor) Encrypt(inputBytes []byte) ([]byte, []byte, error)
Encrypt encrypts an input []byte and generates a random key. This function will return the encrypted input []byte and a key also as []byte.
func (*AESEncryptor) EncryptWithPassword ¶
func (e *AESEncryptor) EncryptWithPassword(inputBytes []byte, password []byte) ([]byte, error)
EncryptWithPassword encrypts a []byte with a given password. The []byte will only be able to be decrypted by using the given password as a key.
func (*AESEncryptor) GenerateKey ¶
func (e *AESEncryptor) GenerateKey() []byte
GenerateKey generates a random key with the correct length for the chosen bit size.
AES-128 = 16 characters AES-192 = 24 characters AES-256 = 32 characters
Click to show internal directories.
Click to hide internal directories.