Documentation ¶
Index ¶
- func Decrypt(password []byte, data []byte) ([]byte, error)
- func Encrypt(cipherType CipherType, password []byte, data []byte) ([]byte, error)
- type AES256Cipher
- type Cipher
- type CipherType
- type DataIsEncryptedError
- type DataIsNotEncryptedError
- type SerpentCipher
- type TwofishCipher
- type UnknownCipherNameError
- type UnknownCipherTypeError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AES256Cipher ¶
type AES256Cipher struct {
// contains filtered or unexported fields
}
AES256Cipher encrypts using AES256-GCM
func (*AES256Cipher) Decrypt ¶
func (c *AES256Cipher) Decrypt(data []byte, password []byte) ([]byte, error)
Decrypt data using AES256-GCM cipher. This both hides the content of the data and provides a check that it hasn't been altered. Expects input form nonce|ciphertext|tag|salt where '|' indicates concatenation.
func (*AES256Cipher) Encrypt ¶
func (c *AES256Cipher) Encrypt(data []byte, password []byte) ([]byte, error)
Encrypt data using AES256-GCM cipher. This both hides the content of the data and provides a check that it hasn't been altered. Output takes the form nonce|ciphertext|tag|salt where '|' indicates concatenation.
func (*AES256Cipher) GetDescription ¶
func (c *AES256Cipher) GetDescription() string
GetDescription returns description string
func (*AES256Cipher) GetType ¶
func (c *AES256Cipher) GetType() CipherType
GetType returns CryptType
type Cipher ¶
type Cipher interface { Encrypt(data []byte, password []byte) ([]byte, error) Decrypt(data []byte, password []byte) ([]byte, error) GetDescription() string GetName() string GetType() CipherType }
Cipher interface represents a en/decrypting module
type CipherType ¶
type CipherType uint8
CipherType is the cipher type
const ( Unknown CipherType = iota AES256 TWOFISH SERPENT )
cipher types
func GetCipherTypeByName ¶
func GetCipherTypeByName(name string) (c CipherType, err error)
GetCipherTypeByName gets the CipherType by name
type DataIsEncryptedError ¶
type DataIsEncryptedError struct {
// contains filtered or unexported fields
}
DataIsEncryptedError when trying to encrypt already encrypted data
func NewDataIsEcryptedError ¶
func NewDataIsEcryptedError() *DataIsEncryptedError
NewDataIsEcryptedError returns a new error
func (*DataIsEncryptedError) Error ¶
func (e *DataIsEncryptedError) Error() string
type DataIsNotEncryptedError ¶
type DataIsNotEncryptedError struct {
// contains filtered or unexported fields
}
DataIsNotEncryptedError when trying to decrypt data that is not encrypted
func NewDataIsNotEncryptedError ¶
func NewDataIsNotEncryptedError() *DataIsNotEncryptedError
NewDataIsNotEncryptedError returns a new error
func (*DataIsNotEncryptedError) Error ¶
func (e *DataIsNotEncryptedError) Error() string
type SerpentCipher ¶
type SerpentCipher struct {
// contains filtered or unexported fields
}
SerpentCipher encrypts using Serpent-GCM
func (*SerpentCipher) Decrypt ¶
func (c *SerpentCipher) Decrypt(data []byte, password []byte) ([]byte, error)
Decrypt data using Serpent-GCM cipher. This both hides the content of the data and provides a check that it hasn't been altered. Expects input form nonce|ciphertext|tag|salt where '|' indicates concatenation.
func (*SerpentCipher) Encrypt ¶
func (c *SerpentCipher) Encrypt(data []byte, password []byte) ([]byte, error)
Encrypt data using the Serpent-GCM cipher. Output takes the form nonce|ciphertext|tag|salt where '|' indicates concatenation.
func (*SerpentCipher) GetDescription ¶
func (c *SerpentCipher) GetDescription() string
GetDescription returns description string
func (*SerpentCipher) GetName ¶
func (c *SerpentCipher) GetName() string
GetName returns name string
func (*SerpentCipher) GetType ¶
func (c *SerpentCipher) GetType() CipherType
GetType returns CryptType
type TwofishCipher ¶
type TwofishCipher struct {
// contains filtered or unexported fields
}
TwofishCipher encrypts using Twofish-GCM
func (*TwofishCipher) Decrypt ¶
func (c *TwofishCipher) Decrypt(data []byte, password []byte) ([]byte, error)
Decrypt data using Twofish-GCM cipher. This both hides the content of the data and provides a check that it hasn't been altered. Expects input form nonce|ciphertext|tag|salt where '|' indicates concatenation.
func (*TwofishCipher) Encrypt ¶
func (c *TwofishCipher) Encrypt(data []byte, password []byte) ([]byte, error)
Encrypt data using the Twofish-GCM cipher. Output takes the form nonce|ciphertext|tag|salt where '|' indicates concatenation.
func (*TwofishCipher) GetDescription ¶
func (c *TwofishCipher) GetDescription() string
GetDescription returns description string
func (*TwofishCipher) GetName ¶
func (c *TwofishCipher) GetName() string
GetName returns name string
func (*TwofishCipher) GetType ¶
func (c *TwofishCipher) GetType() CipherType
GetType returns CryptType
type UnknownCipherNameError ¶
type UnknownCipherNameError struct {
// contains filtered or unexported fields
}
UnknownCipherNameError when cipher name is not known
func NewUnknownCipherNameError ¶
func NewUnknownCipherNameError() *UnknownCipherNameError
NewUnknownCipherNameError returns a new error
func (*UnknownCipherNameError) Error ¶
func (e *UnknownCipherNameError) Error() string
type UnknownCipherTypeError ¶
type UnknownCipherTypeError struct {
// contains filtered or unexported fields
}
UnknownCipherTypeError when cipher name is not known
func NewUnknownCipherTypeError ¶
func NewUnknownCipherTypeError() *UnknownCipherTypeError
NewUnknownCipherTypeError returns a new error
func (*UnknownCipherTypeError) Error ¶
func (e *UnknownCipherTypeError) Error() string