]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Add OSSL_SERIALIZER_PUBKEY_TO_DER_PQ and friends
authorRichard Levitte <levitte@openssl.org>
Tue, 11 Feb 2020 05:23:58 +0000 (06:23 +0100)
committerRichard Levitte <levitte@openssl.org>
Wed, 12 Feb 2020 12:07:56 +0000 (13:07 +0100)
It's already used internally, there's no reason the DER serializer
propqueries shouldn't be present alongside the PEM and TEXT ones.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11055)

crypto/x509/x_pubkey.c
include/openssl/serializer.h

index c4d2806ea17aeb5d30039c250c8d0b810dd1a56b..f74c1566522a1fd758593b3f548ed13c63a30479 100644 (file)
@@ -93,7 +93,7 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
         }
     } else if (pkey->pkeys[0].keymgmt != NULL) {
         BIO *bmem = BIO_new(BIO_s_mem());
-        const char *serprop = "format=der,type=public";
+        const char *serprop = OSSL_SERIALIZER_PUBKEY_TO_DER_PQ;
         OSSL_SERIALIZER_CTX *sctx =
             OSSL_SERIALIZER_CTX_new_by_EVP_PKEY(pkey, serprop);
 
index c37939f813a6d40f5990d0c8558fbbb1ce28636b..ceeeffb2b16aff174736cd788f96adbf5cf90afb 100644 (file)
@@ -89,6 +89,10 @@ OSSL_SERIALIZER_CTX *OSSL_SERIALIZER_CTX_new_by_EVP_PKEY(const EVP_PKEY *pkey,
 # define OSSL_SERIALIZER_PrivateKey_TO_PEM_PQ "format=pem,type=private"
 # define OSSL_SERIALIZER_Parameters_TO_PEM_PQ "format=pem,type=parameters"
 
+# define OSSL_SERIALIZER_PUBKEY_TO_DER_PQ "format=der,type=public"
+# define OSSL_SERIALIZER_PrivateKey_TO_DER_PQ "format=der,type=private"
+# define OSSL_SERIALIZER_Parameters_TO_DER_PQ "format=der,type=parameters"
+
 /* Corresponding macros for text output */
 # define OSSL_SERIALIZER_PUBKEY_TO_TEXT_PQ "format=text,type=public"
 # define OSSL_SERIALIZER_PrivateKey_TO_TEXT_PQ "format=text,type=private"