1 | /** @file
|
---|
2 | * IPRT - Crypto - Time-Stamp Protocol (RFC-3161).
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2017 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_crypto_tsp_h
|
---|
27 | #define ___iprt_crypto_tsp_h
|
---|
28 |
|
---|
29 | #include <iprt/asn1.h>
|
---|
30 | #include <iprt/crypto/x509.h>
|
---|
31 |
|
---|
32 |
|
---|
33 | RT_C_DECLS_BEGIN
|
---|
34 |
|
---|
35 | /** @defgroup grp_rt_cr_tap RTCrTap - Time-Stamp Protocol (RFC-3161)
|
---|
36 | * @ingroup grp_rt_crypto
|
---|
37 | * @{
|
---|
38 | */
|
---|
39 |
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * RFC-3161 MessageImprint (IPRT representation).
|
---|
43 | */
|
---|
44 | typedef struct RTCRTSPMESSAGEIMPRINT
|
---|
45 | {
|
---|
46 | /** Sequence core. */
|
---|
47 | RTASN1SEQUENCECORE SeqCore;
|
---|
48 | /** The digest algorithm used to produce HashedMessage. */
|
---|
49 | RTCRX509ALGORITHMIDENTIFIER HashAlgorithm;
|
---|
50 | /** The digest of the message being timestamped. */
|
---|
51 | RTASN1OCTETSTRING HashedMessage;
|
---|
52 | } RTCRTSPMESSAGEIMPRINT;
|
---|
53 | /** Pointer to the IPRT representation of a RFC-3161 MessageImprint. */
|
---|
54 | typedef RTCRTSPMESSAGEIMPRINT *PRTCRTSPMESSAGEIMPRINT;
|
---|
55 | /** Pointer to the const IPRT representation of a RFC-3161 MessageImprint. */
|
---|
56 | typedef RTCRTSPMESSAGEIMPRINT const *PCRTCRTSPMESSAGEIMPRINT;
|
---|
57 | RTASN1TYPE_STANDARD_PROTOTYPES(RTCRTSPMESSAGEIMPRINT, RTDECL, RTCrTspMessageImprint, SeqCore.Asn1Core);
|
---|
58 |
|
---|
59 |
|
---|
60 | /**
|
---|
61 | * RFC-3161 Accuracy (IPRT representation).
|
---|
62 | */
|
---|
63 | typedef struct RTCRTSPACCURACY
|
---|
64 | {
|
---|
65 | /** Sequence core. */
|
---|
66 | RTASN1SEQUENCECORE SeqCore;
|
---|
67 | /** The seconds accuracy.
|
---|
68 | * This will be larger than 0. If 1 inspect the Millis field. */
|
---|
69 | RTASN1INTEGER Seconds;
|
---|
70 | /** The millisecond accuracy, optional, implicit tag 0.
|
---|
71 | * Range 1..999. If 1 inspect the Micros field. */
|
---|
72 | RTASN1INTEGER Millis;
|
---|
73 | /** The microsecond accuracy, optional, implicit tag 1.
|
---|
74 | * Range 1..999. */
|
---|
75 | RTASN1INTEGER Micros;
|
---|
76 | } RTCRTSPACCURACY;
|
---|
77 | /** Pointer to the IPRT representation of a RFC-3161 Accuracy. */
|
---|
78 | typedef RTCRTSPACCURACY *PRTCRTSPACCURACY;
|
---|
79 | /** Pointer to the const IPRT representation of a RFC-3161 Accuracy. */
|
---|
80 | typedef RTCRTSPACCURACY const *PCRTCRTSPACCURACY;
|
---|
81 | RTASN1TYPE_STANDARD_PROTOTYPES(RTCRTSPACCURACY, RTDECL, RTCrTspAccuracy, SeqCore.Asn1Core);
|
---|
82 |
|
---|
83 |
|
---|
84 | /**
|
---|
85 | * RFC-3161 TSTInfo (IPRT representation).
|
---|
86 | */
|
---|
87 | typedef struct RTCRTSPTSTINFO
|
---|
88 | {
|
---|
89 | /** Sequence core. */
|
---|
90 | RTASN1SEQUENCECORE SeqCore;
|
---|
91 | /** The structure version number, current only 1 is valid. */
|
---|
92 | RTASN1INTEGER Version;
|
---|
93 | /** Time authority policy. */
|
---|
94 | RTASN1OBJID Policy;
|
---|
95 | /** The message imprint. */
|
---|
96 | RTCRTSPMESSAGEIMPRINT MessageImprint;
|
---|
97 | /** Timestamp request serial number. */
|
---|
98 | RTASN1INTEGER SerialNumber;
|
---|
99 | /** The timestamp. */
|
---|
100 | RTASN1TIME GenTime;
|
---|
101 | /** The timestamp accuracy, optional. */
|
---|
102 | RTCRTSPACCURACY Accuracy;
|
---|
103 | /** Ordering, whatever that means, defaults to FALSE. */
|
---|
104 | RTASN1BOOLEAN Ordering;
|
---|
105 | /** Nonce, optional. */
|
---|
106 | RTASN1INTEGER Nonce;
|
---|
107 | /** Timestamp authority name, explicit optional.
|
---|
108 | * (Should match a name in the certificate of the signature.) */
|
---|
109 | struct
|
---|
110 | {
|
---|
111 | /** Context tag 0. */
|
---|
112 | RTASN1CONTEXTTAG0 CtxTag0;
|
---|
113 | /** The TSA name. */
|
---|
114 | RTCRX509GENERALNAME Tsa;
|
---|
115 | } T0;
|
---|
116 | /** Extensions, optional, implicit tag 1. */
|
---|
117 | RTCRX509EXTENSION Extensions;
|
---|
118 | } RTCRTSPTSTINFO;
|
---|
119 | /** Pointer to the IPRT representation of a RFC-3161 TSTInfo. */
|
---|
120 | typedef RTCRTSPTSTINFO *PRTCRTSPTSTINFO;
|
---|
121 | /** Pointer to the const IPRT representation of a RFC-3161 TSTInfo. */
|
---|
122 | typedef RTCRTSPTSTINFO const *PCRTCRTSPTSTINFO;
|
---|
123 | RTASN1TYPE_STANDARD_PROTOTYPES(RTCRTSPTSTINFO, RTDECL, RTCrTspTstInfo, SeqCore.Asn1Core);
|
---|
124 |
|
---|
125 | /** The object identifier for RTCRTSPTSTINFO.
|
---|
126 | * Found in the ContentType field of PKCS \#7's ContentInfo structure and
|
---|
127 | * the equivalent CMS field. */
|
---|
128 | #define RTCRTSPTSTINFO_OID "1.2.840.113549.1.9.16.1.4"
|
---|
129 |
|
---|
130 | /** @} */
|
---|
131 |
|
---|
132 | RT_C_DECLS_END
|
---|
133 |
|
---|
134 | #endif
|
---|
135 |
|
---|