summaryrefslogtreecommitdiff
path: root/devdocs/go/crypto%2Findex.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/go/crypto%2Findex.html
new repository
Diffstat (limited to 'devdocs/go/crypto%2Findex.html')
-rw-r--r--devdocs/go/crypto%2Findex.html106
1 files changed, 106 insertions, 0 deletions
diff --git a/devdocs/go/crypto%2Findex.html b/devdocs/go/crypto%2Findex.html
new file mode 100644
index 00000000..40f5c02a
--- /dev/null
+++ b/devdocs/go/crypto%2Findex.html
@@ -0,0 +1,106 @@
+<h1> Package crypto </h1> <ul id="short-nav">
+<li><code>import "crypto"</code></li>
+<li><a href="#pkg-overview" class="overviewLink">Overview</a></li>
+<li><a href="#pkg-index" class="indexLink">Index</a></li>
+<li><a href="#pkg-subdirectories">Subdirectories</a></li>
+</ul> <h2 id="pkg-overview">Overview </h2> <p>Package crypto collects common cryptographic constants. </p> <h2 id="pkg-index">Index </h2> <ul id="manual-nav">
+<li><a href="#RegisterHash">func RegisterHash(h Hash, f func() hash.Hash)</a></li>
+<li><a href="#Decrypter">type Decrypter</a></li>
+<li><a href="#DecrypterOpts">type DecrypterOpts</a></li>
+<li><a href="#Hash">type Hash</a></li>
+<li> <a href="#Hash.Available">func (h Hash) Available() bool</a>
+</li>
+<li> <a href="#Hash.HashFunc">func (h Hash) HashFunc() Hash</a>
+</li>
+<li> <a href="#Hash.New">func (h Hash) New() hash.Hash</a>
+</li>
+<li> <a href="#Hash.Size">func (h Hash) Size() int</a>
+</li>
+<li> <a href="#Hash.String">func (h Hash) String() string</a>
+</li>
+<li><a href="#PrivateKey">type PrivateKey</a></li>
+<li><a href="#PublicKey">type PublicKey</a></li>
+<li><a href="#Signer">type Signer</a></li>
+<li><a href="#SignerOpts">type SignerOpts</a></li>
+</ul> <h3>Package files</h3> <p> <span>crypto.go</span> </p> <h2 id="RegisterHash">func <span>RegisterHash</span> </h2> <pre data-language="go">func RegisterHash(h Hash, f func() hash.Hash)</pre> <p>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. </p>
+<h2 id="Decrypter">type <span>Decrypter</span> <span title="Added in Go 1.5">1.5</span> </h2> <p>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. </p>
+<pre data-language="go">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)
+}</pre> <h2 id="DecrypterOpts">type <span>DecrypterOpts</span> <span title="Added in Go 1.5">1.5</span> </h2> <pre data-language="go">type DecrypterOpts any</pre> <h2 id="Hash">type <span>Hash</span> </h2> <p>Hash identifies a cryptographic hash function that is implemented in another package. </p>
+<pre data-language="go">type Hash uint</pre> <pre data-language="go">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
+
+)</pre> <h3 id="Hash.Available">func (Hash) <span>Available</span> </h3> <pre data-language="go">func (h Hash) Available() bool</pre> <p>Available reports whether the given hash function is linked into the binary. </p>
+<h3 id="Hash.HashFunc">func (Hash) <span>HashFunc</span> <span title="Added in Go 1.4">1.4</span> </h3> <pre data-language="go">func (h Hash) HashFunc() Hash</pre> <p>HashFunc simply returns the value of h so that <a href="#Hash">Hash</a> implements <a href="#SignerOpts">SignerOpts</a>. </p>
+<h3 id="Hash.New">func (Hash) <span>New</span> </h3> <pre data-language="go">func (h Hash) New() hash.Hash</pre> <p>New returns a new hash.Hash calculating the given hash function. New panics if the hash function is not linked into the binary. </p>
+<h3 id="Hash.Size">func (Hash) <span>Size</span> </h3> <pre data-language="go">func (h Hash) Size() int</pre> <p>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. </p>
+<h3 id="Hash.String">func (Hash) <span>String</span> <span title="Added in Go 1.15">1.15</span> </h3> <pre data-language="go">func (h Hash) String() string</pre> <h2 id="PrivateKey">type <span>PrivateKey</span> </h2> <p>PrivateKey represents a private key using an unspecified algorithm. </p>
+<p>Although this type is an empty interface for backwards compatibility reasons, all private key types in the standard library implement the following interface </p>
+<pre data-language="go">interface{
+ Public() crypto.PublicKey
+ Equal(x crypto.PrivateKey) bool
+}
+</pre> <p>as well as purpose-specific interfaces such as <a href="#Signer">Signer</a> and <a href="#Decrypter">Decrypter</a>, which can be used for increased type safety within applications. </p>
+<pre data-language="go">type PrivateKey any</pre> <h2 id="PublicKey">type <span>PublicKey</span> <span title="Added in Go 1.2">1.2</span> </h2> <p>PublicKey represents a public key using an unspecified algorithm. </p>
+<p>Although this type is an empty interface for backwards compatibility reasons, all public key types in the standard library implement the following interface </p>
+<pre data-language="go">interface{
+ Equal(x crypto.PublicKey) bool
+}
+</pre> <p>which can be used for increased type safety within applications. </p>
+<pre data-language="go">type PublicKey any</pre> <h2 id="Signer">type <span>Signer</span> <span title="Added in Go 1.4">1.4</span> </h2> <p>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. </p>
+<pre data-language="go">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 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.Reader, digest []byte, opts SignerOpts) (signature []byte, err error)
+}</pre> <h2 id="SignerOpts">type <span>SignerOpts</span> <span title="Added in Go 1.4">1.4</span> </h2> <p>SignerOpts contains options for signing with a <a href="#Signer">Signer</a>. </p>
+<pre data-language="go">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
+}</pre> <h2 id="pkg-subdirectories">Subdirectories</h2> <div class="pkg-dir"> <table> <tr> <th class="pkg-name">Name</th> <th class="pkg-synopsis">Synopsis</th> </tr> <tr> <td colspan="2"><a href="../index">..</a></td> </tr> <tr> <td class="pkg-name"> <a href="aes/index">aes</a> </td> <td class="pkg-synopsis"> Package aes implements AES encryption (formerly Rijndael), as defined in U.S. Federal Information Processing Standards Publication 197. </td> </tr> <tr> <td class="pkg-name"> <a href="boring/index">boring</a> </td> <td class="pkg-synopsis"> Package boring exposes functions that are only available when building with Go+BoringCrypto. </td> </tr> <tr> <td class="pkg-name"> <a href="cipher/index">cipher</a> </td> <td class="pkg-synopsis"> Package cipher implements standard block cipher modes that can be wrapped around low-level block cipher implementations. </td> </tr> <tr> <td class="pkg-name"> <a href="des/index">des</a> </td> <td class="pkg-synopsis"> 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. </td> </tr> <tr> <td class="pkg-name"> <a href="dsa/index">dsa</a> </td> <td class="pkg-synopsis"> Package dsa implements the Digital Signature Algorithm, as defined in FIPS 186-3. </td> </tr> <tr> <td class="pkg-name"> <a href="ecdh/index">ecdh</a> </td> <td class="pkg-synopsis"> Package ecdh implements Elliptic Curve Diffie-Hellman over NIST curves and Curve25519. </td> </tr> <tr> <td class="pkg-name"> <a href="ecdsa/index">ecdsa</a> </td> <td class="pkg-synopsis"> Package ecdsa implements the Elliptic Curve Digital Signature Algorithm, as defined in FIPS 186-4 and SEC 1, Version 2.0. </td> </tr> <tr> <td class="pkg-name"> <a href="ed25519/index">ed25519</a> </td> <td class="pkg-synopsis"> Package ed25519 implements the Ed25519 signature algorithm. </td> </tr> <tr> <td class="pkg-name"> <a href="elliptic/index">elliptic</a> </td> <td class="pkg-synopsis"> Package elliptic implements the standard NIST P-224, P-256, P-384, and P-521 elliptic curves over prime fields. </td> </tr> <tr> <td class="pkg-name"> <a href="hmac/index">hmac</a> </td> <td class="pkg-synopsis"> Package hmac implements the Keyed-Hash Message Authentication Code (HMAC) as defined in U.S. Federal Information Processing Standards Publication 198. </td> </tr> <tr> <td class="pkg-name"> <a href="md5/index">md5</a> </td> <td class="pkg-synopsis"> Package md5 implements the MD5 hash algorithm as defined in RFC 1321. </td> </tr> <tr> <td class="pkg-name"> <a href="rand/index">rand</a> </td> <td class="pkg-synopsis"> Package rand implements a cryptographically secure random number generator. </td> </tr> <tr> <td class="pkg-name"> <a href="rc4/index">rc4</a> </td> <td class="pkg-synopsis"> Package rc4 implements RC4 encryption, as defined in Bruce Schneier's Applied Cryptography. </td> </tr> <tr> <td class="pkg-name"> <a href="rsa/index">rsa</a> </td> <td class="pkg-synopsis"> Package rsa implements RSA encryption as specified in PKCS #1 and RFC 8017. </td> </tr> <tr> <td class="pkg-name"> <a href="sha1/index">sha1</a> </td> <td class="pkg-synopsis"> Package sha1 implements the SHA-1 hash algorithm as defined in RFC 3174. </td> </tr> <tr> <td class="pkg-name"> <a href="sha256/index">sha256</a> </td> <td class="pkg-synopsis"> Package sha256 implements the SHA224 and SHA256 hash algorithms as defined in FIPS 180-4. </td> </tr> <tr> <td class="pkg-name"> <a href="sha512/index">sha512</a> </td> <td class="pkg-synopsis"> Package sha512 implements the SHA-384, SHA-512, SHA-512/224, and SHA-512/256 hash algorithms as defined in FIPS 180-4. </td> </tr> <tr> <td class="pkg-name"> <a href="subtle/index">subtle</a> </td> <td class="pkg-synopsis"> Package subtle implements functions that are often useful in cryptographic code but require careful thought to use correctly. </td> </tr> <tr> <td class="pkg-name"> <a href="tls/index">tls</a> </td> <td class="pkg-synopsis"> Package tls partially implements TLS 1.2, as specified in RFC 5246, and TLS 1.3, as specified in RFC 8446. </td> </tr> <tr> <td class="pkg-name"> <a href="tls/fipsonly/index">fipsonly</a> </td> <td class="pkg-synopsis"> Package fipsonly restricts all TLS configuration to FIPS-approved settings. </td> </tr> <tr> <td class="pkg-name"> <a href="x509/index">x509</a> </td> <td class="pkg-synopsis"> Package x509 implements a subset of the X.509 standard. </td> </tr> <tr> <td class="pkg-name"> <a href="x509/pkix/index">pkix</a> </td> <td class="pkg-synopsis"> Package pkix contains shared, low level structures used for ASN.1 parsing and serialization of X.509 certificates, CRL and OCSP. </td> </tr> </table> </div><div class="_attribution">
+ <p class="_attribution-p">
+ &copy; Google, Inc.<br>Licensed under the Creative Commons Attribution License 3.0.<br>
+ <a href="http://golang.org/pkg/crypto/" class="_attribution-link">http://golang.org/pkg/crypto/</a>
+ </p>
+</div>