Browse Source

crypto: fix error reporting in SetKey()

v0.9.1-release
Fedor Indutny 13 years ago
committed by isaacs
parent
commit
af52bc4fe6
  1. 9
      src/node_crypto.cc

9
src/node_crypto.cc

@ -297,7 +297,14 @@ Handle<Value> SecureContext::SetKey(const Arguments& args) {
if (!key) { if (!key) {
BIO_free(bio); 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); SSL_CTX_use_PrivateKey(sc->ctx_, key);

Loading…
Cancel
Save