Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Pouliot <sebastien@ximian.com>2004-03-23 20:19:20 +0300
committerSebastien Pouliot <sebastien@ximian.com>2004-03-23 20:19:20 +0300
commit6e79ed7e60c82f0161cdd97f043c6169fd4b2523 (patch)
tree92d68f62d9cff51b8019ed654fc1a3722fa93fb2 /mcs/class/Mono.Security/Mono.Security.Authenticode
parente82e7ed41b429a714f39c22a1396fd6a73c77d02 (diff)
2004-02-23 Sebastien Pouliot <sebastien@ximian.com>
* PrivateKey.cs: Adjusted to catch exceptions from CryptoConvert. FromCapiPrivateKeyBlob when dealing with weakly encrypted keys. svn path=/trunk/mcs/; revision=24471
Diffstat (limited to 'mcs/class/Mono.Security/Mono.Security.Authenticode')
-rw-r--r--mcs/class/Mono.Security/Mono.Security.Authenticode/ChangeLog5
-rw-r--r--mcs/class/Mono.Security/Mono.Security.Authenticode/PrivateKey.cs9
2 files changed, 10 insertions, 4 deletions
diff --git a/mcs/class/Mono.Security/Mono.Security.Authenticode/ChangeLog b/mcs/class/Mono.Security/Mono.Security.Authenticode/ChangeLog
index 8aa80eadcb0..b3275bf5e2d 100644
--- a/mcs/class/Mono.Security/Mono.Security.Authenticode/ChangeLog
+++ b/mcs/class/Mono.Security/Mono.Security.Authenticode/ChangeLog
@@ -1,3 +1,8 @@
+2004-02-23 Sebastien Pouliot <sebastien@ximian.com>
+
+ * PrivateKey.cs: Adjusted to catch exceptions from CryptoConvert.
+ FromCapiPrivateKeyBlob when dealing with weakly encrypted keys.
+
2004-02-20 Sebastien Pouliot <sebastien@ximian.com>
* AuthenticodeDeformatter.cs: Updated to use the new X509Chain syntax.
diff --git a/mcs/class/Mono.Security/Mono.Security.Authenticode/PrivateKey.cs b/mcs/class/Mono.Security/Mono.Security.Authenticode/PrivateKey.cs
index ba238bb9c2a..c1725a65dd2 100644
--- a/mcs/class/Mono.Security/Mono.Security.Authenticode/PrivateKey.cs
+++ b/mcs/class/Mono.Security/Mono.Security.Authenticode/PrivateKey.cs
@@ -102,8 +102,11 @@ namespace Mono.Security.Authenticode {
ICryptoTransform dec = rc4.CreateDecryptor (key, null);
int x = 24 + salt.Length + 8;
dec.TransformBlock (keypair, 8, keypair.Length - 8, keypair, 8);
- rsa = CryptoConvert.FromCapiPrivateKeyBlob (keypair);
- if (rsa == null) {
+ try {
+ rsa = CryptoConvert.FromCapiPrivateKeyBlob (keypair);
+ weak = false;
+ }
+ catch (CryptographicException) {
weak = true;
// second change using weak crypto
Array.Copy (pvk, 24 + saltlen, keypair, 0, keylen);
@@ -115,8 +118,6 @@ namespace Mono.Security.Authenticode {
dec.TransformBlock (keypair, 8, keypair.Length - 8, keypair, 8);
rsa = CryptoConvert.FromCapiPrivateKeyBlob (keypair);
}
- else
- weak = false;
Array.Clear (key, 0, key.Length);
}
else {