#!/usr/bin/perl use strict; use Crypt::Twofish; use Crypt::CBC; my $key = "Super Secret Handshake"; my $cipher = new Crypt::CBC ($key, 'Twofish'); my $plaintext; my $ciphertext; # Open the plain text config file and read the data to encrypt. # print "Give me the server to connect :"; my $server=; chomp($server); print "Give me the user to login :"; my $login=; chomp($login); print "Give me the password to login :"; my $password=; chomp($password); open(PLAINTEXT,">Plain") || print "Error to write to the file"; print PLAINTEXT "$server\|$login\|$password\n"; local $/; $plaintext = ; close(PLAINTEXT); # Using our super-secret key write out the encrypted data. # open(CIPHERTEXT, "> Plain"); #EncryptedConfigFile $ciphertext = $cipher->encrypt($plaintext); $ciphertext = unpack("B*", $ciphertext); # convert the encrypted data into a string of "0"s and "1"s print CIPHERTEXT $ciphertext; close(CIPHERTEXT);