Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
crypto: fix error reporting in SetKey()
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny authored and isaacs committed Jun 21, 2012
1 parent fce7c95 commit af52bc4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/node_crypto.cc
Expand Up @@ -297,7 +297,14 @@ Handle<Value> SecureContext::SetKey(const Arguments& args) {

if (!key) {
BIO_free(bio);
return False();
unsigned long err = ERR_get_error();
if (!err) {
return ThrowException(Exception::Error(
String::New("PEM_read_bio_PrivateKey")));
}
char string[120];
ERR_error_string_n(err, string, sizeof string);
return ThrowException(Exception::Error(String::New(string)));
}

SSL_CTX_use_PrivateKey(sc->ctx_, key);
Expand Down

0 comments on commit af52bc4

Please sign in to comment.