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

how to convert rsa key to json

26 views
Skip to first unread message

Raphaël Jadot

unread,
May 16, 2013, 9:20:05 AM5/16/13
to dev-id...@lists.mozilla.org
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

signature.asc
0 new messages