in reply to Re: convert dotnet to perl
in thread convert dotnet to perl

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.

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

    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?
      I'm not sure I understand your question. The initialization vector and key are from the dotnet code and looks like this:

      private static byte InitVect = { 11, 22, 33, 44, 55, 66, 77, 88}; private static byte CryptKey = { 99, 100, 101, 102, 103, 104, 105, 106 };

      (numbers changed for security)

      I tried doing a pack("b*",(11, 22, 33, 44, 55, 66, 77, 88)) but I'm not sure if that is what I need to do.

      Anybody know what I need to do with these?

        Okay. Then

        my $InitVec = pack 'C*', 11, 22, 33, 44, 55, 66, 77, 88; my $CryptKey = pack 'C*', 99, 100, 101, 102, 103, 104, 105, 106;

        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?