Documentation
¶
Index ¶
- Constants
- func GenerateKeyPair() (PublicKey, PrivateKey, error)
- type PrivateKey
- func (p PrivateKey) Equal(other crypto.PrivateKey) bool
- func (p PrivateKey) Public() crypto.PublicKey
- func (p PrivateKey) Seed() []byte
- func (p PrivateKey) SignToASN1(message []byte, opts ...crypto.SigningOption) ([]byte, error)
- func (p PrivateKey) SignToBytes(message []byte, opts ...crypto.SigningOption) ([]byte, error)
- func (p PrivateKey) ToBytes() []byte
- func (p PrivateKey) ToPKCS8DER() []byte
- func (p PrivateKey) ToPKCS8PEM() string
- func (p PrivateKey) Varsig(opts ...crypto.SigningOption) varsig.Varsig
- type PublicKey
- func (p PublicKey) Equal(other crypto.PublicKey) bool
- func (p PublicKey) ToBytes() []byte
- func (p PublicKey) ToPublicKeyMultibase() string
- func (p PublicKey) ToX509DER() []byte
- func (p PublicKey) ToX509PEM() string
- func (p PublicKey) VerifyASN1(message, signature []byte, opts ...crypto.SigningOption) bool
- func (p PublicKey) VerifyBytes(message, signature []byte, opts ...crypto.SigningOption) bool
Constants ¶
const ( // PublicKeyBytesSize is the size, in bytes, of public keys in raw bytes. PublicKeyBytesSize = ed25519.PublicKeySize // PrivateKeyBytesSize is the size, in bytes, of private keys in raw bytes. PrivateKeyBytesSize = ed25519.PrivateKeySize // SignatureBytesSize is the size, in bytes, of signatures in raw bytes. SignatureBytesSize = ed25519.SignatureSize MultibaseCode = uint64(0xed) )
Variables ¶
This section is empty.
Functions ¶
func GenerateKeyPair ¶
func GenerateKeyPair() (PublicKey, PrivateKey, error)
Types ¶
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
func PrivateKeyFromBytes ¶
func PrivateKeyFromBytes(b []byte) (PrivateKey, error)
PrivateKeyFromBytes converts a serialized private key to a PrivateKey. This compact serialization format is the raw key material, without metadata or structure. It returns an error if the slice is not the right size.
func PrivateKeyFromPKCS8DER ¶
func PrivateKeyFromPKCS8DER(bytes []byte) (PrivateKey, error)
PrivateKeyFromPKCS8DER decodes a PKCS#8 DER (binary) encoded private key.
func PrivateKeyFromPKCS8PEM ¶
func PrivateKeyFromPKCS8PEM(str string) (PrivateKey, error)
PrivateKeyFromPKCS8PEM decodes an PKCS#8 PEM (string) encoded private key.
func PrivateKeyFromSeed ¶
func PrivateKeyFromSeed(seed []byte) (PrivateKey, error)
func (PrivateKey) Equal ¶
func (p PrivateKey) Equal(other crypto.PrivateKey) bool
func (PrivateKey) Public ¶
func (p PrivateKey) Public() crypto.PublicKey
func (PrivateKey) Seed ¶
func (p PrivateKey) Seed() []byte
Seed returns the private key seed corresponding to priv. It is provided for interoperability with RFC 8032. RFC 8032's private keys correspond to seeds in this package.
func (PrivateKey) SignToASN1 ¶
func (p PrivateKey) SignToASN1(message []byte, opts ...crypto.SigningOption) ([]byte, error)
SignToASN1 creates a signature with ASN.1 encoding. This ASN.1 encoding uses a BIT STRING, which would be correct for an X.509 certificate.
func (PrivateKey) SignToBytes ¶
func (p PrivateKey) SignToBytes(message []byte, opts ...crypto.SigningOption) ([]byte, error)
func (PrivateKey) ToBytes ¶
func (p PrivateKey) ToBytes() []byte
func (PrivateKey) ToPKCS8DER ¶
func (p PrivateKey) ToPKCS8DER() []byte
func (PrivateKey) ToPKCS8PEM ¶
func (p PrivateKey) ToPKCS8PEM() string
func (PrivateKey) Varsig ¶
func (p PrivateKey) Varsig(opts ...crypto.SigningOption) varsig.Varsig
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
func PublicKeyFromBytes ¶
PublicKeyFromBytes converts a serialized public key to a PublicKey. This compact serialization format is the raw key material, without metadata or structure. It errors if the slice is not the right size.
func PublicKeyFromPublicKeyMultibase ¶
PublicKeyFromPublicKeyMultibase decodes the public key from its PublicKeyMultibase form
func PublicKeyFromX509DER ¶
PublicKeyFromX509DER decodes an X.509 DER (binary) encoded public key.
func PublicKeyFromX509PEM ¶
PublicKeyFromX509PEM decodes an X.509 PEM (string) encoded public key.
func (PublicKey) ToPublicKeyMultibase ¶
func (PublicKey) VerifyASN1 ¶
func (p PublicKey) VerifyASN1(message, signature []byte, opts ...crypto.SigningOption) bool
VerifyASN1 verifies a signature with ASN.1 encoding. This ASN.1 encoding uses a BIT STRING, which would be correct for an X.509 certificate.
func (PublicKey) VerifyBytes ¶
func (p PublicKey) VerifyBytes(message, signature []byte, opts ...crypto.SigningOption) bool