[Cryptography-dev] Processing public key algorithm 'ecdsa-with-SHA256'

Paul King paul at grumpypunk.com
Thu Apr 20 08:14:08 EDT 2017


Hi 

I am using pyOpenSSL to process a PEM certificate.

From the command line I can use ‘openssl x509 -inform pem -text -in 10.pem’ to process the certificate and can see:

Signature Algorithm: ecdsa-with-SHA256

However, when I try this in python with pyOpenSSL on my Mac, I struggle.

Can someone advise me on how to process this type in python with pyOpenSSL? 

Code:

    pub = cert.get_pubkey()
    pub_asn1 = OpenSSL.crypto.dump_publickey( OpenSSL.crypto.FILETYPE_ASN1, pub )

Similarly I want to do the same for the Subject Public Key:

        Subject Public Key Info:
            Public Key Algorithm: id-ecPublicKey
                Public-Key: (256 bit)
                pub:
                    <-snip->
                ASN1 OID: prime256v1
                NIST CURVE: P-256


Does that make sense for what I am trying to do, and should I be able to do this with pyOpenSSL?


Thanks
Paul








More information about the Cryptography-dev mailing list