Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature to extract all certificates and private keys from pfxData. #8

Closed
wants to merge 1 commit into from

Conversation

lpusok
Copy link

@lpusok lpusok commented Jul 9, 2019

pfxData can contain more than one private key. One use case is exporting multiple codesigning certificates from macOS Keychain to one .p12 file. Would like to support this or any other use case when any number of certificates and private keys are present. Additional validation on the number of certificates and private keys is left to the user of the DecodeAll function.

Added DecodeAll function.
Changed DecodeChain to call DecodeAll, retaining the existing validation.

pfxData can contain more than one private key. One use case is exporting multiple
codesigning certificates from macOS Keychain to one .p12 file.
Would like to support this use case.

Changed DecodeChain to call DecodeAll, retaining the existing validation.
@lpusok
Copy link
Author

lpusok commented Sep 4, 2019

Hello @AGWA,
Did you maybe have a chance to have a look? Let me know if you have any questions.
Thanks.

@lpusok
Copy link
Author

lpusok commented Jan 6, 2020

Hi @AGWA,
Can you please have a look?
Thank you.

@eksrha
Copy link

eksrha commented Jul 19, 2021

Hi, does anyone have an update on this PR?
Thanks

@AGWA
Copy link
Member

AGWA commented Jul 19, 2021

This PR is currently blocked on someone providing an example PKCS#12 file that can be used as a test case.

@eksrha
Copy link

eksrha commented Jul 22, 2021

Briefly for info @AGWA:
Fortunately I made it with the 'DecodeChain' method, because I have a complete chain of certificates.

@AGWA
Copy link
Member

AGWA commented Jul 15, 2023

Reading through the linked issues, it sounds like all of the problems were caused by people using Decode when they should have been using DecodeChain, or by making a mistake when exporting from the macOS Keychain.

Therefore I'm going to close this PR, but anyone who needs to decode a PKCS#12 file with multiple keys can open a new issue containing a description of the use case and an example PKCS#12 file.

@ofalvai
Copy link

ofalvai commented Aug 15, 2023

Hey everyone!
We at Bitrise still maintain our fork that adds this DecodeAll() feature because our use-case requires correctly parsing all user-provided PKCS files. The fork lives at https://github.com/bitrise-io/go-pkcs12

@AGWA the updated PR implementing this feature has a test p12 file you want to take a look. I created this file using macOS keychain (selecting multiple items, then clicking export): https://github.com/bitrise-io/go-pkcs12/pull/1/files#diff-682508f50871e0878ce2c00e0a6c9627f9dc9f32a8754ef3311c1f7e8a50b4c6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants