Giter Site home page Giter Site logo

rubycrypto / ed25519 Goto Github PK

View Code? Open in Web Editor NEW
106.0 7.0 17.0 1.02 MB

Ed25519 high-performance public-key signature system as a RubyGem (MRI C extension and JRuby Java extension)

Home Page: https://ed25519.cr.yp.to/

License: MIT License

C 46.81% Ruby 3.06% Java 50.07% HTML 0.06%
ed25519 digital-signatures curve25519 elliptic-curves cryptography

ed25519's People

Contributors

ghosteathuman avatar ixti avatar kotovalexarian avatar petergoldstein avatar tarcieri avatar utkarsh2102 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ed25519's Issues

Better JRuby provider

The JRuby provider used by this library is quite old, slow, and based on BigInteger, which may mean it is not timing-safe:

https://github.com/k3d3/ed25519-java

It now carries the following warning:

Don't use this!

This library was the first implementation of ed25519 in Java, and I highly recommend you don't
use this for anything serious. It uses BigInteger for everything and is therefore extremely slow
(takes 5 seconds to sign a message) and is also not secure against side-channel or timing attacks.

str4d's implementation is an alternative to consider:

https://github.com/str4d/ed25519-java

When use with capistrano, get incompatible library version error.

cap aborted!
LoadError: incompatible library version - ed25519-1.3.0/lib/ed25519_ref10.so
<internal:ruby/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
<internal:ruby/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
ed25519-1.3.0/lib/ed25519.rb:35:in `<module:Ed25519>'
ed25519-1.3.0/lib/ed25519.rb:9:in `<top (required)>'
<internal:ruby/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
<internal:ruby/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
/home/common/Stocks/marketbet_crawler/Capfile:6:in `<top (required)>'
ruby/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_module.rb:29:in `load'
ruby/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_module.rb:29:in `load_rakefile'
ruby/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:710:in `raw_load_rakefile'
ruby/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:104:in `block in load_rakefile'
ruby/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
ruby/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:103:in `load_rakefile'
ruby/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:82:in `block in run'
ruby/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
ruby/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:80:in `run'
capistrano-3.17.1/lib/capistrano/application.rb:14:in `run'
bin/../app/capistrano/gems/capistrano-3.17.1/bin/cap:3:in `<main>'

Thanks

How to use a received public key?

Hi

This is more like a quesiotn of usage. Got a public I need to use to verify a siganture. But when i try to load it i get

expected 32-byte String, got 43

Is that becasue i am using a Base64 encoded string?

More modern Ed25519 implementation(s)

The implementation used in this gem presently is the ~~~ref (not even ref10!)~~~ ref10 from SUPERCOP ~~~circa 2012~~~ October 2017. ~~~At the very least, it'd be good to upgrade the portable C implementation to ref10~~~.

It'd be nice to supply a more optimized implementation, such as floodyberry's ed25519-donna:

https://github.com/floodyberry/ed25519-donna

It might also be interesting to explore binding to curve25519-dalek using Helix:

https://github.com/isislovecruft/curve25519-dalek

See also issue #4 specifically in regard to JRuby.

Seeking to decode a point

I'm seeking to decode a point as described in RFC-8032 Section 5.1.3.

I believe I've discovered that the point is available as a serialization verify_key.to_bytes, however in rummaging through the gem, I cannot readily find an interface that performs the Section 5.1.3 decoding.

Is this decoding operation already supported? If so, are there usage guidelines?

(newbie in working with ed25519)

Support sign hex string

When the message is hex string like(0x0b00586cb27c291c813ce74e86a60dad270609abf2fc8bee107e44a80ac00225c409070010a5d4e80028000100000001000000d9bdd928bef54b08037a91aef4d051e5f6aacdd2cceb839ce58b668e275a161fd9bdd928bef54b08037a91aef4d051e5f6aacdd2cceb839ce58b668e275a161f),
When i use sign message, give me a wrong message.which is different from python result and js result.
please support it

Release new version for jRuby 9.3 support

Hi! I see you have a fix committed to fix jRuby 9.3 - could you release a new gem version with the fix?

I'm getting this error with capistrano and your fix seems to work when I paste it in manually:

NoMethodError: undefined method `runtime' for JRuby:Module

Thanks!

Internals could use refactoring

The internals of this gem are a tad wonky: parts of the code are implemented in Ruby and other parts as native extensions, calling each other through Ed25519::Engine.

They should probably be rewritten to work more like the x25519 gem, with the entirety of the gem implemented in the respective native language.

Question: Should I expect compatibility with OpenSSL?

Can I create a signature using this library (ref10 implementation on mri), and use openssl to verify it?

Here is a ruby program that shows basically what I trying to do:

require 'ed25519'
require 'base64'

message = 'a message to sign'

sk = Ed25519::SigningKey.generate
binary_sig = sk.sign(message)

# write signature to file
File.write 'sig', binary_sig

# write message to file
File.write 'msg', message

# write public key to PEM file
public_pem = <<~PEM
  -----BEGIN PUBLIC KEY-----
  #{Base64.strict_encode64(sk.verify_key.to_bytes)}
  -----END PUBLIC KEY-----
PEM
File.write 'key.public', public_pem

# verify using openssl
system("openssl pkeyutl -verify -pubin -inkey key.public -sigfile sig -rawin -in msg")

When I run that I get an error that makes me think openssl does not like the public key from this library. I may be exporting it wrong. Or I may be wrong to expect compatibility? This method of verifying ED25519 signatures does work with keys generated by openssl itself though.

The error I get:

$ ruby test.rb

Could not find private key of public key from key.public
C05F2C46F87F0000:error:1E08010C:DECODER routines:OSSL_DECODER_from_bio:unsupported:crypto/encode_decode/decoder_lib.c:102:No supported data to decode.
pkeyutl: Error initializing context

Thanks for any help!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.