VirtualBox

source: vbox/trunk/src/VBox/Main/include/CertificateImpl.h@ 60334

Last change on this file since 60334 was 60334, checked in by vboxsync, 9 years ago

CertificateImpl,ApplianceImpl: Drop the unwanted presence attribute and replaced by returning NULL object in IAppliance::getCertificate. Move the certificate object to the data structure. Dropped the clearly unwanted init() method that (a) kept wanting to relate to IAppliance which I though I made clear several times it should not, (b) create an Certificate object in a unready state where most attributes would assert in debug builds and possibly crash. Renamed the CertificateVersion bits and redid the query method to no assume stuff.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 KB
Line 
1/* $Id: CertificateImpl.h 60334 2016-04-05 13:55:31Z vboxsync $ */
2/** @file
3 * VirtualBox COM ICertificate implementation.
4 */
5
6/*
7 * Copyright (C) 2006-2016 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
18#ifndef ____H_CERTIFICATEIMPL
19#define ____H_CERTIFICATEIMPL
20
21/* VBox includes */
22#include <VBox/settings.h>
23#include <iprt/crypto/x509.h>
24#include "CertificateWrap.h"
25
26#include <vector>
27
28using namespace std;
29
30class ATL_NO_VTABLE Certificate :
31 public CertificateWrap
32{
33
34public:
35
36 DECLARE_EMPTY_CTOR_DTOR(Certificate)
37
38 HRESULT initCertificate(PCRTCRX509CERTIFICATE a_pCert, bool a_fTrusted);
39 void uninit();
40
41 HRESULT FinalConstruct();
42 void FinalRelease();
43
44private:
45 // wrapped ICertificate properties
46 HRESULT getVersionNumber(CertificateVersion_T *aVersionNumber);
47 HRESULT getSerialNumber(com::Utf8Str &aSerialNumber);
48 HRESULT getSignatureAlgorithmOID(com::Utf8Str &aSignatureAlgorithmOID);
49 HRESULT getSignatureAlgorithmName(com::Utf8Str &aSignatureAlgorithmName);
50 HRESULT getPublicKeyAlgorithmOID(com::Utf8Str &aPublicKeyAlgorithmOID);
51 HRESULT getPublicKeyAlgorithm(com::Utf8Str &aPublicKeyAlgorithm);
52 HRESULT getIssuerName(std::vector<com::Utf8Str> &aIssuerName);
53 HRESULT getSubjectName(std::vector<com::Utf8Str> &aSubjectName);
54 HRESULT getValidityPeriodNotBefore(com::Utf8Str &aValidityPeriodNotBefore);
55 HRESULT getValidityPeriodNotAfter(com::Utf8Str &aValidityPeriodNotAfter);
56 HRESULT getSubjectPublicKey(std::vector<BYTE> &aSubjectPublicKey);
57 HRESULT getIssuerUniqueIdentifier(com::Utf8Str &aIssuerUniqueIdentifier);
58 HRESULT getSubjectUniqueIdentifier(com::Utf8Str &aSubjectUniqueIdentifier);
59 HRESULT getCertificateAuthority(BOOL *aCertificateAuthority);
60 HRESULT getKeyUsage(ULONG *aKeyUsage);
61 HRESULT getExtendedKeyUsage(std::vector<com::Utf8Str> &aExtendedKeyUsage);
62 HRESULT getRawCertData(std::vector<BYTE> &aRawCertData);
63 HRESULT getSelfSigned(BOOL *aSelfSigned);
64 HRESULT getTrusted(BOOL *aTrusted);
65 // wrapped ICertificate methods
66 HRESULT queryInfo(LONG aWhat, com::Utf8Str &aResult);
67
68 /** @name Methods extracting COM data from the certificate object
69 * @{ */
70 HRESULT i_getAlgorithmName(PCRTCRX509ALGORITHMIDENTIFIER a_pAlgId, com::Utf8Str &a_rReturn);
71 HRESULT i_getX509Name(PCRTCRX509NAME a_pName, std::vector<com::Utf8Str> &a_rReturn);
72 HRESULT i_getTime(PCRTASN1TIME a_pTime, com::Utf8Str &a_rReturn);
73 HRESULT i_getUniqueIdentifier(PCRTCRX509UNIQUEIDENTIFIER a_pUniqueId, com::Utf8Str &a_rReturn);
74 HRESULT i_getEncodedBytes(PRTASN1CORE a_pAsn1Obj, std::vector<BYTE> &a_rReturn);
75 /** @} */
76
77 //data
78 struct Data;
79 Data *mData;
80
81};
82
83#endif // !____H_CERTIFICATEIMPL
84
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