MySQL或Oracle中的TimeStampToken存储?

时间:2015-02-27 10:49:53

标签: mysql oracle timestamp bouncycastle rfc3161

我使用基于java的客户端获取TimeStampToken(RFC3161)。
我需要将TSTInfo中包含的所有信息存储在数据库,MySql或Oracle中。是否有任何特定的格式来存储它?

2 个答案:

答案 0 :(得分:1)

这种事情没有指定格式 1

但是有一些显而易见的选择让人想起:

  • 将DER编码的表格存储为BLOB。

  • 采用DER编码形式,base-64编码并将其存储在CHAR(n)列中。

  • 创建一个包含列的表来表示TSSInfo结构的每个字段...假设您已在解码它。

  • 使用Java序列化协议,XML,JSON等序列化Java对象表示。

  • 依此类推。


1 - 实际上,根据Wikipedia,ASN.1的编码称为XER,使用XML表示。

答案 1 :(得分:0)

请注意,如果您只存储 TSTInfo,则会丢失签名,这就是拥有 RFC3161 令牌的全部意义所在。没有签名的 TSTInfo 什么也证明不了!

为了保留其证据属性,您确实应该存储整个时间戳标记(定义为包装 TSTInfo 的签名 CMS ContentInfo)。

就使用什么格式而言,RFC3161 规范 (https://tools.ietf.org/html/rfc3161) 的第 3.2 章可能会有所帮助(尽管这只是一个建议):

3. Transports

   There is no mandatory transport mechanism for TSA messages in this
   document.  The mechanisms described below are optional; additional
   optional mechanisms may be defined in the future.

[...]

3.2. File Based Protocol

   A file containing a time-stamp message MUST contain only the DER
   encoding of one TSA message, i.e., there MUST be no extraneous header
   or trailer information in the file.  Such files can be used to
   transport time stamp messages using for example, FTP.

因此,我会将 DER 编码的 CMS ContentInfo(不是 TSTInfo)存储为 BLOB