Skip to content

Failure to create and verify ECDSA signatures #193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
aleksandrs-ledovskis opened this issue Feb 15, 2020 · 2 comments
Closed

Failure to create and verify ECDSA signatures #193

aleksandrs-ledovskis opened this issue Feb 15, 2020 · 2 comments
Milestone

Comments

@aleksandrs-ledovskis
Copy link

aleksandrs-ledovskis commented Feb 15, 2020

Haven't tested it with other algorithms, but attempting to generate a Digest-type signature using secp256r1/P-256 (ECDSA) key using SHA-1 hashing algorithm

OpenSSL::PKey::EC.new(File.read('ecdsa.key')).sign(OpenSSL::Digest::SHA1.new, 'foobar')

fails with

OpenSSL::PKey::PKeyError: SHA1WITHEC Signature not available
    sign at org/jruby/ext/openssl/PKey.java:223

Cursory investigation brings me to Bouncy Castle, where SHA1WITHECDSA algo does exists.

I have cobbled up a hacky patch to pass ECDSA in around here when PKeyEC instance is in play. It does work (both sign/verify output proper values, cross checked with CRuby's OpenSSL), but am not sure about architectural validity of this approach.

@kares
Copy link
Member

kares commented Feb 18, 2020

Hey Aleks, that makes sense. The EC support wasn't completely polished.
But this part should return "ECDSA" ... as you already figured. Please fire up a PR.

@aleksandrs-ledovskis
Copy link
Author

@kares As the 25972fd commit only contains test but not an implementation, and causes some CI failures, I think this issue in itself isn't fully resolved?

kares added a commit that referenced this issue Jun 14, 2020
deivid-rodriguez pushed a commit to deivid-rodriguez/jruby-openssl that referenced this issue Sep 4, 2020
deivid-rodriguez pushed a commit to deivid-rodriguez/jruby-openssl that referenced this issue Sep 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants