I understand that RSA keys can be generated using different sha
algorithms. Using openssl
, I don't seem to have the option of specifying what algorithm the key generator should use. I suspect it's using sha256
.
How can I generate RSA keys using different sha
algorithms (such as sha512
) in either a bash shell or in Ruby? Does the openssl
library support generating RSA keys using different algorithms? If not, does anyone know of another library I can use? (In ruby, OpenSSL::PKey::RSA
doesn't seem to allow for choosing an algorithm, but the documentation is hard for me to follow soo...?)
Apologies if this question has already been answered, but I haven't been able to find an answer.
Maybe I should also note (in case I am wrong): it is my understanding that choosing a size for the generated RSA key (i.e. RSA 2048
) is separate from choosing the hashing algorithm (i.e. sha512
).
UPDATE - Some background
I want to sign Java Web Tokens with an RSA key. The JWT library I'm using gives me the impression that RSA keys can be generated using different hashing algorithms (RS256, RS384, RS512). Generating a key using openssl
doesn't seem to let me choose what hashing algorithm is used though.
Thanks!!
SecureRandom
); or (2) the signing algorithm associated with a digital signature (like used in a certificate). In either case I think we need more information or clarification. – Allip
,q
, selectinge
and then solving ford
. There are some other constraints, like ensuringp
andq
are prime, ande
is relatively prime or coprime toϕ(n)
. Hashes are not used at this stage in the process. – Alliopenssl
) only allows you to select the number of bits in the key, not the algorithm used. Thanks! – Riggs