diff options
Diffstat (limited to 'mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs')
-rw-r--r-- | mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs index 5d3f9dd8177..af5722f601d 100644 --- a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs +++ b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs @@ -116,26 +116,15 @@ namespace System.Security.Cryptography.X509Certificates { [MonoTODO ("Incomplete - minimal validation in this version")] public static X509Certificate CreateFromSignedFile (string filename) { - try { - AuthenticodeDeformatter a = new AuthenticodeDeformatter (filename); - if (a.SigningCertificate != null) { - if (a.Reason != 0) { - string msg = String.Format (Locale.GetText ( - "Invalid digital signature on {0}, reason #{1}."), - filename, a.Reason); - throw new COMException (msg); - } - return new X509Certificate (a.SigningCertificate.RawData); - } - + AuthenticodeDeformatter a = new AuthenticodeDeformatter (filename); + if (a.SigningCertificate != null) { + return new X509Certificate (a.SigningCertificate.RawData); + } + else { // if no signature is present return an empty certificate byte[] cert = null; // must not confuse compiler about null ;) return new X509Certificate (cert); } - catch (Exception e) { - string msg = String.Format (Locale.GetText ("Couldn't extract digital signature from {0}."), filename); - throw new COMException (msg, e); - } } // constructors @@ -421,4 +410,4 @@ namespace System.Security.Cryptography.X509Certificates { } #endif } -} +}
\ No newline at end of file |