Skip to content

Commit 17d0549

Browse files
committed
preliminary OpenSSL 1.1 (Ruby 2.4) compatibility bits
... mostly port of OpenSSL 1.1.0's new opaque methods for PKey types https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/55285
1 parent 0797b0d commit 17d0549

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

lib/jopenssl/load.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
if RUBY_VERSION > '2.3'
2929
load 'jopenssl23/openssl.rb'
30+
load 'jopenssl24.rb' if RUBY_VERSION >= '2.4'
3031
elsif RUBY_VERSION > '2.2'
3132
load 'jopenssl22/openssl.rb'
3233
elsif RUBY_VERSION > '2.1'

lib/jopenssl24.rb

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# frozen_string_literal: false
2+
3+
# Ruby 2.4 preliminary compatibility script, loaded after all (2.3) jruby-openssl files
4+
5+
module OpenSSL
6+
7+
module SSL
8+
class SSLContext
9+
# OpenSSL 1.1.0 introduced "security level"
10+
def security_level; 0 end
11+
def security_level=(level); raise NotImplementedError end
12+
end
13+
end
14+
15+
module PKey
16+
17+
class DH
18+
19+
def set_key(pub_key, priv_key)
20+
self.public_key = pub_key
21+
self.priv_key = priv_key
22+
self
23+
end
24+
25+
def set_pqg(p, q, g)
26+
self.p = p
27+
self.q = q
28+
self.g = g
29+
self
30+
end
31+
32+
end
33+
34+
class DSA
35+
36+
def set_key(pub_key, priv_key)
37+
self.public_key = pub_key
38+
self.priv_key = priv_key
39+
self
40+
end
41+
42+
def set_pqg(p, q, g)
43+
self.p = p
44+
self.q = q
45+
self.g = g
46+
self
47+
end
48+
49+
end
50+
51+
class RSA
52+
53+
def set_key(n, e, d)
54+
self.n = n
55+
self.e = e
56+
self.d = d
57+
self
58+
end
59+
60+
def set_factors(p, q)
61+
self.p = p
62+
self.q = q
63+
self
64+
end
65+
66+
def set_crt_params(dmp1, dmq1, iqmp)
67+
self.dmp1 = dmp1
68+
self.dmq1 = dmq1
69+
self.iqmp = iqmp
70+
self
71+
end
72+
73+
end
74+
75+
end
76+
77+
end

0 commit comments

Comments
 (0)