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.
- type Decrypter interface {
- // Public returns the public key corresponding to the opaque,
- // private key.
- Public() PublicKey
- // Decrypt decrypts msg. The opts argument should be appropriate for
- // the primitive used. See the documentation in each implementation for
- Decrypt(rand .Reader, msg [], opts DecrypterOpts) (plaintext [], err error)
- }
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
¶
- type DecrypterOpts interface{}
type
¶
- type Hash
Hash identifies a cryptographic hash function that is implemented in another
package.
- func (h Hash) Available()
Available reports whether the given hash function is linked into the binary.
- func (h Hash) HashFunc()
HashFunc simply returns the value of h so that Hash implements SignerOpts.
New returns a new hash.Hash calculating the given hash function. New panics if
the hash function is not linked into the binary.
type
¶
- type PrivateKey interface{}
PrivateKey represents a private key using an unspecified algorithm.
- type PublicKey interface{}
PublicKey represents a public key using an unspecified algorithm.
type
¶
- type Signer interface {
- // Public returns the public key corresponding to the opaque,
- // private key.
- Public()
- // Sign signs digest with the private key, possibly using entropy from
- // rand. For an RSA key, the resulting signature should be either a
- // PKCS#1 v1.5 or PSS signature (as indicated by opts). For an (EC)DSA
- // key, it should be a DER-serialised, ASN.1 signature structure.
- //
- // Hash implements the SignerOpts interface and, in most cases, one can
- // simply pass in the hash function used as opts. Sign may also attempt
- // to type assert opts to other types in order to obtain algorithm
- // specific values. See the documentation in each package for details.
- // Note that when a signature of a hash of a larger message is needed,
- // the caller is responsible for hashing the larger message and passing
- // the hash (as digest) and the hash function (as opts) to Sign.
- Sign(rand io., digest []byte, opts ) (signature []byte, err )
- }
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.