Net::SSH::Perl::Cipher::DES3 - Wrapper for SSH 3DES support
use Net::SSH::Perl::Cipher; my $cipher = Net::SSH::Perl::Cipher->new('DES3', $key); print $cipher->encrypt($plaintext);
Net::SSH::Perl::Cipher::DES3 provides 3DES encryption support for Net::SSH::Perl. To do so it wraps around Crypt::DES, a C/XS implementation of the DES algorithm.
The 3DES (three-key triple-DES) algorithm used here differs based on the SSH protocol being used. SSH1 uses 3DES in inner CBC mode, meaning that there are three CBC objects, and each CBC object is paired with a DES object and key.
SSH2 uses 3DES in outer CBC mode; this uses one CBC object wrapped around a DES-EDE3 object (also included in this library); that object contains three DES ciphers with three different keys. Each encrypt operation is actually encrypt-decrypt-encrypt with the three DES keys; decrypt is actually decrypt-encrypt-decrypt with the DES keys.
The key length for both implementations is 24 bytes. The first 8 bytes of the key are used as the first DES key, the second 8 bytes for the second key, etc. If the key $key that you pass to new is only 16 bytes, the first 8 bytes of $key will be used as the key for both the first and third DES ciphers.
Please see the Net::SSH::Perl manpage for author, copyright, and license information.