chrisa/node-rsa — pull request #5 by danfuzz (2012-01-26 21:22:51+00:00)
Title: Add getModulus() and getExponent() to RsaKeyPair.

Hi there! I recently started looking into doing RSA crypto with Node and found your very useful module.

As it happens, I have a short-term need to extract the components of public keys (e.g. to create fingerprints). It occurred to me that this functionality would fit in pretty reasonably with node-rsa, so I went ahead and made this patch. Before I take the time to add formal tests, document it, etc., I just wanted to check in with you, to see if the patch (or something like it) is something you'd be willing to take.

Thanks for your consideration!

-dan

##########

Original commit message

Add getModulus() and getExponent() to RsaKeyPair.

These two methods return the two components of a public key and will
operate on either a public or private key (since the latter includes
all the info of the former). Each takes an optional encoding argument
("binary" "base64" or "hex") for the result (omitted == "binary").