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

Pkcs7-Mime not seeing Certificate Password? #374

Closed
DBenS opened this issue Feb 15, 2018 · 4 comments
Closed

Pkcs7-Mime not seeing Certificate Password? #374

DBenS opened this issue Feb 15, 2018 · 4 comments

Comments

@DBenS
Copy link

DBenS commented Feb 15, 2018

I left a huge message in StackOverflow to see if I get some help...
https://stackoverflow.com/questions/48815536/mimekit-error-with-self-signed-certificate

Basically, when I sign a message using a Self-Signed Certificate, I receive an error from the function Pkcs7Sign (as shown in Documentation) saying: The provider can not perform the action because the context was acquired as silent

But:

  1. It does not. I provide a "SignedCMS.ComputeSignature(signer, false)" command, which ask me the correct password of the Certificate.

  2. When using the same approach with a Certisign Token A3, everything goes ok.

Do you have any advice?

I appreciate your attention.
Kind regards.

@jstedfast
Copy link
Owner

MimeKit calls cms.ComputeSignature (signer); it doesn't pass true or false to the ComputeSignature method. Normally, for API's like this, the default value is false, but I guess it's not in this case.

jstedfast added a commit that referenced this issue Feb 15, 2018
@DBenS
Copy link
Author

DBenS commented Feb 15, 2018

Yes, you are almost 100% right - the fact is that the default of ComputeSignature is TRUE (not asking for a password).

In my case, cms.Signature must be called with FALSE as second parameter to obtain the password of a certificate.

I believe it should be an enhancement in the ApplicationPkcs7Mime.Sign function, I mean, get a parameter to obly cms.Computesignature to be FALSE.

I'm making this manually before this function but, I don't know why, the application is not seeing the password as it sees when I utilize Certisign/Token (not a self-signed certificate but a real one).

@jstedfast
Copy link
Owner

I have no idea what you are saying. The problem is with the WindowsSecureMimeContext and I fixed it above.

@DBenS
Copy link
Author

DBenS commented Feb 15, 2018

Ok, it solves my problem.
Thank you very much for your attention.
I'll download the code right now.

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