Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateEcdsaKey() (*ecdsaSigner, error)
- func GenerateEd25519Key() (*ed25519Signer, error)
- func GenerateRsaKey() (*rsaSigner, error)
- func NewEd25519SignerFromKey(keyValue Ed25519PrivateKeyValue) *ed25519Signer
- type EcdsaVerifier
- type Ed25519PrivateKeyValue
- type PKIXPublicKey
- type Signer
- type Verifier
Constants ¶
View Source
const MaxJSONKeySize = 512 * 1024 // 512Kb
MaxJSONKeySize defines the maximum length of a JSON payload.
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 GenerateEcdsaKey ¶ added in v0.5.0
func GenerateEcdsaKey() (*ecdsaSigner, error)
func GenerateEd25519Key ¶
func GenerateEd25519Key() (*ed25519Signer, error)
func GenerateRsaKey ¶
func GenerateRsaKey() (*rsaSigner, error)
func NewEd25519SignerFromKey ¶ added in v0.3.2
func NewEd25519SignerFromKey(keyValue Ed25519PrivateKeyValue) *ed25519Signer
Types ¶
type EcdsaVerifier ¶ added in v0.5.0
type EcdsaVerifier struct { PublicKey *PKIXPublicKey `json:"public"` // contains filtered or unexported fields }
func (*EcdsaVerifier) MarshalPublicKey ¶ added in v0.5.0
func (p *EcdsaVerifier) MarshalPublicKey() *data.PublicKey
func (*EcdsaVerifier) Public ¶ added in v0.5.0
func (p *EcdsaVerifier) Public() string
func (*EcdsaVerifier) UnmarshalPublicKey ¶ added in v0.5.0
func (p *EcdsaVerifier) UnmarshalPublicKey(key *data.PublicKey) error
func (*EcdsaVerifier) Verify ¶ added in v0.5.0
func (p *EcdsaVerifier) Verify(msg, sigBytes []byte) error
type Ed25519PrivateKeyValue ¶
type PKIXPublicKey ¶ added in v0.5.0
func (*PKIXPublicKey) MarshalJSON ¶ added in v0.5.0
func (p *PKIXPublicKey) MarshalJSON() ([]byte, error)
func (*PKIXPublicKey) UnmarshalJSON ¶ added in v0.5.0
func (p *PKIXPublicKey) UnmarshalJSON(b []byte) error
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 NewEd25519Signer ¶
func NewEd25519Signer() 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 NewDeprecatedEcdsaVerifier ¶ added in v0.5.0
func NewDeprecatedEcdsaVerifier() Verifier
func NewEcdsaVerifier ¶
func NewEcdsaVerifier() Verifier
func NewEd25519Verifier ¶ added in v0.3.2
func NewEd25519Verifier() Verifier
func NewRsaVerifier ¶
func NewRsaVerifier() Verifier
Click to show internal directories.
Click to hide internal directories.