Re: [Cryptography-dev] Extracting pub key from a csr

2024-08-30 Thread Robert Moskowitz
For want of a parens, 2 hours were lost  :) I do trip on this, still, a lot.  Blame my dyslexia! thanks! On 8/30/24 01:57, Glyph wrote: You will note that https://cryptography.io/en/latest/hazmat/primitives/asymmetric/ed25519/#cryptography.hazmat.primitives.asymmetric.ed25519.Ed25519Private

Re: [Cryptography-dev] Extracting pub key from a csr

2024-08-29 Thread Glyph
You will note that https://cryptography.io/en/latest/hazmat/primitives/asymmetric/ed25519/#cryptography.hazmat.primitives.asymmetric.ed25519.Ed25519PrivateKey.public_key has parentheses after it in its description. That's it. You just forgot the parens. i.e., try: public_bytes = csr.public_k

Re: [Cryptography-dev] Extracting pub key from a csr

2024-08-29 Thread Robert Moskowitz
I may know a lot about x.509 objects (and use openssl command line a lot), but I am a serious hack at anything python, so I am missing your point wrt what I need to do after reading in the csr to get a var that contains the public key in bytes I can use. So, please, be a little understanding a

Re: [Cryptography-dev] Extracting pub key from a csr

2024-08-29 Thread Paul Kehrer
public_key is a method on your csr object that returns the public_key, not an attribute. -Paul On Thu, Aug 29, 2024 at 8:36 PM Robert Moskowitz wrote: > > I tried that and: > > public_bytes = public_key.public_bytes( > encoding=serialization.Encoding.Raw, > format=serialization.PublicF

Re: [Cryptography-dev] Extracting pub key from a csr

2024-08-29 Thread Robert Moskowitz
I tried that and: public_bytes = public_key.public_bytes(     encoding=serialization.Encoding.Raw,     format=serialization.PublicFormat.Raw)     public_bytes = public_key.public_bytes(    ^^ NameError: name 'public_key' is not defined so I tried public_bytes = csr.publ

Re: [Cryptography-dev] Extracting pub key from a csr

2024-08-29 Thread Alex Gaynor
All of our public key types have a public_bytes() method that can be used to serialize the key as you wish: https://cryptography.io/en/latest/hazmat/primitives/asymmetric/ed25519/#cryptography.hazmat.primitives.asymmetric.ed25519.Ed25519PublicKey.public_bytes Alex On Thu, Aug 29, 2024 at 11:12 PM

Re: [Cryptography-dev] Extracting pub key from a csr

2024-08-29 Thread Robert Moskowitz
I want a variable that is the bits of the public key so that if I print it, I get something like: 0xf32938f7ff6918d5bbdc52483f31e3725875456a9aeb83f915461a5ea629acda or whatever type that I can then change to what I need elsewhere. On 8/29/24 23:02, Alex Gaynor wrote: You're getting back the p

Re: [Cryptography-dev] Extracting pub key from a csr

2024-08-29 Thread Alex Gaynor
You're getting back the public key object for that CSR. When you say you want the "public key itself" what do you mean? Alex On Thu, Aug 29, 2024 at 10:54 PM Robert Moskowitz wrote: > > I have a csr with an eddsa25519 key: > > -BEGIN CERTIFICATE REQUEST- > MIGPMEMCAQAwEDEOMAwGA1UEBRMFeDE

[Cryptography-dev] Extracting pub key from a csr

2024-08-29 Thread Robert Moskowitz
I have a csr with an eddsa25519 key: -BEGIN CERTIFICATE REQUEST- MIGPMEMCAQAwEDEOMAwGA1UEBRMFeDEyMjQwKjAFBgMrZXADIQAqLOv73gF8OMT9 dvXIai0HOzyoT0kWkwziuPObnb+PbaAAMAUGAytlcANBAMbkfr344AGb2NHMJOk7 hUdknmKY3XOrAKITLbE0X5NiSxfsZ8ovLG4SnmIEE86t5pWfaPAFhJ8t+jMGJUzQ XgM= -END CERTIFICATE REQ