eckcdsa

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2024 License: MIT Imports: 12 Imported by: 1

Documentation

Overview

Package eckcdsa implements the EC-KCDSA(Korean Certificate-based Digital Signature Algorithm using Elliptic Curves) as defined in TTAK.KO-12.0015/R3

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sign

func Sign(rand io.Reader, priv *PrivateKey, h hash.Hash, data []byte) (r, s *big.Int, err error)

Sign data using K generated randomly like in crypto/ecdsa packages.

func SignASN1 added in v1.3.0

func SignASN1(randReader io.Reader, priv *PrivateKey, h hash.Hash, data []byte) (sig []byte, err error)

Sign data using K generated randomly like in crypto/ecdsa packages. returns the ASN.1 encoded signature.

func Verify

func Verify(pub *PublicKey, h hash.Hash, data []byte, r, s *big.Int) bool

func VerifyASN1 added in v1.3.0

func VerifyASN1(pub *PublicKey, h hash.Hash, data, sig []byte) bool

VerifyASN1 verifies the ASN.1 encoded signature, sig, M, of hash using the public key, pub. Its return value records whether the signature is valid.

Types

type PrivateKey

type PrivateKey struct {
	PublicKey
	D *big.Int
}

PrivateKey represents a EC-KCDSA private key.

func FromECDSA added in v1.3.0

func FromECDSA(dpk *ecdsa.PrivateKey) *PrivateKey

func GenerateKey

func GenerateKey(c elliptic.Curve, randReader io.Reader) (*PrivateKey, error)

Generate the parameters

func (*PrivateKey) Equal added in v1.3.0

func (priv *PrivateKey) Equal(x crypto.PrivateKey) bool

Equal reports whether priv and x have the same value.

func (*PrivateKey) Public added in v1.2.2

func (priv *PrivateKey) Public() crypto.PublicKey

Public returns the public key corresponding to priv.

func (*PrivateKey) Sign added in v1.3.0

func (priv *PrivateKey) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error)

crypto.Signer

func (*PrivateKey) ToECDSA added in v1.3.0

func (kpk *PrivateKey) ToECDSA() *ecdsa.PrivateKey

type PublicKey

type PublicKey struct {
	elliptic.Curve

	X *big.Int
	Y *big.Int
}

PublicKey represents a EC-KCDSA public key.

func (*PublicKey) Equal added in v1.2.2

func (pub *PublicKey) Equal(x crypto.PublicKey) bool

Equal reports whether pub and x have the same value.

type SignerOpts added in v1.3.0

type SignerOpts struct {
	Hash crypto.Hash
}

SignerOpts contains options for creating and verifying EC-KCDSA signatures.

func (*SignerOpts) HashFunc added in v1.3.0

func (opts *SignerOpts) HashFunc() crypto.Hash

HashFunc returns opts.Hash so that SignerOpts implements crypto.SignerOpts.

Jump to

Keyboard shortcuts

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