tinovyatkin / pass-js

Apple Wallet Passes generating library for Node.JS
MIT License
676 stars 81 forks source link

Error outputting keys and certificates (when running passkit-keys) #644

Closed tbergeron closed 11 months ago

tbergeron commented 11 months ago

I followed the instructions in the README to export my certificate to p12 and ran the passkit-keys tool to no avail. See logs below.

Any idea what goes wrong?

I'm on a Macbook Air M1, on macOS 13.6 (22G120) with Node v20.4.0

Thanks

➜  server git:(feature/qr-backgrounds) ✗ ./node_modules/@walletpass/pass-js/bin/passkit-keys etc          [16:16:46]
Extracting Apple WWDR certificate into directory /Users/anon/Workshop/redacted/server/etc
Generating PEM versions for all P12 keys at /Users/anon/Workshop/redacted/server/etc...
Generating PEM from file /Users/anon/Workshop/redacted/server/etc/redacted.p12...
Enter Import Password:
Error outputting keys and certificates
80E0B0FE01000000:error:0308010C:digital envelope routines:inner_evp_generic_fetch:unsupported:crypto/evp/evp_fetch.c:341:Global default library context, Algorithm (RC2-40-CBC : 0), Properties ()
node:child_process:924
    throw err;
    ^

Error: Command failed: openssl pkcs12 -in /Users/anon/Workshop/redacted/server/etc/redacted.p12 -out /Users/anon/Workshop/redacted/server/etc/redacted.pem
    at checkExecSyncError (node:child_process:885:11)
    at execFileSync (node:child_process:921:15)
    at /Users/anon/Workshop/redacted/server/node_modules/@walletpass/pass-js/bin/passkit-keys:64:7
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/Users/anon/Workshop/redacted/server/node_modules/@walletpass/pass-js/bin/passkit-keys:58:4)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 9925,
  stdout: null,
  stderr: null
}

Node.js v20.4.0
tbergeron commented 11 months ago

It does generate an empty .pem file with the same filename as the origin .pem file and also generates a wwdr.pem file which does contain something but won't work anyway.

tbergeron commented 11 months ago

I edited the passkit-keys tool and added -legacy to the arguments and it worked!

Line 64 was changed with:

execFileSync('openssl', ['pkcs12', '-legacy', '-in', file, '-out', outputFile], {