package crypto

Import Path
	crypto (on go.dev)

Dependency Relation
	imports 3 packages, and imported by 11 packages

Involved Source Files Package crypto collects common cryptographic constants.
Package-Level Type Names (total 7)
/* sort by: | */
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. Decrypt decrypts msg. The opts argument should be appropriate for the primitive used. See the documentation in each implementation for details. Public returns the public key corresponding to the opaque, private key. *crypto/rsa.PrivateKey
func Decrypter.Decrypt(rand io.Reader, msg []byte, opts DecrypterOpts) (plaintext []byte, err error) func crypto/rsa.(*PrivateKey).Decrypt(rand io.Reader, ciphertext []byte, opts DecrypterOpts) (plaintext []byte, err error)
Hash identifies a cryptographic hash function that is implemented in another package. Available reports whether the given hash function is linked into the binary. 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. Size returns the length, in bytes, of a digest resulting from the given hash function. It doesn't require that the hash function in question be linked into the program. ( Hash) String() string Hash : SignerOpts Hash : expvar.Var Hash : fmt.Stringer func Hash.HashFunc() Hash func SignerOpts.HashFunc() Hash func crypto/ed25519.(*Options).HashFunc() Hash func crypto/rsa.(*PSSOptions).HashFunc() Hash func RegisterHash(h Hash, f func() hash.Hash) func crypto/internal/boring.SignRSAPKCS1v15(priv *boring.PrivateKeyRSA, h Hash, hashed []byte) ([]byte, error) func crypto/internal/boring.SignRSAPSS(priv *boring.PrivateKeyRSA, h Hash, hashed []byte, saltLen int) ([]byte, error) func crypto/internal/boring.VerifyRSAPKCS1v15(pub *boring.PublicKeyRSA, h Hash, hashed, sig []byte) error func crypto/internal/boring.VerifyRSAPSS(pub *boring.PublicKeyRSA, h Hash, hashed, sig []byte, saltLen int) error func crypto/rsa.SignPKCS1v15(random io.Reader, priv *rsa.PrivateKey, hash Hash, hashed []byte) ([]byte, error) func crypto/rsa.SignPSS(rand io.Reader, priv *rsa.PrivateKey, hash Hash, digest []byte, opts *rsa.PSSOptions) ([]byte, error) func crypto/rsa.VerifyPKCS1v15(pub *rsa.PublicKey, hash Hash, hashed []byte, sig []byte) error func crypto/rsa.VerifyPSS(pub *rsa.PublicKey, hash Hash, digest []byte, sig []byte, opts *rsa.PSSOptions) error const BLAKE2b_256 const BLAKE2b_384 const BLAKE2b_512 const BLAKE2s_256 const MD4 const MD5 const MD5SHA1 const RIPEMD160 const SHA1 const SHA224 const SHA256 const SHA384 const SHA3_224 const SHA3_256 const SHA3_384 const SHA3_512 const SHA512 const SHA512_224 const SHA512_256
PrivateKey represents a private key using an unspecified algorithm. Although this type is an empty interface for backwards compatibility reasons, all private key types in the standard library implement the following interface interface{ Public() crypto.PublicKey Equal(x crypto.PrivateKey) bool } as well as purpose-specific interfaces such as [Signer] and [Decrypter], which can be used for increased type safety within applications. func crypto/ecdh.(*PrivateKey).Equal(x PrivateKey) bool func crypto/ecdsa.(*PrivateKey).Equal(x PrivateKey) bool func crypto/ed25519.PrivateKey.Equal(x PrivateKey) bool func crypto/rsa.(*PrivateKey).Equal(x PrivateKey) bool
PublicKey represents a public key using an unspecified algorithm. Although this type is an empty interface for backwards compatibility reasons, all public key types in the standard library implement the following interface interface{ Equal(x crypto.PublicKey) bool } which can be used for increased type safety within applications. func Decrypter.Public() PublicKey func Signer.Public() PublicKey func crypto/ecdh.(*PrivateKey).Public() PublicKey func crypto/ecdsa.(*PrivateKey).Public() PublicKey func crypto/ed25519.PrivateKey.Public() PublicKey func crypto/rsa.(*PrivateKey).Public() PublicKey func crypto/ecdh.(*PublicKey).Equal(x PublicKey) bool func crypto/ecdsa.(*PublicKey).Equal(x PublicKey) bool func crypto/ed25519.PublicKey.Equal(x PublicKey) bool func crypto/rsa.(*PublicKey).Equal(x PublicKey) bool
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. Public returns the public key corresponding to the opaque, private key. 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. *crypto/ecdsa.PrivateKey crypto/ed25519.PrivateKey *crypto/rsa.PrivateKey func crypto/x509.CreateRevocationList(rand io.Reader, template *x509.RevocationList, issuer *x509.Certificate, priv Signer) ([]byte, error)
SignerOpts contains options for signing with a [Signer]. HashFunc returns an identifier for the hash function used to produce the message passed to Signer.Sign, or else zero to indicate that no hashing was done. Hash *crypto/ed25519.Options *crypto/rsa.PSSOptions func Signer.Sign(rand io.Reader, digest []byte, opts SignerOpts) (signature []byte, err error) func crypto/ecdsa.(*PrivateKey).Sign(rand io.Reader, digest []byte, opts SignerOpts) ([]byte, error) func crypto/ed25519.PrivateKey.Sign(rand io.Reader, message []byte, opts SignerOpts) (signature []byte, err error) func crypto/rsa.(*PrivateKey).Sign(rand io.Reader, digest []byte, opts SignerOpts) ([]byte, error)
Package-Level Functions (only one)
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.
Package-Level Constants (total 19)
const BLAKE2b_256 Hash = 17 // import golang.org/x/crypto/blake2b
const BLAKE2b_384 Hash = 18 // import golang.org/x/crypto/blake2b
const BLAKE2b_512 Hash = 19 // import golang.org/x/crypto/blake2b
const BLAKE2s_256 Hash = 16 // import golang.org/x/crypto/blake2s
const MD4 Hash = 1 // import golang.org/x/crypto/md4
const MD5 Hash = 2 // import crypto/md5
const MD5SHA1 Hash = 8 // no implementation; MD5+SHA1 used for TLS RSA
const RIPEMD160 Hash = 9 // import golang.org/x/crypto/ripemd160
const SHA1 Hash = 3 // import crypto/sha1
const SHA224 Hash = 4 // import crypto/sha256
const SHA256 Hash = 5 // import crypto/sha256
const SHA384 Hash = 6 // import crypto/sha512
const SHA3_224 Hash = 10 // import golang.org/x/crypto/sha3
const SHA3_256 Hash = 11 // import golang.org/x/crypto/sha3
const SHA3_384 Hash = 12 // import golang.org/x/crypto/sha3
const SHA3_512 Hash = 13 // import golang.org/x/crypto/sha3
const SHA512 Hash = 7 // import crypto/sha512
const SHA512_224 Hash = 14 // import crypto/sha512
const SHA512_256 Hash = 15 // import crypto/sha512