jruby-openssl 0.11.0.cr1-java → 0.12.2-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +5 -5
  2. data/History.md +45 -0
  3. data/Mavenfile +20 -25
  4. data/README.md +3 -0
  5. data/Rakefile +21 -35
  6. data/lib/jopenssl/load.rb +49 -14
  7. data/lib/jopenssl/version.rb +2 -1
  8. data/lib/jopenssl.jar +0 -0
  9. data/lib/openssl/bn.rb +40 -9
  10. data/lib/openssl/buffering.rb +478 -9
  11. data/lib/openssl/cipher.rb +67 -9
  12. data/lib/openssl/config.rb +496 -12
  13. data/lib/openssl/digest.rb +73 -9
  14. data/lib/openssl/hmac.rb +13 -0
  15. data/lib/openssl/marshal.rb +30 -0
  16. data/lib/openssl/pkcs5.rb +3 -3
  17. data/lib/openssl/pkey.rb +42 -5
  18. data/lib/openssl/ssl.rb +543 -9
  19. data/lib/openssl/x509.rb +369 -9
  20. data/lib/openssl.rb +3 -1
  21. data/pom.xml +35 -126
  22. metadata +9 -44
  23. data/lib/jopenssl19/openssl/bn.rb +0 -29
  24. data/lib/jopenssl19/openssl/buffering.rb +0 -449
  25. data/lib/jopenssl19/openssl/cipher.rb +0 -28
  26. data/lib/jopenssl19/openssl/config.rb +0 -472
  27. data/lib/jopenssl19/openssl/digest.rb +0 -32
  28. data/lib/jopenssl19/openssl/ssl-internal.rb +0 -223
  29. data/lib/jopenssl19/openssl/ssl.rb +0 -2
  30. data/lib/jopenssl19/openssl/x509-internal.rb +0 -115
  31. data/lib/jopenssl19/openssl/x509.rb +0 -2
  32. data/lib/jopenssl19/openssl.rb +0 -22
  33. data/lib/jopenssl21/openssl/bn.rb +0 -28
  34. data/lib/jopenssl21/openssl/buffering.rb +0 -1
  35. data/lib/jopenssl21/openssl/cipher.rb +0 -1
  36. data/lib/jopenssl21/openssl/config.rb +0 -1
  37. data/lib/jopenssl21/openssl/digest.rb +0 -1
  38. data/lib/jopenssl21/openssl/ssl.rb +0 -1
  39. data/lib/jopenssl21/openssl/x509.rb +0 -119
  40. data/lib/jopenssl21/openssl.rb +0 -22
  41. data/lib/jopenssl22/openssl/bn.rb +0 -39
  42. data/lib/jopenssl22/openssl/buffering.rb +0 -456
  43. data/lib/jopenssl22/openssl/cipher.rb +0 -28
  44. data/lib/jopenssl22/openssl/config.rb +0 -313
  45. data/lib/jopenssl22/openssl/digest.rb +0 -54
  46. data/lib/jopenssl22/openssl/ssl.rb +0 -330
  47. data/lib/jopenssl22/openssl/x509.rb +0 -139
  48. data/lib/jopenssl22/openssl.rb +0 -22
  49. data/lib/jopenssl23/openssl/bn.rb +0 -38
  50. data/lib/jopenssl23/openssl/buffering.rb +0 -455
  51. data/lib/jopenssl23/openssl/cipher.rb +0 -25
  52. data/lib/jopenssl23/openssl/config.rb +0 -474
  53. data/lib/jopenssl23/openssl/digest.rb +0 -43
  54. data/lib/jopenssl23/openssl/pkey.rb +0 -25
  55. data/lib/jopenssl23/openssl/ssl.rb +0 -508
  56. data/lib/jopenssl23/openssl/x509.rb +0 -208
  57. data/lib/jopenssl23/openssl.rb +0 -19
  58. data/lib/openssl/ssl-internal.rb +0 -5
  59. data/lib/openssl/x509-internal.rb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f3f30690dc2b33cef639d984152204e362ca32fe
4
- data.tar.gz: e28ede260833c9223108b43ca15d725224c678b7
2
+ SHA256:
3
+ metadata.gz: 5e7e293b2549e684866105df2df1b7fdc93b930a9740bf6b5159149dfbc236e0
4
+ data.tar.gz: 771bace1ef936acd0ec9508f30f4636c3415a3785ebe29883490646b9221eae9
5
5
  SHA512:
6
- metadata.gz: c061354db76fc82fc1b554e633c4192f3795e109a78e4aba8fe9d3d3a244a2dc5ff29ee8e6389876abf12999c080375c191f7be654d3fe839f01a9882589d8af
7
- data.tar.gz: 2cc1932d607582de0f4858c6e11fc32774ca3a1653ce3efc9bea20204e358feffe274e13c1d96c44cff5fa77600678c4703cdaf7d4a0e62f27a9c08982457e29
6
+ metadata.gz: f746ec0e6551af8004714f6345154a0c52a429283828e8a41765617627d0498083283216b33dcca9fe1dd7206aeb1bc8d9bff0b2e6999395bfe8cdaa32dd295e
7
+ data.tar.gz: 9261e4930fd87105dfcf2ade1cba0cf8d241623394f83ecd0c86a476d151eb12de34fa480a0838347dcc4950acebae3306746b4e0c69ebeb2c109c38ce7a81ac
data/History.md CHANGED
@@ -1,3 +1,48 @@
1
+ ## 0.12.2
2
+
3
+ * [fix] work-around JRuby 9.2 autoload behavior (#248)
4
+ to be able to install jruby-openssl >= 0.12 on JRuby 9.2
5
+ while the default gem (shipped with JRuby) is < 0.12
6
+ * [feat] support alpn negotiation in ssl context (#247)
7
+ * [feat] support Java cipher names on `SSLContext#ciphers=`
8
+ * [fix] properly handle `require_jar` fallback
9
+
10
+ ## 0.12.1
11
+
12
+ * improved compatibility with the openssl gem (version 2.2.1)
13
+ * JOSSL now ships with a single set of openssl .rb files
14
+ - providing compat with `required_ruby_version = '>= 2.3.0'`
15
+ - flat set of .rb files at *lib/openssl/* (based on openssl gem)
16
+ * revisited `OpenSSL::SSL::SSLContext::DEFAULT_PARAMS` defaults
17
+ - implicit `verify_hostname` default .rb callback still a noop
18
+ - TLS continues to rely on the Java SSL engine for hostname checks
19
+ * working TLS 1.3 support
20
+ * droped Java 1.7 support (at least Java 8 needed to use the gem)
21
+ * fixed `SSLContext#options` matches C OpenSSL (using `OP_ALL`)
22
+ * no longer filter out SSLv2 (for improved OpenSSL compatibility)
23
+ * implemented naive `SSLContext#ciphers` caching to speed-up TLS
24
+ * `StoreError` raised due a Java exception now retain native cause
25
+
26
+ ## 0.12.0 (yanked)
27
+
28
+ There were Java 8 and JRuby 9.3 regressions in this release, use 0.12.1 instead.
29
+
30
+ ## 0.11.0
31
+
32
+ NOTE: This release aims to adapt the certificate verification logic to be aligned
33
+ with OpenSSL 1.1.1 as a resolution to issues due *DST Root CA X3* expiration, more
34
+ details at: https://letsencrypt.org/docs/dst-root-ca-x3-expiration-september-2021/
35
+
36
+ The port is expected to be superior compared to the simple legacy verification,
37
+ however in case of issues the previous algorithm is still around and can be toggled
38
+ using `JRUBY_OPTS="-J-Djruby.openssl.x509.store.verify=legacy"` system property.
39
+
40
+ * **OpenSSL 1.1.1 cert verification port** (fixes #236) (#239)
41
+ - as a side-effect part of the PR to "allow multiple certs with same SubjectDN"
42
+ (#198) got reverted, this has been causing verification regressions (since 0.10.5)
43
+ for some users (#232) and is expected to be fixed
44
+ * [fix] replace deprecated getPeerCertificateChain (#231)
45
+
1
46
  ## 0.10.7
2
47
 
3
48
  * [feat] upgrade BC library to 1.68
data/Mavenfile CHANGED
@@ -45,15 +45,18 @@ plugin( 'org.codehaus.mojo:build-helper-maven-plugin', '1.9' ) do
45
45
  execute_goal 'add-source', :phase => 'process-classes', :sources => [ gen_sources ]
46
46
  end
47
47
 
48
- plugin( :compiler, '3.1',
49
- :source => '1.8', :target => java_target,
50
- :encoding => 'UTF-8', :debug => true,
51
- :showWarnings => true, :showDeprecation => true,
52
- :excludes => [ 'module-info.java' ],
53
- #:jdkToolchain => { :version => '[1.7,11)' },
48
+ compiler_configuration = {
49
+ :source => '1.8', :target => java_target, :release => '8',
50
+ :encoding => 'UTF-8', :debug => true,
51
+ :showWarnings => true, :showDeprecation => true,
52
+ :excludes => [ 'module-info.java' ],
53
+ #:jdkToolchain => { :version => '[1.7,11)' },
54
+ :generatedSourcesDirectory => gen_sources,
55
+ :annotationProcessors => [ 'org.jruby.anno.AnnotationBinder' ]
56
+ }
57
+ compiler_configuration.delete(:release) if ENV_JAVA['java.specification.version'] == '1.8'
54
58
 
55
- :generatedSourcesDirectory => gen_sources,
56
- :annotationProcessors => [ 'org.jruby.anno.AnnotationBinder' ]) do
59
+ plugin( :compiler, '3.9.0', compiler_configuration) do
57
60
 
58
61
  #execute_goal :compile, :id => 'annotation-binder', :phase => 'compile',
59
62
  # :generatedSourcesDirectory => gen_sources, #:outputDirectory => gen_sources,
@@ -69,14 +72,6 @@ plugin( :compiler, '3.1',
69
72
  :compilerArgs => [ '', '-XDignore.symbol.file=true' ]
70
73
  end
71
74
 
72
- profile 'module-info' do
73
- activation { jdk '[9,)' }
74
- plugin :compiler, '3.8.1',
75
- :source => '9', :target => java_target,
76
- :release => '9',
77
- :includes => [ 'module-info.java' ]
78
- end
79
-
80
75
  plugin :clean do
81
76
  execute_goals( 'clean', :id => 'default-clean', :phase => 'clean',
82
77
  'filesets' => [
@@ -87,18 +82,18 @@ plugin :clean do
87
82
  'failOnError' => 'false' )
88
83
  end
89
84
 
90
- jar 'org.jruby:jruby-core', '1.7.20', :scope => :provided
85
+ jar 'org.jruby:jruby-core', '9.1.11.0', :scope => :provided
86
+ # for invoker generated classes we need to add javax.annotation when on Java > 8
87
+ jar 'javax.annotation:javax.annotation-api', '1.3.1', :scope => :compile
91
88
  jar 'junit:junit', '[4.13.1,)', :scope => :test
92
89
 
93
- # 9.1.17.0 is Java 7 compatible (till supporting JRuby 1.7)
94
90
  # NOTE: to build on Java 11 - installing gems fails (due old jossl) with:
95
91
  # load error: jopenssl/load -- java.lang.StringIndexOutOfBoundsException
96
- MVN_JRUBY_VERSION = ENV_JAVA['java.version'].to_i >= 9 ? '9.2.9.0' : '9.1.17.0'
92
+ MVN_JRUBY_VERSION = ENV_JAVA['java.version'].to_i >= 9 ? '9.2.19.0' : '9.1.17.0'
97
93
 
98
94
  jruby_plugin! :gem do
99
95
  # when installing dependent gems we want to use the built in openssl not the one from this lib directory
100
- # we compile against jruby-core-1.7.20 and want to keep this out of the plugin execution here
101
- execute_goal :id => 'default-initialize', :addProjectClasspath => false, :libDirectory => 'something-which-does-not-exists'
96
+ execute_goal :id => 'default-package', :addProjectClasspath => false, :libDirectory => 'something-which-does-not-exists'
102
97
  execute_goals :id => 'default-push', :skip => true
103
98
  end
104
99
 
@@ -107,12 +102,12 @@ plugin :deploy, '2.8.1' do
107
102
  execute_goals( :deploy, :skip => false )
108
103
  end
109
104
 
110
- supported_bc_versions = %w{ 1.58 1.59 1.60 1.61 1.62 1.63 1.64 1.65 }
105
+ supported_bc_versions = %w{ 1.60 1.61 1.62 1.63 1.64 1.65 1.66 1.67 1.68 }
111
106
 
112
107
  default_bc_version = File.read File.expand_path('lib/jopenssl/version.rb', File.dirname(__FILE__))
113
108
  default_bc_version = default_bc_version[/BOUNCY_CASTLE_VERSION\s?=\s?'(.*?)'/, 1]
114
109
 
115
- properties( 'jruby.plugins.version' => '1.1.8',
110
+ properties( 'jruby.plugins.version' => '2.0.1', # 2.0.1
116
111
  'jruby.switches' => '-W0', # https://github.com/torquebox/jruby-maven-plugins/issues/94
117
112
  'bc.versions' => default_bc_version,
118
113
  'invoker.test' => '${bc.versions}',
@@ -151,8 +146,8 @@ invoker_run_options = {
151
146
  'runit.dir' => '${runit.dir}' }
152
147
  }
153
148
 
154
- jruby_9_K_versions = %w{ 9.0.5.0 9.1.2.0 9.1.8.0 9.1.12.0 9.1.16.0 9.1.17.0 }
155
- jruby_9_K_versions += %w{ 9.2.0.0 9.2.5.0 9.2.6.0 9.2.7.0 9.2.8.0 9.2.9.0 }
149
+ jruby_9_K_versions = %w{ 9.1.2.0 9.1.8.0 9.1.12.0 9.1.16.0 9.1.17.0 }
150
+ jruby_9_K_versions += %w{ 9.2.0.0 9.2.5.0 9.2.10.0 9.2.17.0 9.2.19.0 }
156
151
 
157
152
  jruby_9_K_versions.each { |version|
158
153
  profile :id => "test-#{version}" do
data/README.md CHANGED
@@ -24,6 +24,9 @@ the JRuby [mailing list][1] or the [bug tracker][2].
24
24
  | ~>0.9.18 | 1.6.8-9.1.x | Java 6-8 | 1.50-1.55 |
25
25
  | 0.10.0 | 1.7.20-9.2.x | Java 7-10 | 1.55-1.59 |
26
26
  | 0.10.3 | 1.7.20-9.2.x | Java 7-11 | 1.56-1.62 |
27
+ | ~>0.10.5 | 1.7.20-9.3.x | Java 7-11 | 1.60-1.68 |
28
+ | ~>0.11.x | 9.0.x-9.3.x | Java 7-11 | 1.62-1.68 |
29
+ | ~>0.12.x | 9.1.x-9.3.x | Java 8-15 | 1.65-1.68 |
27
30
 
28
31
  NOTE: backwards JRuby compatibility was not handled for versions <= **0.9.6**
29
32
 
data/Rakefile CHANGED
@@ -1,40 +1,27 @@
1
1
  #-*- mode: ruby -*-
2
2
 
3
- begin
4
- require 'ruby-maven'
5
- rescue LoadError
6
- warn "ruby-maven not available - some tasks will not work " <<
7
- "either `gem install ruby-maven' or use mvn instead of rake"
8
- desc "Package jopenssl.jar with the compiled classes"
9
- task :jar do
10
- sh "mvn prepare-package -Dmaven.test.skip=true"
11
- end
12
- namespace :jar do
13
- desc "Package jopenssl.jar file (and dependendent jars)"
14
- task :all do
15
- sh "mvn package -Dmaven.test.skip=true"
16
- end
17
- end
18
- else
19
- #Rake::Task[:jar].clear rescue nil
20
- desc "Package jopenssl.jar with the compiled classes"
21
- task :jar do
22
- RubyMaven.exec( 'prepare-package -Dmaven.test.skip=true' )
23
- end
24
- namespace :jar do
25
- desc "Package jopenssl.jar file (and dependendent jars)"
26
- task :all do
27
- RubyMaven.exec( 'package -Dmaven.test.skip=true' )
28
- end
29
- end
30
- task :test_prepare do
31
- RubyMaven.exec( 'prepare-package -Dmaven.test.skip=true' )
32
- RubyMaven.exec( 'test-compile' ) # separate step due -Dmaven.test.skip=true
3
+ #Rake::Task[:jar].clear rescue nil
4
+ desc "Package jopenssl.jar with the compiled classes"
5
+ task :jar do
6
+ sh( './mvnw prepare-package -Dmaven.test.skip=true' )
7
+ end
8
+ namespace :jar do
9
+ desc "Package jopenssl.jar file (and dependendent jars)"
10
+ task :all do
11
+ sh( './mvnw package -Dmaven.test.skip=true' )
33
12
  end
34
13
  end
14
+ task :test_prepare do
15
+ sh( './mvnw prepare-package -Dmaven.test.skip=true' )
16
+ sh( './mvnw test-compile' ) # separate step due -Dmaven.test.skip=true
17
+ end
18
+
19
+ task :clean do
20
+ sh( './mvnw clean' )
21
+ end
35
22
 
36
23
  task :build do
37
- RubyMaven.exec('package -Dmaven.test.skip')
24
+ sh( './mvnw clean package -Dmaven.test.skip=true' )
38
25
  end
39
26
 
40
27
  task :default => :build
@@ -55,16 +42,15 @@ task :test => 'lib/jopenssl.jar'
55
42
  namespace :integration do
56
43
  it_path = File.expand_path('../src/test/integration', __FILE__)
57
44
  task :install do
58
- Dir.chdir(it_path) do
59
- ruby "-S bundle install --gemfile '#{it_path}/Gemfile'"
60
- end
45
+ ruby "-C #{it_path} -S bundle install"
61
46
  end
62
47
  # desc "Run IT tests"
63
48
  task :test => 'lib/jopenssl.jar' do
64
49
  unless File.exist?(File.join(it_path, 'Gemfile.lock'))
65
50
  raise "bundle not installed, run `rake integration:install'"
66
51
  end
67
- loader = "ARGV.each { |f| require f }" ; lib = [ 'lib', it_path ]
52
+ loader = "ARGV.each { |f| require f }"
53
+ lib = [ File.expand_path('../lib', __FILE__), it_path ]
68
54
  test_files = FileList['src/test/integration/*_test.rb'].map { |path| path.sub('src/test/integration/', '') }
69
55
  ruby "-I#{lib.join(':')} -C src/test/integration -e \"#{loader}\" #{test_files.map { |f| "\"#{f}\"" }.join(' ')}"
70
56
  end
data/lib/jopenssl/load.rb CHANGED
@@ -2,20 +2,22 @@ warn 'Loading jruby-openssl gem in a non-JRuby interpreter' unless defined? JRUB
2
2
 
3
3
  require 'jopenssl/version'
4
4
 
5
- warn "JRuby #{JRUBY_VERSION} is not supported by jruby-openssl #{JOpenSSL::VERSION}" if JRUBY_VERSION < '1.7.20'
6
-
7
5
  # NOTE: assuming user does pull in BC .jars from somewhere else on the CP
8
6
  unless ENV_JAVA['jruby.openssl.load.jars'].eql?('false')
9
7
  version = JOpenSSL::BOUNCY_CASTLE_VERSION
10
- bc_jars = nil
11
8
  begin
12
9
  require 'jar-dependencies'
13
10
  # if we have jar-dependencies we let it track the jars
14
- require_jar( 'org.bouncycastle', 'bcprov-jdk15on', version )
15
- require_jar( 'org.bouncycastle', 'bcpkix-jdk15on', version )
16
- require_jar( 'org.bouncycastle', 'bctls-jdk15on', version )
11
+ require_jar 'org.bouncycastle', 'bcprov-jdk15on', version
12
+ require_jar 'org.bouncycastle', 'bcpkix-jdk15on', version
13
+ require_jar 'org.bouncycastle', 'bctls-jdk15on', version
14
+ begin # bcutil got extracted from bcprov in BC 1.69
15
+ require_jar 'org.bouncycastle', 'bcutil-jdk15to18', version
16
+ rescue LoadError, RuntimeError
17
+ # continue without loading the jar - assume we got BC < 1.69
18
+ end
17
19
  bc_jars = true
18
- rescue LoadError
20
+ rescue LoadError, RuntimeError
19
21
  bc_jars = false
20
22
  end
21
23
  unless bc_jars
@@ -34,17 +36,50 @@ else; require 'jruby'
34
36
  end
35
37
 
36
38
  if RUBY_VERSION > '2.3'
37
- load 'jopenssl23/openssl.rb'
38
39
  load 'jopenssl/_compat23.rb'
39
- elsif RUBY_VERSION > '2.2'
40
- load 'jopenssl22/openssl.rb'
41
- elsif RUBY_VERSION > '2.1'
42
- load 'jopenssl21/openssl.rb'
43
- else
44
- load 'jopenssl19/openssl.rb'
45
40
  end
46
41
 
42
+ # NOTE: content bellow should live in *lib/openssl.rb* but due RubyGems/Bundler
43
+ # `autoload :OpenSSL` this will cause issues if an older version (0.11) is the
44
+ # default gem under JRuby 9.2 (which on auto-load does not trigger a dynamic
45
+ # require - this is only fixed in JRuby 9.3)
46
+
47
47
  module OpenSSL
48
48
  autoload :Config, 'openssl/config' unless const_defined?(:Config, false)
49
49
  autoload :PKCS12, 'openssl/pkcs12'
50
50
  end
51
+
52
+ =begin
53
+ = Info
54
+ 'OpenSSL for Ruby 2' project
55
+ Copyright (C) 2002 Michal Rokos <m.rokos@sh.cvut.cz>
56
+ All rights reserved.
57
+
58
+ = Licence
59
+ This program is licensed under the same licence as Ruby.
60
+ (See the file 'LICENCE'.)
61
+ =end
62
+
63
+ require 'openssl/bn'
64
+ require 'openssl/pkey'
65
+ require 'openssl/cipher'
66
+ #require 'openssl/config' if OpenSSL.const_defined?(:Config, false)
67
+ require 'openssl/digest'
68
+ require 'openssl/hmac'
69
+ require 'openssl/x509'
70
+ require 'openssl/ssl'
71
+ require 'openssl/pkcs5'
72
+
73
+ module OpenSSL
74
+ # call-seq:
75
+ # OpenSSL.secure_compare(string, string) -> boolean
76
+ #
77
+ # Constant time memory comparison. Inputs are hashed using SHA-256 to mask
78
+ # the length of the secret. Returns +true+ if the strings are identical,
79
+ # +false+ otherwise.
80
+ def self.secure_compare(a, b)
81
+ hashed_a = OpenSSL::Digest.digest('SHA256', a)
82
+ hashed_b = OpenSSL::Digest.digest('SHA256', b)
83
+ OpenSSL.fixed_length_secure_compare(hashed_a, hashed_b) && a == b
84
+ end
85
+ end
@@ -1,9 +1,10 @@
1
1
  module JOpenSSL
2
- VERSION = '0.11.0.cr1'
2
+ VERSION = '0.12.2'
3
3
  BOUNCY_CASTLE_VERSION = '1.68'
4
4
  end
5
5
 
6
6
  Object.class_eval do
7
7
  Jopenssl = JOpenSSL
8
8
  private_constant :Jopenssl if respond_to?(:private_constant)
9
+ deprecate_constant :Jopenssl if respond_to?(:deprecate_constant)
9
10
  end
data/lib/jopenssl.jar CHANGED
Binary file
data/lib/openssl/bn.rb CHANGED
@@ -1,9 +1,40 @@
1
- if RUBY_VERSION > '2.3'
2
- load "jopenssl23/openssl/#{File.basename(__FILE__)}"
3
- elsif RUBY_VERSION > '2.2'
4
- load "jopenssl22/openssl/#{File.basename(__FILE__)}"
5
- elsif RUBY_VERSION > '2.1'
6
- load "jopenssl21/openssl/#{File.basename(__FILE__)}"
7
- else
8
- load "jopenssl19/openssl/#{File.basename(__FILE__)}"
9
- end
1
+ # frozen_string_literal: true
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 <m.rokos@sh.cvut.cz>
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
+ include Comparable
19
+
20
+ def pretty_print(q)
21
+ q.object_group(self) {
22
+ q.text ' '
23
+ q.text to_i.to_s
24
+ }
25
+ end
26
+ end # BN
27
+ end # OpenSSL
28
+
29
+ ##
30
+ #--
31
+ # Add double dispatch to Integer
32
+ #++
33
+ class Integer
34
+ # Casts an Integer as an OpenSSL::BN
35
+ #
36
+ # See `man bn` for more info.
37
+ def to_bn
38
+ OpenSSL::BN::new(self)
39
+ end
40
+ end # Integer