0 votes
by (220 points)

a: For specific certificate which has private key, the method loads the recipient and the certificate and property hasPriveteKey is true.

b: For another certificate which has private key, the method loads the recipient but not the certificate and property hasPriveteKey is false.

Both certificates are set for all purposes.

What are the cases for case b?

Thanks

by (220 points)
Fyi, passing Certificate finder to the envelopedata object and return from my Find implementation the correct certificate is ok.

1 Answer

0 votes
by (73.5k points)

When loading EnvelopedData the certificate is searched for in CertificateStoreName.My, CertificateStoreName.TrustedPeople and CertificateStoreName.AddressBook certificate stores (based on SubjectIdentifier.Type).

Is it possible that you do not have the certificate in any of those certificate stores?

Or is it possible that you have the certificate without key in one of those certificate stores?

If you post here your certificate finder implementation, we can spot some difference.

by (220 points)
edited by
Thank yiu for the answer, i have all my certificates imported in trusted cas local machine. I guess it should find none. But it finds some of them. But implementing my cert finder i search specific store so it works.
...