kkcrypto

package module
v0.0.0-...-22c55d1 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AlgES256 = "ES256"
	AlgHS256 = "HS256"
	AlgRS256 = "RS256"
)

Functions

This section is empty.

Types

type ES

type ES struct {
	Private *PrivateKey
	HashId  crypto.Hash
}

func NewES

func NewES(curve EllipticCurve) *ES

func NewES256

func NewES256() *ES

func NewES384

func NewES384() *ES

func NewES512

func NewES512() *ES

func NewRawES

func NewRawES(curve EllipticCurve, rand io.Reader, hash crypto.Hash) *ES

func (*ES) Curve

func (e *ES) Curve() EllipticCurve

func (*ES) D

func (e *ES) D() *big.Int

func (*ES) Hash

func (e *ES) Hash() hash.Hash

func (*ES) PrivateKey

func (e *ES) PrivateKey() *PrivateKey

func (*ES) PublicKey

func (e *ES) PublicKey() *PublicKey

func (*ES) Sign

func (e *ES) Sign(data []byte) []byte

func (*ES) Verify

func (e *ES) Verify(data []byte, signature []byte) bool

func (*ES) X

func (e *ES) X() *big.Int

func (*ES) Y

func (e *ES) Y() *big.Int

type EllipticCurve

type EllipticCurve elliptic.Curve

func P256

func P256() EllipticCurve

func P384

func P384() EllipticCurve

func P521

func P521() EllipticCurve

func Prime256v1

func Prime256v1() EllipticCurve

func Secp256r1

func Secp256r1() EllipticCurve

func Secp384r1

func Secp384r1() EllipticCurve

func Secp521r1

func Secp521r1() EllipticCurve

type PEM

type PEM interface {
	PEMPrivateKey() string
	PEMPublicKey() string
}

type Private

type Private interface {
	PEM() string
	Key() *ecdsa.PrivateKey
	Public() PublicKey
	Sign(data []byte, hash hash.Hash) []byte
	Bytes() []byte
	PrivateKeyHex() string
}

type PrivateKey

type PrivateKey ecdsa.PrivateKey

func (*PrivateKey) Bytes

func (k *PrivateKey) Bytes() []byte

func (*PrivateKey) Key

func (k *PrivateKey) Key() *ecdsa.PrivateKey

func (*PrivateKey) PEM

func (k *PrivateKey) PEM() string

func (*PrivateKey) PrivateKeyHex

func (k *PrivateKey) PrivateKeyHex() string

func (*PrivateKey) Public

func (k *PrivateKey) Public() *PublicKey

func (*PrivateKey) Sign

func (k *PrivateKey) Sign(data []byte, hash hash.Hash) []byte

type Public

type Public interface {
	Key() *ecdsa.PublicKey
	PEM() string
	Verify(data []byte, signature []byte, hash hash.Hash) bool
	Bytes() []byte
	Hex() string
}

type PublicKey

type PublicKey ecdsa.PublicKey

func UnmarshalECPublicKey

func UnmarshalECPublicKey(curve EllipticCurve, bs []byte) *PublicKey

func (*PublicKey) Bytes

func (k *PublicKey) Bytes() []byte

func (*PublicKey) CompressedBytes

func (k *PublicKey) CompressedBytes() []byte

func (*PublicKey) Hex

func (k *PublicKey) Hex() string

func (*PublicKey) Key

func (k *PublicKey) Key() *ecdsa.PublicKey

func (*PublicKey) PEM

func (k *PublicKey) PEM() string

func (*PublicKey) Verify

func (k *PublicKey) Verify(data []byte, signature []byte, hash hash.Hash) bool

type RS256

type RS256 struct {
	PrivateKey *rsa.PrivateKey
	PublicKey  *rsa.PublicKey
}

func NewRS256

func NewRS256() *RS256

func (*RS256) PEMPassphrasePrivateKey

func (r *RS256) PEMPassphrasePrivateKey(passphrase string) string

func (*RS256) PEMPrivateKey

func (r *RS256) PEMPrivateKey() string

func (*RS256) PEMPublicKey

func (r *RS256) PEMPublicKey() string

Jump to

Keyboard shortcuts

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