Documentation ¶
Index ¶
- Constants
- Variables
- func SignData(key *ecdsa.PrivateKey, src DataSource, opts ...SignOption) (res *signature.Signature, err error)
- func SignDataWithHandler(key *ecdsa.PrivateKey, src DataSource, handler func(key, sig []byte)) error
- func VerifyData(dataSrc DataSource, sig *signature.Signature, opts ...SignOption) error
- func VerifyDataWithSource(dataSrc DataSource, sigSrc func() (key, sig []byte)) error
- type DataSource
- type DataWithSignature
- type SignOption
Constants ¶
View Source
const ( // PrivateKeyCompressedSize is constant with compressed size of private key (SK). // D coordinate stored, recover PK by formula x, y = curve.ScalarBaseMul(d,bytes). PrivateKeyCompressedSize = 32 // PublicKeyCompressedSize is constant with compressed size of public key (PK). PublicKeyCompressedSize = 33 // PublicKeyUncompressedSize is constant with uncompressed size of public key (PK). // First byte always should be 0x4 other 64 bytes is X and Y (32 bytes per coordinate). // 2 * 32 + 1. PublicKeyUncompressedSize = 65 )
Variables ¶
View Source
var ( // ErrEmptyPrivateKey is returned when used private key is empty. ErrEmptyPrivateKey = errors.New("empty private key") // ErrInvalidPublicKey is returned when public key cannot be unmarshalled. ErrInvalidPublicKey = errors.New("invalid public key") // ErrInvalidSignature is returned if signature cannot be verified. ErrInvalidSignature = errors.New("invalid signature") )
Functions ¶
func SignData ¶
func SignData(key *ecdsa.PrivateKey, src DataSource, opts ...SignOption) (res *signature.Signature, err error)
func SignDataWithHandler ¶
func SignDataWithHandler(key *ecdsa.PrivateKey, src DataSource, handler func(key, sig []byte)) error
func VerifyData ¶
func VerifyData(dataSrc DataSource, sig *signature.Signature, opts ...SignOption) error
func VerifyDataWithSource ¶
func VerifyDataWithSource(dataSrc DataSource, sigSrc func() (key, sig []byte)) error
Types ¶
type DataSource ¶
type DataWithSignature ¶
type DataWithSignature interface { DataSource GetSignature() *signature.Signature SetSignature(*signature.Signature) }
type SignOption ¶
type SignOption func(*cfg)
func SignWithRFC6979 ¶
func SignWithRFC6979() SignOption
Click to show internal directories.
Click to hide internal directories.