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 ¶
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 // details. 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 ¶
type DecrypterOpts interface{}
type Hash ¶
type Hash uint
Hash identifies a cryptographic hash function that is implemented in another package.
const ( MD4 Hash = 1 + iota // import golang.org/x/crypto/md4 MD5 // import crypto/md5 SHA1 // import crypto/sha1 SHA224 // import crypto/sha256 SHA256 // import crypto/sha256 SHA384 // import crypto/sha512 SHA512 // import crypto/sha512 MD5SHA1 // no implementation; MD5+SHA1 used for TLS RSA RIPEMD160 // import golang.org/x/crypto/ripemd160 SHA3_224 // import golang.org/x/crypto/sha3 SHA3_256 // import golang.org/x/crypto/sha3 SHA3_384 // import golang.org/x/crypto/sha3 SHA3_512 // import golang.org/x/crypto/sha3 SHA512_224 // import crypto/sha512 SHA512_256 // import crypto/sha512 BLAKE2s_256 // import golang.org/x/crypto/blake2s BLAKE2b_256 // import golang.org/x/crypto/blake2b BLAKE2b_384 // import golang.org/x/crypto/blake2b BLAKE2b_512 // import golang.org/x/crypto/blake2b )
func (Hash) Available ¶
Available reports whether the given hash function is linked into the binary.
type PrivateKey ¶
type PrivateKey interface{}
PrivateKey represents a private key using an unspecified algorithm.
type PublicKey ¶
type PublicKey interface{}
PublicKey represents a public key using an unspecified algorithm.
type Signer ¶
type Signer interface { // Public returns the public key corresponding to the opaque, // private key. Public() PublicKey // 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 DERserialised, 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.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 ¶
type SignerOpts interface { // 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. 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 lowlevel block cipher implementations.

Package cipher implements standard block cipher modes that can be wrapped around lowlevel 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 463.

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 463. 
Package dsa implements the Digital Signature Algorithm, as defined in FIPS 1863.

Package dsa implements the Digital Signature Algorithm, as defined in FIPS 1863. 
Package ecdsa implements the Elliptic Curve Digital Signature Algorithm, as defined in FIPS 1863.

Package ecdsa implements the Elliptic Curve Digital Signature Algorithm, as defined in FIPS 1863. 
Package elliptic implements several standard elliptic curves over prime fields.

Package elliptic implements several standard elliptic curves over prime fields. 
Package hmac implements the KeyedHash Message Authentication Code (HMAC) as defined in U.S. Federal Information Processing Standards Publication 198.

Package hmac implements the KeyedHash Message Authentication Code (HMAC) as defined in U.S. Federal Information Processing Standards Publication 198. 
internal


boring
Package boring provides access to BoringCrypto implementation functions.

Package boring provides access to BoringCrypto implementation functions. 
boring/fipstls
Package fipstls allows control over whether crypto/tls requires FIPSapproved settings.

Package fipstls allows control over whether crypto/tls requires FIPSapproved settings. 
boring/sig
Package sig holds “code signatures” that can be called and will result in certain code sequences being linked into the final binary.

Package sig holds “code signatures” that can be called and will result in certain code sequences being linked into the final binary. 
cipherhw
Package cipherhw exposes common functions for detecting whether hardware support for certain ciphers and authenticators is present.

Package cipherhw exposes common functions for detecting whether hardware support for certain ciphers and authenticators is present. 
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 pseudorandom number generator.

Package rand implements a cryptographically secure pseudorandom 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.

Package rsa implements RSA encryption as specified in PKCS#1. 
Package sha1 implements the SHA1 hash algorithm as defined in RFC 3174.

Package sha1 implements the SHA1 hash algorithm as defined in RFC 3174. 
Package sha256 implements the SHA224 and SHA256 hash algorithms as defined in FIPS 1804.

Package sha256 implements the SHA224 and SHA256 hash algorithms as defined in FIPS 1804. 
Package sha512 implements the SHA384, SHA512, SHA512/224, and SHA512/256 hash algorithms as defined in FIPS 1804.

Package sha512 implements the SHA384, SHA512, SHA512/224, and SHA512/256 hash algorithms as defined in FIPS 1804. 
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.

Package tls partially implements TLS 1.2, as specified in RFC 5246. 
fipsonly
Package fipsonly restricts all TLS configuration to FIPSapproved settings.

Package fipsonly restricts all TLS configuration to FIPSapproved settings. 
Package x509 parses X.509encoded keys and certificates.

Package x509 parses X.509encoded keys and certificates. 
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. 