Imported Upstream version 5.16.0.100

Former-commit-id: 38faa55fb9669e35e7d8448b15c25dc447f25767
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-08-07 15:19:03 +00:00
parent 0a9828183b
commit 7d7f676260
4419 changed files with 170950 additions and 90273 deletions

View File

@@ -244,24 +244,26 @@ namespace System.Security.Cryptography.X509Certificates
if (_cert == null)
throw new CryptographicException (empty_error);
try {
if (_cert.RSA != null) {
RSACryptoServiceProvider rcsp = _cert.RSA as RSACryptoServiceProvider;
if (rcsp != null)
return rcsp.PublicOnly ? null : rcsp;
RSAManaged rsam = _cert.RSA as RSAManaged;
if (rsam != null)
return rsam.PublicOnly ? null : rsam;
_cert.RSA.ExportParameters (true);
return _cert.RSA;
} else if (_cert.DSA != null) {
DSACryptoServiceProvider dcsp = _cert.DSA as DSACryptoServiceProvider;
if (dcsp != null)
return dcsp.PublicOnly ? null : dcsp;
_cert.DSA.ExportParameters (true);
return _cert.DSA;
if (_cert.RSA is RSACryptoServiceProvider rcsp) {
if (rcsp.PublicOnly)
return null;
var key = new RSACryptoServiceProvider ();
key.ImportParameters (_cert.RSA.ExportParameters(true));
return key;
}
if (_cert.RSA is RSAManaged rsam) {
if (rsam.PublicOnly)
return null;
var key = new RSAManaged ();
key.ImportParameters (_cert.RSA.ExportParameters(true));
return key;
}
if (_cert.DSA is DSACryptoServiceProvider dcsp) {
if (dcsp.PublicOnly)
return null;
var key = new DSACryptoServiceProvider();
key.ImportParameters(_cert.DSA.ExportParameters(true));
return key;
}
}
catch {