# Almost ! RSA Javascript/Ruby

**URL:** <https://www.ruby-forum.com/t/almost-rsa-javascript-ruby/68279>\
**Category:** Ruby\
**Created:** [September 11, 2006, 12:27pm UTC](https://www.ruby-forum.com/t/almost-rsa-javascript-ruby/68279 "2006-09-11T12:27:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jverger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/49beb7/32.png) [@jverger](https://www.ruby-forum.com/u/jverger)\
**Post date:** [September 11, 2006, 12:27pm UTC](https://www.ruby-forum.com/t/almost-rsa-javascript-ruby/68279/1 "2006-09-11T12:27:54Z")

</div>

Hi all,

back into the RSA Javascript/Ruby:  
[![](https://i108.photobucket.com/albums/n27/jverger/rsaRuby.png) ](https://i108.photobucket.com/albums/n27/jverger/rsaRuby.png)

It looks that Javascript returns hex, while Ruby  
PKey::RSA.private\_decrypt(str) it takes bytes as argument. The little  
documentation I found on PKey::RSA.private\_decrypt, shows that it  
takes string (str) as argument.

My questions:

- What kind of argument does PKey::RSA.private\_decrypt(str) take ?  
string, byte?
- How to convert from Hex to bytes? what hex to string?
- Where can I find more documentation on PKey::RSA
- In case I decide to modify “src/ext/openssl/ossl\_pkey\_rsa.c” …  
should I compile that code? and store it where?

Some RSA crypt/verification hints with Ruby will be much appreciated.

thanks,

Jean

P.S.: Why almost?: I got to share the keys from the client to the  
server, although I’m still not able to load the cryped pwd from the  
client to the server … but very close 🙂

[![](https://i108.photobucket.com/albums/n27/jverger/rsaRuby.png) ](https://i108.photobucket.com/albums/n27/jverger/rsaRuby.png)
