From 0652b62d5e8a2992aa87324a9a14104bd4f1910f Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Thu, 25 Apr 2024 16:02:13 +0200 Subject: [PATCH] Fix rsa_pkcs1_*_clear.der to actually be PKCS#1 files With OpenSSL 3.0.2 (which I used to generate the previous set of "pkcs1" DER files), the output of `openssl rsa -outform DER` is actually a PKCS#8-encoded key, despite what the documentation says. This is a change from OpenSSL 1.x, where the output is a PKCS#1-encoded key. OpenSSL 3.0.8 documents the output as PKCS#8. Change to `openssl pkey`, which seems more reliable. The documentation states that the output is PKCS#8, but the output is actually consistently PKCS#1 at least from 1.0.2g to 3.3.0. Signed-off-by: Gilles Peskine --- tests/data_files/Makefile | 2 +- tests/data_files/rsa_pkcs1_1024_clear.der | Bin 634 -> 608 bytes tests/data_files/rsa_pkcs1_2048_clear.der | Bin 1218 -> 1192 bytes tests/data_files/rsa_pkcs1_4096_clear.der | Bin 2374 -> 2348 bytes tests/data_files/rsa_pkcs1_768_clear.der | Bin 489 -> 463 bytes tests/data_files/rsa_pkcs1_769_clear.der | Bin 490 -> 464 bytes tests/data_files/rsa_pkcs1_770_clear.der | Bin 491 -> 465 bytes tests/data_files/rsa_pkcs1_776_clear.der | Bin 492 -> 466 bytes tests/data_files/rsa_pkcs1_784_clear.der | Bin 497 -> 471 bytes 9 files changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/data_files/Makefile b/tests/data_files/Makefile index 0fbdfe513d..fa30cf57b0 100644 --- a/tests/data_files/Makefile +++ b/tests/data_files/Makefile @@ -739,7 +739,7 @@ all_final += $(keys_rsa_base) ### PKCS1-encoded, plaintext RSA keys in derived forms rsa_pkcs1_%.der: rsa_pkcs1_%.pem - $(OPENSSL) rsa -inform PEM -in $< -outform DER -out $@ + $(OPENSSL) pkey -inform PEM -in $< -outform DER -out $@ all_final += $(keys_rsa_base:.pem=.der) ### diff --git a/tests/data_files/rsa_pkcs1_1024_clear.der b/tests/data_files/rsa_pkcs1_1024_clear.der index 8dfb09fb8407c69ab2501c2b5738b754aa594704..cec2c30117d6e3ddc6492c5354bace376c84bd2c 100644 GIT binary patch delta 8 Pcmeyx@_=QdR00zK5gY>$ delta 34 pcmaFB@{2{vpoyuBiIKs8myJ`a&7CIFS!2l@a2 diff --git a/tests/data_files/rsa_pkcs1_2048_clear.der b/tests/data_files/rsa_pkcs1_2048_clear.der index 137395e2a392d435aceb82d0983ab9ff9af5757d..667051bd80aa77abb5164bfb2dd1d3d6527d2b62 100644 GIT binary patch delta 8 PcmX@axq@?})Cv{=4%!0r delta 34 qcmZ3%d5BZWpowK46C;BGFB_*;n@8JsUPeYnRtAmv_@#7lny5V4vPYp delta 34 pcmZ1@bWBLfpo!CoiIKs8myJ`a&7{EAu1po#Gr6C;BGFB_*;n@8JsUPeYnRtA