Hi All,

once Again back with one more question.

can some one please help me how to use aes-128-cbc in perl.I got the information like:/

URL="https://metacpan.org/module/Crypt::OpenToken::Cipher::AES128"

but How can i use this in encrypting in perl. I got some data,key and iv values and i need to encrypt it using the aes-128-cbc. Here is some more additional information:

use Crypt::Mode::CBC; my $key = '(32bit key value)'; my $iv = '(32bit iv value)'; my $cbc = Crypt::Mode::CBC->new('AES'); my $ciphertext = $cbc->encrypt("secret data", $key, $iv); print $ciphertext;

after executing the above code it is showing the error message as : Uncaught exception from user code: Can't locate loadable object for module CryptX in @INC (@INC contains: C :/Dwimperl/perl/site/lib C:/Dwimperl/perl/vendor/lib C:/Dwimperl/perl/lib .) at C:/Dwimperl/perl/site/lib/Crypt/Cipher.pm line 5 Compilation failed in require at C:/Dwimperl/perl/site/lib/Crypt/Cipher.pm line 5. BEGIN failed--compilation aborted at C:/Dwimperl/perl/site/lib/Crypt/Cipher.pm l ine 5. Compilation failed in require at C:/Dwimperl/perl/site/lib/Crypt/Mode/CBC.pm lin e 8. BEGIN failed--compilation aborted at C:/Dwimperl/perl/site/lib/Crypt/Mode/CBC.pm line 8. Compilation failed in require at cipher1.pl line 1. BEGIN failed--compilation aborted at cipher1.pl line 1. at cipher1.pl line 1 Press any key to continue . . . -----------------------------------------------------

or
use Crypt::CBC; use Crypt::Cipher::AES; my $key = '(32bit key value)'; my $iv = '(32bit iv value)'; my $cbc = Crypt::CBC->new( -cipher=>'Cipher::AES', -key=>$key, -iv=>$i +v ); my $ciphertext = $cbc->encrypt("secret data"); print $ciphertext;

after executing the above code it is showing the error message as : Uncaught exception from user code: Can't locate loadable object for module CryptX in @INC (@INC contains: C :/Dwimperl/perl/site/lib C:/Dwimperl/perl/vendor/lib C:/Dwimperl/perl/lib .) at C:/Dwimperl/perl/site/lib/Crypt/Cipher/AES.pm line 8 Compilation failed in require at C:/Dwimperl/perl/site/lib/Crypt/Cipher/AES.pm l ine 8. BEGIN failed--compilation aborted at C:/Dwimperl/perl/site/lib/Crypt/Cipher/AES. pm line 8. Compilation failed in require at cipher2.pl line 2. BEGIN failed--compilation aborted at cipher2.pl line 2. at cipher2.pl line 2 Press any key to continue . . . ------------------------------------------------------- In this case can some one please do let me know how can i check if 'CryptX' and (related modules) are installed properly in my machine.

Thanks in adv...

In reply to How to do encryption in perl with aes-128-cbc by saysuri

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.