M2Crypto get certificate (X509) signature hash algorithm

948 views Asked by At

For a small project I want to manage some certificates. In the beginning I used the Python "cryptography" extension but I needed some further functionality so I switched to M2Crypto.

With "cryptography" I retrieved the signature hash algorithm from the certificate like so cert.signature_hash_algorithm.name.upper(). With M2Crypto I cannot find a way to get the same result.

How can I get the signature hash algorithm from a X509 certificate with M2Crypto?

1

There are 1 answers

2
Daniel Fisher  lennybacon On

Sorry to say, but neither a loaded certificate provides such functionality, nor does M2 offer an ANS.1 reader to manually find the OID of the signature to evaluate the hash algorithm from the signature.

x509 = X509.load_cert_string(cert)

Sources: