Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to port code over from dotnet to perl. They were using this class with what appears to be an 8byte key array and an 8byte IV array. Anybody know how to take the IV & Key arrays and translate them/apply them to perl? I don't want to have to generate a new key and am having problems figuring out how to reuse them for the perl implementation.

Replies are listed 'Best First'.
Re: convert dotnet to perl
by BrowserUk (Patriarch) on Apr 21, 2005 at 18:40 UTC

    Essentially, an 8 byte array can be manipulated in Perl as a string with 8 characters, though there might but some unicode related concerns.

    You're going to have to be a little clearer about what you are having problems with?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco.
    Rule 1 has a caveat! -- Who broke the cabal?
      Well, the class they are using seems to be based on DES. I was planning on using Crypt::DES but I don't see any methods that allow passing in an IV. So, the next thing I did was take a look at Crypt::CBC which allows you to specify a cipher (DES, in this case) as well as a key and iv. My next problem was trying to figure out what to do with a dotnet byte array for the iv and key (pack?) in order to stringify since that is what the perl modules use.

        Where are you getting these fields from in your Perl code? And what form are they in?


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        Lingua non convalesco, consenesco et abolesco.
        Rule 1 has a caveat! -- Who broke the cabal?
Re: convert dotnet to perl
by CountZero (Bishop) on Apr 21, 2005 at 20:29 UTC
    Could it be that Crypt::DES doesn't need an initialization vector? Did you try this module to decrypt a message encrypted with the .NET program?

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law