]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/x509: unwrap Subject Key Identifier
authorAdam Langley <agl@golang.org>
Tue, 3 Aug 2010 16:26:48 +0000 (12:26 -0400)
committerAdam Langley <agl@golang.org>
Tue, 3 Aug 2010 16:26:48 +0000 (12:26 -0400)
RFC 5280, 4.2.1.2 says:
  SubjectKeyIdentifier ::= KeyIdentifier
  KeyIdentifier ::= OCTET STRING

Previously, we were failing to unwrap the second level of OCTET STRING
encoding.

Fixes #993.

R=rsc
CC=golang-dev
https://golang.org/cl/1917044

src/pkg/crypto/x509/x509.go

index 728116850fbcd152d6858019f93a6d006c55bd95..e4a05d3ef0976c86395f6b76091f1d6f44120d80 100644 (file)
@@ -610,7 +610,12 @@ func parseCertificate(in *certificate) (*Certificate, os.Error) {
 
                        case 14:
                                // RFC 5280, 4.2.1.2
-                               out.SubjectKeyId = e.Value
+                               var keyid []byte
+                               _, err = asn1.Unmarshal(&keyid, e.Value)
+                               if err != nil {
+                                       return nil, err
+                               }
+                               out.SubjectKeyId = keyid
                                continue
                        }
                }