Documentation
¶
Index ¶
- Constants
- func GenerateKeyPair(bits int) (*PublicKey, *PrivateKey, error)
- type PrivateKey
- func (p *PrivateKey) DBytes() []byte
- func (p *PrivateKey) DpBytes() []byte
- func (p *PrivateKey) DqBytes() []byte
- func (p *PrivateKey) Equal(other crypto.PrivateKey) bool
- func (p *PrivateKey) KeyLength() uint64
- func (p *PrivateKey) PBytes() []byte
- func (p *PrivateKey) Public() crypto.PublicKey
- func (p *PrivateKey) QBytes() []byte
- func (p *PrivateKey) QiBytes() []byte
- func (p *PrivateKey) SignToASN1(message []byte, opts ...crypto.SigningOption) ([]byte, error)
- func (p *PrivateKey) ToPKCS8DER() []byte
- func (p *PrivateKey) ToPKCS8PEM() string
- func (p *PrivateKey) Varsig(opts ...crypto.SigningOption) varsig.Varsig
- type PublicKey
- func PublicKeyFromNE(n, e []byte) (*PublicKey, error)
- func PublicKeyFromPKCS1DER(bytes []byte) (*PublicKey, error)
- func PublicKeyFromPublicKeyMultibase(multibase string) (*PublicKey, error)
- func PublicKeyFromX509DER(bytes []byte) (*PublicKey, error)
- func PublicKeyFromX509PEM(str string) (*PublicKey, error)
- func (p *PublicKey) EBytes() []byte
- func (p *PublicKey) Equal(other crypto.PublicKey) bool
- func (p *PublicKey) KeyLength() uint64
- func (p *PublicKey) NBytes() []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
Constants ¶
const ( MultibaseCode = uint64(0x1205) MinRsaKeyBits = 2048 MaxRsaKeyBits = 8192 )
Variables ¶
This section is empty.
Functions ¶
func GenerateKeyPair ¶
func GenerateKeyPair(bits int) (*PublicKey, *PrivateKey, error)
Types ¶
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
func PrivateKeyFromNEDPQ ¶
func PrivateKeyFromNEDPQ(n, e, d, p, q []byte) (*PrivateKey, error)
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 (*PrivateKey) DBytes ¶
func (p *PrivateKey) DBytes() []byte
func (*PrivateKey) DpBytes ¶
func (p *PrivateKey) DpBytes() []byte
func (*PrivateKey) DqBytes ¶
func (p *PrivateKey) DqBytes() []byte
func (*PrivateKey) Equal ¶
func (p *PrivateKey) Equal(other crypto.PrivateKey) bool
func (*PrivateKey) KeyLength ¶
func (p *PrivateKey) KeyLength() uint64
func (*PrivateKey) PBytes ¶
func (p *PrivateKey) PBytes() []byte
func (*PrivateKey) Public ¶
func (p *PrivateKey) Public() crypto.PublicKey
func (*PrivateKey) QBytes ¶
func (p *PrivateKey) QBytes() []byte
func (*PrivateKey) QiBytes ¶
func (p *PrivateKey) QiBytes() []byte
func (*PrivateKey) SignToASN1 ¶
func (p *PrivateKey) SignToASN1(message []byte, opts ...crypto.SigningOption) ([]byte, error)
SignToASN1 produce a PKCS#1 v1.5 signature. The default signing hash is: - SHA-256 for keys of length 2048 bits and under - SHA-384 for keys of length 3072 bits and under - SHA-512 for higher key length
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
The default signing hash is: - SHA-256 for keys of length 2048 bits and under - SHA-384 for keys of length 3072 bits and under - SHA-512 for higher key length
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
func PublicKeyFromNE ¶
func PublicKeyFromPKCS1DER ¶
func PublicKeyFromPublicKeyMultibase ¶
PublicKeyFromPublicKeyMultibase decodes the public key from its Multibase 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 PKCS#1 v1.5 signature. The default signing hash is: - SHA-256 for keys of length 2048 bits and under - SHA-384 for keys of length 3072 bits and under - SHA-512 for higher key length