From: Jan Svitok Date: 2006-09-05T20:31:52+09:00 Subject: Re: RSA Java/Ruby On 9/5/06, Jean Verger wrote: > 2. If I use this: PKey::RSA.generate(512) I believe that I still have > a random key generated (instead of one with n, d and e desired). From > not much difference than using this: > #openssl genrsa -out key.pem 256 > PKey::RSA.new(File.open("/key.pem").read, nil) Sorry, I misunderstood. This is how it *could* be done. I've just read the sources, haven't tried. key = PKey.RSA.new key.n, key.e, key.d = n,e,d If you know a bit of C, read the sources of ruby, everything is there ;-) namely: src/ext/openssl/ossl_pkey_rsa.c