Skip to content

Commit 126d868

Browse files
committed
Ruby 2.3 compatibility - for now mostly adjust to changes in MRI's openssl .rb parts
1 parent cd47562 commit 126d868

File tree

11 files changed

+1668
-2
lines changed

11 files changed

+1668
-2
lines changed

lib/jopenssl/load.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
require 'jopenssl.jar'
2525
org.jruby.ext.openssl.OpenSSL.load(JRuby.runtime)
2626

27-
if RUBY_VERSION > '2.2'
27+
if RUBY_VERSION > '2.3'
28+
load 'jopenssl23/openssl.rb'
29+
elsif RUBY_VERSION > '2.2'
2830
load 'jopenssl22/openssl.rb'
2931
elsif RUBY_VERSION > '2.1'
3032
load 'jopenssl21/openssl.rb'

lib/jopenssl23/openssl.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
=begin
2+
= $RCSfile$ -- Loader for all OpenSSL C-space and Ruby-space definitions
3+
4+
= Info
5+
'OpenSSL for Ruby 2' project
6+
Copyright (C) 2002 Michal Rokos <[email protected]>
7+
All rights reserved.
8+
9+
= Licence
10+
This program is licenced under the same licence as Ruby.
11+
(See the file 'LICENCE'.)
12+
13+
= Version
14+
$Id$
15+
=end
16+
17+
require 'openssl/bn'
18+
require 'openssl/cipher'
19+
require 'openssl/config'
20+
require 'openssl/digest'
21+
require 'openssl/x509'
22+
require 'openssl/ssl'

lib/jopenssl23/openssl/bn.rb

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# frozen_string_literal: false
2+
#--
3+
#
4+
# = Ruby-space definitions that completes C-space funcs for BN
5+
#
6+
# = Info
7+
# 'OpenSSL for Ruby 2' project
8+
# Copyright (C) 2002 Michal Rokos <[email protected]>
9+
# All rights reserved.
10+
#
11+
# = Licence
12+
# This program is licensed under the same licence as Ruby.
13+
# (See the file 'LICENCE'.)
14+
#++
15+
16+
module OpenSSL
17+
class BN
18+
def pretty_print(q)
19+
q.object_group(self) {
20+
q.text ' '
21+
q.text to_i.to_s
22+
}
23+
end
24+
end # BN
25+
end # OpenSSL
26+
27+
##
28+
# Add double dispatch to Integer
29+
#
30+
class Integer
31+
# Casts an Integer as an OpenSSL::BN
32+
#
33+
# See `man bn` for more info.
34+
def to_bn
35+
OpenSSL::BN::new(self)
36+
end
37+
end # Integer

0 commit comments

Comments
 (0)