Almost ! RSA Javascript/Ruby

Discussion in 'Ruby' started by Jean Verger, Sep 11, 2006.

  1. Jean Verger

    Jean Verger Guest

    Hi all,

    back into the RSA Javascript/Ruby:
    http://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 :)

    http://i108.photobucket.com/albums/n27/jverger/rsaRuby.png

    On 9/5/06, Jan Svitok <> wrote:
    > 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
    >
    >
     
    Jean Verger, Sep 11, 2006
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. gg
    Replies:
    0
    Views:
    3,113
  2. Evren Esat Ozkan
    Replies:
    3
    Views:
    923
    Paul Rubin
    Jul 17, 2008
  3. sri

    RSA encryption using javascript

    sri, May 25, 2004, in forum: ASP .Net Security
    Replies:
    0
    Views:
    310
  4. news.bt.com
    Replies:
    1
    Views:
    300
    Dave Anderson
    Nov 18, 2004
  5. voipfc
    Replies:
    0
    Views:
    226
    voipfc
    Oct 11, 2006
  6. joe
    Replies:
    1
    Views:
    224
    Charles Lowe
    Apr 22, 2008
  7. Avdi Grimm

    Ruby is Almost Ready!

    Avdi Grimm, Apr 11, 2008, in forum: Ruby
    Replies:
    3
    Views:
    203
    Marc Heiler
    Apr 11, 2008
  8. Astan Chee

    simple rsa from javascript to python

    Astan Chee, Apr 3, 2012, in forum: Python
    Replies:
    1
    Views:
    743
    Nobody
    Apr 3, 2012
Loading...