You've already forked linux-packaging-mono
Imported Upstream version 5.16.0.100
Former-commit-id: 38faa55fb9669e35e7d8448b15c25dc447f25767
This commit is contained in:
parent
0a9828183b
commit
7d7f676260
@@ -132,20 +132,15 @@ namespace System.Security.Cryptography.X509Certificates {
|
||||
|
||||
public AsymmetricAlgorithm Key {
|
||||
get {
|
||||
if (_key == null) {
|
||||
switch (_oid.Value) {
|
||||
case rsaOid:
|
||||
_key = DecodeRSA (_keyValue.RawData);
|
||||
break;
|
||||
case dsaOid:
|
||||
_key = DecodeDSA (_keyValue.RawData, _params.RawData);
|
||||
break;
|
||||
default:
|
||||
string msg = Locale.GetText ("Cannot decode public key from unknown OID '{0}'.", _oid.Value);
|
||||
throw new NotSupportedException (msg);
|
||||
}
|
||||
switch (_oid.Value) {
|
||||
case rsaOid:
|
||||
return DecodeRSA (_keyValue.RawData);
|
||||
case dsaOid:
|
||||
return DecodeDSA (_keyValue.RawData, _params.RawData);
|
||||
default:
|
||||
string msg = Locale.GetText ("Cannot decode public key from unknown OID '{0}'.", _oid.Value);
|
||||
throw new NotSupportedException (msg);
|
||||
}
|
||||
return _key;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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 {
|
||||
|
Reference in New Issue
Block a user