1 | /* $Id: CertificateImpl.h 60341 2016-04-05 23:37:57Z 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 |
|
---|
28 | using namespace std;
|
---|
29 |
|
---|
30 | class ATL_NO_VTABLE Certificate :
|
---|
31 | public CertificateWrap
|
---|
32 | {
|
---|
33 |
|
---|
34 | public:
|
---|
35 |
|
---|
36 | DECLARE_EMPTY_CTOR_DTOR(Certificate)
|
---|
37 |
|
---|
38 | HRESULT initCertificate(PCRTCRX509CERTIFICATE a_pCert, bool a_fTrusted, bool a_fExpired);
|
---|
39 | void uninit();
|
---|
40 |
|
---|
41 | HRESULT FinalConstruct();
|
---|
42 | void FinalRelease();
|
---|
43 |
|
---|
44 | private:
|
---|
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 getFriendlyName(com::Utf8Str &aFriendlyName);
|
---|
55 | HRESULT getValidityPeriodNotBefore(com::Utf8Str &aValidityPeriodNotBefore);
|
---|
56 | HRESULT getValidityPeriodNotAfter(com::Utf8Str &aValidityPeriodNotAfter);
|
---|
57 | HRESULT getSubjectPublicKey(std::vector<BYTE> &aSubjectPublicKey);
|
---|
58 | HRESULT getIssuerUniqueIdentifier(com::Utf8Str &aIssuerUniqueIdentifier);
|
---|
59 | HRESULT getSubjectUniqueIdentifier(com::Utf8Str &aSubjectUniqueIdentifier);
|
---|
60 | HRESULT getCertificateAuthority(BOOL *aCertificateAuthority);
|
---|
61 | HRESULT getKeyUsage(ULONG *aKeyUsage);
|
---|
62 | HRESULT getExtendedKeyUsage(std::vector<com::Utf8Str> &aExtendedKeyUsage);
|
---|
63 | HRESULT getRawCertData(std::vector<BYTE> &aRawCertData);
|
---|
64 | HRESULT getSelfSigned(BOOL *aSelfSigned);
|
---|
65 | HRESULT getTrusted(BOOL *aTrusted);
|
---|
66 | HRESULT getExpired(BOOL *aExpired);
|
---|
67 | // wrapped ICertificate methods
|
---|
68 | HRESULT isCurrentlyExpired(BOOL *aResult);
|
---|
69 | HRESULT queryInfo(LONG aWhat, com::Utf8Str &aResult);
|
---|
70 |
|
---|
71 | /** @name Methods extracting COM data from the certificate object
|
---|
72 | * @{ */
|
---|
73 | HRESULT i_getAlgorithmName(PCRTCRX509ALGORITHMIDENTIFIER a_pAlgId, com::Utf8Str &a_rReturn);
|
---|
74 | HRESULT i_getX509Name(PCRTCRX509NAME a_pName, std::vector<com::Utf8Str> &a_rReturn);
|
---|
75 | HRESULT i_getTime(PCRTASN1TIME a_pTime, com::Utf8Str &a_rReturn);
|
---|
76 | HRESULT i_getUniqueIdentifier(PCRTCRX509UNIQUEIDENTIFIER a_pUniqueId, com::Utf8Str &a_rReturn);
|
---|
77 | HRESULT i_getEncodedBytes(PRTASN1CORE a_pAsn1Obj, std::vector<BYTE> &a_rReturn);
|
---|
78 | /** @} */
|
---|
79 |
|
---|
80 | //data
|
---|
81 | struct Data;
|
---|
82 | Data *mData;
|
---|
83 |
|
---|
84 | };
|
---|
85 |
|
---|
86 | #endif // !____H_CERTIFICATEIMPL
|
---|
87 |
|
---|