Skip to content

Commit 53901e5

Browse files
committed
[fix] DSA private key should generate after set_key
1 parent a9a093a commit 53901e5

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

lib/jopenssl/_compat23.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,6 @@ def set_pqg(p, q, g)
2525

2626
end
2727

28-
class DSA
29-
30-
def set_key(pub_key, priv_key)
31-
self.pub_key = pub_key
32-
self.priv_key = priv_key
33-
self
34-
end
35-
36-
end
37-
3828
end
3929

4030
end

src/main/java/org/jruby/ext/openssl/PKeyDSA.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,14 @@ public IRubyObject set_pqg(IRubyObject p, IRubyObject q, IRubyObject g) {
512512
return this;
513513
}
514514

515+
@JRubyMethod
516+
public IRubyObject set_key(final ThreadContext context, IRubyObject pub_key, IRubyObject priv_key) {
517+
this.dsa_y = BN.getBigInteger(pub_key);
518+
this.dsa_x = BN.getBigInteger(priv_key);
519+
generateKeyInternal();
520+
return this;
521+
}
522+
515523
@JRubyMethod(name = "priv_key")
516524
public synchronized IRubyObject get_priv_key() {
517525
DSAPrivateKey key;

0 commit comments

Comments
 (0)