Re: secp256r1 65 byte key size in packet capture

2024-06-19 Thread Lokesh Chakka
Is there a way to have all those man pages installed in my system. I'm using Ubuntu 24. On Wed, Jun 19, 2024, 17:49 Matt Caswell wrote: > > > On 19/06/2024 12:14, Lokesh Chakka wrote: > > Now I need to explore C APIs for getting those keys as hex array. > > Could you please suggest any good

Re: secp256r1 65 byte key size in packet capture

2024-06-19 Thread Matt Caswell
On 19/06/2024 12:14, Lokesh Chakka wrote: Now I need to explore C APIs for getting those keys as hex array. Could you please suggest any good references for beginners. You would need to first load the key from the file to create an EVP_PKEY object. For example you could use the

Re: secp256r1 65 byte key size in packet capture

2024-06-19 Thread Lokesh Chakka
Hi Matt, I'm trying to craft a client hello packet using a C program. I'm learning about these keys, openssl, TLS etc. So openssl ecparam -name secp256r1 -genkey -out pvtkey.pem openssl ec -in pvtkey.pem -pubout -out pubkey.pem openssl pkey -in pubkey.pem -pubin -noout -text will give me the

Re: secp256r1 65 byte key size in packet capture

2024-06-19 Thread Matt Caswell
On 19/06/2024 09:15, Lokesh Chakka wrote: hello, I'm trying to generate public/private keys with following commands: openssl ecparam -name secp256r1 -genkey -out pvtkey.pem openssl ec -in pvtkey.pem -pubout I'm seeing the sizeof private key as 164 bytes and public key as 124 bytes. In a

Re: secp256r1 65 byte key size in packet capture

2024-06-19 Thread Lokesh Chakka
Understood. Thanks alot. But I'm still Not able to understand why it is 65 bytes in the key value. Thanks & Regards -- Lokesh Chakka. On Wed, Jun 19, 2024 at 3:03 PM Tomas Mraz wrote: > You need to do base64 decoding to find out the real size of the ASN.1 > encoded data. > > Tomas Mraz,

Re: secp256r1 65 byte key size in packet capture

2024-06-19 Thread Tomas Mraz
You need to do base64 decoding to find out the real size of the ASN.1 encoded data. Tomas Mraz, OpenSSL On Wed, 2024-06-19 at 14:58 +0530, Lokesh Chakka wrote: > hi, > > please check the following : > > = >

Re: secp256r1 65 byte key size in packet capture

2024-06-19 Thread Lokesh Chakka
hi, please check the following : == $ openssl ecparam -name secp256r1 -genkey -out pvtkey.pem using curve name prime256v1 instead of secp256r1 $ cat pvtkey.pem -BEGIN EC PARAMETERS- BggqhkjOPQMBBw==

Re: secp256r1 65 byte key size in packet capture

2024-06-19 Thread Tomas Mraz
Hi Lokesh, I am not sure how do you count the sizes of 164 bytes and 124 bytes for the pem files. If I use -outform DER (and use -noout with the ecparam to avoid outputting the params because the private key already contains info about the params used) I see the following sizes for the DER

secp256r1 65 byte key size in packet capture

2024-06-19 Thread Lokesh Chakka
hello, I'm trying to generate public/private keys with following commands: openssl ecparam -name secp256r1 -genkey -out pvtkey.pem openssl ec -in pvtkey.pem -pubout I'm seeing the sizeof private key as 164 bytes and public key as 124 bytes. In a wireshark capture( attached ), I'm seeing key