View | Details | Raw Unified | Return to issue 120675
Collapse All | Expand All

(-)xmlsecurity.o/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx (-19 / +42 lines)
Lines 122-128 Link Here
122
    }
122
    }
123
}
123
}
124
124
125
SecurityEnvironment_MSCryptImpl :: SecurityEnvironment_MSCryptImpl( const Reference< XMultiServiceFactory >& aFactory ) : m_hProv( NULL ) , m_pszContainer( NULL ) , m_hKeyStore( NULL ), m_hCertStore( NULL ), m_tSymKeyList() , m_tPubKeyList() , m_tPriKeyList(), m_xServiceManager( aFactory ), m_bEnableDefault( sal_False ) {
125
SecurityEnvironment_MSCryptImpl :: SecurityEnvironment_MSCryptImpl( const Reference< XMultiServiceFactory >& aFactory ) : m_hProv( NULL ) , m_pszContainer( NULL ) , m_hKeyStore( NULL ), m_hCertStore( NULL ), m_tSymKeyList() , m_tPubKeyList() , m_tPriKeyList(), m_xServiceManager( aFactory ), m_bEnableDefault( sal_False ), m_hMySystemStore(NULL), m_hRootSystemStore(NULL), m_hTrustSystemStore(NULL), m_hCaSystemStore(NULL){
126
126
127
}
127
}
128
128
Lines 148-153 Link Here
148
		m_hKeyStore = NULL ;
148
		m_hKeyStore = NULL ;
149
	}
149
	}
150
150
151
	//i120675, close the store handles 
152
	if( m_hMySystemStore != NULL ) {
153
		CertCloseStore( m_hMySystemStore, CERT_CLOSE_STORE_CHECK_FLAG ) ;
154
		m_hMySystemStore = NULL ;
155
	}
156
157
	if( m_hRootSystemStore != NULL ) {
158
		CertCloseStore( m_hRootSystemStore, CERT_CLOSE_STORE_CHECK_FLAG ) ;
159
		m_hRootSystemStore = NULL ;
160
	}
161
162
	if( m_hTrustSystemStore != NULL ) {
163
		CertCloseStore( m_hTrustSystemStore, CERT_CLOSE_STORE_CHECK_FLAG ) ;
164
		m_hTrustSystemStore = NULL ;
165
	}
166
167
	if( m_hCaSystemStore != NULL ) {
168
		CertCloseStore( m_hCaSystemStore, CERT_CLOSE_STORE_CHECK_FLAG ) ;
169
		m_hCaSystemStore = NULL ;
170
	}
171
151
	if( !m_tSymKeyList.empty()  ) {
172
	if( !m_tSymKeyList.empty()  ) {
152
		std::list< HCRYPTKEY >::iterator symKeyIt ;
173
		std::list< HCRYPTKEY >::iterator symKeyIt ;
153
174
Lines 1260-1299 Link Here
1260
	 * Adopt system default certificate store.
1281
	 * Adopt system default certificate store.
1261
	 */
1282
	 */
1262
	if( defaultEnabled() ) {
1283
	if( defaultEnabled() ) {
1263
		HCERTSTORE hSystemStore ;
1264
1265
		//Add system key store into the keys manager.
1284
		//Add system key store into the keys manager.
1266
		hSystemStore = CertOpenSystemStore( 0, "MY" ) ;
1285
		m_hMySystemStore = CertOpenSystemStore( 0, "MY" ) ;
1267
		if( hSystemStore != NULL ) {
1286
		if( m_hMySystemStore != NULL ) {
1268
			if( xmlSecMSCryptoAppliedKeysMngrAdoptKeyStore( pKeysMngr, hSystemStore ) < 0 ) {
1287
			if( xmlSecMSCryptoAppliedKeysMngrAdoptKeyStore( pKeysMngr, m_hMySystemStore ) < 0 ) {
1269
				CertCloseStore( hSystemStore, CERT_CLOSE_STORE_CHECK_FLAG ) ;
1288
				CertCloseStore( m_hMySystemStore, CERT_CLOSE_STORE_CHECK_FLAG ) ;
1289
				m_hMySystemStore = NULL;
1270
				throw RuntimeException() ;
1290
				throw RuntimeException() ;
1271
			}
1291
			}
1272
		}
1292
		}
1273
1293
1274
		//Add system root store into the keys manager.
1294
		//Add system root store into the keys manager.
1275
		hSystemStore = CertOpenSystemStore( 0, "Root" ) ;
1295
		m_hRootSystemStore = CertOpenSystemStore( 0, "Root" ) ;
1276
		if( hSystemStore != NULL ) {
1296
		if( m_hRootSystemStore != NULL ) {
1277
			if( xmlSecMSCryptoAppliedKeysMngrAdoptTrustedStore( pKeysMngr, hSystemStore ) < 0 ) {
1297
			if( xmlSecMSCryptoAppliedKeysMngrAdoptTrustedStore( pKeysMngr, m_hRootSystemStore ) < 0 ) {
1278
				CertCloseStore( hSystemStore, CERT_CLOSE_STORE_CHECK_FLAG ) ;
1298
				CertCloseStore( m_hRootSystemStore, CERT_CLOSE_STORE_CHECK_FLAG ) ;
1299
				m_hRootSystemStore = NULL;
1279
				throw RuntimeException() ;
1300
				throw RuntimeException() ;
1280
			}
1301
			}
1281
		}
1302
		}
1282
1303
1283
		//Add system trusted store into the keys manager.
1304
		//Add system trusted store into the keys manager.
1284
		hSystemStore = CertOpenSystemStore( 0, "Trust" ) ;
1305
		m_hTrustSystemStore = CertOpenSystemStore( 0, "Trust" ) ;
1285
		if( hSystemStore != NULL ) {
1306
		if( m_hTrustSystemStore != NULL ) {
1286
			if( xmlSecMSCryptoAppliedKeysMngrAdoptUntrustedStore( pKeysMngr, hSystemStore ) < 0 ) {
1307
			if( xmlSecMSCryptoAppliedKeysMngrAdoptUntrustedStore( pKeysMngr, m_hTrustSystemStore ) < 0 ) {
1287
				CertCloseStore( hSystemStore, CERT_CLOSE_STORE_CHECK_FLAG ) ;
1308
				CertCloseStore( m_hTrustSystemStore, CERT_CLOSE_STORE_CHECK_FLAG ) ;
1309
				m_hTrustSystemStore = NULL;
1288
				throw RuntimeException() ;
1310
				throw RuntimeException() ;
1289
			}
1311
			}
1290
		}
1312
		}
1291
1313
1292
		//Add system CA store into the keys manager.
1314
		//Add system CA store into the keys manager.
1293
		hSystemStore = CertOpenSystemStore( 0, "CA" ) ;
1315
		m_hCaSystemStore = CertOpenSystemStore( 0, "CA" ) ;
1294
		if( hSystemStore != NULL ) {
1316
		if( m_hCaSystemStore != NULL ) {
1295
			if( xmlSecMSCryptoAppliedKeysMngrAdoptUntrustedStore( pKeysMngr, hSystemStore ) < 0 ) {
1317
			if( xmlSecMSCryptoAppliedKeysMngrAdoptUntrustedStore( pKeysMngr, m_hCaSystemStore ) < 0 ) {
1296
				CertCloseStore( hSystemStore, CERT_CLOSE_STORE_CHECK_FLAG ) ;
1318
				CertCloseStore( m_hCaSystemStore, CERT_CLOSE_STORE_CHECK_FLAG ) ;
1319
				m_hCaSystemStore = NULL;
1297
				throw RuntimeException() ;
1320
				throw RuntimeException() ;
1298
			}
1321
			}
1299
		}
1322
		}
(-)xmlsecurity.o/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx (-1 / +7 lines)
Lines 75-81 Link Here
75
75
76
		//Certiticate store
76
		//Certiticate store
77
		HCERTSTORE							m_hCertStore ;
77
		HCERTSTORE							m_hCertStore ;
78
78
		
79
		// i120675, save the store handles
80
		HCERTSTORE 							m_hMySystemStore;
81
		HCERTSTORE 							m_hRootSystemStore;
82
		HCERTSTORE 							m_hTrustSystemStore;
83
		HCERTSTORE 							m_hCaSystemStore;
84
		
79
		//Enable default system cryptography setting
85
		//Enable default system cryptography setting
80
		sal_Bool							m_bEnableDefault ;
86
		sal_Bool							m_bEnableDefault ;
81
87

Return to issue 120675