The pages are generated with Goldsv0.8.5. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
diff --git a/imp/encoding/binary.littleEndian^40d0b.html b/imp/encoding/binary.littleEndian^40d0b.html
index 7bacb72ddee..567c44308a4 100644
--- a/imp/encoding/binary.littleEndian^40d0b.html
+++ b/imp/encoding/binary.littleEndian^40d0b.html
@@ -36,12 +36,12 @@
littleEndian.M : ByteOrder.Uint16
The pages are generated with Goldsv0.8.5. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
diff --git a/imp/encoding/binary.nativeEndian^61760.html b/imp/encoding/binary.nativeEndian^61760.html
index 1d82ea80fc1..898ffc34aec 100644
--- a/imp/encoding/binary.nativeEndian^61760.html
+++ b/imp/encoding/binary.nativeEndian^61760.html
@@ -36,12 +36,12 @@
nativeEndian.M : ByteOrder.Uint16
The pages are generated with Goldsv0.8.5. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
diff --git a/imp/golang.org/x/sys/cpu.byteOrder^5f5cc.html b/imp/golang.org/x/sys/cpu.byteOrder^5f5cc.html
index 31c784190dc..72221711316 100644
--- a/imp/golang.org/x/sys/cpu.byteOrder^5f5cc.html
+++ b/imp/golang.org/x/sys/cpu.byteOrder^5f5cc.html
@@ -20,7 +20,7 @@
encoding/binary.littleEndian.Uint32
encoding/binary.nativeEndian.littleEndian.Uint32
vendor/golang.org/x/sys/cpu.bigEndian.Uint32
- vendor/golang.org/x/sys/cpu.byteOrder.Uint32
+ vendor/golang.org/x/sys/cpu.byteOrder.Uint32
vendor/golang.org/x/sys/cpu.littleEndian.Uint32
The pages are generated with Goldsv0.8.5. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
diff --git a/imp/vendor/golang.org/x/sys/cpu.byteOrder^5f5cc.html b/imp/vendor/golang.org/x/sys/cpu.byteOrder^5f5cc.html
index 9e31a5fcf2f..db9296b6b09 100644
--- a/imp/vendor/golang.org/x/sys/cpu.byteOrder^5f5cc.html
+++ b/imp/vendor/golang.org/x/sys/cpu.byteOrder^5f5cc.html
@@ -20,7 +20,7 @@
encoding/binary.littleEndian.Uint32
encoding/binary.nativeEndian.littleEndian.Uint32
golang.org/x/sys/cpu.bigEndian.Uint32
- golang.org/x/sys/cpu.byteOrder.Uint32
+ golang.org/x/sys/cpu.byteOrder.Uint32
golang.org/x/sys/cpu.littleEndian.Uint32
The pages are generated with Goldsv0.8.5. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
diff --git a/index.html b/index.html
index 4f459a65521..c953821122f 100644
--- a/index.html
+++ b/index.html
@@ -13,7 +13,7 @@
Statistics (detailed ones)
Total 306 packages analyzed and 4810 Go files
- (1596040 lines of code) parsed. On average,
+ (1596071 lines of code) parsed. On average,
* each Go source file imports 7.19 packages
and contains 332 lines of code.
* each package depends on 6.70 other packages,
@@ -22,7 +22,7 @@
- 4.29 variables,
- 27.30 constants,
- 13.51 functions.
-
All Packages (sort packages by: | | | )
3
1. bufio (14) (1269) (10) (4) - implements buffered I/O. It wraps an io.Reader or io.Writer object, creating another object (Reader or Writer) that also implements the interface but provides buffering and some help for textual I/O.
9. context (31) (806) (11) (2) - defines the Context type, which carries deadlines, cancellation signals, and other request-scoped values across API boundaries and between processes.
11. crypto/aes (10) (48) (19) (3) - implements AES encryption (formerly Rijndael), as defined in U.S. Federal Information Processing Standards Publication 197.
3
12. crypto/cipher (17) (1040) (17) (3) - implements standard block cipher modes that can be wrapped around low-level block cipher implementations.
3
13. crypto/des (3) (556) (18) (4) - 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.
3
14. crypto/dsa (1) (330) (20) (4) - implements the Digital Signature Algorithm, as defined in FIPS 186-3.
3
15. crypto/ecdh (6) (551) (20) (4) - implements Elliptic Curve Diffie-Hellman over NIST curves and Curve25519.
3
16. crypto/ecdsa (3) (868) (21) (4) - implements the Elliptic Curve Digital Signature Algorithm, as defined in [FIPS 186-5].
18. crypto/elliptic (4) (884) (16) (4) - implements the standard NIST P-224, P-256, P-384, and P-521 elliptic curves over prime fields.
3
19. crypto/fips140 (6) (93) (14) (4) - provides information about the FIPS 140-3 Go Cryptographic Module and FIPS 140-3 mode.
3
20. crypto/hkdf (4) (84) (17) (5) - implements the HMAC-based Extract-and-Expand Key Derivation Function (HKDF) as defined in RFC 5869.
3
21. crypto/hmac (5) (65) (19) (5) - implements the Keyed-Hash Message Authentication Code (HMAC) as defined in U.S. Federal Information Processing Standards Publication 198.
3
22. crypto/hpke (1) (1482) (21) (5) - implements Hybrid Public Key Encryption (HPKE) as defined in [RFC 9180].
25. crypto/internal/boring/sig (1) (17) (1) (4) - holds “code signatures” that can be called and will result in certain code sequences being linked into the final binary.
42. crypto/internal/fips140/mlkem (1) (1609) (16) (6) - implements the quantum-resistant key encapsulation method ML-KEM (formerly known as Kyber), as specified in [NIST FIPS 203].
47. crypto/internal/fips140/sha256 (10) (440) (11) (4) - implements the SHA-224 and SHA-256 hash algorithms as defined in FIPS 180-4.
3
48. crypto/internal/fips140/sha3 (6) (933) (11) (4) - 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].
3
49. crypto/internal/fips140/sha512 (7) (515) (11) (4) - implements the SHA-384, SHA-512, SHA-512/224, and SHA-512/256 hash algorithms as defined in FIPS 180-4.
52. crypto/internal/fips140/tls13 (1) (215) (15) (5) - 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.
3
53. crypto/internal/fips140cache (2) (52) (7) (5) - provides a weak map that associates the lifetime of values with the lifetime of keys.
60. crypto/internal/impl (6) (107) (10) (4) - is a registry of alternative implementations of cryptographic primitives, to allow selecting them for testing.
62. crypto/internal/randutil (1) (26) (9) (4) - contains internal randomness utilities for various crypto packages.
3
63. crypto/internal/sysrand (1) (144) (14) (5) - rand provides cryptographically secure random bytes from the operating system.
3
64. crypto/md5 (4) (347) (17) (4) - implements the MD5 hash algorithm as defined in RFC 1321.
3
65. crypto/mlkem (3) (221) (17) (5) - implements the quantum-resistant key encapsulation method ML-KEM (formerly known as Kyber), as specified in [NIST FIPS 203].
3
66. crypto/pbkdf2 (1) (54) (17) (5) - implements the key derivation function PBKDF2 as defined in RFC 8018 (PKCS #5 v2.1).
3
67. crypto/rand (11) (198) (20) (3) - implements a cryptographically secure random number generator.
3
68. crypto/rc4 (2) (83) (17) (5) - implements RC4 encryption, as defined in Bruce Schneier's Applied Cryptography.
3
69. crypto/rsa (7) (1441) (21) (2) - implements RSA encryption as specified in PKCS #1 and RFC 8017.
3
70. crypto/sha1 (6) (413) (19) (3) - implements the SHA-1 hash algorithm as defined in RFC 3174.
3
71. crypto/sha256 (8) (74) (19) (3) - implements the SHA224 and SHA256 hash algorithms as defined in FIPS 180-4.
3
72. crypto/sha3 (3) (274) (12) (4) - implements the SHA-3 hash algorithms and the SHAKE extendable output functions defined in FIPS 202.
3
73. crypto/sha512 (7) (123) (19) (4) - implements the SHA-384, SHA-512, SHA-512/224, and SHA-512/256 hash algorithms as defined in FIPS 180-4.
3
74. crypto/subtle (11) (134) (4) (3) - implements functions that are often useful in cryptographic code but require careful thought to use correctly.
3
75. crypto/tls (2) (14445) (23) (4) - partially implements TLS 1.2, as specified in RFC 5246, and TLS 1.3, as specified in RFC 8446.
77. crypto/x509 (3) (7768) (22) (3) - implements a subset of the X.509 standard.
3
78. crypto/x509/pkix (1) (320) (17) (4) - contains shared, low level structures used for ASN.1 parsing and serialization of X.509 certificates, CRL and OCSP.
3
79. embed (1) (436) (12) (3) - provides access to files embedded in the running Go program.
3
80. encoding (1) (78) (1) (4) - defines interfaces shared by other packages that convert data to and from byte-level and textual representations.
3
81. encoding/asn1 (4) (2116) (16) (4) - implements parsing of DER-encoded ASN.1 data structures, as defined in ITU-T Rec X.690.
3
82. encoding/base64 (14) (665) (9) (3) - implements base64 encoding as specified by RFC 4648.
3
83. encoding/binary (33) (1214) (10) (3) - implements simple translation between numbers and byte sequences and encoding and decoding of varints.
93. github.com/cespare/xxhash/v2 (1) (316) (11) (3) - implements the 64-bit variant of xxHash (XXH64) as described at http://cyan4973.github.io/xxHash/.
103. github.com/gotd/log (8) (460) (15) (1) - defines a minimal, dependency-free logging port for gotd libraries.
3
104. github.com/gotd/neo (1) (538) (15) (2) - implements side effects simulation for testing.
3
105. github.com/gotd/td/ascii (1) (19) (1) (2) - provides data and functions to test some properties of ASCII code points.
3
106. github.com/gotd/td/bin (17) (742) (16) (1) - implements binary serialization and deserialization for TL, providing Buffer that can decode and encode basic Type Language types.
146. github.com/klauspost/compress/gzip (1) (670) (17) (2) - implements reading and writing of gzip format compressed files, as specified in RFC 1952.
3
147. github.com/klauspost/compress/huff0 (1) (2956) (16) (6) - This file contains the specialisation of Decoder.Decompress4X and Decoder.Decompress1X that use an asm implementation of thir main loops.
153. github.com/refraction-networking/utls (1) (25388) (28) (4) - partially implements TLS 1.2, as specified in RFC 5246, and TLS 1.3, as specified in RFC 8446.
180. go.uber.org/atomic (3) (1716) (16) (1) - provides simple wrappers around numerics to enforce atomic access.
3
181. go.uber.org/multierr (9) (694) (15) (1) - allows combining one or more errors together.
3
182. golang.org/x/crypto/chacha20 (1) (453) (18) (6) - implements the ChaCha20 and XChaCha20 encryption algorithms as specified in RFC 8439 and draft-irtf-cfrg-xchacha-01.
3
183. golang.org/x/crypto/chacha20poly1305 (2) (380) (19) (5) - implements the ChaCha20-Poly1305 AEAD and its extended nonce variant XChaCha20-Poly1305, as specified in RFC 8439 and draft-irtf-cfrg-xchacha-01.
3
184. golang.org/x/crypto/cryptobyte (2) (1358) (17) (5) - contains types that help with parsing and constructing length-prefixed, binary messages, including ASN.1 DER.
3
185. golang.org/x/crypto/cryptobyte/asn1 (1) (46) (1) (6) - contains supporting types for parsing and building ASN.1 messages with the cryptobyte package.
3
186. golang.org/x/crypto/hkdf (1) (100) (20) (5) - implements the HMAC-based Extract-and-Expand Key Derivation Function (HKDF) as defined in RFC 5869.
192. golang.org/x/net/proxy (1) (429) (16) (1) - provides support for a variety of protocols to proxy network data.
3
193. golang.org/x/sync/errgroup (1) (151) (15) (2) - provides synchronization, error propagation, and Context cancellation for groups of goroutines working on subtasks of a common task.
212. internal/godebug (13) (316) (8) (3) - makes the settings in the $GODEBUG environment variable available to other packages.
3
213. internal/godebugs (2) (116) (1) (4) - provides a table of known GODEBUG settings, for use by a variety of other packages, including internal/godebug, runtime, runtime/metrics, and cmd/go/internal/load.
3
214. internal/goexperiment (1) (291) (1) (4) - implements support for toolchain experiments.
216. internal/msan (2) (37) (2) (4) - contains helper functions for manually instrumenting code for the memory sanitizer.
3
217. internal/nettrace (2) (46) (1) (4) - contains internal hooks for tracing activity in the net package.
3
218. internal/oserror (2) (18) (8) (4) - defines errors values used in the os package.
3
219. internal/poll (3) (2390) (11) (3) - supports non-blocking I/O on file descriptors with polling.
3
220. internal/profilerecord (1) (28) (1) (4) - holds internal types used to represent profiling records with deep stack traces.
3
221. internal/race (6) (66) (3) (3) - contains helper functions for manually instrumenting code for the race detector.
3
222. internal/reflectlite (3) (1201) (6) (3) - implements lightweight version of reflect, not using any package except for "runtime", "unsafe", and "internal/abi"
3
223. internal/runtime/atomic (2) (876) (2) (4) - provides atomic operations, independent of sync/atomic, to the runtime.
236. internal/stringslite (10) (150) (4) (3) - implements a subset of strings, only using packages that may be imported by "os".
3
237. internal/sync (2) (1010) (4) (3) - provides basic synchronization primitives such as mutual exclusion locks to internal packages (including ones that depend on sync).
3
238. internal/synctest (1) (105) (3) (3) - provides support for testing concurrent code.
241. internal/testlog (1) (113) (7) (3) - provides a back-channel communication path between tests and package os, so that cmd/go can see which environment variables and files a test consults.
3
242. internal/trace/tracev2 (1) (707) (1) (4) - contains definitions for the v2 execution trace wire format.
3
243. internal/unsafeheader (2) (37) (2) (4) - contains header declarations for the Go runtime's slice and string implementations.
252. math/bits (49) (693) (2) (2) - implements bit counting and manipulation functions for the predeclared unsigned integer types.
3
253. math/rand (4) (1265) (9) (3) - implements pseudo-random number generators suitable for tasks such as simulation, but it should not be used for security-sensitive work.
3
254. math/rand/v2 (2) (1046) (8) (5) - implements pseudo-random number generators suitable for tasks such as simulation, but it should not be used for security-sensitive work.
3
255. mime (2) (1295) (15) (4) - implements parts of the MIME spec.
3
256. mime/multipart (1) (1022) (21) (4) - implements MIME multipart parsing, as defined in RFC 2046.
3
257. mime/quotedprintable (1) (312) (15) (5) - implements quoted-printable encoding as specified by RFC 2045.
3
258. net (19) (12982) (14) (3) - provides a portable interface for network I/O, including TCP/IP, UDP, domain name resolution, and Unix domain sockets.
3
259. net/http (4) (29689) (26) (3) - provides HTTP client and server implementations.
3
260. net/http/httptrace (2) (255) (24) (4) - provides mechanisms to trace the events within HTTP client requests.
3
261. net/http/internal (1) (300) (15) (4) - contains HTTP internals shared by net/http and net/http/httputil.
269. path/filepath (5) (1039) (14) (2) - implements utility routines for manipulating filename paths in a way compatible with the target operating system-defined file paths.
3
270. reflect (15) (8694) (9) (3) - implements run-time reflection, allowing a program to manipulate objects with arbitrary types.
3
271. rsc.io/qr (1) (516) (16) (2) - encodes QR codes.
283. syscall (9) (8451) (9) (3) - contains an interface to the low-level operating system primitives.
3
284. time (46) (5623) (10) (2) - provides functionality for measuring and displaying time.
3
285. unicode (8) (10330) (1) (3) - provides data and functions to test some properties of Unicode code points.
3
286. unicode/utf16 (4) (144) (1) (3) - implements encoding and decoding of UTF-16 sequences.
3
287. unicode/utf8 (25) (578) (1) (3) - implements functions and constants to support text encoded in UTF-8.
3
288. unique (1) (552) (7) (4) - The unique package provides facilities for canonicalizing ("interning") comparable values.
3
289. unsafe (81) (271) (1) (3) - contains operations that step around the type safety of Go programs.
3
290. vendor/golang.org/x/crypto/chacha20 (1) (453) (18) (6) - implements the ChaCha20 and XChaCha20 encryption algorithms as specified in RFC 8439 and draft-irtf-cfrg-xchacha-01.
3
291. vendor/golang.org/x/crypto/chacha20poly1305 (2) (380) (19) (5) - implements the ChaCha20-Poly1305 AEAD and its extended nonce variant XChaCha20-Poly1305, as specified in RFC 8439 and draft-irtf-cfrg-xchacha-01.
3
292. vendor/golang.org/x/crypto/cryptobyte (3) (1358) (17) (4) - contains types that help with parsing and constructing length-prefixed, binary messages, including ASN.1 DER.
298. vendor/golang.org/x/net/http/httpproxy (1) (373) (19) (4) - provides support for HTTP proxy determination based on environment variables, as provided by net/http's ProxyFromEnvironment function.
3
299. vendor/golang.org/x/net/http2/hpack (2) (1585) (15) (4) - implements HPACK, a compression format for efficiently representing HTTP header fields in the context of HTTP/2.
3
300. vendor/golang.org/x/net/idna (3) (6354) (18) (4) - implements IDNA2008 using the compatibility processing defined by UTS (Unicode Technical Standard) #46, which defines a standard to deal with the transition from IDNA2003.
3
301. vendor/golang.org/x/sys/cpu (1) (759) (14) (6) - implements processor feature detection for various CPU architectures.
303. vendor/golang.org/x/text/transform (2) (709) (10) (6) - provides reader and writer wrappers that transform the bytes passing through as well as various transformations.
306. weak (4) (107) (6) (5) - provides ways to safely reference memory weakly, that is, without preventing its reclamation.
+
All Packages (sort packages by: | | | )
3
1. bufio (14) (1269) (10) (4) - implements buffered I/O. It wraps an io.Reader or io.Writer object, creating another object (Reader or Writer) that also implements the interface but provides buffering and some help for textual I/O.
9. context (31) (806) (11) (2) - defines the Context type, which carries deadlines, cancellation signals, and other request-scoped values across API boundaries and between processes.
11. crypto/aes (10) (48) (19) (3) - implements AES encryption (formerly Rijndael), as defined in U.S. Federal Information Processing Standards Publication 197.
3
12. crypto/cipher (17) (1040) (17) (3) - implements standard block cipher modes that can be wrapped around low-level block cipher implementations.
3
13. crypto/des (3) (556) (18) (4) - 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.
3
14. crypto/dsa (1) (330) (20) (4) - implements the Digital Signature Algorithm, as defined in FIPS 186-3.
3
15. crypto/ecdh (6) (551) (20) (4) - implements Elliptic Curve Diffie-Hellman over NIST curves and Curve25519.
3
16. crypto/ecdsa (3) (868) (21) (4) - implements the Elliptic Curve Digital Signature Algorithm, as defined in [FIPS 186-5].
18. crypto/elliptic (4) (884) (16) (4) - implements the standard NIST P-224, P-256, P-384, and P-521 elliptic curves over prime fields.
3
19. crypto/fips140 (6) (93) (14) (4) - provides information about the FIPS 140-3 Go Cryptographic Module and FIPS 140-3 mode.
3
20. crypto/hkdf (4) (84) (17) (5) - implements the HMAC-based Extract-and-Expand Key Derivation Function (HKDF) as defined in RFC 5869.
3
21. crypto/hmac (5) (65) (19) (5) - implements the Keyed-Hash Message Authentication Code (HMAC) as defined in U.S. Federal Information Processing Standards Publication 198.
3
22. crypto/hpke (1) (1482) (21) (5) - implements Hybrid Public Key Encryption (HPKE) as defined in [RFC 9180].
25. crypto/internal/boring/sig (1) (17) (1) (4) - holds “code signatures” that can be called and will result in certain code sequences being linked into the final binary.
42. crypto/internal/fips140/mlkem (1) (1609) (16) (6) - implements the quantum-resistant key encapsulation method ML-KEM (formerly known as Kyber), as specified in [NIST FIPS 203].
47. crypto/internal/fips140/sha256 (10) (440) (11) (4) - implements the SHA-224 and SHA-256 hash algorithms as defined in FIPS 180-4.
3
48. crypto/internal/fips140/sha3 (6) (933) (11) (4) - 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].
3
49. crypto/internal/fips140/sha512 (7) (515) (11) (4) - implements the SHA-384, SHA-512, SHA-512/224, and SHA-512/256 hash algorithms as defined in FIPS 180-4.
52. crypto/internal/fips140/tls13 (1) (215) (15) (5) - 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.
3
53. crypto/internal/fips140cache (2) (52) (7) (5) - provides a weak map that associates the lifetime of values with the lifetime of keys.
60. crypto/internal/impl (6) (107) (10) (4) - is a registry of alternative implementations of cryptographic primitives, to allow selecting them for testing.
62. crypto/internal/randutil (1) (26) (9) (4) - contains internal randomness utilities for various crypto packages.
3
63. crypto/internal/sysrand (1) (144) (14) (5) - rand provides cryptographically secure random bytes from the operating system.
3
64. crypto/md5 (4) (347) (17) (4) - implements the MD5 hash algorithm as defined in RFC 1321.
3
65. crypto/mlkem (3) (221) (17) (5) - implements the quantum-resistant key encapsulation method ML-KEM (formerly known as Kyber), as specified in [NIST FIPS 203].
3
66. crypto/pbkdf2 (1) (54) (17) (5) - implements the key derivation function PBKDF2 as defined in RFC 8018 (PKCS #5 v2.1).
3
67. crypto/rand (11) (198) (20) (3) - implements a cryptographically secure random number generator.
3
68. crypto/rc4 (2) (83) (17) (5) - implements RC4 encryption, as defined in Bruce Schneier's Applied Cryptography.
3
69. crypto/rsa (7) (1441) (21) (2) - implements RSA encryption as specified in PKCS #1 and RFC 8017.
3
70. crypto/sha1 (6) (413) (19) (3) - implements the SHA-1 hash algorithm as defined in RFC 3174.
3
71. crypto/sha256 (8) (74) (19) (3) - implements the SHA224 and SHA256 hash algorithms as defined in FIPS 180-4.
3
72. crypto/sha3 (3) (274) (12) (4) - implements the SHA-3 hash algorithms and the SHAKE extendable output functions defined in FIPS 202.
3
73. crypto/sha512 (7) (123) (19) (4) - implements the SHA-384, SHA-512, SHA-512/224, and SHA-512/256 hash algorithms as defined in FIPS 180-4.
3
74. crypto/subtle (11) (134) (4) (3) - implements functions that are often useful in cryptographic code but require careful thought to use correctly.
3
75. crypto/tls (2) (14445) (23) (4) - partially implements TLS 1.2, as specified in RFC 5246, and TLS 1.3, as specified in RFC 8446.
77. crypto/x509 (3) (7799) (22) (3) - implements a subset of the X.509 standard.
3
78. crypto/x509/pkix (1) (320) (17) (4) - contains shared, low level structures used for ASN.1 parsing and serialization of X.509 certificates, CRL and OCSP.
3
79. embed (1) (436) (12) (3) - provides access to files embedded in the running Go program.
3
80. encoding (1) (78) (1) (4) - defines interfaces shared by other packages that convert data to and from byte-level and textual representations.
3
81. encoding/asn1 (4) (2116) (16) (4) - implements parsing of DER-encoded ASN.1 data structures, as defined in ITU-T Rec X.690.
3
82. encoding/base64 (14) (665) (9) (3) - implements base64 encoding as specified by RFC 4648.
3
83. encoding/binary (33) (1214) (10) (3) - implements simple translation between numbers and byte sequences and encoding and decoding of varints.
93. github.com/cespare/xxhash/v2 (1) (316) (11) (3) - implements the 64-bit variant of xxHash (XXH64) as described at http://cyan4973.github.io/xxHash/.
103. github.com/gotd/log (8) (460) (15) (1) - defines a minimal, dependency-free logging port for gotd libraries.
3
104. github.com/gotd/neo (1) (538) (15) (2) - implements side effects simulation for testing.
3
105. github.com/gotd/td/ascii (1) (19) (1) (2) - provides data and functions to test some properties of ASCII code points.
3
106. github.com/gotd/td/bin (17) (742) (16) (1) - implements binary serialization and deserialization for TL, providing Buffer that can decode and encode basic Type Language types.
146. github.com/klauspost/compress/gzip (1) (670) (17) (2) - implements reading and writing of gzip format compressed files, as specified in RFC 1952.
3
147. github.com/klauspost/compress/huff0 (1) (2956) (16) (6) - This file contains the specialisation of Decoder.Decompress4X and Decoder.Decompress1X that use an asm implementation of thir main loops.
153. github.com/refraction-networking/utls (1) (25388) (28) (4) - partially implements TLS 1.2, as specified in RFC 5246, and TLS 1.3, as specified in RFC 8446.
180. go.uber.org/atomic (3) (1716) (16) (1) - provides simple wrappers around numerics to enforce atomic access.
3
181. go.uber.org/multierr (9) (694) (15) (1) - allows combining one or more errors together.
3
182. golang.org/x/crypto/chacha20 (1) (453) (18) (6) - implements the ChaCha20 and XChaCha20 encryption algorithms as specified in RFC 8439 and draft-irtf-cfrg-xchacha-01.
3
183. golang.org/x/crypto/chacha20poly1305 (2) (380) (19) (5) - implements the ChaCha20-Poly1305 AEAD and its extended nonce variant XChaCha20-Poly1305, as specified in RFC 8439 and draft-irtf-cfrg-xchacha-01.
3
184. golang.org/x/crypto/cryptobyte (2) (1358) (17) (5) - contains types that help with parsing and constructing length-prefixed, binary messages, including ASN.1 DER.
3
185. golang.org/x/crypto/cryptobyte/asn1 (1) (46) (1) (6) - contains supporting types for parsing and building ASN.1 messages with the cryptobyte package.
3
186. golang.org/x/crypto/hkdf (1) (100) (20) (5) - implements the HMAC-based Extract-and-Expand Key Derivation Function (HKDF) as defined in RFC 5869.
192. golang.org/x/net/proxy (1) (429) (16) (1) - provides support for a variety of protocols to proxy network data.
3
193. golang.org/x/sync/errgroup (1) (151) (15) (2) - provides synchronization, error propagation, and Context cancellation for groups of goroutines working on subtasks of a common task.
212. internal/godebug (13) (316) (8) (3) - makes the settings in the $GODEBUG environment variable available to other packages.
3
213. internal/godebugs (2) (116) (1) (4) - provides a table of known GODEBUG settings, for use by a variety of other packages, including internal/godebug, runtime, runtime/metrics, and cmd/go/internal/load.
3
214. internal/goexperiment (1) (291) (1) (4) - implements support for toolchain experiments.
216. internal/msan (2) (37) (2) (4) - contains helper functions for manually instrumenting code for the memory sanitizer.
3
217. internal/nettrace (2) (46) (1) (4) - contains internal hooks for tracing activity in the net package.
3
218. internal/oserror (2) (18) (8) (4) - defines errors values used in the os package.
3
219. internal/poll (3) (2390) (11) (3) - supports non-blocking I/O on file descriptors with polling.
3
220. internal/profilerecord (1) (28) (1) (4) - holds internal types used to represent profiling records with deep stack traces.
3
221. internal/race (6) (66) (3) (3) - contains helper functions for manually instrumenting code for the race detector.
3
222. internal/reflectlite (3) (1201) (6) (3) - implements lightweight version of reflect, not using any package except for "runtime", "unsafe", and "internal/abi"
3
223. internal/runtime/atomic (2) (876) (2) (4) - provides atomic operations, independent of sync/atomic, to the runtime.
236. internal/stringslite (10) (150) (4) (3) - implements a subset of strings, only using packages that may be imported by "os".
3
237. internal/sync (2) (1010) (4) (3) - provides basic synchronization primitives such as mutual exclusion locks to internal packages (including ones that depend on sync).
3
238. internal/synctest (1) (105) (3) (3) - provides support for testing concurrent code.
241. internal/testlog (1) (113) (7) (3) - provides a back-channel communication path between tests and package os, so that cmd/go can see which environment variables and files a test consults.
3
242. internal/trace/tracev2 (1) (707) (1) (4) - contains definitions for the v2 execution trace wire format.
3
243. internal/unsafeheader (2) (37) (2) (4) - contains header declarations for the Go runtime's slice and string implementations.
252. math/bits (49) (693) (2) (2) - implements bit counting and manipulation functions for the predeclared unsigned integer types.
3
253. math/rand (4) (1265) (9) (3) - implements pseudo-random number generators suitable for tasks such as simulation, but it should not be used for security-sensitive work.
3
254. math/rand/v2 (2) (1046) (8) (5) - implements pseudo-random number generators suitable for tasks such as simulation, but it should not be used for security-sensitive work.
3
255. mime (2) (1295) (15) (4) - implements parts of the MIME spec.
3
256. mime/multipart (1) (1022) (21) (4) - implements MIME multipart parsing, as defined in RFC 2046.
3
257. mime/quotedprintable (1) (312) (15) (5) - implements quoted-printable encoding as specified by RFC 2045.
3
258. net (19) (12982) (14) (3) - provides a portable interface for network I/O, including TCP/IP, UDP, domain name resolution, and Unix domain sockets.
3
259. net/http (4) (29689) (26) (3) - provides HTTP client and server implementations.
3
260. net/http/httptrace (2) (255) (24) (4) - provides mechanisms to trace the events within HTTP client requests.
3
261. net/http/internal (1) (300) (15) (4) - contains HTTP internals shared by net/http and net/http/httputil.
269. path/filepath (5) (1039) (14) (2) - implements utility routines for manipulating filename paths in a way compatible with the target operating system-defined file paths.
3
270. reflect (15) (8694) (9) (3) - implements run-time reflection, allowing a program to manipulate objects with arbitrary types.
3
271. rsc.io/qr (1) (516) (16) (2) - encodes QR codes.
283. syscall (9) (8451) (9) (3) - contains an interface to the low-level operating system primitives.
3
284. time (46) (5623) (10) (2) - provides functionality for measuring and displaying time.
3
285. unicode (8) (10330) (1) (3) - provides data and functions to test some properties of Unicode code points.
3
286. unicode/utf16 (4) (144) (1) (3) - implements encoding and decoding of UTF-16 sequences.
3
287. unicode/utf8 (25) (578) (1) (3) - implements functions and constants to support text encoded in UTF-8.
3
288. unique (1) (552) (7) (4) - The unique package provides facilities for canonicalizing ("interning") comparable values.
3
289. unsafe (81) (271) (1) (3) - contains operations that step around the type safety of Go programs.
3
290. vendor/golang.org/x/crypto/chacha20 (1) (453) (18) (6) - implements the ChaCha20 and XChaCha20 encryption algorithms as specified in RFC 8439 and draft-irtf-cfrg-xchacha-01.
3
291. vendor/golang.org/x/crypto/chacha20poly1305 (2) (380) (19) (5) - implements the ChaCha20-Poly1305 AEAD and its extended nonce variant XChaCha20-Poly1305, as specified in RFC 8439 and draft-irtf-cfrg-xchacha-01.
3
292. vendor/golang.org/x/crypto/cryptobyte (3) (1358) (17) (4) - contains types that help with parsing and constructing length-prefixed, binary messages, including ASN.1 DER.
298. vendor/golang.org/x/net/http/httpproxy (1) (373) (19) (4) - provides support for HTTP proxy determination based on environment variables, as provided by net/http's ProxyFromEnvironment function.
3
299. vendor/golang.org/x/net/http2/hpack (2) (1585) (15) (4) - implements HPACK, a compression format for efficiently representing HTTP header fields in the context of HTTP/2.
3
300. vendor/golang.org/x/net/idna (3) (6354) (18) (4) - implements IDNA2008 using the compatibility processing defined by UTS (Unicode Technical Standard) #46, which defines a standard to deal with the transition from IDNA2003.
3
301. vendor/golang.org/x/sys/cpu (1) (759) (14) (6) - implements processor feature detection for various CPU architectures.
303. vendor/golang.org/x/text/transform (2) (709) (10) (6) - provides reader and writer wrappers that transform the bytes passing through as well as various transformations.
306. weak (4) (107) (6) (5) - provides ways to safely reference memory weakly, that is, without preventing its reclamation.
The pages are generated with Goldsv0.8.5. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
diff --git a/pkg/crypto/x509.html b/pkg/crypto/x509.html
index 5dacb6ad51b..ea9e5ffeebb 100644
--- a/pkg/crypto/x509.html
+++ b/pkg/crypto/x509.html
@@ -198,7 +198,7 @@
Package-Level Type Names (total 57, in which 21 are exported)
-
SystemRootsError results when we fail to load the system root certificates.Errerror
- ( SystemRootsError) Error() string
- ( SystemRootsError) Unwrap() error
+ ( SystemRootsError) Error() string
+ ( SystemRootsError) Unwrap() error
SystemRootsError : error
SystemRootsError : github.com/go-faster/errors.Wrapper
@@ -1109,82 +1110,82 @@
UnhandledCriticalExtension : error
-
+
UnknownAuthorityError results when the certificate issuer is unknown
- Cert*Certificate
+ Cert*Certificate
-
+ hintCert contains a possible authority certificate that was rejected
because of the error in hintErr.
-
+ hintErr contains an error that may be helpful in determining why an
authority wasn't found.
- ( UnknownAuthorityError) Error() string
+ ( UnknownAuthorityError) Error() string
UnknownAuthorityError : error
-
+
VerifyOptions contains parameters for Certificate.Verify.
-
+ CertificatePolicies specifies which certificate policy OIDs are
acceptable during policy validation. An empty CertificatePolices
field implies any valid policy is acceptable.
-
+ CurrentTime is used to check the validity of all certificates in the
chain. If zero, the current time is used.
-
+ DNSName, if set, is checked against the leaf certificate with
Certificate.VerifyHostname or the platform verifier.
-
+ Intermediates is an optional pool of certificates that are not trust
anchors, but can be used to form a chain from the leaf certificate to a
root certificate.
-
+ KeyUsages specifies which Extended Key Usage values are acceptable. A
chain is accepted if it allows any of the listed values. An empty list
means ExtKeyUsageServerAuth. To accept any key usage, include ExtKeyUsageAny.
-
+ MaxConstraintComparisions is the maximum number of comparisons to
perform when checking a given certificate's name constraints. If
zero, a sensible default is used. This limit prevents pathological
certificates from consuming excessive amounts of CPU time when
validating. It does not apply to the platform verifier.
-
+ Roots is the set of trusted root certificates the leaf certificate needs
to chain up to. If nil, the system roots or the platform verifier are used.
-
+ inhibitAnyPolicy indicates if the anyPolicy policy should be
processed if present in a certificate being validated.
-
+ inhibitPolicyMapping indicates if policy mapping should be allowed
during path validation.
-
+ requireExplicitPolicy indidicates if explicit policies must be present
for each certificate being validated.
- func (*Certificate).Verify(opts VerifyOptions) ([][]*Certificate, error)
+ func (*Certificate).Verify(opts VerifyOptions) ([][]*Certificate, error)
func policiesValid(chain []*Certificate, opts VerifyOptions) bool
- func (*Certificate).buildChains(currentChain []*Certificate, sigChecks *int, opts *VerifyOptions) (chains [][]*Certificate, err error)
- func (*Certificate).isValid(certType int, currentChain []*Certificate, opts *VerifyOptions) error
+ func (*Certificate).buildChains(currentChain []*Certificate, sigChecks *int, opts *VerifyOptions) (chains [][]*Certificate, err error)
+ func (*Certificate).isValid(certType int, currentChain []*Certificate, opts *VerifyOptions) error
func (*Certificate).systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error)
func crypto/tls.anyValidVerifiedChain(verifiedChains [][]*Certificate, opts VerifyOptions) bool
@@ -1476,39 +1477,39 @@
Algopkix.AlgorithmIdentifierBitStringasn1.BitString
-
Package-Level Functions (total 124, in which 28 are exported)
+
Package-Level Functions (total 125, in which 28 are exported)
CreateCertificate creates a new X.509 v3 certificate based on a template.
@@ -1939,19 +1940,19 @@
New changes in the system cert pool might not be reflected in subsequent calls.
-
+
alreadyInChain checks whether a candidate certificate is present in a chain.
Rather than doing a direct byte for byte equivalency check, we check if the
subject, public key, and SAN, if present, are equal. This prevents loops that
are created by mutual cross-signatures, or other cross-signature bridge
oddities.
-
asn1BitLength returns the bit-length of bitString by considering the
most-significant bit in a byte to be the "first" bit. This convention
matches ASN.1, but differs from almost everything else.
-
Type Parameters:
T: string | *net.IPNet
@@ -1962,7 +1963,11 @@
checkSignature verifies that signature is a valid signature over signed from
a crypto.PublicKey.
-
+ containsDistrustedSPKIHash checks if any of the certificates in the chain
+ have an SPKI whose hash is present in the distrustedSPKIHashes map.
+
+
dnsCompare is a case-insensitive reversed implementation of strings.Compare
that operates from the end to the start of the strings. This is more
efficient that allocating reversed version of a and b and using
@@ -1989,7 +1994,7 @@
domainNameValid is an alloc-less version of the checks that
domainToReverseLabels does.
-
+
domainToReverseLabels converts a textual domain name like foo.example.com to
the list of labels in reverse order, e.g. ["com", "example", "foo"].
@@ -1998,7 +2003,7 @@
identifier for public key types supported in certificates and CSRs. Marshal
and Parse functions may support a different set of public key types.
-
isPrintable reports whether the given b is in the ASN.1 PrintableString set.
This is a simplified version of encoding/asn1.isPrintable.
@@ -2021,7 +2026,7 @@
marshalSANs marshals a list of addresses into a the contents of an X.509
SubjectAlternativeName extension.
-
newRawAttributes converts AttributeTypeAndValueSETs from a template
CertificateRequest's Attributes into tbsCertificateRequest RawAttributes.
@@ -2052,13 +2057,13 @@
parseRawAttributes Unmarshals RawAttributes into AttributeTypeAndValueSETs.
-
+
parseRFC2821Mailbox parses an email address into local and domain parts,
based on the ABNF for a “Mailbox” from RFC 2821. According to RFC 5280,
Section 4.2.1.6 that's correct for an rfc822Name from a certificate: “The
format of an rfc822Name is a "Mailbox" as defined in RFC 2821, Section 4.1.2”.
-
readUniqueDirectoryEntries is like os.ReadDir but omits
symlinks that point within the directory.
@@ -2067,18 +2072,18 @@
Identifier to use for signing, based on the key type. If sigAlgo is not zero
then it overrides the default.
-
toLowerCaseASCII returns a lower-case version of in. See RFC 6125 6.4.1. We use
an explicitly ASCII function to avoid any sharp corners resulting from
performing Unicode operations on DNS labels.
-
validHostname reports whether host is a valid hostname that can be matched or
matched against according to RFC 6125 2.2, with some leniency to accommodate
legacy values.
-
Possible directories with certificate files; all will be read.
Possible certificate files; stop after finding one.
+
+ distrustedSPKIHashes contains hashes of SPKIs from certificates which
+ we don't consider to be trustworthy. We use these hashes to filter out
+ chains returned by Verify
+
dnsCompareTable contains the ASCII alphabet mapped from a characters index in
the table to its lowercased form.
@@ -2101,11 +2111,11 @@
emptyASN1Subject is the ASN.1 DER encoding of an empty Subject, which is
just an empty SEQUENCE.
-
Package-Level Constants (total 82, in which 61 are exported)
-
+
CANotAuthorizedForExtKeyUsage results when an intermediate or root
certificate does not permit a requested extended key usage.
-
+
CANotAuthorizedForThisName results when an intermediate or root
certificate has a name constraint which doesn't permit a DNS or
other name (including IP address) in the leaf certificate.
-
TooManyConstraints results when the number of comparison operations
needed to check a certificate exceeds the limit set by
VerifyOptions.MaxConstraintComparisions. This limit exists to
prevent pathological certificates can consuming excessive amounts of
CPU time to verify.
-
+
TooManyIntermediates results when a path length constraint is
violated.
-
+
UnconstrainedName results when a CA certificate contains permitted
name constraints, but leaf certificate contains a name of an
unsupported or unconstrained type.
@@ -3457,13 +3467,13 @@
certFileEnv is the environment variable which identifies where to locate
the SSL certificate file. If set this overrides the system default.
-
maxChainSignatureChecks is the maximum number of CheckSignatureFrom calls
that an invocation of buildChains will (transitively) make. Most chains are
less than 15 certificates long, so this leaves space for multiple chains and
for failed checks due to different intermediates having the same Subject.
-
// Copyright 2011 The Go Authors. All rights reserved.
@@ -581,1396 +599,1427 @@
import (
-
-
-
-
-
-
-
-
-
-
-
-)
-
-typeInvalidReasonint
+
+
+
+
+
+
+
+
+
+
+
+
+
+)
-const (
-// NotAuthorizedToSign results when a certificate is signed by another
- // which isn't marked as a CA certificate.
-NotAuthorizedToSignInvalidReason = iota
-// Expired results when a certificate has expired, based on the time
- // given in the VerifyOptions.
-Expired
-// CANotAuthorizedForThisName results when an intermediate or root
- // certificate has a name constraint which doesn't permit a DNS or
- // other name (including IP address) in the leaf certificate.
-CANotAuthorizedForThisName
-// TooManyIntermediates results when a path length constraint is
- // violated.
-TooManyIntermediates
-// IncompatibleUsage results when the certificate's key usage indicates
- // that it may only be used for a different purpose.
-IncompatibleUsage
-// NameMismatch results when the subject name of a parent certificate
- // does not match the issuer name in the child.
-NameMismatch
-// NameConstraintsWithoutSANs is a legacy error and is no longer returned.
-NameConstraintsWithoutSANs
-// UnconstrainedName results when a CA certificate contains permitted
- // name constraints, but leaf certificate contains a name of an
- // unsupported or unconstrained type.
-UnconstrainedName
-// TooManyConstraints results when the number of comparison operations
- // needed to check a certificate exceeds the limit set by
- // VerifyOptions.MaxConstraintComparisions. This limit exists to
- // prevent pathological certificates can consuming excessive amounts of
- // CPU time to verify.
-TooManyConstraints
-// CANotAuthorizedForExtKeyUsage results when an intermediate or root
- // certificate does not permit a requested extended key usage.
-CANotAuthorizedForExtKeyUsage
-// NoValidChains results when there are no valid chains to return.
-NoValidChains
-)
-
-// CertificateInvalidError results when an odd error occurs. Users of this
-// library probably want to handle all these errors uniformly.
-typeCertificateInvalidErrorstruct {
-Cert *Certificate
-ReasonInvalidReason
-Detailstring
-}
-
-func ( CertificateInvalidError) () string {
-switch .Reason {
-caseNotAuthorizedToSign:
-return"x509: certificate is not authorized to sign other certificates"
-caseExpired:
-return"x509: certificate has expired or is not yet valid: " + .Detail
-caseCANotAuthorizedForThisName:
-return"x509: a root or intermediate certificate is not authorized to sign for this name: " + .Detail
-caseCANotAuthorizedForExtKeyUsage:
-return"x509: a root or intermediate certificate is not authorized for an extended key usage: " + .Detail
-caseTooManyIntermediates:
-return"x509: too many intermediates for path length constraint"
-caseIncompatibleUsage:
-return"x509: certificate specifies an incompatible key usage"
-caseNameMismatch:
-return"x509: issuer name does not match subject from issuing certificate"
-caseNameConstraintsWithoutSANs:
-return"x509: issuer has name constraints but leaf doesn't have a SAN extension"
-caseUnconstrainedName:
-return"x509: issuer has name constraints but leaf contains unknown or unconstrained name: " + .Detail
-caseNoValidChains:
- := "x509: no valid chains built"
-if .Detail != "" {
- = fmt.Sprintf("%s: %s", , .Detail)
- }
-return
- }
-return"x509: unknown error"
-}
-
-// HostnameError results when the set of authorized names doesn't match the
-// requested name.
-typeHostnameErrorstruct {
-Certificate *Certificate
-Hoststring
-}
-
-func ( HostnameError) () string {
- := .Certificate
- := 100
-
-if !.hasSANExtension() && matchHostnames(.Subject.CommonName, splitHostname(.Host)) {
-return"x509: certificate relies on legacy Common Name field, use SANs instead"
- }
-
-varstrings.Builder
-if := net.ParseIP(.Host); != nil {
-// Trying to validate an IP
-iflen(.IPAddresses) == 0 {
-return"x509: cannot validate certificate for " + .Host + " because it doesn't contain any IP SANs"
- }
-iflen(.IPAddresses) >= {
-returnfmt.Sprintf("x509: certificate is valid for %d IP SANs, but none matched %s", len(.IPAddresses), .Host)
- }
-for , := range .IPAddresses {
-if .Len() > 0 {
- .WriteString(", ")
- }
- .WriteString(.String())
- }
- } else {
-iflen(.DNSNames) >= {
-returnfmt.Sprintf("x509: certificate is valid for %d names, but none matched %s", len(.DNSNames), .Host)
- }
- .WriteString(strings.Join(.DNSNames, ", "))
- }
-
-if .Len() == 0 {
-return"x509: certificate is not valid for any names, but wanted to match " + .Host
- }
-return"x509: certificate is valid for " + .String() + ", not " + .Host
-}
-
-// UnknownAuthorityError results when the certificate issuer is unknown
-typeUnknownAuthorityErrorstruct {
-Cert *Certificate
-// hintErr contains an error that may be helpful in determining why an
- // authority wasn't found.
-hintErrerror
-// hintCert contains a possible authority certificate that was rejected
- // because of the error in hintErr.
-hintCert *Certificate
-}
-
-func ( UnknownAuthorityError) () string {
- := "x509: certificate signed by unknown authority"
-if .hintErr != nil {
- := .hintCert.Subject.CommonName
-iflen() == 0 {
-iflen(.hintCert.Subject.Organization) > 0 {
- = .hintCert.Subject.Organization[0]
- } else {
- = "serial:" + .hintCert.SerialNumber.String()
- }
- }
- += fmt.Sprintf(" (possibly because of %q while trying to verify candidate authority certificate %q)", .hintErr, )
- }
-return
-}
-
-// SystemRootsError results when we fail to load the system root certificates.
-typeSystemRootsErrorstruct {
-Errerror
-}
-
-func ( SystemRootsError) () string {
- := "x509: failed to load system roots and no roots provided"
-if .Err != nil {
-return + "; " + .Err.Error()
- }
-return
-}
-
-func ( SystemRootsError) () error { return .Err }
+typeInvalidReasonint
+
+const (
+// NotAuthorizedToSign results when a certificate is signed by another
+ // which isn't marked as a CA certificate.
+NotAuthorizedToSignInvalidReason = iota
+// Expired results when a certificate has expired, based on the time
+ // given in the VerifyOptions.
+Expired
+// CANotAuthorizedForThisName results when an intermediate or root
+ // certificate has a name constraint which doesn't permit a DNS or
+ // other name (including IP address) in the leaf certificate.
+CANotAuthorizedForThisName
+// TooManyIntermediates results when a path length constraint is
+ // violated.
+TooManyIntermediates
+// IncompatibleUsage results when the certificate's key usage indicates
+ // that it may only be used for a different purpose.
+IncompatibleUsage
+// NameMismatch results when the subject name of a parent certificate
+ // does not match the issuer name in the child.
+NameMismatch
+// NameConstraintsWithoutSANs is a legacy error and is no longer returned.
+NameConstraintsWithoutSANs
+// UnconstrainedName results when a CA certificate contains permitted
+ // name constraints, but leaf certificate contains a name of an
+ // unsupported or unconstrained type.
+UnconstrainedName
+// TooManyConstraints results when the number of comparison operations
+ // needed to check a certificate exceeds the limit set by
+ // VerifyOptions.MaxConstraintComparisions. This limit exists to
+ // prevent pathological certificates can consuming excessive amounts of
+ // CPU time to verify.
+TooManyConstraints
+// CANotAuthorizedForExtKeyUsage results when an intermediate or root
+ // certificate does not permit a requested extended key usage.
+CANotAuthorizedForExtKeyUsage
+// NoValidChains results when there are no valid chains to return.
+NoValidChains
+)
+
+// CertificateInvalidError results when an odd error occurs. Users of this
+// library probably want to handle all these errors uniformly.
+typeCertificateInvalidErrorstruct {
+Cert *Certificate
+ReasonInvalidReason
+Detailstring
+}
+
+func ( CertificateInvalidError) () string {
+switch .Reason {
+caseNotAuthorizedToSign:
+return"x509: certificate is not authorized to sign other certificates"
+caseExpired:
+return"x509: certificate has expired or is not yet valid: " + .Detail
+caseCANotAuthorizedForThisName:
+return"x509: a root or intermediate certificate is not authorized to sign for this name: " + .Detail
+caseCANotAuthorizedForExtKeyUsage:
+return"x509: a root or intermediate certificate is not authorized for an extended key usage: " + .Detail
+caseTooManyIntermediates:
+return"x509: too many intermediates for path length constraint"
+caseIncompatibleUsage:
+return"x509: certificate specifies an incompatible key usage"
+caseNameMismatch:
+return"x509: issuer name does not match subject from issuing certificate"
+caseNameConstraintsWithoutSANs:
+return"x509: issuer has name constraints but leaf doesn't have a SAN extension"
+caseUnconstrainedName:
+return"x509: issuer has name constraints but leaf contains unknown or unconstrained name: " + .Detail
+caseNoValidChains:
+ := "x509: no valid chains built"
+if .Detail != "" {
+ = fmt.Sprintf("%s: %s", , .Detail)
+ }
+return
+ }
+return"x509: unknown error"
+}
+
+// HostnameError results when the set of authorized names doesn't match the
+// requested name.
+typeHostnameErrorstruct {
+Certificate *Certificate
+Hoststring
+}
+
+func ( HostnameError) () string {
+ := .Certificate
+ := 100
+
+if !.hasSANExtension() && matchHostnames(.Subject.CommonName, splitHostname(.Host)) {
+return"x509: certificate relies on legacy Common Name field, use SANs instead"
+ }
+
+varstrings.Builder
+if := net.ParseIP(.Host); != nil {
+// Trying to validate an IP
+iflen(.IPAddresses) == 0 {
+return"x509: cannot validate certificate for " + .Host + " because it doesn't contain any IP SANs"
+ }
+iflen(.IPAddresses) >= {
+returnfmt.Sprintf("x509: certificate is valid for %d IP SANs, but none matched %s", len(.IPAddresses), .Host)
+ }
+for , := range .IPAddresses {
+if .Len() > 0 {
+ .WriteString(", ")
+ }
+ .WriteString(.String())
+ }
+ } else {
+iflen(.DNSNames) >= {
+returnfmt.Sprintf("x509: certificate is valid for %d names, but none matched %s", len(.DNSNames), .Host)
+ }
+ .WriteString(strings.Join(.DNSNames, ", "))
+ }
+
+if .Len() == 0 {
+return"x509: certificate is not valid for any names, but wanted to match " + .Host
+ }
+return"x509: certificate is valid for " + .String() + ", not " + .Host
+}
+
+// UnknownAuthorityError results when the certificate issuer is unknown
+typeUnknownAuthorityErrorstruct {
+Cert *Certificate
+// hintErr contains an error that may be helpful in determining why an
+ // authority wasn't found.
+hintErrerror
+// hintCert contains a possible authority certificate that was rejected
+ // because of the error in hintErr.
+hintCert *Certificate
+}
+
+func ( UnknownAuthorityError) () string {
+ := "x509: certificate signed by unknown authority"
+if .hintErr != nil {
+ := .hintCert.Subject.CommonName
+iflen() == 0 {
+iflen(.hintCert.Subject.Organization) > 0 {
+ = .hintCert.Subject.Organization[0]
+ } else {
+ = "serial:" + .hintCert.SerialNumber.String()
+ }
+ }
+ += fmt.Sprintf(" (possibly because of %q while trying to verify candidate authority certificate %q)", .hintErr, )
+ }
+return
+}
+
+// SystemRootsError results when we fail to load the system root certificates.
+typeSystemRootsErrorstruct {
+Errerror
+}
+
+func ( SystemRootsError) () string {
+ := "x509: failed to load system roots and no roots provided"
+if .Err != nil {
+return + "; " + .Err.Error()
+ }
+return
+}
-// errNotParsed is returned when a certificate without ASN.1 contents is
-// verified. Platform-specific verification needs the ASN.1 contents.
-varerrNotParsed = errors.New("x509: missing ASN.1 contents; use ParseCertificate")
-
-// VerifyOptions contains parameters for Certificate.Verify.
-typeVerifyOptionsstruct {
-// DNSName, if set, is checked against the leaf certificate with
- // Certificate.VerifyHostname or the platform verifier.
-DNSNamestring
-
-// Intermediates is an optional pool of certificates that are not trust
- // anchors, but can be used to form a chain from the leaf certificate to a
- // root certificate.
-Intermediates *CertPool
-// Roots is the set of trusted root certificates the leaf certificate needs
- // to chain up to. If nil, the system roots or the platform verifier are used.
-Roots *CertPool
-
-// CurrentTime is used to check the validity of all certificates in the
- // chain. If zero, the current time is used.
-CurrentTimetime.Time
-
-// KeyUsages specifies which Extended Key Usage values are acceptable. A
- // chain is accepted if it allows any of the listed values. An empty list
- // means ExtKeyUsageServerAuth. To accept any key usage, include ExtKeyUsageAny.
-KeyUsages []ExtKeyUsage
-
-// MaxConstraintComparisions is the maximum number of comparisons to
- // perform when checking a given certificate's name constraints. If
- // zero, a sensible default is used. This limit prevents pathological
- // certificates from consuming excessive amounts of CPU time when
- // validating. It does not apply to the platform verifier.
-MaxConstraintComparisionsint
-
-// CertificatePolicies specifies which certificate policy OIDs are
- // acceptable during policy validation. An empty CertificatePolices
- // field implies any valid policy is acceptable.
-CertificatePolicies []OID
-
-// The following policy fields are unexported, because we do not expect
- // users to actually need to use them, but are useful for testing the
- // policy validation code.
-
-// inhibitPolicyMapping indicates if policy mapping should be allowed
- // during path validation.
-inhibitPolicyMappingbool
-
-// requireExplicitPolicy indidicates if explicit policies must be present
- // for each certificate being validated.
-requireExplicitPolicybool
-
-// inhibitAnyPolicy indicates if the anyPolicy policy should be
- // processed if present in a certificate being validated.
-inhibitAnyPolicybool
-}
-
-const (
-leafCertificate = iota
-intermediateCertificate
-rootCertificate
-)
-
-// rfc2821Mailbox represents a “mailbox” (which is an email address to most
-// people) by breaking it into the “local” (i.e. before the '@') and “domain”
-// parts.
-typerfc2821Mailboxstruct {
-local, domainstring
-}
-
-func ( rfc2821Mailbox) () string {
-returnfmt.Sprintf("%s@%s", .local, .domain)
-}
-
-// parseRFC2821Mailbox parses an email address into local and domain parts,
-// based on the ABNF for a “Mailbox” from RFC 2821. According to RFC 5280,
-// Section 4.2.1.6 that's correct for an rfc822Name from a certificate: “The
-// format of an rfc822Name is a "Mailbox" as defined in RFC 2821, Section 4.1.2”.
-func ( string) ( rfc2821Mailbox, bool) {
-iflen() == 0 {
-return , false
- }
-
- := make([]byte, 0, len()/2)
+func ( SystemRootsError) () error { return .Err }
+
+// errNotParsed is returned when a certificate without ASN.1 contents is
+// verified. Platform-specific verification needs the ASN.1 contents.
+varerrNotParsed = errors.New("x509: missing ASN.1 contents; use ParseCertificate")
+
+// VerifyOptions contains parameters for Certificate.Verify.
+typeVerifyOptionsstruct {
+// DNSName, if set, is checked against the leaf certificate with
+ // Certificate.VerifyHostname or the platform verifier.
+DNSNamestring
+
+// Intermediates is an optional pool of certificates that are not trust
+ // anchors, but can be used to form a chain from the leaf certificate to a
+ // root certificate.
+Intermediates *CertPool
+// Roots is the set of trusted root certificates the leaf certificate needs
+ // to chain up to. If nil, the system roots or the platform verifier are used.
+Roots *CertPool
+
+// CurrentTime is used to check the validity of all certificates in the
+ // chain. If zero, the current time is used.
+CurrentTimetime.Time
+
+// KeyUsages specifies which Extended Key Usage values are acceptable. A
+ // chain is accepted if it allows any of the listed values. An empty list
+ // means ExtKeyUsageServerAuth. To accept any key usage, include ExtKeyUsageAny.
+KeyUsages []ExtKeyUsage
+
+// MaxConstraintComparisions is the maximum number of comparisons to
+ // perform when checking a given certificate's name constraints. If
+ // zero, a sensible default is used. This limit prevents pathological
+ // certificates from consuming excessive amounts of CPU time when
+ // validating. It does not apply to the platform verifier.
+MaxConstraintComparisionsint
+
+// CertificatePolicies specifies which certificate policy OIDs are
+ // acceptable during policy validation. An empty CertificatePolices
+ // field implies any valid policy is acceptable.
+CertificatePolicies []OID
+
+// The following policy fields are unexported, because we do not expect
+ // users to actually need to use them, but are useful for testing the
+ // policy validation code.
+
+// inhibitPolicyMapping indicates if policy mapping should be allowed
+ // during path validation.
+inhibitPolicyMappingbool
+
+// requireExplicitPolicy indidicates if explicit policies must be present
+ // for each certificate being validated.
+requireExplicitPolicybool
+
+// inhibitAnyPolicy indicates if the anyPolicy policy should be
+ // processed if present in a certificate being validated.
+inhibitAnyPolicybool
+}
+
+const (
+leafCertificate = iota
+intermediateCertificate
+rootCertificate
+)
+
+// rfc2821Mailbox represents a “mailbox” (which is an email address to most
+// people) by breaking it into the “local” (i.e. before the '@') and “domain”
+// parts.
+typerfc2821Mailboxstruct {
+local, domainstring
+}
+
+func ( rfc2821Mailbox) () string {
+returnfmt.Sprintf("%s@%s", .local, .domain)
+}
+
+// parseRFC2821Mailbox parses an email address into local and domain parts,
+// based on the ABNF for a “Mailbox” from RFC 2821. According to RFC 5280,
+// Section 4.2.1.6 that's correct for an rfc822Name from a certificate: “The
+// format of an rfc822Name is a "Mailbox" as defined in RFC 2821, Section 4.1.2”.
+func ( string) ( rfc2821Mailbox, bool) {
+iflen() == 0 {
+return , false
+ }
-if [0] == '"' {
-// Quoted-string = DQUOTE *qcontent DQUOTE
- // non-whitespace-control = %d1-8 / %d11 / %d12 / %d14-31 / %d127
- // qcontent = qtext / quoted-pair
- // qtext = non-whitespace-control /
- // %d33 / %d35-91 / %d93-126
- // quoted-pair = ("\" text) / obs-qp
- // text = %d1-9 / %d11 / %d12 / %d14-127 / obs-text
- //
- // (Names beginning with “obs-” are the obsolete syntax from RFC 2822,
- // Section 4. Since it has been 16 years, we no longer accept that.)
- = [1:]
- :
-for {
-iflen() == 0 {
-return , false
- }
- := [0]
- = [1:]
-
-switch {
-case == '"':
-break
-
-case == '\\':
-// quoted-pair
-iflen() == 0 {
-return , false
- }
-if [0] == 11 ||
- [0] == 12 ||
- (1 <= [0] && [0] <= 9) ||
- (14 <= [0] && [0] <= 127) {
- = append(, [0])
- = [1:]
- } else {
-return , false
- }
-
-case == 11 ||
- == 12 ||
-// Space (char 32) is not allowed based on the
- // BNF, but RFC 3696 gives an example that
- // assumes that it is. Several “verified”
- // errata continue to argue about this point.
- // We choose to accept it.
- == 32 ||
- == 33 ||
- == 127 ||
- (1 <= && <= 8) ||
- (14 <= && <= 31) ||
- (35 <= && <= 91) ||
- (93 <= && <= 126):
-// qtext
- = append(, )
-
-default:
-return , false
- }
- }
- } else {
-// Atom ("." Atom)*
- :
-forlen() > 0 {
-// atext from RFC 2822, Section 3.2.4
- := [0]
-
-switch {
-case == '\\':
-// Examples given in RFC 3696 suggest that
- // escaped characters can appear outside of a
- // quoted string. Several “verified” errata
- // continue to argue the point. We choose to
- // accept it.
- = [1:]
-iflen() == 0 {
-return , false
- }
-fallthrough
-
-case ('0' <= && <= '9') ||
- ('a' <= && <= 'z') ||
- ('A' <= && <= 'Z') ||
- == '!' || == '#' || == '$' || == '%' ||
- == '&' || == '\'' || == '*' || == '+' ||
- == '-' || == '/' || == '=' || == '?' ||
- == '^' || == '_' || == '`' || == '{' ||
- == '|' || == '}' || == '~' || == '.':
- = append(, [0])
- = [1:]
-
-default:
-break
- }
- }
-
-iflen() == 0 {
-return , false
- }
-
-// From RFC 3696, Section 3:
- // “period (".") may also appear, but may not be used to start
- // or end the local part, nor may two or more consecutive
- // periods appear.”
- := []byte{'.', '.'}
-if [0] == '.' ||
- [len()-1] == '.' ||
-bytes.Contains(, ) {
-return , false
- }
- }
-
-iflen() == 0 || [0] != '@' {
-return , false
- }
- = [1:]
-
-// The RFC species a format for domains, but that's known to be
- // violated in practice so we accept that anything after an '@' is the
- // domain part.
-if , := domainToReverseLabels(); ! {
-return , false
- }
-
- .local = string()
- .domain =
-return , true
-}
-
-// domainToReverseLabels converts a textual domain name like foo.example.com to
-// the list of labels in reverse order, e.g. ["com", "example", "foo"].
-func ( string) ( []string, bool) {
- = make([]string, 0, strings.Count(, ".")+1)
-forlen() > 0 {
-if := strings.LastIndexByte(, '.'); == -1 {
- = append(, )
- = ""
- } else {
- = append(, [+1:])
- = [:]
-if == 0 { // domain == ""
-// domain is prefixed with an empty label, append an empty
- // string to reverseLabels to indicate this.
- = append(, "")
- }
- }
- }
-
-iflen() > 0 && len([0]) == 0 {
-// An empty label at the end indicates an absolute value.
-returnnil, false
- }
-
-for , := range {
-iflen() == 0 {
-// Empty labels are otherwise invalid.
-returnnil, false
- }
-
-for , := range {
-if < 33 || > 126 {
-// Invalid character.
-returnnil, false
- }
- }
- }
-
-return , true
-}
-
-// isValid performs validity checks on c given that it is a candidate to append
-// to the chain in currentChain.
-func ( *Certificate) ( int, []*Certificate, *VerifyOptions) error {
-iflen(.UnhandledCriticalExtensions) > 0 {
-returnUnhandledCriticalExtension{}
- }
-
-iflen() > 0 {
- := [len()-1]
-if !bytes.Equal(.RawIssuer, .RawSubject) {
-returnCertificateInvalidError{, NameMismatch, ""}
- }
- }
-
- := .CurrentTime
-if .IsZero() {
- = time.Now()
- }
-if .Before(.NotBefore) {
-returnCertificateInvalidError{
-Cert: ,
-Reason: Expired,
-Detail: fmt.Sprintf("current time %s is before %s", .Format(time.RFC3339), .NotBefore.Format(time.RFC3339)),
- }
- } elseif .After(.NotAfter) {
-returnCertificateInvalidError{
-Cert: ,
-Reason: Expired,
-Detail: fmt.Sprintf("current time %s is after %s", .Format(time.RFC3339), .NotAfter.Format(time.RFC3339)),
- }
- }
-
-if == intermediateCertificate || == rootCertificate {
-iflen() == 0 {
-returnerrors.New("x509: internal error: empty chain when appending CA cert")
- }
- }
-
-// KeyUsage status flags are ignored. From Engineering Security, Peter
- // Gutmann: A European government CA marked its signing certificates as
- // being valid for encryption only, but no-one noticed. Another
- // European CA marked its signature keys as not being valid for
- // signatures. A different CA marked its own trusted root certificate
- // as being invalid for certificate signing. Another national CA
- // distributed a certificate to be used to encrypt data for the
- // country’s tax authority that was marked as only being usable for
- // digital signatures but not for encryption. Yet another CA reversed
- // the order of the bit flags in the keyUsage due to confusion over
- // encoding endianness, essentially setting a random keyUsage in
- // certificates that it issued. Another CA created a self-invalidating
- // certificate by adding a certificate policy statement stipulating
- // that the certificate had to be used strictly as specified in the
- // keyUsage, and a keyUsage containing a flag indicating that the RSA
- // encryption key could only be used for Diffie-Hellman key agreement.
-
-if == intermediateCertificate && (!.BasicConstraintsValid || !.IsCA) {
-returnCertificateInvalidError{, NotAuthorizedToSign, ""}
- }
-
-if .BasicConstraintsValid && .MaxPathLen >= 0 {
- := len() - 1
-if > .MaxPathLen {
-returnCertificateInvalidError{, TooManyIntermediates, ""}
- }
- }
-
-returnnil
-}
-
-// Verify attempts to verify c by building one or more chains from c to a
-// certificate in opts.Roots, using certificates in opts.Intermediates if
-// needed. If successful, it returns one or more chains where the first
-// element of the chain is c and the last element is from opts.Roots.
-//
-// If opts.Roots is nil, the platform verifier might be used, and
-// verification details might differ from what is described below. If system
-// roots are unavailable the returned error will be of type SystemRootsError.
-//
-// Name constraints in the intermediates will be applied to all names claimed
-// in the chain, not just opts.DNSName. Thus it is invalid for a leaf to claim
-// example.com if an intermediate doesn't permit it, even if example.com is not
-// the name being validated. Note that DirectoryName constraints are not
-// supported.
-//
-// Name constraint validation follows the rules from RFC 5280, with the
-// addition that DNS name constraints may use the leading period format
-// defined for emails and URIs. When a constraint has a leading period
-// it indicates that at least one additional label must be prepended to
-// the constrained name to be considered valid.
-//
-// Extended Key Usage values are enforced nested down a chain, so an intermediate
-// or root that enumerates EKUs prevents a leaf from asserting an EKU not in that
-// list. (While this is not specified, it is common practice in order to limit
-// the types of certificates a CA can issue.)
-//
-// Certificates that use SHA1WithRSA and ECDSAWithSHA1 signatures are not supported,
-// and will not be used to build chains.
-//
-// Certificates other than c in the returned chains should not be modified.
+ := make([]byte, 0, len()/2)
+
+if [0] == '"' {
+// Quoted-string = DQUOTE *qcontent DQUOTE
+ // non-whitespace-control = %d1-8 / %d11 / %d12 / %d14-31 / %d127
+ // qcontent = qtext / quoted-pair
+ // qtext = non-whitespace-control /
+ // %d33 / %d35-91 / %d93-126
+ // quoted-pair = ("\" text) / obs-qp
+ // text = %d1-9 / %d11 / %d12 / %d14-127 / obs-text
+ //
+ // (Names beginning with “obs-” are the obsolete syntax from RFC 2822,
+ // Section 4. Since it has been 16 years, we no longer accept that.)
+ = [1:]
+ :
+for {
+iflen() == 0 {
+return , false
+ }
+ := [0]
+ = [1:]
+
+switch {
+case == '"':
+break
+
+case == '\\':
+// quoted-pair
+iflen() == 0 {
+return , false
+ }
+if [0] == 11 ||
+ [0] == 12 ||
+ (1 <= [0] && [0] <= 9) ||
+ (14 <= [0] && [0] <= 127) {
+ = append(, [0])
+ = [1:]
+ } else {
+return , false
+ }
+
+case == 11 ||
+ == 12 ||
+// Space (char 32) is not allowed based on the
+ // BNF, but RFC 3696 gives an example that
+ // assumes that it is. Several “verified”
+ // errata continue to argue about this point.
+ // We choose to accept it.
+ == 32 ||
+ == 33 ||
+ == 127 ||
+ (1 <= && <= 8) ||
+ (14 <= && <= 31) ||
+ (35 <= && <= 91) ||
+ (93 <= && <= 126):
+// qtext
+ = append(, )
+
+default:
+return , false
+ }
+ }
+ } else {
+// Atom ("." Atom)*
+ :
+forlen() > 0 {
+// atext from RFC 2822, Section 3.2.4
+ := [0]
+
+switch {
+case == '\\':
+// Examples given in RFC 3696 suggest that
+ // escaped characters can appear outside of a
+ // quoted string. Several “verified” errata
+ // continue to argue the point. We choose to
+ // accept it.
+ = [1:]
+iflen() == 0 {
+return , false
+ }
+fallthrough
+
+case ('0' <= && <= '9') ||
+ ('a' <= && <= 'z') ||
+ ('A' <= && <= 'Z') ||
+ == '!' || == '#' || == '$' || == '%' ||
+ == '&' || == '\'' || == '*' || == '+' ||
+ == '-' || == '/' || == '=' || == '?' ||
+ == '^' || == '_' || == '`' || == '{' ||
+ == '|' || == '}' || == '~' || == '.':
+ = append(, [0])
+ = [1:]
+
+default:
+break
+ }
+ }
+
+iflen() == 0 {
+return , false
+ }
+
+// From RFC 3696, Section 3:
+ // “period (".") may also appear, but may not be used to start
+ // or end the local part, nor may two or more consecutive
+ // periods appear.”
+ := []byte{'.', '.'}
+if [0] == '.' ||
+ [len()-1] == '.' ||
+bytes.Contains(, ) {
+return , false
+ }
+ }
+
+iflen() == 0 || [0] != '@' {
+return , false
+ }
+ = [1:]
+
+// The RFC species a format for domains, but that's known to be
+ // violated in practice so we accept that anything after an '@' is the
+ // domain part.
+if , := domainToReverseLabels(); ! {
+return , false
+ }
+
+ .local = string()
+ .domain =
+return , true
+}
+
+// domainToReverseLabels converts a textual domain name like foo.example.com to
+// the list of labels in reverse order, e.g. ["com", "example", "foo"].
+func ( string) ( []string, bool) {
+ = make([]string, 0, strings.Count(, ".")+1)
+forlen() > 0 {
+if := strings.LastIndexByte(, '.'); == -1 {
+ = append(, )
+ = ""
+ } else {
+ = append(, [+1:])
+ = [:]
+if == 0 { // domain == ""
+// domain is prefixed with an empty label, append an empty
+ // string to reverseLabels to indicate this.
+ = append(, "")
+ }
+ }
+ }
+
+iflen() > 0 && len([0]) == 0 {
+// An empty label at the end indicates an absolute value.
+returnnil, false
+ }
+
+for , := range {
+iflen() == 0 {
+// Empty labels are otherwise invalid.
+returnnil, false
+ }
+
+for , := range {
+if < 33 || > 126 {
+// Invalid character.
+returnnil, false
+ }
+ }
+ }
+
+return , true
+}
+
+// isValid performs validity checks on c given that it is a candidate to append
+// to the chain in currentChain.
+func ( *Certificate) ( int, []*Certificate, *VerifyOptions) error {
+iflen(.UnhandledCriticalExtensions) > 0 {
+returnUnhandledCriticalExtension{}
+ }
+
+iflen() > 0 {
+ := [len()-1]
+if !bytes.Equal(.RawIssuer, .RawSubject) {
+returnCertificateInvalidError{, NameMismatch, ""}
+ }
+ }
+
+ := .CurrentTime
+if .IsZero() {
+ = time.Now()
+ }
+if .Before(.NotBefore) {
+returnCertificateInvalidError{
+Cert: ,
+Reason: Expired,
+Detail: fmt.Sprintf("current time %s is before %s", .Format(time.RFC3339), .NotBefore.Format(time.RFC3339)),
+ }
+ } elseif .After(.NotAfter) {
+returnCertificateInvalidError{
+Cert: ,
+Reason: Expired,
+Detail: fmt.Sprintf("current time %s is after %s", .Format(time.RFC3339), .NotAfter.Format(time.RFC3339)),
+ }
+ }
+
+if == intermediateCertificate || == rootCertificate {
+iflen() == 0 {
+returnerrors.New("x509: internal error: empty chain when appending CA cert")
+ }
+ }
+
+// KeyUsage status flags are ignored. From Engineering Security, Peter
+ // Gutmann: A European government CA marked its signing certificates as
+ // being valid for encryption only, but no-one noticed. Another
+ // European CA marked its signature keys as not being valid for
+ // signatures. A different CA marked its own trusted root certificate
+ // as being invalid for certificate signing. Another national CA
+ // distributed a certificate to be used to encrypt data for the
+ // country’s tax authority that was marked as only being usable for
+ // digital signatures but not for encryption. Yet another CA reversed
+ // the order of the bit flags in the keyUsage due to confusion over
+ // encoding endianness, essentially setting a random keyUsage in
+ // certificates that it issued. Another CA created a self-invalidating
+ // certificate by adding a certificate policy statement stipulating
+ // that the certificate had to be used strictly as specified in the
+ // keyUsage, and a keyUsage containing a flag indicating that the RSA
+ // encryption key could only be used for Diffie-Hellman key agreement.
+
+if == intermediateCertificate && (!.BasicConstraintsValid || !.IsCA) {
+returnCertificateInvalidError{, NotAuthorizedToSign, ""}
+ }
+
+if .BasicConstraintsValid && .MaxPathLen >= 0 {
+ := len() - 1
+if > .MaxPathLen {
+returnCertificateInvalidError{, TooManyIntermediates, ""}
+ }
+ }
+
+returnnil
+}
+
+// Verify attempts to verify c by building one or more chains from c to a
+// certificate in opts.Roots, using certificates in opts.Intermediates if
+// needed. If successful, it returns one or more chains where the first
+// element of the chain is c and the last element is from opts.Roots.
+//
+// If opts.Roots is nil, the platform verifier might be used, and
+// verification details might differ from what is described below. If system
+// roots are unavailable the returned error will be of type SystemRootsError.
+//
+// Name constraints in the intermediates will be applied to all names claimed
+// in the chain, not just opts.DNSName. Thus it is invalid for a leaf to claim
+// example.com if an intermediate doesn't permit it, even if example.com is not
+// the name being validated. Note that DirectoryName constraints are not
+// supported.
+//
+// Name constraint validation follows the rules from RFC 5280, with the
+// addition that DNS name constraints may use the leading period format
+// defined for emails and URIs. When a constraint has a leading period
+// it indicates that at least one additional label must be prepended to
+// the constrained name to be considered valid.
+//
+// Extended Key Usage values are enforced nested down a chain, so an intermediate
+// or root that enumerates EKUs prevents a leaf from asserting an EKU not in that
+// list. (While this is not specified, it is common practice in order to limit
+// the types of certificates a CA can issue.)
+//
+// Certificates that use SHA1WithRSA and ECDSAWithSHA1 signatures are not supported,
+// and will not be used to build chains.//
-// WARNING: this function doesn't do any revocation checking.
-func ( *Certificate) ( VerifyOptions) ([][]*Certificate, error) {
-// Platform-specific verification needs the ASN.1 contents so
- // this makes the behavior consistent across platforms.
-iflen(.Raw) == 0 {
-returnnil, errNotParsed
- }
-for := 0; < .Intermediates.len(); ++ {
- , , := .Intermediates.cert()
-if != nil {
-returnnil, fmt.Errorf("crypto/x509: error fetching intermediate: %w", )
- }
-iflen(.Raw) == 0 {
-returnnil, errNotParsed
- }
- }
-
-// Use platform verifiers, where available, if Roots is from SystemCertPool.
-ifruntime.GOOS == "windows" || runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
-// Don't use the system verifier if the system pool was replaced with a non-system pool,
- // i.e. if SetFallbackRoots was called with x509usefallbackroots=1.
- := systemRootsPool()
-if .Roots == nil && ( == nil || .systemPool) {
-return .systemVerify(&)
- }
-if .Roots != nil && .Roots.systemPool {
- , := .systemVerify(&)
-// If the platform verifier succeeded, or there are no additional
- // roots, return the platform verifier result. Otherwise, continue
- // with the Go verifier.
-if == nil || .Roots.len() == 0 {
-return ,
- }
- }
- }
-
-if .Roots == nil {
- .Roots = systemRootsPool()
-if .Roots == nil {
-returnnil, SystemRootsError{systemRootsErr}
- }
- }
-
- := .isValid(leafCertificate, nil, &)
-if != nil {
-returnnil,
- }
-
-iflen(.DNSName) > 0 {
- = .VerifyHostname(.DNSName)
-if != nil {
-returnnil,
- }
- }
-
-var [][]*Certificate
-if .Roots.contains() {
- = [][]*Certificate{{}}
- } else {
- , = .buildChains([]*Certificate{}, nil, &)
-if != nil {
-returnnil,
- }
- }
-
- := false
-for , := range .KeyUsages {
-if == ExtKeyUsageAny {
-// The presence of anyExtendedKeyUsage overrides any other key usage.
- = true
-break
- }
- }
-
-iflen(.KeyUsages) == 0 {
- .KeyUsages = []ExtKeyUsage{ExtKeyUsageServerAuth}
- }
-
-varint
-varint
-varerror
- = slices.DeleteFunc(, func( []*Certificate) bool {
-if !policiesValid(, ) {
- ++
-returntrue
- }
-// If any key usage is acceptable, no need to check the chain for
- // key usages.
-if ! && !checkChainForKeyUsage(, .KeyUsages) {
- ++
-returntrue
- }
-if := checkChainConstraints(); != nil {
-if == nil {
- = CertificateInvalidError{, CANotAuthorizedForThisName, .Error()}
- }
-returntrue
- }
-returnfalse
- })
-
-iflen() == 0 {
-if != nil {
-returnnil, // Preserve previous constraint behavior
- }
-var []string
-if > 0 {
-if == 0 {
-returnnil, CertificateInvalidError{, IncompatibleUsage, ""}
- }
- = append(, fmt.Sprintf("%d candidate chains with incompatible key usage", ))
- }
-if > 0 {
- = append(, fmt.Sprintf("%d candidate chains with invalid policies", ))
- }
- = CertificateInvalidError{, NoValidChains, strings.Join(, ", ")}
-returnnil,
- }
-
-return , nil
-}
-
-func ( []*Certificate, *Certificate) []*Certificate {
- := make([]*Certificate, len()+1)
-copy(, )
- [len()] =
-return
-}
-
-// alreadyInChain checks whether a candidate certificate is present in a chain.
-// Rather than doing a direct byte for byte equivalency check, we check if the
-// subject, public key, and SAN, if present, are equal. This prevents loops that
-// are created by mutual cross-signatures, or other cross-signature bridge
-// oddities.
-func ( *Certificate, []*Certificate) bool {
-typeinterface {
- (crypto.PublicKey) bool
- }
-
-var *pkix.Extension
-for , := range .Extensions {
-if .Id.Equal(oidExtensionSubjectAltName) {
- = &
-break
- }
- }
-
-for , := range {
-if !bytes.Equal(.RawSubject, .RawSubject) {
-continue
- }
-// We enforce the canonical encoding of SPKI (by only allowing the
- // correct AI paremeter encodings in parseCertificate), so it's safe to
- // directly compare the raw bytes.
-if !bytes.Equal(.RawSubjectPublicKeyInfo, .RawSubjectPublicKeyInfo) {
-continue
- }
-var *pkix.Extension
-for , := range .Extensions {
-if .Id.Equal(oidExtensionSubjectAltName) {
- = &
-break
- }
- }
-if == nil && == nil {
-returntrue
- } elseif == nil || == nil {
-returnfalse
+// Certificates other than c in the returned chains should not be modified.
+//
+// WARNING: this function doesn't do any revocation checking.
+func ( *Certificate) ( VerifyOptions) ([][]*Certificate, error) {
+// Platform-specific verification needs the ASN.1 contents so
+ // this makes the behavior consistent across platforms.
+iflen(.Raw) == 0 {
+returnnil, errNotParsed
+ }
+for := 0; < .Intermediates.len(); ++ {
+ , , := .Intermediates.cert()
+if != nil {
+returnnil, fmt.Errorf("crypto/x509: error fetching intermediate: %w", )
+ }
+iflen(.Raw) == 0 {
+returnnil, errNotParsed
+ }
+ }
+
+// Use platform verifiers, where available, if Roots is from SystemCertPool.
+ifruntime.GOOS == "windows" || runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
+// Don't use the system verifier if the system pool was replaced with a non-system pool,
+ // i.e. if SetFallbackRoots was called with x509usefallbackroots=1.
+ := systemRootsPool()
+if .Roots == nil && ( == nil || .systemPool) {
+return .systemVerify(&)
+ }
+if .Roots != nil && .Roots.systemPool {
+ , := .systemVerify(&)
+// If the platform verifier succeeded, or there are no additional
+ // roots, return the platform verifier result. Otherwise, continue
+ // with the Go verifier.
+if == nil || .Roots.len() == 0 {
+return ,
+ }
+ }
+ }
+
+if .Roots == nil {
+ .Roots = systemRootsPool()
+if .Roots == nil {
+returnnil, SystemRootsError{systemRootsErr}
+ }
+ }
+
+ := .isValid(leafCertificate, nil, &)
+if != nil {
+returnnil,
+ }
+
+iflen(.DNSName) > 0 {
+ = .VerifyHostname(.DNSName)
+if != nil {
+returnnil,
+ }
+ }
+
+var [][]*Certificate
+if .Roots.contains() {
+ = [][]*Certificate{{}}
+ } else {
+ , = .buildChains([]*Certificate{}, nil, &)
+if != nil {
+returnnil,
+ }
+ }
+
+ := false
+for , := range .KeyUsages {
+if == ExtKeyUsageAny {
+// The presence of anyExtendedKeyUsage overrides any other key usage.
+ = true
+break
+ }
+ }
+
+iflen(.KeyUsages) == 0 {
+ .KeyUsages = []ExtKeyUsage{ExtKeyUsageServerAuth}
+ }
+
+varint
+varint
+varerror
+ = slices.DeleteFunc(, func( []*Certificate) bool {
+if !policiesValid(, ) {
+ ++
+returntrue
+ }
+// If any key usage is acceptable, no need to check the chain for
+ // key usages.
+if ! && !checkChainForKeyUsage(, .KeyUsages) {
+ ++
+returntrue
+ }
+if := checkChainConstraints(); != nil {
+if == nil {
+ = CertificateInvalidError{, CANotAuthorizedForThisName, .Error()}
+ }
+returntrue
+ }
+ifcontainsDistrustedSPKIHash() {
+returntrue
+ }
+returnfalse
+ })
+
+iflen() == 0 {
+if != nil {
+returnnil, // Preserve previous constraint behavior
+ }
+var []string
+if > 0 {
+if == 0 {
+returnnil, CertificateInvalidError{, IncompatibleUsage, ""}
+ }
+ = append(, fmt.Sprintf("%d candidate chains with incompatible key usage", ))
+ }
+if > 0 {
+ = append(, fmt.Sprintf("%d candidate chains with invalid policies", ))
+ }
+ = CertificateInvalidError{, NoValidChains, strings.Join(, ", ")}
+returnnil,
+ }
+
+return , nil
+}
+
+func ( []*Certificate, *Certificate) []*Certificate {
+ := make([]*Certificate, len()+1)
+copy(, )
+ [len()] =
+return
+}
+
+// alreadyInChain checks whether a candidate certificate is present in a chain.
+// Rather than doing a direct byte for byte equivalency check, we check if the
+// subject, public key, and SAN, if present, are equal. This prevents loops that
+// are created by mutual cross-signatures, or other cross-signature bridge
+// oddities.
+func ( *Certificate, []*Certificate) bool {
+typeinterface {
+ (crypto.PublicKey) bool
+ }
+
+var *pkix.Extension
+for , := range .Extensions {
+if .Id.Equal(oidExtensionSubjectAltName) {
+ = &
+break
+ }
+ }
+
+for , := range {
+if !bytes.Equal(.RawSubject, .RawSubject) {
+continue
+ }
+// We enforce the canonical encoding of SPKI (by only allowing the
+ // correct AI paremeter encodings in parseCertificate), so it's safe to
+ // directly compare the raw bytes.
+if !bytes.Equal(.RawSubjectPublicKeyInfo, .RawSubjectPublicKeyInfo) {
+continue
+ }
+var *pkix.Extension
+for , := range .Extensions {
+if .Id.Equal(oidExtensionSubjectAltName) {
+ = &
+break
+ } }
-ifbytes.Equal(.Value, .Value) {
+if == nil && == nil {returntrue
- }
- }
-returnfalse
-}
-
-// maxChainSignatureChecks is the maximum number of CheckSignatureFrom calls
-// that an invocation of buildChains will (transitively) make. Most chains are
-// less than 15 certificates long, so this leaves space for multiple chains and
-// for failed checks due to different intermediates having the same Subject.
-constmaxChainSignatureChecks = 100
-
-varerrSignatureLimit = errors.New("x509: signature check attempts limit reached while verifying certificate chain")
-
-func ( *Certificate) ( []*Certificate, *int, *VerifyOptions) ( [][]*Certificate, error) {
-var (
-error
- *Certificate
- )
-
- := func( int, potentialParent) {
-if == nil {
- = new(int)
- }
- *++
-if * > maxChainSignatureChecks {
- = errSignatureLimit
-return
+ } elseif == nil || == nil {
+returnfalse
+ }
+ifbytes.Equal(.Value, .Value) {
+returntrue
+ }
+ }
+returnfalse
+}
+
+// maxChainSignatureChecks is the maximum number of CheckSignatureFrom calls
+// that an invocation of buildChains will (transitively) make. Most chains are
+// less than 15 certificates long, so this leaves space for multiple chains and
+// for failed checks due to different intermediates having the same Subject.
+constmaxChainSignatureChecks = 100
+
+varerrSignatureLimit = errors.New("x509: signature check attempts limit reached while verifying certificate chain")
+
+func ( *Certificate) ( []*Certificate, *int, *VerifyOptions) ( [][]*Certificate, error) {
+var (
+error
+ *Certificate
+ )
+
+ := func( int, potentialParent) {
+if == nil {
+ = new(int) }
-
-if .cert.PublicKey == nil || alreadyInChain(.cert, ) {
-return
- }
-
-if := .CheckSignatureFrom(.cert); != nil {
-if == nil {
- =
- = .cert
- }
-return
- }
-
- = .cert.isValid(, , )
-if != nil {
-if == nil {
- =
- = .cert
- }
-return
- }
-
-if .constraint != nil {
-if := .constraint(); != nil {
-if == nil {
- =
- = .cert
- }
-return
- }
- }
-
-switch {
-caserootCertificate:
- = append(, appendToFreshChain(, .cert))
-caseintermediateCertificate:
-var [][]*Certificate
- , = .cert.(appendToFreshChain(, .cert), , )
- = append(, ...)
- }
- }
-
-:
-for , := range []struct {
-int
- []potentialParent
- }{
- {rootCertificate, .Roots.findPotentialParents()},
- {intermediateCertificate, .Intermediates.findPotentialParents()},
- } {
-for , := range . {
- (., )
-if == errSignatureLimit {
-break
- }
- }
- }
-
-iflen() > 0 {
- = nil
- }
-iflen() == 0 && == nil {
- = UnknownAuthorityError{, , }
- }
-
-return
-}
-
-func ( string) bool { returnvalidHostname(, true) }
-func ( string) bool { returnvalidHostname(, false) }
-
-// validHostname reports whether host is a valid hostname that can be matched or
-// matched against according to RFC 6125 2.2, with some leniency to accommodate
-// legacy values.
-func ( string, bool) bool {
-if ! {
- = strings.TrimSuffix(, ".")
- }
-iflen() == 0 {
-returnfalse
- }
-if == "*" {
-// Bare wildcards are not allowed, they are not valid DNS names,
- // nor are they allowed per RFC 6125.
+ *++
+if * > maxChainSignatureChecks {
+ = errSignatureLimit
+return
+ }
+
+if .cert.PublicKey == nil || alreadyInChain(.cert, ) {
+return
+ }
+
+if := .CheckSignatureFrom(.cert); != nil {
+if == nil {
+ =
+ = .cert
+ }
+return
+ }
+
+ = .cert.isValid(, , )
+if != nil {
+if == nil {
+ =
+ = .cert
+ }
+return
+ }
+
+if .constraint != nil {
+if := .constraint(); != nil {
+if == nil {
+ =
+ = .cert
+ }
+return
+ }
+ }
+
+switch {
+caserootCertificate:
+ = append(, appendToFreshChain(, .cert))
+caseintermediateCertificate:
+var [][]*Certificate
+ , = .cert.(appendToFreshChain(, .cert), , )
+ = append(, ...)
+ }
+ }
+
+:
+for , := range []struct {
+int
+ []potentialParent
+ }{
+ {rootCertificate, .Roots.findPotentialParents()},
+ {intermediateCertificate, .Intermediates.findPotentialParents()},
+ } {
+for , := range . {
+ (., )
+if == errSignatureLimit {
+break
+ }
+ }
+ }
+
+iflen() > 0 {
+ = nil
+ }
+iflen() == 0 && == nil {
+ = UnknownAuthorityError{, , }
+ }
+
+return
+}
+
+func ( string) bool { returnvalidHostname(, true) }
+func ( string) bool { returnvalidHostname(, false) }
+
+// validHostname reports whether host is a valid hostname that can be matched or
+// matched against according to RFC 6125 2.2, with some leniency to accommodate
+// legacy values.
+func ( string, bool) bool {
+if ! {
+ = strings.TrimSuffix(, ".")
+ }
+iflen() == 0 {returnfalse }
-
-for , := rangestrings.Split(, ".") {
-if == "" {
-// Empty label.
-returnfalse
- }
-if && == 0 && == "*" {
-// Only allow full left-most wildcards, as those are the only ones
- // we match, and matching literal '*' characters is probably never
- // the expected behavior.
-continue
- }
-for , := range {
-if'a' <= && <= 'z' {
-continue
- }
-if'0' <= && <= '9' {
-continue
- }
-if'A' <= && <= 'Z' {
-continue
- }
-if == '-' && != 0 {
-continue
- }
-if == '_' {
-// Not a valid character in hostnames, but commonly
- // found in deployments outside the WebPKI.
+if == "*" {
+// Bare wildcards are not allowed, they are not valid DNS names,
+ // nor are they allowed per RFC 6125.
+returnfalse
+ }
+
+for , := rangestrings.Split(, ".") {
+if == "" {
+// Empty label.
+returnfalse
+ }
+if && == 0 && == "*" {
+// Only allow full left-most wildcards, as those are the only ones
+ // we match, and matching literal '*' characters is probably never
+ // the expected behavior.
+continue
+ }
+for , := range {
+if'a' <= && <= 'z' {
+continue
+ }
+if'0' <= && <= '9' {
+continue
+ }
+if'A' <= && <= 'Z' {
+continue
+ }
+if == '-' && != 0 {continue }
-returnfalse
- }
- }
-
-returntrue
-}
-
-func (, string) bool {
-if == "" || == "." || == "" || == "." {
-returnfalse
- }
-returntoLowerCaseASCII() == toLowerCaseASCII()
-}
-
-func ( string, []string) bool {
- = toLowerCaseASCII()
-
-iflen() == 0 || len() == 0 {
-returnfalse
- }
-
- := strings.Split(, ".")
-
-iflen() != len() {
-returnfalse
- }
-
-for , := range {
-if == 0 && == "*" {
-continue
- }
-if != [] {
-returnfalse
- }
- }
-
-returntrue
-}
-
-// toLowerCaseASCII returns a lower-case version of in. See RFC 6125 6.4.1. We use
-// an explicitly ASCII function to avoid any sharp corners resulting from
-// performing Unicode operations on DNS labels.
-func ( string) string {
-// If the string is already lower-case then there's nothing to do.
- := true
-for , := range {
-if == utf8.RuneError {
-// If we get a UTF-8 error then there might be
- // upper-case ASCII bytes in the invalid sequence.
- = false
-break
- }
-if'A' <= && <= 'Z' {
- = false
-break
- }
- }
-
-if {
-return
- }
-
- := []byte()
-for , := range {
-if'A' <= && <= 'Z' {
- [] += 'a' - 'A'
- }
- }
-returnstring()
-}
-
-// VerifyHostname returns nil if c is a valid certificate for the named host.
-// Otherwise it returns an error describing the mismatch.
-//
-// IP addresses can be optionally enclosed in square brackets and are checked
-// against the IPAddresses field. Other names are checked case insensitively
-// against the DNSNames field. If the names are valid hostnames, the certificate
-// fields can have a wildcard as the complete left-most label (e.g. *.example.com).
+if == '_' {
+// Not a valid character in hostnames, but commonly
+ // found in deployments outside the WebPKI.
+continue
+ }
+returnfalse
+ }
+ }
+
+returntrue
+}
+
+func (, string) bool {
+if == "" || == "." || == "" || == "." {
+returnfalse
+ }
+returntoLowerCaseASCII() == toLowerCaseASCII()
+}
+
+func ( string, []string) bool {
+ = toLowerCaseASCII()
+
+iflen() == 0 || len() == 0 {
+returnfalse
+ }
+
+ := strings.Split(, ".")
+
+iflen() != len() {
+returnfalse
+ }
+
+for , := range {
+if == 0 && == "*" {
+continue
+ }
+if != [] {
+returnfalse
+ }
+ }
+
+returntrue
+}
+
+// toLowerCaseASCII returns a lower-case version of in. See RFC 6125 6.4.1. We use
+// an explicitly ASCII function to avoid any sharp corners resulting from
+// performing Unicode operations on DNS labels.
+func ( string) string {
+// If the string is already lower-case then there's nothing to do.
+ := true
+for , := range {
+if == utf8.RuneError {
+// If we get a UTF-8 error then there might be
+ // upper-case ASCII bytes in the invalid sequence.
+ = false
+break
+ }
+if'A' <= && <= 'Z' {
+ = false
+break
+ }
+ }
+
+if {
+return
+ }
+
+ := []byte()
+for , := range {
+if'A' <= && <= 'Z' {
+ [] += 'a' - 'A'
+ }
+ }
+returnstring()
+}
+
+// VerifyHostname returns nil if c is a valid certificate for the named host.
+// Otherwise it returns an error describing the mismatch.//
-// Note that the legacy Common Name field is ignored.
-func ( *Certificate) ( string) error {
-// IP addresses may be written in [ ].
- :=
-iflen() >= 3 && [0] == '[' && [len()-1] == ']' {
- = [1 : len()-1]
- }
-if := net.ParseIP(); != nil {
-// We only match IP addresses against IP SANs.
- // See RFC 6125, Appendix B.2.
-for , := range .IPAddresses {
-if .Equal() {
-returnnil
- }
- }
-returnHostnameError{, }
- }
-
- := toLowerCaseASCII() // Save allocations inside the loop.
- := validHostnameInput()
- := splitHostname()
-
-for , := range .DNSNames {
-// Ideally, we'd only match valid hostnames according to RFC 6125 like
- // browsers (more or less) do, but in practice Go is used in a wider
- // array of contexts and can't even assume DNS resolution. Instead,
- // always allow perfect matches, and only apply wildcard and trailing
- // dot processing to valid hostnames.
-if && validHostnamePattern() {
-ifmatchHostnames(, ) {
-returnnil
- }
- } else {
-ifmatchExactly(, ) {
-returnnil
- }
- }
- }
-
-returnHostnameError{, }
-}
-
-func ( string) []string {
-returnstrings.Split(toLowerCaseASCII(strings.TrimSuffix(, ".")), ".")
-}
-
-func ( []*Certificate, []ExtKeyUsage) bool {
- := make([]ExtKeyUsage, len())
-copy(, )
-
-iflen() == 0 {
-returnfalse
- }
-
- := len()
-
-// We walk down the list and cross out any usages that aren't supported
- // by each certificate. If we cross out all the usages, then the chain
- // is unacceptable.
-
-:
-for := len() - 1; >= 0; -- {
- := []
-iflen(.ExtKeyUsage) == 0 && len(.UnknownExtKeyUsage) == 0 {
-// The certificate doesn't have any extended key usage specified.
-continue
- }
-
-for , := range .ExtKeyUsage {
-if == ExtKeyUsageAny {
-// The certificate is explicitly good for any usage.
-continue
- }
- }
-
-const = -1
-
- :
-for , := range {
-if == {
-continue
- }
-
-for , := range .ExtKeyUsage {
-if == {
-continue
- }
- }
-
- [] =
- --
-if == 0 {
-returnfalse
- }
- }
- }
-
-returntrue
-}
-
-func ( []uint64) OID {
- , := OIDFromInts()
-if != nil {
-panic(fmt.Sprintf("OIDFromInts(%v) unexpected error: %v", , ))
- }
-return
-}
-
-typepolicyGraphNodestruct {
-validPolicyOID
-expectedPolicySet []OID
-// we do not implement qualifiers, so we don't track qualifier_set
+// IP addresses can be optionally enclosed in square brackets and are checked
+// against the IPAddresses field. Other names are checked case insensitively
+// against the DNSNames field. If the names are valid hostnames, the certificate
+// fields can have a wildcard as the complete left-most label (e.g. *.example.com).
+//
+// Note that the legacy Common Name field is ignored.
+func ( *Certificate) ( string) error {
+// IP addresses may be written in [ ].
+ :=
+iflen() >= 3 && [0] == '[' && [len()-1] == ']' {
+ = [1 : len()-1]
+ }
+if := net.ParseIP(); != nil {
+// We only match IP addresses against IP SANs.
+ // See RFC 6125, Appendix B.2.
+for , := range .IPAddresses {
+if .Equal() {
+returnnil
+ }
+ }
+returnHostnameError{, }
+ }
+
+ := toLowerCaseASCII() // Save allocations inside the loop.
+ := validHostnameInput()
+ := splitHostname()
+
+for , := range .DNSNames {
+// Ideally, we'd only match valid hostnames according to RFC 6125 like
+ // browsers (more or less) do, but in practice Go is used in a wider
+ // array of contexts and can't even assume DNS resolution. Instead,
+ // always allow perfect matches, and only apply wildcard and trailing
+ // dot processing to valid hostnames.
+if && validHostnamePattern() {
+ifmatchHostnames(, ) {
+returnnil
+ }
+ } else {
+ifmatchExactly(, ) {
+returnnil
+ }
+ }
+ }
+
+returnHostnameError{, }
+}
+
+func ( string) []string {
+returnstrings.Split(toLowerCaseASCII(strings.TrimSuffix(, ".")), ".")
+}
+
+func ( []*Certificate, []ExtKeyUsage) bool {
+ := make([]ExtKeyUsage, len())
+copy(, )
+
+iflen() == 0 {
+returnfalse
+ }
+
+ := len()
+
+// We walk down the list and cross out any usages that aren't supported
+ // by each certificate. If we cross out all the usages, then the chain
+ // is unacceptable.
+
+:
+for := len() - 1; >= 0; -- {
+ := []
+iflen(.ExtKeyUsage) == 0 && len(.UnknownExtKeyUsage) == 0 {
+// The certificate doesn't have any extended key usage specified.
+continue
+ }
+
+for , := range .ExtKeyUsage {
+if == ExtKeyUsageAny {
+// The certificate is explicitly good for any usage.
+continue
+ }
+ }
+
+const = -1
+
+ :
+for , := range {
+if == {
+continue
+ }
+
+for , := range .ExtKeyUsage {
+if == {
+continue
+ }
+ }
+
+ [] =
+ --
+if == 0 {
+returnfalse
+ }
+ }
+ }
+
+returntrue
+}
+
+func ( []uint64) OID {
+ , := OIDFromInts()
+if != nil {
+panic(fmt.Sprintf("OIDFromInts(%v) unexpected error: %v", , ))
+ }
+return
+}
-parentsmap[*policyGraphNode]bool
-childrenmap[*policyGraphNode]bool
-}
-
-func ( OID, []*policyGraphNode) *policyGraphNode {
- := &policyGraphNode{
-validPolicy: ,
-expectedPolicySet: []OID{},
-children: map[*policyGraphNode]bool{},
-parents: map[*policyGraphNode]bool{},
- }
-for , := range {
- .children[] = true
- .parents[] = true
- }
-return
-}
-
-typepolicyGraphstruct {
-strata []map[string]*policyGraphNode
-// map of OID -> nodes at strata[depth-1] with OID in their expectedPolicySet
-parentIndexmap[string][]*policyGraphNode
-depthint
-}
-
-varanyPolicyOID = mustNewOIDFromInts([]uint64{2, 5, 29, 32, 0})
-
-func () *policyGraph {
- := policyGraphNode{
-validPolicy: anyPolicyOID,
-expectedPolicySet: []OID{anyPolicyOID},
-children: map[*policyGraphNode]bool{},
-parents: map[*policyGraphNode]bool{},
- }
-return &policyGraph{
-depth: 0,
-strata: []map[string]*policyGraphNode{{string(anyPolicyOID.der): &}},
- }
-}
-
-func ( *policyGraph) ( *policyGraphNode) {
- .strata[.depth][string(.validPolicy.der)] =
-}
-
-func ( *policyGraph) ( OID) []*policyGraphNode {
-if .depth == 0 {
-returnnil
- }
-return .parentIndex[string(.der)]
-}
-
-func ( *policyGraph) () *policyGraphNode {
-if .depth == 0 {
-returnnil
- }
-return .strata[.depth-1][string(anyPolicyOID.der)]
-}
-
-func ( *policyGraph) () iter.Seq[*policyGraphNode] {
-if .depth == 0 {
-returnnil
- }
-returnmaps.Values(.strata[.depth-1])
-}
-
-func ( *policyGraph) () map[string]*policyGraphNode {
-return .strata[.depth]
-}
-
-func ( *policyGraph) ( OID) *policyGraphNode {
-return .strata[.depth][string(.der)]
-}
-
-func ( *policyGraph) ( OID) {
- := .strata[.depth][string(.der)]
-if == nil {
-return
- }
-for := range .parents {
-delete(.children, )
- }
-for := range .children {
-delete(.parents, )
- }
-delete(.strata[.depth], string(.der))
-}
-
-func ( *policyGraph) () []*policyGraphNode {
-var []*policyGraphNode
-for := .depth; >= 0; -- {
-for , := range .strata[] {
-if .validPolicy.Equal(anyPolicyOID) {
-continue
- }
-
-iflen(.parents) == 1 {
-for := range .parents {
-if .validPolicy.Equal(anyPolicyOID) {
- = append(, )
- }
- }
- }
- }
- }
-return
-}
-
-func ( *policyGraph) () {
-for := .depth - 1; > 0; -- {
-for , := range .strata[] {
-iflen(.children) == 0 {
-for := range .parents {
-delete(.children, )
- }
-delete(.strata[], string(.validPolicy.der))
- }
- }
- }
-}
-
-func ( *policyGraph) () {
- .parentIndex = map[string][]*policyGraphNode{}
-for , := range .strata[.depth] {
-for , := range .expectedPolicySet {
- .parentIndex[string(.der)] = append(.parentIndex[string(.der)], )
- }
- }
-
- .depth++
- .strata = append(.strata, map[string]*policyGraphNode{})
-}
-
-func ( []*Certificate, VerifyOptions) bool {
-// The following code implements the policy verification algorithm as
- // specified in RFC 5280 and updated by RFC 9618. In particular the
- // following sections are replaced by RFC 9618:
- // * 6.1.2 (a)
- // * 6.1.3 (d)
- // * 6.1.3 (e)
- // * 6.1.3 (f)
- // * 6.1.4 (b)
- // * 6.1.5 (g)
-
-iflen() == 1 {
-returntrue
- }
-
-// n is the length of the chain minus the trust anchor
- := len() - 1
-
- := newPolicyGraph()
-var , , int
-if !.inhibitAnyPolicy {
- = + 1
- }
-if !.requireExplicitPolicy {
- = + 1
- }
-if !.inhibitPolicyMapping {
- = + 1
- }
-
- := map[string]bool{}
-for , := range .CertificatePolicies {
- [string(.der)] = true
+typepolicyGraphNodestruct {
+validPolicyOID
+expectedPolicySet []OID
+// we do not implement qualifiers, so we don't track qualifier_set
+
+parentsmap[*policyGraphNode]bool
+childrenmap[*policyGraphNode]bool
+}
+
+func ( OID, []*policyGraphNode) *policyGraphNode {
+ := &policyGraphNode{
+validPolicy: ,
+expectedPolicySet: []OID{},
+children: map[*policyGraphNode]bool{},
+parents: map[*policyGraphNode]bool{},
+ }
+for , := range {
+ .children[] = true
+ .parents[] = true
+ }
+return
+}
+
+typepolicyGraphstruct {
+strata []map[string]*policyGraphNode
+// map of OID -> nodes at strata[depth-1] with OID in their expectedPolicySet
+parentIndexmap[string][]*policyGraphNode
+depthint
+}
+
+varanyPolicyOID = mustNewOIDFromInts([]uint64{2, 5, 29, 32, 0})
+
+func () *policyGraph {
+ := policyGraphNode{
+validPolicy: anyPolicyOID,
+expectedPolicySet: []OID{anyPolicyOID},
+children: map[*policyGraphNode]bool{},
+parents: map[*policyGraphNode]bool{},
+ }
+return &policyGraph{
+depth: 0,
+strata: []map[string]*policyGraphNode{{string(anyPolicyOID.der): &}},
+ }
+}
+
+func ( *policyGraph) ( *policyGraphNode) {
+ .strata[.depth][string(.validPolicy.der)] =
+}
+
+func ( *policyGraph) ( OID) []*policyGraphNode {
+if .depth == 0 {
+returnnil
+ }
+return .parentIndex[string(.der)]
+}
+
+func ( *policyGraph) () *policyGraphNode {
+if .depth == 0 {
+returnnil
+ }
+return .strata[.depth-1][string(anyPolicyOID.der)]
+}
+
+func ( *policyGraph) () iter.Seq[*policyGraphNode] {
+if .depth == 0 {
+returnnil
+ }
+returnmaps.Values(.strata[.depth-1])
+}
+
+func ( *policyGraph) () map[string]*policyGraphNode {
+return .strata[.depth]
+}
+
+func ( *policyGraph) ( OID) *policyGraphNode {
+return .strata[.depth][string(.der)]
+}
+
+func ( *policyGraph) ( OID) {
+ := .strata[.depth][string(.der)]
+if == nil {
+return
+ }
+for := range .parents {
+delete(.children, )
+ }
+for := range .children {
+delete(.parents, )
+ }
+delete(.strata[.depth], string(.der))
+}
+
+func ( *policyGraph) () []*policyGraphNode {
+var []*policyGraphNode
+for := .depth; >= 0; -- {
+for , := range .strata[] {
+if .validPolicy.Equal(anyPolicyOID) {
+continue
+ }
+
+iflen(.parents) == 1 {
+for := range .parents {
+if .validPolicy.Equal(anyPolicyOID) {
+ = append(, )
+ }
+ }
+ }
+ }
+ }
+return
+}
+
+func ( *policyGraph) () {
+for := .depth - 1; > 0; -- {
+for , := range .strata[] {
+iflen(.children) == 0 {
+for := range .parents {
+delete(.children, )
+ }
+delete(.strata[], string(.validPolicy.der))
+ }
+ }
+ }
+}
+
+func ( *policyGraph) () {
+ .parentIndex = map[string][]*policyGraphNode{}
+for , := range .strata[.depth] {
+for , := range .expectedPolicySet {
+ .parentIndex[string(.der)] = append(.parentIndex[string(.der)], )
+ }
+ }
+
+ .depth++
+ .strata = append(.strata, map[string]*policyGraphNode{})
+}
+
+func ( []*Certificate, VerifyOptions) bool {
+// The following code implements the policy verification algorithm as
+ // specified in RFC 5280 and updated by RFC 9618. In particular the
+ // following sections are replaced by RFC 9618:
+ // * 6.1.2 (a)
+ // * 6.1.3 (d)
+ // * 6.1.3 (e)
+ // * 6.1.3 (f)
+ // * 6.1.4 (b)
+ // * 6.1.5 (g)
+
+iflen() == 1 {
+returntrue
+ }
+
+// n is the length of the chain minus the trust anchor
+ := len() - 1
+
+ := newPolicyGraph()
+var , , int
+if !.inhibitAnyPolicy {
+ = + 1
+ }
+if !.requireExplicitPolicy {
+ = + 1
+ }
+if !.inhibitPolicyMapping {
+ = + 1 }
-// If the user does not pass any policies, we consider
- // that equivalent to passing anyPolicyOID.
-iflen() == 0 {
- [string(anyPolicyOID.der)] = true
+
+ := map[string]bool{}
+for , := range .CertificatePolicies {
+ [string(.der)] = true }
-
-for := - 1; >= 0; -- {
- := []
-
- := bytes.Equal(.RawIssuer, .RawSubject)
+// If the user does not pass any policies, we consider
+ // that equivalent to passing anyPolicyOID.
+iflen() == 0 {
+ [string(anyPolicyOID.der)] = true
+ }
-// 6.1.3 (e) -- as updated by RFC 9618
-iflen(.Policies) == 0 {
- = nil
- }
+for := - 1; >= 0; -- {
+ := []
+
+ := bytes.Equal(.RawIssuer, .RawSubject)
-// 6.1.3 (f) -- as updated by RFC 9618
-if == 0 && == nil {
-returnfalse
+// 6.1.3 (e) -- as updated by RFC 9618
+iflen(.Policies) == 0 {
+ = nil }
-if != nil {
- .incrDepth()
-
- := map[string]bool{}
+// 6.1.3 (f) -- as updated by RFC 9618
+if == 0 && == nil {
+returnfalse
+ }
-// 6.1.3 (d) (1) -- as updated by RFC 9618
-for , := range .Policies {
- [string(.der)] = true
-
-if .Equal(anyPolicyOID) {
-continue
- }
-
-// 6.1.3 (d) (1) (i) -- as updated by RFC 9618
- := .parentsWithExpected()
-iflen() == 0 {
-// 6.1.3 (d) (1) (ii) -- as updated by RFC 9618
-if := .parentWithAnyPolicy(); != nil {
- = []*policyGraphNode{}
- }
- }
-iflen() > 0 {
- .insert(newPolicyGraphNode(, ))
- }
- }
-
-// 6.1.3 (d) (2) -- as updated by RFC 9618
- // NOTE: in the check "n-i < n" our i is different from the i in the specification.
- // In the specification chains go from the trust anchor to the leaf, whereas our
- // chains go from the leaf to the trust anchor, so our i's our inverted. Our
- // check here matches the check "i < n" in the specification.
-if [string(anyPolicyOID.der)] && ( > 0 || (- < && )) {
- := map[string][]*policyGraphNode{}
- := .leaves()
-for := range .parents() {
-for , := range .expectedPolicySet {
-if [string(.der)] == nil {
- [string(.der)] = append([string(.der)], )
- }
- }
- }
-
-for , := range {
- .insert(newPolicyGraphNode(OID{der: []byte()}, ))
- }
- }
+if != nil {
+ .incrDepth()
+
+ := map[string]bool{}
+
+// 6.1.3 (d) (1) -- as updated by RFC 9618
+for , := range .Policies {
+ [string(.der)] = true
+
+if .Equal(anyPolicyOID) {
+continue
+ }
+
+// 6.1.3 (d) (1) (i) -- as updated by RFC 9618
+ := .parentsWithExpected()
+iflen() == 0 {
+// 6.1.3 (d) (1) (ii) -- as updated by RFC 9618
+if := .parentWithAnyPolicy(); != nil {
+ = []*policyGraphNode{}
+ }
+ }
+iflen() > 0 {
+ .insert(newPolicyGraphNode(, ))
+ }
+ }
+
+// 6.1.3 (d) (2) -- as updated by RFC 9618
+ // NOTE: in the check "n-i < n" our i is different from the i in the specification.
+ // In the specification chains go from the trust anchor to the leaf, whereas our
+ // chains go from the leaf to the trust anchor, so our i's our inverted. Our
+ // check here matches the check "i < n" in the specification.
+if [string(anyPolicyOID.der)] && ( > 0 || (- < && )) {
+ := map[string][]*policyGraphNode{}
+ := .leaves()
+for := range .parents() {
+for , := range .expectedPolicySet {
+if [string(.der)] == nil {
+ [string(.der)] = append([string(.der)], )
+ }
+ }
+ }
-// 6.1.3 (d) (3) -- as updated by RFC 9618
- .prune()
-
-if != 0 {
-// 6.1.4 (b) -- as updated by RFC 9618
-iflen(.PolicyMappings) > 0 {
-// collect map of issuer -> []subject
- := map[string][]OID{}
-
-for , := range .PolicyMappings {
-if > 0 {
-if .IssuerDomainPolicy.Equal(anyPolicyOID) || .SubjectDomainPolicy.Equal(anyPolicyOID) {
-// Invalid mapping
-returnfalse
- }
- [string(.IssuerDomainPolicy.der)] = append([string(.IssuerDomainPolicy.der)], .SubjectDomainPolicy)
- } else {
-// 6.1.4 (b) (3) (i) -- as updated by RFC 9618
- .deleteLeaf(.IssuerDomainPolicy)
- }
- }
-
-// 6.1.4 (b) (3) (ii) -- as updated by RFC 9618
- .prune()
-
-for , := range {
-// 6.1.4 (b) (1) -- as updated by RFC 9618
-if := .leafWithPolicy(OID{der: []byte()}); != nil {
- .expectedPolicySet =
- } elseif := .leafWithPolicy(anyPolicyOID); != nil {
-// 6.1.4 (b) (2) -- as updated by RFC 9618
- := newPolicyGraphNode(OID{der: []byte()}, []*policyGraphNode{})
- .expectedPolicySet =
- .insert()
- }
- }
- }
- }
- }
-
-if != 0 {
-// 6.1.4 (h)
-if ! {
-if > 0 {
- --
- }
-if > 0 {
- --
- }
-if > 0 {
- --
- }
- }
-
-// 6.1.4 (i)
-if (.RequireExplicitPolicy > 0 || .RequireExplicitPolicyZero) && .RequireExplicitPolicy < {
- = .RequireExplicitPolicy
+for , := range {
+ .insert(newPolicyGraphNode(OID{der: []byte()}, ))
+ }
+ }
+
+// 6.1.3 (d) (3) -- as updated by RFC 9618
+ .prune()
+
+if != 0 {
+// 6.1.4 (b) -- as updated by RFC 9618
+iflen(.PolicyMappings) > 0 {
+// collect map of issuer -> []subject
+ := map[string][]OID{}
+
+for , := range .PolicyMappings {
+if > 0 {
+if .IssuerDomainPolicy.Equal(anyPolicyOID) || .SubjectDomainPolicy.Equal(anyPolicyOID) {
+// Invalid mapping
+returnfalse
+ }
+ [string(.IssuerDomainPolicy.der)] = append([string(.IssuerDomainPolicy.der)], .SubjectDomainPolicy)
+ } else {
+// 6.1.4 (b) (3) (i) -- as updated by RFC 9618
+ .deleteLeaf(.IssuerDomainPolicy)
+ }
+ }
+
+// 6.1.4 (b) (3) (ii) -- as updated by RFC 9618
+ .prune()
+
+for , := range {
+// 6.1.4 (b) (1) -- as updated by RFC 9618
+if := .leafWithPolicy(OID{der: []byte()}); != nil {
+ .expectedPolicySet =
+ } elseif := .leafWithPolicy(anyPolicyOID); != nil {
+// 6.1.4 (b) (2) -- as updated by RFC 9618
+ := newPolicyGraphNode(OID{der: []byte()}, []*policyGraphNode{})
+ .expectedPolicySet =
+ .insert()
+ }
+ }
+ }
+ }
+ }
+
+if != 0 {
+// 6.1.4 (h)
+if ! {
+if > 0 {
+ --
+ }
+if > 0 {
+ --
+ }
+if > 0 {
+ --
+ } }
-if (.InhibitPolicyMapping > 0 || .InhibitPolicyMappingZero) && .InhibitPolicyMapping < {
- = .InhibitPolicyMapping
- }
-// 6.1.4 (j)
-if (.InhibitAnyPolicy > 0 || .InhibitAnyPolicyZero) && .InhibitAnyPolicy < {
- = .InhibitAnyPolicy
- }
- }
- }
-
-// 6.1.5 (a)
-if > 0 {
- --
+
+// 6.1.4 (i)
+if (.RequireExplicitPolicy > 0 || .RequireExplicitPolicyZero) && .RequireExplicitPolicy < {
+ = .RequireExplicitPolicy
+ }
+if (.InhibitPolicyMapping > 0 || .InhibitPolicyMappingZero) && .InhibitPolicyMapping < {
+ = .InhibitPolicyMapping
+ }
+// 6.1.4 (j)
+if (.InhibitAnyPolicy > 0 || .InhibitAnyPolicyZero) && .InhibitAnyPolicy < {
+ = .InhibitAnyPolicy
+ }
+ } }
-// 6.1.5 (b)
-if [0].RequireExplicitPolicyZero {
- = 0
+// 6.1.5 (a)
+if > 0 {
+ -- }
-// 6.1.5 (g) (1) -- as updated by RFC 9618
-var []*policyGraphNode
-// 6.1.5 (g) (2) -- as updated by RFC 9618
-if != nil {
- = .validPolicyNodes()
-// 6.1.5 (g) (3) -- as updated by RFC 9618
-if := .leafWithPolicy(anyPolicyOID); != nil {
- = append(, )
- }
- }
-
-// 6.1.5 (g) (4) -- as updated by RFC 9618
- := map[string]bool{}
-for , := range {
- [string(.validPolicy.der)] = true
- }
-// 6.1.5 (g) (5) -- as updated by RFC 9618
- := maps.Clone()
-// 6.1.5 (g) (6) -- as updated by RFC 9618
-iflen() != 1 || ![string(anyPolicyOID.der)] {
-// 6.1.5 (g) (6) (i) -- as updated by RFC 9618
-for := range {
-if ![] {
-delete(, )
- }
- }
-// 6.1.5 (g) (6) (ii) -- as updated by RFC 9618
-if [string(anyPolicyOID.der)] {
-for := range {
- [] = true
- }
- }
- }
-
-if == 0 && len() == 0 {
-returnfalse
- }
-
-returntrue
-}
+// 6.1.5 (b)
+if [0].RequireExplicitPolicyZero {
+ = 0
+ }
+
+// 6.1.5 (g) (1) -- as updated by RFC 9618
+var []*policyGraphNode
+// 6.1.5 (g) (2) -- as updated by RFC 9618
+if != nil {
+ = .validPolicyNodes()
+// 6.1.5 (g) (3) -- as updated by RFC 9618
+if := .leafWithPolicy(anyPolicyOID); != nil {
+ = append(, )
+ }
+ }
+
+// 6.1.5 (g) (4) -- as updated by RFC 9618
+ := map[string]bool{}
+for , := range {
+ [string(.validPolicy.der)] = true
+ }
+// 6.1.5 (g) (5) -- as updated by RFC 9618
+ := maps.Clone()
+// 6.1.5 (g) (6) -- as updated by RFC 9618
+iflen() != 1 || ![string(anyPolicyOID.der)] {
+// 6.1.5 (g) (6) (i) -- as updated by RFC 9618
+for := range {
+if ![] {
+delete(, )
+ }
+ }
+// 6.1.5 (g) (6) (ii) -- as updated by RFC 9618
+if [string(anyPolicyOID.der)] {
+for := range {
+ [] = true
+ }
+ }
+ }
+
+if == 0 && len() == 0 {
+returnfalse
+ }
+
+returntrue
+}
+
+// distrustedSPKIHashes contains hashes of SPKIs from certificates which
+// we don't consider to be trustworthy. We use these hashes to filter out
+// chains returned by Verify
+vardistrustedSPKIHashes = map[string]struct{}{
+"ebed6475c2c2d80fcb199f3fe8dd6e6b3ce60b77eb15d4e42c3dec0c6f5b5105": {},
+"49dd353dc2b919a3770645117d0e60c16115e7d1bc259eefe734b00ea434fe5f": {},
+"e0254c7fcdc265e2f0f8a428dabb75ab4ae039b4872d62f5ee57f0877d5a8a41": {},
+"5c0660a2b164910d8ff589c18e14552e9e0ec237dcefe2cb736d41a4811f81a0": {},
+"43bffa19d6ef651451f6841e019931e96f6f2eaeff28ab4b6f1ce4576de2717b": {},
+"63ecefee431d49523bc1136c4e72d0206a477086caf606cd5cf025686c109cf8": {},
+"ec4ffa1ad0ac88081314b7aaffef6a91f97cd57291bb5ba686c5415f5eb4f6b6": {},
+"92c063d67e8f14db71d288e11266ffdaf69cbf115f7bab14f3bc2f68d25e0e30": {},
+}
+
+// containsDistrustedSPKIHash checks if any of the certificates in the chain
+// have an SPKI whose hash is present in the distrustedSPKIHashes map.
+func ( []*Certificate) bool {
+for , := range {
+ := sha256.Sum256(.RawSubjectPublicKeyInfo)
+if , := distrustedSPKIHashes[hex.EncodeToString([:])]; {
+returntrue
+ }
+ }
+returnfalse
+}
The pages are generated with Goldsv0.8.5. (GOOS=linux GOARCH=amd64)
diff --git a/src/github.com/refraction-networking/utls/common.go.html b/src/github.com/refraction-networking/utls/common.go.html
index 14baefc91ab..d59ae407dc8 100644
--- a/src/github.com/refraction-networking/utls/common.go.html
+++ b/src/github.com/refraction-networking/utls/common.go.html
@@ -1864,7 +1864,7 @@
if != nil {returnfmt.Errorf("failed to parse certificate: %w", ) }
-if := .VerifyHostname(.ServerName); != nil {
+if := .VerifyHostname(.ServerName); != nil {returnfmt.Errorf("certificate is not valid for requested server name: %w", ) } }
diff --git a/src/github.com/refraction-networking/utls/conn.go.html b/src/github.com/refraction-networking/utls/conn.go.html
index 0e68d365d57..80cce079b25 100644
--- a/src/github.com/refraction-networking/utls/conn.go.html
+++ b/src/github.com/refraction-networking/utls/conn.go.html
@@ -2383,7 +2383,7 @@
iflen(.verifiedChains) == 0 {returnerrors.New("tls: handshake did not verify certificate chain") }
-return .peerCertificates[0].VerifyHostname()
+return .peerCertificates[0].VerifyHostname()}
// Code generated by cmd/cgo; DO NOT EDIT.
-//line /opt/hostedtoolcache/go/1.26.9/x64/src/net/cgo_linux.go:1:1
+//line /opt/hostedtoolcache/go/1.26.10/x64/src/net/cgo_linux.go:1:1// Copyright 2011 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.
diff --git a/src/net/cgo_resnew.go.html b/src/net/cgo_resnew.go.html
index d46a350c827..8888d4aaade 100644
--- a/src/net/cgo_resnew.go.html
+++ b/src/net/cgo_resnew.go.html
@@ -38,7 +38,7 @@
// Code generated by cmd/cgo; DO NOT EDIT.
-//line /opt/hostedtoolcache/go/1.26.9/x64/src/net/cgo_resnew.go:1:1
+//line /opt/hostedtoolcache/go/1.26.10/x64/src/net/cgo_resnew.go:1:1// Copyright 2015 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.
diff --git a/src/net/cgo_socknew.go.html b/src/net/cgo_socknew.go.html
index fa1a0f5edc8..031dc40d3de 100644
--- a/src/net/cgo_socknew.go.html
+++ b/src/net/cgo_socknew.go.html
@@ -42,7 +42,7 @@
// Code generated by cmd/cgo; DO NOT EDIT.
-//line /opt/hostedtoolcache/go/1.26.9/x64/src/net/cgo_socknew.go:1:1
+//line /opt/hostedtoolcache/go/1.26.10/x64/src/net/cgo_socknew.go:1:1// Copyright 2015 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.
diff --git a/src/net/cgo_unix_cgo.go.html b/src/net/cgo_unix_cgo.go.html
index 43c832d36e7..59f902d7c53 100644
--- a/src/net/cgo_unix_cgo.go.html
+++ b/src/net/cgo_unix_cgo.go.html
@@ -92,7 +92,7 @@
// Code generated by cmd/cgo; DO NOT EDIT.
-//line /opt/hostedtoolcache/go/1.26.9/x64/src/net/cgo_unix_cgo.go:1:1
+//line /opt/hostedtoolcache/go/1.26.10/x64/src/net/cgo_unix_cgo.go:1:1// Copyright 2022 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.
diff --git a/src/net/cgo_unix_cgo_res.go.html b/src/net/cgo_unix_cgo_res.go.html
index 1d0813ab473..2df48f4157f 100644
--- a/src/net/cgo_unix_cgo_res.go.html
+++ b/src/net/cgo_unix_cgo_res.go.html
@@ -48,7 +48,7 @@
// Code generated by cmd/cgo; DO NOT EDIT.
-//line /opt/hostedtoolcache/go/1.26.9/x64/src/net/cgo_unix_cgo_res.go:1:1
+//line /opt/hostedtoolcache/go/1.26.10/x64/src/net/cgo_unix_cgo_res.go:1:1// Copyright 2022 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.
diff --git a/src/runtime/cgo/cgo.go.html b/src/runtime/cgo/cgo.go.html
index 3251ed5ef07..4eadf05565e 100644
--- a/src/runtime/cgo/cgo.go.html
+++ b/src/runtime/cgo/cgo.go.html
@@ -26,7 +26,7 @@
// Code generated by cmd/cgo; DO NOT EDIT.
-//line /opt/hostedtoolcache/go/1.26.9/x64/src/runtime/cgo/cgo.go:1:1
+//line /opt/hostedtoolcache/go/1.26.10/x64/src/runtime/cgo/cgo.go:1:1// Copyright 2010 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.
diff --git a/statistics.html b/statistics.html
index 0d52e9b985f..7017642640d 100644
--- a/statistics.html
+++ b/statistics.html
@@ -13,7 +13,7 @@
Packages
Total 306 packages, 196 of them are standard packages.
Total 4900 source files, 4810 of them are Go source files.
- Total 1596040 lines of Go code.
+ Total 1596071 lines of Go code.
Averagely,
- each Go source file imports 7.19 packages and contains 332 lines of code.
- each package depends 6.70 other packages and contains 15.72 source files.
@@ -60,15 +60,15 @@
12(5)
-
+13
-(12)
+(11)14(5)
-
+15
-(5)
+(6)16(1)
diff --git a/use/bytes..Contains.html b/use/bytes..Contains.html
index 27056b479af..2719f305e03 100644
--- a/use/bytes..Contains.html
+++ b/use/bytes..Contains.html
@@ -17,7 +17,7 @@
bytes.go#L77: func Contains(b, subslice []byte) bool {
crypto/x509
- verify.go#L378: bytes.Contains(localPartBytes, twoDots) {
+ verify.go#L380: bytes.Contains(localPartBytes, twoDots) {
The pages are generated with Goldsv0.8.5. (GOOS=linux GOARCH=amd64)
diff --git a/use/bytes..Equal.html b/use/bytes..Equal.html
index 83ce4bca5eb..dc30392faed 100644
--- a/use/bytes..Equal.html
+++ b/use/bytes..Equal.html
@@ -104,11 +104,11 @@
parser.go#L257: if !bytes.Equal(params.FullBytes, asn1.NullBytes) {
parser.go#L949: if !bytes.Equal(outerSigAISeq, sigAISeq) {
parser.go#L1156: if !bytes.Equal(outerSigAISeq, sigAISeq) {
- verify.go#L450: if !bytes.Equal(child.RawIssuer, c.RawSubject) {
- verify.go#L689: if !bytes.Equal(candidate.RawSubject, cert.RawSubject) {
- verify.go#L695: if !bytes.Equal(candidate.RawSubjectPublicKeyInfo, cert.RawSubjectPublicKeyInfo) {
- verify.go#L710: if bytes.Equal(candidateSAN.Value, certSAN.Value) {
- verify.go#L1223: isSelfSigned := bytes.Equal(cert.RawIssuer, cert.RawSubject)
+ verify.go#L452: if !bytes.Equal(child.RawIssuer, c.RawSubject) {
+ verify.go#L694: if !bytes.Equal(candidate.RawSubject, cert.RawSubject) {
+ verify.go#L700: if !bytes.Equal(candidate.RawSubjectPublicKeyInfo, cert.RawSubjectPublicKeyInfo) {
+ verify.go#L715: if bytes.Equal(candidateSAN.Value, certSAN.Value) {
+ verify.go#L1228: isSelfSigned := bytes.Equal(cert.RawIssuer, cert.RawSubject)
x509.go#L452: if (len(params.Hash.Parameters.FullBytes) != 0 && !bytes.Equal(params.Hash.Parameters.FullBytes, asn1.NullBytes)) ||
x509.go#L455: (len(mgf1HashFunc.Parameters.FullBytes) != 0 && !bytes.Equal(mgf1HashFunc.Parameters.FullBytes, asn1.NullBytes)) ||
x509.go#L917: return bytes.Equal(c.Raw, other.Raw)
diff --git a/use/crypto..PublicKey.html b/use/crypto..PublicKey.html
index 41ebd8c2137..8c5d8ba8974 100644
--- a/use/crypto..PublicKey.html
+++ b/use/crypto..PublicKey.html
@@ -42,7 +42,7 @@
handshake_server.go#L690: var pub crypto.PublicKey // public key for client auth, if any
crypto/x509
- verify.go#L677: Equal(crypto.PublicKey) bool
+ verify.go#L682: Equal(crypto.PublicKey) bool
x509.go#L980: func checkSignature(algo SignatureAlgorithm, signed, signature []byte, publicKey crypto.PublicKey, allowSHA1 bool) (err error) {
x509.go#L1769: Equal(crypto.PublicKey) bool
diff --git a/use/crypto/sha256..Sum256.html b/use/crypto/sha256..Sum256.html
index 9a91b0feb14..e0192e2c733 100644
--- a/use/crypto/sha256..Sum256.html
+++ b/use/crypto/sha256..Sum256.html
@@ -11,12 +11,13 @@
crypto/x509.CertificateInvalidError.Detail (field)9 uses
crypto/x509 (current package)
- verify.go#L69: Detail string
- verify.go#L77: return "x509: certificate has expired or is not yet valid: " + e.Detail
- verify.go#L79: return "x509: a root or intermediate certificate is not authorized to sign for this name: " + e.Detail
- verify.go#L81: return "x509: a root or intermediate certificate is not authorized for an extended key usage: " + e.Detail
- verify.go#L91: return "x509: issuer has name constraints but leaf contains unknown or unconstrained name: " + e.Detail
- verify.go#L94: if e.Detail != "" {
- verify.go#L95: s = fmt.Sprintf("%s: %s", s, e.Detail)
- verify.go#L463: Detail: fmt.Sprintf("current time %s is before %s", now.Format(time.RFC3339), c.NotBefore.Format(time.RFC3339)),
- verify.go#L469: Detail: fmt.Sprintf("current time %s is after %s", now.Format(time.RFC3339), c.NotAfter.Format(time.RFC3339)),
+ verify.go#L71: Detail string
+ verify.go#L79: return "x509: certificate has expired or is not yet valid: " + e.Detail
+ verify.go#L81: return "x509: a root or intermediate certificate is not authorized to sign for this name: " + e.Detail
+ verify.go#L83: return "x509: a root or intermediate certificate is not authorized for an extended key usage: " + e.Detail
+ verify.go#L93: return "x509: issuer has name constraints but leaf contains unknown or unconstrained name: " + e.Detail
+ verify.go#L96: if e.Detail != "" {
+ verify.go#L97: s = fmt.Sprintf("%s: %s", s, e.Detail)
+ verify.go#L465: Detail: fmt.Sprintf("current time %s is before %s", now.Format(time.RFC3339), c.NotBefore.Format(time.RFC3339)),
+ verify.go#L471: Detail: fmt.Sprintf("current time %s is after %s", now.Format(time.RFC3339), c.NotAfter.Format(time.RFC3339)),
The pages are generated with Goldsv0.8.5. (GOOS=linux GOARCH=amd64)
diff --git a/use/crypto/x509..CertificateInvalidError.Error.html b/use/crypto/x509..CertificateInvalidError.Error.html
index b5c5ee34860..8a3b3d35cb1 100644
--- a/use/crypto/x509..CertificateInvalidError.Error.html
+++ b/use/crypto/x509..CertificateInvalidError.Error.html
@@ -9,12 +9,12 @@
crypto/x509.HostnameError.Host (field)8 uses
crypto/x509 (current package)
- verify.go#L106: Host string
- verify.go#L113: if !c.hasSANExtension() && matchHostnames(c.Subject.CommonName, splitHostname(h.Host)) {
- verify.go#L118: if ip := net.ParseIP(h.Host); ip != nil {
- verify.go#L121: return "x509: cannot validate certificate for " + h.Host + " because it doesn't contain any IP SANs"
- verify.go#L124: return fmt.Sprintf("x509: certificate is valid for %d IP SANs, but none matched %s", len(c.IPAddresses), h.Host)
- verify.go#L134: return fmt.Sprintf("x509: certificate is valid for %d names, but none matched %s", len(c.DNSNames), h.Host)
- verify.go#L140: return "x509: certificate is not valid for any names, but wanted to match " + h.Host
- verify.go#L142: return "x509: certificate is valid for " + valid.String() + ", not " + h.Host
+ verify.go#L108: Host string
+ verify.go#L115: if !c.hasSANExtension() && matchHostnames(c.Subject.CommonName, splitHostname(h.Host)) {
+ verify.go#L120: if ip := net.ParseIP(h.Host); ip != nil {
+ verify.go#L123: return "x509: cannot validate certificate for " + h.Host + " because it doesn't contain any IP SANs"
+ verify.go#L126: return fmt.Sprintf("x509: certificate is valid for %d IP SANs, but none matched %s", len(c.IPAddresses), h.Host)
+ verify.go#L136: return fmt.Sprintf("x509: certificate is valid for %d names, but none matched %s", len(c.DNSNames), h.Host)
+ verify.go#L142: return "x509: certificate is not valid for any names, but wanted to match " + h.Host
+ verify.go#L144: return "x509: certificate is valid for " + valid.String() + ", not " + h.Host
The pages are generated with Goldsv0.8.5. (GOOS=linux GOARCH=amd64)
diff --git a/use/crypto/x509..HostnameError.html b/use/crypto/x509..HostnameError.html
index ed0b7e52088..af062a1ff1c 100644
--- a/use/crypto/x509..HostnameError.html
+++ b/use/crypto/x509..HostnameError.html
@@ -9,15 +9,15 @@