Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
+ 'new-style certificate');
if (cert.isExpired()) {
/*
* It's ok to tell the client details about this error -- we aren't
* telling them about anything in the DB, just about the cert they
* sent to us.
*/
next(new errors.UnauthorizedError('Client certificate expired'));
return;
}
if (!cert.subjects[0].equals(cert.issuer)) {
var fp;
try {
fp = sshpk.parseFingerprint(cert.issuer.cn);
if (fp.algorithm === 'md5') {
lookupFp = fp.toString('hex');
} else {
log.info('CN= fingerprint in issuer was not MD5');
fp = undefined;
}
} catch (e) {
log.info({err: e}, 'failed to parse CN= fingerprint in issuer');
}
if (fp === undefined) {
next(new errors.UnauthorizedError('Client certificate is not '
+ 'self-signed, and the issuer DN could not be parsed'));
return;
}
}
}