- Timestamp:
- Apr 5, 2016 1:55:31 PM (9 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r60328 r60334 2982 2982 <enum 2983 2983 name="CertificateVersion" 2984 uuid="394b00ce-4b60-45ff-abe1-f58221d4f73b" 2985 > 2986 <desc> 2987 Possible version of certificate 2988 </desc> 2989 <const name="Unknown" value="0"/> 2990 <const name="One" value="1"/> 2991 <const name="Two" value="2"/> 2992 <const name="Three" value="3"/> 2993 <const name="Four" value="4"/> 2984 uuid="9e232a99-51d0-4dbd-96a0-ffac4bc3e2a8" 2985 > 2986 <desc> 2987 X.509 certificate version numbers. 2988 </desc> 2989 <const name="V1" value="1"/> 2990 <const name="V2" value="2"/> 2991 <const name="V3" value="3"/> 2992 <const name="Unknown" value="99"/> 2994 2993 </enum> 2995 2994 … … 3000 2999 <interface 3001 3000 name="ICertificate" extends="$unknown" 3002 uuid=" 336064ce-c853-4bd0-ad6c-b42d8ed99e5e"3001 uuid="c85f71ef-dd7f-4b9c-aa58-5c186a95d7f9" 3003 3002 wsmap="managed" 3004 reservedAttributes=" 4" reservedMethods="2"3005 > 3006 <desc> 3007 X 509 certificate details.3003 reservedAttributes="12" reservedMethods="2" 3004 > 3005 <desc> 3006 X.509 certificate details. 3008 3007 </desc> 3009 3008 <attribute name="versionNumber" type="CertificateVersion" readonly="yes"> … … 3029 3028 </attribute> 3030 3029 <attribute name="validityPeriodNotBefore" type="wstring" readonly="yes"> 3031 <desc> Time stamp in milliseconds since 1970-01-01 UTC.</desc>3030 <desc>Certificate not valid before ISO time stamp.</desc> 3032 3031 </attribute> 3033 3032 <attribute name="validityPeriodNotAfter" type="wstring" readonly="yes"> 3034 <desc> Time stamp in milliseconds since 1970-01-01 UTC.</desc>3033 <desc>Certificate not valid after ISO time stamp.</desc> 3035 3034 </attribute> 3036 3035 <attribute name="publicKeyAlgorithmOID" type="wstring" readonly="yes"> … … 3068 3067 <attribute name="trusted" type="boolean" readonly="yes"> 3069 3068 <desc>Set if the certificate is trusted.</desc> 3070 </attribute>3071 <attribute name="presence" type="boolean" readonly="yes">3072 <desc>Returns true in case of presence of certificate.</desc>3073 </attribute>3074 <attribute name="verified" type="boolean" readonly="yes">3075 <desc>Check whether certificate was verified or not during import.</desc>3076 3069 </attribute> 3077 3070 … … 3235 3228 3236 3229 <attribute name="certificate" type="ICertificate" readonly="yes"> 3237 <desc> X509 certificate information given to user if certificate exists in the OVF package 3230 <desc> 3231 The X.509 signing certificate, if the imported OVF was signed, @c null 3232 if not signed. This is available after calling <link to="#read"/>. 3238 3233 </desc> 3239 3234 </attribute> -
trunk/src/VBox/Main/include/ApplianceImpl.h
r60332 r60334 115 115 VirtualBox* const mVirtualBox; 116 116 117 ComObjPtr<Certificate> mptrCertificateInfo;118 117 struct ImportStack; 119 118 class TaskOVF; -
trunk/src/VBox/Main/include/ApplianceImplPrivate.h
r59679 r60334 137 137 fDeterminedDigestTypes = false; 138 138 fDigestTypes = RTMANIFEST_ATTR_SHA1 | RTMANIFEST_ATTR_SHA256 | RTMANIFEST_ATTR_SHA512; 139 ptrCertificateInfo.setNull(); 139 140 strCertError.setNull(); 140 141 } … … 168 169 RTVFSFILE hMemFileTheirManifest; 169 170 170 /** The signer certificate from the signature fi el(.cert).171 /** The signer certificate from the signature file (.cert). 171 172 * This will be used in the future provide information about the signer via 172 173 * the API. */ … … 192 193 /** The digest type used to sign the manifest. */ 193 194 RTDIGESTTYPE enmSignedDigestType; 195 /** The certificate info object. This is NULL if no signature and 196 * successfully loaded certificate. */ 197 ComObjPtr<Certificate> ptrCertificateInfo; 194 198 /** @} */ 195 199 -
trunk/src/VBox/Main/include/CertificateImpl.h
r60328 r60334 28 28 using namespace std; 29 29 30 class Appliance;31 32 30 class ATL_NO_VTABLE Certificate : 33 31 public CertificateWrap … … 38 36 DECLARE_EMPTY_CTOR_DTOR(Certificate) 39 37 40 HRESULT init(Appliance* appliance);41 38 HRESULT initCertificate(PCRTCRX509CERTIFICATE a_pCert, bool a_fTrusted); 42 39 void uninit(); … … 46 43 47 44 private: 48 const Appliance* m_appliance;49 50 45 // wrapped ICertificate properties 51 46 HRESULT getVersionNumber(CertificateVersion_T *aVersionNumber); … … 68 63 HRESULT getSelfSigned(BOOL *aSelfSigned); 69 64 HRESULT getTrusted(BOOL *aTrusted); 70 HRESULT getVerified(BOOL *aVerified);71 HRESULT getPresence(BOOL *aPresence);72 65 // wrapped ICertificate methods 73 66 HRESULT queryInfo(LONG aWhat, com::Utf8Str &aResult); -
trunk/src/VBox/Main/src-server/ApplianceImpl.cpp
r60332 r60334 410 410 AssertReturn(m->m_pSecretKeyStore, E_FAIL); 411 411 412 mptrCertificateInfo.createObject();413 mptrCertificateInfo->init(this);414 415 412 i_initApplianceIONameMap(); 416 413 … … 527 524 return E_ACCESSDENIED; 528 525 529 /** @todo r=bird: What about when there is no signature and certificate?*/530 m ptrCertificateInfo.queryInterfaceTo(aCertificateInfo.asOutParam());526 /* Can be NULL at this point, queryInterfaceto handles that. */ 527 m->ptrCertificateInfo.queryInterfaceTo(aCertificateInfo.asOutParam()); 531 528 return S_OK; 532 529 } -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r60332 r60334 1951 1951 /** @todo provide details about the signatory, signature, etc. */ 1952 1952 if (m->fSignerCertLoaded) 1953 mptrCertificateInfo->initCertificate(&m->SignerCert, m->fCertificateValid && !m->fCertificateMissingPath); 1953 { 1954 m->ptrCertificateInfo.createObject(); 1955 m->ptrCertificateInfo->initCertificate(&m->SignerCert, m->fCertificateValid && !m->fCertificateMissingPath); 1956 } 1954 1957 1955 1958 /* -
trunk/src/VBox/Main/src-server/CertificateImpl.cpp
r60331 r60334 22 22 23 23 #include "ProgressImpl.h" 24 #include "ApplianceImpl.h"25 #include "ApplianceImplPrivate.h"26 24 #include "CertificateImpl.h" 27 25 #include "AutoCaller.h" … … 86 84 } 87 85 88 HRESULT Certificate::init(Appliance* appliance)89 {90 HRESULT rc = S_OK;91 LogFlowThisFuncEnter();92 93 /* Enclose the state transition NotReady->InInit->Ready */94 AutoInitSpan autoInitSpan(this);95 AssertReturn(autoInitSpan.isOk(), E_FAIL);96 if(appliance!=NULL)97 {98 LogFlowThisFunc(("m_appliance: %d \n", m_appliance));99 m_appliance = appliance;100 }101 else102 rc = E_FAIL;103 104 /* Confirm a successful initialization when it's the case */105 if (SUCCEEDED(rc))106 autoInitSpan.setSucceeded();107 108 LogFlowThisFunc(("rc=%Rhrc\n", rc));109 LogFlowThisFuncLeave();110 111 return rc;112 }113 114 86 /** 115 87 * Initializes a certificate instance. … … 124 96 LogFlowThisFuncEnter(); 125 97 98 AutoInitSpan autoInitSpan(this); 99 AssertReturn(autoInitSpan.isOk(), E_FAIL); 100 126 101 mData = new Data(); 127 102 mData->m.allocate(); … … 132 107 mData->m->fValidX509 = true; 133 108 mData->m->fTrusted = a_fTrusted; 109 autoInitSpan.setSucceeded(); 134 110 } 135 111 else 136 112 rc = Global::vboxStatusCodeToCOM(vrc); 137 113 138 LogFlowThisFunc(("rc=%Rhrc\n", rc)); 139 LogFlowThisFuncLeave(); 140 114 LogFlowThisFunc(("returns rc=%Rhrc\n", rc)); 141 115 return rc; 142 116 } … … 164 138 165 139 Assert(mData->m->fValidX509); 166 /* version 1 has value 0, so +1.*/ 167 *aVersionNumber = (CertificateVersion_T)(mData->m->X509.TbsCertificate.T0.Version.uValue.u + 1); 168 140 switch (mData->m->X509.TbsCertificate.T0.Version.uValue.u) 141 { 142 case RTCRX509TBSCERTIFICATE_V1: *aVersionNumber = (CertificateVersion_T)CertificateVersion_V1; break; 143 case RTCRX509TBSCERTIFICATE_V2: *aVersionNumber = (CertificateVersion_T)CertificateVersion_V2; break; 144 case RTCRX509TBSCERTIFICATE_V3: *aVersionNumber = (CertificateVersion_T)CertificateVersion_V3; break; 145 default: AssertFailed(); *aVersionNumber = (CertificateVersion_T)CertificateVersion_Unknown; break; 146 } 169 147 return S_OK; 170 148 } … … 421 399 NOREF(aResult); 422 400 return setError(E_FAIL, "Unknown item %u", aWhat); 423 }424 425 /**426 * Private method implementation.427 * @param aPresence428 * @return aPresence429 */430 HRESULT Certificate::getPresence(BOOL *aPresence)431 {432 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);433 434 *aPresence = m_appliance->m->fSignerCertLoaded;435 436 return S_OK;437 }438 439 /**440 * Private method implementation.441 * @param aVerified442 * @return aVerified443 */444 HRESULT Certificate::getVerified(BOOL *aVerified)445 {446 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);447 448 *aVerified = (m_appliance->m->pbSignedDigest &&449 m_appliance->m->fCertificateValid &&450 m_appliance->m->fCertificateValidTime) ? true:false;451 452 return S_OK;453 401 } 454 402
Note:
See TracChangeset
for help on using the changeset viewer.