Hello,

I have tried to sign a pdf for several days now, but cannot get it to work.
I am using itextsharp 5.0.0.

I have code for signing a pdf with an external TSA:

In this code I get the Timestamp with the following code:

byte[] timeStampToken =X509Utils.GetTimestampToken(TsaServerUrl, null, null,
timeStampHash);


Now I want to create the timestamp myself for testing purposes, so I
replaced the above line with:

System.Security.Cryptography.X509Certificates.X509Certificate2 WinCert =  
GetCertificate();
Org.BouncyCastle.X509.X509Certificate cert =
                    DotNetUtilities.FromX509Certificate(WinCert);

AsymmetricKeyParameter key =
                   
DotNetUtilities.GetRsaKeyPair((RSACryptoServiceProvider)WinCert.PrivateKey).Private;

TimeStampTokenGenerator TokenGen = new TimeStampTokenGenerator(
                    key, cert, TspAlgorithms.Sha1, "1.2");

TimeStampResponseGenerator RespGenerator =
                    new TimeStampResponseGenerator(TokenGen,
TspAlgorithms.Allowed);

TimeStampResponse response = RespGenerator.Generate(
                                                request, cert.SerialNumber,
DateTime.UtcNow);
byte[] timeStampToken = response.TimeStampToken.GetEncoded();


But this does not work as expected. In the first case AdobeReader shows that
all is correct, but in the second case AdobeReader shows that there is a
problem with validating the certificate. AdobeReader also does not recognize
that there is a timestamp there.

Anybody who knows how to create the TimeStampToken correctly?

Regards,

Alex

-- 
View this message in context: 
http://old.nabble.com/Sign-PDF-with-Timestamp-tp28081120p28081120.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to