Documentation
¶
Overview ¶
Package mac provides implementations of the Mac primitive.
Index ¶
- Constants
- func Config() *config
- func Factory() *factory
- func HmacSha256Tag128KeyTemplate() *tinkpb.KeyTemplate
- func HmacSha256Tag256KeyTemplate() *tinkpb.KeyTemplate
- func NewHmacKey(params *hmacpb.HmacParams, version uint32, keyValue []byte) *hmacpb.HmacKey
- func NewHmacKeyFormat(params *hmacpb.HmacParams, keySize uint32) *hmacpb.HmacKeyFormat
- func NewHmacParams(hashType commonpb.HashType, tagSize uint32) *hmacpb.HmacParams
- type HmacKeyManager
- func (km *HmacKeyManager) DoesSupport(typeURL string) bool
- func (km *HmacKeyManager) GetKeyType() string
- func (km *HmacKeyManager) GetPrimitiveFromKey(m proto.Message) (interface{}, error)
- func (km *HmacKeyManager) GetPrimitiveFromSerializedKey(serializedKey []byte) (interface{}, error)
- func (km *HmacKeyManager) NewKeyData(serializedKeyFormat []byte) (*tinkpb.KeyData, error)
- func (km *HmacKeyManager) NewKeyFromKeyFormat(m proto.Message) (proto.Message, error)
- func (km *HmacKeyManager) NewKeyFromSerializedKeyFormat(serializedKeyFormat []byte) (proto.Message, error)
Constants ¶
const ( // HmacTypeURL is the only type URL that this manager supports. HmacTypeURL = "type.googleapis.com/google.crypto.tink.HmacKey" // HmacKeyVersion is the maxmimal version of keys that this key manager supports. HmacKeyVersion = uint32(0) )
Variables ¶
This section is empty.
Functions ¶
func Config ¶
func Config() *config
Config creates an instance of config if there isn't and returns the instance.
func Factory ¶
func Factory() *factory
Factory creates an instance of factory if there isn't and returns the instance.
func HmacSha256Tag128KeyTemplate ¶
func HmacSha256Tag128KeyTemplate() *tinkpb.KeyTemplate
HmacSha256Tag128KeyTemplate is a KeyTemplate for HmacKey with the following parameters:
- Key size: 32 bytes
- Tag size: 16 bytes
- Hash function: SHA256
func HmacSha256Tag256KeyTemplate ¶
func HmacSha256Tag256KeyTemplate() *tinkpb.KeyTemplate
HmacSha256Tag256KeyTemplate is a KeyTemplate for HmacKey with the following parameters:
- Key size: 32 bytes
- Tag size: 32 bytes
- Hash function: SHA256
func NewHmacKey ¶ added in v1.1.0
NewHmacKey returns a new HmacKey.
func NewHmacKeyFormat ¶ added in v1.1.0
func NewHmacKeyFormat(params *hmacpb.HmacParams, keySize uint32) *hmacpb.HmacKeyFormat
NewHmacKeyFormat returns a new HmacKeyFormat.
func NewHmacParams ¶ added in v1.1.0
func NewHmacParams(hashType commonpb.HashType, tagSize uint32) *hmacpb.HmacParams
NewHmacParams returns a new HmacParams.
Types ¶
type HmacKeyManager ¶
type HmacKeyManager struct{}
HmacKeyManager generates new HmacKeys and produces new instances of Hmac.
func NewHmacKeyManager ¶
func NewHmacKeyManager() *HmacKeyManager
NewHmacKeyManager returns a new HmacKeyManager.
func (*HmacKeyManager) DoesSupport ¶
func (km *HmacKeyManager) DoesSupport(typeURL string) bool
DoesSupport checks whether this KeyManager supports the given key type.
func (*HmacKeyManager) GetKeyType ¶
func (km *HmacKeyManager) GetKeyType() string
GetKeyType returns the type URL of keys managed by this KeyManager.
func (*HmacKeyManager) GetPrimitiveFromKey ¶
func (km *HmacKeyManager) GetPrimitiveFromKey(m proto.Message) (interface{}, error)
GetPrimitiveFromKey constructs a HMAC instance for the given HmacKey.
func (*HmacKeyManager) GetPrimitiveFromSerializedKey ¶
func (km *HmacKeyManager) GetPrimitiveFromSerializedKey(serializedKey []byte) (interface{}, error)
GetPrimitiveFromSerializedKey constructs a Hmac instance for the given serialized HmacKey.
func (*HmacKeyManager) NewKeyData ¶
func (km *HmacKeyManager) NewKeyData(serializedKeyFormat []byte) (*tinkpb.KeyData, error)
NewKeyData generates a new KeyData according to specification in the given serialized HmacKeyFormat. This should be used solely by the key management API.
func (*HmacKeyManager) NewKeyFromKeyFormat ¶
NewKeyFromKeyFormat generates a new HmacKey according to specification in the given HmacKeyFormat.
func (*HmacKeyManager) NewKeyFromSerializedKeyFormat ¶
func (km *HmacKeyManager) NewKeyFromSerializedKeyFormat(serializedKeyFormat []byte) (proto.Message, error)
NewKeyFromSerializedKeyFormat generates a new HmacKey according to specification in the given serialized HmacKeyFormat.