diff options
author | Sebastien Pouliot <sebastien@ximian.com> | 2004-09-07 16:29:20 +0400 |
---|---|---|
committer | Sebastien Pouliot <sebastien@ximian.com> | 2004-09-07 16:29:20 +0400 |
commit | 1af532c0dda16a222839c2932bfe8014efcce879 (patch) | |
tree | ef0363f4cfe7aff79423e31a5b2ee518d47d17d0 /mcs | |
parent | 3da5e0153a88705fd87365a156cb9c2ae8e894b8 (diff) |
2004-09-07 Sebastien Pouliot <sebastien@ximian.com>
* X509Certificate.cs: Merge changes from HEAD.
svn path=/branches/mono-1-0/mcs/; revision=33512
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/class/corlib/System.Security.Cryptography.X509Certificates/ChangeLog | 4 | ||||
-rw-r--r-- | mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs | 23 |
2 files changed, 21 insertions, 6 deletions
diff --git a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/ChangeLog b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/ChangeLog index b5a036af423..86be09eef0a 100644 --- a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/ChangeLog +++ b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/ChangeLog @@ -1,3 +1,7 @@ +2004-09-07 Sebastien Pouliot <sebastien@ximian.com> + + * X509Certificate.cs: Merge changes from HEAD. + 2003-12-15 Sebastien Pouliot <spouliot@videotron.ca> * X509Certificate.cs: Removed old (commented) Authenticode stuff. diff --git a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs index af5722f601d..5d3f9dd8177 100644 --- a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs +++ b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs @@ -116,15 +116,26 @@ namespace System.Security.Cryptography.X509Certificates { [MonoTODO ("Incomplete - minimal validation in this version")] public static X509Certificate CreateFromSignedFile (string filename) { - AuthenticodeDeformatter a = new AuthenticodeDeformatter (filename); - if (a.SigningCertificate != null) { - return new X509Certificate (a.SigningCertificate.RawData); - } - else { + 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); + } + // 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 @@ -410,4 +421,4 @@ namespace System.Security.Cryptography.X509Certificates { } #endif } -}
\ No newline at end of file +} |