EldoS | Feel safer!

Software components for data protection, secure storage and transfer

accessing the timestamp in a pkcs#7 *.tsr file

Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages
Posted: 01/27/2010 07:45:19
by Christoph Moar (Standard support level)
Joined: 08/28/2009
Posts: 46

Seems like today is my forum day. Sorry, I hope my questions are of help for others, too. The next issue I came around is the following:

I have
- a container with a document and its signatures (*.p7m) file
- a detached timestamp (*.tsr) file which basically signs and timestamps the p7m file

I would like to read in the *.tsr file, loop over the signatures in there and display some timestamp information.

So my approach would be:
1. MIME decode the tsr file
2. TElSignedCMSMessage and Open() the tsr file (do as if this is a p7s file)
3. For each Signature in there
4. Get the timestampCount
5. For each timestamp in there
6. Get the TElClientTSPInfo to retrieve all timestamp informations.

I believe this should be correct?
The problem is that these *.tsr files are somewhat different from a normal *.p7s file? The old toolkit I was using had special methods for opening and inspecting them. I attach one of these timestamp files, maybe you can point me into the right direction?

Posted: 01/27/2010 07:49:42
by Christoph Moar (Standard support level)
Joined: 08/28/2009
Posts: 46

The following zip archive contains:

- the sample p7m file (a document + signatures)
- the tsr file (=signature of p7m file + timestamp)
- the tsr file mime-decoded (*.tmp)

Wait, now I see: maybe I should use

[ Download ]
Posted: 01/27/2010 09:30:46
by Christoph Moar (Standard support level)
Joined: 08/28/2009
Posts: 46

Hmmm. It still does not work.
I instantiate a TElFileTSPClient object.

Then i use aMessage->TSPInfo->ParseCMS(aArray) to read in the *.tsr file I have containing the timestamp response.

The method seems to process things for a few seconds, then it returns -1 and the tspinfo object does not contain any useful data.

Can you hint me as to what I am doing wrong here?
What is error code -1 on ParseCMS() meaning?
Why can't I read a *.tsr file this way?

Posted: 01/27/2010 09:45:30
by Ken Ivanov (Team)

You can pass the timestamp contained in the T000003356.TXT.p7m.tsr.tmp file to the constructor of TElCMSTimestamp class:

TSP := TElCMSTimestamp.Create(nil, BufTSP);

Then you can browse the information contained in the timestamp using the properties of TElCMSTimestamp object.
Posted: 01/27/2010 15:01:45
by Christoph Moar (Standard support level)
Joined: 08/28/2009
Posts: 46

Thanks, that was the solution.
Your library is so extensive that the only hard part is finding the right approach sometimes ;)

Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.



Topic viewed 3460 times



Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!