Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Crypt::PGP5 giving me a headache

  • 18-02-2002 11:42pm
    #1
    Registered Users, Registered Users 2 Posts: 944 ✭✭✭


    Has anyone used this perl module before?

    I really must just be missing something here. I don't see why it's so complicated.

    Could someone please show me how to do one or more of the following:

    a) make any public key and its corresponding private key

    b) encrypt a piece of text using that public key

    c) decrypt that text using the private key

    Isn't that how PGP works? Maybe I just don't understand the basics and that's why it's not working. *sigh* this module has given me a major headache! Any help is much appreciated. Or would you recommend using a different perl module like Crypt::OpenPGP? Or if you know how to do it in maybe PHP or java. I'll try anything at this stage.

    use Crypt::PGP5;
    $pgp = new Crypt::PGP5;


    $pgp->secretkey ($keyid); # Set ID of default secret key.
    $pgp->passphrase ($passphrase); # Set passphrase.
    $pgp->armor ($boolean); # Switch ASCII armoring on/off.
    $pgp->detach ($boolean); # Switch detached signatures on/off.
    $pgp->encryptsafe ($boolean); # Switch paranoid encryption on/off.
    $pgp->version ($versionstring); # Set version string.
    $pgp->debug ($boolean); # Switch debugging output on/off.


    $signed = $pgp->sign (@message);
    @recipients = $pgp->msginfo (@ciphertext);
    $ciphertext = $pgp->encrypt ([@recipients], @plaintext);
    ($signature, $plaintext) = $pgp->verify (@ciphertext);
    ($signature, $plaintext) = $pgp->dverify ([@signature], [@message]);


    (Most of the methods below will be encapsulated into the
    Crypt::PGP5::Key class by next release, bewarned!)


    $pgp->addkey ($keyring, @key);
    $pgp->delkey ($keyid);
    $pgp->disablekey ($keyid);
    $pgp->enablekey ($keyid);
    @keys = $pgp->keyinfo (@ids);
    $keystring = $pgp->extractkey ($userid, $keyring);
    $pgp->keypass ($keyid, $oldpasswd, $newpasswd);
    $status = $pgp->keygen
    ($name, $email, $keytype, $keysize, $expire, $pass);


Comments

  • Registered Users, Registered Users 2 Posts: 944 ✭✭✭nahdoic


    So no one is used to using PGP encryption with Perl or PHP?


  • Registered Users, Registered Users 2 Posts: 944 ✭✭✭nahdoic


    Well it took me a couple of days, but i have finally got it working ( on my own :rolleyes: ).

    I ended up not using PGP5. There just seemed to be so many restrictions on it, about having to have licenses for commercial use, and apparently it is illegal for an american hosting company to offer the use of PGP to other countries? How that law can be enforced or be at all effective I have no idea. Instead i used www.gnupg.org , which is free from all licenses and worked a treat in the end. If anyone needs to get a PGP type system set up again i'd recommend it.

    And an excellent site on getting your PGP working can be found here http://www.verysimple.com/scripts/support_pgp.html

    Although gnupg does have some annoying quirks. Like it needed me to generate lotsa random ENTROPY for it to use to generate my random key. But because my freebsd build was too efficient it could never make enough to use. Instead I had to install it and run it on my inefficient windows to make enough ENTROPY for it use to generate my randon enough keys. Weird.

    Hmmm, ever get the feeling you're talking to yourself!


  • Closed Accounts Posts: 7,230 ✭✭✭scojones


    i use gnupg too. it's great. :)


Advertisement