1 | /** @file
|
---|
2 | * VirtualBox COM class implementation
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2013 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | */
|
---|
16 |
|
---|
17 | #ifndef ____H_CERTIFICATEIMPL
|
---|
18 | #define ____H_CERTIFICATEIMPL
|
---|
19 |
|
---|
20 | /* VBox includes */
|
---|
21 | #include <VBox/settings.h>
|
---|
22 |
|
---|
23 |
|
---|
24 | #include "CertificateWrap.h"
|
---|
25 |
|
---|
26 | #include <vector>
|
---|
27 |
|
---|
28 | using namespace std;
|
---|
29 |
|
---|
30 | /* VBox forward declarations */
|
---|
31 | class Appliance;
|
---|
32 | struct RTCRX509CERTIFICATE;
|
---|
33 |
|
---|
34 | class ATL_NO_VTABLE Certificate :
|
---|
35 | public CertificateWrap
|
---|
36 | {
|
---|
37 |
|
---|
38 | public:
|
---|
39 |
|
---|
40 | DECLARE_EMPTY_CTOR_DTOR(Certificate)
|
---|
41 |
|
---|
42 | HRESULT init(Appliance* appliance);
|
---|
43 | void uninit();
|
---|
44 |
|
---|
45 | HRESULT FinalConstruct();
|
---|
46 | void FinalRelease();
|
---|
47 |
|
---|
48 | HRESULT setData(RTCRX509CERTIFICATE *inCert);
|
---|
49 |
|
---|
50 | private:
|
---|
51 |
|
---|
52 | const Appliance* m_appliance;
|
---|
53 |
|
---|
54 | HRESULT setVersionNumber(uint64_t inVersionNumber);
|
---|
55 | HRESULT setSerialNumber(uint64_t inSerialNumber);
|
---|
56 | HRESULT setPublicKeyAlgorithmOID(const char *aPublicKeyAlgorithmOID);
|
---|
57 | HRESULT setPublicKeyAlgorithmName(const char *aPublicKeyAlgorithmOID);
|
---|
58 | HRESULT setSignatureAlgorithmOID(const char *aSignatureAlgorithmOID);
|
---|
59 | HRESULT setSignatureAlgorithmName(const char *aSignatureAlgorithmOID);
|
---|
60 | HRESULT setIssuerName(com::Utf8Str &aIssuerName);
|
---|
61 | HRESULT setSubjectName(com::Utf8Str &aSubjectName);
|
---|
62 | HRESULT setValidityPeriodNotBefore(PCRTTIME aValidityPeriodNotBefore);
|
---|
63 | HRESULT setValidityPeriodNotAfter(PCRTTIME aValidityPeriodNotAfter);
|
---|
64 | HRESULT setCertificateAuthority(BOOL aCertificateAuthority);
|
---|
65 | HRESULT setSelfSigned(BOOL aSelfSigned);
|
---|
66 | HRESULT setTrusted(BOOL aTrusted);
|
---|
67 | // HRESULT setSubjectPublicKey(std::vector<BYTE> aSubjectPublicKey);
|
---|
68 | // HRESULT setIssuerUniqueIdentifier(std::vector<BYTE> aIssuerUniqueIdentifier);
|
---|
69 | // HRESULT setSubjectUniqueIdentifier(std::vector<BYTE> aSubjectUniqueIdentifier);
|
---|
70 | // HRESULT setKeyUsage(std::vector<ULONG> aKeyUsage);
|
---|
71 | // HRESULT setExtendedKeyUsage(std::vector<com::Utf8Str> aExtendedKeyUsage);
|
---|
72 | // HRESULT setRawCertData(std::vector<BYTE> aRawCertData);
|
---|
73 |
|
---|
74 | // wrapped ICertificate properties
|
---|
75 | HRESULT getVersionNumber(com::Utf8Str &aVersionNumber);
|
---|
76 | HRESULT getSerialNumber(com::Utf8Str &aSerialNumber);
|
---|
77 | HRESULT getSignatureAlgorithmOID(com::Utf8Str &aSignatureAlgorithmOID);
|
---|
78 | HRESULT getSignatureAlgorithmName(com::Utf8Str &aSignatureAlgorithmName);
|
---|
79 | HRESULT getPublicKeyAlgorithm(com::Utf8Str &aPublicKeyAlgorithm);
|
---|
80 | HRESULT getIssuerName(std::vector<com::Utf8Str> &aIssuerName);
|
---|
81 | HRESULT getSubjectName(std::vector<com::Utf8Str> &aSubjectName);
|
---|
82 | HRESULT getValidityPeriodNotBefore(com::Utf8Str &aValidityPeriodNotBefore);
|
---|
83 | HRESULT getValidityPeriodNotAfter(com::Utf8Str &aValidityPeriodNotAfter);
|
---|
84 | HRESULT getSubjectPublicKey(std::vector<BYTE> &aSubjectPublicKey);
|
---|
85 | HRESULT getIssuerUniqueIdentifier(std::vector<BYTE> &aIssuerUniqueIdentifier);
|
---|
86 | HRESULT getSubjectUniqueIdentifier(std::vector<BYTE> &aSubjectUniqueIdentifier);
|
---|
87 | HRESULT getCertificateAuthority(BOOL *aCertificateAuthority);
|
---|
88 | HRESULT getKeyUsage(std::vector<ULONG> &aKeyUsage);
|
---|
89 | HRESULT getExtendedKeyUsage(std::vector<com::Utf8Str> &aExtendedKeyUsage);
|
---|
90 | HRESULT getRawCertData(std::vector<BYTE> &aRawCertData);
|
---|
91 | HRESULT getSelfSigned(BOOL *aSelfSigned);
|
---|
92 | HRESULT getTrusted(BOOL *aTrusted);
|
---|
93 |
|
---|
94 | // wrapped ICertificate methods
|
---|
95 | HRESULT queryInfo(LONG aWhat, com::Utf8Str &aResult);
|
---|
96 | HRESULT checkExistence(BOOL *aPresence);
|
---|
97 | HRESULT isVerified(BOOL *aVerified);
|
---|
98 | //data
|
---|
99 | struct Data;
|
---|
100 | Data *mData;
|
---|
101 |
|
---|
102 | };
|
---|
103 |
|
---|
104 | #endif // !____H_CERTIFICATEIMPL
|
---|
105 |
|
---|