I have the following code :
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.x509.oid import _OID_NAMES
file = open('ToParse.pem',"r")
file_data = file.read()
certoparse = x509.load_pem_x509_certificate(bytes(file_data,'utf-8'),
default_backend())
signalgo = certoparse.signature_algorithm_oid
print (signalgo)
Print gives me this :
<ObjectIdentifier(oid=1.2.840.113549.1.1.11, name=sha256WithRSAEncryption)>
But I'm only intressted in the name so I tried :
print (signalgo.name)
But the 'ObjectIdentifier' object has no attribute name id has only dotted_string attribute (oid).
AttributeError: 'ObjectIdentifier' object has no attribute 'name'
>>> print (signalgo.dotted_string)
1.2.840.113549.1.1.11
My question is : how can I get the description for this OID ?
Thank you in advance.
The answer is :
print(signalgo._name)
I'm sorry, a newbie in python ( figured it out with dir(signalgo)).