diff options
author | Richard Levitte <levitte@openssl.org> | 2020-10-17 08:55:39 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-11-11 12:43:27 +0100 |
commit | 4227e504c894db14d06be7180d0b4e7f6fe4ac2c (patch) | |
tree | f9b487eb1d670c430e4a8492e03d77dff4606b05 /crypto/x509/x_pubkey.c | |
parent | c319b6276bf84da2676b4b70f40f7ce897649f72 (diff) |
Adapt libcrypto functionality to specify the desired output structure
This also modifies i2d_PublicKey() and i2d_KeyParams() to support
provided keys.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13167)
Diffstat (limited to 'crypto/x509/x_pubkey.c')
-rw-r--r-- | crypto/x509/x_pubkey.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/x509/x_pubkey.c b/crypto/x509/x_pubkey.c index b7dd04838c..b24ed8ff46 100644 --- a/crypto/x509/x_pubkey.c +++ b/crypto/x509/x_pubkey.c @@ -104,7 +104,8 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) unsigned char *der = NULL; size_t derlen = 0; OSSL_ENCODER_CTX *ectx = - OSSL_ENCODER_CTX_new_by_EVP_PKEY(pkey, "DER", EVP_PKEY_PUBLIC_KEY, + OSSL_ENCODER_CTX_new_by_EVP_PKEY(pkey, EVP_PKEY_PUBLIC_KEY, + "DER", "SubjectPublicKeyInfo", libctx, NULL); if (OSSL_ENCODER_to_data(ectx, &der, &derlen)) { @@ -309,7 +310,8 @@ int i2d_PUBKEY(const EVP_PKEY *a, unsigned char **pp) const OSSL_PROVIDER *pkprov = EVP_KEYMGMT_provider(a->keymgmt); OSSL_LIB_CTX *libctx = ossl_provider_libctx(pkprov); OSSL_ENCODER_CTX *ctx = - OSSL_ENCODER_CTX_new_by_EVP_PKEY(a, "DER", EVP_PKEY_PUBLIC_KEY, + OSSL_ENCODER_CTX_new_by_EVP_PKEY(a, EVP_PKEY_PUBLIC_KEY, + "DER", "SubjectPublicKeyInfo", libctx, NULL); BIO *out = BIO_new(BIO_s_mem()); BUF_MEM *buf = NULL; |