X509 *ocsp_issuer;
OCSP_CERTID *ocsp_cid;
struct issuer_chain *extra_chain; /* chain from 'issuers-chain-path' */
+ int encrypted_privkey; /* 1 if 'key' is encrypted, 0 otherwise */
};
/* configuration for the ckch_store */
BIO *in = NULL;
int ret = 1;
EVP_PKEY *key = NULL;
- struct passphrase_cb_data cb_data = { path, 0 };
+ struct passphrase_cb_data cb_data = { path, data, 0 };
if (buf) {
/* reading from a buffer */
goto end;
}
+ /* We don't know yet if the private key requires a password. */
+ data->encrypted_privkey = 0;
+
/* Read Private Key
* Since multiple private keys might have different passphrases that are
* stored in a local cache, we want to try all the already known
}
+ /* Do not dump encrypted private keys */
+ if (ckchs->data->encrypted_privkey) {
+ HA_SPIN_UNLOCK(CKCH_LOCK, &ckch_lock);
+ return cli_err(appctx, "Can't display the contents of an encrypted certificate!\n");
+ }
+
ctx->ckchs = ckchs;
ctx->index = -2; /* -2 for pkey, -1 for cert, >= 0 for chain */
int wstatus = 0;
int fd[2];
char *bufstart = buf;
+ struct ckch_data *ckch_data = NULL;
struct passphrase_cb_data *data = userdata;
if (!data || data->passphrase_idx == -1)
return -1;
+ ckch_data = data->ckch_data;
+
+ if (ckch_data)
+ ckch_data->encrypted_privkey = 1;
+
if (!global_ssl.passphrase_cmd) {
data->passphrase_idx = -1;
ha_alert("Trying to load a passphrase-protected private key without an 'ssl-passphrase-cmd' defined.");