Documentation ¶
Overview ¶
package x509 implements Public Key Infrastructure X.509 formats.
Index ¶
- Variables
- func EqualPublicKeys(a, b *PublicKey) bool
- func MarshalPrivateKey(out []byte, x *PrivateKey) []byte
- func MarshalPublicKey(out []byte, x *PublicKey) []byte
- func ToStandardSigner(x *PrivateKey) (crypto.Signer, error)
- type Codec
- type ErrUnrecognizedAlgo
- type PrivateKey
- type PublicKey
- type Registry
- func (r Registry) LoadSigner(pk *PrivateKey) (Signer, error)
- func (r Registry) LoadVerifier(pk *PublicKey) (Verifier, error)
- func (r Registry) ParseVerifier(data []byte) (Verifier, error)
- func (r Registry) PublicFromPrivate(private *PrivateKey) (ret PublicKey, _ error)
- func (r Registry) StoreSigner(algoID oids.OID, s Signer) (PrivateKey, error)
- func (r Registry) StoreVerifier(algoID oids.OID, v Verifier) (PublicKey, error)
- type Signer
- type Verifier
Constants ¶
This section is empty.
Variables ¶
var ( // https://www.rfc-editor.org/rfc/rfc8410#section-3 Algo_Ed25519 = oids.New(1, 3, 101, 112) Algo_Ed448 = oids.New(1, 3, 101, 113) )
Functions ¶
func EqualPublicKeys ¶
EqualPublicKeys returns true if a and b are equal.
func MarshalPrivateKey ¶
func MarshalPrivateKey(out []byte, x *PrivateKey) []byte
MarshalPrivateKey appends the marshalled bytes of x to out and returns the result.
func MarshalPublicKey ¶
MarshalPublicKey appends the marshalled bytes of x to out and returns the result.
func ToStandardSigner ¶
func ToStandardSigner(x *PrivateKey) (crypto.Signer, error)
Types ¶
type Codec ¶
type Codec struct { ParsePublic func([]byte) (Verifier, error) MarshalPublic func(out []byte, v Verifier) []byte ParsePrivate func([]byte) (Signer, error) MarshalPrivate func(out []byte, s Signer) []byte }
A Codec contains functions for Parsing and Marshaling Verifiers and Signers
type ErrUnrecognizedAlgo ¶
func (ErrUnrecognizedAlgo) Error ¶
func (e ErrUnrecognizedAlgo) Error() string
type PrivateKey ¶
func ParsePrivateKey ¶
func ParsePrivateKey(input []byte) (PrivateKey, error)
ParsePrivateKey attempts to parse a PrivateKey from input, and returns the PrivateKey or an error.
func (*PrivateKey) IsZero ¶
func (priv *PrivateKey) IsZero() bool
type PublicKey ¶
PublicKey is an AlgorithmID and a marshaled public key
func ParsePublicKey ¶
ParsePublicKey attempts to parse a PublicKey from input, and returns the PublicKey or an error.
type Registry ¶
Registry mananges parsing Verifiers and Signers for a given set of algorithms.
func DefaultRegistry ¶
func DefaultRegistry() Registry
func (Registry) LoadSigner ¶
func (r Registry) LoadSigner(pk *PrivateKey) (Signer, error)
func (Registry) PublicFromPrivate ¶
func (r Registry) PublicFromPrivate(private *PrivateKey) (ret PublicKey, _ error)
func (Registry) StoreSigner ¶
type Signer ¶
type Signer interface { // Sign appends a signature for msg to out, and returns out, or an error Sign(out []byte, msg []byte) ([]byte, error) Verifier() Verifier }
Signer contains the Sign method
type Verifier ¶
Verifier contains the verify method
func NewVerifier ¶
NewVerifier creates a Verifier from a sign.Scheme and a public key