[Mono-dev] System.Security.Cryptography : TripleDES Issue

Sebastien Pouliot sebastien.pouliot at gmail.com
Wed Oct 19 14:12:05 EDT 2005


Hello Yogendra,

As the exception says your IV size isn't right - it's 32 bytes long (256
bits) while it should be 8 bytes (64 bits) like the DES/3DES block size.

Strangely this isn't detected by the MS implementation (but IIRC this is
check for other crypto algorithms). Anyway I'll look into "fixing" this
to ensure interoperability between Mono and MS.

Thanks for reporting this.

On Wed, 2005-10-19 at 14:05 -0400, Yogendra Thakur wrote:
> Sebastien,
> 
> I have opened bug for this issue (bug# 76483).
> Please see attached file for source code.
> 
> To Compile : mcs TestEncryption.cs
> To Run     : mono TestEncryption.exe
> 
> Result :
> ========
> Unhandled Exception:
> System.Security.Cryptography.CryptographicException: IV length cannot be
> larger than block size
> in <0x000e0> System.Security.Cryptography.SymmetricAlgorithm:set_IV
> (System.Byte[] value)
> in <0x00020>
> System.Security.Cryptography.TripleDESCryptoServiceProvider:CreateEncryp
> tor (System.Byte[] rgbKey, System.Byte[] rgbIV)
> in <0x0013d> TestEncryption.TestEncryption:Main (System.String[] args)
> 
> 
> 
> Regards,
> Yogendra Thakur
> 
> -----Original Message-----
> From: Sebastien Pouliot [mailto:sebastien.pouliot at gmail.com] 
> Sent: Monday, October 17, 2005 7:18 PM
> To: Yogendra Thakur
> Cc: mono-devel-list at lists.ximian.com
> Subject: Re: [Mono-dev] System.Security.Cryptography : TripleDES Issue
> 
> Hello Yogendra,
> 
> On Mon, 2005-10-17 at 17:39 -0400, Yogendra Thakur wrote:
> > Hello,
> > 
> > Is Triple DES Encryption supported in Mono?
> 
> yes
> 
> > I have small code which uses Triple DES algorithm to encrypt /Decrypt
> > data.
> > This works fine in MS .NET. When I run same code on Mono, it throws
> "IV
> > length can not be greater than Block Size" exception. 
> 
> Sorry I can't help you without more details.
> 
> Please open a bug report at http://bugzilla.ximian.com and include a
> small source code sample that reproduce the problem. Don't forget to
> indicate which version of Mono you are using and on which platform.
> 
> > I don't find any entry for this class in documentation. I searched
> data
> > base but couldn't find anything.
> 
> You can access the documentation from http://www.mono-project.com
> Click on "manuals and docs" (icon on top right) then navigate the tree
> view to get to the desired class documentation.
> 
> Here's a direct link to the TripleDES class
> http://www.go-mono.com/docs/monodoc.ashx?link=T%
> 3aSystem.Security.Cryptography.TripleDES
> 
> > Also I see Crypto classes are implemented under two different
> namespaces
> > System.Security.Cryptography and Mono.Security.Cryptography. What is
> the
> > difference between them?
> 
> System.Security.Cryptography implements the same classes (i.e. same
> features/same limites) as MS base class library.
> 
> Mono.Security.Cryptography offer extra classes (i.e. not available on
> the MS framework).
-- 
Sebastien Pouliot
email: sebastien at ximian.com
blog: http://pages.infinit.net/ctech/




More information about the Mono-devel-list mailing list