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.
1) Node.js PKCS#12 Example
Parse Windows-like PKCS#12 data
Windows RC2:
Error: error:0308010C:digital envelope routines::unsupported
at Decipheriv.createCipherBase (node:internal/crypto/cipher:116:19)
at Decipheriv.createCipherWithIV (node:internal/crypto/cipher:135:3)
at new Decipheriv (node:internal/crypto/cipher:289:3)
at Object.createDecipheriv (node:crypto:149:10)
at Object.decryptUsingPBKDF1Password (examples/NodePKCS12Example/NodeEngineNodeSpecific.ts:381:25)
at NodeEngine.decryptEncryptedContentInfo (examples/NodePKCS12Example/NodeEngine.ts:433:33)
at EncryptedData.decrypt (src/EncryptedData.ts:129:43)
at AuthenticatedSafe.parseInternalValues (src/AuthenticatedSafe.ts:47:62)
at parsePKCS12 (test/nodePKCS12Example.spec.ts:196:46)
at async Context.<anonymous> (test/nodePKCS12Example.spec.ts:252:7)
2) Node.js PKCS#12 Example
X.509 Certificate
RC2-40-CBC algorithm:
Error: error:0308010C:digital envelope routines::unsupported
at Cipheriv.createCipherBase (node:internal/crypto/cipher:116:19)
at Cipheriv.createCipherWithIV (node:internal/crypto/cipher:135:3)
at new Cipheriv (node:internal/crypto/cipher:243:3)
at Object.createCipheriv (node:crypto:141:10)
at Object.encryptUsingPBKDF1Password (examples/NodePKCS12Example/NodeEngineNodeSpecific.ts:328:25)
at NodeEngine.encryptEncryptedContentInfo (examples/NodePKCS12Example/NodeEngine.ts:316:57)
at EncryptedData.encrypt (src/EncryptedData.ts:113:6)
at PKCS8ShroudedKeyBag.makeInternalValues (src/PKCS8ShroudedKeyBag.ts:76:44)
at pkcs12Like (test/nodePKCS12Example.spec.ts:145:101)
at windowsLike (test/nodePKCS12Example.spec.ts:176:10)
at Context.<anonymous> (test/nodePKCS12Example.spec.ts:273:31)
at processImmediate (node:internal/timers:471:21)
These tests don't work on NodeJS v18