utils

package
v0.0.0-...-5a44e68 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Unsupported = fmt.Errorf("Algorithm not supported")
)

Functions

func Encrypt

func Encrypt(rand io.Reader, cert x509.Certificate, plaintext []byte, opts EncryptorOpts) ([]byte, error)

Encrypt the input plaintext to the x509 Certificate's Private Key

func Verify

func Verify(rand io.Reader, cert x509.Certificate, input, signature []byte, opts VerifierOpts) error

Types

type Encryptor

type Encryptor interface {
	// Public returns the public key corresponding to the opaque,
	// private key.
	Public() crypto.PublicKey

	// Encrypt encrypts msg. The opts argument should be appropriate for
	// the primitive used. See the documentation in each implementation for
	// details.
	Encrypt(rand io.Reader, cleartext []byte, opts EncryptorOpts) (ciphertext []byte, err error)
}

type EncryptorOpts

type EncryptorOpts interface{}

type Verifier

type Verifier interface {
	// Public returns the public key corresponding to the opaque,
	// private key.
	Public() crypto.PublicKey

	// Verify checks the valididity of the signature over the given
	// digest value.
	Verify(rand io.Reader, digest []byte, signature []byte, opts VerifierOpts) error
}

type VerifierOpts

type VerifierOpts interface {
	HashFunc() crypto.Hash
}

Jump to

Keyboard shortcuts

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