Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: how to convert rsa key to json

12 views
Skip to first unread message

Raymond Kroeker

unread,
May 17, 2013, 1:00:33 AM5/17/13
to Raphaël Jadot, dev-id...@lists.mozilla.org
Hi Raphael,

I'm just guessing because I haven't seen your environment but why don't you
try installing the json gem ala
$ gem install json

Tha should add the dependency you need.

Raymond

On Thursday, May 16, 2013, Raphaël Jadot wrote:

> Hello,
>
> I try to follow the documentation for implementing my own IdP, but i
> fail in generating a correct browserid file
> I made a script (deftojson2) following this document
>
> https://github.com/mozilla/browserid/blob/dev/docs/PRIMARY_PROTOCOL.md
> (6.1 Public Key Format)
>
> but while executing the script with "ruby deftojson2" , i've got
>
> -
> deftojson2:1:in `<main>': uninitialized constant OpenSSL (NameError)
> -
>
>
> So i added
>
> -
> require 'openssl'
> -
>
>
> and I've got
>
> -
> deftojson2:4:in `<main>': undefined method `to_json' for #<Hash:0x9ac22f0>
> (NoMethodError)
> -
>
>
> I tried another script found on the web
>
> -
> require 'openssl'
> privkey = OpenSSL::PKey::RSA.new(2048)
> pubkey = privkey.public_key
>
> # Return BrowserID Identity JSON
> def to_json
> {
> "public-key" => { "algorithm"=> "RS", "n" => public_key.n.to_s, "e" =>
> public_key.e.to_s },
> "authentication" => "/sign_in",
> "provisioning" => "/provision"
> }.to_json
> end
> -
>
>
> but I have no output at all.
>
> I'm not a ruby user, I'd be glad if someone can tell me what I'm doing
> wrong :)
>
>
>
> --
> Best regards, meilleures salutations
> Raphaël Jadot
>
>

--
---------------------------------------------------------
Raymond Kroeker

Raphaël Jadot

unread,
May 17, 2013, 7:24:02 PM5/17/13
to raykr...@gmail.com, dev-id...@lists.mozilla.org
Thanks Raymond :)

I did it unfortunately, it did not change the general behaviour of the
scripts.

Is there no alternative (easy maybe :p ) way to generate a browserid
file from a rsa key?

Le ven. 17 mai 2013 07:00:33 CEST, Raymond Kroeker a écrit :
> Hi Raphael,
>
> I'm just guessing because I haven't seen your environment but why
> don't you try installing the json gem ala
> $ gem install json
>
> Tha should add the dependency you need.

0 new messages