views:

1058

answers:

3

I have two sites.

The first site requires users to log in. An authentication token then will be passed to the second site when the users nagivate from the first to the second. So the users can't just grab the url of the second sites and login to it.

What is the best encryption/ authentication algorithm that I can use for the this authentication purpose?

+4  A: 

Typical PK scheme. On site1 encrypt auth info with site1's private key, and site2's public key. On site2 decrytp using site2's private key, and site1's public key.

Functions of interest:

vartec
I am sorry, but I don't find anything on PK scheme in Google
Ngu Soon Hui
PK == Public Key. http://en.wikipedia.org/wiki/Public_key
vartec
See http://en.wikipedia.org/wiki/Public-key_cryptography
Ferdinand Beyer
+2  A: 

I'd use AES encryption.

Why a symmetric encryption? It's faster and less resource intensive. (CPU, bandwidth) You can just distribute the keys and then it's just as safe as the asymmetric encryption.

The advantage of asymmetric encryption exists only if the two clients don't know each other.

Georg
+1. You can also do it with a simple hash. eg: token “4d2.49a7f0d4.226c04be17a8f860acb7e4e5ce093d420b9a177e”, where ‘4d2’ is user 1234 in hex, ‘49a7f0d4’ is a token-expiry timestamp, and the last bit is an sha1() hash of “sausage.4d2.49a7f0d4”, ‘sausage’ being a shared secret between site1 and site2
bobince
nb. If you do something like that, use a stronger shared secret than ‘sausage’ :-)
bobince
sausage is awesome! but you're right, dictionary words are probably not your best source of encryption keys...
Wally Lawless
+3  A: 

Be sure to have a look at the OpenID protocol, it does what you want.

kmkaplan