[Mono-dev] DES problem

Arnhoffer Károly karnhoffer at ecron.hu
Thu May 18 07:28:29 EDT 2006


Hi,

There is a little difference between .NET and Mono. When I call the routine below in .NET I get the results:

True
True

With Mono it says:

False
True.

Is it possible to set this CanReuseTransform property to true and reuse the transform once again or shall I reinitialize it every time? (I found that with Mono I can not decrypt two or more times with the same ICryptoTransform. I get different results with same inputs.)

The code snippet:

    Private mobjEncryptTransform As ICryptoTransform
    Private mobjDecryptTransform As ICryptoTransform

    Private Function InitTripleDESCSP(ByVal tbytaDESKey As Byte(), ByVal tbytaDESIV As Byte(), Optional ByVal tlogForceInit As Boolean = False) As Boolean
        Dim lobjTripleDESCSP As TripleDESCryptoServiceProvider
        Try
            If lobjTripleDESCSP Is Nothing OrElse mobjDecryptTransform Is Nothing OrElse mobjEncryptTransform Is Nothing OrElse tlogForceInit Then
                lobjTripleDESCSP = New TripleDESCryptoServiceProvider()
                mobjDecryptTransform = lobjTripleDESCSP.CreateDecryptor(tbytaDESKey, tbytaDESIV)
                mobjEncryptTransform = lobjTripleDESCSP.CreateEncryptor(tbytaDESKey, tbytaDESIV)

                Console.WriteLine(mobjDecryptTransform.CanReuseTransform)
                Console.WriteLine(mobjDecryptTransform.CanTransformMultipleBlocks)
            End If
            Return True
        Catch ex As Exception
        End Try
    End Function



More information about the Mono-devel-list mailing list