Thread: Functions that deal with public key crypto?

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    265

    Functions that deal with public key crypto?

    Okeydokey, Im not a big cryptography fan, as im a firm believer that if somebody wants your data, they are going to get it no matter what you do with it, however recently I have found it necessary (been ordered to) start integration of basic public/private key pair cryptographic coding. I understand this stuff in theory, but what i really need is some working, portable, easy to understand, key generation and interaction code. Yes, before you go screaming stfw, rtfm, or any of that good stuff, know that yes, i have, and it wasnt good enough. I want to know how keys of varying length are created, and how they are used. Basically what im looking for are 3 functions. GenerateKeyPair, EncryptUsingMyPrivateKey, DecryptUsingTheOtherGuysPublicKey. There are about a million tutorials on how to set up key based crypto for various services, clients, and pre-created libs, but what i want to see is simple example code behind it. Thanks for your time.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    http://www.amazon.com/exec/obidos/tg...lance&n=507846

    Quick awnsers:
    Use SHA1 to generate keys.
    Use tripple DES (3DES) and 128 bit keys and encrypt/decrypt (they're not going to "get it" anytime soon).
    Use Diffie-Hellman key exchange algorithm.
    Use Google to find out about any of the above.

    gg
    Last edited by Codeplug; 11-29-2003 at 07:22 AM.

  3. #3
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    Get OpenSSL. It has lots of crypto functions for you to use.

  4. #4
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    I'd use an elliptic curve based key exchange protocol. Diffie-Hellman isn't quite as strong as it seems.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  5. #5
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Just use Rijndael encryption.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  6. #6
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    Originally posted by XSquared
    Just use Rijndael encryption.
    But thats a private key algorithm. It needs to be built in with a more complex cryptosystem.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  7. #7
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Isn't 3DES symmetrical too?
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  8. #8
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    Yeah, it is. You're right, Rijndael would probably be a wiser choice for the symmetric ciper in the cryptosystem layed out.

    DeepBlackMagic, you might want to look into Crypto++.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. key press in c plz help thanks
    By fizz_uk83 in forum C Programming
    Replies: 1
    Last Post: 12-24-2002, 07:40 PM
  2. FAQ: Directional Keys - Useing in Console
    By RoD in forum FAQ Board
    Replies: 38
    Last Post: 10-06-2002, 04:42 PM
  3. heeeeeeellllllpppppppp!!!
    By DarkDays in forum C++ Programming
    Replies: 15
    Last Post: 12-09-2001, 09:43 PM
  4. BST/Red and Black Tree
    By ghettoman in forum C++ Programming
    Replies: 0
    Last Post: 10-24-2001, 10:45 PM
  5. Exporting Object Hierarchies from a DLL
    By andy668 in forum C++ Programming
    Replies: 0
    Last Post: 10-20-2001, 01:26 PM