1

I successfully obtained a Timestamp from a tsa server (RFC 3161) and i've created the following Object using bouncyCastle:

TimeStampedData timeStampedData = new TimeStampedData(uri, null, asn1OctetString, evid);

How can i save this structure to a file (.tsr or .tsd) with RFC 5544 specifications?

I've looked for this all over the bouncycaste wiki and also asked in their forum but i received no answer.

Thank you

4

1 回答 1

0

由于 RFC 5544 基于 CMS 对象,您需要使用 RFC 中定义的带时间戳的数据对象标识符将该TimeStampedData对象包装成一个。ContentInfo

您应该致电:

TimeStampedData timeStampedData = new TimeStampedData(uri, null, asn1OctetString, evid);
ContentInfo contentInfo = new ContentInfo(CmsObjectIdentifiers.timestampedData, timeStampedData);
Byte[] fileData = contentInfo.GetEncoded();

然后将这个字节数组存储到一个文件中。

于 2014-02-05T23:37:36.153 回答