Closed fabiancook closed 1 year ago
Hi @fabiancook, thank you very much for your issue! It is very precious for passkit-generator.
So, if I understand correctly, some tools are still generating the P12 in a "legacy mode" (RC2-40-CBC) and newer OpenSSL versions might, therefore, require the -legacy
flag to parse them correctly.
That's fine, but there are still a few things that are not yet clear to me and that I'd like to ask you (if you have any clue) so we can document it better on wiki:
1) Were you using MacOS Ventura to generate the PKCS#12 file, or were you following the "terminal steps"?
2) If the answer to question one is "terminal", what happens if you generate it with Ventura?
3) Do you perhaps have any idea on how could we identify which kind of algorithm has been used on PKCS#12? So we can indicate whether one should add the legacy flag.
Thank you!
EDIT: Maybe we might use this command? Do you have a certificate that does not require -legacy
perhaps?
I was using the "Keychain Access" on macOS Ventura application to generate the p12 file
... I can say that I have fully integrated since posting this issue and am able to generate passes perfectly!
![image](https://github.com/alexandercerutti/passkit-generator/assets/4337080/5f777f02-3917-414b-ae92-6051780bf215)
Sorry @fabiancook but I didn't quite get what you mean by "I can say that I have fully integrated since posting this".
I was meaning I had got this working for my use case and that the keys/certs created using -legacy
worked on my machine with this module.
For questions 2 + 3 I would be taking a step back in the process to generate them again.
I will make some attempts later if you are not able to do them.
I tried the docs for "Generate certificates through Terminal" and didn't get errors running those commands, but I can't spot where the p12 file is generated from terminal?
e.g . there are these two commands listed in step 8/9 here https://github.com/alexandercerutti/passkit-generator/wiki/Generating-Certificates#generate-certificates-through-terminal
openssl x509 -inform DER -outform PEM -in pass.cer -out signerCert.pem
openssl x509 -inform DER -outform PEM -in pass.cer -out wwdr.pem
Is this what you were meaning? I get signerCert.pem.... but isn't there meant to be a cert and key?
@fabiancook you are right, I forgot steps through terminal do not involve P12 creation 😅
So what we are saying is that Keychain Access on Ventura is not yet updated to work through the new algorithm and that version of OpenSSL, isn't it?
p.s. I have LibreSSL installed on my system, so I don't know the differences there.
Correct.
Going through the Keychain Access process on Ventura, and exporting the p12 key of the private key + certificate together, from Keychain Access, requires the use of -legacy
when creating the .pem
files based on the .p12
file exported.
I think we should try to create, if possible, a p12 starting from a cert and a key through OpenSSL/LibreSSL and check the algorithm it gets signed with and check what the info command reports. So by doing this way we are able to discriminate the case.
Okay, I've tried to install OpenSSL 3.1.2 and attempted to pack a P12.
This is a comparison between a PKCS12 I obtained in the previous months (but also one that I tried to generate through LibreSSL) and a new one I tried to create through my signerCert.pem
and my signerKey.pem
.
So I guess we could write in the wiki that:
1) To check the OpenSSL / LibreSSL version. OpenSSL >v3.0.0 added this change in 2021 (version's changelog) while LibreSSL didn't (yet?) (changelog)
2) Add -legacy
if using an OpenSSL > v3.0.0 and if the p12 generated is encrypted through RC2-CBC
What do you think?
I've updated the wiki! Let me know what you think of it! Here, on step 7, I've added a link to a whole new paragraph: https://github.com/alexandercerutti/passkit-generator/wiki/Generating-Certificates#generate-certificates-through-macos
Running OS
macOS Ventura 13.4.1
Running
Nodeopenssl VersionDescription
Using the instructions provided here: https://github.com/alexandercerutti/passkit-generator/wiki/Generating-Certificates
On macOS Ventura you get back the output:
Expected behavior
For the
.pem
file to be created as per the stepsSteps to reproduce
Running:
Updated steps:
Source
The
.pem
exports after using-legacy
Other info:
Hope this helps anyone else running into this!