diff options
author | Martin Baulig <mabaul@microsoft.com> | 2019-08-15 02:07:35 +0300 |
---|---|---|
committer | Alexander Köplinger <alex.koeplinger@outlook.com> | 2019-08-15 02:07:35 +0300 |
commit | 934c4f4c8783be8ae8faf65b0c7ee5e3873b29b9 (patch) | |
tree | 0c1b5a81be8673f9f8ee3dd5dcb22db2a17e5fa2 /mcs/class/System | |
parent | 4e793ad30c24b30097ba3e9865799b6d9e7e0390 (diff) |
X509CertificateImplBtls.PrivateKey should allow to actually set the key. (#16212)
The `X509CertificateImplBtls.PrivateKey` property setter was previously ignoring all values and always used `null`. This should help with #16189.
Diffstat (limited to 'mcs/class/System')
-rw-r--r-- | mcs/class/System/Mono.Btls/X509CertificateImplBtls.cs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/mcs/class/System/Mono.Btls/X509CertificateImplBtls.cs b/mcs/class/System/Mono.Btls/X509CertificateImplBtls.cs index 3914e483c38..50143dedd98 100644 --- a/mcs/class/System/Mono.Btls/X509CertificateImplBtls.cs +++ b/mcs/class/System/Mono.Btls/X509CertificateImplBtls.cs @@ -198,7 +198,14 @@ namespace Mono.Btls set { if (nativePrivateKey != null) nativePrivateKey.Dispose (); - nativePrivateKey = null; + try { + // FIXME: there doesn't seem to be a public API to check whether it actually + // contains a private key (apart from RSAManaged.PublicOnly). + if (value != null) + nativePrivateKey = MonoBtlsKey.CreateFromRSAPrivateKey ((RSA)value); + } catch { + nativePrivateKey = null; + } } } |