diff --git a/certoperations.js b/certoperations.js index 21228e21..04364ccb 100644 --- a/certoperations.js +++ b/certoperations.js @@ -634,9 +634,17 @@ module.exports.CertificateOperations = function (parent) { }; // Return the SHA384 hash of the certificate public key - obj.getPublicKeyHashBinary = function (cert) { - var publickey = obj.pki.certificateFromPem(cert).publicKey; - return obj.pki.getPublicKeyFingerprint(publickey, { encoding: 'binary', md: obj.forge.md.sha384.create() }); + obj.getPublicKeyHashBinary = function (pem) { + const { X509Certificate } = require('crypto'); + if (X509Certificate == null) { + // This version of NodeJS (