go/src/crypto
Roland Shoemaker 082cfabf12 crypto/x509: don't create certs with negative serials
Refuse to create certificates with negative serial numbers, as they
are explicitly disallowed by RFC 5280.

We still allow parsing certificates with negative serial numbers,
because in the past there were buggy CA implementations which would
produce them (although there are currently *no* trusted certificates
that have this issue). We may want to revisit this decision if we can
find metrics about the prevalence of this issue in enterprise settings.

Change-Id: I131262008db99b6354f542f335abc68775a2d6d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/400494
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-15 16:25:52 +00:00
..
aes crypto/aes: merge ppc64le crypt key expansion 2022-04-08 21:51:50 +00:00
cipher all: gofmt main repo 2022-04-11 16:34:30 +00:00
des crypto/des: fix typo in permuteInitialBlock function comments 2020-09-22 21:24:40 +00:00
dsa crypto/dsa,crypto/x509: deprecate DSA and remove crypto/x509 support 2020-10-02 10:48:33 +00:00
ecdsa all: separate doc comment from //go: directives 2022-04-05 17:54:15 +00:00
ed25519 all: gofmt main repo 2022-04-11 16:34:30 +00:00
elliptic all: gofmt main repo 2022-04-11 16:34:30 +00:00
hmac crypto/hmac: panic if reusing hash.Hash values 2020-10-19 15:00:02 +00:00
internal all: go fix -fix=buildtag std cmd (except for bootstrap deps, vendor) 2021-10-28 18:17:57 +00:00
md5 all: remove more leftover // +build lines 2021-11-06 10:24:44 +00:00
rand all: gofmt main repo 2022-04-11 16:34:30 +00:00
rc4
rsa all: gofmt main repo 2022-04-11 16:34:30 +00:00
sha1 all: go fix -fix=buildtag std cmd (except for bootstrap deps, vendor) 2021-10-28 18:17:57 +00:00
sha256 crypto/sha256: adapt ppc64le asm to work on ppc64 2022-03-03 14:41:35 +00:00
sha512 crypto/sha512: fix stack size for previous change 2022-03-04 19:04:50 +00:00
subtle crypto/subtle: note that input length mismatch makes ConstantTimeCompare return immediately 2022-04-05 01:54:27 +00:00
tls all: gofmt main repo 2022-04-11 16:34:30 +00:00
x509 crypto/x509: don't create certs with negative serials 2022-04-15 16:25:52 +00:00
crypto.go all: gofmt main repo 2022-04-11 16:34:30 +00:00
issue21104_test.go