Documentation
¶
Index ¶
Constants ¶
View Source
const ( KeySize = aes.BlockSize // NonceSize is standard nonce size for GCM (unexported in cipher package) NonceSize = 12 // TagSize is standard auth tag size for GCM (unexported in cipher package) TagSize = 16 )
View Source
const ( DefaultRecordSize uint32 = 4096 DefaultKeyLabel string = "P-256" )
Variables ¶
View Source
var ( ErrInvalidDH = fmt.Errorf("dh sequence is invalid") ErrTruncated = fmt.Errorf("content truncated") ErrInvalidPadding = fmt.Errorf("invalid padding") )
View Source
var ( ErrInvalidKeySize = fmt.Errorf("invalid static key length") ErrInvalidSaltSize = fmt.Errorf("invaild salt size") )
Functions ¶
func WithAuthSecret ¶
func WithAuthSecret(authSecret []byte) engineOption
WithAuthSecret specifies auth secret for shared key derivation
func WithKeyLabel ¶
func WithKeyLabel(keyLabel string) engineOption
WithKeyLabel sets a key label to use
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine represents encryption and decryption engine
type KeyLookupFunc ¶
type KeyLookupFunc func(keyID []byte) *ecdsa.PrivateKey
KeyLookupFunc is a function that fetches a private key by provided keyID It must always return non-nil value even if input is nil
func SingleKey ¶
func SingleKey(key *ecdsa.PrivateKey) KeyLookupFunc
type Version ¶
type Version string
Version determines encoding mode
const ( // AES128GCM is a newest and recommended for usage, also used as default if not specified explicitly AES128GCM Version = "aes128gcm" // AESGCM is a widely used version (i.e. in Firebase Cloud Messaging) AESGCM Version = "aesgcm" // AESGCM128 is a legacy version but sometimes used AESGCM128 Version = "aesgcm128" )
Available content-encoding versions
Click to show internal directories.
Click to hide internal directories.