Welcome Guest Search | Active Topics | Sign In | Register

PdfSigner ctor error Options
Sergey
Posted: Thursday, May 21, 2015 4:26:25 AM
Rank: Newbie
Groups: Member

Joined: 5/21/2015
Posts: 3
Good day
We have your licensed product Eo.PDF for .Net
VS 2012, .Net 4.0, C#

I tried to sign pdf by selfsigned certificate
code:

// get certificate
X509Certificate2 cert=GetCertificate();
//Create a PdfSigner object
PdfSigner signer = new PdfSigner(cert );

the PdfSigned ctor throws error : "Unable to load certificate data. Please check if the password is correct."

The certificate is created without password.
But i tried this code with certificates with password also. In this case i got error: "Unable to load certificate data. Please check if the password is correct."

Also i tried use iTextSharp with same certificates and it worked good.

What is wrong in using PDFSigner ?







eo_support
Posted: Monday, May 25, 2015 9:26:26 AM
Rank: Administration
Groups: Administration

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

Please update to the latest build and use either of these two constructors:

Code: C#
//Load the certificate from file
PdfSigner signer = new PdfSigner(fileName, password);


Or

Code: C#
//Load the certificate from byte array
PdfSigner signer = new PdfSigner(byte[], password);


These two versions work with the certificate data directly and it would bypass Windows certificate management. Please let us know if this works for you.

Thanks!
Sergey
Posted: Monday, May 25, 2015 10:43:06 AM
Rank: Newbie
Groups: Member

Joined: 5/21/2015
Posts: 3
Hi
I updated through nuget to version 6.0.36.2
Tried use constructor :
Code: C#
PdfSigner signer = new PdfSigner(byte[], password);


It's compiled, but then i try to run ,I get exception: {"Method not found: 'Void EO.Pdf.PdfSigner..ctor(Byte[], System.String)'."}
After that i tried to use the second constructor:
Example:

Code: C#
// create certificate
byte[] binCertData = clsDCUCertificatesFabric.CreateSelfSignCertificatePfx("CN=aaa", DateTime.Today, DateTime.Today, "123456123456123456");

// just for test: create certificate from binary data
X509Certificate2 cert2 = new X509Certificate2(binCertData, "123456123456123456", X509KeyStorageFlags.Exportable); // works good
            
// save certificate to file
string fileName = @"c:\cert.pcx";
File.WriteAllBytes(fileName, binCertData);
            
// try to load signer with certificate data
PdfSigner signer = new PdfSigner(fileName, "123456123456123456");;


Exception on PdfSigner constructor: "The specified network password is not correct."
eo_support
Posted: Monday, May 25, 2015 11:14:07 AM
Rank: Administration
Groups: Administration

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

Can you try to create a test project and send the test project to us? Please include a test certificate file as well so that we can try to run it here to see what we can find. Please see here for instructions on how to send test file to us:

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

Thanks!
Sergey
Posted: Tuesday, May 26, 2015 3:45:47 AM
Rank: Newbie
Groups: Member

Joined: 5/21/2015
Posts: 3
Good day

Thank you for your help. After your posts i decided to check: may be possibly there is old EO.PDF.Dll and my projects always after start refer to this dll instead new dll. And I found it (EO.PDF.Dll - ver 29). Removed from disk , and now everything is ok.

Best regards
Sergey
eo_support
Posted: Tuesday, May 26, 2015 9:43:34 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,066
Great. Glad to hear that it works for you!


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.