diff options
author | Martin Baulig <martin.baulig@xamarin.com> | 2017-02-02 14:06:23 +0300 |
---|---|---|
committer | Martin Baulig <martin.baulig@xamarin.com> | 2017-02-02 14:07:27 +0300 |
commit | 78c101158799eccac9116813f95a345cf0096fcd (patch) | |
tree | 541684632001bf9c0204e9ea515175bdd0b4f285 | |
parent | afc625c7a347f6d4a661724070e682555bdbf815 (diff) |
Merge pull request #4316 from mono/work-51562
[btls]: Allow importing a null `byte[]`. Fixes #51562.
(cherry picked from commit e4b4e981d68ad0ce2d0fd7b9f9472d56311de4f7)
-rw-r--r-- | mcs/class/System/Mono.Btls/X509CertificateImplBtls.cs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/mcs/class/System/Mono.Btls/X509CertificateImplBtls.cs b/mcs/class/System/Mono.Btls/X509CertificateImplBtls.cs index eb920677d01..b9c83ae4383 100644 --- a/mcs/class/System/Mono.Btls/X509CertificateImplBtls.cs +++ b/mcs/class/System/Mono.Btls/X509CertificateImplBtls.cs @@ -386,11 +386,13 @@ namespace Mono.Btls void Import (byte[] data) { - // Does it look like PEM? - if ((data.Length > 0) && (data [0] != 0x30)) - x509 = MonoBtlsX509.LoadFromData (data, MonoBtlsX509Format.PEM); - else - x509 = MonoBtlsX509.LoadFromData (data, MonoBtlsX509Format.DER); + if (data != null) { + // Does it look like PEM? + if ((data.Length > 0) && (data [0] != 0x30)) + x509 = MonoBtlsX509.LoadFromData (data, MonoBtlsX509Format.PEM); + else + x509 = MonoBtlsX509.LoadFromData (data, MonoBtlsX509Format.DER); + } } void ImportPkcs12 (byte[] data, string password) |