ecdsa

package
v0.0.0-...-05098b9 Latest Latest
Warning

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

Go to latest
Published: May 20, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ECDSA

type ECDSA struct{}

ECDSA struct to implement the IECDSA methods

func (*ECDSA) FromPEM

func (e *ECDSA) FromPEM(privatePEM p.PrivatePEM, publicPEM p.PublicPEM) (*ecdsa.PrivateKey, *ecdsa.PublicKey, error)

FromPEM takes pem keys and converts them into a ecdsa keys

func (*ECDSA) FromPEMPrivateKey

func (e *ECDSA) FromPEMPrivateKey(privatePEM p.PrivatePEM) (*ecdsa.PrivateKey, error)

FromPEMPrivateKey takes a private pem key and converts it into a ecdsa private key

func (*ECDSA) FromPEMPublicKey

func (e *ECDSA) FromPEMPublicKey(publicPEM p.PublicPEM) (*ecdsa.PublicKey, error)

FromPEMPublicKey takes a public pem key and converts it into a ecdsa public key

func (*ECDSA) P224

func (e *ECDSA) P224() (*ecdsa.PrivateKey, *ecdsa.PublicKey, error)

P224 generates new ECDSA P224 private/public keys

func (*ECDSA) P224PEM

P224PEM generates new ECDSA P224 private/public pem keys

func (*ECDSA) P224PEMPrivateKey

func (e *ECDSA) P224PEMPrivateKey() (*ecdsa.PrivateKey, p.PrivatePEM, error)

P224PEMPrivateKey generates a new ECDSA P224 private PEM key

func (*ECDSA) P224PrivateKey

func (e *ECDSA) P224PrivateKey() (*ecdsa.PrivateKey, error)

P224PrivateKey generates a new ECDSA P224 private key

func (*ECDSA) P256

func (e *ECDSA) P256() (*ecdsa.PrivateKey, *ecdsa.PublicKey, error)

P256 generates new ECDSA P256 private/public keys

func (*ECDSA) P256PEM

P256PEM generates new ECDSA P256 private/public pem keys

func (*ECDSA) P256PEMPrivateKey

func (e *ECDSA) P256PEMPrivateKey() (*ecdsa.PrivateKey, p.PrivatePEM, error)

P256PEMPrivateKey generates a new ECDSA P256 private PEM key

func (*ECDSA) P256PrivateKey

func (e *ECDSA) P256PrivateKey() (*ecdsa.PrivateKey, error)

P256PrivateKey generates a new ECDSA P256 private key

func (*ECDSA) P384

func (e *ECDSA) P384() (*ecdsa.PrivateKey, *ecdsa.PublicKey, error)

P384 generates new ECDSA P384 private/public keys

func (*ECDSA) P384PEM

P384PEM generates new ECDSA P384 private/public pem keys

func (*ECDSA) P384PEMPrivateKey

func (e *ECDSA) P384PEMPrivateKey() (*ecdsa.PrivateKey, p.PrivatePEM, error)

P384PEMPrivateKey generates a new ECDSA P384 private PEM key

func (*ECDSA) P384PrivateKey

func (e *ECDSA) P384PrivateKey() (*ecdsa.PrivateKey, error)

P384PrivateKey generates a new ECDSA P384 private key

func (*ECDSA) P521

func (e *ECDSA) P521() (*ecdsa.PrivateKey, *ecdsa.PublicKey, error)

P521 generates new ECDSA P521 private/public keys

func (*ECDSA) P521PEM

P521PEM generates new ECDSA P521 private/public pem keys

func (*ECDSA) P521PEMPrivateKey

func (e *ECDSA) P521PEMPrivateKey() (*ecdsa.PrivateKey, p.PrivatePEM, error)

P521PEMPrivateKey generates a new ECDSA P521 private PEM key

func (*ECDSA) P521PrivateKey

func (e *ECDSA) P521PrivateKey() (*ecdsa.PrivateKey, error)

P521PrivateKey generates a new ECDSA P521 private key

func (*ECDSA) ToJWK

func (e *ECDSA) ToJWK(publicKey *ecdsa.PublicKey, id string, algo jose.SignatureAlgorithm) ([]byte, error)

ToJWK converts ECDSA public key into a jwk

func (*ECDSA) ToJWKES256

func (e *ECDSA) ToJWKES256(publicKey *ecdsa.PublicKey, id string) ([]byte, error)

ToJWKES256 converts ECDSA P256 public key into a jwk ES256

func (*ECDSA) ToJWKES384

func (e *ECDSA) ToJWKES384(publicKey *ecdsa.PublicKey, id string) ([]byte, error)

ToJWKES384 converts ECDSA P384 public key into a jwk ES384

func (*ECDSA) ToJWKES512

func (e *ECDSA) ToJWKES512(publicKey *ecdsa.PublicKey, id string) ([]byte, error)

ToJWKES512 converts ECDSA P521 public key into a jwk ES512

func (*ECDSA) ToPEM

func (e *ECDSA) ToPEM(privateKey *ecdsa.PrivateKey, publicKey *ecdsa.PublicKey) (p.PrivatePEM, p.PublicPEM, error)

ToPEM converts ECDSA private & public keys, into private & public PEM keys

func (*ECDSA) ToPEMPrivateKey

func (e *ECDSA) ToPEMPrivateKey(privateKey *ecdsa.PrivateKey) (p.PrivatePEM, error)

ToPEMPrivateKey converts a ECDSA private key into a private PEM key

func (*ECDSA) ToPEMPublicKey

func (e *ECDSA) ToPEMPublicKey(publicKey *ecdsa.PublicKey) (p.PublicPEM, error)

ToPEMPublicKey converts a ECDSA public key into a public PEM key

type IECDSA

type IECDSA interface {
	P521() (*ecdsa.PrivateKey, *ecdsa.PublicKey, error)
	P384() (*ecdsa.PrivateKey, *ecdsa.PublicKey, error)
	P256() (*ecdsa.PrivateKey, *ecdsa.PublicKey, error)
	P224() (*ecdsa.PrivateKey, *ecdsa.PublicKey, error)

	P521PrivateKey() (*ecdsa.PrivateKey, error)
	P384PrivateKey() (*ecdsa.PrivateKey, error)
	P256PrivateKey() (*ecdsa.PrivateKey, error)
	P224PrivateKey() (*ecdsa.PrivateKey, error)

	P521PEM() (*ecdsa.PrivateKey, p.PrivatePEM, *ecdsa.PublicKey, p.PublicPEM, error)
	P384PEM() (*ecdsa.PrivateKey, p.PrivatePEM, *ecdsa.PublicKey, p.PublicPEM, error)
	P256PEM() (*ecdsa.PrivateKey, p.PrivatePEM, *ecdsa.PublicKey, p.PublicPEM, error)
	P224PEM() (*ecdsa.PrivateKey, p.PrivatePEM, *ecdsa.PublicKey, p.PublicPEM, error)

	P521PEMPrivateKey() (*ecdsa.PrivateKey, p.PrivatePEM, error)
	P384PEMPrivateKey() (*ecdsa.PrivateKey, p.PrivatePEM, error)
	P256PEMPrivateKey() (*ecdsa.PrivateKey, p.PrivatePEM, error)
	P224PEMPrivateKey() (*ecdsa.PrivateKey, p.PrivatePEM, error)

	FromPEMPrivateKey(p.PrivatePEM) (*ecdsa.PrivateKey, error)
	FromPEMPublicKey(p.PublicPEM) (*ecdsa.PublicKey, error)
	FromPEM(p.PrivatePEM, p.PublicPEM) (*ecdsa.PrivateKey, *ecdsa.PublicKey, error)

	ToPEMPrivateKey(*ecdsa.PrivateKey) (p.PrivatePEM, error)
	ToPEMPublicKey(*ecdsa.PublicKey) (p.PublicPEM, error)
	ToPEM(*ecdsa.PrivateKey, *ecdsa.PublicKey) (p.PrivatePEM, p.PublicPEM, error)

	ToJWKES512(publicKey *ecdsa.PublicKey, id string) ([]byte, error)
	ToJWKES384(publicKey *ecdsa.PublicKey, id string) ([]byte, error)
	ToJWKES256(publicKey *ecdsa.PublicKey, id string) ([]byte, error)
	ToJWK(publicKey *ecdsa.PublicKey, id string, algo jose.SignatureAlgorithm) ([]byte, error)
}

IECDSA interface for methods to generate ecdsa keys and conversion to PEM format

func NewECDSA

func NewECDSA() IECDSA

NewECDSA get a new ECDSA pointer

Jump to

Keyboard shortcuts

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