Results 1 to 2 of 2

Thread: cryptography

  1. #1
    Join Date
    Apr 2009


    What steps are required to integrate AES with Diffie Hellman???

  2. #2
    Junior Member
    Join Date
    Apr 2009
    I'm not positive how exactly one would integrate one into the other, but I do know they can be used side-by-side fairly easily.

    I'm a little bit rusty in regards to cryptography, but I think I'll be able to answer this question for you.

    The Diffie-Hellman Key Exchange is a way for two parties to generate a common secret key without actually exchanging the key between themselves. The key that is generated could be considered to be something along the line of a password. When I work with encryption algorithms I like to have a piece of programming code to use as a visual and reference. This is something that I've had bookmarked in my del.icio.us in reference to Diffie-Hellman and the Ruby scripting language:


    Ok, so based off that Ruby code, Alice and Bob both have a shared key which only they know. Now what can be done is to use this secret key/password as the key for encrypting and decrypting strings with a simple AES function. Again here is some simple Ruby code for some basic Encrypt and Decrypt AES functions using the OpenSSL library:


    With the above Ruby examples, it would be possible to implement something along the lines of:

    # Create diffie-hellman object
    alice = DH.new(53, 5, 23)
    bob   = DH.new(53, 5, 15)
    # Generate public keys
    # Exchange public keys and generate secret keys
    alice_s = alice.secret(bob.e)
    bob_s   = bob.secret(alice.e)
    # Alice encrypts a message and sends it to Bob over a socket
    safe_payload = encrypt(alice_s,"Hello world")
    # Bob receives the encrypted string and decrypts it into a readable message
    message = decrypt(bob_s,safe_payload)
    # Print the message
    print "Message from Alice: #{message}"
    This isn't the best way to go about securing communications, but it does provide a pretty good idea of how DH and AES could be used together. If you are interested in secure communications, you may want to look into the OpenSSL libraries. They provide easy access to a Secure Socket Layer (SSL) which already had Diffie-Hellman and AES integrated.

    I hope this is the answer you were looking for. It's pretty early in the morning and it's been a while since I took any cryptography classes or programmed anything in regards to secure communications, so there is a chance that I may be incorrect or my examples may not work.


Similar Threads

  1. Quantum cryptography leaves the lab
    By Aspman in forum Cryptography, Steganography, etc.
    Replies: 11
    Last Post: May 1st, 2007, 09:08 AM
  2. An Introduction to Cryptography, and Common Electronic Cryptosystems – Part I
    By 576869746568617 in forum Cryptography, Steganography, etc.
    Replies: 1
    Last Post: July 10th, 2006, 10:38 PM
  3. Public Key Cryptography
    By hypronix in forum The Security Tutorials Forum
    Replies: 0
    Last Post: July 21st, 2003, 11:42 AM
  4. Introduction about cryptography
    By nirvanainheaven in forum AntiOnline's General Chit Chat
    Replies: 1
    Last Post: March 24th, 2003, 04:51 AM
  5. Cryptography Introduction.
    By instronics in forum The Security Tutorials Forum
    Replies: 5
    Last Post: March 24th, 2003, 03:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts