Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSA key: ignore and warn about empty passphrase for NSS keys #17

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/libswan/secrets.c
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,7 @@ static err_t lsw_process_rsa_keycert(struct RSA_private_key *rsak)
{
char friendly_name[PATH_MAX]; /* XXX: is there an NSS limit < PATH_MAX ? */
err_t ugh = NULL;
bool unexpected;

zero(&friendly_name);

Expand All @@ -710,7 +711,15 @@ static err_t lsw_process_rsa_keycert(struct RSA_private_key *rsak)
else
memcpy(friendly_name, flp->tok, flp->cur - flp->tok);

if (shift()) {
unexpected = shift();
/* we used to recommend people to provide an empty passphrase for NSS keys */
if (unexpected && (strcmp(flp->tok, "\"\"") == 0 || strcmp(flp->tok, "''") == 0)) {
libreswan_log("RSA private key file "
"-- ignoring empty token after friendly_name "
"-- this will be an error in a future release");
unexpected = shift();
}
if (unexpected) {
ugh = "RSA private key file -- unexpected token after friendly_name";
} else {
ugh = extract_and_add_secret_from_nss_cert_file(rsak, friendly_name);
Expand Down