compute_key

dh.compute_key(pub_bn) â aString Instance Public methods Returns a String containing a shared secret computed from the other party's public value. See DH_compute_key() for further information. Parameters pub_bn is a OpenSSL::BN, not the DH instance returned by #public_key as that contains the DH parameters only.

export

dh.to_pem â aString Instance Public methods Encodes this DH to its PEM encoding. Note that any existing per-session public/private keys will not get encoded, just the Diffie-Hellman parameters will be encoded. to_pem to_s

generate_key!

dh.generate_key! â self Instance Public methods Generates a private and public key unless a private key already exists. If this DH instance was generated from public DH parameters (e.g. by encoding the result of #public_key), then this method needs to be called first in order to generate the per-session keys before performing the actual key exchange. Example dh = OpenSSL::PKey::DH.new(2048) public_key = dh.public_key #contains no private/public key yet public_key.generate_key! put

params

dh.params â hash Instance Public methods Stores all parameters of key to the hash INSECURE: PRIVATE INFORMATIONS CAN LEAK OUT!!! Don't use :-)) (I's up to you)

params_ok?

dh.check_params â true | false Instance Public methods Validates the Diffie-Hellman parameters associated with this instance. It checks whether a safe prime and a suitable generator are used. If this is not the case, false is returned.

private?

dh.private? â true | false Instance Public methods Indicates whether this DH instance has a private key associated with it or not. The private key may be retrieved with DH#priv_key.

public?

dh.public? â true | false Instance Public methods Indicates whether this DH instance has a public key associated with it or not. The public key may be retrieved with DH#pub_key.

public_key

dh.public_key â aDH Instance Public methods Returns a new DH instance that carries just the public information, i.e. the prime p and the generator g, but no public/private key yet. Such a pair may be generated using #generate_key!. The âpublic keyâ needed for a key exchange with #compute_key is considered as per-session information and may be retrieved with DH#pub_key once a key pair has been generated. If the current instance already contains private information (and thus a valid

to_der

dh.to_der â aString Instance Public methods Encodes this DH to its DER encoding. Note that any existing per-session public/private keys will not get encoded, just the Diffie-Hellman parameters will be encoded.

to_pem

to_pem() Instance Public methods Alias for: export