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

Alex Gaynor alex.gaynor at gmail.com
Fri Aug 30 16:18:54 EDT 2024


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



-- 
All that is necessary for evil to succeed is for good people to do nothing.


More information about the Cryptography-dev mailing list