signer

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CryptoSigner

type CryptoSigner struct {
	PubKeyBytes []byte
	PubKey      interface{}
	// contains filtered or unexported fields
}

CryptoSigner defines signer based on crypto.

func NewCryptoSigner

func NewCryptoSigner(crypto cryptoapi.Crypto, kms kmsapi.KeyManager, keyType kmsapi.KeyType) (*CryptoSigner, error)

NewCryptoSigner creates a new CryptoSigner.

func (*CryptoSigner) Alg added in v0.1.9

func (s *CryptoSigner) Alg() string

Alg returns alg.

func (*CryptoSigner) KID added in v0.1.6

func (s *CryptoSigner) KID() string

KID returns key id.

func (*CryptoSigner) PublicKey

func (s *CryptoSigner) PublicKey() interface{}

PublicKey returns a public key object (e.g. ed25519.VerificationMethod or *ecdsa.PublicKey).

func (*CryptoSigner) PublicKeyBytes

func (s *CryptoSigner) PublicKeyBytes() []byte

PublicKeyBytes returns bytes of the public key.

func (*CryptoSigner) Sign

func (s *CryptoSigner) Sign(msg []byte) ([]byte, error)

Sign will sign document and return signature.

type ECDSASigner

type ECDSASigner struct {
	PubKey *ecdsa.PublicKey
	// contains filtered or unexported fields
}

ECDSASigner makes ECDSA based signatures.

func GetECDSAP256Signer

func GetECDSAP256Signer(privKey *ecdsa.PrivateKey) *ECDSASigner

GetECDSAP256Signer creates a new ECDSA P256 signer with passed ECDSA P256 private key.

func GetECDSAP384Signer

func GetECDSAP384Signer(privKey *ecdsa.PrivateKey) *ECDSASigner

GetECDSAP384Signer creates a new ECDSA P384 signer with passed ECDSA P384 private key.

func GetECDSAP521Signer

func GetECDSAP521Signer(privKey *ecdsa.PrivateKey) *ECDSASigner

GetECDSAP521Signer creates a new ECDSA P521 signer with passed ECDSA P521 private key.

func GetECDSASecp256k1Signer

func GetECDSASecp256k1Signer(privKey *ecdsa.PrivateKey) *ECDSASigner

GetECDSASecp256k1Signer creates a new ECDSA Secp256k1 signer with passed ECDSA Secp256k1 private key.

func GetECDSASigner added in v0.1.9

func GetECDSASigner(privKey *ecdsa.PrivateKey) (*ECDSASigner, error)

GetECDSASigner creates a new ECDSA signer based on the input *ecdsa.PrivateKey.

func NewECDSAP256Signer

func NewECDSAP256Signer() (*ECDSASigner, error)

NewECDSAP256Signer creates a new ECDSA P256 signer with generated key.

func NewECDSAP384Signer

func NewECDSAP384Signer() (*ECDSASigner, error)

NewECDSAP384Signer creates a new ECDSA P384 signer with generated key.

func NewECDSAP521Signer

func NewECDSAP521Signer() (*ECDSASigner, error)

NewECDSAP521Signer creates a new ECDSA P521 signer with generated key.

func NewECDSASecp256k1Signer

func NewECDSASecp256k1Signer() (*ECDSASigner, error)

NewECDSASecp256k1Signer creates a new ECDSA Secp256k1 signer with generated key.

func NewECDSASigner

func NewECDSASigner(curve elliptic.Curve) (*ECDSASigner, error)

NewECDSASigner creates a new ECDSA signer based on the input elliptic curve.

func (*ECDSASigner) Alg added in v0.1.9

func (es *ECDSASigner) Alg() string

Alg return alg.

func (*ECDSASigner) PublicKey

func (es *ECDSASigner) PublicKey() interface{}

PublicKey returns a public key object (*ecdsa.PublicKey).

func (*ECDSASigner) PublicKeyBytes

func (es *ECDSASigner) PublicKeyBytes() []byte

PublicKeyBytes returns bytes of the public key.

func (*ECDSASigner) Sign

func (es *ECDSASigner) Sign(msg []byte) ([]byte, error)

Sign signs a message.

type Ed25519Signer

type Ed25519Signer struct {
	PubKey ed25519.PublicKey
	// contains filtered or unexported fields
}

Ed25519Signer makes Ed25519 based signatures.

func GetEd25519Signer

func GetEd25519Signer(privKey ed25519.PrivateKey, pubKey ed25519.PublicKey) *Ed25519Signer

GetEd25519Signer creates a new Ed25519 signer with passed Ed25519 key pair.

func NewEd25519Signer

func NewEd25519Signer() (*Ed25519Signer, error)

NewEd25519Signer creates a new Ed25519 signer with generated key.

func (*Ed25519Signer) Alg added in v0.1.9

func (s *Ed25519Signer) Alg() string

Alg return alg.

func (*Ed25519Signer) PublicKey

func (s *Ed25519Signer) PublicKey() interface{}

PublicKey returns a public key object (ed25519.VerificationMethod).

func (*Ed25519Signer) PublicKeyBytes

func (s *Ed25519Signer) PublicKeyBytes() []byte

PublicKeyBytes returns bytes of the public key.

func (*Ed25519Signer) Sign

func (s *Ed25519Signer) Sign(msg []byte) ([]byte, error)

Sign signs a message.

type PS256Signer

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

PS256Signer makes PS256 based signatures.

func GetPS256Signer

func GetPS256Signer(privKey *rsa.PrivateKey) *PS256Signer

GetPS256Signer creates a new PS256 signer with provided RSA private key.

func NewPS256Signer

func NewPS256Signer() (*PS256Signer, error)

NewPS256Signer creates a new PS256 signer with generated key.

func (*PS256Signer) Alg added in v0.1.9

func (s *PS256Signer) Alg() string

Alg return alg.

func (*PS256Signer) PublicKey

func (s *PS256Signer) PublicKey() interface{}

func (*PS256Signer) PublicKeyBytes

func (s *PS256Signer) PublicKeyBytes() []byte

func (*PS256Signer) Sign

func (s *PS256Signer) Sign(msg []byte) ([]byte, error)

Sign signs a message.

type RS256Signer

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

RS256Signer makes RS256 based signatures.

func GetRS256Signer

func GetRS256Signer(privKey *rsa.PrivateKey) *RS256Signer

GetRS256Signer creates a new RS256 signer with provided RSA private key.

func NewRS256Signer

func NewRS256Signer() (*RS256Signer, error)

NewRS256Signer creates a new RS256 signer with generated key.

func (*RS256Signer) Alg added in v0.1.9

func (s *RS256Signer) Alg() string

Alg return alg.

func (*RS256Signer) PublicKey

func (s *RS256Signer) PublicKey() interface{}

func (*RS256Signer) PublicKeyBytes

func (s *RS256Signer) PublicKeyBytes() []byte

func (*RS256Signer) Sign

func (s *RS256Signer) Sign(msg []byte) ([]byte, error)

Sign signs a message.

Jump to

Keyboard shortcuts

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