VirtualBox

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

Last change on this file since 72090 was 69500, checked in by vboxsync, 7 years ago

*: scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 KB
Line 
1/* $Id: CertificateImpl.h 69500 2017-10-28 15:14:05Z vboxsync $ */
2/** @file
3 * VirtualBox COM ICertificate implementation.
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
18#ifndef ____H_CERTIFICATEIMPL
19#define ____H_CERTIFICATEIMPL
20
21/* VBox includes */
22#include <iprt/crypto/x509.h>
23#include "CertificateWrap.h"
24
25#include <vector>
26
27using namespace std;
28
29/**
30 * Implemenation of ICertificate.
31 *
32 * This implemenation is a very thin wrapper around an immutable
33 * RTCRX509CERTIFICATE and a few caller stated views.
34 *
35 * The views are whether the caller thinks the certificate is trustworthly, and
36 * whether the caller thinks it's expired or not. The caller could be sitting
37 * on more information, like timestamp and intermediate certificates, that helps
38 * inform the caller's view on these two topics.
39 *
40 * @remarks It could be helpful to let the caller also add certificate paths
41 * showing how this certificate ends up being trusted. However, that's
42 * possibly quite some work and will have to wait till required...
43 */
44class ATL_NO_VTABLE Certificate
45 : public CertificateWrap
46{
47
48public:
49
50 DECLARE_EMPTY_CTOR_DTOR(Certificate)
51
52 HRESULT initCertificate(PCRTCRX509CERTIFICATE a_pCert, bool a_fTrusted, bool a_fExpired);
53 void uninit();
54
55 HRESULT FinalConstruct();
56 void FinalRelease();
57
58private:
59 // Wrapped ICertificate properties
60 HRESULT getVersionNumber(CertificateVersion_T *aVersionNumber);
61 HRESULT getSerialNumber(com::Utf8Str &aSerialNumber);
62 HRESULT getSignatureAlgorithmOID(com::Utf8Str &aSignatureAlgorithmOID);
63 HRESULT getSignatureAlgorithmName(com::Utf8Str &aSignatureAlgorithmName);
64 HRESULT getPublicKeyAlgorithmOID(com::Utf8Str &aPublicKeyAlgorithmOID);
65 HRESULT getPublicKeyAlgorithm(com::Utf8Str &aPublicKeyAlgorithm);
66 HRESULT getIssuerName(std::vector<com::Utf8Str> &aIssuerName);
67 HRESULT getSubjectName(std::vector<com::Utf8Str> &aSubjectName);
68 HRESULT getFriendlyName(com::Utf8Str &aFriendlyName);
69 HRESULT getValidityPeriodNotBefore(com::Utf8Str &aValidityPeriodNotBefore);
70 HRESULT getValidityPeriodNotAfter(com::Utf8Str &aValidityPeriodNotAfter);
71 HRESULT getSubjectPublicKey(std::vector<BYTE> &aSubjectPublicKey);
72 HRESULT getIssuerUniqueIdentifier(com::Utf8Str &aIssuerUniqueIdentifier);
73 HRESULT getSubjectUniqueIdentifier(com::Utf8Str &aSubjectUniqueIdentifier);
74 HRESULT getCertificateAuthority(BOOL *aCertificateAuthority);
75 HRESULT getKeyUsage(ULONG *aKeyUsage);
76 HRESULT getExtendedKeyUsage(std::vector<com::Utf8Str> &aExtendedKeyUsage);
77 HRESULT getRawCertData(std::vector<BYTE> &aRawCertData);
78 HRESULT getSelfSigned(BOOL *aSelfSigned);
79 HRESULT getTrusted(BOOL *aTrusted);
80 HRESULT getExpired(BOOL *aExpired);
81
82 // Wrapped ICertificate methods
83 HRESULT isCurrentlyExpired(BOOL *aResult);
84 HRESULT queryInfo(LONG aWhat, com::Utf8Str &aResult);
85
86 // Methods extracting COM data from the certificate object
87 HRESULT i_getAlgorithmName(PCRTCRX509ALGORITHMIDENTIFIER a_pAlgId, com::Utf8Str &a_rReturn);
88 HRESULT i_getX509Name(PCRTCRX509NAME a_pName, std::vector<com::Utf8Str> &a_rReturn);
89 HRESULT i_getTime(PCRTASN1TIME a_pTime, com::Utf8Str &a_rReturn);
90 HRESULT i_getUniqueIdentifier(PCRTCRX509UNIQUEIDENTIFIER a_pUniqueId, com::Utf8Str &a_rReturn);
91 HRESULT i_getEncodedBytes(PRTASN1CORE a_pAsn1Obj, std::vector<BYTE> &a_rReturn);
92
93 struct Data;
94 /** Pointer to the private instance data */
95 Data *m;
96};
97
98#endif // !____H_CERTIFICATEIMPL
99
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