GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  CRYPT::MODE::CBC (3)

.ds Aq ’

NAME

Crypt::Mode::CBC - Block cipher mode CBC [Cipher-block chaining]

CONTENTS

SYNOPSIS



   use Crypt::Mode::CBC;
   my $m = Crypt::Mode::CBC->new(AES);

   #(en|de)crypt at once
   my $ciphertext = $m->encrypt($plaintext, $key, $iv);
   my $plaintext = $m->decrypt($ciphertext, $key, $iv);

   #encrypt more chunks
   $m->start_encrypt($key, $iv);
   my $ciphertext = $m->add(some data);
   $ciphertext .= $m->add(more data);
   $ciphertext .= $m->finish;

   #decrypt more chunks
   $m->start_decrypt($key, $iv);
   my $plaintext = $m->add($some_ciphertext);
   $plaintext .= $m->add($more_ciphertext);
   $plaintext .= $m->finish;



DESCRIPTION

This module implements CBC cipher mode. <B>NOTE:B> it works only with ciphers from CryptX (Crypt::Cipher::NNNN).

METHODS

    new



 my $m = Crypt::Mode::CBC->new(AES);
 #or
 my $m = Crypt::Mode::CBC->new(AES, $padding);
 #or
 my $m = Crypt::Mode::CBC->new(AES, $padding, $cipher_rounds);

 # $padding .... 0 no padding (plaintext size has to be myltiple of block length)
 #               1 PKCS5 padding, Crypt::CBCs "standard" - DEFAULT
 #               2 Crypt::CBCs "oneandzeroes"
 # $cipher_rounds ... optional num of rounds for given cipher



    encrypt



   my $ciphertext = $m->encrypt($plaintext, $key, $iv);



    decrypt



   my $plaintext = $m->decrypt($ciphertext, $key, $iv);



    start_encrypt

See example below finish.

    start_decrypt

See example below finish.

    add

See example below finish.

    finish



   #encrypt more chunks
   $m->start_encrypt($key, $iv);
   my $ciphertext = ;
   $ciphertext .= $m->add(some data);
   $ciphertext .= $m->add(more data);
   $ciphertext .= $m->finish;

   #decrypt more chunks
   $m->start_decrypt($key, $iv);
   my $plaintext = ;
   $plaintext .= $m->add($some_ciphertext);
   $plaintext .= $m->add($more_ciphertext);
   $plaintext .= $m->finish;



SEE ALSO

o CryptX, Crypt::Cipher
o Crypt::Cipher::AES, Crypt::Cipher::Blowfish, ...
o <https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher-block_chaining_.28CBC.29>
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 CRYPT::MODE::CBC (3) 2015-11-28

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.