1 | /* $Id: tsp-template.h 96407 2022-08-22 17:43:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT - Crypto - Time-Stamp Protocol (RFC-3161), Code Generator Template.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2022 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * The contents of this file may alternatively be used under the terms
|
---|
26 | * of the Common Development and Distribution License Version 1.0
|
---|
27 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
28 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
29 | * CDDL are applicable instead of those of the GPL.
|
---|
30 | *
|
---|
31 | * You may elect to license modified versions of this file under the
|
---|
32 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
33 | *
|
---|
34 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
35 | */
|
---|
36 |
|
---|
37 | #define RTASN1TMPL_DECL RTDECL
|
---|
38 |
|
---|
39 | /*
|
---|
40 | * MessageImprint
|
---|
41 | */
|
---|
42 | #define RTASN1TMPL_TYPE RTCRTSPMESSAGEIMPRINT
|
---|
43 | #define RTASN1TMPL_EXT_NAME RTCrTspMessageImprint
|
---|
44 | #define RTASN1TMPL_INT_NAME rtCrTspMessageImprint
|
---|
45 | RTASN1TMPL_BEGIN_SEQCORE();
|
---|
46 | RTASN1TMPL_MEMBER( HashAlgorithm, RTCRX509ALGORITHMIDENTIFIER, RTCrX509AlgorithmIdentifier);
|
---|
47 | RTASN1TMPL_MEMBER( HashedMessage, RTASN1OCTETSTRING, RTAsn1OctetString);
|
---|
48 | RTASN1TMPL_END_SEQCORE();
|
---|
49 | #undef RTASN1TMPL_TYPE
|
---|
50 | #undef RTASN1TMPL_EXT_NAME
|
---|
51 | #undef RTASN1TMPL_INT_NAME
|
---|
52 |
|
---|
53 | /*
|
---|
54 | * TimeStampReq
|
---|
55 | */
|
---|
56 |
|
---|
57 | /*
|
---|
58 | * PKIStatusInfo
|
---|
59 | */
|
---|
60 |
|
---|
61 | /*
|
---|
62 | * TimeStampResp
|
---|
63 | */
|
---|
64 |
|
---|
65 | /*
|
---|
66 | * Accuracy
|
---|
67 | *
|
---|
68 | * Note! Capping second accuracy at an hour to reduce chance exploiting this
|
---|
69 | * field to tinker with a signed structure. The RFC does not specify
|
---|
70 | * any upper limit.
|
---|
71 | *
|
---|
72 | * Note! Allowing a zero value for the 'millis' field because we've seen symantec
|
---|
73 | * return that when 'micros' is present. The RFC seems to want the TSA to
|
---|
74 | * omit the field if its value is zero.
|
---|
75 | */
|
---|
76 | #define RTASN1TMPL_TYPE RTCRTSPACCURACY
|
---|
77 | #define RTASN1TMPL_EXT_NAME RTCrTspAccuracy
|
---|
78 | #define RTASN1TMPL_INT_NAME rtCrTspAccuracy
|
---|
79 | RTASN1TMPL_BEGIN_SEQCORE();
|
---|
80 | RTASN1TMPL_MEMBER_OPT_ITAG_EX( Seconds, RTASN1INTEGER, RTAsn1Integer, ASN1_TAG_INTEGER, RTASN1TMPL_ITAG_F_UP,
|
---|
81 | RTASN1TMPL_MEMBER_CONSTR_U64_MIN_MAX(Seconds, 0, 3600, RT_NOTHING));
|
---|
82 | RTASN1TMPL_MEMBER_OPT_ITAG_EX( Millis, RTASN1INTEGER, RTAsn1Integer, 0, RTASN1TMPL_ITAG_F_CP,
|
---|
83 | RTASN1TMPL_MEMBER_CONSTR_U64_MIN_MAX(Millis, 0, 999, RT_NOTHING));
|
---|
84 | RTASN1TMPL_MEMBER_OPT_ITAG_EX( Micros, RTASN1INTEGER, RTAsn1Integer, 1, RTASN1TMPL_ITAG_F_CP,
|
---|
85 | RTASN1TMPL_MEMBER_CONSTR_U64_MIN_MAX(Micros, 1, 999, RT_NOTHING));
|
---|
86 | RTASN1TMPL_END_SEQCORE();
|
---|
87 | #undef RTASN1TMPL_TYPE
|
---|
88 | #undef RTASN1TMPL_EXT_NAME
|
---|
89 | #undef RTASN1TMPL_INT_NAME
|
---|
90 |
|
---|
91 |
|
---|
92 | /*
|
---|
93 | * TSTInfo
|
---|
94 | */
|
---|
95 | #define RTASN1TMPL_TYPE RTCRTSPTSTINFO
|
---|
96 | #define RTASN1TMPL_EXT_NAME RTCrTspTstInfo
|
---|
97 | #define RTASN1TMPL_INT_NAME rtCrTspTstInfo
|
---|
98 | RTASN1TMPL_BEGIN_SEQCORE();
|
---|
99 | RTASN1TMPL_MEMBER( Version, RTASN1INTEGER, RTAsn1Integer);
|
---|
100 | RTASN1TMPL_MEMBER( Policy, RTASN1OBJID, RTAsn1ObjId);
|
---|
101 | RTASN1TMPL_MEMBER( MessageImprint, RTCRTSPMESSAGEIMPRINT, RTCrTspMessageImprint);
|
---|
102 | RTASN1TMPL_MEMBER( SerialNumber, RTASN1INTEGER, RTAsn1Integer);
|
---|
103 | RTASN1TMPL_MEMBER( GenTime, RTASN1TIME, RTAsn1GeneralizedTime);
|
---|
104 | RTASN1TMPL_MEMBER_OPT_ITAG_UC( Accuracy, RTCRTSPACCURACY, RTCrTspAccuracy, ASN1_TAG_SEQUENCE);
|
---|
105 | RTASN1TMPL_MEMBER_DEF_ITAG_UP( Ordering, RTASN1BOOLEAN, RTAsn1Boolean, ASN1_TAG_BOOLEAN, 0 /*False*/);
|
---|
106 | RTASN1TMPL_MEMBER_OPT_ITAG_UP( Nonce, RTASN1INTEGER, RTAsn1Integer, ASN1_TAG_INTEGER);
|
---|
107 | RTASN1TMPL_MEMBER_OPT_XTAG( T0, CtxTag0, Tsa, RTCRX509GENERALNAME, RTCrX509GeneralName, 0);
|
---|
108 | RTASN1TMPL_MEMBER_OPT_ITAG( Extensions, RTCRX509EXTENSION, RTCrX509Extension, 1);
|
---|
109 | RTASN1TMPL_END_SEQCORE();
|
---|
110 | #undef RTASN1TMPL_TYPE
|
---|
111 | #undef RTASN1TMPL_EXT_NAME
|
---|
112 | #undef RTASN1TMPL_INT_NAME
|
---|
113 |
|
---|