Hello,
I've put together the little elliptic gem that makes elliptic curve
digital signature algorithm (ECDSA) cryptography
with OpenSSL easy / easier (including the "classic" secp256k1 curve
used by ethereum, bitcon, and many others).
So far the only public comment from the always friendly ruby
community (on reddit):
Why is this needed? Doesn't ruby already support all of
elliptic curve digital signature algorithm (ECDSA) out of the box?
Here's my response and coding challenge reposted:
It says it in the title - OpenSSL made easy / easier.
You are more than welcome to use the "raw" OpenSSL module or create
your own OpenSSL helpers.
As an exercise can you show how to get the r,s numbers for a signature
with the out-of-the-box "raw" OpenSSL?
Here's the version from elliptic README:
signature = EC.sign( txhash, private_key )
signature.r
#=> 80563021554295584320113598933963644829902821722081604563031030942154621916407
signature.s
#=> 58316177618967642068351252425530175807242657664855230973164972803783751708604
or how about challenge #2 - recreate a public key from the elliptic
curve point, that is,
the x,y numbers with the out-of-the-box "raw" OpenSSL.
Here again is the elliptic version from the README for your reference:
public_key = EC::PublicKey.new(
102884003323827292915668239759940053105992008087520207150474896054185180420338,
49384988101491619794462775601349526588349137780292274540231125201115197157452)
or how about challenge #3 - super easy - create a private key from a number
with the out-of-the-box "raw" OpenSSL. Here again is the elliptic
version from the README for your reference:
private_key = EC::PrivateKey.new( 123456 )
and now challenge #4 - derive the public key.
Here again is the elliptic version from the README for your reference:
public_key = private_key.public_key
and so on.
Cheers. Prosit 2021!
[1] blockchain/elliptic at master · rubycocos/blockchain · GitHub
[2] elliptic | RubyGems.org | your community gem host