Bug #4734

[ext/openssl] DSA#sign error

Added by Martin Bosslet almost 3 years ago. Updated almost 3 years ago.

[ruby-core:36322]
Status:Closed
Priority:Normal
Assignee:Martin Bosslet
Category:ext
Target version:1.9.3
ruby -v:- Backport:

Description

Hi,

imo the following should work just fine:

data = 'Sign me!'
digest = OpenSSL::Digest::SHA256.new
pkey = OpenSSL::PKey::DSA.new(512)
signature = pkey.sign(digest, data)

At least it does for PKey::RSA. But the above produces (OpenSSL 0.9.8k):

in `sign': wrong public key type (OpenSSL::PKey::PKeyError)

I'll look into it - but I'd appreciate if someone could please
verify that this is really a bug and try to reproduce the error?

Regards,
Martin

History

#1 Updated by Yui NARUSE almost 3 years ago

I can reproduce it with
* ruby 1.9.3dev (2011-05-18 trunk 31621) [x86_64-freebsd8.2]
* OpenSSL 0.9.8q 2 Dec 2010"

#2 Updated by Hiroshi Nakamura almost 3 years ago

  • ruby -v changed from ruby 1.9.3dev (2011-05-17 trunk 31593) [i686-linux] to -

Sorry, I should have aware of this ticket.

Non-DSS1 DSA signing is from openssl 1.0.0. It should work on openssl >= 1.0.0.

Tests in ruby18 branch (test/openssl/test_x509cert.rb) should have
related tests. The tests are synced with jruby-ossl but it's not
merged yet to trunk. Can you merge that? Let me know if I should do
that.

Regards,
// NaHi

#3 Updated by Martin Bosslet almost 3 years ago

Thanks Yui for testing!

@nahi: OK, I understand now. I'll try with openssl >= 1.0.0 to see if
it works there.
I can merge the tests from ruby18 to trunk after that, that's OK.

Thanks for your input, both of you!
-Martin

2011/5/19 Hiroshi Nakamura nakahiro@gmail.com:

Sorry, I should have aware of this ticket.

Non-DSS1 DSA signing is from openssl 1.0.0. It should work on openssl >= 1.0.0.

Tests in ruby18 branch (test/openssl/test_x509cert.rb) should have
related tests. The tests are synced with jruby-ossl but it's not
merged yet to trunk. Can you merge that? Let me know if I should do
that.

Regards,
// NaHi

#4 Updated by Martin Bosslet almost 3 years ago

  • Status changed from Assigned to Closed

I merged the tests from 1.8 and added further tests to testpkeydsa.rb.

Regards,
Martin

Also available in: Atom PDF