Documentation
¶
Overview ¶
Package crypto collects common cryptographic constants.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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.
Types ¶
type Decrypter ¶ added in v1.5.0
type Decrypter interface {
Public() PublicKey
Decrypt(rand io.Reader, msg []byte, opts DecrypterOpts) (plaintext []byte, 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 DecrypterOpts ¶ added in v1.5.0
type DecrypterOpts any
type Hash ¶
type Hash uint
Hash identifies a cryptographic hash function that is implemented in another package.
func (Hash) Available ¶
Available reports whether the given hash function is linked into the binary.
func (Hash) HashFunc ¶ added in v1.4.0
HashFunc simply returns the value of h so that Hash implements SignerOpts.
func (Hash) New ¶
New returns a new hash.Hash calculating the given hash function. New panics if the hash function is not linked into the binary.
type PrivateKey ¶
type PrivateKey any
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.
type PublicKey ¶ added in v1.2.0
type PublicKey any
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.
type Signer ¶ added in v1.4.0
type Signer interface {
Public() PublicKey
Sign(rand io.Reader, digest []byte, opts SignerOpts) (signature []byte, err error)
}
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 ¶ added in v1.4.0
type SignerOpts interface {
HashFunc() Hash
}
SignerOpts contains options for signing with a Signer.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package aes implements AES encryption (formerly Rijndael), as defined in U.S. Federal Information Processing Standards Publication 197.
|
Package aes implements AES encryption (formerly Rijndael), as defined in U.S. Federal Information Processing Standards Publication 197. |
|
Package cipher implements standard block cipher modes that can be wrapped around low-level block cipher implementations.
|
Package cipher implements standard block cipher modes that can be wrapped around low-level block cipher implementations. |
|
Package des implements the Data Encryption Standard (DES) and the Triple Data Encryption Algorithm (TDEA) as defined in U.S. Federal Information Processing Standards Publication 46-3.
|
Package des implements the Data Encryption Standard (DES) and the Triple Data Encryption Algorithm (TDEA) as defined in U.S. Federal Information Processing Standards Publication 46-3. |
|
Package dsa implements the Digital Signature Algorithm, as defined in FIPS 186-3.
|
Package dsa implements the Digital Signature Algorithm, as defined in FIPS 186-3. |
|
Package ecdsa implements the Elliptic Curve Digital Signature Algorithm, as defined in FIPS 186-4 and SEC 1, Version 2.0.
|
Package ecdsa implements the Elliptic Curve Digital Signature Algorithm, as defined in FIPS 186-4 and SEC 1, Version 2.0. |
|
Package ed25519 implements the Ed25519 signature algorithm.
|
Package ed25519 implements the Ed25519 signature algorithm. |
|
Package elliptic implements the standard NIST P-224, P-256, P-384, and P-521 elliptic curves over prime fields.
|
Package elliptic implements the standard NIST P-224, P-256, P-384, and P-521 elliptic curves over prime fields. |
|
Package hmac implements the Keyed-Hash Message Authentication Code (HMAC) as defined in U.S. Federal Information Processing Standards Publication 198.
|
Package hmac implements the Keyed-Hash Message Authentication Code (HMAC) as defined in U.S. Federal Information Processing Standards Publication 198. |
|
Package md5 implements the MD5 hash algorithm as defined in RFC 1321.
|
Package md5 implements the MD5 hash algorithm as defined in RFC 1321. |
|
Package rand implements a cryptographically secure random number generator.
|
Package rand implements a cryptographically secure random number generator. |
|
Package rc4 implements RC4 encryption, as defined in Bruce Schneier's Applied Cryptography.
|
Package rc4 implements RC4 encryption, as defined in Bruce Schneier's Applied Cryptography. |
|
Package rsa implements RSA encryption as specified in PKCS #1 and RFC 8017.
|
Package rsa implements RSA encryption as specified in PKCS #1 and RFC 8017. |
|
Package sha1 implements the SHA-1 hash algorithm as defined in RFC 3174.
|
Package sha1 implements the SHA-1 hash algorithm as defined in RFC 3174. |
|
Package sha256 implements the SHA224 and SHA256 hash algorithms as defined in FIPS 180-4.
|
Package sha256 implements the SHA224 and SHA256 hash algorithms as defined in FIPS 180-4. |
|
Package sha512 implements the SHA-384, SHA-512, SHA-512/224, and SHA-512/256 hash algorithms as defined in FIPS 180-4.
|
Package sha512 implements the SHA-384, SHA-512, SHA-512/224, and SHA-512/256 hash algorithms as defined in FIPS 180-4. |
|
Package subtle implements functions that are often useful in cryptographic code but require careful thought to use correctly.
|
Package subtle implements functions that are often useful in cryptographic code but require careful thought to use correctly. |
|
Package tls partially implements TLS 1.2, as specified in RFC 5246, and TLS 1.3, as specified in RFC 8446.
|
Package tls partially implements TLS 1.2, as specified in RFC 5246, and TLS 1.3, as specified in RFC 8446. |
|
pkix
Package pkix contains shared, low level structures used for ASN.1 parsing and serialization of X.509 certificates, CRL and OCSP.
|
Package pkix contains shared, low level structures used for ASN.1 parsing and serialization of X.509 certificates, CRL and OCSP. |