Documentation
¶
Index ¶
- Variables
- func AddNamedCurve(curve elliptic.Curve, oid asn1.ObjectIdentifier)
- func BitsToBytes(bits int) int
- func MarshalECPrivateKey(key *PrivateKey) ([]byte, error)
- func MarshalPrivateKey(key *PrivateKey) ([]byte, error)
- func MarshalPublicKey(pub *PublicKey) ([]byte, error)
- func NamedCurveFromOid(oid asn1.ObjectIdentifier) elliptic.Curve
- func OidFromNamedCurve(curve elliptic.Curve) (asn1.ObjectIdentifier, bool)
- func Sign(rand io.Reader, priv *PrivateKey, h hash.Hash, data []byte) (sig []byte, err error)
- func SignToRS(rand io.Reader, priv *PrivateKey, h hash.Hash, msg []byte) (r, s *big.Int, err error)
- func Verify(pub *PublicKey, h hash.Hash, data, sig []byte) bool
- func VerifyWithRS(pub *PublicKey, h hash.Hash, data []byte, r, s *big.Int) bool
- func XY(D *big.Int, c elliptic.Curve) (X, Y *big.Int)
- type PrivateKey
- type PublicKey
- type SignerOpts
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrParametersNotSetUp = errors.New("go-cryptobin/eckcdsa: parameters not set up before generating key") ErrInvalidK = errors.New("go-cryptobin/eckcdsa: use another K") ErrInvalidInteger = errors.New("go-cryptobin/eckcdsa: invalid integer") ErrInvalidASN1 = errors.New("go-cryptobin/eckcdsa: invalid ASN.1") )
Functions ¶
func AddNamedCurve ¶
func AddNamedCurve(curve elliptic.Curve, oid asn1.ObjectIdentifier)
func BitsToBytes ¶
func MarshalECPrivateKey ¶
func MarshalECPrivateKey(key *PrivateKey) ([]byte, error)
MarshalECPrivateKey converts an EC private key to SEC 1, ASN.1 DER form.
This kind of key is commonly encoded in PEM blocks of type "EC PRIVATE KEY". For a more flexible key format which is not EC specific, use MarshalPKCS8PrivateKey.
func NamedCurveFromOid ¶
func NamedCurveFromOid(oid asn1.ObjectIdentifier) elliptic.Curve
func OidFromNamedCurve ¶
func OidFromNamedCurve(curve elliptic.Curve) (asn1.ObjectIdentifier, bool)
Types ¶
type PrivateKey ¶
ec-kcdsa PrivateKey
func GenerateKey ¶
Generate the paramters
func ParseECPrivateKey ¶
func ParseECPrivateKey(der []byte) (*PrivateKey, error)
ParseECPrivateKey parses an EC private key in SEC 1, ASN.1 DER form.
This kind of key is commonly encoded in PEM blocks of type "EC PRIVATE KEY".
func (*PrivateKey) Equal ¶
func (priv *PrivateKey) Equal(x crypto.PrivateKey) bool
Equal reports whether pub 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) Sign ¶
func (priv *PrivateKey) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error)
crypto.Signer
type PublicKey ¶
ec-kcdsa PublicKey
type SignerOpts ¶
SignerOpts contains options for creating and verifying EC-KCDSA signatures.
func (*SignerOpts) HashFunc ¶
func (opts *SignerOpts) HashFunc() crypto.Hash
HashFunc returns opts.Hash
Click to show internal directories.
Click to hide internal directories.