Skip to content

Node parsed a cert without error. But ZCertificate reported the error that the modulus is not a positive number #63824

@Jennifer-first

Description

@Jennifer-first

Version

v22.22.2

Platform

Linux liu-VirtualBox 6.8.0-111-generic #111~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 14 17:13:45 UTC  x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

const fs = require('fs');
const { X509Certificate } = require('crypto');
const certPath = process.argv[2];
const cert = new X509Certificate(fs.readFileSync(certPath));
console.dir(cert, { depth: null });

How often does it reproduce? Is there a required condition?

A certificate is required.

What is the expected behavior? Why is that the expected behavior?

Node.js, Forge, OpenSSL, and Gnutls all accepted this certificate. Gnutls considered it a bug, while OpenSSL fixed it, resulting in the rejection of negative modulo values.

What do you see instead?

node parse_cert.js cert.pem
X509Certificate {
[Symbol(kInternalState)]: SafeMap(0) {},
[Symbol(kHandle)]: X509Certificate {}
}

Additional information

cert.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions