Microsoft .NET and perl 3DES encryption

J

Jerry Maguire

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
 
S

Sisyphus

Jerry said:
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
 
J

Jerry Maguire

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
 
S

Sisyphus

Jerry said:
#!/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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top