Documentation ¶
Overview ¶
Package testutil provides test utilities.
Index ¶
- func NewAesGcmKey(keySize uint32) *gcmpb.AesGcmKey
- func NewAesGcmKeyData(keySize uint32) *tinkpb.KeyData
- func NewDummyKey(keyID int, status tinkpb.KeyStatusType, ...) *tinkpb.Keyset_Key
- func NewEcdsaPrivateKey(hashType commonpb.HashType, curve commonpb.EllipticCurveType) *ecdsapb.EcdsaPrivateKey
- func NewEcdsaPrivateKeyData(hashType commonpb.HashType, curve commonpb.EllipticCurveType) *tinkpb.KeyData
- func NewEcdsaPublicKey(hashType commonpb.HashType, curve commonpb.EllipticCurveType) *ecdsapb.EcdsaPublicKey
- func NewHmacKey(hashType commonpb.HashType, tagSize uint32) *hmacpb.HmacKey
- func NewHmacKeyData(hashType commonpb.HashType, tagSize uint32) *tinkpb.KeyData
- func NewHmacKeyFormat(hashType commonpb.HashType, tagSize uint32) *hmacpb.HmacKeyFormat
- func NewHmacKeysetManager() *tink.KeysetManager
- func NewSerializedAesGcmKey(keySize uint32) []byte
- func NewTestAesGcmKeyset(primaryOutputPrefixType tinkpb.OutputPrefixType) *tinkpb.Keyset
- func NewTestHmacKeyset(tagSize uint32, primaryOutputPrefixType tinkpb.OutputPrefixType) *tinkpb.Keyset
- func NewTestKeyset(keyData *tinkpb.KeyData, primaryOutputPrefixType tinkpb.OutputPrefixType) *tinkpb.Keyset
- type DummyAead
- type DummyAeadKeyManager
- func (km *DummyAeadKeyManager) DoesSupport(typeURL string) bool
- func (km *DummyAeadKeyManager) GetKeyType() string
- func (km *DummyAeadKeyManager) GetPrimitiveFromKey(m proto.Message) (interface{}, error)
- func (km *DummyAeadKeyManager) GetPrimitiveFromSerializedKey(serializedKey []byte) (interface{}, error)
- func (km *DummyAeadKeyManager) NewKeyData(serializedKeyFormat []byte) (*tinkpb.KeyData, error)
- func (km *DummyAeadKeyManager) NewKeyFromKeyFormat(m proto.Message) (proto.Message, error)
- func (km *DummyAeadKeyManager) NewKeyFromSerializedKeyFormat(serializedKeyFormat []byte) (proto.Message, error)
- type DummyMac
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAesGcmKey ¶
NewAesGcmKey creates a randomly generated AesGcmKey.
func NewAesGcmKeyData ¶
NewAesGcmKeyData creates a KeyData containing a randomly generated AesGcmKey.
func NewDummyKey ¶
func NewDummyKey(keyID int, status tinkpb.KeyStatusType, outputPrefixType tinkpb.OutputPrefixType) *tinkpb.Keyset_Key
NewDummyKey returns a dummy key that doesn't contain actual key material.
func NewEcdsaPrivateKey ¶
func NewEcdsaPrivateKey(hashType commonpb.HashType, curve commonpb.EllipticCurveType) *ecdsapb.EcdsaPrivateKey
NewEcdsaPrivateKey creates an EcdsaPrivateKey with a randomly generated key material.
func NewEcdsaPrivateKeyData ¶
func NewEcdsaPrivateKeyData(hashType commonpb.HashType, curve commonpb.EllipticCurveType) *tinkpb.KeyData
NewEcdsaPrivateKeyData creates a KeyData containing an EcdsaPrivateKey with a randomly generated key material.
func NewEcdsaPublicKey ¶
func NewEcdsaPublicKey(hashType commonpb.HashType, curve commonpb.EllipticCurveType) *ecdsapb.EcdsaPublicKey
NewEcdsaPublicKey creates an EcdsaPublicKey with the specified parameters.
func NewHmacKey ¶
NewHmacKey creates a new HmacKey with the specified parameters.
func NewHmacKeyData ¶
NewHmacKeyData returns a new KeyData that contains a HmacKey.
func NewHmacKeyFormat ¶
func NewHmacKeyFormat(hashType commonpb.HashType, tagSize uint32) *hmacpb.HmacKeyFormat
NewHmacKeyFormat creates a new HmacKeyFormat with the specified parameters.
func NewHmacKeysetManager ¶
func NewHmacKeysetManager() *tink.KeysetManager
NewHmacKeysetManager returns a new KeysetManager that contains a HmacKey.
func NewSerializedAesGcmKey ¶
NewSerializedAesGcmKey creates a AesGcmKey with randomly generated key material.
func NewTestAesGcmKeyset ¶
func NewTestAesGcmKeyset(primaryOutputPrefixType tinkpb.OutputPrefixType) *tinkpb.Keyset
NewTestAesGcmKeyset creates a new Keyset containing an AesGcmKey.
func NewTestHmacKeyset ¶
func NewTestHmacKeyset(tagSize uint32, primaryOutputPrefixType tinkpb.OutputPrefixType) *tinkpb.Keyset
NewTestHmacKeyset creates a new Keyset containing a HmacKey.
func NewTestKeyset ¶
func NewTestKeyset(keyData *tinkpb.KeyData, primaryOutputPrefixType tinkpb.OutputPrefixType) *tinkpb.Keyset
NewTestKeyset creates a new test Keyset.
Types ¶
type DummyAead ¶
type DummyAead struct{}
DummyAead is a dummy implementation of Aead interface.
type DummyAeadKeyManager ¶
type DummyAeadKeyManager struct{}
DummyAeadKeyManager is a dummy implementation of the KeyManager interface. It returns DummyAead when GetPrimitive() functions are called.
func (*DummyAeadKeyManager) DoesSupport ¶
func (km *DummyAeadKeyManager) DoesSupport(typeURL string) bool
DoesSupport returns true iff this KeyManager supports key type identified by {@code typeURL}.
func (*DummyAeadKeyManager) GetKeyType ¶
func (km *DummyAeadKeyManager) GetKeyType() string
GetKeyType returns the type URL.
func (*DummyAeadKeyManager) GetPrimitiveFromKey ¶
func (km *DummyAeadKeyManager) GetPrimitiveFromKey(m proto.Message) (interface{}, error)
GetPrimitiveFromKey constructs a primitive instance for the key given in {@code key}.
func (*DummyAeadKeyManager) GetPrimitiveFromSerializedKey ¶
func (km *DummyAeadKeyManager) GetPrimitiveFromSerializedKey(serializedKey []byte) (interface{}, error)
GetPrimitiveFromSerializedKey constructs a primitive instance for the key given in serializedKey, which must be a serialized key protocol buffer handled by this manager.
func (*DummyAeadKeyManager) NewKeyData ¶
func (km *DummyAeadKeyManager) NewKeyData(serializedKeyFormat []byte) (*tinkpb.KeyData, error)
NewKeyData generates a new {@code KeyData} according to specification in {@code serializedkeyFormat}.
func (*DummyAeadKeyManager) NewKeyFromKeyFormat ¶
NewKeyFromKeyFormat generates a new key according to specification in {@code keyFormat}.
func (*DummyAeadKeyManager) NewKeyFromSerializedKeyFormat ¶
func (km *DummyAeadKeyManager) NewKeyFromSerializedKeyFormat(serializedKeyFormat []byte) (proto.Message, error)
NewKeyFromSerializedKeyFormat Generates a new key according to specification in {@code serializedKeyFormat}, which must be a serialized key format protocol buffer handled by this manager.
type DummyMac ¶
type DummyMac struct {
Name string
}
DummyMac is a dummy implementation of Mac interface.
func (*DummyMac) ComputeMac ¶
ComputeMac Computes message authentication code (MAC) for {@code data}.