VirtualBox

Changeset 95681 in vbox for trunk/src/VBox/Runtime/r3/win


Ignore:
Timestamp:
Jul 17, 2022 6:39:27 PM (2 years ago)
Author:
vboxsync
Message:

IPRT/RTCrStoreCreateSnapshotById: Added two more store IDs for intermediate CAs so RTSignTool can search these when signing, only implemented for windows. Fixed an incorrect handle check in worker (windows). bugref:8691

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/win/RTCrStoreCreateSnapshotById-win.cpp

    r93115 r95681  
    5757    HCERTSTORE hNativeStore = pfnOpenStore(CERT_STORE_PROV_SYSTEM_W, PKCS_7_ASN_ENCODING | X509_ASN_ENCODING,
    5858                                           NULL /* hCryptProv = default */, fStore | fOpenStore, pwszStoreName);
    59     if (hStore)
     59    if (hNativeStore)
    6060    {
    6161        PCCERT_CONTEXT pCurCtx = NULL;
     
    137137                 * Do the work.
    138138                 */
     139                DWORD fStore = CERT_SYSTEM_STORE_CURRENT_USER;
    139140                switch (enmStoreId)
    140141                {
     142                    case RTCRSTOREID_SYSTEM_TRUSTED_CAS_AND_CERTIFICATES:
     143                    case RTCRSTOREID_SYSTEM_INTERMEDIATE_CAS:
     144                        fStore = CERT_SYSTEM_STORE_LOCAL_MACHINE;
     145                        RT_FALL_THRU();
    141146                    case RTCRSTOREID_USER_TRUSTED_CAS_AND_CERTIFICATES:
    142                     case RTCRSTOREID_SYSTEM_TRUSTED_CAS_AND_CERTIFICATES:
     147                    case RTCRSTOREID_USER_INTERMEDIATE_CAS:
    143148                    {
    144                         DWORD fStore = enmStoreId == RTCRSTOREID_USER_TRUSTED_CAS_AND_CERTIFICATES
    145                                      ? CERT_SYSTEM_STORE_CURRENT_USER : CERT_SYSTEM_STORE_LOCAL_MACHINE;
    146                         static PCRTUTF16 const s_apwszStores[] =  { L"AuthRoot", L"CA", L"MY", L"Root" };
    147                         for (uint32_t i = 0; i < RT_ELEMENTS(s_apwszStores); i++)
    148                             rc = rtCrStoreAddCertsFromNative(hStore, fStore, s_apwszStores[i], pfnOpenStore, pfnCloseStore,
     149                        /** @todo CA and MY in s_apwszRootStores are _very_ questionable!!! However,
     150                         * curl may need them  to work correct and it doesn't seem to have any
     151                         * intermediate ca file. :/ */
     152                        static PCRTUTF16 const s_apwszRootStores[] = { L"AuthRoot", L"CA", L"MY", L"Root" };
     153                        static PCRTUTF16 const s_apwszIntermediateStores[] = { L"CA", L"MY" };
     154                        PCRTUTF16 const *papwszStores = s_apwszRootStores;
     155                        uint32_t         cStores      = RT_ELEMENTS(s_apwszRootStores);
     156                        if (enmStoreId == RTCRSTOREID_USER_INTERMEDIATE_CAS || enmStoreId == RTCRSTOREID_SYSTEM_INTERMEDIATE_CAS)
     157                        {
     158                            papwszStores = s_apwszIntermediateStores;
     159                            cStores      = RT_ELEMENTS(s_apwszIntermediateStores);
     160                        }
     161
     162                        for (uint32_t i = 0; i < cStores; i++)
     163                            rc = rtCrStoreAddCertsFromNative(hStore, fStore, papwszStores[i], pfnOpenStore, pfnCloseStore,
    149164                                                             pfnEnumCerts, rc, pErrInfo);
    150165                        break;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette