Overview

Package crypto collects common cryptographic constants.

Index

func RegisterHash

RegisterHash registers a function that returns a new instance of the given hash
function. This is intended to be called from the init function in packages that
implement hash functions.

  1. type Decrypter interface {
  2. // Public returns the public key corresponding to the opaque,
  3. // private key.
  4. Public() PublicKey
  5.  
  6. // Decrypt decrypts msg. The opts argument should be appropriate for
  7. // the primitive used. See the documentation in each implementation for
  8. Decrypt(rand .Reader, msg [], opts DecrypterOpts) (plaintext [], err error)
  9. }

Decrypter is an interface for an opaque private key that can be used for
asymmetric decryption operations. An example would be an RSA key kept in a
hardware module.

type

  1. type DecrypterOpts interface{}

type

  1. type Hash

Hash identifies a cryptographic hash function that is implemented in another
package.

  1. func (h Hash) Available()

Available reports whether the given hash function is linked into the binary.

  1. func (h Hash) HashFunc()

HashFunc simply returns the value of h so that Hash implements SignerOpts.

  1. func (h Hash) New() .Hash

New returns a new hash.Hash calculating the given hash function. New panics if
the hash function is not linked into the binary.

type

  1. type PrivateKey interface{}

PrivateKey represents a private key using an unspecified algorithm.

  1. type PublicKey interface{}

PublicKey represents a public key using an unspecified algorithm.

type

  1. type Signer interface {
  2. // Public returns the public key corresponding to the opaque,
  3. // private key.
  4. Public()
  5.  
  6. // Sign signs digest with the private key, possibly using entropy from
  7. // rand. For an RSA key, the resulting signature should be either a
  8. // PKCS#1 v1.5 or PSS signature (as indicated by opts). For an (EC)DSA
  9. // key, it should be a DER-serialised, ASN.1 signature structure.
  10. //
  11. // Hash implements the SignerOpts interface and, in most cases, one can
  12. // simply pass in the hash function used as opts. Sign may also attempt
  13. // to type assert opts to other types in order to obtain algorithm
  14. // specific values. See the documentation in each package for details.
  15. // Note that when a signature of a hash of a larger message is needed,
  16. // the caller is responsible for hashing the larger message and passing
  17. // the hash (as digest) and the hash function (as opts) to Sign.
  18. Sign(rand io., digest []byte, opts ) (signature []byte, err )
  19. }

Signer is an interface for an opaque private key that can be used for signing
operations. For example, an RSA key kept in a hardware module.

type SignerOpts

SignerOpts contains options for signing with a Signer.

Subdirectories