secp256r1

package
v0.0.0-...-3c905e5 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2023 License: BSD-3-Clause Imports: 20 Imported by: 4

Documentation

Index

Constants

View Source
const ID = 257

ID id

View Source
const Name = "secp256r1"

Name name

Variables

View Source
var EcdsaAuthor = authority.Authority{}

EcdsaAuthor secp256r1证书校验

Functions

func IsLowS

func IsLowS(s *big.Int) bool

IsLowS check is low int

func MarshalECDSASignature

func MarshalECDSASignature(r, s *big.Int) ([]byte, error)

MarshalECDSASignature marshal ECDSA signature

func New

func New(sub []byte)

New new

func NewEcdsaValidator

func NewEcdsaValidator() core.Validator

NewEcdsaValidator 创建ecdsa校验器

func SerializePrivateKey

func SerializePrivateKey(p *ecdsa.PrivateKey) []byte

SerializePrivateKey serialize private key

func SerializePublicKeyCompressed

func SerializePublicKeyCompressed(p *ecdsa.PublicKey) []byte

SerializePublicKeyCompressed serialize compressed publicKey

func ToLowS

func ToLowS(k *ecdsa.PublicKey, s *big.Int) *big.Int

ToLowS convert to low int

func UnmarshalECDSASignature

func UnmarshalECDSASignature(raw []byte) (*big.Int, *big.Int, error)

UnmarshalECDSASignature unmarshal ECDSA signature

Types

type Driver

type Driver struct{}

Driver driver

func (Driver) GenKey

func (d Driver) GenKey() (crypto.PrivKey, error)

GenKey create private key

func (Driver) PrivKeyFromBytes

func (d Driver) PrivKeyFromBytes(b []byte) (privKey crypto.PrivKey, err error)

PrivKeyFromBytes create private key from bytes

func (Driver) PubKeyFromBytes

func (d Driver) PubKeyFromBytes(b []byte) (pubKey crypto.PubKey, err error)

PubKeyFromBytes create public key from bytes

func (Driver) SignatureFromBytes

func (d Driver) SignatureFromBytes(b []byte) (sig crypto.Signature, err error)

SignatureFromBytes create signature from bytes

func (Driver) Validate

func (d Driver) Validate(msg, pub, sig []byte) error

Validate validate msg and signature

type PrivKeyECDSA

type PrivKeyECDSA [privateKeyECDSALength]byte

PrivKeyECDSA PrivKey

func (PrivKeyECDSA) Bytes

func (privKey PrivKeyECDSA) Bytes() []byte

Bytes convert to bytes

func (PrivKeyECDSA) Equals

func (privKey PrivKeyECDSA) Equals(other crypto.PrivKey) bool

Equals check privkey is equal

func (PrivKeyECDSA) PubKey

func (privKey PrivKeyECDSA) PubKey() crypto.PubKey

PubKey convert to public key

func (PrivKeyECDSA) Sign

func (privKey PrivKeyECDSA) Sign(msg []byte) crypto.Signature

Sign create signature

func (PrivKeyECDSA) String

func (privKey PrivKeyECDSA) String() string

String convert to string

type PubKeyECDSA

type PubKeyECDSA [publicKeyECDSALengthCompressed]byte

PubKeyECDSA PubKey prefixed with 0x02 or 0x03, depending on the y-cord.

func (PubKeyECDSA) Bytes

func (pubKey PubKeyECDSA) Bytes() []byte

Bytes convert to bytes

func (PubKeyECDSA) Equals

func (pubKey PubKeyECDSA) Equals(other crypto.PubKey) bool

Equals check public key is equal

func (PubKeyECDSA) KeyString

func (pubKey PubKeyECDSA) KeyString() string

KeyString Must return the full bytes in hex. Used for map keying, etc.

func (PubKeyECDSA) String

func (pubKey PubKeyECDSA) String() string

String convert to string

func (PubKeyECDSA) VerifyBytes

func (pubKey PubKeyECDSA) VerifyBytes(msg []byte, sig crypto.Signature) bool

VerifyBytes verify signature

type SignatureECDSA

type SignatureECDSA []byte

SignatureECDSA Signature

func (SignatureECDSA) Bytes

func (sig SignatureECDSA) Bytes() []byte

Bytes convert signature to bytes

func (SignatureECDSA) Equals

func (sig SignatureECDSA) Equals(other crypto.Signature) bool

Equals check signature equals

func (SignatureECDSA) IsZero

func (sig SignatureECDSA) IsZero() bool

IsZero check signature is zero

func (SignatureECDSA) String

func (sig SignatureECDSA) String() string

String convert signature to string

type SignatureS

type SignatureS struct {
	crypto.Signature
}

SignatureS signature struct

Jump to

Keyboard shortcuts

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