verifier

package
v0.1.6-0...-5c25bcb Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BBSG2SignatureProofVerifier

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

BBSG2SignatureProofVerifier is a signature verifier that verifies a BBS+ Signature Proof taking Bls12381G2Key2020 public key bytes as input. The reference implementation https://github.com/mattrglobal/bls12381-key-pair supports public key bytes only, JWK is not supported.

func NewBBSG2SignatureProofVerifier

func NewBBSG2SignatureProofVerifier(nonce []byte) *BBSG2SignatureProofVerifier

NewBBSG2SignatureProofVerifier creates a new BBSG2SignatureProofVerifier.

func (BBSG2SignatureProofVerifier) Algorithm

func (sv BBSG2SignatureProofVerifier) Algorithm() string

func (BBSG2SignatureProofVerifier) Curve

func (sv BBSG2SignatureProofVerifier) Curve() string

func (BBSG2SignatureProofVerifier) KeyType

func (sv BBSG2SignatureProofVerifier) KeyType() string

func (*BBSG2SignatureProofVerifier) Verify

func (v *BBSG2SignatureProofVerifier) Verify(pubKeyValue *PublicKey, doc, signature []byte) error

Verify verifies the signature.

type BBSG2SignatureVerifier

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

BBSG2SignatureVerifier is a signature verifier that verifies a BBS+ Signature taking Bls12381G2Key2020 public key bytes as input. The reference implementation https://github.com/mattrglobal/bls12381-key-pair supports public key bytes only, JWK is not supported.

func NewBBSG2SignatureVerifier

func NewBBSG2SignatureVerifier() *BBSG2SignatureVerifier

NewBBSG2SignatureVerifier creates a new BBSG2SignatureVerifier.

func (BBSG2SignatureVerifier) Algorithm

func (sv BBSG2SignatureVerifier) Algorithm() string

func (BBSG2SignatureVerifier) Curve

func (sv BBSG2SignatureVerifier) Curve() string

func (BBSG2SignatureVerifier) KeyType

func (sv BBSG2SignatureVerifier) KeyType() string

func (*BBSG2SignatureVerifier) Verify

func (v *BBSG2SignatureVerifier) Verify(pubKeyValue *PublicKey, doc, signature []byte) error

Verify verifies the signature.

type DocumentVerifier

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

DocumentVerifier implements JSON LD document proof verification.

func New

func New(resolver keyResolver, suites ...SignatureSuite) (*DocumentVerifier, error)

New returns new instance of document verifier.

func (*DocumentVerifier) Verify

func (dv *DocumentVerifier) Verify(jsonLdDoc []byte, opts ...jsonld.ProcessorOpts) error

Verify will verify document proofs.

type ECDSASignatureVerifier

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

ECDSASignatureVerifier verifies elliptic curve signatures.

func NewECDSAES256SignatureVerifier

func NewECDSAES256SignatureVerifier() *ECDSASignatureVerifier

NewECDSAES256SignatureVerifier creates a new signature verifier that verifies a ECDSA P-256 signature taking public key bytes and JSON Web Key as input.

func NewECDSAES384SignatureVerifier

func NewECDSAES384SignatureVerifier() *ECDSASignatureVerifier

NewECDSAES384SignatureVerifier creates a new signature verifier that verifies a ECDSA P-384 signature taking public key bytes and JSON Web Key as input.

func NewECDSAES521SignatureVerifier

func NewECDSAES521SignatureVerifier() *ECDSASignatureVerifier

NewECDSAES521SignatureVerifier creates a new signature verifier that verifies a ECDSA P-521 signature taking public key bytes and JSON Web Key as input.

func NewECDSASecp256k1SignatureVerifier

func NewECDSASecp256k1SignatureVerifier() *ECDSASignatureVerifier

NewECDSASecp256k1SignatureVerifier creates a new signature verifier that verifies a ECDSA secp256k1 signature taking public key bytes and JSON Web Key as input.

func (ECDSASignatureVerifier) Algorithm

func (sv ECDSASignatureVerifier) Algorithm() string

func (ECDSASignatureVerifier) Curve

func (sv ECDSASignatureVerifier) Curve() string

func (ECDSASignatureVerifier) KeyType

func (sv ECDSASignatureVerifier) KeyType() string

func (*ECDSASignatureVerifier) Verify

func (sv *ECDSASignatureVerifier) Verify(pubKey *PublicKey, msg, signature []byte) error

Verify verifies the signature.

type Ed25519SignatureVerifier

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

Ed25519SignatureVerifier verifies a Ed25519 signature taking Ed25519 public key bytes as input.

func NewEd25519SignatureVerifier

func NewEd25519SignatureVerifier() *Ed25519SignatureVerifier

NewEd25519SignatureVerifier creates a new Ed25519SignatureVerifier.

func (Ed25519SignatureVerifier) Algorithm

func (sv Ed25519SignatureVerifier) Algorithm() string

func (Ed25519SignatureVerifier) Curve

func (sv Ed25519SignatureVerifier) Curve() string

func (Ed25519SignatureVerifier) KeyType

func (sv Ed25519SignatureVerifier) KeyType() string

func (Ed25519SignatureVerifier) Verify

func (sv Ed25519SignatureVerifier) Verify(pubKey *PublicKey, msg, signature []byte) error

Verify verifies the signature.

type PublicKey

type PublicKey struct {
	Type  string
	Value []byte
	JWK   *jose.JWK
}

PublicKey contains a result of public key resolution.

type PublicKeyVerifier

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

PublicKeyVerifier makes signature verification using the public key based on one or several signature algorithms.

func NewCompositePublicKeyVerifier

func NewCompositePublicKeyVerifier(verifiers []SignatureVerifier, opts ...PublicKeyVerifierOpt) *PublicKeyVerifier

NewCompositePublicKeyVerifier creates a new PublicKeyVerifier based on one or more signature algorithms.

func NewPublicKeyVerifier

func NewPublicKeyVerifier(sigAlg SignatureVerifier, opts ...PublicKeyVerifierOpt) *PublicKeyVerifier

NewPublicKeyVerifier creates a new PublicKeyVerifier based on single signature algorithm.

func (*PublicKeyVerifier) Verify

func (pkv *PublicKeyVerifier) Verify(pubKey *PublicKey, msg, signature []byte) error

Verify verifies the signature.

type PublicKeyVerifierOpt

type PublicKeyVerifierOpt func(opts *PublicKeyVerifier)

PublicKeyVerifierOpt is the PublicKeyVerifier functional option.

func WithExactPublicKeyType

func WithExactPublicKeyType(jwkType string) PublicKeyVerifierOpt

WithExactPublicKeyType option is used to check the type of the PublicKey.

type RSAPS256SignatureVerifier

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

RSAPS256SignatureVerifier verifies a Ed25519 signature taking RSA public key bytes as input.

func NewRSAPS256SignatureVerifier

func NewRSAPS256SignatureVerifier() *RSAPS256SignatureVerifier

NewRSAPS256SignatureVerifier creates a new RSAPS256SignatureVerifier.

func (RSAPS256SignatureVerifier) Algorithm

func (sv RSAPS256SignatureVerifier) Algorithm() string

func (RSAPS256SignatureVerifier) Curve

func (sv RSAPS256SignatureVerifier) Curve() string

func (RSAPS256SignatureVerifier) KeyType

func (sv RSAPS256SignatureVerifier) KeyType() string

func (RSAPS256SignatureVerifier) Verify

func (sv RSAPS256SignatureVerifier) Verify(key *PublicKey, msg, signature []byte) error

Verify verifies the signature.

type SignatureSuite

type SignatureSuite interface {

	// GetCanonicalDocument will return normalized/canonical version of the document
	GetCanonicalDocument(doc map[string]interface{}, opts ...jsonld.ProcessorOpts) ([]byte, error)

	// GetDigest returns document digest
	GetDigest(doc []byte) []byte

	// Verify will verify signature against public key
	Verify(pubKey *PublicKey, doc []byte, signature []byte) error

	// Accept registers this signature suite with the given signature type
	Accept(signatureType string) bool

	// CompactProof indicates weather to compact the proof doc before canonization
	CompactProof() bool
}

SignatureSuite encapsulates signature suite methods required for signature verification.

type SignatureVerifier

type SignatureVerifier interface {
	KeyType() string

	Curve() string

	Algorithm() string

	Verify(pubKey *PublicKey, msg, signature []byte) error
}

SignatureVerifier make signature verification of a certain algorithm (e.g. Ed25519 or ECDSA secp256k1).

Jump to

Keyboard shortcuts

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