cryptoutils

package
v0.1.5-beta.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurveEqual

func CurveEqual(a, b elliptic.Curve) bool

CurveEqual returns true if curves are equal regardless of names and pointer values

func MarshalPKCS8PrivateKey

func MarshalPKCS8PrivateKey(key interface{}) ([]byte, error)

MarshalPKCS8PrivateKey converts a private key to PKCS#8, ASN.1 DER form.

func NamedCurve

func NamedCurve(name string) elliptic.Curve

NamedCurve returns curve by its standard name or nil

func S256

func S256() *secp256k1.KoblitzCurve

S256 S256 returns a Curve which implements secp256k1 with correct name

Types

type ECDSASignature

type ECDSASignature struct {
	R *big.Int
	S *big.Int
}

ECDSASignature is a type representing an ecdsa signature.

func CanonizeECDSASignature

func CanonizeECDSASignature(curve elliptic.Curve, sig *ECDSASignature) *ECDSASignature

CanonizeECDSASignature returns the canonical versions of the signature the canonical version enforce low S values if S is above order / 2 it negating the S (modulo the order (N))

func (*ECDSASignature) String

func (e *ECDSASignature) String() string

type ED25519Signature

type ED25519Signature []byte

ED25519Signature is a type representing an Ed25519 signature

func (ED25519Signature) String

func (e ED25519Signature) String() string

type PrivateKey

type PrivateKey interface {
	Public() crypto.PublicKey
}

PrivateKey is omplemented by private key types

type Signature

type Signature interface {
	String() string
}

Signature is a type representing a digital signature.

func CanonizeSignature

func CanonizeSignature(pub crypto.PublicKey, sig Signature) Signature

CanonizeSignature returns the canonical versions of the ECDSA signature if one is given

func Sign

func Sign(priv PrivateKey, hash []byte) (Signature, error)

Sign sign a hash using this private key

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL