Read and write X25519 and X448 private keys

Signed-off-by: Jethro Beekman <jethro@fortanix.com>
Co-authored-by: Gijs Kwakkel <gijs.kwakkel@fortanix.com>
Signed-off-by: Gijs Kwakkel <gijs.kwakkel@fortanix.com>
This commit is contained in:
Jethro Beekman 2023-04-19 14:08:14 +02:00
parent e4072c00c8
commit 0167244be4
19 changed files with 515 additions and 94 deletions

View file

@ -1003,6 +1003,38 @@ ec_bp512_pub.comp.pem: ec_bp512_pub.pem
$(OPENSSL) ec -pubin -in $< -out $@ -conv_form compressed
all_final += ec_bp512_pub.comp.pem
ec_x25519_prv.der:
$(OPENSSL) genpkey -algorithm X25519 -out $@ -outform DER
all_final += ec_x25519_prv.der
ec_x25519_pub.der: ec_x25519_pub.der
$(OPENSSL) pkey -in $< -inform DER -out $@ -outform DER
all_final += ec_x25519_pub.der
ec_x25519_prv.pem: ec_x25519_prv.pem
$(OPENSSL) pkey -in $< -inform DER -out $@
all_final += ec_x25519_prv.pem
ec_x25519_pub.pem: ec_x25519_pub.pem
$(OPENSSL) pkey -in $< -inform DER -out $@
all_final += ec_x25519_pub.pem
ec_x448_prv.der:
$(OPENSSL) genpkey -algorithm X448 -out $@ -outform DER
all_final += ec_x448_prv.der
ec_x448_pub.der: ec_x448_pub.der
$(OPENSSL) pkey -in $< -inform DER -out $@ -outform DER
all_final += ec_x448_pub.der
ec_x448_prv.pem: ec_x448_prv.pem
$(OPENSSL) pkey -in $< -inform DER -out $@
all_final += ec_x448_prv.pem
ec_x448_pub.pem: ec_x448_pub.pem
$(OPENSSL) pkey -in $< -inform DER -out $@
all_final += ec_x448_pub.pem
################################################################
#### Convert PEM keys to DER format
################################################################

Binary file not shown.

View file

@ -0,0 +1,3 @@
-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VuBCIEILBtgpZVVDpRy6NuU1IrwKz9YK9ZRmVV+z4eeWhyqxpZ
-----END PRIVATE KEY-----

Binary file not shown.

View file

@ -0,0 +1,3 @@
-----BEGIN PUBLIC KEY-----
MCowBQYDK2VuAyEAm8Ow6T2CM/5qi6YTiUjMEqkTYtXC7YFYTbBatUGcnRE=
-----END PUBLIC KEY-----

Binary file not shown.

View file

@ -0,0 +1,4 @@
-----BEGIN PRIVATE KEY-----
MEYCAQAwBQYDK2VvBDoEOGTpCDYD9atLDMYwDnjdwUTkjO4ZMB/uacXKw+4iUiED
oe50tXsIxi5REqWe2YOoL7eD7npOGRPt
-----END PRIVATE KEY-----

Binary file not shown.

View file

@ -0,0 +1,4 @@
-----BEGIN PUBLIC KEY-----
MEIwBQYDK2VvAzkAlrVhn5KDNBt3nL38B9mqGKqrPwnah3ynJgaWQ5IcLzv6zZT+
TIjhGQ1NFGWwgtOV8UqU2tO4pYQ=
-----END PUBLIC KEY-----