diff options
author | Darshan Sen <raisinten@gmail.com> | 2022-01-22 17:56:05 +0530 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-01-26 17:15:52 +0100 |
commit | 1d28ada1c39997c10fe5392f4235bbd2bc44b40f (patch) | |
tree | 14c32dd7ef4cf57393d59a39d4d332fc83706549 /test/evp_pkey_provided_test.c | |
parent | 59ccb72cd5cec3b4e312853621e12a68dacdbc7e (diff) |
Allow empty passphrase in PEM_write_bio_PKCS8PrivateKey_nid()
Signed-off-by: Darshan Sen <raisinten@gmail.com>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17507)
Diffstat (limited to 'test/evp_pkey_provided_test.c')
-rw-r--r-- | test/evp_pkey_provided_test.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/evp_pkey_provided_test.c b/test/evp_pkey_provided_test.c index b4b53f67fc..b4a77f8500 100644 --- a/test/evp_pkey_provided_test.c +++ b/test/evp_pkey_provided_test.c @@ -165,6 +165,20 @@ static int test_print_key_using_pem(const char *alg, const EVP_PKEY *pk) EVP_aes_256_cbc(), NULL, 0, pass_cb_error, NULL)) +#ifndef OPENSSL_NO_DES + || !TEST_true(PEM_write_bio_PKCS8PrivateKey_nid( + bio_out, pk, NID_pbe_WithSHA1And3_Key_TripleDES_CBC, + (const char *)~0, 0, NULL, NULL)) + || !TEST_true(PEM_write_bio_PKCS8PrivateKey_nid( + bio_out, pk, NID_pbe_WithSHA1And3_Key_TripleDES_CBC, NULL, 0, + NULL, "")) + || !TEST_true(PEM_write_bio_PKCS8PrivateKey_nid( + bio_out, pk, NID_pbe_WithSHA1And3_Key_TripleDES_CBC, NULL, 0, + pass_cb, NULL)) + || !TEST_false(PEM_write_bio_PKCS8PrivateKey_nid( + bio_out, pk, NID_pbe_WithSHA1And3_Key_TripleDES_CBC, NULL, 0, + pass_cb_error, NULL)) +#endif /* Private key in text form */ || !TEST_int_gt(EVP_PKEY_print_private(membio, pk, 0, NULL), 0) || !TEST_true(compare_with_file(alg, PRIV_TEXT, membio)) |