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

Unable to parse Code Signing Certificate for Microsoft #34

Open
tehmoon opened this issue May 28, 2018 · 4 comments
Open

Unable to parse Code Signing Certificate for Microsoft #34

tehmoon opened this issue May 28, 2018 · 4 comments

Comments

@tehmoon
Copy link

tehmoon commented May 28, 2018

Hi!

First off, many thanks for taking the time to do this useful lib!!

For a side project, I was trying to parse certificates inside exe files -- PE format -- to get the expiration date.

I'll skip the details on how to do it, but it turns out it's using PKCS7 format to store the certificate chain, hence the use of this lib.

When I call Parse() with the payload in DER this is what I get:

structure error: tags don't match (4 vs {class:0 tag:16 length:23 isCompound:true}) {optional:false explicit:false application:false defaultValue:<nil> tag:<nil> stringType:0 timeType:0 set:false omitEmpty:false} unsignedData @2

I had to patch the library and can make a PR if that's necessary: tehmoon@8f12946

As you can see, I de-serialize using RawValue and passing the underlying bytes. I didn't dig much further so I have no idea what's wrong.

I've attached the pkcs7 data in hex string format: data.hex.txt

Even though the patch works well for me, I thought about opening an issue to contribute a little bit.

@atvaccaro
Copy link

Not sure if you're still around, but I still get the same error message with the patch.

@tehmoon
Copy link
Author

tehmoon commented Feb 14, 2019

@atvaccaro yes still around! Could you tell me more about still get the same error message please? If you could share the data that is being parse that would be cool.

@atvaccaro
Copy link

Whoops, just went on vacation! I'd been getting the tags don't match error. I ended up just using golang.org/x/crypto/pkcs12 and switching to a PKCS12 file.

@tehmoon
Copy link
Author

tehmoon commented Feb 27, 2019

OK! let me know if you switch back to pkcs7 for some reason :p

chrisccoulson pushed a commit to chrisccoulson/pkcs7 that referenced this issue Apr 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants