How to use the sshpk.parseFingerprint function in sshpk

To help you get started, we’ve selected a few sshpk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github joyent / sdc-docker / lib / auth.js View on Github external
+ '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;
            }
        }
    }

sshpk

A library for finding and using SSH public keys

MIT
Latest version published 1 year ago

Package Health Score

74 / 100
Full package analysis