PKI.js is a pure JavaScript library implementing the formats that are used in PKI applications (signing, encryption, certificate requests, OCSP and TSP requests/responses). It is built on WebCrypto (Web Cryptography API) and requires no plug-ins.
When calling the verify function on the CertificateChainValidationEngine with an explicit crypto parameter you get an error stating "Please call 'setEngine' before call to 'getEngine'"
const cryptoEngine = new pkijs.CryptoEngine({
name: 'mycrypto',
crypto: new Crypto(),
});
const ccve = new pkijs.CertificateChainValidationEngine({
certs: [rootCert, intCert, signingCert],
trustedCerts: [rootCert]
});
const result = await ccve.verify({}, cryptoEngine);
console.log(result);
{
result: false,
resultCode: -1,
resultMessage: "Please call 'setEngine' before call to 'getEngine'"
}
The issue seems to be that the verify function doesn't pass the supplied crypto value down to invocation of findIssuer.
Coverage remained the same at 74.291% when pulling a6da39674a66f7fe233f16c7ee5de334916f6a0e on bdehamer:cert-chain-engine-fix into 3e3e61439a49a4a8b712bc30641c75b7c8740a8a on PeculiarVentures:master.
When calling the
verify
function on theCertificateChainValidationEngine
with an explicitcrypto
parameter you get an error stating "Please call 'setEngine' before call to 'getEngine'"The issue seems to be that the
verify
function doesn't pass the suppliedcrypto
value down to invocation offindIssuer
.