Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Crypt::OpenPGP - determining which cipher to use

by hardburn (Abbot)
on Feb 02, 2004 at 15:12 UTC ( [id://325869]=note: print w/replies, xml ) Need Help??


in reply to Crypt::OpenPGP - determining which cipher to use

The best way is probably to use the Compat option. Crypt::OpenPGP should pick good defaults based on that.

Public key crypto is quite computationally expensive, but block ciphers are usually pretty quick. Instead of encrypting the entire message with the public key, most implementations will create a one-time session key for use in a block cipher, encrypt that key at the beginning of the message using the public key, and then encrypt the rest of the message with the block cipher key. So what KeyRing/KeyBlock types you have has nothing to do with what kind of block cipher you use.

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

: () { :|:& };:

Note: All code is untested, unless otherwise stated

Replies are listed 'Best First'.
Re: Re: Crypt::OpenPGP - determining which cipher to use
by hv (Prior) on Feb 02, 2004 at 15:31 UTC

    Sure, I'd love to use the Compat option, but as far as I can see that just shifts the problem: now I need to determine which Compat option to select, presumably again based on information (which I don't know how to get) encoded in the public key block.

    Hugo

      What you use for Compat depends entirely on what program your colleague is using to decrypt. The OpenPGP standard allows for a comment in the first line, which is generally used to store information about the program that generated it, but Crypt::OpenPGP doesn't appear to save this information. It would be difficult to extract meaningful data from it, anyway.

      The best option is to get everyone on a program that can understand the same block cipher. 3DES is a good choice; it's old and slow, but it's supported by just about everyone, and it's been pounded on for 20+ years and brute force is still the most efficent known way to break it.

      ----
      I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
      -- Schemer

      : () { :|:& };:

      Note: All code is untested, unless otherwise stated

        Ah, the intention is to produce something rather more general-purpose than that, which I can point at an arbitrary public key block.

        I notice that my colleague (who's using PGP Freeware 7.0.3 for Mac) can select any of his imported keys and get information about ID, Type, Keysize, Creation date, Expiry date and Cipher; amongst the keys he has imported are ones specifying CAST, AES-256, AES-128 or IDEA as the cipher.

        If it comes to it, I can always ask users to select a cipher from a list of those available, but I'm hoping to be able to provide the same auto-detect support that PGP Freeware is doing.

        Hugo

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://325869]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (7)
As of 2024-04-24 06:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found