如何在 C 中使用 OpenSSL 从 DER 文件中读取椭圆曲线 public 密钥

How to read elliptic curve public key from DER file with OpenSSL in C

读取已读入字节数组的 DER 格式的椭圆曲线 public 密钥的正确 OpenSSL C API 函数是什么?

密钥是通过以下命令行参数生成的:

openssl ecparam -name prime256v1 -genkey -noout -out private.der -outform der
openssl ec -in private.der -pubout -out public.der -outform der

您可以使用 d2i_PUBKEY 来达到这个目的。请在此处查看手册页:

https://www.openssl.org/docs/man1.1.1/man3/d2i_PUBKEY.html