aboutsummaryrefslogtreecommitdiff
path: root/src/internal/obscuretestdata
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2022-11-03 13:08:52 -0400
committerGopher Robot <gobot@golang.org>2022-11-09 14:47:58 +0000
commit9ff2a6677fd34084295172aff0848ab9a4f5b76e (patch)
treeca94dbdf82f59002f8e0099d2f6fbd348a89fd7b /src/internal/obscuretestdata
parent821e31042a47a9f65529c16f76b392428329c20b (diff)
downloadgo-9ff2a6677fd34084295172aff0848ab9a4f5b76e.tar.xz
crypto/x509: allow BoringCrypto to use 4096-bit keys
FIPS-140 has been updated to allow 4096-bit RSA keys. Allow them in certificate processing. Fixes #41147. Change-Id: I4c6bcb1b137a200dfe70cebc605ae57f49871184 Reviewed-on: https://go-review.googlesource.com/c/go/+/447655 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Roland Shoemaker <roland@golang.org>
Diffstat (limited to 'src/internal/obscuretestdata')
-rw-r--r--src/internal/obscuretestdata/obscuretestdata.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/internal/obscuretestdata/obscuretestdata.go b/src/internal/obscuretestdata/obscuretestdata.go
index 5ea2cdf5d1..d54d3f68c2 100644
--- a/src/internal/obscuretestdata/obscuretestdata.go
+++ b/src/internal/obscuretestdata/obscuretestdata.go
@@ -13,6 +13,21 @@ import (
"os"
)
+// Rot13 returns the rot13 encoding or decoding of its input.
+func Rot13(data []byte) []byte {
+ out := make([]byte, len(data))
+ copy(out, data)
+ for i, c := range out {
+ switch {
+ case 'A' <= c && c <= 'M' || 'a' <= c && c <= 'm':
+ out[i] = c + 13
+ case 'N' <= c && c <= 'Z' || 'n' <= c && c <= 'z':
+ out[i] = c - 13
+ }
+ }
+ return out
+}
+
// DecodeToTempFile decodes the named file to a temporary location.
// If successful, it returns the path of the decoded file.
// The caller is responsible for ensuring that the temporary file is removed.