Documentation ¶
Index ¶
- Constants
- func GenerateKeyPair() (privkey PrivateKey, pubkey PublicKey, err error)
- func ParsePrivateKey(privkey PrivateKey) ecdsa.PrivateKey
- func ParsePublicKey(pubkey PublicKey) (ecdsa.PublicKey, error)
- func Verify(pubkey PublicKey, digest []byte, signature Signature) error
- type PrivateKey
- type PublicKey
- type Signature
Constants ¶
View Source
const ( PublicKeyLength = 64 PrivateKeyLength = 32 SignatureLength = 64 )
Variables ¶
This section is empty.
Functions ¶
func GenerateKeyPair ¶
func GenerateKeyPair() (privkey PrivateKey, pubkey PublicKey, err error)
GenerateKeyPair generate a key pair
func ParsePrivateKey ¶
func ParsePrivateKey(privkey PrivateKey) ecdsa.PrivateKey
ParsePrivateKey parse from local type to EC private key
func ParsePublicKey ¶
ParsePublicKey parse from local type to EC public key
Types ¶
type PrivateKey ¶
type PrivateKey [PrivateKeyLength]byte
func DecodePrivateKeyFromString ¶
func DecodePrivateKeyFromString(s string) (PrivateKey, error)
DecodePrivateKeyFromString decode ec private key from string
func MarshalPrivateKey ¶
func MarshalPrivateKey(privkey *ecdsa.PrivateKey) PrivateKey
MarshalPrivateKey marshal private key to local types
func (PrivateKey) String ¶
func (sk PrivateKey) String() string
type PublicKey ¶
type PublicKey [PublicKeyLength]byte
func DecodePublicKeyFromString ¶
DecodePublicKeyFromString decode ec public key from string
func MarshalPublicKey ¶
MarshalPublicKey marshal public key to local types
func PublicKeyFromPrivateKey ¶
func PublicKeyFromPrivateKey(privkey PrivateKey) PublicKey
PublicKeyFromPrivateKey
type Signature ¶
type Signature [SignatureLength]byte
func DecodeSignatureFromString ¶
DecodeSignatureFromString decode ec signature from string
Click to show internal directories.
Click to hide internal directories.