identity

package
v0.0.0-...-c3677c5 Latest Latest
Warning

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

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

Documentation

Overview

Package identity contains helper functions for signing data and verifying signatures

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Verify

func Verify(data []byte, sig *titus.CertificateSignature) bool

Verify verify

func VerifyStringSig

func VerifyStringSig(data []byte, sig *titus.CertificateStringSignature) bool

VerifyStringSig verify

func VerifyWithPublicKey

func VerifyWithPublicKey(data []byte, key crypto.PublicKey, sig []byte) bool

VerifyWithPublicKey with a given public key

Types

type Signer

type Signer struct {
	Algorithm   titus.SignatureAlgorithm
	Certificate tls.Certificate
	Hash        crypto.Hash
	SignerOpts  crypto.SignerOpts
	Signer      crypto.Signer
}

Signer signs bytes using an x509 cert / key pair: in practice, this is the client cert

func NewDefaultSigner

func NewDefaultSigner() (*Signer, error)

NewDefaultSigner creates a signer with the default certificate path to the client cert

func NewSigner

func NewSigner(cert tls.Certificate) (*Signer, error)

NewSigner creates a new signer with the passed in TLS certificate

func (*Signer) Sign

func (s *Signer) Sign(data []byte) (*titus.CertificateSignature, error)

Sign signs the bytes, returning a CertificateSignature suitable for binary encoding

func (*Signer) SignString

func (s *Signer) SignString(data []byte) (*titus.CertificateStringSignature, error)

SignString signs the bytes, returning a CertificateStringSignature suitable for JSON encoding

Jump to

Keyboard shortcuts

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