Documentation ¶
Index ¶
- func MustRandomString(keyLen int) string
- func NewFactoryAEAD(keyLen int, cipherFactory cipherFactoryFunc) symmecrypt.KeyFactory
- func NewFactoryAEADMutex(keyLen int, cipherFactory cipherFactoryFunc) symmecrypt.KeyFactory
- func NewKeyAEAD(rawkey []byte, keyLen int, factory cipherFactoryFunc) (symmecrypt.Key, error)
- func NewKeySequenceAEAD(rawkey []byte, keyLen int, factory cipherFactoryFunc) (symmecrypt.Key, error)
- func NewRandomKeyAEAD(keyLen int, factory cipherFactoryFunc) (symmecrypt.Key, error)
- func Random(keyLen int) ([]byte, error)
- func RandomSalt() string
- func RawKey(b []byte, keyLen int) ([]byte, error)
- type KeyAEAD
- func (b KeyAEAD) Decrypt(text []byte, extra ...[]byte) ([]byte, error)
- func (b KeyAEAD) DecryptMarshal(s string, target interface{}, extra ...[]byte) error
- func (b *KeyAEAD) Encrypt(text []byte, extra ...[]byte) ([]byte, error)
- func (b KeyAEAD) EncryptMarshal(i interface{}, extra ...[]byte) (string, error)
- func (b KeyAEAD) String() (string, error)
- func (b KeyAEAD) Wait()
- type KeyMutex
- func (k *KeyMutex) Decrypt(text []byte, extra ...[]byte) ([]byte, error)
- func (k *KeyMutex) DecryptMarshal(s string, target interface{}, extra ...[]byte) error
- func (k *KeyMutex) Encrypt(text []byte, extra ...[]byte) ([]byte, error)
- func (k *KeyMutex) EncryptMarshal(i interface{}, extra ...[]byte) (string, error)
- func (k *KeyMutex) String() (string, error)
- func (k *KeyMutex) Wait()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustRandomString ¶ added in v0.5.0
MustRandomString returns a random string of len keyLen.
func NewFactoryAEAD ¶
func NewFactoryAEAD(keyLen int, cipherFactory cipherFactoryFunc) symmecrypt.KeyFactory
NewFactoryAEAD returns a symmecrypt.KeyFactory that can be registered to symmecrypt.RegisterCipher. It accepts a key length and a function that returns a cipher.AEAD. This allows very easy symmecrypt implementations of any cipher that respects the AEAD interface.
func NewFactoryAEADMutex ¶
func NewFactoryAEADMutex(keyLen int, cipherFactory cipherFactoryFunc) symmecrypt.KeyFactory
func NewKeyAEAD ¶
func NewKeyAEAD(rawkey []byte, keyLen int, factory cipherFactoryFunc) (symmecrypt.Key, error)
func NewKeySequenceAEAD ¶ added in v0.5.0
func NewKeySequenceAEAD(rawkey []byte, keyLen int, factory cipherFactoryFunc) (symmecrypt.Key, error)
func NewRandomKeyAEAD ¶
func NewRandomKeyAEAD(keyLen int, factory cipherFactoryFunc) (symmecrypt.Key, error)
NewRandomKeyAEAD needs the desired key length, and an AEAD cipher factory.
func RandomSalt ¶ added in v0.5.0
func RandomSalt() string
Types ¶
type KeyAEAD ¶
type KeyAEAD struct {
// contains filtered or unexported fields
}
KeyAEAD is a base implementation of a symmecrypt key that uses AEAD ciphers. It transforms any AEAD cipher factory into a full-fledged symmecrypt key implementation.
func (KeyAEAD) DecryptMarshal ¶
DecryptMarshal decrypts the marshaled representation of an arbitrary object. Extra data can be passed for MAC.
func (KeyAEAD) EncryptMarshal ¶
EncryptMarshal encrypts the marshaled representation of an arbitrary object. Extra data can be passed for MAC.
type KeyMutex ¶
type KeyMutex struct { Key symmecrypt.Key // contains filtered or unexported fields }
KeyMutex wraps a symmecrypt Key with a mutex to protect unsafe concurrent implementations