aboutsummaryrefslogtreecommitdiff
path: root/crypto/pem
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>1999-06-09 23:12:08 +0000
committerBodo Möller <bodo@openssl.org>1999-06-09 23:12:08 +0000
commit0b977773d256063715a5a9b24d78ac31d1911b00 (patch)
treea2431707d97a75917a5a927987a8b327eb9a7e50 /crypto/pem
parent62c419d603f2cf13a773b899857464ef7402ab1c (diff)
downloadopenssl-0b977773d256063715a5a9b24d78ac31d1911b00.zip
openssl-0b977773d256063715a5a9b24d78ac31d1911b00.tar.gz
openssl-0b977773d256063715a5a9b24d78ac31d1911b00.tar.bz2
Repair PEM_write_PrivateKey and PEM_write_bio_PrivateKey.
Diffstat (limited to 'crypto/pem')
-rw-r--r--crypto/pem/pem_all.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/crypto/pem/pem_all.c b/crypto/pem/pem_all.c
index b283b6b..bc473f3 100644
--- a/crypto/pem/pem_all.c
+++ b/crypto/pem/pem_all.c
@@ -102,5 +102,12 @@ IMPLEMENT_PEM_rw(DHparams, DH, PEM_STRING_DHPARAMS, DHparams)
#endif
-IMPLEMENT_PEM_rw_cb(PrivateKey, EVP_PKEY, PEM_STRING_EVP_PKEY, PrivateKey)
+/* The PrivateKey case is not that straightforward.
+ * IMPLEMENT_PEM_rw_cb(PrivateKey, EVP_PKEY, PEM_STRING_EVP_PKEY, PrivateKey)
+ * does not work, RSA and DSA keys have specific strings.
+ * (When reading, parameter PEM_STRING_EVP_PKEY is a wildcard for anything
+ * appropriate.)
+ */
+IMPLEMENT_PEM_read(PrivateKey, EVP_PKEY, PEM_STRING_EVP_PKEY, PrivateKey)
+IMPLEMENT_PEM_write_cb(PrivateKey, EVP_PKEY, ((x->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA), PrivateKey)