summaryrefslogtreecommitdiffstats
path: root/src/crypto
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 19:27:12 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 19:27:12 +0000
commit0e07b82b3b3ec5af236400610939724e137f8e90 (patch)
tree1ff52042665843a28e0cf521c79aa33f5d52709e /src/crypto
parentReleasing progress-linux version 1.22.1-1~progress7.99u1. (diff)
downloadgolang-1.22-0e07b82b3b3ec5af236400610939724e137f8e90.tar.xz
golang-1.22-0e07b82b3b3ec5af236400610939724e137f8e90.zip
Merging upstream version 1.22.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/x509/x509.go1
-rw-r--r--src/crypto/x509/x509_test.go11
2 files changed, 12 insertions, 0 deletions
diff --git a/src/crypto/x509/x509.go b/src/crypto/x509/x509.go
index f33283b..15b3b9e 100644
--- a/src/crypto/x509/x509.go
+++ b/src/crypto/x509/x509.go
@@ -780,6 +780,7 @@ type Certificate struct {
PolicyIdentifiers []asn1.ObjectIdentifier
// Policies contains all policy identifiers included in the certificate.
+ // In Go 1.22, encoding/gob cannot handle and ignores this field.
Policies []OID
}
diff --git a/src/crypto/x509/x509_test.go b/src/crypto/x509/x509_test.go
index ead0453..548b8d9 100644
--- a/src/crypto/x509/x509_test.go
+++ b/src/crypto/x509/x509_test.go
@@ -19,6 +19,7 @@ import (
"crypto/x509/pkix"
"encoding/asn1"
"encoding/base64"
+ "encoding/gob"
"encoding/hex"
"encoding/pem"
"fmt"
@@ -3999,3 +4000,13 @@ func TestCertificatePoliciesGODEBUG(t *testing.T) {
t.Errorf("cert.Policies = %v, want: %v", cert.Policies, expectPolicies)
}
}
+
+func TestGob(t *testing.T) {
+ // Test that gob does not reject Certificate.
+ // See go.dev/issue/65633.
+ cert := new(Certificate)
+ err := gob.NewEncoder(io.Discard).Encode(cert)
+ if err != nil {
+ t.Fatal(err)
+ }
+}