Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HashSHA256 ¶
HashSHA256 returns the SHA256 checksum of the data.
Types ¶
type Config ¶
type Config struct { // Cipher is the main algorithm to encrypt/decrypt text. // (e,g, AES GCM) Cipher cipher.Cipher // HSM is Hardware Security Module // (e.g. AWS KMS) HSM hsm.HSM // Hasher is hashing algorithm. // (e.g. Argon2, Scrypt) Hasher hasher.Hasher // HMACKey is the key used for signing message with HMAC. HMACKey string }
type Hierogolyph ¶
type Hierogolyph struct { Config Password string Salt string EncryptionKey string // generated by password and salt, used for encryption/decryption and verifying password. }
Hierogolyph treats encryption and decryption.
func CreateHierogolyph ¶
func CreateHierogolyph(password string, conf Config) (Hierogolyph, error)
CreateHierogolyph creates new Hierogolyph from given password, which is used for encryption. (after the first encryption, don't use this constructor.)
func (Hierogolyph) Decrypt ¶
func (h Hierogolyph) Decrypt(cipherText string) (plainText string, err error)
Decrypt decrypts given cipherText.
func (Hierogolyph) Encrypt ¶
func (h Hierogolyph) Encrypt(plainText string) (cipherText string, err error)
Encrypt encrypts given plainText.
func (*Hierogolyph) SetEncryptionKey ¶ added in v0.0.3
func (h *Hierogolyph) SetEncryptionKey() error
SetEncryptionKey sets an encryption key generated from password and salt.
func (Hierogolyph) Unlock ¶
func (h Hierogolyph) Unlock() (cek string, err error)
Unlock creates Content Encryption Key.
Click to show internal directories.
Click to hide internal directories.