Welcome Guest Search | Active Topics | Sign In | Register

Key no valid? Options
herrozerro
Posted: Thursday, April 21, 2016 4:32:19 PM
Rank: Newbie
Groups: Member

Joined: 4/21/2016
Posts: 3
Hello all!

I am looking into a solution for my company for pdf signing. I have tried to use EO, but I keep running into issues.

here is my code:

var cert = new X509Certificate2(@"C:\cert.pfx", "password");
var s = new PdfSigner(cert);
s.Sign(@"C:\test.pdf");

and the error:

An exception of type 'System.Security.Cryptography.CryptographicException' occurred in mscorlib.dll but was not handled in user code
Additional information: Key not valid for use in specified state.

I have tried a few other libraries and it seems to work, but I just wanted to see how this one stacked up against EO.

thanks!
eo_support
Posted: Thursday, April 21, 2016 4:42:48 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

Have you tried this constructor of PdfSigner yet?

http://www.essentialobjects.com/doc/eo.pdf.pdfsignerconstructor3.aspx

Here you would pass your certificate file name ans password directly to the PdfSigner class instead through a X509Certificate2 object.

Please let us know if this works for you.

Thanks!
herrozerro
Posted: Thursday, April 21, 2016 4:49:37 PM
Rank: Newbie
Groups: Member

Joined: 4/21/2016
Posts: 3
Yeah, I have tried both constructors. Both give the same error.
eo_support
Posted: Friday, April 22, 2016 9:01:47 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

Can you try a self signed test certificate and see if it works? If that still does not work, please try to isolate the problem into a test project and send the test project to us. See here for more information on how to send test project to us:

http://www.essentialobjects.com/forum/topics3_Support.aspx

Once we have that we will investigate further.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.