use Imaginary::Crypt; $cipher = Imaginary::Crypt->new($key); # $fileName is the path to the file to encrypt # and $newFileName is where the now encrypted # file would reside $cipher->encrypt($fileName, $newFileName);