diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2006-09-22 05:16:12 +0400 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2006-09-22 05:16:12 +0400 |
commit | 614d7f4d2fbff6f546cdefd1dd8a1023f97ef062 (patch) | |
tree | d3d3d19ffd68c614b8b67e1bff25267f879bdef5 /mcs/class/System.Security/System.Security.Cryptography.Xml | |
parent | c664e589919d400d49da0f25ef286347b452a86d (diff) |
2006-09-21 Atsushi Enomoto <atsushi@ximian.com>
* EncryptedXml.cs : implement orthodox padding on encryption.
* EncryptedXmlTest.cs : added roundtrip sample i.e. encryption test.
svn path=/trunk/mcs/; revision=65800
Diffstat (limited to 'mcs/class/System.Security/System.Security.Cryptography.Xml')
-rw-r--r-- | mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog | 4 | ||||
-rw-r--r-- | mcs/class/System.Security/System.Security.Cryptography.Xml/EncryptedXml.cs | 11 |
2 files changed, 15 insertions, 0 deletions
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog b/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog index 0f5c862445a..ae06b9ff0d9 100644 --- a/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog +++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog @@ -1,5 +1,9 @@ 2006-09-21 Atsushi Enomoto <atsushi@ximian.com> + * EncryptedXml.cs : implement orthodox padding on encryption. + +2006-09-21 Atsushi Enomoto <atsushi@ximian.com> + * EncryptedXml.cs : Handle orthodox padding (xmlenc spec section 5.2). However, like EncryptedXmlSample1, it might not exist, so make it optional. 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 b2e95594d2d..3509a688a91 100644 --- a/mcs/class/System.Security/System.Security.Cryptography.Xml/EncryptedXml.cs +++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/EncryptedXml.cs @@ -238,6 +238,17 @@ namespace System.Security.Cryptography.Xml { public byte[] EncryptData (byte[] plainText, SymmetricAlgorithm symAlg) { + PaddingMode bak = symAlg.Padding; + try { + symAlg.Padding = PaddingMode.ISO10126; + return EncryptDataCore (plainText, symAlg); + } finally { + symAlg.Padding = bak; + } + } + + byte[] EncryptDataCore (byte[] plainText, SymmetricAlgorithm symAlg) + { // Write the symmetric algorithm IV and ciphertext together. // We use a memory stream to accomplish this. MemoryStream stream = new MemoryStream (); |