----- Original Message ----- From: "Eliasen Jan" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, May 23, 2006 10:05 PM
Subject: RE: [iText-questions] Signing a PDF file with a digital signature


I now have this working:

string alias = null;
PKCS12Store pk12 = new PKCS12Store(new FileStream(@"D:\Work\Projekter\DubliNet\Sikkerhed\Certifikatet\PrivateKeyWithCert.p12",
FileMode.Open, FileAccess.Read), "TooHot4u".ToCharArray());
IEnumerator i = pk12.aliases();
while (i.MoveNext())
{
alias = ((string)i.Current);
if (pk12.isKeyEntry(alias))
break;
}
AsymmetricKeyParameter akp = pk12.getKey(alias).getKey();
X509CertificateEntry[] ce = pk12.getCertificateChain(alias);
X509Certificate[] chain = new X509Certificate[ce.Length];
for (int k = 0; k < ce.Length; ++k)
chain[k] = ce[k].getCertificate();
PdfReader reader = new PdfReader(@"D:\Work\Projekter\DubliNet\Blanketter\20050104 InfoRequest filled out.pdf");
PdfStamper st = PdfStamper.CreateSignature(reader, new
FileStream(@"D:\Work\Projekter\DubliNet\Blanketter\20050104 InfoRequest filled out SIGNED.pdf", FileMode.Create, FileAccess.Write), '\0');
PdfSignatureAppearance sap = st.SignatureAppearance;
sap.SetCrypto(akp, chain, null, PdfSignatureAppearance.WINCER_SIGNED);
sap.Reason = "I am approving this document";
sap.Location = "Denmark";
sap.SetVisibleSignature(new iTextSharp.text.Rectangle(50, 75, 250, 150), 1, null);
st.Close();


But once the document has been signed, a user can still edit the form. I need this to be disabled. How can I do that?


After creating the stamper call setEncryption().

And what are the WINCER_SIGNED, SELF_SIGNED and VERISIGN_SIGNED options?


Not all signatures are born equal, there are many variants.

Paulo

Thanks in advance.

Med venlig hilsen
________________________________________
Jan Eliasen

WM-data
Fredrik Bajers Vej 1
9220  Aalborg Øst
Tel.: +45 9630 5800, direkte: +45 9630 5818
Mobil: +45 2518 8024, fax: +45 9630 5805
mailto: [EMAIL PROTECTED]
http://www.wmdata.dk


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eliasen Jan
Sent: 23. maj 2006 22:51
To: [email protected]
Subject: RE: [iText-questions] Signing a PDF file with a digital signature

Hi

Using this code:
X509CertificateParser p = new X509CertificateParser(new FileStream(@"D:\Work\Projekter\DubliNet\Sikkerhed\Certifikatet\PrivateKey.p12", FileMode.Open, FileAccess.Read)); X509Certificate x = p.ReadCertificate();

I get a System.ArgumentException in the second line. Aditional information: unknown object in factory

Using this code:
string alias = null;
PKCS12Store pk12 = new PKCS12Store(new FileStream(@"D:\Work\Projekter\DubliNet\Sikkerhed\Certifikatet\PrivateKey.p12", FileMode.Open, FileAccess.Read), "TooHot4u".ToCharArray()); IEnumerator i = pk12.aliases(); while (i.MoveNext()) {
alias = ((string)i.Current);
if (pk12.isKeyEntry(alias))
break;
}
AsymmetricKeyParameter akp = pk12.getKey(alias).getKey();

I get an InvalidCastException in the last line. Additional information: Specified cast is not valid. The "pk12.isKeyEntry(alias) returns true on the first iteration on i.

Med venlig hilsen
________________________________________
Jan Eliasen

WM-data
Fredrik Bajers Vej 1
9220  Aalborg Øst
Tel.: +45 9630 5800, direkte: +45 9630 5818
Mobil: +45 2518 8024, fax: +45 9630 5805
mailto: [EMAIL PROTECTED]
http://www.wmdata.dk


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paulo Soares
Sent: 23. maj 2006 16:07
To: [email protected]
Subject: RE: [iText-questions] Signing a PDF file with a digital signature

What error do you get and in what part of the code?

Paulo

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Eliasen Jan
Sent: Tuesday, May 23, 2006 2:54 PM
To: [email protected]
Subject: RE: [iText-questions] Signing a PDF file with a digital
signature

Hi

Thanks! But I can't seem to get it to work... I have a certificate
which is a .p12 file - and I can not seem to get it to work.

I have tried both the non-WSE approaches from the link you have
provided, replacing the certificate file in the code with my .p12
file. But it doesn't seem to work in either case.

Any thoughts? Are .p12 files not supported? Or have I just not
understood how I should load it?

Thanks in advance!

Med venlig hilsen
________________________________________
Jan Eliasen

WM-data
Fredrik Bajers Vej 1
9220  Aalborg Øst
Tel.: +45 9630 5800, direkte: +45 9630 5818
Mobil: +45 2518 8024, fax: +45 9630 5805
mailto: [EMAIL PROTECTED]
http://www.wmdata.dk


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Paulo Soares
Sent: 22. maj 2006 01:28
To: [email protected]
Subject: Re: [iText-questions] Signing a PDF file with a digital
signature

http://article.gmane.org/gmane.comp.windows.dotnet.itextsharp.
general/12

Paulo

----- Original Message -----
From: "Eliasen Jan" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Sunday, May 21, 2006 9:52 PM
Subject: [iText-questions] Signing a PDF file with a digital signature


Hi

I have been looking at http://itextpdf.sourceforge.net/howtosign.html
because I need to sign a PDF file programatically.

BUT, I need to do it using c# - so I have downloaded the iTextSharp
version 3.1.0 dll, and am trying to use it. But the classes used in
http://itextpdf.sourceforge.net/howtosign.html do not seem to appear
in this dll - or am I wrong?

Can anyone point me in the right direction? How do I sign a PDF file
using C#?

Thanks in advance!

Med venlig hilsen
________________________________________
Jan Eliasen

WM-data
Fredrik Bajers Vej 1
9220  Aalborg Øst
Tel.: +45 9630 5800, direkte: +45 9630 5818
Mobil: +45 2518 8024, fax: +45 9630 5805
mailto: [EMAIL PROTECTED]
http://www.wmdata.dk





-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services,
security?
Get stuff done quickly with pre-integrated technology to make your job
easier Download IBM WebSphere Application Server v.1.0.1 based on
Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&;
dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services,
security?
Get stuff done quickly with pre-integrated technology to make your job
easier Download IBM WebSphere Application Server v.1.0.1 based on
Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=k&kid0709&bid&3057&dat1642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions



Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem.

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message.

Rȧ:&q[yhv^yhipyzr!n}hꮉ%ފ{^y^r薈2쨺m欉ã 塧HŞm*azbqbt]5mv!xgxmzVږF\ОIt
jjyyrrzyqjJjj}j
jjyyrrzyqjJjj}j



-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to