diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2006-09-21 11:25:48 +0400 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2006-09-21 11:25:48 +0400 |
commit | eb9e5702942536f187b81234289ecd043869354d (patch) | |
tree | 14160d4c3942538f4e3900ca88e17572c4b7715b /mcs/class/System.Security/System.Security.Cryptography.Xml | |
parent | 7d179d69f52199e6f1a314e03c4e5430f2b58ddc (diff) |
2006-09-21 Atsushi Enomoto <atsushi@ximian.com>
* EncryptedXml.cs : True fix for DecryptData(). It indeed uses block size
(or possibly IV size) in Transform(), but only for stripping the heading
n bytes garbage.
* EncryptedXmlTest.cs : new file. Added practical example.
* EncryptedXmlSample1.xml, sample.pfx : support files for the above test.
* System.Security_test.dll.sources: added EncryptedXmlTest.cs.
* Makefile: added some extra test support files as EXTRA_DISTFILES.
svn path=/trunk/mcs/; revision=65750
Diffstat (limited to 'mcs/class/System.Security/System.Security.Cryptography.Xml')
-rw-r--r-- | mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog | 6 | ||||
-rw-r--r-- | mcs/class/System.Security/System.Security.Cryptography.Xml/EncryptedXml.cs | 7 |
2 files changed, 10 insertions, 3 deletions
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog b/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog index ddc0220a555..4e1f68632d7 100644 --- a/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog +++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog @@ -1,3 +1,9 @@ +2006-09-21 Atsushi Enomoto <atsushi@ximian.com> + + * EncryptedXml.cs : True fix for DecryptData(). It indeed uses block size + (or possibly IV size) in Transform(), but only for stripping the heading + n bytes garbage. + 2006-09-20 Atsushi Enomoto <atsushi@ximian.com> * SignedXml.cs : overwrite my fix with Gert's patch on #79454 to make it diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/EncryptedXml.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/EncryptedXml.cs index 27a132880a0..f0529da9c74 100644 --- a/mcs/class/System.Security/System.Security.Cryptography.Xml/EncryptedXml.cs +++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/EncryptedXml.cs @@ -141,7 +141,7 @@ namespace System.Security.Cryptography.Xml { public byte[] DecryptData (EncryptedData encryptedData, SymmetricAlgorithm symAlg) { - return Transform (encryptedData.CipherData.CipherValue, symAlg.CreateDecryptor (), 0); + return Transform (encryptedData.CipherData.CipherValue, symAlg.CreateDecryptor (), symAlg.BlockSize / 8); } public void DecryptDocument () @@ -417,11 +417,12 @@ namespace System.Security.Cryptography.Xml { { MemoryStream output = new MemoryStream (); CryptoStream crypto = new CryptoStream (output, transform, CryptoStreamMode.Write); - crypto.Write (data, startIndex, data.Length - startIndex); + crypto.Write (data, 0, data.Length); crypto.FlushFinalBlock (); - byte[] result = output.ToArray (); + byte[] result = new byte [output.Length - startIndex]; + Array.Copy (output.GetBuffer (), startIndex, result, 0, result.Length); crypto.Close (); output.Close (); |