bssl pkcs12 shouldn't crash on missing key.
PKCS#12 files may not necessarily include keys. Change-Id: Ibb43b609783b02aa9cbb192fea377081169666ff Reviewed-on: https://boringssl-review.googlesource.com/6456 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
parent
e348ff4a72
commit
f606f9831b
@ -128,8 +128,10 @@ bool DoPKCS12(const std::vector<std::string> &args) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PEM_write_PrivateKey(stdout, key, NULL, NULL, 0, NULL, NULL);
|
||||
EVP_PKEY_free(key);
|
||||
if (key != NULL) {
|
||||
PEM_write_PrivateKey(stdout, key, NULL, NULL, 0, NULL, NULL);
|
||||
EVP_PKEY_free(key);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < sk_X509_num(certs); i++) {
|
||||
PEM_write_X509(stdout, sk_X509_value(certs, i));
|
||||
|
Loading…
Reference in New Issue
Block a user