For OpenID smart mode, the specification uses Diffie-Hellman key exchange. I am wondering if it is possible to use public and private keys (provided that they are not compromised), or if they should be created for each request. I use the PHP OpenSSL library (my code: $key = openssl_pkey_new(array('private_key_type' => OPENSSL_KEYTYPE_DH)); ) to generate the keys, and it's terribly slow (on average 22 seconds to generate the key - very unacceptable to the website) . If keys cannot be reused, is there a faster way to generate keys using OpenSSL? I would prefer not to do it manually due to dependencies on math libraries, etc.
EDIT: To be clear, I am looking for two things in the answer: can I reuse Diffie-Hellman keys in OpenID association mode, and if not, is there a faster way to generate keys using OpenSSL than openssl_pkey_new() , since it takes a lot of time.
source share