Documentation ¶
Overview ¶
Package ecc implements a generic interface for ECDH, ECDSA, and EdDSA.
Package ecc implements a generic interface for ECDH, ECDSA, and EdDSA.
Package ecc implements a generic interface for ECDH, ECDSA, and EdDSA.
Package ecc implements a generic interface for ECDH, ECDSA, and EdDSA.
Package ecc implements a generic interface for ECDH, ECDSA, and EdDSA.
Package ecc implements a generic interface for ECDH, ECDSA, and EdDSA.
Package ecc implements a generic interface for ECDH, ECDSA, and EdDSA.
Index ¶
Constants ¶
View Source
const Curve25519GenName = "Curve25519"
Variables ¶
View Source
var Curves = []CurveInfo{ { GenName: "P256", Oid: encoding.NewOID([]byte{0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07}), Curve: NewGenericCurve(elliptic.P256()), }, { GenName: "P384", Oid: encoding.NewOID([]byte{0x2B, 0x81, 0x04, 0x00, 0x22}), Curve: NewGenericCurve(elliptic.P384()), }, { GenName: "P521", Oid: encoding.NewOID([]byte{0x2B, 0x81, 0x04, 0x00, 0x23}), Curve: NewGenericCurve(elliptic.P521()), }, { GenName: "SecP256k1", Oid: encoding.NewOID([]byte{0x2B, 0x81, 0x04, 0x00, 0x0A}), Curve: NewGenericCurve(bitcurves.S256()), }, { GenName: Curve25519GenName, Oid: encoding.NewOID([]byte{0x2B, 0x06, 0x01, 0x04, 0x01, 0x97, 0x55, 0x01, 0x05, 0x01}), Curve: NewCurve25519(), }, { GenName: "Curve448", Oid: encoding.NewOID([]byte{0x2B, 0x65, 0x6F}), Curve: NewX448(), }, { GenName: Curve25519GenName, Oid: encoding.NewOID([]byte{0x2B, 0x06, 0x01, 0x04, 0x01, 0xDA, 0x47, 0x0F, 0x01}), Curve: NewEd25519(), }, { GenName: "Curve448", Oid: encoding.NewOID([]byte{0x2B, 0x65, 0x71}), Curve: NewEd448(), }, { GenName: "BrainpoolP256", Oid: encoding.NewOID([]byte{0x2B, 0x24, 0x03, 0x03, 0x02, 0x08, 0x01, 0x01, 0x07}), Curve: NewGenericCurve(brainpool.P256r1()), }, { GenName: "BrainpoolP384", Oid: encoding.NewOID([]byte{0x2B, 0x24, 0x03, 0x03, 0x02, 0x08, 0x01, 0x01, 0x0B}), Curve: NewGenericCurve(brainpool.P384r1()), }, { GenName: "BrainpoolP512", Oid: encoding.NewOID([]byte{0x2B, 0x24, 0x03, 0x03, 0x02, 0x08, 0x01, 0x01, 0x0D}), Curve: NewGenericCurve(brainpool.P512r1()), }, }
Functions ¶
func NewCurve25519 ¶
func NewCurve25519() *curve25519
func NewEd25519 ¶
func NewEd25519() *ed25519
func NewGenericCurve ¶
Types ¶
type CurveInfo ¶
func FindByCurve ¶
type ECDHCurve ¶
type ECDHCurve interface { Curve MarshalBytePoint([]byte) (encoded []byte) UnmarshalBytePoint(encoded []byte) []byte MarshalByteSecret(d []byte) []byte UnmarshalByteSecret(d []byte) []byte GenerateECDH(rand io.Reader) (point []byte, secret []byte, err error) Encaps(rand io.Reader, point []byte) (ephemeral, sharedSecret []byte, err error) Decaps(ephemeral, secret []byte) (sharedSecret []byte, err error) ValidateECDH(public []byte, secret []byte) error }
func FindECDHByGenName ¶
type ECDSACurve ¶
type ECDSACurve interface { Curve MarshalIntegerPoint(x, y *big.Int) []byte UnmarshalIntegerPoint([]byte) (x, y *big.Int) MarshalIntegerSecret(d *big.Int) []byte UnmarshalIntegerSecret(d []byte) *big.Int GenerateECDSA(rand io.Reader) (x, y, secret *big.Int, err error) Sign(rand io.Reader, x, y, d *big.Int, hash []byte) (r, s *big.Int, err error) Verify(x, y *big.Int, hash []byte, r, s *big.Int) bool ValidateECDSA(x, y *big.Int, secret []byte) error }
func FindECDSAByGenName ¶
func FindECDSAByGenName(curveGenName string) ECDSACurve
type EdDSACurve ¶
type EdDSACurve interface { Curve MarshalBytePoint(x []byte) []byte UnmarshalBytePoint([]byte) (x []byte) MarshalByteSecret(d []byte) []byte UnmarshalByteSecret(d []byte) []byte MarshalSignature(sig []byte) (r, s []byte) UnmarshalSignature(r, s []byte) (sig []byte) GenerateEdDSA(rand io.Reader) (pub, priv []byte, err error) Sign(publicKey, privateKey, message []byte) (sig []byte, err error) Verify(publicKey, message, sig []byte) bool ValidateEdDSA(publicKey, privateKey []byte) (err error) }
func FindEdDSAByGenName ¶
func FindEdDSAByGenName(curveGenName string) EdDSACurve
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package curve25519 implements custom field operations without clamping for forwarding.
|
Package curve25519 implements custom field operations without clamping for forwarding. |
field
Package field implements fast arithmetic modulo 2^255-19.
|
Package field implements fast arithmetic modulo 2^255-19. |
Click to show internal directories.
Click to hide internal directories.