Skip to content

Commit

Permalink
[fix] DSA private key should generate after set_key
Browse files Browse the repository at this point in the history
  • Loading branch information
kares committed Dec 13, 2024
1 parent a9a093a commit 53901e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
10 changes: 0 additions & 10 deletions lib/jopenssl/_compat23.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,6 @@ def set_pqg(p, q, g)

end

class DSA

def set_key(pub_key, priv_key)
self.pub_key = pub_key
self.priv_key = priv_key
self
end

end

end

end
8 changes: 8 additions & 0 deletions src/main/java/org/jruby/ext/openssl/PKeyDSA.java
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,14 @@ public IRubyObject set_pqg(IRubyObject p, IRubyObject q, IRubyObject g) {
return this;
}

@JRubyMethod
public IRubyObject set_key(final ThreadContext context, IRubyObject pub_key, IRubyObject priv_key) {
this.dsa_y = BN.getBigInteger(pub_key);
this.dsa_x = BN.getBigInteger(priv_key);
generateKeyInternal();
return this;
}

@JRubyMethod(name = "priv_key")
public synchronized IRubyObject get_priv_key() {
DSAPrivateKey key;
Expand Down

0 comments on commit 53901e5

Please sign in to comment.