Documentation ¶
Index ¶
- Constants
- type Key
- func (k Key) Decrypt(data []byte, extra ...[]byte) ([]byte, error)
- func (k Key) DecryptMarshal(s string, v interface{}, extra ...[]byte) error
- func (k Key) Encrypt(plain []byte, extra ...[]byte) ([]byte, error)
- func (k Key) EncryptMarshal(v interface{}, extra ...[]byte) (string, error)
- func (k Key) String() (string, error)
- func (k Key) Wait()
Constants ¶
View Source
const ( // CipherName is the name of the cipher as registered on symmecrypt CipherName = "hmac" // KeyLen is the number of raw bytes for a key KeyLen = 32 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Key ¶
type Key []byte
Key is a simple key which uses plain data + HMAC-sha512 for authentication
func (Key) Decrypt ¶
Decrypt checks the appended base64 HMAC-sha512 using the plaintext part + extra data, and returns the plaintext only.
func (Key) DecryptMarshal ¶
DecryptMarshal takes as parameter an opaque base64 encoded string, checks the HMAC-sha512 appended to the JSON representation, and unmarshals it into the target.
func (Key) Encrypt ¶
Encrypt appends a base64 HMAC-sha512 (with fully printable characters) calculated from the plaintext + extra data, to the plaintext.
func (Key) EncryptMarshal ¶
EncryptMarshal appends a HMAC-sha512 to the JSON representation of the object, and returns an opaque base64 encoded string.
Click to show internal directories.
Click to hide internal directories.