VirtualBox

source: vbox/trunk/src/VBox/Runtime/common/crypto/spc-asn1-decoder.cpp@ 73603

Last change on this file since 73603 was 69111, checked in by vboxsync, 7 years ago

(C) year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.9 KB
Line 
1/* $Id: spc-asn1-decoder.cpp 69111 2017-10-17 14:26:02Z vboxsync $ */
2/** @file
3 * IPRT - Crypto - Microsoft SPC / Authenticode, Decoder for ASN.1.
4 */
5
6/*
7 * Copyright (C) 2006-2017 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
28/*********************************************************************************************************************************
29* Header Files *
30*********************************************************************************************************************************/
31#include "internal/iprt.h"
32#include <iprt/crypto/spc.h>
33
34#include <iprt/err.h>
35#include <iprt/string.h>
36#include <iprt/uuid.h>
37
38#include "spc-internal.h"
39
40
41/*
42 * One SPC Serialized Object Attribute.
43 */
44
45/** Decode the content of the octet string value if known. */
46static int rtCrSpcSerializedObject_DecodeMore(PRTASN1CURSOR pCursor, uint32_t fFlags,
47 PRTCRSPCSERIALIZEDOBJECT pThis, const char *pszErrorTag)
48
49{
50 RT_NOREF_PV(fFlags); RT_NOREF_PV(pszErrorTag);
51
52 int rc;
53 RTASN1CURSOR SubCursor;
54 if (RTUuidCompareStr(pThis->Uuid.Asn1Core.uData.pUuid, RTCRSPCSERIALIZEDOBJECT_UUID_STR) == 0)
55 {
56 rc = RTAsn1MemAllocZ(&pThis->SerializedData.EncapsulatedAllocation, (void **)&pThis->u.pData, sizeof(*pThis->u.pData));
57 if (RT_SUCCESS(rc))
58 {
59 pThis->SerializedData.pEncapsulated = (PRTASN1CORE)pThis->u.pData;
60 pThis->enmType = RTCRSPCSERIALIZEDOBJECTTYPE_ATTRIBUTES;
61
62 rc = RTAsn1CursorInitSubFromCore(pCursor, &pThis->SerializedData.Asn1Core, &SubCursor, "SerializedData");
63 if (RT_SUCCESS(rc))
64 rc = RTCrSpcSerializedObjectAttributes_DecodeAsn1(&SubCursor, 0, pThis->u.pData, "SD");
65 }
66 }
67 else
68 return VINF_SUCCESS;
69 if (RT_SUCCESS(rc))
70 rc = RTAsn1CursorCheckEnd(&SubCursor);
71 return rc;
72}
73
74/*
75 * Generate the code.
76 */
77#include <iprt/asn1-generator-asn1-decoder.h>
78
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