Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.2 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    Crypt::OTR 0.08

    Download button

    No screenshots available
    Downloads: 136  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Mischa Spiegelmock | More programs
    Perl Artistic License / FREE
    November 4th, 2011, 05:23 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Crypt::OTR description

    Off-The-Record encryption library for secure instant messaging applications

    Crypt::OTR is a Perl wrapper around libotr - see http://www.cypherpunks.ca/otr/README-libotr-3.2.0.txt

    This module is experimental and unfinished, not yet recommended for production or important systems.

    SYNOPSIS

     use Crypt::OTR;
     
     # call near the beginning of your program
     Crypt::OTR->init;

     # create OTR object, set up callbacks
     my $otr = new Crypt::OTR(
     account_name => "alice", # name of account associated with this keypair
     protocol_name => "my_protocol_name", # e.g. 'AIM'
     max_message_size => 1024, # how much to fragment
     );
     $otr->set_callback('inject' => \&otr_inject);
     $otr->set_callback('otr_message' => \&otr_system_message);
     $otr->set_callback('verified' => \&otr_verified);
     $otr->set_callback('unverified' => \&otr_unverified);

     # create a context for user "bob"
     $otr->establish("bob"); # calls otr_inject($account_name, $protocol, $dest_account, $message)

     # send a message to bob
     my $plaintext = "hello, bob! this is a message from alice";
     if (my $ciphertext = $otr->encrypt("bob", $plaintext)) {
     $my_app->send_message_to_user("bob", $ciphertext);
     } else {
     warn "Your message was not sent - no encrypted conversation is established\n";
     }

     # called from bob's end
     if (my $plaintext = $otr->decrypt("alice", $ciphertext)) {
     print "alice: $plaintext\n";
     } else {
     warn "We received an encrypted message from alice but were unable to decrypt it\n";
     }

     # done with chats
     $otr->finish("bob");
     
     # CALLBACKS

     # called when OTR is ready to send a message after massaging it.
     # this method should actually transmit $message to $dest_account
     sub otr_inject {
     my ($self, $account_name, $protocol, $dest_account, $message) = @_;
     $my_app->send_message_to_user($dest_account, $message);
     }

     # called to display an OTR control message for a particular user or protocol
     sub otr_system_message {
     my ($self, $account_name, $protocol, $other_user, $otr_message) = @_;
     warn "OTR says: $otr_message\n";
     return 1;
     }

     # called when a verified conversation is established with $from_account
     sub verified {
     my ($self, $from_account) = @_;
     print "Started verified conversation with $from_account\n";
     }

     # called when an unverified conversation is established with $from_account
     sub unverified {
     my ($self, $from_account) = @_;
     print "Started unverified conversation with $from_account\n";
     }



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    libotr wrapper | Perl module | Perl | libotr | wrapper

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM