[Cryptography-dev] well maybe not - what to import
Robert Moskowitz
rgm at htt-consult.com
Fri Aug 30 16:45:50 EDT 2024
Thank you.
I have spent much time reading the docs and testing things out. I have
succeeded to a small extent and have gotten some of my goals met. But I
hit a wall and am really too tired at this point and really should just
shutdown and not ask for help.
I actually had just found this part that you point to. I read through
it earlier in the week, and did not see how it fit in to what I am doing
and my old brain just forgot it.
So, have a good weekend and I will come back to this fresh and will be
more diligent in rerereading the docs.
On 8/30/24 16:18, Alex Gaynor wrote:
> All of the attributes and methods on certificates are documented here:
> https://cryptography.io/en/latest/x509/reference/#cryptography.x509.Certificate
>
> I strongly encourage you to read the documentation before asking for help.
>
> Alex
>
> On Fri, Aug 30, 2024 at 4:13 PM Robert Moskowitz <rgm at htt-consult.com> wrote:
>> 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
>> _______________________________________________
>> 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