Skip to content

Commit d7968d9

Browse files
committed
re-add (2.4) preliminary compat script but load it on 2.3 (JRuby 9.1)
... as well - since C openssl is pretty much gem-ified these days
1 parent 777faee commit d7968d9

2 files changed

Lines changed: 72 additions & 1 deletion

File tree

lib/jopenssl/_compat23.rb

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# frozen_string_literal: false
2+
3+
module OpenSSL
4+
5+
module PKey
6+
7+
class DH
8+
9+
def set_key(pub_key, priv_key)
10+
self.public_key = pub_key
11+
self.priv_key = priv_key
12+
self
13+
end
14+
15+
def set_pqg(p, q, g)
16+
self.p = p
17+
if respond_to?(:q)
18+
self.q = q
19+
else # TODO self.q = q
20+
OpenSSL.warn "JRuby-OpenSSL does not support setting q param on #{inspect}" if q
21+
end
22+
self.g = g
23+
self
24+
end
25+
26+
end
27+
28+
class DSA
29+
30+
def set_key(pub_key, priv_key)
31+
self.public_key = pub_key
32+
self.priv_key = priv_key
33+
self
34+
end
35+
36+
def set_pqg(p, q, g)
37+
self.p = p
38+
self.q = q
39+
self.g = g
40+
self
41+
end
42+
43+
end
44+
45+
class RSA
46+
47+
def set_key(n, e, d)
48+
self.n = n
49+
self.e = e
50+
self.d = d
51+
self
52+
end
53+
54+
def set_factors(p, q)
55+
self.p = p
56+
self.q = q
57+
self
58+
end
59+
60+
def set_crt_params(dmp1, dmq1, iqmp)
61+
self.dmp1 = dmp1
62+
self.dmq1 = dmq1
63+
self.iqmp = iqmp
64+
self
65+
end
66+
67+
end
68+
69+
end
70+
71+
end

lib/jopenssl/load.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
if RUBY_VERSION > '2.3'
3434
load 'jopenssl23/openssl.rb'
35-
load 'jopenssl24.rb' if RUBY_VERSION >= '2.4'
35+
load 'jopenssl/_compat23.rb'
3636
elsif RUBY_VERSION > '2.2'
3737
load 'jopenssl22/openssl.rb'
3838
elsif RUBY_VERSION > '2.1'

0 commit comments

Comments
 (0)