|
|
Comments and Discussions
|
|
 |

|
thank you for the very useful article and sample code that works perfectly.
We are not able to export a private key (necessary for PKCS #12) due to govt. restrictions. Is there a certif other than pkcs #12 that can be used for the same purpose (eg pkcs 7) and used with some mods to your sample code?
thank you
Harvey
|
|
|
|

|
Can I do this program using vb.net??
|
|
|
|

|
Thank you so much for the code. Itextsharp being a free library is still such a useful software.
Cheers,
Kalpana Volety
PDF tools online
|
|
|
|

|
Hi,
I'm using your source files and the signature goes in fine, but when I open the file it says the signature isn't valid. Looks like you had someone else have this problem several years ago with a German version of Adobe. I'm using Adobe Acrobat X. Have you run into this problem with that version?
|
|
|
|
|

|
Hi,
How to change the program so that I can protect my PDF document with a password?
thank you
|
|
|
|

|
Hi,
Thank you for your application, I find it very useful.
My problem is when I try to select * certificated from the installed certificates list. I then click "OK" and "Process" but all I get is this error message from the console:
Checking certificate ...
Warning : No valid certificate found, please make sure you entered a valid certificate file and password
Exception : System.InvalidCastException: Impossible d'effectuer un cast d'un objet de type 'Org.BouncyCastle.Asn1.DerSequence' en type 'Org.BouncyCastle.Asn1.DerInteger'.
à Org.BouncyCastle.Asn1.Pkcs.Pfx..ctor(Asn1Sequence seq)
à Org.BouncyCastle.Pkcs.Pkcs12Store.Load(Stream input, Char[] password)
à Org.BouncyCastle.Pkcs.Pkcs12Store..ctor(Stream input, Char[] password)
à Org.Eurekaa.PDF.iSafePDF.Cert.processCert() dans C:\Users\dmusset\VS Projects\iSafePDF\Cert.cs:ligne 67
à Org.Eurekaa.PDF.iSafePDF.Cert..ctor(Byte[] rawData, String cpassword, String tsaURL, String tsaLogin, String tsaPwd) dans C:\Users\dmusset\VS Projects\iSafePDF\Cert.cs:ligne 126
à Org.Eurekaa.PDF.iSafePDF.Form1.ProcessBtn_Click(Object sender, EventArgs e) dans C:\Users\dmusset\VS Projects\iSafePDF\Form1.cs:ligne 133
==> Continue ... the document will not be signed !
On the other hand when I just "browse" to the original certificate file (in my case the demo file from http://v4.nwp.home.net.pl/digi-seal/demo+certificate.[^]
and enter the password, then I click "OK" and "Process", it works perfectly.
Do you know what might be wrong, and what I should do to be able to just select an installed certificate?
Thank you very much!
-David
|
|
|
|

|
Hi Alaa-eddine,
I get the NullReferenceException at line 228 in the "Sign" methode:
st.Close(); // NullReferenceException thrown (
Can u please help???
Thx
Andy
|
|
|
|

|
Your project is too good, but it can only sign a pdf which contain only one pages...do itext.ddl provide feature to sign a specified pages by user...if yes then how to do that
|
|
|
|

|
I'm having trouble getting the message 'Signer's identity is unknown...' message in the signature panel. I've tried the export method mentioned above, I've gone to Verisign's web site and downloaded a demo certificate but I still get the error. When I bring up the cert in the Certificate viewer I see three levels:
1. VeriSign Class 1 Public Primeary Certification Authority - G3
2. Verisign Class 1 Indvidual Subscriber CA - G3
3. My web sites URL
It says at the bottom that the selected certificate path is valid for all three of these. However when I go to the Trust tab is says the certificate is not trusted and all the option have a red 'X'.
Any ideas?
------------------------
Bernie Basel
bbasel@monlife.com
|
|
|
|

|
Hi people!
With the last version of itextsharp you must make any changes in the code of "class Metadata":
Change the Hashtable type by the System.Collections.Generic.Dictionary(of string, string), like below:
Private m_info As New System.Collections.Generic.Dictionary(Of String, String)
Public Property Info() As System.Collections.Generic.Dictionary(Of String, String)
Get
Return m_info
End Get
Set(ByVal value As System.Collections.Generic.Dictionary(Of String, String))
m_info = value
End Set
End Property
In adition to that, you must change the return type of the function getMetadata in the same class (Metadata) to the same type above.
I hope it can help...
See you!
|
|
|
|

|
I really hope that you can assit me. I find this iTextSharp very confusing, simply because I cant find any proper documentation.
I saved a PDF in SQL Database as blob. when I retrieve the data, I load it into a byte[].
1. Can I use iTextsharp to create a PDF file from this byte[]??????
2. Can I use iTextsharp to create an Image object of the byte[]?????
Your assistance will be highly appreciated
|
|
|
|

|
You can check the new version here http://isafepdf.eurekaa.org/news/[^]
Some new features :
- Customizable signature image
- Customizable signature text (will replace the default signature fields)
- drag / resize the signature blog inside a "fake" page preview
- better certificate interface
- ...
- some bugs fixes
Enjoy
|
|
|
|

|
HI,when i try to sign using a smart card.When i plug smart card into usb port,certificate is automatically added into store.when i select that certificate to sign,i am being prompted for a pin to access private key.When i enter private then a message is displayed "Key not valid for use of specified state." Can you help me?
|
|
|
|

|
hi,
i use your tool to sign my pdfs. this works fine. i use a pfx certificate and after signing i can see the signature in acrobat reader.
but if i install my certificate in windows and sign again then i can't see the signature in my pdf any more. but it is there!
when i open my pdf on another computer then i can see the signature again.
do you know what is going on here?
|
|
|
|
|

|
Hello All
I decided to write a new version with the most of features you asked for.
I make an open source program called iSafePDF, witch can signe, timestamp and encrypt PDF.
both binary and source code are available here : http://isafepdf.eurekaa.org[^]
I'll write a new article about it as soon as possible
|
|
|
|

|
HELP!
When I put two references of BouncyCastle.Crypto.dll and itextsharp.dll into same project, and want to use them in one CS file (exackly in ASPX webpage CS), then I have an error. What to do?
Error 1 Typ „Org.BouncyCastle.Crypto.AsymmetricKeyParameter” exist in „c:\Users\MindOnFire\AppData\Local\Temp\Temporary ASP.NET Files\agfawwwreporting\348944af\be5459e3\assembly\dl3\988ffe33\00c6574f_c3fec901\itextsharp.DLL” and „c:\Users\MindOnFire\AppData\Local\Temp\Temporary ASP.NET Files\agfawwwreporting\348944af\be5459e3\assembly\dl3\51b2a893\0082950a_6020ca01\BouncyCastle.Crypto.DLL” D:\Archive\AGFA\AGFAWWWReporting\Default.aspx.cs 225 13 D:\...\AGFAWWWReporting\
|
|
|
|

|
Hi,
nice tutorial and it works fine... but any idea how I can add a timestamp from a TSA, f.e. Verisign, to the signature?
|
|
|
|

|
Hi,
I ran into a problem trying to sign a pdf with an exported (pfx) certificate.
The pk12.getCertificateChain(alias) method returned null indicating that the alias was not found. Which is strange because the alias appears in the list of aliasses.
What turned out to be is that the alias that contains the private key was not the same alias that is required for obtaining the certificate chain.
I fixed it by iterating througt all aliases again and pick the first isCertificateEntry. When this alias is used with the getCertificateChain method all works fine.
private void processCert()
{
string alias = null;
//First we'll read the certificate file
PKCS12Store pk12 = new PKCS12Store(new FileStream(Path, FileMode.Open, FileAccess.Read), password.ToCharArray());
//then Iterate throught certificate entries to find the private key entry
IEnumerator i = pk12.aliases();
while (i.MoveNext())
{
alias = ((string)i.Current);
if (pk12.isKeyEntry(alias)) break;
}
//then Iterate throught certificate entries to find certificate on begin of chain
akp = pk12.getKey(alias).getKey();
i.Reset();
while (i.MoveNext())
{
alias = ((string)i.Current);
if (pk12.isCertificateEntry(alias)) break;
}
X509CertificateEntry[] ce = pk12.getCertificateChain(alias);
chain = new X509Certificate[ce.Length];
for (int k = 0; k < ce.Length; ++k) chain[k] = ce[k].getCertificate();
}
|
|
|
|

|
It is a great program. When I used the iTextSharp.dll come with your source code, everything works fine. But when I changed to the dll from the iTextSharp website. There are a lot of error, look a lot of the namespace, menthods are not there? Thank you if you can pointing out the difference ?
|
|
|
|

|
Hi,
I can use this example in a windows application.But I can't use in a windows services .
All properites or value is same.
I take this error
.MAC: Key cannot be null.
Parameter name: key
at org.bouncycastle.pkcs.PKCS12Store..ctor(Stream input, Char[] password)
at GetronPdfSigner.Cert.processCert() in D:\Projeler\Uygulamalar\GetronPdfSigner\GetronPdfSigner\PDFSigner.cs:line 62
..............
I take error in this line
pk12 = new PKCS12Store(new FileStream(this.Path, FileMode.Open, FileAccess.Read), this.password.ToCharArray());
Thank you
modified on Friday, June 26, 2009 6:28 AM
|
|
|
|

|
When i try to sign a pdf using windows certificate store & memory stream then i get the error as
Unable to cast object of type 'Org.BouncyCastle.Asn1.DerSequence' to type 'Org.BouncyCastle.Asn1.DerInteger'.
please help me out .
thanks in advance
|
|
|
|

|
Is there any pkcs#11 support ? I see that iText Java has some kind of support...
|
|
|
|

|
Just that... Any way to use HttpClientCertificate instead of a path file
|
|
|
|

|
how can I add a timestamp with itextsharp and the the code of this page,
example in http://blog.rubypdf.com/2007/08/22/digital-signature-and-timestamp-to-pdf-documents-with-itextsharp/
|
|
|
|

|
Hello all.
I'm trying running this code (signing pdf) on a web application, but allways get an error on the same place, and i tried 3 differents codes founds.
The pfx file is on server path and in accesible, and readable.
The error is always on close pdfstamper, throwing a NullException, but object "st" is not null:
// -------------------------------------------------------------------
public void Sign(string SigReason, string SigContact, string SigLocation, bool visible)
{
PdfReader reader = new PdfReader(this.inputPDF);
//Activate MultiSignatures
PdfStamper st = PdfStamper.CreateSignature(reader, new FileStream(this.outputPDF, FileMode.Create, FileAccess.Write), '\0', null, true);
st.MoreInfo = this.metadata.getMetaData();
st.XmpMetadata = this.metadata.getStreamedMetaData();
PdfSignatureAppearance sap = st.SignatureAppearance;
sap.SetCrypto(this.myCert.Akp, this.myCert.Chain, null, PdfSignatureAppearance.WINCER_SIGNED);
sap.Reason = SigReason;
sap.Contact = SigContact;
sap.Location = SigLocation;
if (visible)
sap.SetVisibleSignature(new iTextSharp.text.Rectangle(100, 100, 250, 150), 1, null);
st.Close(); <---- THIS LINE THROWS NULLEXCEPTION ERROR ON WEB APPLICATION !!!!!!
}
// -------------------------------------------------------------------
Any idea?
Thanks all.
|
|
|
|

|
hi...
I m signing multiple pages of a PDF document through iTextSharp.dll version 4.1, but as i open the PDF document it gives me a message in the Signature Panel that "At least one signature is invalid" i.e.
When i open the Signed PDF document the signatures are not verified.
And i read the Certificate from Token not from .pfx file.
Am i missing something....Ny solution,...
Anyone knows it how to do it...
Pleas help
modified on Saturday, April 11, 2009 7:36 AM
|
|
|
|

|
Is there a way to specify the page and position of the signature?
Thanks,
Daniel
|
|
|
|

|
How can I sign a pdf and make it pdf/a compatible? It seems not to work: the pdf is not pdf/a compatible anymore after signing. Is there a bug in iTextSharp?
Thanks,
Patrik
|
|
|
|

|
I am translating the excellent example in VB language. But i have some problems.
Could be possible to have the translation in vb language at least processCert method and its variables.
Thanks in advance.
|
|
|
|

|
Hi Alaa-eddine,
Could you make available a compiled executable of your code. I don't have tools to create it.
Thanks
|
|
|
|

|
Hi,
Can i get the expiry date fieild of the certificate..?
Like
PdfPKCS7.GetSubjectFields(pk.SigningCertificate).GetField("CN") will return the subject..
like the same is there any field name available to get the expiry date of the certificate?
Regards
Venkat
|
|
|
|

|
Hi,
I am new to this Digital Signature Concept.
In my project i need to implement Digital Signature for the PDF reports created through Crystal Reports.
I plan to use the method explained here. But i facing problem in installing the demo certificate.
I didn't get the exact link to download the certificate and install.
Kindly help me.
Regards
Sasi
|
|
|
|
|

|
how to signing the document with multiple key?
|
|
|
|

|
Hi i need like others here modifi the code to use a Cer for the windows storage, and look some class of the itextSharp library, and i look this when i use the pfx of my certificate an extrac the stringBase64 private key have differents values for modulus,p,q,d compared with the values returned ToXMLString method of System.Security.Cryptography.AsymmetricAlgorithm in .net, someone kwons why
as
|
|
|
|

|
Hello
I've test the code to read certificates stored in IE, but know i wish to know how to create an iTextSharpSign.Cert variable from the x509Certificate2 i got inside the foreach loop
|
|
|
|

|
I have just tried to sign a pdf with using a certificate exported from my Windows 2003 web server.
I choose the option export the private key, and set a password. However every time i try to sign a pdf i get the following exception:
Any ideas welcome.
Started ...
Checking certificate ...
Error : please make sure you entered a valid certificate file and password
|
|
|
|

|
Hi,
I want to add timestamps, email address, name at the end of pdf document after e-signature is applied.
Is there any suggestions how to do this using iTextSharp functions?
It's urgent...
Thanks in advance.
|
|
|
|

|
How to select certificate for sign from Windows X509 store?
|
|
|
|

|
Works perfect!
Code is clear and easy to understand.
Info: Need to modify a little the code if you use the latest version of iTextSharp because some names have changed (Org.BouncyCastle).
Merci
|
|
|
|

|
Hello,
The program signs the document by means of a signature in file, but I would like to know if someone can take like the certificate from windows.
Thank you.
|
|
|
|

|
How to sign with a card reader ?
the cert from card read, NOT from file.
please help me.
|
|
|
|

|
hi,
i can not sign with .cert files, i get
"Unable to cast object of type 'Org.BouncyCastle.Asn1.DerSequence' to type 'Org.BouncyCastle.Asn1.DerInteger'."
at
pk12 = new Pkcs12Store(new FileStream(this.Path, FileMode.Open, FileAccess.Read), this.password.ToCharArray());
please help..
EDiT: To sum up, i want to put a declaration to the PDF file that this PDF file is signed, by
the certificate (a .cer file). As .cer files have only public key (not private key) included,
i can't pass password as parameter. please help, so urgent!!!
modified on Friday, December 07, 2007 10:59:56 AM
|
|
|
|
|

|
How to use smartcard reader ?
|
|
|
|

|
myCert = new Cert(certTextBox.Text, passwordBox.Text);
The location and password of Cert is input from WinForm,
but i want dynamic read card reader and prompt a PIN screen .
How to do ?
Thanks very much.
John
|
|
|
|

|
Supported Signature Certificates..
What are other supported signature certificate types for signing a pdf using iText?
?.FDF {Acrobat FDF Data Exchange}
?.P7C {Certificate Message Syntax PKCS#7}
?.P7B {Cryptographic Message Syntax Standard}
?.CER {DER Encoded Binary X.509}
?.CER {Base 64 Encoded X.509}
?.P12 {Personal Information Exchange PKCS#12}
?.PFX {Personal Information Exchange PKCS#12}
You have shown the example to sign with .PFX, but, Could you explain how to sign a PDF with other types of certificates files using iText?
Thank you,
Nick K.
Regards,
Nick K.
Web: www.nk-inc.com
|
|
|
|

|
Hello KADDOURI,
do you know how Sign PDF Documents on the .NET Compact Framework? Exists alternatives to extract the hash compute with Private Key of Certificate on Compact Framework? The X509Certificate class doesn´t implement the method to extract this hash, do you have any ideia?
Please help me, thanks for all
Best Regards.
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
An example demonstrating how to sign PDF documents with the iTextSharp library.
| Type | Article |
| Licence | LGPL3 |
| First Posted | 17 Jun 2006 |
| Views | 268,730 |
| Downloads | 4,627 |
| Bookmarked | 109 times |
|
|