VirtualBox

source: vbox/trunk/src/VBox/Runtime/common/crypto/pkcs7-template.h@ 52503

Last change on this file since 52503 was 52503, checked in by vboxsync, 10 years ago

Started working on PKCS #7 attributes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.6 KB
Line 
1/* $Id: pkcs7-template.h 52503 2014-08-26 14:43:04Z vboxsync $ */
2/** @file
3 * IPRT - Crypto - PKCS \#7, Core APIs, Code Generator Template.
4 */
5
6/*
7 * Copyright (C) 2006-2014 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27#define RTASN1TMPL_DECL RTDECL
28
29/*
30 * One PCKS #7 IssuerAndSerialNumber.
31 */
32#define RTASN1TMPL_TYPE RTCRPKCS7ISSUERANDSERIALNUMBER
33#define RTASN1TMPL_EXT_NAME RTCrPkcs7IssuerAndSerialNumber
34#define RTASN1TMPL_INT_NAME rtCrPkcs7IssuerAndSerialNumber
35RTASN1TMPL_BEGIN_SEQCORE();
36RTASN1TMPL_MEMBER( Name, RTCRX509NAME, RTCrX509Name);
37RTASN1TMPL_MEMBER( SerialNumber, RTASN1INTEGER, RTAsn1Integer);
38RTASN1TMPL_END_SEQCORE();
39#undef RTASN1TMPL_TYPE
40#undef RTASN1TMPL_EXT_NAME
41#undef RTASN1TMPL_INT_NAME
42
43
44/*
45 * One PCKS #7 Attribute.
46 */
47#define RTASN1TMPL_TYPE RTCRPKCS7ATTRIBUTE
48#define RTASN1TMPL_EXT_NAME RTCrPkcs7Attribute
49#define RTASN1TMPL_INT_NAME rtCrPkcs7Attribute
50RTASN1TMPL_BEGIN_SEQCORE();
51RTASN1TMPL_MEMBER( Type, RTASN1OBJID, RTAsn1ObjId);
52RTASN1TMPL_MEMBER_DYN_BEGIN(RTCRPKCS7ATTRIBUTETYPE, enmType, Allocation);
53RTASN1TMPL_MEMBER_DYN( uValues, pOctetStrings, RTASN1SETOFOCTETSTRINGS, RTAsn1SetOfOctetStrings, Allocation,
54 enmType, RTCRPKCS7ATTRIBUTETYPE_OCTET_STRINGS, RTAsn1ObjId_CompareWithString(&pThis->Type, RTCR_PKCS9_ID_MESSAGE_DIGEST_OID) == 0);
55RTASN1TMPL_MEMBER_DYN( uValues, pObjIds, RTASN1SETOFOBJIDS, RTAsn1SetOfObjIds, Allocation,
56 enmType, RTCRPKCS7ATTRIBUTETYPE_OBJ_IDS, RTAsn1ObjId_CompareWithString(&pThis->Type, RTCR_PKCS9_ID_CONTENT_TYPE_OID) == 0);
57RTASN1TMPL_MEMBER_DYN( uValues, pCounterSignatures, RTCRPKCS7SINGERINFOS, RTCrPkcs7SignerInfos, Allocation,
58 enmType, RTCRPKCS7ATTRIBUTETYPE_COUNTER_SIGNATURES, RTAsn1ObjId_CompareWithString(&pThis->Type, RTCR_PKCS9_ID_COUNTER_SIGNATURE_OID) == 0);
59RTASN1TMPL_MEMBER_DYN( uValues, pSigningTime, RTASN1SETOFTIMES, RTAsn1SetOfTimes, Allocation,
60 enmType, RTCRPKCS7ATTRIBUTETYPE_SIGNING_TIME, RTAsn1ObjId_CompareWithString(&pThis->Type, RTCR_PKCS9_ID_SIGNING_TIME_OID) == 0);
61RTASN1TMPL_MEMBER_DYN_DEFAULT( uValues, pCores, RTASN1SETOFCORES, RTAsn1SetOfCores, Allocation,
62 enmType, RTCRPKCS7ATTRIBUTETYPE_UNKNOWN);
63RTASN1TMPL_MEMBER_DYN_END(RTCRPKCS7ATTRIBUTETYPE, enmType, Allocation);
64RTASN1TMPL_END_SEQCORE();
65#undef RTASN1TMPL_TYPE
66#undef RTASN1TMPL_EXT_NAME
67#undef RTASN1TMPL_INT_NAME
68
69
70/*
71 * Set of PCKS #7 Attributes.
72 */
73#define RTASN1TMPL_TYPE RTCRPKCS7ATTRIBUTES
74#define RTASN1TMPL_EXT_NAME RTCrPkcs7Attributes
75#define RTASN1TMPL_INT_NAME rtCrPkcs7Attributes
76RTASN1TMPL_SET_OF(RTCRPKCS7ATTRIBUTE, RTCrPkcs7Attribute);
77#undef RTASN1TMPL_TYPE
78#undef RTASN1TMPL_EXT_NAME
79#undef RTASN1TMPL_INT_NAME
80
81
82/*
83 * One PCKS #7 SignerInfo.
84 */
85#define RTASN1TMPL_TYPE RTCRPKCS7SIGNERINFO
86#define RTASN1TMPL_EXT_NAME RTCrPkcs7SignerInfo
87#define RTASN1TMPL_INT_NAME rtCrPkcs7SignerInfo
88RTASN1TMPL_BEGIN_SEQCORE();
89RTASN1TMPL_MEMBER( Version, RTASN1INTEGER, RTAsn1Integer);
90RTASN1TMPL_MEMBER( IssuerAndSerialNumber, RTCRPKCS7ISSUERANDSERIALNUMBER, RTCrPkcs7IssuerAndSerialNumber);
91RTASN1TMPL_MEMBER( DigestAlgorithm, RTCRX509ALGORITHMIDENTIFIER, RTCrX509AlgorithmIdentifier);
92RTASN1TMPL_MEMBER_OPT_ITAG( AuthenticatedAttributes, RTCRPKCS7ATTRIBUTES, RTCrPkcs7Attributes, 0);
93RTASN1TMPL_MEMBER( DigestEncryptionAlgorithm, RTCRX509ALGORITHMIDENTIFIER, RTCrX509AlgorithmIdentifier);
94RTASN1TMPL_MEMBER( EncryptedDigest, RTASN1OCTETSTRING, RTAsn1OctetString);
95RTASN1TMPL_MEMBER_OPT_ITAG( UnauthenticatedAttributes, RTCRPKCS7ATTRIBUTES, RTCrPkcs7Attributes, 1);
96RTASN1TMPL_END_SEQCORE();
97#undef RTASN1TMPL_TYPE
98#undef RTASN1TMPL_EXT_NAME
99#undef RTASN1TMPL_INT_NAME
100
101
102/*
103 * Set of PCKS #7 SignerInfos.
104 */
105#define RTASN1TMPL_TYPE RTCRPKCS7SIGNERINFOS
106#define RTASN1TMPL_EXT_NAME RTCrPkcs7SignerInfos
107#define RTASN1TMPL_INT_NAME rtCrPkcs7SignerInfos
108RTASN1TMPL_SET_OF(RTCRPKCS7SIGNERINFO, RTCrPkcs7SignerInfo);
109#undef RTASN1TMPL_TYPE
110#undef RTASN1TMPL_EXT_NAME
111#undef RTASN1TMPL_INT_NAME
112
113
114/*
115 * PCKS #7 SignedData.
116 */
117#define RTASN1TMPL_TYPE RTCRPKCS7SIGNEDDATA
118#define RTASN1TMPL_EXT_NAME RTCrPkcs7SignedData
119#define RTASN1TMPL_INT_NAME rtCrPkcs7SignedData
120RTASN1TMPL_BEGIN_SEQCORE();
121RTASN1TMPL_MEMBER( Version, RTASN1INTEGER, RTAsn1Integer);
122RTASN1TMPL_MEMBER( DigestAlgorithms, RTCRX509ALGORITHMIDENTIFIERS, RTCrX509AlgorithmIdentifiers);
123RTASN1TMPL_MEMBER( ContentInfo, RTCRPKCS7CONTENTINFO, RTCrPkcs7ContentInfo);
124RTASN1TMPL_MEMBER_OPT_ITAG( Certificates, RTCRX509CERTIFICATES, RTCrX509Certificates, 0);
125RTASN1TMPL_MEMBER_OPT_ITAG( Crls, RTASN1CORE, RTAsn1Core, 1);
126RTASN1TMPL_MEMBER( SignerInfos, RTCRPKCS7SIGNERINFOS, RTCrPkcs7SignerInfos);
127RTASN1TMPL_EXEC_CHECK_SANITY( rc = rtCrPkcs7SignedData_CheckSanityExtra(pThis, fFlags, pErrInfo, pszErrorTag) ) /* no ; */
128RTASN1TMPL_END_SEQCORE();
129#undef RTASN1TMPL_TYPE
130#undef RTASN1TMPL_EXT_NAME
131#undef RTASN1TMPL_INT_NAME
132
133
134/*
135 * PCKS #7 DigestInfo.
136 */
137#define RTASN1TMPL_TYPE RTCRPKCS7DIGESTINFO
138#define RTASN1TMPL_EXT_NAME RTCrPkcs7DigestInfo
139#define RTASN1TMPL_INT_NAME rtCrPkcs7DigestInfo
140RTASN1TMPL_BEGIN_SEQCORE();
141RTASN1TMPL_MEMBER( DigestAlgorithm, RTCRX509ALGORITHMIDENTIFIER, RTCrX509AlgorithmIdentifier);
142RTASN1TMPL_MEMBER( Digest, RTASN1OCTETSTRING, RTAsn1OctetString);
143RTASN1TMPL_END_SEQCORE();
144#undef RTASN1TMPL_TYPE
145#undef RTASN1TMPL_EXT_NAME
146#undef RTASN1TMPL_INT_NAME
147
148
149/*
150 * PCKS #7 ContentInfo.
151 */
152#define RTASN1TMPL_TYPE RTCRPKCS7CONTENTINFO
153#define RTASN1TMPL_EXT_NAME RTCrPkcs7ContentInfo
154#define RTASN1TMPL_INT_NAME rtCrPkcs7ContentInfo
155RTASN1TMPL_BEGIN_SEQCORE();
156RTASN1TMPL_MEMBER( ContentType, RTASN1OBJID, RTAsn1ObjId);
157RTASN1TMPL_MEMBER_OPT_ITAG( Content, RTASN1OCTETSTRING, RTAsn1OctetString, 0);
158RTASN1TMPL_EXEC_DECODE( rc = rtCrPkcs7ContentInfo_DecodeExtra(pCursor, fFlags, pThis, pszErrorTag)) /* no ; */
159RTASN1TMPL_EXEC_CLONE( rc = rtCrPkcs7ContentInfo_CloneExtra(pThis) ) /* no ; */
160RTASN1TMPL_END_SEQCORE();
161#undef RTASN1TMPL_TYPE
162#undef RTASN1TMPL_EXT_NAME
163#undef RTASN1TMPL_INT_NAME
164
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette