vbox的更動 60246 路徑 trunk/src/VBox/Main
- 時間撮記:
- 2016-3-29 下午02:56:40 (9 年 以前)
- 位置:
- trunk/src/VBox/Main
- 檔案:
-
- 修改 2 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Main/include/CertificateImpl.h
r60243 r60246 45 45 46 46 #ifdef DONT_DUPLICATE_ALL_THE_DATA 47 HRESULT init (PCRTCRX509CERTIFICATE a_pCert);47 HRESULT initCertificate(PCRTCRX509CERTIFICATE a_pCert, bool a_fTrusted); 48 48 #else 49 49 HRESULT init(Appliance* appliance); -
trunk/src/VBox/Main/src-server/CertificateImpl.cpp
r60243 r60246 99 99 }; 100 100 101 #ifndef DONT_DUPLICATE_ALL_THE_DATA 101 102 const char* const strUnknownAlgorithm = "Unknown Algorithm"; 102 103 const char* const strRsaEncription = "rsaEncryption"; … … 109 110 const char* const strSha512WithRSAEncryption = "sha512WithRSAEncryption"; 110 111 const char* const strSha224WithRSAEncryption = "sha224WithRSAEncryption"; 112 #endif 111 113 112 114 /////////////////////////////////////////////////////////////////////////////////// … … 130 132 131 133 #ifdef DONT_DUPLICATE_ALL_THE_DATA 132 HRESULT Certificate::init(PCRTCRX509CERTIFICATE a_pCert) 134 /** 135 * Initializes a certificate instance. 136 * 137 * @returns COM status code. 138 * @param a_pCert The certificate. 139 * @param a_fTrusted Whether the caller trusts the certificate or not. 140 */ 141 HRESULT Certificate::initCertificate(PCRTCRX509CERTIFICATE a_pCert, bool a_fTrusted) 133 142 #else 134 143 HRESULT Certificate::init(Appliance* appliance) … … 157 166 int vrc = RTCrX509Certificate_Clone(&mData->m->X509, a_pCert, &g_RTAsn1DefaultAllocator); 158 167 if (RT_SUCCESS(vrc)) 168 { 159 169 mData->m->fValidX509 = true; 170 mData->m->fTrusted = a_fTrusted; 171 } 160 172 else 161 173 rc = Global::vboxStatusCodeToCOM(vrc); … … 894 906 HRESULT Certificate::i_getAlgorithmName(PCRTCRX509ALGORITHMIDENTIFIER a_pAlgId, com::Utf8Str &a_rReturn) 895 907 { 896 /** @todo */ 897 NOREF(a_pAlgId); 898 NOREF(a_rReturn); 899 return E_NOTIMPL; 908 const char *pszOid = a_pAlgId->Algorithm.szObjId; 909 const char *pszName; 910 if (!pszOid) pszName = ""; 911 else if (strcmp(pszOid, RTCRX509ALGORITHMIDENTIFIERID_RSA)) pszName = "rsaEncryption"; 912 else if (strcmp(pszOid, RTCRX509ALGORITHMIDENTIFIERID_MD2_WITH_RSA)) pszName = "md2WithRSAEncryption"; 913 else if (strcmp(pszOid, RTCRX509ALGORITHMIDENTIFIERID_MD4_WITH_RSA)) pszName = "md4WithRSAEncryption"; 914 else if (strcmp(pszOid, RTCRX509ALGORITHMIDENTIFIERID_MD5_WITH_RSA)) pszName = "md5WithRSAEncryption"; 915 else if (strcmp(pszOid, RTCRX509ALGORITHMIDENTIFIERID_SHA1_WITH_RSA)) pszName = "sha1WithRSAEncryption"; 916 else if (strcmp(pszOid, RTCRX509ALGORITHMIDENTIFIERID_SHA224_WITH_RSA)) pszName = "sha224WithRSAEncryption"; 917 else if (strcmp(pszOid, RTCRX509ALGORITHMIDENTIFIERID_SHA256_WITH_RSA)) pszName = "sha256WithRSAEncryption"; 918 else if (strcmp(pszOid, RTCRX509ALGORITHMIDENTIFIERID_SHA384_WITH_RSA)) pszName = "sha384WithRSAEncryption"; 919 else if (strcmp(pszOid, RTCRX509ALGORITHMIDENTIFIERID_SHA512_WITH_RSA)) pszName = "sha512WithRSAEncryption"; 920 else 921 pszName = pszOid; 922 a_rReturn = pszName; 923 return S_OK; 900 924 } 901 925 902 926 HRESULT Certificate::i_getX509Name(PCRTCRX509NAME a_pName, std::vector<com::Utf8Str> &a_rReturn) 903 927 { 904 /** @todo */ 905 NOREF(a_pName); 906 NOREF(a_rReturn); 907 return E_NOTIMPL; 928 if (RTCrX509Name_IsPresent(a_pName)) 929 { 930 for (uint32_t i = 0; i < a_pName->cItems; i++) 931 { 932 PCRTCRX509RELATIVEDISTINGUISHEDNAME pRdn = &a_pName->paItems[i]; 933 for (uint32_t j = 0; j < pRdn->cItems; j++) 934 { 935 PCRTCRX509ATTRIBUTETYPEANDVALUE pComponent = &pRdn->paItems[j]; 936 937 AssertReturn(pComponent->Value.enmType == RTASN1TYPE_STRING, 938 setErrorVrc(VERR_CR_X509_NAME_NOT_STRING, "VERR_CR_X509_NAME_NOT_STRING")); 939 940 /* Get the prefix for this name component. */ 941 const char *pszPrefix = RTCrX509Name_GetShortRdn(&pComponent->Type); 942 AssertStmt(pszPrefix, pszPrefix = pComponent->Type.szObjId); 943 944 /* Get the string. */ 945 const char *pszUtf8; 946 int vrc = RTAsn1String_QueryUtf8(&pComponent->Value.u.String, &pszUtf8, NULL /*pcch*/); 947 AssertRCReturn(vrc, setErrorVrc(vrc, "RTAsn1String_QueryUtf8(%u/%u,,) -> %Rrc", i, j, vrc)); 948 949 a_rReturn.push_back(Utf8StrFmt("%s=%s", pszPrefix, pszUtf8)); 950 } 951 } 952 } 953 return S_OK; 908 954 } 909 955
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器