Skip to content

crypto/x509: ParsePKCS8PrivateKey does not support loading DSA keys #8919

Description

@gopherbot

by alex.gaynor:

Trying to load a PKCS8 DSA key fails with the error: 

    ERROR: asn1.StructuralError{Msg:"tags don't match (16 vs {class:0 tag:13 length:45 isCompound:true}) {optional:false explicit:false application:false defaultValue:<nil> tag:<nil> stringType:0 set:false omitEmpty:false} pkcs8 @2"}

An example of such a key is available at
https://raw.githubusercontent.com/pyca/cryptography/master/vectors/cryptography_vectors/asymmetric/PKCS8/unenc-dsa-pkcs8.pem

It can be successfully parsed by OpenSSL:

$ cat ./vectors/cryptography_vectors/asymmetric/PKCS8/unenc-dsa-pkcs8.pem | openssl
pkcs8 -nocrypt | openssl dsa -text -noout
read DSA key
Private-Key: (1024 bit)
priv:
    00:a5:35:a8:e1:d0:d9:1b:ea:fc:8b:ee:1d:9b:2a:
    3a:8d:e3:31:12:03
(continued)

OpenSSL's documentation claims that the specification for this can actually be found in
PKCS#11 (https://www.openssl.org/docs/apps/pkcs8.html#STANDARDS)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions