redcar 0.3.2dev → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +49 -2
- data/README.md +2 -7
- data/ROADMAP.md +8 -9
- data/Rakefile +29 -44
- data/bin/redcar +11 -2
- data/lib/openssl/History.txt +75 -0
- data/lib/openssl/License.txt +30 -0
- data/lib/openssl/Manifest.txt +99 -0
- data/lib/openssl/README.txt +24 -0
- data/lib/openssl/Rakefile +71 -0
- data/lib/openssl/build.properties.SAMPLE +7 -0
- data/lib/openssl/build.xml +57 -0
- data/lib/openssl/lib/jopenssl/version.rb +5 -0
- data/lib/openssl/lib/openssl.rb +24 -0
- data/lib/openssl/lib/openssl/bn.rb +33 -0
- data/lib/openssl/lib/openssl/buffering.rb +239 -0
- data/lib/openssl/lib/openssl/cipher.rb +56 -0
- data/lib/openssl/lib/openssl/digest.rb +46 -0
- data/lib/openssl/lib/openssl/dummy.rb +34 -0
- data/lib/openssl/lib/openssl/dummyssl.rb +13 -0
- data/lib/openssl/lib/openssl/ssl.rb +135 -0
- data/lib/openssl/lib/openssl/x509.rb +154 -0
- data/lib/openssl/mocha/COPYING +3 -0
- data/lib/openssl/mocha/MIT-LICENSE +7 -0
- data/lib/openssl/mocha/README +35 -0
- data/lib/openssl/mocha/RELEASE +171 -0
- data/lib/openssl/mocha/Rakefile +147 -0
- data/lib/openssl/mocha/TODO +48 -0
- data/lib/openssl/mocha/examples/misc.rb +36 -0
- data/lib/openssl/mocha/examples/mocha.rb +26 -0
- data/lib/openssl/mocha/examples/stubba.rb +65 -0
- data/lib/openssl/mocha/init.rb +3 -0
- data/lib/openssl/mocha/lib/mocha.rb +19 -0
- data/lib/openssl/mocha/lib/mocha/any_instance_method.rb +35 -0
- data/lib/openssl/mocha/lib/mocha/auto_verify.rb +111 -0
- data/lib/openssl/mocha/lib/mocha/central.rb +35 -0
- data/lib/openssl/mocha/lib/mocha/class_method.rb +62 -0
- data/lib/openssl/mocha/lib/mocha/deprecation.rb +22 -0
- data/lib/openssl/mocha/lib/mocha/exception_raiser.rb +17 -0
- data/lib/openssl/mocha/lib/mocha/expectation.rb +382 -0
- data/lib/openssl/mocha/lib/mocha/expectation_error.rb +6 -0
- data/lib/openssl/mocha/lib/mocha/expectation_list.rb +45 -0
- data/lib/openssl/mocha/lib/mocha/infinite_range.rb +25 -0
- data/lib/openssl/mocha/lib/mocha/inspect.rb +39 -0
- data/lib/openssl/mocha/lib/mocha/instance_method.rb +8 -0
- data/lib/openssl/mocha/lib/mocha/is_a.rb +9 -0
- data/lib/openssl/mocha/lib/mocha/metaclass.rb +7 -0
- data/lib/openssl/mocha/lib/mocha/missing_expectation.rb +27 -0
- data/lib/openssl/mocha/lib/mocha/mock.rb +200 -0
- data/lib/openssl/mocha/lib/mocha/multiple_yields.rb +20 -0
- data/lib/openssl/mocha/lib/mocha/no_yields.rb +11 -0
- data/lib/openssl/mocha/lib/mocha/object.rb +110 -0
- data/lib/openssl/mocha/lib/mocha/parameter_matchers.rb +9 -0
- data/lib/openssl/mocha/lib/mocha/parameter_matchers/all_of.rb +39 -0
- data/lib/openssl/mocha/lib/mocha/parameter_matchers/any_of.rb +44 -0
- data/lib/openssl/mocha/lib/mocha/parameter_matchers/anything.rb +30 -0
- data/lib/openssl/mocha/lib/mocha/parameter_matchers/has_entry.rb +39 -0
- data/lib/openssl/mocha/lib/mocha/parameter_matchers/has_key.rb +39 -0
- data/lib/openssl/mocha/lib/mocha/parameter_matchers/has_value.rb +39 -0
- data/lib/openssl/mocha/lib/mocha/parameter_matchers/includes.rb +37 -0
- data/lib/openssl/mocha/lib/mocha/parameter_matchers/instance_of.rb +39 -0
- data/lib/openssl/mocha/lib/mocha/parameter_matchers/kind_of.rb +39 -0
- data/lib/openssl/mocha/lib/mocha/pretty_parameters.rb +28 -0
- data/lib/openssl/mocha/lib/mocha/return_values.rb +31 -0
- data/lib/openssl/mocha/lib/mocha/setup_and_teardown.rb +23 -0
- data/lib/openssl/mocha/lib/mocha/single_return_value.rb +24 -0
- data/lib/openssl/mocha/lib/mocha/single_yield.rb +18 -0
- data/lib/openssl/mocha/lib/mocha/standalone.rb +32 -0
- data/lib/openssl/mocha/lib/mocha/stub.rb +18 -0
- data/lib/openssl/mocha/lib/mocha/test_case_adapter.rb +49 -0
- data/lib/openssl/mocha/lib/mocha/yield_parameters.rb +31 -0
- data/lib/openssl/mocha/lib/mocha_standalone.rb +2 -0
- data/lib/openssl/mocha/lib/stubba.rb +2 -0
- data/lib/openssl/mocha/templates/html_with_google_analytics.rb +742 -0
- data/lib/openssl/mocha/test/acceptance/expected_invocation_count_acceptance_test.rb +187 -0
- data/lib/openssl/mocha/test/acceptance/mocha_acceptance_test.rb +98 -0
- data/lib/openssl/mocha/test/acceptance/mocked_methods_dispatch_acceptance_test.rb +71 -0
- data/lib/openssl/mocha/test/acceptance/parameter_matcher_acceptance_test.rb +63 -0
- data/lib/openssl/mocha/test/acceptance/standalone_acceptance_test.rb +131 -0
- data/lib/openssl/mocha/test/acceptance/stubba_acceptance_test.rb +102 -0
- data/lib/openssl/mocha/test/active_record_test_case.rb +36 -0
- data/lib/openssl/mocha/test/deprecation_disabler.rb +15 -0
- data/lib/openssl/mocha/test/execution_point.rb +34 -0
- data/lib/openssl/mocha/test/integration/mocha_test_result_integration_test.rb +105 -0
- data/lib/openssl/mocha/test/integration/stubba_integration_test.rb +89 -0
- data/lib/openssl/mocha/test/integration/stubba_test_result_integration_test.rb +85 -0
- data/lib/openssl/mocha/test/method_definer.rb +18 -0
- data/lib/openssl/mocha/test/test_helper.rb +12 -0
- data/lib/openssl/mocha/test/test_runner.rb +31 -0
- data/lib/openssl/mocha/test/unit/any_instance_method_test.rb +124 -0
- data/lib/openssl/mocha/test/unit/array_inspect_test.rb +16 -0
- data/lib/openssl/mocha/test/unit/auto_verify_test.rb +122 -0
- data/lib/openssl/mocha/test/unit/central_test.rb +124 -0
- data/lib/openssl/mocha/test/unit/class_method_test.rb +196 -0
- data/lib/openssl/mocha/test/unit/date_time_inspect_test.rb +21 -0
- data/lib/openssl/mocha/test/unit/expectation_list_test.rb +69 -0
- data/lib/openssl/mocha/test/unit/expectation_raiser_test.rb +28 -0
- data/lib/openssl/mocha/test/unit/expectation_test.rb +399 -0
- data/lib/openssl/mocha/test/unit/hash_inspect_test.rb +16 -0
- data/lib/openssl/mocha/test/unit/infinite_range_test.rb +53 -0
- data/lib/openssl/mocha/test/unit/metaclass_test.rb +22 -0
- data/lib/openssl/mocha/test/unit/missing_expectation_test.rb +45 -0
- data/lib/openssl/mocha/test/unit/mock_test.rb +316 -0
- data/lib/openssl/mocha/test/unit/multiple_yields_test.rb +18 -0
- data/lib/openssl/mocha/test/unit/no_yield_test.rb +18 -0
- data/lib/openssl/mocha/test/unit/object_inspect_test.rb +35 -0
- data/lib/openssl/mocha/test/unit/object_test.rb +165 -0
- data/lib/openssl/mocha/test/unit/parameter_matchers/all_of_test.rb +26 -0
- data/lib/openssl/mocha/test/unit/parameter_matchers/any_of_test.rb +26 -0
- data/lib/openssl/mocha/test/unit/parameter_matchers/anything_test.rb +21 -0
- data/lib/openssl/mocha/test/unit/parameter_matchers/has_entry_test.rb +25 -0
- data/lib/openssl/mocha/test/unit/parameter_matchers/has_key_test.rb +25 -0
- data/lib/openssl/mocha/test/unit/parameter_matchers/has_value_test.rb +25 -0
- data/lib/openssl/mocha/test/unit/parameter_matchers/includes_test.rb +25 -0
- data/lib/openssl/mocha/test/unit/parameter_matchers/instance_of_test.rb +25 -0
- data/lib/openssl/mocha/test/unit/parameter_matchers/kind_of_test.rb +25 -0
- data/lib/openssl/mocha/test/unit/parameter_matchers/stub_matcher.rb +22 -0
- data/lib/openssl/mocha/test/unit/pretty_parameters_test.rb +32 -0
- data/lib/openssl/mocha/test/unit/return_values_test.rb +63 -0
- data/lib/openssl/mocha/test/unit/setup_and_teardown_test.rb +76 -0
- data/lib/openssl/mocha/test/unit/single_return_value_test.rb +33 -0
- data/lib/openssl/mocha/test/unit/single_yield_test.rb +18 -0
- data/lib/openssl/mocha/test/unit/string_inspect_test.rb +11 -0
- data/lib/openssl/mocha/test/unit/stub_test.rb +24 -0
- data/lib/openssl/mocha/test/unit/yield_parameters_test.rb +93 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/FOLDERS +53 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/LICENSE +340 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/README +117 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/bin/coderay +77 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/bin/coderay_stylesheet +4 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay.rb +319 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/duo.rb +29 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoder.rb +173 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/_map.rb +8 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/count.rb +21 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/debug.rb +46 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/div.rb +20 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/html.rb +260 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/html/classes.rb +77 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/html/css.rb +65 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/html/numerization.rb +122 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/html/output.rb +195 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/null.rb +26 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/page.rb +21 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/span.rb +20 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/statistic.rb +81 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/text.rb +33 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/tokens.rb +44 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/xml.rb +71 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/yaml.rb +22 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/helpers/file_type.rb +182 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/helpers/gzip_simple.rb +122 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/helpers/plugin.rb +326 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/helpers/word_list.rb +119 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/scanner.rb +238 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/scanners/_map.rb +15 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/scanners/c.rb +163 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/scanners/debug.rb +60 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/scanners/delphi.rb +149 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/scanners/html.rb +177 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/scanners/nitro_xhtml.rb +133 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/scanners/plaintext.rb +16 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/scanners/rhtml.rb +73 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/scanners/ruby.rb +367 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/scanners/ruby/patterns.rb +230 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/scanners/xml.rb +18 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/style.rb +20 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/styles/_map.rb +7 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/styles/cycnus.rb +125 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/styles/murphy.rb +119 -0
- data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/tokens.rb +368 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/CHANGES +295 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/MIT-LICENSE +21 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/README +129 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/Rakefile +152 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project.rb +19 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/open_uri.rb +22 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/pathname.rb +36 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/string.rb +5 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/http/multipart.rb +32 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/patois.rb +1 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/patois/parser.rb +99 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project.rb +4 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project/base.rb +9 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project/codehaus.rb +1 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project/codehaus/codehaus_project_svn.rb +31 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project/trac.rb +1 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project/trac/trac_project.rb +54 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project/xforge.rb +5 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project/xforge/ruby_forge.rb +47 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project/xforge/session.rb +177 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project/xforge/source_forge.rb +50 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project/xforge/xfile.rb +45 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project/xforge/xforge_base.rb +85 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project_analyzer.rb +36 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/release/freshmeat.rb +267 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/release/raa.rb +572 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/scm_web.rb +2 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/scm_web/browser.rb +112 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/scm_web/pathname.rb +89 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker.rb +6 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker/base.rb +24 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker/digit_issues.rb +34 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker/issue.rb +57 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker/jira.rb +2 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker/jira/jira_issues.rb +35 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker/jira/jira_tracker.rb +149 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker/trac.rb +1 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker/trac/trac_tracker.rb +33 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker/xforge.rb +3 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker/xforge/ruby_forge_tracker.rb +17 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker/xforge/source_forge_tracker.rb +17 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker/xforge/xforge_tracker.rb +191 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/version_parser.rb +52 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/rake/contrib/xforge.rb +3 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/rake/contrib/xforge/base.rb +64 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/rake/contrib/xforge/news_publisher.rb +97 -0
- data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/rake/contrib/xforge/release.rb +134 -0
- data/lib/openssl/nbproject/genfiles.properties +5 -0
- data/lib/openssl/nbproject/jdk.xml +157 -0
- data/lib/openssl/nbproject/nbjdk.properties +1 -0
- data/lib/openssl/nbproject/nbjdk.xml +16 -0
- data/lib/openssl/nbproject/project.xml +117 -0
- data/lib/openssl/src/java/JopensslService.java +41 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/ASN1.java +930 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/Attribute.java +132 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/BN.java +769 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/BouncyCastlePEMHandler.java +69 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/Callable.java +10 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/Cipher.java +661 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/CipherStrings.java +1827 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/Config.java +49 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/DefaultPEMHandler.java +44 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/Digest.java +207 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/HMAC.java +183 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/NetscapeSPKI.java +212 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/OpenSSLImpl.java +341 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/OpenSSLReal.java +113 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/PEMHandler.java +40 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/PKCS10CertificationRequestExt.java +159 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/PKCS7.java +642 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/PKey.java +154 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/PKeyDH.java +401 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/PKeyDSA.java +419 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/PKeyRSA.java +762 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/Random.java +103 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/Request.java +336 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/SSL.java +71 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/SSLContext.java +358 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/SSLSocket.java +561 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/SimpleSecretKey.java +53 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/Utils.java +60 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/X509.java +108 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/X509CRL.java +446 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/X509Cert.java +520 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/X509Extensions.java +751 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/X509Name.java +405 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/X509Revoked.java +111 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/X509Store.java +282 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/X509StoreCtx.java +206 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/ASN1Registry.java +5135 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/Attribute.java +79 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/BIO.java +345 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/BIOFilter.java +38 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/Base64BIOFilter.java +84 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/CipherBIOFilter.java +157 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/Digest.java +126 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/EVP.java +136 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/EncContent.java +178 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/Encrypt.java +77 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/Envelope.java +169 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/IssuerAndSerial.java +35 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/MemBIO.java +117 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/MessageDigestBIOFilter.java +76 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/Mime.java +245 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/MimeHeader.java +103 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/MimeParam.java +69 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/NotVerifiedPKCS7Exception.java +38 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/NullSinkBIO.java +52 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/PKCS7.java +1276 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/PKCS7Data.java +168 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/PKCS7DataData.java +88 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/PKCS7DataDigest.java +64 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/PKCS7DataEncrypted.java +61 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/PKCS7DataEnveloped.java +85 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/PKCS7DataSigned.java +127 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/PKCS7DataSignedAndEnveloped.java +91 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/PKCS7Exception.java +68 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/RecipInfo.java +244 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/SMIME.java +281 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/SignEnvelope.java +202 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/Signed.java +345 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/SignerInfoWithPkey.java +365 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/TypeDiscriminating.java +34 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/impl/utils/Base64.java +1809 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/util/Base64Coder.java +103 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/CRL.java +59 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/Certificate.java +57 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/CertificateFile.java +46 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/CertificateHashDir.java +46 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/Function0.java +43 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/Function1.java +43 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/Function2.java +43 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/Function3.java +43 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/Function4.java +43 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/Function5.java +43 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/Lookup.java +560 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/LookupMethod.java +84 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/Name.java +85 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/PEMInputOutput.java +1210 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/PKey.java +41 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/PolicyTree.java +36 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/Purpose.java +475 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/Store.java +377 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/StoreContext.java +1356 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/Trust.java +279 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/VerifyParameter.java +324 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/X509Aux.java +43 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/X509AuxCertificate.java +170 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/X509Error.java +70 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/X509Object.java +88 -0
- data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/X509Utils.java +541 -0
- data/lib/openssl/test/cert_with_ec_pk.cer +27 -0
- data/lib/openssl/test/fixture/ca_path/72fa7371.0 +19 -0
- data/lib/openssl/test/fixture/ca_path/verisign.pem +19 -0
- data/lib/openssl/test/fixture/cacert.pem +23 -0
- data/lib/openssl/test/fixture/cert_localhost.pem +19 -0
- data/lib/openssl/test/fixture/common.pem +48 -0
- data/lib/openssl/test/fixture/localhost_keypair.pem +18 -0
- data/lib/openssl/test/fixture/max.pem +29 -0
- data/lib/openssl/test/fixture/purpose/b70a5bc1.0 +24 -0
- data/lib/openssl/test/fixture/purpose/ca/PASSWD_OF_CA_KEY_IS_1234 +0 -0
- data/lib/openssl/test/fixture/purpose/ca/ca_config.rb +37 -0
- data/lib/openssl/test/fixture/purpose/ca/cacert.pem +24 -0
- data/lib/openssl/test/fixture/purpose/ca/newcerts/2_cert.pem +19 -0
- data/lib/openssl/test/fixture/purpose/ca/newcerts/3_cert.pem +19 -0
- data/lib/openssl/test/fixture/purpose/ca/private/cakeypair.pem +30 -0
- data/lib/openssl/test/fixture/purpose/ca/serial +1 -0
- data/lib/openssl/test/fixture/purpose/cacert.pem +24 -0
- data/lib/openssl/test/fixture/purpose/scripts/gen_cert.rb +127 -0
- data/lib/openssl/test/fixture/purpose/scripts/gen_csr.rb +50 -0
- data/lib/openssl/test/fixture/purpose/scripts/init_ca.rb +66 -0
- data/lib/openssl/test/fixture/purpose/sslclient.pem +19 -0
- data/lib/openssl/test/fixture/purpose/sslclient/csr.pem +10 -0
- data/lib/openssl/test/fixture/purpose/sslclient/keypair.pem +15 -0
- data/lib/openssl/test/fixture/purpose/sslclient/sslclient.pem +19 -0
- data/lib/openssl/test/fixture/purpose/sslserver.pem +19 -0
- data/lib/openssl/test/fixture/purpose/sslserver/csr.pem +10 -0
- data/lib/openssl/test/fixture/purpose/sslserver/keypair.pem +15 -0
- data/lib/openssl/test/fixture/purpose/sslserver/sslserver.pem +19 -0
- data/lib/openssl/test/fixture/verisign.pem +19 -0
- data/lib/openssl/test/fixture/verisign_c3.pem +14 -0
- data/lib/openssl/test/openssl/ssl_server.rb +99 -0
- data/lib/openssl/test/openssl/test_asn1.rb +199 -0
- data/lib/openssl/test/openssl/test_cipher.rb +196 -0
- data/lib/openssl/test/openssl/test_digest.rb +88 -0
- data/lib/openssl/test/openssl/test_hmac.rb +44 -0
- data/lib/openssl/test/openssl/test_ns_spki.rb +69 -0
- data/lib/openssl/test/openssl/test_pair.rb +149 -0
- data/lib/openssl/test/openssl/test_pkcs7.rb +160 -0
- data/lib/openssl/test/openssl/test_pkey_rsa.rb +49 -0
- data/lib/openssl/test/openssl/test_ssl.rb +413 -0
- data/lib/openssl/test/openssl/test_x509cert.rb +236 -0
- data/lib/openssl/test/openssl/test_x509crl.rb +234 -0
- data/lib/openssl/test/openssl/test_x509ext.rb +95 -0
- data/lib/openssl/test/openssl/test_x509name.rb +281 -0
- data/lib/openssl/test/openssl/test_x509req.rb +178 -0
- data/lib/openssl/test/openssl/test_x509store.rb +245 -0
- data/lib/openssl/test/openssl/utils.rb +135 -0
- data/lib/openssl/test/pkcs7_mime_enveloped.message +19 -0
- data/lib/openssl/test/pkcs7_mime_signed.message +30 -0
- data/lib/openssl/test/pkcs7_multipart_signed.message +45 -0
- data/lib/openssl/test/ref/compile.rb +8 -0
- data/lib/openssl/test/ref/pkcs1 +0 -0
- data/lib/openssl/test/ref/pkcs1.c +21 -0
- data/lib/openssl/test/test_cipher.rb +95 -0
- data/lib/openssl/test/test_integration.rb +139 -0
- data/lib/openssl/test/test_java.rb +98 -0
- data/lib/openssl/test/test_java_attribute.rb +25 -0
- data/lib/openssl/test/test_java_bio.rb +42 -0
- data/lib/openssl/test/test_java_mime.rb +173 -0
- data/lib/openssl/test/test_java_pkcs7.rb +769 -0
- data/lib/openssl/test/test_java_smime.rb +177 -0
- data/lib/openssl/test/test_openssl.rb +34 -0
- data/lib/openssl/test/test_openssl_x509.rb +34 -0
- data/lib/openssl/test/test_parse_certificate.rb +20 -0
- data/lib/openssl/test/test_pkey.rb +46 -0
- data/lib/openssl/test/test_x509store.rb +155 -0
- data/lib/openssl/test/ut_eof.rb +128 -0
- data/lib/redcar.rb +134 -8
- data/lib/redcar/installer.rb +46 -11
- data/lib/redcar/runner.rb +2 -1
- data/lib/redcar/usage.rb +12 -5
- data/lib/redcar_quick_start.rb +37 -0
- data/plugins/application/features/support/env.rb +9 -1
- data/plugins/application/icons/redcar_icon_beta.png +0 -0
- data/plugins/application/lib/application.rb +113 -43
- data/plugins/application/lib/application/clipboard.rb +28 -4
- data/plugins/application/lib/application/command.rb +4 -12
- data/plugins/application/lib/application/command/executor.rb +2 -2
- data/plugins/application/lib/application/keymap.rb +39 -0
- data/plugins/application/lib/application/keymap/builder.rb +19 -0
- data/plugins/application/lib/application/speedbar.rb +33 -24
- data/plugins/application/lib/application/tab.rb +15 -0
- data/plugins/application/lib/application/window.rb +28 -5
- data/plugins/application/spec/application/clipboard_spec.rb +20 -1
- data/plugins/application/spec/application/command/executor_spec.rb +7 -2
- data/plugins/application/spec/application/command_spec.rb +0 -5
- data/plugins/application/spec/application/keymap/builder_spec.rb +17 -0
- data/plugins/application/spec/application/menu_spec.rb +30 -0
- data/plugins/application/spec/application/speedbar_spec.rb +30 -6
- data/plugins/application/spec/application/window_spec.rb +2 -2
- data/plugins/application/spec/spec_helper.rb +1 -1
- data/plugins/application_swt/lib/application_swt.rb +3 -0
- data/plugins/application_swt/lib/application_swt/dialogs/filter_list_dialog_controller.rb +10 -1
- data/plugins/application_swt/lib/application_swt/html_tab.rb +1 -0
- data/plugins/application_swt/lib/application_swt/menu.rb +4 -3
- data/plugins/application_swt/lib/application_swt/menu/binding_translator.rb +12 -4
- data/plugins/application_swt/lib/application_swt/speedbar.rb +105 -19
- data/plugins/application_swt/lib/application_swt/swt_wrapper.rb +2 -0
- data/plugins/application_swt/lib/application_swt/window.rb +55 -23
- data/plugins/application_swt/spec/spec_helper.rb +0 -1
- data/plugins/auto_completer/lib/auto_completer.rb +57 -3
- data/plugins/auto_indenter/lib/auto_indenter.rb +1 -1
- data/plugins/core/lib/core.rb +5 -3
- data/plugins/core/lib/core/interface.rb +73 -0
- data/plugins/core/lib/core/model.rb +2 -0
- data/plugins/core/lib/core/observable.rb +12 -1
- data/plugins/core/lib/core/observable_struct.rb +34 -0
- data/plugins/core/lib/core/plugin/storage.rb +16 -3
- data/plugins/core/lib/core/reentry_helpers.rb +13 -0
- data/plugins/core/spec/core/observable_spec.rb +13 -0
- data/plugins/core/spec/core/storage_spec.rb +18 -0
- data/plugins/core/spec/spec_helper.rb +1 -0
- data/plugins/edit_view/features/cut_and_paste.feature +4 -2
- data/plugins/edit_view/features/soft_tabs.feature +243 -0
- data/plugins/edit_view/features/step_definitions/editing_steps.rb +91 -2
- data/plugins/edit_view/features/step_definitions/tab_steps.rb +1 -1
- data/plugins/edit_view/features/tabs.feature +146 -0
- data/plugins/edit_view/lib/edit_view.rb +197 -8
- data/plugins/edit_view/lib/edit_view/actions/arrow_keys.rb +121 -0
- data/plugins/edit_view/lib/edit_view/actions/deletion.rb +30 -0
- data/plugins/edit_view/lib/edit_view/actions/tab.rb +66 -0
- data/plugins/edit_view/lib/edit_view/command.rb +0 -2
- data/plugins/edit_view/lib/edit_view/document.rb +62 -27
- data/plugins/edit_view/lib/edit_view/document/command.rb +11 -0
- data/plugins/edit_view/lib/edit_view/edit_tab.rb +2 -1
- data/plugins/edit_view/lib/edit_view/info_speedbar.rb +69 -0
- data/plugins/edit_view/lib/edit_view/tab_settings.rb +40 -0
- data/plugins/edit_view/spec/edit_view/document_spec.rb +26 -0
- data/plugins/edit_view/spec/spec_helper.rb +0 -1
- data/plugins/edit_view_swt/lib/edit_view_swt.rb +57 -69
- data/plugins/edit_view_swt/lib/edit_view_swt/document.rb +24 -3
- data/plugins/edit_view_swt/lib/edit_view_swt/edit_tab.rb +23 -6
- data/plugins/edit_view_swt/spec/spec_helper.rb +0 -1
- data/plugins/edit_view_swt/vendor/java-mateview.rb +19 -2
- data/plugins/encryption/encryption.rb +38 -0
- data/plugins/encryption/ezcrypto.rb +652 -0
- data/plugins/encryption/jarmor-1.1.jar +0 -0
- data/plugins/encryption/plugin.rb +9 -0
- data/plugins/execute_current_tab/lib/execute_current_tab.rb +56 -0
- data/plugins/execute_current_tab/plugin.rb +8 -0
- data/plugins/html_view/lib/html_view.rb +16 -11
- data/plugins/plugin_manager_ui/lib/plugin_manager_ui.rb +2 -1
- data/plugins/plugin_manager_ui/views/index.html.erb +22 -4
- data/plugins/project/lib/project.rb +140 -26
- data/plugins/project/lib/project/drb_service.rb +75 -0
- data/plugins/project/lib/project/file_mirror.rb +5 -5
- data/plugins/project/lib/project/find_file_dialog.rb +123 -32
- data/plugins/project/spec/project/file_mirror_spec.rb +10 -1
- data/plugins/project/spec/spec_helper.rb +0 -1
- data/plugins/redcar/plugin.rb +1 -1
- data/plugins/redcar/redcar.rb +204 -109
- data/plugins/redcar/spec/redcar/redcar_spec.rb +70 -0
- data/plugins/redcar/spec/spec_helper.rb +4 -0
- data/plugins/repl/lib/repl.rb +14 -7
- data/plugins/repl/lib/repl/internal_mirror.rb +43 -22
- data/plugins/repl/spec/repl/internal_mirror_spec.rb +34 -7
- data/plugins/repl/spec/spec_helper.rb +0 -1
- data/plugins/tree/spec/spec_helper.rb +0 -1
- data/plugins/tree_view_swt/lib/tree_view_swt.rb +1 -1
- data/textmate/Bundles/RedcarRepl.tmbundle/Syntaxes/InternalRuby.plist +2 -18
- data/textmate/Bundles/asciidoc.tmbundle/Syntaxes/AsciiDoc.tmLanguage +428 -0
- metadata +790 -371
- data/lib/redcar/boot.rb +0 -108
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/***** BEGIN LICENSE BLOCK *****
|
|
2
|
+
* Version: CPL 1.0/GPL 2.0/LGPL 2.1
|
|
3
|
+
*
|
|
4
|
+
* The contents of this file are subject to the Common Public
|
|
5
|
+
* License Version 1.0 (the "License"); you may not use this file
|
|
6
|
+
* except in compliance with the License. You may obtain a copy of
|
|
7
|
+
* the License at http://www.eclipse.org/legal/cpl-v10.html
|
|
8
|
+
*
|
|
9
|
+
* Software distributed under the License is distributed on an "AS
|
|
10
|
+
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
11
|
+
* implied. See the License for the specific language governing
|
|
12
|
+
* rights and limitations under the License.
|
|
13
|
+
*
|
|
14
|
+
* Copyright (C) 2006, 2007 Ola Bini <ola@ologix.com>
|
|
15
|
+
*
|
|
16
|
+
* Alternatively, the contents of this file may be used under the terms of
|
|
17
|
+
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
18
|
+
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
19
|
+
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
20
|
+
* of those above. If you wish to allow use of your version of this file only
|
|
21
|
+
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
22
|
+
* use your version of this file under the terms of the CPL, indicate your
|
|
23
|
+
* decision by deleting the provisions above and replace them with the notice
|
|
24
|
+
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
25
|
+
* the provisions above, a recipient may use your version of this file under
|
|
26
|
+
* the terms of any one of the CPL, the GPL or the LGPL.
|
|
27
|
+
***** END LICENSE BLOCK *****/
|
|
28
|
+
package org.jruby.ext.openssl;
|
|
29
|
+
|
|
30
|
+
import java.security.InvalidKeyException;
|
|
31
|
+
import java.security.NoSuchAlgorithmException;
|
|
32
|
+
import java.security.PrivateKey;
|
|
33
|
+
import java.security.PublicKey;
|
|
34
|
+
import java.security.Signature;
|
|
35
|
+
import java.security.SignatureException;
|
|
36
|
+
|
|
37
|
+
import org.jruby.Ruby;
|
|
38
|
+
import org.jruby.RubyClass;
|
|
39
|
+
import org.jruby.RubyModule;
|
|
40
|
+
import org.jruby.RubyObject;
|
|
41
|
+
import org.jruby.RubyString;
|
|
42
|
+
import org.jruby.anno.JRubyMethod;
|
|
43
|
+
import org.jruby.exceptions.RaiseException;
|
|
44
|
+
import org.jruby.runtime.Block;
|
|
45
|
+
import org.jruby.runtime.ObjectAllocator;
|
|
46
|
+
import org.jruby.runtime.builtin.IRubyObject;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
|
|
50
|
+
*/
|
|
51
|
+
public abstract class PKey extends RubyObject {
|
|
52
|
+
public static void createPKey(Ruby runtime, RubyModule ossl) {
|
|
53
|
+
RubyModule mPKey = ossl.defineModuleUnder("PKey");
|
|
54
|
+
// PKey is abstract
|
|
55
|
+
RubyClass cPKey = mPKey.defineClassUnder("PKey",runtime.getObject(),ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
|
|
56
|
+
RubyClass openSSLError = ossl.getClass("OpenSSLError");
|
|
57
|
+
mPKey.defineClassUnder("PKeyError",openSSLError,openSSLError.getAllocator());
|
|
58
|
+
|
|
59
|
+
cPKey.defineAnnotatedMethods(PKey.class);
|
|
60
|
+
|
|
61
|
+
PKeyRSA.createPKeyRSA(runtime,mPKey);
|
|
62
|
+
PKeyDSA.createPKeyDSA(runtime,mPKey);
|
|
63
|
+
PKeyDH.createPKeyDH(runtime, mPKey, cPKey);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
public static RaiseException newPKeyError(Ruby runtime, String message) {
|
|
67
|
+
return new RaiseException(runtime, ((RubyModule)runtime.getModule("OpenSSL").getConstantAt("PKey")).getClass("PKeyError"), message, true);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
public PKey(Ruby runtime, RubyClass type) {
|
|
71
|
+
super(runtime,type);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@JRubyMethod
|
|
75
|
+
public IRubyObject initialize() {
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
PublicKey getPublicKey() {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
PrivateKey getPrivateKey() {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
String getAlgorithm() {
|
|
88
|
+
return "NONE";
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// FIXME: any compelling reason for abstract method here?
|
|
92
|
+
public abstract IRubyObject to_der() throws Exception;
|
|
93
|
+
|
|
94
|
+
@JRubyMethod
|
|
95
|
+
public IRubyObject sign(IRubyObject digest, IRubyObject data) throws Exception {
|
|
96
|
+
if(!this.callMethod(getRuntime().getCurrentContext(),"private?").isTrue()) {
|
|
97
|
+
throw getRuntime().newArgumentError("Private key is needed.");
|
|
98
|
+
}
|
|
99
|
+
Signature sig = Signature.getInstance(((Digest)digest).getAlgorithm() + "WITH" + getAlgorithm(),OpenSSLReal.PROVIDER);
|
|
100
|
+
sig.initSign(getPrivateKey());
|
|
101
|
+
byte[] inp = data.convertToString().getBytes();
|
|
102
|
+
sig.update(inp);
|
|
103
|
+
byte[] sigge = sig.sign();
|
|
104
|
+
return RubyString.newString(getRuntime(), sigge);
|
|
105
|
+
/*
|
|
106
|
+
GetPKey(self, pkey);
|
|
107
|
+
EVP_SignInit(&ctx, GetDigestPtr(digest));
|
|
108
|
+
StringValue(data);
|
|
109
|
+
EVP_SignUpdate(&ctx, RSTRING(data)->ptr, RSTRING(data)->len);
|
|
110
|
+
str = rb_str_new(0, EVP_PKEY_size(pkey)+16);
|
|
111
|
+
if (!EVP_SignFinal(&ctx, RSTRING(str)->ptr, &buf_len, pkey))
|
|
112
|
+
ossl_raise(ePKeyError, NULL);
|
|
113
|
+
assert(buf_len <= RSTRING(str)->len);
|
|
114
|
+
RSTRING(str)->len = buf_len;
|
|
115
|
+
RSTRING(str)->ptr[buf_len] = 0;
|
|
116
|
+
|
|
117
|
+
return str;
|
|
118
|
+
*/
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
@JRubyMethod
|
|
122
|
+
public IRubyObject verify(IRubyObject digest, IRubyObject sig, IRubyObject data) {
|
|
123
|
+
if (!(digest instanceof Digest)) {
|
|
124
|
+
throw newPKeyError(getRuntime(), "invalid digest");
|
|
125
|
+
}
|
|
126
|
+
if (!(sig instanceof RubyString)) {
|
|
127
|
+
throw newPKeyError(getRuntime(), "invalid signature");
|
|
128
|
+
}
|
|
129
|
+
if (!(data instanceof RubyString)) {
|
|
130
|
+
throw newPKeyError(getRuntime(), "invalid data");
|
|
131
|
+
}
|
|
132
|
+
byte[] sigBytes = ((RubyString)sig).getBytes();
|
|
133
|
+
byte[] dataBytes = ((RubyString)data).getBytes();
|
|
134
|
+
String algorithm = ((Digest)digest).getRealName() + "with" + getAlgorithm();
|
|
135
|
+
boolean valid;
|
|
136
|
+
try {
|
|
137
|
+
// note: not specifying "BC" provider here, as that would fail if
|
|
138
|
+
// BC wasn't plugged in (as it would not be for, say, Net::SSH)
|
|
139
|
+
Signature signature = OpenSSLReal.PROVIDER == null ?
|
|
140
|
+
Signature.getInstance(algorithm) :
|
|
141
|
+
Signature.getInstance(algorithm, OpenSSLReal.PROVIDER);
|
|
142
|
+
signature.initVerify(getPublicKey());
|
|
143
|
+
signature.update(dataBytes);
|
|
144
|
+
valid = signature.verify(sigBytes);
|
|
145
|
+
} catch (NoSuchAlgorithmException e) {
|
|
146
|
+
throw newPKeyError(getRuntime(), "unsupported algorithm: " + algorithm);
|
|
147
|
+
} catch (SignatureException e) {
|
|
148
|
+
throw newPKeyError(getRuntime(), "invalid signature");
|
|
149
|
+
} catch (InvalidKeyException e) {
|
|
150
|
+
throw newPKeyError(getRuntime(), "invalid key");
|
|
151
|
+
}
|
|
152
|
+
return getRuntime().newBoolean(valid);
|
|
153
|
+
}
|
|
154
|
+
}// PKey
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
/***** BEGIN LICENSE BLOCK *****
|
|
2
|
+
* Version: CPL 1.0/GPL 2.0/LGPL 2.1
|
|
3
|
+
*
|
|
4
|
+
* The contents of this file are subject to the Common Public
|
|
5
|
+
* License Version 1.0 (the "License"); you may not use this file
|
|
6
|
+
* except in compliance with the License. You may obtain a copy of
|
|
7
|
+
* the License at http://www.eclipse.org/legal/cpl-v10.html
|
|
8
|
+
*
|
|
9
|
+
* Software distributed under the License is distributed on an "AS
|
|
10
|
+
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
11
|
+
* implied. See the License for the specific language governing
|
|
12
|
+
* rights and limitations under the License.
|
|
13
|
+
*
|
|
14
|
+
* Copyright (C) 2007 William N Dortch <bill.dortch@gmail.com>
|
|
15
|
+
*
|
|
16
|
+
* Alternatively, the contents of this file may be used under the terms of
|
|
17
|
+
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
18
|
+
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
19
|
+
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
20
|
+
* of those above. If you wish to allow use of your version of this file only
|
|
21
|
+
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
22
|
+
* use your version of this file under the terms of the CPL, indicate your
|
|
23
|
+
* decision by deleting the provisions above and replace them with the notice
|
|
24
|
+
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
25
|
+
* the provisions above, a recipient may use your version of this file under
|
|
26
|
+
* the terms of any one of the CPL, the GPL or the LGPL.
|
|
27
|
+
***** END LICENSE BLOCK *****/
|
|
28
|
+
package org.jruby.ext.openssl;
|
|
29
|
+
|
|
30
|
+
import java.io.IOException;
|
|
31
|
+
import java.io.StringReader;
|
|
32
|
+
import java.io.StringWriter;
|
|
33
|
+
import java.math.BigInteger;
|
|
34
|
+
import java.security.SecureRandom;
|
|
35
|
+
import java.security.spec.InvalidParameterSpecException;
|
|
36
|
+
import java.util.HashMap;
|
|
37
|
+
|
|
38
|
+
import javax.crypto.spec.DHParameterSpec;
|
|
39
|
+
|
|
40
|
+
import org.bouncycastle.asn1.ASN1EncodableVector;
|
|
41
|
+
import org.bouncycastle.asn1.DERInteger;
|
|
42
|
+
import org.bouncycastle.asn1.DERSequence;
|
|
43
|
+
import org.jruby.Ruby;
|
|
44
|
+
import org.jruby.RubyClass;
|
|
45
|
+
import org.jruby.RubyHash;
|
|
46
|
+
import org.jruby.RubyKernel;
|
|
47
|
+
import org.jruby.RubyModule;
|
|
48
|
+
import org.jruby.RubyNumeric;
|
|
49
|
+
import org.jruby.RubyString;
|
|
50
|
+
import org.jruby.anno.JRubyMethod;
|
|
51
|
+
import org.jruby.exceptions.RaiseException;
|
|
52
|
+
import org.jruby.ext.openssl.x509store.PEMInputOutput;
|
|
53
|
+
import org.jruby.runtime.Arity;
|
|
54
|
+
import org.jruby.runtime.Block;
|
|
55
|
+
import org.jruby.runtime.ObjectAllocator;
|
|
56
|
+
import org.jruby.runtime.builtin.IRubyObject;
|
|
57
|
+
import org.jruby.util.ByteList;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* OpenSSL::PKey::DH implementation.
|
|
61
|
+
*
|
|
62
|
+
* @author <a href="mailto:bill.dortch@gmail.com">Bill Dortch</a>
|
|
63
|
+
*/
|
|
64
|
+
public class PKeyDH extends PKey {
|
|
65
|
+
private static final long serialVersionUID = 293266329939132250L;
|
|
66
|
+
|
|
67
|
+
// parameters used in generating 'p'; see [ossl]/crypto/dh/dh_gen.c #dh_builtin_genparams
|
|
68
|
+
private static final BigInteger GEN_2_ADD_PARAM = BigInteger.valueOf(24);
|
|
69
|
+
private static final BigInteger GEN_2_REM_PARAM = BigInteger.valueOf(11);
|
|
70
|
+
private static final BigInteger GEN_5_ADD_PARAM = BigInteger.valueOf(10);
|
|
71
|
+
private static final BigInteger GEN_5_REM_PARAM = BigInteger.valueOf(3);
|
|
72
|
+
private static final BigInteger DEFAULT_ADD_PARAM = BigInteger.valueOf(2);
|
|
73
|
+
private static final BigInteger DEFAULT_REM_PARAM = BigInteger.ONE;
|
|
74
|
+
|
|
75
|
+
private static final BigInteger TWO = BigInteger.valueOf(2);
|
|
76
|
+
|
|
77
|
+
// from [ossl]/crypto/dh/dh.h
|
|
78
|
+
private static final int OPENSSL_DH_MAX_MODULUS_BITS = 10000;
|
|
79
|
+
|
|
80
|
+
private static ObjectAllocator PKEYDH_ALLOCATOR = new ObjectAllocator() {
|
|
81
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klass) {
|
|
82
|
+
return new PKeyDH(runtime, klass);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
public static void createPKeyDH(Ruby runtime, RubyModule pkeyModule, RubyClass pkeyClass) {
|
|
87
|
+
RubyClass dh = pkeyModule.defineClassUnder("DH", pkeyClass, PKEYDH_ALLOCATOR);
|
|
88
|
+
|
|
89
|
+
RubyClass pkeyError = pkeyModule.getClass("PKeyError");
|
|
90
|
+
pkeyModule.defineClassUnder("DHError",pkeyError,pkeyError.getAllocator());
|
|
91
|
+
|
|
92
|
+
dh.defineAnnotatedMethods(PKeyDH.class);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
public static RaiseException newDHError(Ruby runtime, String message) {
|
|
96
|
+
return new RaiseException(runtime, ((RubyModule)runtime.getModule("OpenSSL").getConstantAt("PKey")).getClass("DHError"), message, true);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
private static SecureRandom _secureRandom;
|
|
100
|
+
|
|
101
|
+
private static SecureRandom getSecureRandom() {
|
|
102
|
+
SecureRandom rand;
|
|
103
|
+
if ((rand = _secureRandom) != null) {
|
|
104
|
+
return rand;
|
|
105
|
+
}
|
|
106
|
+
// FIXME: do we want a particular algorithm / provider? BC?
|
|
107
|
+
return _secureRandom = new SecureRandom();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// transient because: we do not want these value serialized (insecure)
|
|
111
|
+
// volatile because: permits unsynchronized reads in some cases
|
|
112
|
+
private transient volatile BigInteger dh_p;
|
|
113
|
+
private transient volatile BigInteger dh_g;
|
|
114
|
+
private transient volatile BigInteger dh_pub_key;
|
|
115
|
+
private transient volatile BigInteger dh_priv_key;
|
|
116
|
+
|
|
117
|
+
// FIXME! need to figure out what it means in MRI/OSSL code to
|
|
118
|
+
// claim a DH is(/has) private if an engine is present -- doesn't really
|
|
119
|
+
// map to Java implementation.
|
|
120
|
+
|
|
121
|
+
//private volatile boolean haveEngine;
|
|
122
|
+
|
|
123
|
+
public PKeyDH(Ruby runtime, RubyClass clazz) {
|
|
124
|
+
super(runtime, clazz);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@JRubyMethod(name="initialize", rest=true)
|
|
128
|
+
public synchronized IRubyObject dh_initialize(IRubyObject[] args) {
|
|
129
|
+
Ruby runtime = getRuntime();
|
|
130
|
+
if (this.dh_p != null || this.dh_g != null || this.dh_pub_key != null || this.dh_priv_key != null) {
|
|
131
|
+
throw newDHError(runtime, "illegal initialization");
|
|
132
|
+
}
|
|
133
|
+
int argc = Arity.checkArgumentCount(runtime, args, 0, 2);
|
|
134
|
+
if (argc > 0) {
|
|
135
|
+
IRubyObject arg0 = args[0];
|
|
136
|
+
if (argc == 1 && arg0 instanceof RubyString) {
|
|
137
|
+
try {
|
|
138
|
+
DHParameterSpec spec = PEMInputOutput.readDHParameters(new StringReader(arg0.toString()));
|
|
139
|
+
this.dh_p = spec.getP();
|
|
140
|
+
this.dh_g = spec.getG();
|
|
141
|
+
} catch (IOException e) {
|
|
142
|
+
throw runtime.newIOErrorFromException(e);
|
|
143
|
+
} catch (InvalidParameterSpecException e) {
|
|
144
|
+
throw runtime.newArgumentError(e.getMessage());
|
|
145
|
+
}
|
|
146
|
+
} else {
|
|
147
|
+
int bits = RubyNumeric.fix2int(args[0]);
|
|
148
|
+
// g defaults to 2
|
|
149
|
+
int gval = argc == 2 ? RubyNumeric.fix2int(args[1]) : 2;
|
|
150
|
+
BigInteger p;
|
|
151
|
+
try {
|
|
152
|
+
p = generateP(bits, gval);
|
|
153
|
+
} catch(IllegalArgumentException e) {
|
|
154
|
+
throw runtime.newArgumentError(e.getMessage());
|
|
155
|
+
}
|
|
156
|
+
BigInteger g = BigInteger.valueOf(gval);
|
|
157
|
+
BigInteger x = generateX(p);
|
|
158
|
+
BigInteger y = generateY(p, g, x);
|
|
159
|
+
this.dh_p = p;
|
|
160
|
+
this.dh_g = g;
|
|
161
|
+
this.dh_priv_key = x;
|
|
162
|
+
this.dh_pub_key = y;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return this;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
public static BigInteger generateP(int bits, int g) {
|
|
169
|
+
|
|
170
|
+
// FIXME? I'm following algorithms used in OpenSSL, could use JCE provider instead.
|
|
171
|
+
// (Note that I tried that, but got mystifying values of g returned by the param generator.
|
|
172
|
+
// In any case, in OpenSSL/MRI-OpenSSL, the caller supplies g, or it defaults to 2.)
|
|
173
|
+
|
|
174
|
+
// see [ossl]/crypto/dh/dh_gen.c #dh_builtin_genparams
|
|
175
|
+
|
|
176
|
+
if (bits < 2) throw new IllegalArgumentException("invalid bit length");
|
|
177
|
+
if (g < 2) throw new IllegalArgumentException("invalid generator");
|
|
178
|
+
|
|
179
|
+
// generate safe prime meeting appropriate add/rem (mod) criteria
|
|
180
|
+
|
|
181
|
+
switch(g) {
|
|
182
|
+
case 2:
|
|
183
|
+
// add = 24, rem = 11
|
|
184
|
+
return BN.generatePrime(bits, true, GEN_2_ADD_PARAM, GEN_2_REM_PARAM);
|
|
185
|
+
case 5:
|
|
186
|
+
// add = 10, rem = 3
|
|
187
|
+
return BN.generatePrime(bits, true, GEN_5_ADD_PARAM, GEN_5_REM_PARAM);
|
|
188
|
+
default:
|
|
189
|
+
// add = 2, rem = 1
|
|
190
|
+
return BN.generatePrime(bits, true, DEFAULT_ADD_PARAM, DEFAULT_REM_PARAM);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
public static BigInteger generateX(BigInteger p, int limit) {
|
|
195
|
+
if (limit < 0) throw new IllegalArgumentException("invalid limit");
|
|
196
|
+
|
|
197
|
+
BigInteger x;
|
|
198
|
+
SecureRandom secureRandom = getSecureRandom();
|
|
199
|
+
// adapting algorithm from org.bouncycastle.crypto.generators.DHKeyGeneratorHelper,
|
|
200
|
+
// which seems a little stronger (?) than OpenSSL's (OSSL just generates a random,
|
|
201
|
+
// while BC generates a random potential prime [for limit > 0], though it's not
|
|
202
|
+
// subject to Miller-Rabin [certainty = 0], but is subject to other constraints)
|
|
203
|
+
// see also [ossl]/crypto/dh/dh_key.c #generate_key
|
|
204
|
+
if (limit == 0) {
|
|
205
|
+
BigInteger pSub2 = p.subtract(TWO);
|
|
206
|
+
do {
|
|
207
|
+
x = BN.getRandomBIInRange(pSub2, secureRandom);
|
|
208
|
+
} while (x.equals(BigInteger.ZERO));
|
|
209
|
+
} else {
|
|
210
|
+
do {
|
|
211
|
+
// generate potential prime, though with 0 certainty (no Miller-Rabin tests)
|
|
212
|
+
x = new BigInteger(limit, 0, secureRandom);
|
|
213
|
+
} while (x.equals(BigInteger.ZERO));
|
|
214
|
+
}
|
|
215
|
+
return x;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
public static BigInteger generateX(BigInteger p) {
|
|
219
|
+
// OpenSSL default l(imit) is p bits - 1 -- see [ossl]/crypto/dh/dh_key.c #generate_key
|
|
220
|
+
return generateX(p, p.bitLength() - 1);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
public static BigInteger generateY(BigInteger p, BigInteger g, BigInteger x) {
|
|
224
|
+
return g.modPow(x, p);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
public static BigInteger generateY(BigInteger p, int g, BigInteger x) {
|
|
228
|
+
return generateY(p, BigInteger.valueOf(g), x);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
@JRubyMethod(name="generate_key!")
|
|
232
|
+
public synchronized IRubyObject dh_generate_key() {
|
|
233
|
+
BigInteger p, g, x, y;
|
|
234
|
+
if ((p = this.dh_p) == null || (g = this.dh_g) == null) {
|
|
235
|
+
throw newDHError(getRuntime(), "can't generate key");
|
|
236
|
+
}
|
|
237
|
+
if ((x = this.dh_priv_key) == null) {
|
|
238
|
+
x = generateX(p);
|
|
239
|
+
}
|
|
240
|
+
y = generateY(p, g, x);
|
|
241
|
+
this.dh_priv_key = x;
|
|
242
|
+
this.dh_pub_key = y;
|
|
243
|
+
return this;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
@JRubyMethod(name="compute_key")
|
|
247
|
+
public synchronized IRubyObject dh_compute_key(IRubyObject other_pub_key) {
|
|
248
|
+
BigInteger x, y, p;
|
|
249
|
+
if ((y = BN.getBigInteger(other_pub_key)) == null) {
|
|
250
|
+
throw getRuntime().newArgumentError("invalid public key");
|
|
251
|
+
}
|
|
252
|
+
if ((x = this.dh_priv_key) == null || (p = this.dh_p) == null) {
|
|
253
|
+
throw newDHError(getRuntime(), "can't compute key");
|
|
254
|
+
}
|
|
255
|
+
int plen;
|
|
256
|
+
if ((plen = p.bitLength()) == 0 || plen > OPENSSL_DH_MAX_MODULUS_BITS) {
|
|
257
|
+
throw newDHError(getRuntime(), "can't compute key");
|
|
258
|
+
}
|
|
259
|
+
return getRuntime().newString(new ByteList(computeKey(y, x, p), false));
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
public static byte[] computeKey(BigInteger y, BigInteger x, BigInteger p) {
|
|
263
|
+
return y.modPow(x, p).toByteArray();
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
@JRubyMethod(name="public?")
|
|
267
|
+
public IRubyObject dh_is_public() {
|
|
268
|
+
return getRuntime().newBoolean(dh_pub_key != null);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
@JRubyMethod(name="private?")
|
|
272
|
+
public IRubyObject dh_is_private() {
|
|
273
|
+
// FIXME! need to figure out what it means in MRI/OSSL code to
|
|
274
|
+
// claim a DH is private if an engine is present -- doesn't really
|
|
275
|
+
// map to Java implementation.
|
|
276
|
+
return getRuntime().newBoolean(dh_priv_key != null /* || haveEngine */);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
@JRubyMethod(name={"export", "to_pem", "to_s"})
|
|
280
|
+
public IRubyObject dh_export() {
|
|
281
|
+
BigInteger p, g;
|
|
282
|
+
synchronized(this) {
|
|
283
|
+
p = this.dh_p;
|
|
284
|
+
g = this.dh_g;
|
|
285
|
+
}
|
|
286
|
+
StringWriter w = new StringWriter();
|
|
287
|
+
try {
|
|
288
|
+
PEMInputOutput.writeDHParameters(w, new DHParameterSpec(p, g));
|
|
289
|
+
w.flush();
|
|
290
|
+
w.close();
|
|
291
|
+
} catch (IOException e) {
|
|
292
|
+
// shouldn't happen (string/buffer io only)
|
|
293
|
+
throw getRuntime().newIOErrorFromException(e);
|
|
294
|
+
}
|
|
295
|
+
return getRuntime().newString(w.toString());
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
@JRubyMethod(name="to_der")
|
|
299
|
+
public IRubyObject dh_to_der() {
|
|
300
|
+
BigInteger p, g;
|
|
301
|
+
synchronized(this) {
|
|
302
|
+
p = this.dh_p;
|
|
303
|
+
g = this.dh_g;
|
|
304
|
+
}
|
|
305
|
+
ASN1EncodableVector v = new ASN1EncodableVector();
|
|
306
|
+
if (p != null) {
|
|
307
|
+
v.add(new DERInteger(p));
|
|
308
|
+
}
|
|
309
|
+
if (g != null) {
|
|
310
|
+
v.add(new DERInteger(g));
|
|
311
|
+
}
|
|
312
|
+
byte[] encoded;
|
|
313
|
+
try {
|
|
314
|
+
encoded = new DERSequence(v).getEncoded();
|
|
315
|
+
} catch (IOException e) {
|
|
316
|
+
throw getRuntime().newIOErrorFromException(e);
|
|
317
|
+
}
|
|
318
|
+
return RubyString.newString(getRuntime(), encoded);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
@JRubyMethod(name="params")
|
|
322
|
+
public IRubyObject dh_get_params() {
|
|
323
|
+
BigInteger p, g, x, y;
|
|
324
|
+
synchronized(this) {
|
|
325
|
+
p = this.dh_p;
|
|
326
|
+
g = this.dh_g;
|
|
327
|
+
x = this.dh_priv_key;
|
|
328
|
+
y = this.dh_pub_key;
|
|
329
|
+
}
|
|
330
|
+
Ruby runtime = getRuntime();
|
|
331
|
+
HashMap<IRubyObject, IRubyObject> params = new HashMap<IRubyObject, IRubyObject>();
|
|
332
|
+
|
|
333
|
+
params.put(runtime.newString("p"), BN.newBN(runtime, p));
|
|
334
|
+
params.put(runtime.newString("g"), BN.newBN(runtime, g));
|
|
335
|
+
params.put(runtime.newString("pub_key"), BN.newBN(runtime, x));
|
|
336
|
+
params.put(runtime.newString("priv_key"), BN.newBN(runtime, y));
|
|
337
|
+
|
|
338
|
+
return RubyHash.newHash(runtime, params, runtime.getNil());
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// don't need synchronized as value is volatile
|
|
342
|
+
@JRubyMethod(name="p")
|
|
343
|
+
public IRubyObject dh_get_p() {
|
|
344
|
+
return getBN(dh_p);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
@JRubyMethod(name="p=")
|
|
348
|
+
public synchronized IRubyObject dh_set_p(IRubyObject arg) {
|
|
349
|
+
this.dh_p = BN.getBigInteger(arg);
|
|
350
|
+
return arg;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// don't need synchronized as value is volatile
|
|
354
|
+
@JRubyMethod(name="g")
|
|
355
|
+
public IRubyObject dh_get_g() {
|
|
356
|
+
return getBN(dh_g);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
@JRubyMethod(name="g=")
|
|
360
|
+
public synchronized IRubyObject dh_set_g(IRubyObject arg) {
|
|
361
|
+
this.dh_g = BN.getBigInteger(arg);
|
|
362
|
+
return arg;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// don't need synchronized as value is volatile
|
|
366
|
+
@JRubyMethod(name="pub_key")
|
|
367
|
+
public IRubyObject dh_get_pub_key() {
|
|
368
|
+
return getBN(dh_pub_key);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
@JRubyMethod(name="pub_key=")
|
|
372
|
+
public synchronized IRubyObject dh_set_pub_key(IRubyObject arg) {
|
|
373
|
+
this.dh_pub_key = BN.getBigInteger(arg);
|
|
374
|
+
return arg;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// don't need synchronized as value is volatile
|
|
378
|
+
@JRubyMethod(name="priv_key")
|
|
379
|
+
public IRubyObject dh_get_priv_key() {
|
|
380
|
+
return getBN(dh_priv_key);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
@JRubyMethod(name="priv_key=")
|
|
384
|
+
public synchronized IRubyObject dh_set_priv_key(IRubyObject arg) {
|
|
385
|
+
this.dh_priv_key = BN.getBigInteger(arg);
|
|
386
|
+
return arg;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
private IRubyObject getBN(BigInteger value) {
|
|
390
|
+
if (value != null) {
|
|
391
|
+
return BN.newBN(getRuntime(), value);
|
|
392
|
+
}
|
|
393
|
+
return getRuntime().getNil();
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// override differently-named abstract method from PKey
|
|
397
|
+
public IRubyObject to_der() throws Exception {
|
|
398
|
+
return dh_to_der();
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
}
|