Documentation
¶
Overview ¶
Package xchacha20poly1305 provides a Tink key manager for XChaCha20Poly1305 keys.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterKeyManager ¶
func RegisterKeyManager(c config, t internalapi.Token) error
RegisterKeyManager accepts a config object and registers an instance of an X-CHACHA20-POLY1305 AEAD KeyManager to the provided config.
It is *NOT* part of the public API.
func RegisterPrimitiveConstructor ¶
func RegisterPrimitiveConstructor(c config, t internalapi.Token) error
RegisterPrimitiveConstructor accepts a config object and registers the X-CHACHA20-POLY1305 AEAD primitive constructor to the provided config.
It is *NOT* part of the public API.
Types ¶
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
Key represents a XChaCha20-Poly1305 key.
func NewKey ¶
func NewKey(keyBytes secretdata.Bytes, idRequirement uint32, parameters *Parameters) (*Key, error)
NewKey creates a new xchacha20poly1305.Key key with key, idRequirement and parameters.
func (*Key) IDRequirement ¶
IDRequirement returns the key ID and whether it is required or not.
If not required, the returned key ID is not usable.
func (*Key) KeyBytes ¶
func (k *Key) KeyBytes() secretdata.Bytes
KeyBytes returns the key material.
This function provides access to partial key material. See https://developers.google.com/tink/design/access_control#access_of_parts_of_a_key for more information.
func (*Key) OutputPrefix ¶
OutputPrefix returns the output prefix.
func (*Key) Parameters ¶
func (k *Key) Parameters() key.Parameters
Parameters returns the parameters of this key.
type Parameters ¶
type Parameters struct {
// contains filtered or unexported fields
}
Parameters specifies a XChaCha20-Poly1305 key.
func NewParameters ¶
func NewParameters(variant Variant) (*Parameters, error)
NewParameters creates a new XChaCha20-Poly1305 Parameters object.
func (*Parameters) Equal ¶
func (p *Parameters) Equal(other key.Parameters) bool
Equal returns whether this Parameters object is equal to other.
func (*Parameters) HasIDRequirement ¶
func (p *Parameters) HasIDRequirement() bool
HasIDRequirement returns whether the key has an ID requirement.
func (*Parameters) Variant ¶
func (p *Parameters) Variant() Variant
Variant returns the variant of the key.
type Variant ¶
type Variant int
Variant is the prefix variant of XChaCha20-Poly1305 keys.
It describes how the prefix of the ciphertext is constructed. For AEAD there are three options:
* TINK: prepends '0x01<big endian key id>' to the ciphertext. * CRUNCHY: prepends '0x00<big endian key id>' to the ciphertext. * NO_PREFIX: adds no prefix to the ciphertext.
const ( // VariantUnknown is the default and invalid value of Variant. VariantUnknown Variant = iota // VariantTink prefixes '0x01<big endian key id>' to the ciphertext. VariantTink // VariantCrunchy prefixes '0x00<big endian key id>' to the ciphertext. VariantCrunchy // VariantNoPrefix adds no prefix to the ciphertext. VariantNoPrefix )