1 | /** @file
|
---|
2 | * IPRT - Crypto - Time-Stamp Protocol (RFC-3161).
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2019 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef IPRT_INCLUDED_crypto_tsp_h
|
---|
27 | #define IPRT_INCLUDED_crypto_tsp_h
|
---|
28 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
29 | # pragma once
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #include <iprt/asn1.h>
|
---|
33 | #include <iprt/crypto/x509.h>
|
---|
34 |
|
---|
35 |
|
---|
36 | RT_C_DECLS_BEGIN
|
---|
37 |
|
---|
38 | /** @defgroup grp_rt_cr_tap RTCrTap - Time-Stamp Protocol (RFC-3161)
|
---|
39 | * @ingroup grp_rt_crypto
|
---|
40 | * @{
|
---|
41 | */
|
---|
42 |
|
---|
43 |
|
---|
44 | /**
|
---|
45 | * RFC-3161 MessageImprint (IPRT representation).
|
---|
46 | */
|
---|
47 | typedef struct RTCRTSPMESSAGEIMPRINT
|
---|
48 | {
|
---|
49 | /** Sequence core. */
|
---|
50 | RTASN1SEQUENCECORE SeqCore;
|
---|
51 | /** The digest algorithm used to produce HashedMessage. */
|
---|
52 | RTCRX509ALGORITHMIDENTIFIER HashAlgorithm;
|
---|
53 | /** The digest of the message being timestamped. */
|
---|
54 | RTASN1OCTETSTRING HashedMessage;
|
---|
55 | } RTCRTSPMESSAGEIMPRINT;
|
---|
56 | /** Pointer to the IPRT representation of a RFC-3161 MessageImprint. */
|
---|
57 | typedef RTCRTSPMESSAGEIMPRINT *PRTCRTSPMESSAGEIMPRINT;
|
---|
58 | /** Pointer to the const IPRT representation of a RFC-3161 MessageImprint. */
|
---|
59 | typedef RTCRTSPMESSAGEIMPRINT const *PCRTCRTSPMESSAGEIMPRINT;
|
---|
60 | RTASN1TYPE_STANDARD_PROTOTYPES(RTCRTSPMESSAGEIMPRINT, RTDECL, RTCrTspMessageImprint, SeqCore.Asn1Core);
|
---|
61 |
|
---|
62 |
|
---|
63 | /**
|
---|
64 | * RFC-3161 Accuracy (IPRT representation).
|
---|
65 | */
|
---|
66 | typedef struct RTCRTSPACCURACY
|
---|
67 | {
|
---|
68 | /** Sequence core. */
|
---|
69 | RTASN1SEQUENCECORE SeqCore;
|
---|
70 | /** The seconds accuracy.
|
---|
71 | * This will be larger than 0. If 1 inspect the Millis field. */
|
---|
72 | RTASN1INTEGER Seconds;
|
---|
73 | /** The millisecond accuracy, optional, implicit tag 0.
|
---|
74 | * Range 1..999. If 1 inspect the Micros field. */
|
---|
75 | RTASN1INTEGER Millis;
|
---|
76 | /** The microsecond accuracy, optional, implicit tag 1.
|
---|
77 | * Range 1..999. */
|
---|
78 | RTASN1INTEGER Micros;
|
---|
79 | } RTCRTSPACCURACY;
|
---|
80 | /** Pointer to the IPRT representation of a RFC-3161 Accuracy. */
|
---|
81 | typedef RTCRTSPACCURACY *PRTCRTSPACCURACY;
|
---|
82 | /** Pointer to the const IPRT representation of a RFC-3161 Accuracy. */
|
---|
83 | typedef RTCRTSPACCURACY const *PCRTCRTSPACCURACY;
|
---|
84 | RTASN1TYPE_STANDARD_PROTOTYPES(RTCRTSPACCURACY, RTDECL, RTCrTspAccuracy, SeqCore.Asn1Core);
|
---|
85 |
|
---|
86 |
|
---|
87 | /**
|
---|
88 | * RFC-3161 TSTInfo (IPRT representation).
|
---|
89 | */
|
---|
90 | typedef struct RTCRTSPTSTINFO
|
---|
91 | {
|
---|
92 | /** Sequence core. */
|
---|
93 | RTASN1SEQUENCECORE SeqCore;
|
---|
94 | /** The structure version number, current only 1 is valid. */
|
---|
95 | RTASN1INTEGER Version;
|
---|
96 | /** Time authority policy. */
|
---|
97 | RTASN1OBJID Policy;
|
---|
98 | /** The message imprint. */
|
---|
99 | RTCRTSPMESSAGEIMPRINT MessageImprint;
|
---|
100 | /** Timestamp request serial number. */
|
---|
101 | RTASN1INTEGER SerialNumber;
|
---|
102 | /** The timestamp. */
|
---|
103 | RTASN1TIME GenTime;
|
---|
104 | /** The timestamp accuracy, optional. */
|
---|
105 | RTCRTSPACCURACY Accuracy;
|
---|
106 | /** Ordering, whatever that means, defaults to FALSE. */
|
---|
107 | RTASN1BOOLEAN Ordering;
|
---|
108 | /** Nonce, optional. */
|
---|
109 | RTASN1INTEGER Nonce;
|
---|
110 | /** Timestamp authority name, explicit optional.
|
---|
111 | * (Should match a name in the certificate of the signature.) */
|
---|
112 | struct
|
---|
113 | {
|
---|
114 | /** Context tag 0. */
|
---|
115 | RTASN1CONTEXTTAG0 CtxTag0;
|
---|
116 | /** The TSA name. */
|
---|
117 | RTCRX509GENERALNAME Tsa;
|
---|
118 | } T0;
|
---|
119 | /** Extensions, optional, implicit tag 1. */
|
---|
120 | RTCRX509EXTENSION Extensions;
|
---|
121 | } RTCRTSPTSTINFO;
|
---|
122 | /** Pointer to the IPRT representation of a RFC-3161 TSTInfo. */
|
---|
123 | typedef RTCRTSPTSTINFO *PRTCRTSPTSTINFO;
|
---|
124 | /** Pointer to the const IPRT representation of a RFC-3161 TSTInfo. */
|
---|
125 | typedef RTCRTSPTSTINFO const *PCRTCRTSPTSTINFO;
|
---|
126 | RTASN1TYPE_STANDARD_PROTOTYPES(RTCRTSPTSTINFO, RTDECL, RTCrTspTstInfo, SeqCore.Asn1Core);
|
---|
127 |
|
---|
128 | /** The object identifier for RTCRTSPTSTINFO.
|
---|
129 | * Found in the ContentType field of PKCS \#7's ContentInfo structure and
|
---|
130 | * the equivalent CMS field. */
|
---|
131 | #define RTCRTSPTSTINFO_OID "1.2.840.113549.1.9.16.1.4"
|
---|
132 |
|
---|
133 | /** @} */
|
---|
134 |
|
---|
135 | RT_C_DECLS_END
|
---|
136 |
|
---|
137 | #endif
|
---|
138 |
|
---|