Documentation ¶
Index ¶
- Constants
- func GenerateKey() (*ecdsa.PrivateKey, error)
- func GenerateSharedKey(publicKey *ecdsa.PublicKey, privateKey *ecdsa.PrivateKey) ([]byte, error)
- func MarshalPrivateKey(privateKey *ecdsa.PrivateKey) ([]byte, error)
- func MarshalPublicKey(publicKey *ecdsa.PublicKey) ([]byte, error)
- func Sign(privateKey *ecdsa.PrivateKey, data []byte) ([]byte, error)
- func UnmarshalPrivateKey(data []byte) (*ecdsa.PrivateKey, error)
- func UnmarshalPublicKey(data []byte) (*ecdsa.PublicKey, error)
- func Verify(publicKey *ecdsa.PublicKey, data, signature []byte) bool
- type Signer
- type Verifier
Constants ¶
View Source
const SignatureSize = 64
Variables ¶
This section is empty.
Functions ¶
func GenerateKey ¶
func GenerateKey() (*ecdsa.PrivateKey, error)
GenerateKey generates a new ECDSA private key for the P-256 curve
func GenerateSharedKey ¶
GenerateSharedKey generates a shared key using ECDH exchange between a public and private key
func MarshalPrivateKey ¶
func MarshalPrivateKey(privateKey *ecdsa.PrivateKey) ([]byte, error)
MarshalPrivateKey marshals a private key to SEC 1, ASN.1 DER form
func MarshalPublicKey ¶
MarshalPublicKey marshals a public key to SEC 1, ASN.1 DER form
func Sign ¶
func Sign(privateKey *ecdsa.PrivateKey, data []byte) ([]byte, error)
Sign signs a message using ECDSA and returns an ASN.1 encoded signature
func UnmarshalPrivateKey ¶
func UnmarshalPrivateKey(data []byte) (*ecdsa.PrivateKey, error)
UnmarshalPrivateKey unmarshal a private key from SEC 1, ASN.1 DER form
func UnmarshalPublicKey ¶
UnmarshalPublicKey unmarshal a public key from SEC 1, ASN.1 DER form
Types ¶
type Signer ¶
type Signer struct { Verifier // contains filtered or unexported fields }
func NewSigner ¶
func NewSigner(privateKey *ecdsa.PrivateKey) *Signer
func (*Signer) SignatureSize ¶
Click to show internal directories.
Click to hide internal directories.