Please use these 3 commands to generate a Key.

openssl ecparam -name prime256v1 -out prime256v1.pem

openssl ecparam -in prime256v1.pem -genkey -noout -out prime256v1-key.pem

openssl ec -in prime256v1-key.pem -pubout -out pubkey.pem -conv_form compressed

Did this answer your question?