VirtualBox

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

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

Merged in iprt++ dev branch.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
1/* $Id: spc-asn1-decoder.cpp 51770 2014-07-01 18:14:02Z vboxsync $ */
2/** @file
3 * IPRT - Crypto - Microsoft SPC / Authenticode, Decoder for ASN.1.
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
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 int rc;
51 RTASN1CURSOR SubCursor;
52 if (RTUuidCompareStr(pThis->Uuid.Asn1Core.uData.pUuid, RTCRSPCSERIALIZEDOBJECT_UUID_STR) == 0)
53 {
54 rc = RTAsn1MemAllocZ(&pThis->SerializedData.EncapsulatedAllocation, (void **)&pThis->u.pData, sizeof(*pThis->u.pData));
55 if (RT_SUCCESS(rc))
56 {
57 pThis->SerializedData.pEncapsulated = (PRTASN1CORE)pThis->u.pData;
58 pThis->enmType = RTCRSPCSERIALIZEDOBJECTTYPE_ATTRIBUTES;
59
60 RTAsn1CursorInitSubFromCore(pCursor, &pThis->SerializedData.Asn1Core, &SubCursor, "SerializedData");
61 rc = RTCrSpcSerializedObjectAttributes_DecodeAsn1(&SubCursor, 0, pThis->u.pData, "SD");
62 }
63 }
64 else
65 return VINF_SUCCESS;
66 if (RT_SUCCESS(rc))
67 rc = RTAsn1CursorCheckEnd(&SubCursor);
68 return rc;
69}
70
71/*
72 * Generate the code.
73 */
74#include <iprt/asn1-generator-asn1-decoder.h>
75
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