diff --git a/src/x509.cc b/src/x509.cc index 7606b9f..c82e98f 100644 --- a/src/x509.cc +++ b/src/x509.cc @@ -1,4 +1,5 @@ #include +#include #include using namespace v8; @@ -236,6 +237,13 @@ Local try_parse(const std::string& dataString) { Nan::New("notAfter").ToLocalChecked(), parse_date(X509_get_notAfter(cert))); + // Subject hash + std::stringstream stream; + stream << std::hex << X509_subject_name_hash(cert); + Nan::Set(exports, + Nan::New("subjectHash").ToLocalChecked(), + Nan::New(stream.str()).ToLocalChecked()); + // Signature Algorithm int sig_alg_nid = OBJ_obj2nid(cert->sig_alg->algorithm); if (sig_alg_nid == NID_undef) {