[Cryptography-dev] well maybe not - what to import

Robert Moskowitz rgm at htt-consult.com
Fri Aug 30 16:12:52 EDT 2024


I fixed loading the cert.

I can get the value of cert.serial_number

But I don't see how to get the Issuer, or any of the other elements 
(like SAN content).

What is the proper expansion of SAN?  Is this all somewhere in openSSL docs?


On 8/30/24 15:53, Robert Moskowitz wrote:
> I found my problem.
>
> I have
>
> cryptography.x509.load_pem_x509_certificate(cert)
>
> when it should only be
>
> x509.load_pem_x509_certificate(cert)
>
>
> ARGH!!!  :)
>
> On 8/30/24 15:18, Robert Moskowitz wrote:
>> Unfortunately, I go too much be copying examples.
>>
>> I am not learning how to find the various components to load,
>>
>> For example, I want to load an x509 cert:
>>
>> https://cryptography.io/en/3.4.7/x509/reference.html#loading-certificates 
>>
>>
>> with open(x509cert, "rb") as f:
>>     cert = f.read()
>>     cryptography.x509.load_pem_x509_certificate(cert)
>>     cert.serial_number
>>
>> ImportError: cannot import name 'load_pem_x509_certificate' from 
>> 'cryptography.hazmat.primitives' 
>> (/usr/lib64/python3.11/site-packages/cryptography/hazmat/primitives/__init__.py)
>>
>> I can't find on the website where I am advised what to load.  So far, 
>> shotgunning it as not worked.  Nor should I really count on that 
>> approach.
>>
>> So where is there advise for importing what from where?
>>
>> thanks
>>
>> _______________________________________________
>> Cryptography-dev mailing list
>> Cryptography-dev at python.org
>> https://mail.python.org/mailman/listinfo/cryptography-dev
>
> _______________________________________________
> Cryptography-dev mailing list
> Cryptography-dev at python.org
> https://mail.python.org/mailman/listinfo/cryptography-dev



More information about the Cryptography-dev mailing list