Documentation
¶
Index ¶
- Constants
- Variables
- func MarshalPrivateKey(priv *PrivateKey) ([]byte, error)
- func MarshalPublicKey(pub *PublicKey) ([]byte, error)
- func PrivateKeyTo(key *PrivateKey) []byte
- func PublicKeyTo(key *PublicKey) []byte
- func Sign(rand io.Reader, priv *PrivateKey, msg []byte) ([]byte, error)
- func Verify(pub *PublicKey, msg, signature []byte) (bool, error)
- func VerifyWithOptions(publicKey *PublicKey, message, sig []byte, opts crypto.SignerOpts) error
- type Options
- type PrivateKey
- type PublicKey
- type SchemeID
Constants ¶
View Source
const ( // ContextMaxSize is the maximum length (in bytes) allowed for context. ContextMaxSize = 255 // PublicKeySize is the size, in bytes, of public keys as used in this package. PublicKeySize = 66 // PrivateKeySize is the size, in bytes, of private keys as used in this package. PrivateKeySize = 132 // SignatureSize is the size, in bytes, of signatures generated and verified by this package. SignatureSize = 132 // SeedSize is the size, in bytes, of private key seeds. SeedSize = 66 )
Variables ¶
View Source
var (
ErrInvalidASN1 = errors.New("go-cryptobin/ed521: invalid ASN.1 encoding")
)
Functions ¶
func MarshalPrivateKey ¶
func MarshalPrivateKey(priv *PrivateKey) ([]byte, error)
Marshal PrivateKey to der
func MarshalPublicKey ¶
Marshal PublicKey to der
func VerifyWithOptions ¶
func VerifyWithOptions(publicKey *PublicKey, message, sig []byte, opts crypto.SignerOpts) error
VerifyWithOptions reports whether sig is a valid signature of message by publicKey.
Types ¶
type Options ¶
type Options struct {
// Hash must be crypto.Hash(0) for both Ed521 and Ed521Ph.
Hash crypto.Hash
// Context is an optional domain separation string for signing.
// Its length must be less or equal than 255 bytes.
Context string
// Scheme is an identifier for choosing a signature scheme.
Scheme SchemeID
}
Options implements crypto.SignerOpts and augments with parameters that are specific to the Ed521 signature schemes.
type PrivateKey ¶
func GenerateKey ¶
func GenerateKey(rand io.Reader) (*PrivateKey, error)
GenerateKey returns Ed521 PrivateKey
func NewKeyFromBytes ¶
func NewKeyFromBytes(bytes []byte) (*PrivateKey, error)
New a private key from bytes
func NewKeyFromSeed ¶
func NewKeyFromSeed(seed []byte) (*PrivateKey, error)
New a private key from seed bytes
func NewPrivateKey ¶
func NewPrivateKey(d []byte) (*PrivateKey, error)
New a private key from key data bytes
func (*PrivateKey) Bytes ¶
func (priv *PrivateKey) Bytes() []byte
func (*PrivateKey) Equal ¶
func (priv *PrivateKey) Equal(x crypto.PrivateKey) bool
Equal reports whether priv and x have the same value.
func (*PrivateKey) Public ¶
func (priv *PrivateKey) Public() crypto.PublicKey
Public returns the public key corresponding to priv.
func (*PrivateKey) Seed ¶
func (priv *PrivateKey) Seed() []byte
func (*PrivateKey) Sign ¶
func (priv *PrivateKey) Sign(rand io.Reader, message []byte, opts crypto.SignerOpts) ([]byte, error)
Sign creates a signature for message
type PublicKey ¶
func NewPublicKey ¶
New a PublicKey from publicKey data
func ParsePublicKey ¶
Parse PublicKey der
Click to show internal directories.
Click to hide internal directories.