// If privateKey it's available, load it too..
CspParameters cspParams = new CspParameters ();
cspParams.KeyContainerName = CryptoConvert.ToHex (cert.Hash);
- cspParams.Flags = CspProviderFlags.UseMachineKeyStore;
+ if (_storePath.StartsWith (X509StoreManager.LocalMachinePath))
+ cspParams.Flags = CspProviderFlags.UseMachineKeyStore;
KeyPairPersistence kpp = new KeyPairPersistence (cspParams);
if (!kpp.Load ())
}
return list;
}
-#if !INSIDE_CORLIB
+#if !NET_2_1
private void ImportPrivateKey (X509Certificate certificate, CspParameters cspParams)
{
RSACryptoServiceProvider rsaCsp = certificate.RSA as RSACryptoServiceProvider;
{
string subject = caCertificate.SubjectName.Decode (X500DistinguishedNameFlags.None);
string ski = GetSubjectKeyIdentifier (caCertificate);
- MX.X509Crl result = CheckCrls (subject, ski, LMCAStore.Store.Crls);
+
+ // consider that the LocalMachine directories could not exists... and cannot be created by the user
+ MX.X509Crl result = (LMCAStore.Store == null) ? null : CheckCrls (subject, ski, LMCAStore.Store.Crls);
if (result != null)
return result;
if (location == StoreLocation.CurrentUser) {
if (result != null)
return result;
}
- result = CheckCrls (subject, ski, LMRootStore.Store.Crls);
+
+ // consider that the LocalMachine directories could not exists... and cannot be created by the user
+ result = (LMRootStore.Store == null) ? null : CheckCrls (subject, ski, LMRootStore.Store.Crls);
if (result != null)
return result;
if (location == StoreLocation.CurrentUser) {
// If privateKey it's available, load it too..
CspParameters cspParams = new CspParameters ();
cspParams.KeyContainerName = CryptoConvert.ToHex (cert.Hash);
- cspParams.Flags = CspProviderFlags.UseMachineKeyStore;
+ if (_storePath.StartsWith (X509StoreManager.LocalMachinePath))
+ cspParams.Flags = CspProviderFlags.UseMachineKeyStore;
KeyPairPersistence kpp = new KeyPairPersistence (cspParams);
if (!kpp.Load ())