2 * IPRT - Crypto - Time-Stamp Protocol (RFC-3161).
6 * Copyright (C) 2006-2024 Oracle and/or its affiliates.
8 * This file is part of VirtualBox base platform packages, as
9 * available from https://www.virtualbox.org.
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation, in version 3 of the
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 * The contents of this file may alternatively be used under the terms
25 * of the Common Development and Distribution License Version 1.0
26 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
27 * in the VirtualBox distribution, in which case the provisions of the
28 * CDDL are applicable instead of those of the GPL.
30 * You may elect to license modified versions of this file under the
31 * terms and conditions of either the GPL or the CDDL or both.
33 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
36 #ifndef IPRT_INCLUDED_crypto_tsp_h
37 #define IPRT_INCLUDED_crypto_tsp_h
38 #ifndef RT_WITHOUT_PRAGMA_ONCE
42 #include <iprt/asn1.h>
43 #include <iprt/crypto/x509.h>
48 /** @defgroup grp_rt_cr_tap RTCrTap - Time-Stamp Protocol (RFC-3161)
49 * @ingroup grp_rt_crypto
55 * RFC-3161 MessageImprint (IPRT representation).
57 typedef struct RTCRTSPMESSAGEIMPRINT
60 RTASN1SEQUENCECORE SeqCore
;
61 /** The digest algorithm used to produce HashedMessage. */
62 RTCRX509ALGORITHMIDENTIFIER HashAlgorithm
;
63 /** The digest of the message being timestamped. */
64 RTASN1OCTETSTRING HashedMessage
;
65 } RTCRTSPMESSAGEIMPRINT
;
66 /** Pointer to the IPRT representation of a RFC-3161 MessageImprint. */
67 typedef RTCRTSPMESSAGEIMPRINT
*PRTCRTSPMESSAGEIMPRINT
;
68 /** Pointer to the const IPRT representation of a RFC-3161 MessageImprint. */
69 typedef RTCRTSPMESSAGEIMPRINT
const *PCRTCRTSPMESSAGEIMPRINT
;
70 RTASN1TYPE_STANDARD_PROTOTYPES(RTCRTSPMESSAGEIMPRINT
, RTDECL
, RTCrTspMessageImprint
, SeqCore
.Asn1Core
);
74 * RFC-3161 Accuracy (IPRT representation).
76 typedef struct RTCRTSPACCURACY
79 RTASN1SEQUENCECORE SeqCore
;
80 /** The seconds accuracy.
81 * This will be larger than 0. If 1 inspect the Millis field. */
82 RTASN1INTEGER Seconds
;
83 /** The millisecond accuracy, optional, implicit tag 0.
84 * Range 1..999. If 1 inspect the Micros field. */
86 /** The microsecond accuracy, optional, implicit tag 1.
90 /** Pointer to the IPRT representation of a RFC-3161 Accuracy. */
91 typedef RTCRTSPACCURACY
*PRTCRTSPACCURACY
;
92 /** Pointer to the const IPRT representation of a RFC-3161 Accuracy. */
93 typedef RTCRTSPACCURACY
const *PCRTCRTSPACCURACY
;
94 RTASN1TYPE_STANDARD_PROTOTYPES(RTCRTSPACCURACY
, RTDECL
, RTCrTspAccuracy
, SeqCore
.Asn1Core
);
98 * RFC-3161 TSTInfo (IPRT representation).
100 typedef struct RTCRTSPTSTINFO
102 /** Sequence core. */
103 RTASN1SEQUENCECORE SeqCore
;
104 /** The structure version number, current only 1 is valid. */
105 RTASN1INTEGER Version
;
106 /** Time authority policy. */
108 /** The message imprint. */
109 RTCRTSPMESSAGEIMPRINT MessageImprint
;
110 /** Timestamp request serial number. */
111 RTASN1INTEGER SerialNumber
;
112 /** The timestamp. */
114 /** The timestamp accuracy, optional. */
115 RTCRTSPACCURACY Accuracy
;
116 /** Ordering, whatever that means, defaults to FALSE. */
117 RTASN1BOOLEAN Ordering
;
118 /** Nonce, optional. */
120 /** Timestamp authority name, explicit optional.
121 * (Should match a name in the certificate of the signature.) */
124 /** Context tag 0. */
125 RTASN1CONTEXTTAG0 CtxTag0
;
127 RTCRX509GENERALNAME Tsa
;
129 /** Extensions, optional, implicit tag 1. */
130 RTCRX509EXTENSION Extensions
;
132 /** Pointer to the IPRT representation of a RFC-3161 TSTInfo. */
133 typedef RTCRTSPTSTINFO
*PRTCRTSPTSTINFO
;
134 /** Pointer to the const IPRT representation of a RFC-3161 TSTInfo. */
135 typedef RTCRTSPTSTINFO
const *PCRTCRTSPTSTINFO
;
136 RTASN1TYPE_STANDARD_PROTOTYPES(RTCRTSPTSTINFO
, RTDECL
, RTCrTspTstInfo
, SeqCore
.Asn1Core
);
138 /** The object identifier for RTCRTSPTSTINFO.
139 * Found in the ContentType field of PKCS \#7's ContentInfo structure and
140 * the equivalent CMS field. */
141 #define RTCRTSPTSTINFO_OID "1.2.840.113549.1.9.16.1.4"
147 #endif /* !IPRT_INCLUDED_crypto_tsp_h */