signature

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package signature provides implementations of the PublicKeySign and PublicKeyVerify primitives.

Index

Constants

View Source
const (
	// EcdsaSignKeyVersion is the maximum version of keys that this manager supports.
	EcdsaSignKeyVersion = 0

	// EcdsaSignTypeURL is the only type URL that this manager supports.
	EcdsaSignTypeURL = "type.googleapis.com/google.crypto.tink.EcdsaPrivateKey"
)
View Source
const (
	// EcdsaVerifyKeyVersion is the maximum version of keys that this manager supports.
	EcdsaVerifyKeyVersion = 0

	// EcdsaVerifyTypeURL is the only type URL that this manager supports.
	EcdsaVerifyTypeURL = "type.googleapis.com/google.crypto.tink.EcdsaPublicKey"
)

Variables

This section is empty.

Functions

func EcdsaP256KeyTemplate

func EcdsaP256KeyTemplate() *tinkpb.KeyTemplate

EcdsaP256KeyTemplate is a KeyTemplate of EcdsaPrivateKey with the following parameters:

  • Hash function: SHA256
  • Curve: NIST P-256
  • Signature encoding: DER

func EcdsaP384KeyTemplate

func EcdsaP384KeyTemplate() *tinkpb.KeyTemplate

EcdsaP384KeyTemplate is a KeyTemplate of EcdsaPrivateKey with the following parameters:

  • Hash function: SHA512
  • Curve: NIST P-384
  • Signature encoding: DER

func EcdsaP521KeyTemplate

func EcdsaP521KeyTemplate() *tinkpb.KeyTemplate

EcdsaP521KeyTemplate is a KeyTemplate of EcdsaPrivateKey with the following parameters:

  • Hash function: SHA512
  • Curve: NIST P-521
  • Signature encoding: DER

func GetEcdsaParamNames added in v1.1.0

func GetEcdsaParamNames(params *ecdsapb.EcdsaParams) (string, string, string)

GetEcdsaParamNames returns the string representations of each parameter in the given EcdsaParams.

func GetEcdsaSignatureEncodingName added in v1.1.0

func GetEcdsaSignatureEncodingName(encoding ecdsapb.EcdsaSignatureEncoding) string

GetEcdsaSignatureEncodingName returns the name of the EcdsaSignatureEncoding.

func GetPublicKeySignPrimitive added in v1.1.1

func GetPublicKeySignPrimitive(handle *tink.KeysetHandle) (tink.PublicKeySign, error)

GetPublicKeySignPrimitive returns a PublicKeySign primitive from the given keyset handle.

func GetPublicKeySignPrimitiveWithCustomerManager added in v1.1.1

func GetPublicKeySignPrimitiveWithCustomerManager(
	handle *tink.KeysetHandle, manager tink.KeyManager) (tink.PublicKeySign, error)

GetPublicKeySignPrimitiveWithCustomerManager returns a PublicKeySign primitive from the given keyset handle and custom key manager.

func GetPublicKeyVerifyPrimitive added in v1.1.1

func GetPublicKeyVerifyPrimitive(handle *tink.KeysetHandle) (tink.PublicKeyVerify, error)

GetPublicKeyVerifyPrimitive returns a PublicKeyVerify primitive from the given keyset handle.

func GetPublicKeyVerifyPrimitiveWithCustomerManager added in v1.1.1

func GetPublicKeyVerifyPrimitiveWithCustomerManager(
	handle *tink.KeysetHandle, manager tink.KeyManager) (tink.PublicKeyVerify, error)

GetPublicKeyVerifyPrimitiveWithCustomerManager returns a PublicKeyVerify primitive from the given keyset handle and custom key manager.

func NewEcdsaKeyFormat added in v1.1.0

func NewEcdsaKeyFormat(params *ecdsapb.EcdsaParams) *ecdsapb.EcdsaKeyFormat

NewEcdsaKeyFormat creates a EcdsaKeyFormat with the specified parameters.

func NewEcdsaParams added in v1.1.0

NewEcdsaParams creates a EcdsaParams with the specified parameters.

func NewEcdsaPrivateKey added in v1.1.0

func NewEcdsaPrivateKey(version uint32,
	publicKey *ecdsapb.EcdsaPublicKey,
	keyValue []byte) *ecdsapb.EcdsaPrivateKey

NewEcdsaPrivateKey creates a EcdsaPrivateKey with the specified paramaters.

func NewEcdsaPublicKey added in v1.1.0

func NewEcdsaPublicKey(version uint32,
	params *ecdsapb.EcdsaParams,
	x []byte, y []byte) *ecdsapb.EcdsaPublicKey

NewEcdsaPublicKey creates a EcdsaPublicKey with the specified paramaters.

func RegisterKeyManager added in v1.1.1

func RegisterKeyManager(keyManager tink.KeyManager) (bool, error)

RegisterKeyManager registers the given keyManager for the key type given in keyManager.KeyType(). It returns true if registration was successful, false if there already exisits a key manager for the key type.

func RegisterStandardKeyTypes added in v1.1.1

func RegisterStandardKeyTypes() (bool, error)

RegisterStandardKeyTypes registers standard Aead key types and their managers with the Registry.

Types

type EcdsaSignKeyManager

type EcdsaSignKeyManager struct{}

EcdsaSignKeyManager is an implementation of KeyManager interface. It generates new EcdsaPrivateKeys and produces new instances of EcdsaSign subtle.

func NewEcdsaSignKeyManager

func NewEcdsaSignKeyManager() *EcdsaSignKeyManager

NewEcdsaSignKeyManager creates a new EcdsaSignKeyManager.

func (*EcdsaSignKeyManager) DoesSupport

func (km *EcdsaSignKeyManager) DoesSupport(typeURL string) bool

DoesSupport indicates if this key manager supports the given key type.

func (*EcdsaSignKeyManager) GetKeyType

func (km *EcdsaSignKeyManager) GetKeyType() string

GetKeyType returns the key type of keys managed by this key manager.

func (*EcdsaSignKeyManager) GetPrimitiveFromKey

func (km *EcdsaSignKeyManager) GetPrimitiveFromKey(m proto.Message) (interface{}, error)

GetPrimitiveFromKey creates an EcdsaSign subtle for the given EcdsaPrivateKey proto.

func (*EcdsaSignKeyManager) GetPrimitiveFromSerializedKey

func (km *EcdsaSignKeyManager) GetPrimitiveFromSerializedKey(serializedKey []byte) (interface{}, error)

GetPrimitiveFromSerializedKey creates an EcdsaSign subtle for the given serialized EcdsaPrivateKey proto.

func (*EcdsaSignKeyManager) GetPublicKeyData

func (km *EcdsaSignKeyManager) GetPublicKeyData(serializedPrivKey []byte) (*tinkpb.KeyData, error)

GetPublicKeyData extracts the public key data from the private key.

func (*EcdsaSignKeyManager) NewKeyData

func (km *EcdsaSignKeyManager) NewKeyData(serializedKeyFormat []byte) (*tinkpb.KeyData, error)

NewKeyData creates a new KeyData according to specification in the given serialized EcdsaKeyFormat. It should be used solely by the key management API.

func (*EcdsaSignKeyManager) NewKeyFromKeyFormat

func (km *EcdsaSignKeyManager) NewKeyFromKeyFormat(m proto.Message) (proto.Message, error)

NewKeyFromKeyFormat creates a new key according to specification in the given EcdsaKeyFormat.

func (*EcdsaSignKeyManager) NewKeyFromSerializedKeyFormat

func (km *EcdsaSignKeyManager) NewKeyFromSerializedKeyFormat(serializedKeyFormat []byte) (proto.Message, error)

NewKeyFromSerializedKeyFormat creates a new EcdsaPrivateKey according to specification the given serialized EcdsaKeyFormat.

type EcdsaVerifyKeyManager

type EcdsaVerifyKeyManager struct{}

EcdsaVerifyKeyManager is an implementation of KeyManager interface. It doesn't support key generation.

func NewEcdsaVerifyKeyManager

func NewEcdsaVerifyKeyManager() *EcdsaVerifyKeyManager

NewEcdsaVerifyKeyManager creates a new EcdsaVerifyKeyManager.

func (*EcdsaVerifyKeyManager) DoesSupport

func (km *EcdsaVerifyKeyManager) DoesSupport(typeURL string) bool

DoesSupport indicates if this key manager supports the given key type.

func (*EcdsaVerifyKeyManager) GetKeyType

func (km *EcdsaVerifyKeyManager) GetKeyType() string

GetKeyType returns the key type of keys managed by this key manager.

func (*EcdsaVerifyKeyManager) GetPrimitiveFromKey

func (km *EcdsaVerifyKeyManager) GetPrimitiveFromKey(m proto.Message) (interface{}, error)

GetPrimitiveFromKey creates an EcdsaVerify subtle for the given EcdsaPublicKey proto.

func (*EcdsaVerifyKeyManager) GetPrimitiveFromSerializedKey

func (km *EcdsaVerifyKeyManager) GetPrimitiveFromSerializedKey(serializedKey []byte) (interface{}, error)

GetPrimitiveFromSerializedKey creates an EcdsaVerify subtle for the given serialized EcdsaPublicKey proto.

func (*EcdsaVerifyKeyManager) NewKeyData

func (km *EcdsaVerifyKeyManager) NewKeyData(serializedKeyFormat []byte) (*tinkpb.KeyData, error)

NewKeyData creates a new KeyData according to specification in the given serialized EcdsaKeyFormat. It should be used solely by the key management API.

func (*EcdsaVerifyKeyManager) NewKeyFromKeyFormat

func (km *EcdsaVerifyKeyManager) NewKeyFromKeyFormat(m proto.Message) (proto.Message, error)

NewKeyFromKeyFormat is not implemented

func (*EcdsaVerifyKeyManager) NewKeyFromSerializedKeyFormat

func (km *EcdsaVerifyKeyManager) NewKeyFromSerializedKeyFormat(serializedKeyFormat []byte) (proto.Message, error)

NewKeyFromSerializedKeyFormat is not implemented

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL