Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalid = errors.New("tuf: signature verification failed") ErrInvalidKey = errors.New("invalid key") )
View Source
var SignerMap sync.Map
SignerMap stores mapping between key type strings and signer constructors.
View Source
var VerifierMap sync.Map
Verifier stores mapping between key type strings and verifier constructors.
Functions ¶
func GenerateEd25519Key ¶
func GenerateEd25519Key() (*ed25519Signer, error)
func GenerateRsaKey ¶
func GenerateRsaKey() (*rsaSigner, error)
func NewEd25519Signer ¶
func NewEd25519Signer(keyValue Ed25519PrivateKeyValue) *ed25519Signer
Types ¶
type Ed25519PrivateKeyValue ¶
type Signer ¶
type Signer interface { // MarshalPrivateKey returns the private key data. MarshalPrivateKey() (*data.PrivateKey, error) // UnmarshalPrivateKey takes private key data to a working Signer implementation for the key type. UnmarshalPrivateKey(key *data.PrivateKey) error // Returns the public data.PublicKey from the private key PublicData() *data.PublicKey // Sign returns the signature of the message. // The signer is expected to do its own hashing, so the full message will be // provided as the message to Sign with a zero opts.HashFunc(). SignMessage(message []byte) ([]byte, error) }
func NewP256Signer ¶
func NewP256Signer() Signer
func NewRsaSigner ¶
func NewRsaSigner() Signer
type Verifier ¶
type Verifier interface { // UnmarshalPublicKey takes key data to a working verifier implementation for the key type. // This performs any validation over the data.PublicKey to ensure that the verifier is usable // to verify signatures. UnmarshalPublicKey(key *data.PublicKey) error // MarshalPublicKey returns the data.PublicKey object associated with the verifier. MarshalPublicKey() *data.PublicKey // This is the public string used as a unique identifier for the verifier instance. Public() string // Verify takes a message and signature, all as byte slices, // and determines whether the signature is valid for the given // key and message. Verify(msg, sig []byte) error }
A Verifier verifies public key signatures.
func NewEcdsaVerifier ¶
func NewEcdsaVerifier() Verifier
func NewP256Verifier ¶
func NewP256Verifier() Verifier
func NewRsaVerifier ¶
func NewRsaVerifier() Verifier
Click to show internal directories.
Click to hide internal directories.