Documentation
¶
Overview ¶
cryptoパッケージは一般的な暗号定数を収集します。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterHash ¶
RegisterHash は与えられたハッシュ関数の新しいインスタンスを返す関数を登録します。 これはハッシュ関数を実装するパッケージの init 関数から呼び出されることを意図しています。
func SignMessage ¶ added in v1.25.0
func SignMessage(signer Signer, rand io.Reader, msg []byte, opts SignerOpts) (signature []byte, err error)
SignMessageはsignerでmsgに署名します。signerが MessageSigner を実装している場合、 [MessageSigner.SignMessage] が直接呼び出されます。そうでなければ、msgは opts.HashFunc()でハッシュ化され、[Signer.Sign] で署名されます。
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は、非対称復号化操作に使用できる不透明な秘密鍵のインターフェースです。例えば、ハードウェアモジュールに保管されるRSA鍵があります。
type DecrypterOpts ¶ added in v1.5.0
type DecrypterOpts any
type Hash ¶
type Hash uint
Hashは別のパッケージで実装されている暗号ハッシュ関数を識別します。
func (Hash) HashFunc ¶ added in v1.4.0
HashFunc は単に h の値を返すだけであり、 Hash が SignerOpts を実装することを保証します。
type MessageSigner ¶ added in v1.25.0
type MessageSigner interface {
Signer
SignMessage(rand io.Reader, msg []byte, opts SignerOpts) (signature []byte, err error)
}
MessageSignerは、呼び出し元によってメッセージが事前にハッシュ化されていない 署名操作に使用できる不透明な秘密鍵のインターフェースです。 これは、Signerを受け入れるAPIに渡すことができるように、Signerインターフェースの スーパーセットであり、これらのAPIはインターフェースのアップグレードを試行する場合があります。
MessageSigner.SignMessageとMessageSigner.Signは、同じoptsが与えられた場合、 同じ結果を生成する必要があります。特に、MessageSigner.SignMessageは、 Signerも事前にハッシュ化されていないメッセージを受け入れる場合にのみ、 ゼロのopts.HashFuncを受け入れる必要があります。
事前にハッシュ化されたSign APIを提供しない実装では、 常にエラーを返すことでSigner.Signを実装する必要があります。
type PrivateKey ¶
type PrivateKey any
PrivateKeyは不特定のアルゴリズムを使用して秘密鍵を表します。
この型は、後方互換性のために空のインターフェースとして定義されていますが、 標準ライブラリのすべての秘密鍵タイプは以下のインターフェースを実装します。
interface{
Public() crypto.PublicKey
Equal(x crypto.PrivateKey) bool
}
また、 Signer や Decrypter などの特定の目的のインターフェースも実装しており、 アプリケーション内で型の安全性を向上させるために使用できます。
type PublicKey ¶ added in v1.2.0
type PublicKey any
PublicKeyは未指定のアルゴリズムを使用して公開鍵を表します。
このタイプは、後方互換性のための空のインターフェースですが、 標準ライブラリのすべての公開鍵タイプは、以下のインターフェースを実装しています。
interface{
Equal(x crypto.PublicKey) bool
}
アプリケーション内での型安全性向上のために使用することができます。
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は、署名操作に使用される不透明な秘密鍵のインターフェースです。たとえば、ハードウェアモジュールに保存されているRSA鍵などがあります。
type SignerOpts ¶ added in v1.4.0
type SignerOpts interface {
HashFunc() Hash
}
SignerOptsは Signer での署名のためのオプションを含みます。
Directories
¶
| Path | Synopsis |
|---|---|
|
aesパッケージは、U.S.連邦情報処理標準出版物197で定義されているAES暗号(以前はRijndaelとして知られていた)を実装しています。
|
aesパッケージは、U.S.連邦情報処理標準出版物197で定義されているAES暗号(以前はRijndaelとして知られていた)を実装しています。 |
|
cipherパッケージは、低レベルのブロック暗号実装を包み込むことができる標準のブロック暗号モードを実装しています。
|
cipherパッケージは、低レベルのブロック暗号実装を包み込むことができる標準のブロック暗号モードを実装しています。 |
|
desパッケージは米国連邦情報処理標準パブリケーション46-3で定義された、 データ暗号化標準(DES)とトリプルデータ暗号化アルゴリズム(TDEA)を実装しています。
|
desパッケージは米国連邦情報処理標準パブリケーション46-3で定義された、 データ暗号化標準(DES)とトリプルデータ暗号化アルゴリズム(TDEA)を実装しています。 |
|
dsaパッケージは、FIPS 186-3で定義されたデジタル署名アルゴリズムを実装します。
|
dsaパッケージは、FIPS 186-3で定義されたデジタル署名アルゴリズムを実装します。 |
|
ecdhパッケージはNIST曲線とCurve25519上での楕円曲線ディフィー・ヘルマンを実装します。
|
ecdhパッケージはNIST曲線とCurve25519上での楕円曲線ディフィー・ヘルマンを実装します。 |
|
ecdsaパッケージは、[FIPS 186-5]で定義されている楕円曲線デジタル署名アルゴリズムを実装します。
|
ecdsaパッケージは、[FIPS 186-5]で定義されている楕円曲線デジタル署名アルゴリズムを実装します。 |
|
ed25519パッケージはEd25519署名アルゴリズムを実装しています。
|
ed25519パッケージはEd25519署名アルゴリズムを実装しています。 |
|
ellipticパッケージは、素数体上の標準的なNIST P-224、P-256、P-384、およびP-521楕円曲線を実装しています。
|
ellipticパッケージは、素数体上の標準的なNIST P-224、P-256、P-384、およびP-521楕円曲線を実装しています。 |
|
Package hkdf implements the HMAC-based Extract-and-Expand Key Derivation Function (HKDF) as defined in RFC 5869.
|
Package hkdf implements the HMAC-based Extract-and-Expand Key Derivation Function (HKDF) as defined in RFC 5869. |
|
internal
|
|
|
boring
Package boring provides access to BoringCrypto implementation functions.
|
Package boring provides access to BoringCrypto implementation functions. |
|
boring/bcache
Package bcache implements a GC-friendly cache (see Cache) for BoringCrypto.
|
Package bcache implements a GC-friendly cache (see Cache) for BoringCrypto. |
|
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. |
|
entropy
Package entropy provides the passive entropy source for the FIPS 140-3 module.
|
Package entropy provides the passive entropy source for the FIPS 140-3 module. |
|
fips140/aes/_asm/ctr
command
|
|
|
fips140/aes/_asm/standard
command
|
|
|
fips140/aes/gcm/_asm/gcm
command
|
|
|
fips140/alias
Package alias implements memory aliasing tests.
|
Package alias implements memory aliasing tests. |
|
fips140/bigmod/_asm
command
|
|
|
fips140/check
Package check implements the FIPS 140 load-time code+data verification.
|
Package check implements the FIPS 140 load-time code+data verification. |
|
fips140/check/checktest
Package checktest defines some code and data for use in the crypto/internal/fips140/check test.
|
Package checktest defines some code and data for use in the crypto/internal/fips140/check test. |
|
fips140/drbg
Package drbg provides cryptographically secure random bytes usable by FIPS code.
|
Package drbg provides cryptographically secure random bytes usable by FIPS code. |
|
fips140/edwards25519
Package edwards25519 implements group logic for the twisted Edwards curve
|
Package edwards25519 implements group logic for the twisted Edwards curve |
|
fips140/edwards25519/field
Package field implements fast arithmetic modulo 2^255-19.
|
Package field implements fast arithmetic modulo 2^255-19. |
|
fips140/edwards25519/field/_asm
command
|
|
|
fips140/hmac
Package hmac implements HMAC according to [FIPS 198-1].
|
Package hmac implements HMAC according to [FIPS 198-1]. |
|
fips140/mlkem
Package mlkem implements the quantum-resistant key encapsulation method ML-KEM (formerly known as Kyber), as specified in [NIST FIPS 203].
|
Package mlkem implements the quantum-resistant key encapsulation method ML-KEM (formerly known as Kyber), as specified in [NIST FIPS 203]. |
|
fips140/nistec
Package nistec implements the elliptic curves from NIST SP 800-186.
|
Package nistec implements the elliptic curves from NIST SP 800-186. |
|
fips140/nistec/_asm
command
|
|
|
fips140/sha256
Package sha256 implements the SHA-224 and SHA-256 hash algorithms as defined in FIPS 180-4.
|
Package sha256 implements the SHA-224 and SHA-256 hash algorithms as defined in FIPS 180-4. |
|
fips140/sha256/_asm
command
|
|
|
fips140/sha3
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length functions defined by [FIPS 202], as well as the cSHAKE extendable-output-length functions defined by [SP 800-185].
|
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length functions defined by [FIPS 202], as well as the cSHAKE extendable-output-length functions defined by [SP 800-185]. |
|
fips140/sha3/_asm
command
|
|
|
fips140/sha512
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. |
|
fips140/sha512/_asm
command
|
|
|
fips140/ssh
Package ssh implements the SSH KDF as specified in RFC 4253, Section 7.2 and allowed by SP 800-135 Revision 1.
|
Package ssh implements the SSH KDF as specified in RFC 4253, Section 7.2 and allowed by SP 800-135 Revision 1. |
|
fips140/tls13
Package tls13 implements the TLS 1.3 Key Schedule as specified in RFC 8446, Section 7.1 and allowed by FIPS 140-3 IG 2.4.B Resolution 7.
|
Package tls13 implements the TLS 1.3 Key Schedule as specified in RFC 8446, Section 7.1 and allowed by FIPS 140-3 IG 2.4.B Resolution 7. |
|
fips140cache
Package fips140cache provides a weak map that associates the lifetime of values with the lifetime of keys.
|
Package fips140cache provides a weak map that associates the lifetime of values with the lifetime of keys. |
|
fips140deps
Package fipsdeps contains wrapper packages for internal APIs that are exposed to the FIPS module.
|
Package fipsdeps contains wrapper packages for internal APIs that are exposed to the FIPS module. |
|
impl
Package impl is a registry of alternative implementations of cryptographic primitives, to allow selecting them for testing.
|
Package impl is a registry of alternative implementations of cryptographic primitives, to allow selecting them for testing. |
|
randutil
Package randutil contains internal randomness utilities for various crypto packages.
|
Package randutil contains internal randomness utilities for various crypto packages. |
|
sysrand
Package rand provides cryptographically secure random bytes from the operating system.
|
Package rand provides cryptographically secure random bytes from the operating system. |
|
md5 パッケージは、RFC 1321で定義されたMD5ハッシュアルゴリズムを実装します。
|
md5 パッケージは、RFC 1321で定義されたMD5ハッシュアルゴリズムを実装します。 |
|
_asm
command
|
|
|
Package mlkem implements the quantum-resistant key encapsulation method ML-KEM (formerly known as Kyber), as specified in [NIST FIPS 203].
|
Package mlkem implements the quantum-resistant key encapsulation method ML-KEM (formerly known as Kyber), as specified in [NIST FIPS 203]. |
|
Package pbkdf2 implements the key derivation function PBKDF2 as defined in RFC 8018 (PKCS #5 v2.1).
|
Package pbkdf2 implements the key derivation function PBKDF2 as defined in RFC 8018 (PKCS #5 v2.1). |
|
randパッケージは、暗号学的に安全な乱数生成器を実装しています。
|
randパッケージは、暗号学的に安全な乱数生成器を実装しています。 |
|
rc4パッケージはBruce Schneierの「応用暗号化」で定義されている RC4暗号を実装しています。
|
rc4パッケージはBruce Schneierの「応用暗号化」で定義されている RC4暗号を実装しています。 |
|
rsaパッケージは、PKCS #1およびRFC 8017で指定されたRSA暗号化を実装します。
|
rsaパッケージは、PKCS #1およびRFC 8017で指定されたRSA暗号化を実装します。 |
|
sha1パッケージは、RFC 3174で定義されているSHA-1ハッシュアルゴリズムを実装しています。
|
sha1パッケージは、RFC 3174で定義されているSHA-1ハッシュアルゴリズムを実装しています。 |
|
_asm
command
|
|
|
sha256パッケージは、FIPS 180-4で定義されたSHA224およびSHA256ハッシュアルゴリズムを実装しています。
|
sha256パッケージは、FIPS 180-4で定義されたSHA224およびSHA256ハッシュアルゴリズムを実装しています。 |
|
Package sha3 implements the SHA-3 hash algorithms and the SHAKE extendable output functions defined in FIPS 202.
|
Package sha3 implements the SHA-3 hash algorithms and the SHAKE extendable output functions defined in FIPS 202. |
|
sha512パッケージは、FIPS 180-4で定義されているSHA-384、SHA-512、SHA-512/224、およびSHA-512/256のハッシュアルゴリズムを実装しています。
|
sha512パッケージは、FIPS 180-4で定義されているSHA-384、SHA-512、SHA-512/224、およびSHA-512/256のハッシュアルゴリズムを実装しています。 |
|
subtleパッケージは、暗号化コードでよく使用される関数を実装しますが、正しく使用するために注意深い考慮が必要です。
|
subtleパッケージは、暗号化コードでよく使用される関数を実装しますが、正しく使用するために注意深い考慮が必要です。 |
|
Package tlsは、RFC 5246で規定されているTLS 1.2と、 RFC 8446で規定されているTLS 1.3を部分的に実装しています。
|
Package tlsは、RFC 5246で規定されているTLS 1.2と、 RFC 8446で規定されているTLS 1.3を部分的に実装しています。 |
|
internal/fips140tls
Package fips140tls controls whether crypto/tls requires FIPS-approved settings.
|
Package fips140tls controls whether crypto/tls requires FIPS-approved settings. |
|
x509パッケージはX.509規格の一部を実装しています。
|
x509パッケージはX.509規格の一部を実装しています。 |
|
internal/macos
Package macOS provides cgo-less wrappers for Core Foundation and Security.framework, similarly to how package syscall provides access to libSystem.dylib.
|
Package macOS provides cgo-less wrappers for Core Foundation and Security.framework, similarly to how package syscall provides access to libSystem.dylib. |
|
pkix
pkix パッケージには、ASN.1 パースおよび X.509 証明書、CRL、OCSP のシリアル化に使用される共有の低レベルの構造体が含まれています。
|
pkix パッケージには、ASN.1 パースおよび X.509 証明書、CRL、OCSP のシリアル化に使用される共有の低レベルの構造体が含まれています。 |