Microsoft .NET and perl 3DES encryption

Discussion in 'Perl Misc' started by Jerry Maguire, Jan 21, 2004.

  1. Hi,
    I am having difficulty getting the same results of the encrypted
    packet on .NET platform adn linux perl platform.
    Following are the detaisl of the 2 platforms:

    Platform 1:
    ----------
    Microsoft .NET platform used to encrypt (3DES) and then encode a
    string

    Platform 2:
    -------------
    Linux + perl with MIME-Base64, TripleDES, EDE, CBC modules

    I am trying to encrypt a string on .NET platform. When I am trying to
    encrypt the same string on linux+perl platform, I am getting a
    different result.

    Can anyone let me know which modules should i use on perl to get the
    same encryption result as Microsoft platform?. I am using the
    following program to encrypt the string on microsoft .net:


    http://www.codeproject.com/dotnet/encryption_decryption.asp

    Any advise!!

    Jerry
     
    Jerry Maguire, Jan 21, 2004
    #1
    1. Advertising

  2. Jerry Maguire

    Sisyphus Guest

    Jerry Maguire wrote:
    > Hi,
    > I am having difficulty getting the same results of the encrypted
    > packet on .NET platform adn linux perl platform.
    > Following are the detaisl of the 2 platforms:
    >
    > Platform 1:
    > ----------
    > Microsoft .NET platform used to encrypt (3DES) and then encode a
    > string
    >
    > Platform 2:
    > -------------
    > Linux + perl with MIME-Base64, TripleDES, EDE, CBC modules
    >
    > I am trying to encrypt a string on .NET platform. When I am trying to
    > encrypt the same string on linux+perl platform, I am getting a
    > different result.
    >
    > Can anyone let me know which modules should i use on perl to get the
    > same encryption result as Microsoft platform?.


    Crypt::DES perhaps ?


    > I am using the
    > following program to encrypt the string on microsoft .net:
    >
    >
    > http://www.codeproject.com/dotnet/encryption_decryption.asp
    >


    I see DES, RC2, and Rijndael mentioned in the source code - but does it
    actually do 3DES ?

    What happens if you use Rijndael (and Crypt::Rijndael on the perl side) ?

    Cheers,
    Rob


    --
    To reply by email u have to take out the u in kalinaubears.
     
    Sisyphus, Jan 21, 2004
    #2
    1. Advertising

  3. Hi,
    Thanks for your reply. I tried to use DES on perl but still not
    getting the same results.
    I am attaching my perl program with this email. Can you please advise?

    My perl program:
    -------------------

    #!/usr/bin/perl
    #
    # get libraries
    use Crypt::CBC;
    use Crypt::DES;
    use MIME::Base64;

    $DEPACKET = "testing";

    $DES = Crypt::CBC->new( {'key' => '1234567890',
    'cipher' => 'DES',
    'iv' => 'testing',
    'padding' => 'space',
    'prepand_iv' => 0 });

    $ENCRYPTPACKET = $DES->encrypt($DEPACKET);

    #encode the packet
    $ENCODEPACKET = &encode_base64($ENCRYPTPACKET);


    #display the results
    print "The encrypted packet is:\n";
    print $ENCRYPTPACKET;
    print "The encrypted and encoded packet is:\n";
    print $ENCODEPACKET;


    --------end of program---------------


    Thanks
    Jerry
     
    Jerry Maguire, Jan 23, 2004
    #3
  4. Jerry Maguire

    Sisyphus Guest

    Jerry Maguire wrote:

    >
    > #!/usr/bin/perl
    > #
    > # get libraries
    > use Crypt::CBC;
    > use Crypt::DES;
    > use MIME::Base64;
    >
    > $DEPACKET = "testing";
    >
    > $DES = Crypt::CBC->new( {'key' => '1234567890',
    > 'cipher' => 'DES',
    > 'iv' => 'testing',
    > 'padding' => 'space',
    > 'prepand_iv' => 0 });
    >
    > $ENCRYPTPACKET = $DES->encrypt($DEPACKET);
    >
    > #encode the packet
    > $ENCODEPACKET = &encode_base64($ENCRYPTPACKET);
    >
    >
    > #display the results
    > print "The encrypted packet is:\n";
    > print $ENCRYPTPACKET;
    > print "The encrypted and encoded packet is:\n";
    > print $ENCODEPACKET;
    >
    >


    'prepand_iv' needs to be changed to 'prepend_iv' - and you'll then get a
    different output. Does that fix the problem ?

    Also 'use warnings;'.

    Cheers,
    Rob

    --
    To reply by email u have to take out the u in kalinaubears.
     
    Sisyphus, Jan 24, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Amitesh Hati

    3DES Encryption

    Amitesh Hati, May 29, 2006, in forum: Java
    Replies:
    1
    Views:
    4,902
    Jan Peter Stotz
    May 31, 2006
  2. Tim Mackey

    3des encryption question

    Tim Mackey, Dec 19, 2003, in forum: ASP .Net Security
    Replies:
    1
    Views:
    130
    Cowboy \(Gregory A. Beamer\)
    Dec 19, 2003
  3. news.pironet-ndh.com

    Weak Key in 3DES and MAC

    news.pironet-ndh.com, Feb 25, 2004, in forum: ASP .Net Security
    Replies:
    0
    Views:
    199
    news.pironet-ndh.com
    Feb 25, 2004
  4. David Lund

    3DES encrypt in vb.net with decrypt in classic asp

    David Lund, Dec 3, 2004, in forum: ASP .Net Security
    Replies:
    0
    Views:
    326
    David Lund
    Dec 3, 2004
  5. tshad

    Security - 3DES and RC2

    tshad, Jun 13, 2006, in forum: ASP .Net Security
    Replies:
    0
    Views:
    305
    tshad
    Jun 13, 2006
Loading...

Share This Page