ecdsa

package
v0.0.0-...-beacba6 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ECDSA       = "ECDSA"
	ECDSAP256   = "ECDSAP256"
	ECDSAP384   = "ECDSAP384"
	ECDSAReRand = "ECDSA_RERAND"
)

Variables

This section is empty.

Functions

func ECDSAPrivateKeyToPEM

func ECDSAPrivateKeyToPEM(key *ECDSAPrivateKey) ([]byte, error)

func ECDSAPublicKeyToPEM

func ECDSAPublicKeyToPEM(key *ECDSAPublicKey) ([]byte, error)

func GetCurveHalfOrderAt

func GetCurveHalfOrderAt(curve elliptic.Curve) *big.Int

func IsLowS

func IsLowS(key *ecdsa.PublicKey, s *big.Int) (bool, error)

func MarshalECDSASignature

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

func NewECDSAPrivateKey

func NewECDSAPrivateKey(sk *ecdsa.PrivateKey) interfaces.Key

func NewECDSAPublicKey

func NewECDSAPublicKey(pk *ecdsa.PublicKey) interfaces.Key

func SignatureToLowS

func SignatureToLowS(key *ecdsa.PublicKey, signature []byte) ([]byte, error)

func ToLowS

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

func UnmarshalECDSASignature

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

Types

type ECDSAGoPublicKeyImportOpts

type ECDSAGoPublicKeyImportOpts struct {
	Temporary bool
}

func (*ECDSAGoPublicKeyImportOpts) Algorithm

func (opts *ECDSAGoPublicKeyImportOpts) Algorithm() string

func (*ECDSAGoPublicKeyImportOpts) Ephemeral

func (opts *ECDSAGoPublicKeyImportOpts) Ephemeral() bool

type ECDSAGoPublicKeyImporter

type ECDSAGoPublicKeyImporter struct{}

func NewECDSAGoPublicKeyImporter

func NewECDSAGoPublicKeyImporter() *ECDSAGoPublicKeyImporter

func (*ECDSAGoPublicKeyImporter) KeyImport

func (*ECDSAGoPublicKeyImporter) KeyImport(raw interface{}, opts interfaces.KeyImportOpts) (interfaces.Key, error)

KeyImport 此方法的第一个参数必须是 *ecdsa.PublicKey,第二个参数 KeyImportOpts 可以是 nil。

type ECDSAKeyGenerator

type ECDSAKeyGenerator struct {
	// contains filtered or unexported fields
}

func NewECDSAKeyGenerator

func NewECDSAKeyGenerator(curve elliptic.Curve) *ECDSAKeyGenerator

func (*ECDSAKeyGenerator) KeyGen

KeyGen 方法不需要传入 KeyGenOpts 参数。

type ECDSAP256KeyGenOpts

type ECDSAP256KeyGenOpts struct {
	Temporary bool
}

func (*ECDSAP256KeyGenOpts) Algorithm

func (opts *ECDSAP256KeyGenOpts) Algorithm() string

func (*ECDSAP256KeyGenOpts) Ephemeral

func (opts *ECDSAP256KeyGenOpts) Ephemeral() bool

Ephemeral 如果此方法在调用时返回 true,则生成的 ECDSA 密钥不会存储到文件中。

type ECDSAP384KeyGenOpts

type ECDSAP384KeyGenOpts struct {
	Temporary bool
}

func (*ECDSAP384KeyGenOpts) Algorithm

func (opts *ECDSAP384KeyGenOpts) Algorithm() string

func (*ECDSAP384KeyGenOpts) Ephemeral

func (opts *ECDSAP384KeyGenOpts) Ephemeral() bool

Ephemeral 如果此方法在调用时返回 true,则生成的 ECDSA 密钥不会存储到文件中。

type ECDSAPKIXPublicKeyImportOpts

type ECDSAPKIXPublicKeyImportOpts struct {
	Temporary bool
}

func (*ECDSAPKIXPublicKeyImportOpts) Algorithm

func (opts *ECDSAPKIXPublicKeyImportOpts) Algorithm() string

func (*ECDSAPKIXPublicKeyImportOpts) Ephemeral

func (opts *ECDSAPKIXPublicKeyImportOpts) Ephemeral() bool

type ECDSAPKIXPublicKeyImporter

type ECDSAPKIXPublicKeyImporter struct{}

func NewECDSAPKIXPublicKeyImporter

func NewECDSAPKIXPublicKeyImporter() *ECDSAPKIXPublicKeyImporter

func (*ECDSAPKIXPublicKeyImporter) KeyImport

func (*ECDSAPKIXPublicKeyImporter) KeyImport(raw interface{}, opts interfaces.KeyImportOpts) (interfaces.Key, error)

KeyImport 次方的第一个参数必须是 ECDSA 公钥的 PKIX, ASN.1 DER 格式,第二个参数 KeyImportOpts 可以是 nil。

type ECDSAPrivateKey

type ECDSAPrivateKey struct {
	// contains filtered or unexported fields
}

func (*ECDSAPrivateKey) Bytes

func (key *ECDSAPrivateKey) Bytes() ([]byte, error)

func (*ECDSAPrivateKey) Private

func (key *ECDSAPrivateKey) Private() bool

func (*ECDSAPrivateKey) PublicKey

func (key *ECDSAPrivateKey) PublicKey() (publicKey interfaces.Key, err error)

func (*ECDSAPrivateKey) SKI

func (key *ECDSAPrivateKey) SKI() []byte

func (*ECDSAPrivateKey) Symmetric

func (key *ECDSAPrivateKey) Symmetric() bool

type ECDSAPrivateKeyDeriver

type ECDSAPrivateKeyDeriver struct{}

func NewECDSAPrivateKeyDeriver

func NewECDSAPrivateKeyDeriver() *ECDSAPrivateKeyDeriver

func (*ECDSAPrivateKeyDeriver) KeyDeriv

KeyDeriv 此方法的第二个参数必须是 *ECDSAReRandKeyOpts 实例。

type ECDSAPrivateKeyImportOpts

type ECDSAPrivateKeyImportOpts struct {
	Temporary bool
}

func (*ECDSAPrivateKeyImportOpts) Algorithm

func (opts *ECDSAPrivateKeyImportOpts) Algorithm() string

func (*ECDSAPrivateKeyImportOpts) Ephemeral

func (opts *ECDSAPrivateKeyImportOpts) Ephemeral() bool

type ECDSAPrivateKeyImporter

type ECDSAPrivateKeyImporter struct{}

func NewECDSAPrivateKeyImporter

func NewECDSAPrivateKeyImporter() *ECDSAPrivateKeyImporter

func (*ECDSAPrivateKeyImporter) KeyImport

func (*ECDSAPrivateKeyImporter) KeyImport(raw interface{}, opts interfaces.KeyImportOpts) (interfaces.Key, error)

KeyImport 此方法的第一个参数必须是 ECDSA 私钥的 SEC 1, ASN.1 DER 格式,第二个参数 KeyImportOpts 可以是 nil。

type ECDSAPrivateKeyVerifier

type ECDSAPrivateKeyVerifier struct{}

func NewECDSAPrivateKeyVerifier

func NewECDSAPrivateKeyVerifier() *ECDSAPrivateKeyVerifier

func (*ECDSAPrivateKeyVerifier) Verify

func (verifier *ECDSAPrivateKeyVerifier) Verify(key interfaces.Key, signature, digest []byte, opts interfaces.SignerOpts) (bool, error)

Verify 此方法传入的第一个参数必须是 *ECDSAPrivateKey,第四个参数 SignerOpts 可以是 nil。

type ECDSAPublicKey

type ECDSAPublicKey struct {
	// contains filtered or unexported fields
}

func (*ECDSAPublicKey) Bytes

func (key *ECDSAPublicKey) Bytes() ([]byte, error)

func (*ECDSAPublicKey) Private

func (key *ECDSAPublicKey) Private() bool

func (*ECDSAPublicKey) PublicKey

func (key *ECDSAPublicKey) PublicKey() (publicKey interfaces.Key, err error)

func (*ECDSAPublicKey) SKI

func (key *ECDSAPublicKey) SKI() []byte

func (*ECDSAPublicKey) Symmetric

func (key *ECDSAPublicKey) Symmetric() bool

type ECDSAPublicKeyDeriver

type ECDSAPublicKeyDeriver struct{}

func NewECDSAPublicKeyDeriver

func NewECDSAPublicKeyDeriver() *ECDSAPublicKeyDeriver

func (*ECDSAPublicKeyDeriver) KeyDeriv

KeyDeriv 此方法的第二个参数必须是 *ECDSAReRandKeyOpts 实例。

type ECDSAPublicKeyVerifier

type ECDSAPublicKeyVerifier struct{}

func NewECDSAPublicKeyVerifier

func NewECDSAPublicKeyVerifier() *ECDSAPublicKeyVerifier

func (*ECDSAPublicKeyVerifier) Verify

func (verifier *ECDSAPublicKeyVerifier) Verify(key interfaces.Key, signature, digest []byte, opts interfaces.SignerOpts) (bool, error)

Verify 此方法传入的第一个参数必须是 *ECDSAPublicKey,第四个参数 SignerOpts 可以是 nil。

type ECDSAReRandKeyOpts

type ECDSAReRandKeyOpts struct {
	Temporary bool
	Expansion []byte
}

func (*ECDSAReRandKeyOpts) Algorithm

func (opts *ECDSAReRandKeyOpts) Algorithm() string

func (*ECDSAReRandKeyOpts) Ephemeral

func (opts *ECDSAReRandKeyOpts) Ephemeral() bool

type ECDSASignature

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

type ECDSASigner

type ECDSASigner struct{}

func NewECDSASigner

func NewECDSASigner() *ECDSASigner

func (*ECDSASigner) Sign

func (signer *ECDSASigner) Sign(key interfaces.Key, digest []byte, opts interfaces.SignerOpts) ([]byte, error)

Sign 此方法传入的第一个参数必须是 *ECDSAPrivateKey,第三个参数 SignerOpts 可以是 nil。

type ECDSAX509PublicKeyImportOpts

type ECDSAX509PublicKeyImportOpts struct {
	Temporary bool
}

func (*ECDSAX509PublicKeyImportOpts) Algorithm

func (opts *ECDSAX509PublicKeyImportOpts) Algorithm() string

func (*ECDSAX509PublicKeyImportOpts) Ephemeral

func (opts *ECDSAX509PublicKeyImportOpts) Ephemeral() bool

type ECDSAX509PublicKeyImporter

type ECDSAX509PublicKeyImporter struct {
	// contains filtered or unexported fields
}

func NewECDSAX509PublicKeyImporter

func NewECDSAX509PublicKeyImporter(csp *softimpl.SoftCSPImpl) *ECDSAX509PublicKeyImporter

func (*ECDSAX509PublicKeyImporter) KeyImport

func (importer *ECDSAX509PublicKeyImporter) KeyImport(raw interface{}, opts interfaces.KeyImportOpts) (interfaces.Key, error)

KeyImport 此方法的第一个参数必须是 *x509.Certificate,第二个参数 KeyImportOpts 可以是 nil。

Jump to

Keyboard shortcuts

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