Skip to content

Forge accepts a cert which has no subjectAltName and an empty subject #1144

Description

@Jennifer-first

Forge accepts a cert which has no subjectAltName and an empty subject.
Section 4.1.2.6 Subject of RFC 5280 mentions that the subject name MAY be carried in the subject field and/or the subjectAltName extension.

To Reproduce:

const forge = require('node-forge');
const fs = require('fs');
const caPath = process.argv[2];
const certPath = process.argv[3];
const caCert = forge.pki.certificateFromPem(fs.readFileSync(caPath, 'utf8'));
const serverCert = forge.pki.certificateFromPem(fs.readFileSync(certPath, 'utf8'));
const caStore = forge.pki.createCaStore([caCert]);
console.log(forge.pki.verifyCertificateChain(caStore, [serverCert]));

node verify.js ca.pem seed.pem

Expected behavior:
Verification failed.

cert.zip

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions