← index #612PR #15545
Related · medium · value 2.523
QUERY · ISSUE

How do I generate an EC private key with the NISTP256 curve (aka secp256r1, or prime256v1) , and using the private key to generate a public key serialized to bytes in the ANSI X9.62/X9.63 Uncompressed Point format on ESP 32?

openby zhy2020opened 2023-02-14updated 2023-02-14

How do I generate an EC private key with the NISTP256 curve (aka secp256r1, or prime256v1) , and using the private key to generate a public key serialized to bytes in the ANSI X9.62/X9.63 Uncompressed Point format on ESP 32?

CANDIDATE · PULL REQUEST

tests/README: Update instructions for elliptic curve key/cert pair.

closedby andrewleechopened 2024-07-25updated 2024-07-29

Summary

When following the instructions in the tests/readme to create certs:

anl@STEP: ~/micropython/tests $ openssl ecparam -name prime256v1 -genkey -noout -out ec_key.der -outform DER
anl@STEP: ~/micropython/tests $ openssl req -new -x509 -key ec_key.der -out ec_cert.der -outform DER -days 365 -nodes -subj '/CN=micropython.local/O=MicroPython/C=AU'

I got the error:

unable to load Private Key
139897947084096:error:0909006C:PEM routines:get_name:no start line:../crypto/pem/pem_lib.c:745:Expecting: ANY PRIVATE KEY

This is on an WSL / Ubuntu based system:

OpenSSL 1.1.1f  31 Mar 2020

This updates the instructions to first create the key as a pem then convert to der, as per earlier cert generation commands.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied