VirtualBox

source: vbox/trunk/include/iprt/crypto/spc.h@ 106967

Last change on this file since 106967 was 106061, checked in by vboxsync, 2 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 19.3 KB
Line 
1/** @file
2 * IPRT - Crypto - Microsoft SPC / Authenticode.
3 */
4
5/*
6 * Copyright (C) 2006-2024 Oracle and/or its affiliates.
7 *
8 * This file is part of VirtualBox base platform packages, as
9 * available from https://www.virtualbox.org.
10 *
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
14 * License.
15 *
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.
20 *
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>.
23 *
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.
29 *
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.
32 *
33 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
34 */
35
36#ifndef IPRT_INCLUDED_crypto_spc_h
37#define IPRT_INCLUDED_crypto_spc_h
38#ifndef RT_WITHOUT_PRAGMA_ONCE
39# pragma once
40#endif
41
42#include <iprt/asn1.h>
43#include <iprt/crypto/x509.h>
44#include <iprt/crypto/pkcs7.h>
45#include <iprt/md5.h>
46#include <iprt/sha.h>
47
48
49RT_C_DECLS_BEGIN
50
51/** @defgroup grp_rt_cr_spc RTCrSpc - Microsoft Authenticode
52 * @ingroup grp_rt_crypto
53 * @{
54 */
55
56/** Value for RTCR_PKCS9_ID_MS_STATEMENT_TYPE. */
57#define RTCRSPC_STMT_TYPE_INDIVIDUAL_CODE_SIGNING "1.3.6.1.4.1.311.2.1.21"
58
59/**
60 * PE Image page hash table, generic union.
61 *
62 * @remarks This table isn't used by ldrPE.cpp, it walks the table in a generic
63 * fashion using the hash size. So, we can ditch it if we feel like it.
64 */
65typedef union RTCRSPCPEIMAGEPAGEHASHES
66{
67 /** MD5 page hashes. */
68 struct
69 {
70 /** The file offset. */
71 uint32_t offFile;
72 /** The hash. */
73 uint8_t abHash[RTSHA1_HASH_SIZE];
74 } aMd5[1];
75
76 /** SHA-1 page hashes. */
77 struct
78 {
79 /** The file offset. */
80 uint32_t offFile;
81 /** The hash. */
82 uint8_t abHash[RTSHA1_HASH_SIZE];
83 } aSha1[1];
84
85 /** SHA-256 page hashes. */
86 struct
87 {
88 /** The file offset. */
89 uint32_t offFile;
90 /** The hash. */
91 uint8_t abHash[RTSHA256_HASH_SIZE];
92 } aSha256[1];
93
94 /** SHA-512 page hashes. */
95 struct
96 {
97 /** The file offset. */
98 uint32_t offFile;
99 /** The hash. */
100 uint8_t abHash[RTSHA512_HASH_SIZE];
101 } aSha512[1];
102
103 /** Generic view of ONE hash. */
104 struct
105 {
106 /** The file offset. */
107 uint32_t offFile;
108 /** Variable length hash field. */
109 uint8_t abHash[1];
110 } Generic;
111} RTCRSPCPEIMAGEPAGEHASHES;
112/** Pointer to a PE image page hash table union. */
113typedef RTCRSPCPEIMAGEPAGEHASHES *PRTCRSPCPEIMAGEPAGEHASHES;
114/** Pointer to a const PE image page hash table union. */
115typedef RTCRSPCPEIMAGEPAGEHASHES const *PCRTCRSPCPEIMAGEPAGEHASHES;
116
117
118/**
119 * Serialization wrapper for raw RTCRSPCPEIMAGEPAGEHASHES data.
120 */
121typedef struct RTCRSPCSERIALIZEDPAGEHASHES
122{
123 /** The page hashes are within a set. Dunno if there could be multiple
124 * entries in this set, never seen it yet, so I doubt it. */
125 RTASN1SETCORE SetCore;
126 /** Octet string containing the raw data. */
127 RTASN1OCTETSTRING RawData;
128
129 /** Pointer to the hash data within that string.
130 * The hash algorithm is given by the object attribute type in
131 * RTCRSPCSERIALIZEDOBJECTATTRIBUTE. It is generally the same as for the
132 * whole image hash. */
133 PCRTCRSPCPEIMAGEPAGEHASHES pData;
134 /** Field the user can use to store the number of pages in pData. */
135 uint32_t cPages;
136} RTCRSPCSERIALIZEDPAGEHASHES;
137/** Pointer to a serialized wrapper for page hashes. */
138typedef RTCRSPCSERIALIZEDPAGEHASHES *PRTCRSPCSERIALIZEDPAGEHASHES;
139/** Pointer to a const serialized wrapper for page hashes. */
140typedef RTCRSPCSERIALIZEDPAGEHASHES const *PCRTCRSPCSERIALIZEDPAGEHASHES;
141RTASN1TYPE_STANDARD_PROTOTYPES(RTCRSPCSERIALIZEDPAGEHASHES, RTDECL, RTCrSpcSerializedPageHashes, SetCore.Asn1Core);
142
143RTDECL(int) RTCrSpcSerializedPageHashes_UpdateDerivedData(PRTCRSPCSERIALIZEDPAGEHASHES pThis);
144
145
146/**
147 * Data type selection for RTCRSPCSERIALIZEDOBJECTATTRIBUTE.
148 */
149typedef enum RTCRSPCSERIALIZEDOBJECTATTRIBUTETYPE
150{
151 /** Invalid zero entry. */
152 RTCRSPCSERIALIZEDOBJECTATTRIBUTETYPE_INVALID = 0,
153 /** Not present pro forma. */
154 RTCRSPCSERIALIZEDOBJECTATTRIBUTETYPE_NOT_PRESENT,
155 /** Unknown object. */
156 RTCRSPCSERIALIZEDOBJECTATTRIBUTETYPE_UNKNOWN,
157 /** SHA-1 page hashes (pPageHashes). */
158 RTCRSPCSERIALIZEDOBJECTATTRIBUTETYPE_PAGE_HASHES_V1,
159 /** SHA-256 page hashes (pPageHashes). */
160 RTCRSPCSERIALIZEDOBJECTATTRIBUTETYPE_PAGE_HASHES_V2,
161 /** End of valid values. */
162 RTCRSPCSERIALIZEDOBJECTATTRIBUTETYPE_END,
163 /** Blow up the type to at least 32-bits. */
164 RTCRSPCSERIALIZEDOBJECTATTRIBUTETYPE_32BIT_HACK
165} RTCRSPCSERIALIZEDOBJECTATTRIBUTETYPE;
166
167/**
168 * One serialized object attribute (PE image data).
169 */
170typedef struct RTCRSPCSERIALIZEDOBJECTATTRIBUTE
171{
172 /** Sequence core. */
173 RTASN1SEQUENCECORE SeqCore;
174 /** The attribute type. */
175 RTASN1OBJID Type;
176 /** The allocation of the data type. */
177 RTASN1ALLOCATION Allocation;
178 /** Indicates the valid value in the union. */
179 RTCRSPCSERIALIZEDOBJECTATTRIBUTETYPE enmType;
180 /** Union with data format depending on the Type. */
181 union
182 {
183 /** The unknown value (RTCRSPCSERIALIZEDOBJECTATTRIBUTETYPE_UNKNOWN). */
184 PRTASN1CORE pCore;
185 /** Page hashes (RTCRSPCSERIALIZEDOBJECTATTRIBUTETYPE_PAGE_HASHES_V1 or
186 * RTCRSPCSERIALIZEDOBJECTATTRIBUTETYPE_PAGE_HASHES_V2). */
187 PRTCRSPCSERIALIZEDPAGEHASHES pPageHashes;
188 } u;
189} RTCRSPCSERIALIZEDOBJECTATTRIBUTE;
190/** Pointer to a serialized object attribute. */
191typedef RTCRSPCSERIALIZEDOBJECTATTRIBUTE *PRTCRSPCSERIALIZEDOBJECTATTRIBUTE;
192/** Pointer to a const serialized object attribute. */
193typedef RTCRSPCSERIALIZEDOBJECTATTRIBUTE const *PCRTCRSPCSERIALIZEDOBJECTATTRIBUTE;
194RTASN1TYPE_STANDARD_PROTOTYPES(RTCRSPCSERIALIZEDOBJECTATTRIBUTE, RTDECL, RTCrSpcSerializedObjectAttribute, SeqCore.Asn1Core);
195
196RTDECL(int) RTCrSpcSerializedObjectAttribute_SetV1Hashes(PRTCRSPCSERIALIZEDOBJECTATTRIBUTE pThis,
197 PCRTCRSPCSERIALIZEDPAGEHASHES, PCRTASN1ALLOCATORVTABLE pAllocator);
198RTDECL(int) RTCrSpcSerializedObjectAttribute_SetV2Hashes(PRTCRSPCSERIALIZEDOBJECTATTRIBUTE pThis,
199 PCRTCRSPCSERIALIZEDPAGEHASHES, PCRTASN1ALLOCATORVTABLE pAllocator);
200
201/** @name RTCRSPCSERIALIZEDOBJECTATTRIBUTE::Type values
202 * @{ */
203/** Serialized object attribute type for page hashes version 1. */
204#define RTCRSPC_PE_IMAGE_HASHES_V1_OID "1.3.6.1.4.1.311.2.3.1"
205/** Serialized object attribute type for page hashes version 2. */
206#define RTCRSPC_PE_IMAGE_HASHES_V2_OID "1.3.6.1.4.1.311.2.3.2"
207/** @} */
208
209
210/*
211 * Set of serialized object attributes (PE image data).
212 */
213RTASN1_IMPL_GEN_SET_OF_TYPEDEFS_AND_PROTOS(RTCRSPCSERIALIZEDOBJECTATTRIBUTES, RTCRSPCSERIALIZEDOBJECTATTRIBUTE, RTDECL,
214 RTCrSpcSerializedObjectAttributes);
215
216/** The UUID found in RTCRSPCSERIALIZEDOBJECT::Uuid for
217 * RTCRSPCSERIALIZEDOBJECTATTRIBUTES. */
218#define RTCRSPCSERIALIZEDOBJECT_UUID_STR "d586b5a6-a1b4-6624-ae05-a217da8e60d6"
219
220
221/**
222 * Decoded encapsulated data type selection in RTCRSPCSERIALIZEDOBJECT.
223 */
224typedef enum RTCRSPCSERIALIZEDOBJECTTYPE
225{
226 /** Invalid zero value. */
227 RTCRSPCSERIALIZEDOBJECTTYPE_INVALID = 0,
228 /** Serialized object attributes (RTCRSPCSERIALIZEDOBJECT_UUID_STR / pAttribs). */
229 RTCRSPCSERIALIZEDOBJECTTYPE_ATTRIBUTES,
230 /** End of valid values. */
231 RTCRSPCSERIALIZEDOBJECTTYPE_END,
232 /** MAke sure the type is at least 32-bit wide. */
233 RTCRSPCSERIALIZEDOBJECTTYPE_32BIT_HACK = 0x7fffffff
234} RTCRSPCSERIALIZEDOBJECTTYPE;
235
236/**
237 * A serialized object (PE image data).
238 */
239typedef struct RTCRSPCSERIALIZEDOBJECT
240{
241 /** Sequence core. */
242 RTASN1SEQUENCECORE SeqCore;
243 /** The UUID of the data object. */
244 RTASN1OCTETSTRING Uuid;
245 /** Serialized data object. */
246 RTASN1OCTETSTRING SerializedData;
247
248 /** Indicates the valid pointer in the union. */
249 RTCRSPCSERIALIZEDOBJECTTYPE enmType;
250 /** Union of pointers shadowing SerializedData.pEncapsulated. */
251 union
252 {
253 /** Generic core pointer. */
254 PRTASN1CORE pCore;
255 /** Pointer to decoded data if Uuid is RTCRSPCSERIALIZEDOBJECT_UUID_STR. */
256 PRTCRSPCSERIALIZEDOBJECTATTRIBUTES pData;
257 } u;
258} RTCRSPCSERIALIZEDOBJECT;
259/** Pointer to a serialized object (PE image data). */
260typedef RTCRSPCSERIALIZEDOBJECT *PRTCRSPCSERIALIZEDOBJECT;
261/** Pointer to a const serialized object (PE image data). */
262typedef RTCRSPCSERIALIZEDOBJECT const *PCRTCRSPCSERIALIZEDOBJECT;
263RTASN1TYPE_STANDARD_PROTOTYPES(RTCRSPCSERIALIZEDOBJECT, RTDECL, RTCrSpcSerializedObject, SeqCore.Asn1Core);
264
265
266/**
267 * RTCRSPCSTRING choices.
268 */
269typedef enum RTCRSPCSTRINGCHOICE
270{
271 /** Invalid zero value. */
272 RTCRSPCSTRINGCHOICE_INVALID = 0,
273 /** Not present. */
274 RTCRSPCSTRINGCHOICE_NOT_PRESENT,
275 /** UCS-2 string (pUcs2). */
276 RTCRSPCSTRINGCHOICE_UCS2,
277 /** ASCII string (pAscii). */
278 RTCRSPCSTRINGCHOICE_ASCII,
279 /** End of valid values. */
280 RTCRSPCSTRINGCHOICE_END,
281 /** Blow the type up to 32-bit. */
282 RTCRSPCSTRINGCHOICE_32BIT_HACK = 0x7fffffff
283} RTCRSPCSTRINGCHOICE;
284
285/**
286 * Stupid microsoft choosy string type.
287 */
288typedef struct RTCRSPCSTRING
289{
290 /** Dummy core. */
291 RTASN1DUMMY Dummy;
292 /** Allocation of what the pointer below points to. */
293 RTASN1ALLOCATION Allocation;
294 /** Pointer choice.*/
295 RTCRSPCSTRINGCHOICE enmChoice;
296 /** Pointer union. */
297 union
298 {
299 /** Tag 0, implicit: UCS-2 (BMP) string. */
300 PRTASN1STRING pUcs2;
301 /** Tag 1, implicit: ASCII (IA5) string. */
302 PRTASN1STRING pAscii;
303 } u;
304} RTCRSPCSTRING;
305/** Pointer to a stupid microsoft string choice. */
306typedef RTCRSPCSTRING *PRTCRSPCSTRING;
307/** Pointer to a const stupid microsoft string choice. */
308typedef RTCRSPCSTRING const *PCRTCRSPCSTRING;
309RTASN1TYPE_STANDARD_PROTOTYPES(RTCRSPCSTRING, RTDECL, RTCrSpcString, Dummy.Asn1Core);
310
311RTDECL(int) RTCrSpcString_SetUcs2(PRTCRSPCSTRING pThis, PCRTASN1STRING pToClone, PCRTASN1ALLOCATORVTABLE pAllocator);
312RTDECL(int) RTCrSpcString_SetAscii(PRTCRSPCSTRING pThis, PCRTASN1STRING pToClone, PCRTASN1ALLOCATORVTABLE pAllocator);
313
314
315/**
316 * RTCRSPCSTRING choices.
317 */
318typedef enum RTCRSPCLINKCHOICE
319{
320 /** Invalid zero value. */
321 RTCRSPCLINKCHOICE_INVALID = 0,
322 /** Not present. */
323 RTCRSPCLINKCHOICE_NOT_PRESENT,
324 /** URL (ASCII) string (pUrl). */
325 RTCRSPCLINKCHOICE_URL,
326 /** Serialized object (pMoniker). */
327 RTCRSPCLINKCHOICE_MONIKER,
328 /** Filename (pT2). */
329 RTCRSPCLINKCHOICE_FILE,
330 /** End of valid values. */
331 RTCRSPCLINKCHOICE_END,
332 /** Blow the type up to 32-bit. */
333 RTCRSPCLINKCHOICE_32BIT_HACK = 0x7fffffff
334} RTCRSPCLINKCHOICE;
335
336/**
337 * PE image data link.
338 */
339typedef struct RTCRSPCLINK
340{
341 /** Dummy core. */
342 RTASN1DUMMY Dummy;
343 /** Allocation of what the pointer below points to. */
344 RTASN1ALLOCATION Allocation;
345 /** Pointer choice.*/
346 RTCRSPCLINKCHOICE enmChoice;
347 /** Pointer union. */
348 union
349 {
350 /** Tag 0, implicit: An URL encoded as an IA5 STRING. */
351 PRTASN1STRING pUrl;
352 /** Tag 1, implicit: A serialized object. */
353 PRTCRSPCSERIALIZEDOBJECT pMoniker;
354 /** Tag 2, explicit: The default, a file name.
355 * Documented to be set to "<<<Obsolete>>>" when used. */
356 struct
357 {
358 /** Context tag 2. */
359 RTASN1CONTEXTTAG2 CtxTag2;
360 /** The file name string. */
361 RTCRSPCSTRING File;
362 } *pT2;
363 } u;
364} RTCRSPCLINK;
365/** Poitner to a PE image data link. */
366typedef RTCRSPCLINK *PRTCRSPCLINK;
367/** Poitner to a const PE image data link. */
368typedef RTCRSPCLINK const *PCRTCRSPCLINK;
369RTASN1TYPE_STANDARD_PROTOTYPES(RTCRSPCLINK, RTDECL, RTCrSpcLink, Dummy.Asn1Core);
370
371RTDECL(int) RTCrSpcLink_SetUrl(PRTCRSPCLINK pThis, PCRTASN1STRING pToClone, PCRTASN1ALLOCATORVTABLE pAllocator);
372RTDECL(int) RTCrSpcLink_SetMoniker(PRTCRSPCLINK pThis, PCRTCRSPCSERIALIZEDOBJECT pToClone, PCRTASN1ALLOCATORVTABLE pAllocator);
373RTDECL(int) RTCrSpcLink_SetFile(PRTCRSPCLINK pThis, PCRTCRSPCSTRING pToClone, PCRTASN1ALLOCATORVTABLE pAllocator);
374
375
376#if 0 /** @todo Might not be the correct bit order. */
377/**
378 * Flag values for RTCRSPCPEIMAGEDATA::Flags and RTCRSPCPEIMAGEDATA::fFlags.
379 */
380typedef enum RTCRSPCPEIMAGEFLAGS
381{
382 RTCRSPCPEIMAGEFLAGS_INCLUDE_RESOURCES = 0,
383 RTCRSPCPEIMAGEFLAGS_INCLUDE_DEBUG_INFO = 1,
384 RTCRSPCPEIMAGEFLAGS_IMPORT_ADDRESS_TABLE = 2
385} RTCRSPCPEIMAGEFLAGS;
386#endif
387
388
389/**
390 * Authenticode PE Image data.
391 */
392typedef struct RTCRSPCPEIMAGEDATA
393{
394 /** Sequence core. */
395 RTASN1SEQUENCECORE SeqCore;
396 /** One of the RTCRSPCPEIMAGEFLAGS value, default is
397 * RTCRSPCPEIMAGEFLAGS_INCLUDE_RESOURCES. Obsolete with v2 page hashes? */
398 RTASN1BITSTRING Flags;
399 /** Tag 0, explicit: Link to the data. */
400 struct
401 {
402 /** Context tag 0. */
403 RTASN1CONTEXTTAG0 CtxTag0;
404 /** Link to the data. */
405 RTCRSPCLINK File;
406 } T0;
407} RTCRSPCPEIMAGEDATA;
408/** Pointer to a authenticode PE image data representation. */
409typedef RTCRSPCPEIMAGEDATA *PRTCRSPCPEIMAGEDATA;
410/** Pointer to a const authenticode PE image data representation. */
411typedef RTCRSPCPEIMAGEDATA const *PCRTCRSPCPEIMAGEDATA;
412RTASN1TYPE_STANDARD_PROTOTYPES(RTCRSPCPEIMAGEDATA, RTDECL, RTCrSpcPeImageData, SeqCore.Asn1Core);
413
414RTDECL(int) RTCrSpcPeImageData_SetFlags(PRTCRSPCPEIMAGEDATA pThis, PCRTASN1BITSTRING pToClone, PCRTASN1ALLOCATORVTABLE pAllocator);
415RTDECL(int) RTCrSpcPeImageData_SetFile(PRTCRSPCPEIMAGEDATA pThis, PCRTCRSPCLINK pToClone, PCRTASN1ALLOCATORVTABLE pAllocator);
416
417/** The object ID for SpcPeImageData. */
418#define RTCRSPCPEIMAGEDATA_OID "1.3.6.1.4.1.311.2.1.15"
419
420
421/**
422 * Data type selection for RTCRSPCATTRIBUTETYPEANDOPTIONALVALUE.
423 */
424typedef enum RTCRSPCAAOVTYPE
425{
426 /** Invalid zero entry. */
427 RTCRSPCAAOVTYPE_INVALID = 0,
428 /** Not present (pro forma). */
429 RTCRSPCAAOVTYPE_NOT_PRESENT,
430 /** Unknown object. */
431 RTCRSPCAAOVTYPE_UNKNOWN,
432 /** PE image data (pPeImage). */
433 RTCRSPCAAOVTYPE_PE_IMAGE_DATA,
434 /** End of valid values. */
435 RTCRSPCAAOVTYPE_END,
436 /** Blow up the type to at least 32-bits. */
437 RTCRSPCAAOVTYPE_32BIT_HACK
438} RTCRSPCAAOVTYPE;
439
440/**
441 * Authenticode attribute type and optional value.
442 *
443 * Note! Spec says the value should be explicitly tagged, but in real life
444 * it isn't. So, not very optional?
445 */
446typedef struct RTCRSPCATTRIBUTETYPEANDOPTIONALVALUE
447{
448 /** Sequence core. */
449 RTASN1SEQUENCECORE SeqCore;
450 /** An object ID indicating the type of the value. */
451 RTASN1OBJID Type;
452 /** Allocation of the optional data value. */
453 RTASN1ALLOCATION Allocation;
454 /** The valid pointer. */
455 RTCRSPCAAOVTYPE enmType;
456 /** The value part depends on the Type. */
457 union
458 {
459 /** RTCRSPCAAOVTYPE_UNKNOWN / Generic. */
460 PRTASN1CORE pCore;
461 /** RTCRSPCAAOVTYPE_PE_IMAGE_DATA / RTCRSPCPEIMAGEDATA_OID. */
462 PRTCRSPCPEIMAGEDATA pPeImage;
463 } uValue;
464} RTCRSPCATTRIBUTETYPEANDOPTIONALVALUE;
465/** Pointer to a authentication attribute type and optional value
466 * representation. */
467typedef RTCRSPCATTRIBUTETYPEANDOPTIONALVALUE *PRTCRSPCATTRIBUTETYPEANDOPTIONALVALUE;
468/** Pointer to a const authentication attribute type and optional value
469 * representation. */
470typedef RTCRSPCATTRIBUTETYPEANDOPTIONALVALUE const *PCRTCRSPCATTRIBUTETYPEANDOPTIONALVALUE;
471RTASN1TYPE_STANDARD_PROTOTYPES(RTCRSPCATTRIBUTETYPEANDOPTIONALVALUE, RTDECL, RTCrSpcAttributeTypeAndOptionalValue, SeqCore.Asn1Core);
472
473RTDECL(int) RTCrSpcAttributeTypeAndOptionalValue_SetPeImage(PRTCRSPCATTRIBUTETYPEANDOPTIONALVALUE pThis,
474 PCRTCRSPCPEIMAGEDATA pToClone, PCRTASN1ALLOCATORVTABLE pAllocator);
475
476/**
477 * Authenticode indirect data content.
478 */
479typedef struct RTCRSPCINDIRECTDATACONTENT
480{
481 /** Sequence core. */
482 RTASN1SEQUENCECORE SeqCore;
483 /** Additional data. */
484 RTCRSPCATTRIBUTETYPEANDOPTIONALVALUE Data;
485 /** The whole image digest. */
486 RTCRPKCS7DIGESTINFO DigestInfo;
487} RTCRSPCINDIRECTDATACONTENT;
488/** Pointer to a authenticode indirect data content representation. */
489typedef RTCRSPCINDIRECTDATACONTENT *PRTCRSPCINDIRECTDATACONTENT;
490/** Pointer to a const authenticode indirect data content representation. */
491typedef RTCRSPCINDIRECTDATACONTENT const *PCRTCRSPCINDIRECTDATACONTENT;
492RTASN1TYPE_STANDARD_PROTOTYPES(RTCRSPCINDIRECTDATACONTENT, RTDECL, RTCrSpcIndirectDataContent, SeqCore.Asn1Core);
493
494/** The object ID for SpcIndirectDataContent. */
495#define RTCRSPCINDIRECTDATACONTENT_OID "1.3.6.1.4.1.311.2.1.4"
496
497/**
498 * Check the sanity of an Authenticode SPCIndirectDataContent object.
499 *
500 * @returns IPRT status code
501 * @param pIndData The Authenticode SPCIndirectDataContent to
502 * check.
503 * @param pSignedData The related signed data object.
504 * @param fFlags RTCRSPCINDIRECTDATACONTENT_SANITY_F_XXX.
505 * @param pErrInfo Optional error info.
506 */
507RTDECL(int) RTCrSpcIndirectDataContent_CheckSanityEx(PCRTCRSPCINDIRECTDATACONTENT pIndData, PCRTCRPKCS7SIGNEDDATA pSignedData,
508 uint32_t fFlags, PRTERRINFO pErrInfo);
509/** @name RTCRSPCINDIRECTDATACONTENT_SANITY_F_XXX for RTCrSpcIndirectDataContent_CheckSanityEx.
510 * @{ */
511/** The digest hash algorithm must be known to IPRT. */
512#define RTCRSPCINDIRECTDATACONTENT_SANITY_F_ONLY_KNOWN_HASH RT_BIT_32(0)
513/** PE image signing, check expectations of the spec. */
514#define RTCRSPCINDIRECTDATACONTENT_SANITY_F_PE_IMAGE RT_BIT_32(1)
515/** @} */
516
517/**
518 * Gets the first SPC serialized object attribute in a SPC PE image.
519 *
520 * @returns Pointer to the attribute with the given type, NULL if not found.
521 * @param pThis The Authenticode SpcIndirectDataContent.
522 * @param enmType The type of attribute to get.
523 */
524RTDECL(PCRTCRSPCSERIALIZEDOBJECTATTRIBUTE)
525RTCrSpcIndirectDataContent_GetPeImageObjAttrib(PCRTCRSPCINDIRECTDATACONTENT pThis,
526 RTCRSPCSERIALIZEDOBJECTATTRIBUTETYPE enmType);
527
528/** @} */
529
530RT_C_DECLS_END
531
532#endif /* !IPRT_INCLUDED_crypto_spc_h */
533
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