You've already forked linux-packaging-mono
Imported Upstream version 3.12.0
Former-commit-id: cf92446697332992ec36726e78eb8703e1f259d7
This commit is contained in:
@@ -97,10 +97,26 @@ namespace Mono.Security.X509 {
|
||||
// methods
|
||||
|
||||
public void Clear ()
|
||||
{
|
||||
/*
|
||||
* Both _certificates and _crls extend CollectionBase, whose Clear() method calls OnClear() and
|
||||
* OnClearComplete(), which should be overridden in derivative classes. So we should not worry about
|
||||
* other threads that might be holding references to _certificates or _crls. They should be smart enough
|
||||
* to handle this gracefully. And if not, it's their own fault.
|
||||
*/
|
||||
ClearCertificates ();
|
||||
ClearCrls ();
|
||||
}
|
||||
|
||||
void ClearCertificates()
|
||||
{
|
||||
if (_certificates != null)
|
||||
_certificates.Clear ();
|
||||
_certificates = null;
|
||||
}
|
||||
|
||||
void ClearCrls ()
|
||||
{
|
||||
if (_crls != null)
|
||||
_crls.Clear ();
|
||||
_crls = null;
|
||||
@@ -117,6 +133,7 @@ namespace Mono.Security.X509 {
|
||||
fs.Write (data, 0, data.Length);
|
||||
fs.Close ();
|
||||
}
|
||||
ClearCertificates (); // We have modified the store on disk. So forget the old state.
|
||||
}
|
||||
#if !NET_2_1
|
||||
// Try to save privateKey if available..
|
||||
@@ -141,6 +158,7 @@ namespace Mono.Security.X509 {
|
||||
byte[] data = crl.RawData;
|
||||
fs.Write (data, 0, data.Length);
|
||||
}
|
||||
ClearCrls (); // We have modified the store on disk. So forget the old state.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,6 +167,7 @@ namespace Mono.Security.X509 {
|
||||
string filename = Path.Combine (_storePath, GetUniqueName (certificate));
|
||||
if (File.Exists (filename)) {
|
||||
File.Delete (filename);
|
||||
ClearCertificates (); // We have modified the store on disk. So forget the old state.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,6 +176,7 @@ namespace Mono.Security.X509 {
|
||||
string filename = Path.Combine (_storePath, GetUniqueName (crl));
|
||||
if (File.Exists (filename)) {
|
||||
File.Delete (filename);
|
||||
ClearCrls (); // We have modified the store on disk. So forget the old state.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,8 +256,13 @@ namespace Mono.Security.X509 {
|
||||
cspParams.Flags = CspProviderFlags.UseMachineKeyStore;
|
||||
KeyPairPersistence kpp = new KeyPairPersistence (cspParams);
|
||||
|
||||
if (!kpp.Load ())
|
||||
try {
|
||||
if (!kpp.Load ())
|
||||
return cert;
|
||||
}
|
||||
catch {
|
||||
return cert;
|
||||
}
|
||||
|
||||
if (cert.RSA != null)
|
||||
cert.RSA = new RSACryptoServiceProvider (cspParams);
|
||||
|
||||
Reference in New Issue
Block a user