redcar 0.3.2dev → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- 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,113 @@
|
|
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 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 org.jruby.Ruby;
|
31
|
+
import org.jruby.RubyClass;
|
32
|
+
import org.jruby.RubyModule;
|
33
|
+
|
34
|
+
/**
|
35
|
+
* @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
|
36
|
+
*/
|
37
|
+
public class OpenSSLReal {
|
38
|
+
public static java.security.Provider PROVIDER;
|
39
|
+
|
40
|
+
static {
|
41
|
+
try {
|
42
|
+
PROVIDER = (java.security.Provider)
|
43
|
+
Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider").newInstance();
|
44
|
+
} catch (Exception exception) {
|
45
|
+
// no bouncy castle available
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
public static void doWithBCProvider(final Runnable toRun) {
|
50
|
+
getWithBCProvider(new Callable() {
|
51
|
+
|
52
|
+
public Object call() {
|
53
|
+
toRun.run();
|
54
|
+
return null;
|
55
|
+
}
|
56
|
+
});
|
57
|
+
}
|
58
|
+
|
59
|
+
public static Object getWithBCProvider(Callable toRun) {
|
60
|
+
if (PROVIDER != null) {
|
61
|
+
synchronized (java.security.Security.class) {
|
62
|
+
try {
|
63
|
+
java.security.Security.addProvider(PROVIDER);
|
64
|
+
return toRun.call();
|
65
|
+
} finally {
|
66
|
+
java.security.Security.removeProvider("BC");
|
67
|
+
}
|
68
|
+
}
|
69
|
+
} else {
|
70
|
+
return toRun.call();
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
public static void createOpenSSL(Ruby runtime) {
|
75
|
+
RubyModule ossl = runtime.getOrCreateModule("OpenSSL");
|
76
|
+
RubyClass standardError = runtime.getClass("StandardError");
|
77
|
+
ossl.defineClassUnder("OpenSSLError", standardError, standardError.getAllocator());
|
78
|
+
|
79
|
+
if (PROVIDER != null) {
|
80
|
+
ASN1.createASN1(runtime, ossl);
|
81
|
+
PKey.createPKey(runtime, ossl);
|
82
|
+
X509.createX509(runtime, ossl);
|
83
|
+
NetscapeSPKI.createNetscapeSPKI(runtime, ossl);
|
84
|
+
PKCS7.createPKCS7(runtime, ossl);
|
85
|
+
} else {
|
86
|
+
runtime.getLoadService().require("openssl/dummy");
|
87
|
+
}
|
88
|
+
|
89
|
+
BN.createBN(runtime, ossl);
|
90
|
+
Digest.createDigest(runtime, ossl);
|
91
|
+
Cipher.createCipher(runtime, ossl);
|
92
|
+
Random.createRandom(runtime, ossl);
|
93
|
+
HMAC.createHMAC(runtime, ossl);
|
94
|
+
Config.createConfig(runtime, ossl);
|
95
|
+
|
96
|
+
try {
|
97
|
+
SSL.createSSL(runtime, ossl);
|
98
|
+
} catch (Error err) {
|
99
|
+
runtime.getLoadService().require("openssl/dummyssl");
|
100
|
+
}
|
101
|
+
|
102
|
+
ossl.setConstant("VERSION", runtime.newString("1.0.0"));
|
103
|
+
ossl.setConstant("OPENSSL_VERSION", runtime.newString("OpenSSL 0.9.8b 04 May 2006 (JRuby-OpenSSL fake)"));
|
104
|
+
|
105
|
+
try {
|
106
|
+
java.security.MessageDigest.getInstance("SHA224", PROVIDER);
|
107
|
+
ossl.setConstant("OPENSSL_VERSION_NUMBER", runtime.newFixnum(9469999));
|
108
|
+
} catch (Exception e) {
|
109
|
+
ossl.setConstant("OPENSSL_VERSION_NUMBER", runtime.newFixnum(9469952));
|
110
|
+
}
|
111
|
+
}
|
112
|
+
}// OpenSSLReal
|
113
|
+
|
@@ -0,0 +1,40 @@
|
|
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 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.io.Reader;
|
31
|
+
import java.io.Writer;
|
32
|
+
|
33
|
+
/**
|
34
|
+
* @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
|
35
|
+
*/
|
36
|
+
public interface PEMHandler {
|
37
|
+
Object readPEM(Reader read, String password) throws Exception;
|
38
|
+
void writePEM(Writer writ, Object obj, String algorithm, char[] password) throws Exception;
|
39
|
+
void writePEM(Writer writ, Object obj) throws Exception;
|
40
|
+
}// PEMHandler
|
@@ -0,0 +1,159 @@
|
|
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 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.io.ByteArrayOutputStream;
|
31
|
+
import java.security.InvalidKeyException;
|
32
|
+
import java.security.NoSuchAlgorithmException;
|
33
|
+
import java.security.NoSuchProviderException;
|
34
|
+
import java.security.PrivateKey;
|
35
|
+
import java.security.PublicKey;
|
36
|
+
import java.security.Signature;
|
37
|
+
import java.security.SignatureException;
|
38
|
+
|
39
|
+
import javax.security.auth.x500.X500Principal;
|
40
|
+
|
41
|
+
import org.bouncycastle.asn1.ASN1EncodableVector;
|
42
|
+
import org.bouncycastle.asn1.ASN1Sequence;
|
43
|
+
import org.bouncycastle.asn1.ASN1Set;
|
44
|
+
import org.bouncycastle.asn1.DERInteger;
|
45
|
+
import org.bouncycastle.asn1.DEROutputStream;
|
46
|
+
import org.bouncycastle.asn1.DERSequence;
|
47
|
+
import org.bouncycastle.asn1.DERSet;
|
48
|
+
import org.bouncycastle.asn1.DERTaggedObject;
|
49
|
+
import org.bouncycastle.asn1.pkcs.CertificationRequestInfo;
|
50
|
+
import org.bouncycastle.jce.PKCS10CertificationRequest;
|
51
|
+
|
52
|
+
/**
|
53
|
+
* @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
|
54
|
+
*/
|
55
|
+
public class PKCS10CertificationRequestExt extends PKCS10CertificationRequest {
|
56
|
+
public PKCS10CertificationRequestExt(byte[] bytes) {
|
57
|
+
super(bytes);
|
58
|
+
}
|
59
|
+
|
60
|
+
public PKCS10CertificationRequestExt(ASN1Sequence sequence) {
|
61
|
+
super(sequence);
|
62
|
+
}
|
63
|
+
|
64
|
+
public PKCS10CertificationRequestExt(
|
65
|
+
String signatureAlgorithm,
|
66
|
+
org.bouncycastle.asn1.x509.X509Name subject,
|
67
|
+
PublicKey key,
|
68
|
+
ASN1Set attributes,
|
69
|
+
PrivateKey signingKey)
|
70
|
+
throws NoSuchAlgorithmException, NoSuchProviderException,
|
71
|
+
InvalidKeyException, SignatureException
|
72
|
+
{
|
73
|
+
super(signatureAlgorithm,subject,key,attributes,signingKey);
|
74
|
+
}
|
75
|
+
|
76
|
+
public PKCS10CertificationRequestExt(
|
77
|
+
String signatureAlgorithm,
|
78
|
+
X500Principal subject,
|
79
|
+
PublicKey key,
|
80
|
+
ASN1Set attributes,
|
81
|
+
PrivateKey signingKey)
|
82
|
+
throws NoSuchAlgorithmException, NoSuchProviderException,
|
83
|
+
InvalidKeyException, SignatureException
|
84
|
+
{
|
85
|
+
super(signatureAlgorithm,subject,key,attributes,signingKey);
|
86
|
+
}
|
87
|
+
|
88
|
+
public PKCS10CertificationRequestExt(
|
89
|
+
String signatureAlgorithm,
|
90
|
+
X500Principal subject,
|
91
|
+
PublicKey key,
|
92
|
+
ASN1Set attributes,
|
93
|
+
PrivateKey signingKey,
|
94
|
+
String provider)
|
95
|
+
throws NoSuchAlgorithmException, NoSuchProviderException,
|
96
|
+
InvalidKeyException, SignatureException
|
97
|
+
{
|
98
|
+
super(signatureAlgorithm,subject,key,attributes,signingKey,provider);
|
99
|
+
}
|
100
|
+
|
101
|
+
public PKCS10CertificationRequestExt(
|
102
|
+
String signatureAlgorithm,
|
103
|
+
org.bouncycastle.asn1.x509.X509Name subject,
|
104
|
+
PublicKey key,
|
105
|
+
ASN1Set attributes,
|
106
|
+
PrivateKey signingKey,
|
107
|
+
String provider)
|
108
|
+
throws NoSuchAlgorithmException, NoSuchProviderException,
|
109
|
+
InvalidKeyException, SignatureException
|
110
|
+
{
|
111
|
+
super(signatureAlgorithm,subject,key,attributes,signingKey,provider);
|
112
|
+
}
|
113
|
+
|
114
|
+
public void setAttributes(DERSet attrs) {
|
115
|
+
ASN1Sequence seq = (ASN1Sequence)this.reqInfo.toASN1Object();
|
116
|
+
ASN1EncodableVector v1 = new ASN1EncodableVector();
|
117
|
+
for(int i=0;i<(seq.size()-1);i++) {
|
118
|
+
v1.add(seq.getObjectAt(i));
|
119
|
+
}
|
120
|
+
v1.add(new DERTaggedObject(0,attrs));
|
121
|
+
this.reqInfo = new CertificationRequestInfo(new DERSequence(v1));
|
122
|
+
}
|
123
|
+
|
124
|
+
public void setVersion(int v) {
|
125
|
+
DERInteger nVersion = new DERInteger(v);
|
126
|
+
ASN1Sequence seq = (ASN1Sequence)this.reqInfo.toASN1Object();
|
127
|
+
ASN1EncodableVector v1 = new ASN1EncodableVector();
|
128
|
+
v1.add(nVersion);
|
129
|
+
for(int i=1;i<seq.size();i++) {
|
130
|
+
v1.add(seq.getObjectAt(i));
|
131
|
+
}
|
132
|
+
this.reqInfo = new CertificationRequestInfo(new DERSequence(v1));
|
133
|
+
}
|
134
|
+
|
135
|
+
public int getVersion() {
|
136
|
+
return getCertificationRequestInfo().getVersion().getValue().intValue();
|
137
|
+
}
|
138
|
+
|
139
|
+
public boolean verify(PublicKey pubkey) throws Exception {
|
140
|
+
Signature sig = Signature.getInstance(sigAlgId.getObjectId().getId(),OpenSSLReal.PROVIDER);
|
141
|
+
sig.initVerify(pubkey);
|
142
|
+
|
143
|
+
try
|
144
|
+
{
|
145
|
+
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
|
146
|
+
DEROutputStream dOut = new DEROutputStream(bOut);
|
147
|
+
|
148
|
+
dOut.writeObject(reqInfo);
|
149
|
+
|
150
|
+
sig.update(bOut.toByteArray());
|
151
|
+
}
|
152
|
+
catch (Exception e)
|
153
|
+
{
|
154
|
+
throw new SecurityException("exception encoding TBS cert request - " + e);
|
155
|
+
}
|
156
|
+
|
157
|
+
return sig.verify(sigBits.getBytes());
|
158
|
+
}
|
159
|
+
}// PKCS10CertificationRequestExt
|
@@ -0,0 +1,642 @@
|
|
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
|
+
|
31
|
+
import java.io.ByteArrayInputStream;
|
32
|
+
import java.io.IOException;
|
33
|
+
import java.io.InputStreamReader;
|
34
|
+
import java.io.StringWriter;
|
35
|
+
import java.security.GeneralSecurityException;
|
36
|
+
import java.security.PrivateKey;
|
37
|
+
import java.security.cert.CertStore;
|
38
|
+
import java.security.cert.CollectionCertStoreParameters;
|
39
|
+
import java.util.ArrayList;
|
40
|
+
import java.util.Collection;
|
41
|
+
import java.util.HashSet;
|
42
|
+
import java.util.Iterator;
|
43
|
+
import java.util.List;
|
44
|
+
import java.util.Set;
|
45
|
+
import javax.security.auth.x500.X500Principal;
|
46
|
+
import org.bouncycastle.asn1.ASN1InputStream;
|
47
|
+
import org.bouncycastle.asn1.ASN1Object;
|
48
|
+
import org.bouncycastle.asn1.x509.TBSCertificateStructure;
|
49
|
+
import org.jruby.Ruby;
|
50
|
+
import org.jruby.RubyArray;
|
51
|
+
import org.jruby.RubyBignum;
|
52
|
+
import org.jruby.RubyClass;
|
53
|
+
import org.jruby.RubyFile;
|
54
|
+
import org.jruby.RubyModule;
|
55
|
+
import org.jruby.RubyNumeric;
|
56
|
+
import org.jruby.RubyObject;
|
57
|
+
import org.jruby.RubyString;
|
58
|
+
import org.jruby.anno.JRubyMethod;
|
59
|
+
import org.jruby.exceptions.RaiseException;
|
60
|
+
import org.jruby.ext.openssl.impl.ASN1Registry;
|
61
|
+
import org.jruby.ext.openssl.impl.BIO;
|
62
|
+
import org.jruby.ext.openssl.impl.MemBIO;
|
63
|
+
import org.jruby.ext.openssl.impl.Mime;
|
64
|
+
import org.jruby.ext.openssl.impl.NotVerifiedPKCS7Exception;
|
65
|
+
import org.jruby.ext.openssl.impl.PKCS7Exception;
|
66
|
+
import org.jruby.ext.openssl.impl.RecipInfo;
|
67
|
+
import org.jruby.ext.openssl.impl.SMIME;
|
68
|
+
import org.jruby.ext.openssl.impl.SignerInfoWithPkey;
|
69
|
+
import org.jruby.ext.openssl.x509store.PEMInputOutput;
|
70
|
+
import org.jruby.ext.openssl.x509store.Store;
|
71
|
+
import org.jruby.ext.openssl.x509store.StoreContext;
|
72
|
+
import org.jruby.ext.openssl.x509store.X509AuxCertificate;
|
73
|
+
import org.jruby.runtime.Arity;
|
74
|
+
import org.jruby.runtime.Block;
|
75
|
+
import org.jruby.runtime.ObjectAllocator;
|
76
|
+
import org.jruby.runtime.builtin.IRubyObject;
|
77
|
+
import org.jruby.util.ByteList;
|
78
|
+
|
79
|
+
/**
|
80
|
+
* @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
|
81
|
+
*/
|
82
|
+
public class PKCS7 extends RubyObject {
|
83
|
+
private static ObjectAllocator PKCS7_ALLOCATOR = new ObjectAllocator() {
|
84
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klass) {
|
85
|
+
return new PKCS7(runtime, klass);
|
86
|
+
}
|
87
|
+
};
|
88
|
+
|
89
|
+
public static void createPKCS7(Ruby runtime, RubyModule mOSSL) {
|
90
|
+
RubyModule mPKCS7 = mOSSL.defineModuleUnder("PKCS7");
|
91
|
+
RubyClass openSSLError = runtime.getModule("OpenSSL").getClass("OpenSSLError");
|
92
|
+
mPKCS7.defineClassUnder("PKCS7Error",openSSLError,openSSLError.getAllocator());
|
93
|
+
RubyClass cPKCS7 = mPKCS7.defineClassUnder("PKCS7",runtime.getObject(),PKCS7_ALLOCATOR);
|
94
|
+
|
95
|
+
cPKCS7.attr_accessor(runtime.getCurrentContext(), new IRubyObject[]{runtime.newSymbol("data"),runtime.newSymbol("error_string")});
|
96
|
+
|
97
|
+
mPKCS7.defineAnnotatedMethods(ModuleMethods.class);
|
98
|
+
cPKCS7.defineAnnotatedMethods(PKCS7.class);
|
99
|
+
|
100
|
+
SignerInfo.createSignerInfo(runtime,mPKCS7);
|
101
|
+
RecipientInfo.createRecipientInfo(runtime,mPKCS7);
|
102
|
+
|
103
|
+
mPKCS7.setConstant("TEXT",runtime.newFixnum(1));
|
104
|
+
mPKCS7.setConstant("NOCERTS",runtime.newFixnum(2));
|
105
|
+
mPKCS7.setConstant("NOSIGS",runtime.newFixnum(4));
|
106
|
+
mPKCS7.setConstant("NOCHAIN",runtime.newFixnum(8));
|
107
|
+
mPKCS7.setConstant("NOINTERN",runtime.newFixnum(16));
|
108
|
+
mPKCS7.setConstant("NOVERIFY",runtime.newFixnum(32));
|
109
|
+
mPKCS7.setConstant("DETACHED",runtime.newFixnum(64));
|
110
|
+
mPKCS7.setConstant("BINARY",runtime.newFixnum(128));
|
111
|
+
mPKCS7.setConstant("NOATTR",runtime.newFixnum(256));
|
112
|
+
mPKCS7.setConstant("NOSMIMECAP",runtime.newFixnum(512));
|
113
|
+
}
|
114
|
+
|
115
|
+
public static BIO obj2bio(IRubyObject obj) {
|
116
|
+
if(obj instanceof RubyFile) {
|
117
|
+
throw new IllegalArgumentException("TODO: handle RubyFile correctly");
|
118
|
+
// if (TYPE(obj) == T_FILE) {
|
119
|
+
// OpenFile *fptr;
|
120
|
+
// GetOpenFile(obj, fptr);
|
121
|
+
// rb_io_check_readable(fptr);
|
122
|
+
// bio = BIO_new_fp(fptr->f, BIO_NOCLOSE);
|
123
|
+
} else {
|
124
|
+
RubyString str = obj.convertToString();
|
125
|
+
ByteList bl = str.getByteList();
|
126
|
+
return BIO.memBuf(bl.bytes, bl.begin, bl.realSize);
|
127
|
+
}
|
128
|
+
}
|
129
|
+
|
130
|
+
public static PKCS7 wrap(RubyClass klass, org.jruby.ext.openssl.impl.PKCS7 p7) {
|
131
|
+
PKCS7 wrapped = new PKCS7(klass.getRuntime(), klass);
|
132
|
+
wrapped.p7 = p7;
|
133
|
+
return wrapped;
|
134
|
+
}
|
135
|
+
|
136
|
+
public static IRubyObject membio2str(Ruby runtime, BIO bio) {
|
137
|
+
return runtime.newString(new ByteList(((MemBIO)bio).getMemCopy(), false));
|
138
|
+
}
|
139
|
+
|
140
|
+
private static List<X509AuxCertificate> x509_ary2sk(IRubyObject ary) {
|
141
|
+
List<X509AuxCertificate> certs = new ArrayList<X509AuxCertificate>();
|
142
|
+
RubyArray arr = (RubyArray)ary;
|
143
|
+
for(int i = 0; i<arr.size(); i++) {
|
144
|
+
certs.add(((X509Cert)arr.eltInternal(i)).getAuxCert());
|
145
|
+
}
|
146
|
+
return certs;
|
147
|
+
}
|
148
|
+
|
149
|
+
public static class ModuleMethods {
|
150
|
+
@JRubyMethod(meta=true)
|
151
|
+
public static IRubyObject read_smime(IRubyObject klass, IRubyObject arg) throws IOException {
|
152
|
+
BIO in = obj2bio(arg);
|
153
|
+
BIO[] out = new BIO[]{null};
|
154
|
+
org.jruby.ext.openssl.impl.PKCS7 pkcs7 = new SMIME(Mime.DEFAULT).readPKCS7(in, out);
|
155
|
+
if(pkcs7 == null) {
|
156
|
+
throw new RaiseException(klass.getRuntime(), ((RubyModule)(((RubyModule)klass.getRuntime().getModule("OpenSSL")).getConstant("PKCS7"))).getClass("PKCS7Error"), null, false);
|
157
|
+
}
|
158
|
+
IRubyObject data = out[0] != null ? membio2str(klass.getRuntime(), out[0]) : klass.getRuntime().getNil();
|
159
|
+
PKCS7 ret = wrap(((RubyModule)(((RubyModule)klass.getRuntime().getModule("OpenSSL")).getConstant("PKCS7"))).getClass("PKCS7"), pkcs7);
|
160
|
+
ret.setData(data);
|
161
|
+
return ret;
|
162
|
+
}
|
163
|
+
|
164
|
+
@JRubyMethod(meta=true, rest=true)
|
165
|
+
public static IRubyObject write_smime(IRubyObject recv, IRubyObject[] args) {
|
166
|
+
System.err.println("WARNING: un-implemented method called PKCS7#write_smime");
|
167
|
+
return recv.getRuntime().getNil();
|
168
|
+
}
|
169
|
+
|
170
|
+
@JRubyMethod(meta=true, rest=true)
|
171
|
+
public static IRubyObject sign(IRubyObject recv, IRubyObject[] args) throws Exception {
|
172
|
+
Ruby runtime = recv.getRuntime();
|
173
|
+
IRubyObject cert = runtime.getNil();
|
174
|
+
IRubyObject key = runtime.getNil();
|
175
|
+
IRubyObject data = runtime.getNil();
|
176
|
+
IRubyObject certs = runtime.getNil();
|
177
|
+
IRubyObject flags = runtime.getNil();
|
178
|
+
|
179
|
+
switch(Arity.checkArgumentCount(runtime, args, 3, 5)) {
|
180
|
+
case 5:
|
181
|
+
flags = args[4];
|
182
|
+
case 4:
|
183
|
+
certs = args[3];
|
184
|
+
case 3:
|
185
|
+
cert = args[0];
|
186
|
+
key = args[1];
|
187
|
+
data = args[2];
|
188
|
+
}
|
189
|
+
|
190
|
+
X509AuxCertificate x509 = ((X509Cert)cert).getAuxCert();
|
191
|
+
PrivateKey pkey = ((PKey)key).getPrivateKey();
|
192
|
+
int flg = flags.isNil() ? 0 : RubyNumeric.fix2int(flags);
|
193
|
+
|
194
|
+
BIO in = obj2bio(data);
|
195
|
+
|
196
|
+
List<X509AuxCertificate> x509s = certs.isNil()
|
197
|
+
? null
|
198
|
+
: x509_ary2sk(certs);
|
199
|
+
|
200
|
+
org.jruby.ext.openssl.impl.PKCS7 p7 = org.jruby.ext.openssl.impl.PKCS7.sign(x509, pkey, x509s, in, flg);
|
201
|
+
PKCS7 ret = wrap(((RubyModule)(((RubyModule)recv.getRuntime().getModule("OpenSSL")).getConstant("PKCS7"))).getClass("PKCS7"), p7);
|
202
|
+
ret.setData(data);
|
203
|
+
|
204
|
+
return ret;
|
205
|
+
}
|
206
|
+
|
207
|
+
/** ossl_pkcs7_s_encrypt
|
208
|
+
*
|
209
|
+
*/
|
210
|
+
@JRubyMethod(meta=true, rest=true)
|
211
|
+
public static IRubyObject encrypt(IRubyObject recv, IRubyObject[] args) throws Exception {
|
212
|
+
IRubyObject certs, data, cipher = recv.getRuntime().getNil(), flags = recv.getRuntime().getNil();
|
213
|
+
javax.crypto.Cipher ciph = null;
|
214
|
+
switch(Arity.checkArgumentCount(recv.getRuntime(), args, 2, 4)) {
|
215
|
+
case 4:
|
216
|
+
flags = args[3];
|
217
|
+
case 3:
|
218
|
+
cipher = args[2];
|
219
|
+
}
|
220
|
+
data = args[1];
|
221
|
+
certs = args[0];
|
222
|
+
|
223
|
+
if(cipher.isNil()) {
|
224
|
+
ciph = javax.crypto.Cipher.getInstance("RC2/CBC/PKCS5Padding");
|
225
|
+
} else {
|
226
|
+
ciph = ((Cipher)cipher).getCipher();
|
227
|
+
}
|
228
|
+
|
229
|
+
int flg = flags.isNil() ? 0 : RubyNumeric.fix2int(flags);
|
230
|
+
byte[] in = data.convertToString().getBytes();
|
231
|
+
List<X509AuxCertificate> x509s = x509_ary2sk(certs);
|
232
|
+
org.jruby.ext.openssl.impl.PKCS7 p7 = org.jruby.ext.openssl.impl.PKCS7.encrypt(x509s, in, ciph, flg);
|
233
|
+
PKCS7 ret = wrap(((RubyModule)(((RubyModule)recv.getRuntime().getModule("OpenSSL")).getConstant("PKCS7"))).getClass("PKCS7"), p7);
|
234
|
+
ret.setData(data);
|
235
|
+
|
236
|
+
return ret;
|
237
|
+
}
|
238
|
+
}
|
239
|
+
|
240
|
+
public PKCS7(Ruby runtime, RubyClass type) {
|
241
|
+
super(runtime,type);
|
242
|
+
}
|
243
|
+
|
244
|
+
private org.jruby.ext.openssl.impl.PKCS7 p7;
|
245
|
+
|
246
|
+
public void setData(IRubyObject object) {
|
247
|
+
setInstanceVariable("@data", object);
|
248
|
+
}
|
249
|
+
|
250
|
+
public IRubyObject getData() {
|
251
|
+
return getInstanceVariable("@data");
|
252
|
+
}
|
253
|
+
|
254
|
+
@JRubyMethod(name="initialize", rest=true)
|
255
|
+
public IRubyObject _initialize(IRubyObject[] args) throws Exception {
|
256
|
+
IRubyObject arg = null;
|
257
|
+
if(Arity.checkArgumentCount(getRuntime(), args, 0, 1) == 0) {
|
258
|
+
return this;
|
259
|
+
}
|
260
|
+
arg = args[0];
|
261
|
+
|
262
|
+
arg = OpenSSLImpl.to_der_if_possible(arg);
|
263
|
+
BIO input = obj2bio(arg);
|
264
|
+
p7 = org.jruby.ext.openssl.impl.PKCS7.readPEM(input);
|
265
|
+
if(p7 == null) {
|
266
|
+
input.reset();
|
267
|
+
p7 = org.jruby.ext.openssl.impl.PKCS7.fromASN1(input);
|
268
|
+
}
|
269
|
+
|
270
|
+
setData(getRuntime().getNil());
|
271
|
+
return this;
|
272
|
+
}
|
273
|
+
|
274
|
+
@JRubyMethod
|
275
|
+
public IRubyObject initialize_copy(IRubyObject obj) {
|
276
|
+
System.err.println("WARNING: un.implemented method called PKCS7#init_copy");
|
277
|
+
return this;
|
278
|
+
}
|
279
|
+
|
280
|
+
@JRubyMethod(name="type=")
|
281
|
+
public IRubyObject set_type(IRubyObject obj) {
|
282
|
+
System.err.println("WARNING: un.implemented method called PKCS7#type=");
|
283
|
+
return getRuntime().getNil();
|
284
|
+
}
|
285
|
+
|
286
|
+
@JRubyMethod(name="type")
|
287
|
+
public IRubyObject get_type() {
|
288
|
+
if(p7.isSigned()) {
|
289
|
+
return getRuntime().newSymbol("signed");
|
290
|
+
}
|
291
|
+
if(p7.isEncrypted()) {
|
292
|
+
return getRuntime().newSymbol("encrypted");
|
293
|
+
}
|
294
|
+
if(p7.isEnveloped()) {
|
295
|
+
return getRuntime().newSymbol("enveloped");
|
296
|
+
}
|
297
|
+
if(p7.isSignedAndEnveloped()) {
|
298
|
+
return getRuntime().newSymbol("signedAndEnveloped");
|
299
|
+
}
|
300
|
+
if(p7.isData()) {
|
301
|
+
return getRuntime().newSymbol("data");
|
302
|
+
}
|
303
|
+
return getRuntime().getNil();
|
304
|
+
}
|
305
|
+
|
306
|
+
@JRubyMethod(name="detached=")
|
307
|
+
public IRubyObject set_detached(IRubyObject obj) {
|
308
|
+
System.err.println("WARNING: un.implemented method called PKCS7#detached=");
|
309
|
+
return getRuntime().getNil();
|
310
|
+
}
|
311
|
+
|
312
|
+
@JRubyMethod
|
313
|
+
public IRubyObject detached() {
|
314
|
+
System.err.println("WARNING: un.implemented method called PKCS7#detached");
|
315
|
+
return getRuntime().getNil();
|
316
|
+
}
|
317
|
+
|
318
|
+
@JRubyMethod(name="detached?")
|
319
|
+
public IRubyObject detached_p() {
|
320
|
+
System.err.println("WARNING: un.implemented method called PKCS7#detached?");
|
321
|
+
return getRuntime().getNil();
|
322
|
+
}
|
323
|
+
|
324
|
+
@JRubyMethod(name="cipher=")
|
325
|
+
public IRubyObject set_cipher(IRubyObject obj) {
|
326
|
+
System.err.println("WARNING: un.implemented method called PKCS7#cipher=");
|
327
|
+
return getRuntime().getNil();
|
328
|
+
}
|
329
|
+
|
330
|
+
@JRubyMethod
|
331
|
+
public IRubyObject add_signer(IRubyObject obj) {
|
332
|
+
SignerInfoWithPkey p7si = ((SignerInfo)obj).getSignerInfo().dup();
|
333
|
+
|
334
|
+
p7.addSigner(p7si);
|
335
|
+
// TODO: Handle exception here
|
336
|
+
|
337
|
+
if(p7.isSigned()) {
|
338
|
+
p7si.addSignedAttribute(ASN1Registry.NID_pkcs9_contentType, ASN1Registry.nid2obj(ASN1Registry.NID_pkcs7_data));
|
339
|
+
}
|
340
|
+
|
341
|
+
return this;
|
342
|
+
}
|
343
|
+
|
344
|
+
/** ossl_pkcs7_get_signer
|
345
|
+
*
|
346
|
+
* This seems to return a list of SignerInfo objects.
|
347
|
+
*
|
348
|
+
*/
|
349
|
+
@JRubyMethod
|
350
|
+
public IRubyObject signers() {
|
351
|
+
Collection<SignerInfoWithPkey> sk = p7.getSignerInfo();
|
352
|
+
RubyArray ary = getRuntime().newArray(sk.size());
|
353
|
+
for(SignerInfoWithPkey si : sk) {
|
354
|
+
ary.append(SignerInfo.create(getRuntime(), si));
|
355
|
+
}
|
356
|
+
return ary;
|
357
|
+
}
|
358
|
+
|
359
|
+
@JRubyMethod
|
360
|
+
public IRubyObject add_recipient(IRubyObject obj) {
|
361
|
+
System.err.println("WARNING: un.implemented method called PKCS7#add_recipient");
|
362
|
+
return getRuntime().getNil();
|
363
|
+
}
|
364
|
+
|
365
|
+
@JRubyMethod
|
366
|
+
public IRubyObject recipients() {
|
367
|
+
Collection<RecipInfo> sk = null;
|
368
|
+
|
369
|
+
if(p7.isEnveloped()) {
|
370
|
+
sk = p7.getEnveloped().getRecipientInfo();
|
371
|
+
} else if(p7.isSignedAndEnveloped()) {
|
372
|
+
sk = p7.getSignedAndEnveloped().getRecipientInfo();
|
373
|
+
} else {
|
374
|
+
sk = null;
|
375
|
+
}
|
376
|
+
if(sk == null) {
|
377
|
+
return getRuntime().newArray();
|
378
|
+
}
|
379
|
+
|
380
|
+
RubyArray ary = getRuntime().newArray(sk.size());
|
381
|
+
for(RecipInfo ri : sk) {
|
382
|
+
ary.append(RecipientInfo.create(getRuntime(), ri));
|
383
|
+
}
|
384
|
+
return ary;
|
385
|
+
}
|
386
|
+
|
387
|
+
@JRubyMethod
|
388
|
+
public IRubyObject add_certificate(IRubyObject obj) {
|
389
|
+
p7.addCertificate(((X509Cert)obj).getAuxCert());
|
390
|
+
return this;
|
391
|
+
}
|
392
|
+
|
393
|
+
@JRubyMethod(name="certificates=")
|
394
|
+
public IRubyObject set_certificates(IRubyObject obj) {
|
395
|
+
System.err.println("WARNING: un.implemented method called PKCS7#certificates=");
|
396
|
+
return getRuntime().getNil();
|
397
|
+
}
|
398
|
+
|
399
|
+
private Collection<X509AuxCertificate> getCertificates() {
|
400
|
+
Collection<X509AuxCertificate> certs;
|
401
|
+
int i = p7.getType();
|
402
|
+
switch(i) {
|
403
|
+
case ASN1Registry.NID_pkcs7_signed:
|
404
|
+
certs = p7.getSign().getCert();
|
405
|
+
break;
|
406
|
+
case ASN1Registry.NID_pkcs7_signedAndEnveloped:
|
407
|
+
certs = p7.getSignedAndEnveloped().getCert();
|
408
|
+
break;
|
409
|
+
default:
|
410
|
+
certs = new HashSet<X509AuxCertificate>();
|
411
|
+
break;
|
412
|
+
}
|
413
|
+
return certs;
|
414
|
+
}
|
415
|
+
|
416
|
+
private RubyArray certsToArray(Collection<X509AuxCertificate> certs) throws Exception {
|
417
|
+
RubyArray ary = getRuntime().newArray(certs.size());
|
418
|
+
for(X509AuxCertificate x509 : certs) {
|
419
|
+
ary.append(X509Cert.wrap(getRuntime(), x509));
|
420
|
+
}
|
421
|
+
return ary;
|
422
|
+
}
|
423
|
+
|
424
|
+
@JRubyMethod
|
425
|
+
public IRubyObject certificates() throws Exception {
|
426
|
+
return certsToArray(getCertificates());
|
427
|
+
}
|
428
|
+
|
429
|
+
@JRubyMethod
|
430
|
+
public IRubyObject add_crl(IRubyObject obj) {
|
431
|
+
System.err.println("WARNING: un.implemented method called PKCS7#add_crl");
|
432
|
+
return getRuntime().getNil();
|
433
|
+
}
|
434
|
+
|
435
|
+
@JRubyMethod(name="crls=")
|
436
|
+
public IRubyObject set_crls(IRubyObject obj) {
|
437
|
+
System.err.println("WARNING: un.implemented method called PKCS7#crls=");
|
438
|
+
return getRuntime().getNil();
|
439
|
+
}
|
440
|
+
|
441
|
+
@JRubyMethod
|
442
|
+
public IRubyObject crls() {
|
443
|
+
System.err.println("WARNING: un.implemented method called PKCS7#crls");
|
444
|
+
return getRuntime().getNil();
|
445
|
+
}
|
446
|
+
|
447
|
+
@JRubyMethod(name={"add_data", "data="})
|
448
|
+
public IRubyObject add_data(IRubyObject obj) {
|
449
|
+
System.err.println("WARNING: un.implemented method called PKCS7#add_data");
|
450
|
+
return getRuntime().getNil();
|
451
|
+
}
|
452
|
+
|
453
|
+
@JRubyMethod(rest=true)
|
454
|
+
public IRubyObject verify(IRubyObject[] args) throws Exception {
|
455
|
+
IRubyObject certs = null;
|
456
|
+
IRubyObject store = null;
|
457
|
+
IRubyObject indata = getRuntime().getNil();
|
458
|
+
IRubyObject flags = getRuntime().getNil();
|
459
|
+
|
460
|
+
switch(Arity.checkArgumentCount(getRuntime(), args, 2, 4)) {
|
461
|
+
case 4:
|
462
|
+
flags = args[3];
|
463
|
+
case 3:
|
464
|
+
indata = args[2];
|
465
|
+
default:
|
466
|
+
store = args[1];
|
467
|
+
certs = args[0];
|
468
|
+
}
|
469
|
+
int flg = flags.isNil() ? 0 : RubyNumeric.fix2int(flags);
|
470
|
+
|
471
|
+
if(indata.isNil()) {
|
472
|
+
indata = getData();
|
473
|
+
}
|
474
|
+
|
475
|
+
BIO in = indata.isNil() ? null : obj2bio(indata);
|
476
|
+
|
477
|
+
List<X509AuxCertificate> x509s = certs.isNil()
|
478
|
+
? null
|
479
|
+
: x509_ary2sk(certs);
|
480
|
+
|
481
|
+
Store x509st = ((X509Store)store).getStore();
|
482
|
+
BIO out = BIO.mem();
|
483
|
+
|
484
|
+
boolean result = false;
|
485
|
+
try {
|
486
|
+
p7.verify(x509s, x509st, in, out, flg);
|
487
|
+
result = true;
|
488
|
+
} catch(NotVerifiedPKCS7Exception e) {
|
489
|
+
result = false;
|
490
|
+
} catch(PKCS7Exception e) {
|
491
|
+
System.err.println(e.toString());
|
492
|
+
e.printStackTrace();
|
493
|
+
// TODO: throw exception if it's a bad thingy here
|
494
|
+
result = false;
|
495
|
+
}
|
496
|
+
|
497
|
+
IRubyObject data = membio2str(getRuntime(), out);
|
498
|
+
setData(data);
|
499
|
+
|
500
|
+
return result ? getRuntime().getTrue() : getRuntime().getFalse();
|
501
|
+
}
|
502
|
+
|
503
|
+
@JRubyMethod(rest=true)
|
504
|
+
public IRubyObject decrypt(IRubyObject[] args) {
|
505
|
+
IRubyObject flags = getRuntime().getNil();
|
506
|
+
if(Arity.checkArgumentCount(getRuntime(), args, 2, 3) == 3) {
|
507
|
+
flags = args[2];
|
508
|
+
}
|
509
|
+
IRubyObject pkey = args[0];
|
510
|
+
IRubyObject cert = args[1];
|
511
|
+
PrivateKey key = ((PKey)pkey).getPrivateKey();
|
512
|
+
X509AuxCertificate x509 = ((X509Cert)cert).getAuxCert();
|
513
|
+
int flg = flags.isNil() ? 0 : RubyNumeric.fix2int(flags);
|
514
|
+
|
515
|
+
BIO out = BIO.mem();
|
516
|
+
p7.decrypt(key, x509, out, flg);
|
517
|
+
|
518
|
+
return membio2str(getRuntime(), out);
|
519
|
+
}
|
520
|
+
|
521
|
+
@JRubyMethod(name={"to_pem","to_s"})
|
522
|
+
public IRubyObject to_pem() throws Exception {
|
523
|
+
System.err.println("WARNING: un-implemented method called PKCS7#to_pem");
|
524
|
+
return getRuntime().getNil();
|
525
|
+
}
|
526
|
+
|
527
|
+
@JRubyMethod
|
528
|
+
public IRubyObject to_der() throws IOException {
|
529
|
+
return getRuntime().newString(new ByteList(p7.toASN1(), false));
|
530
|
+
}
|
531
|
+
|
532
|
+
public static class SignerInfo extends RubyObject {
|
533
|
+
private static ObjectAllocator SIGNERINFO_ALLOCATOR = new ObjectAllocator() {
|
534
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klass) {
|
535
|
+
return new SignerInfo(runtime, klass);
|
536
|
+
}
|
537
|
+
};
|
538
|
+
|
539
|
+
public static void createSignerInfo(Ruby runtime, RubyModule mPKCS7) {
|
540
|
+
RubyClass cPKCS7Signer = mPKCS7.defineClassUnder("SignerInfo",runtime.getObject(),SIGNERINFO_ALLOCATOR);
|
541
|
+
mPKCS7.defineConstant("Signer",cPKCS7Signer);
|
542
|
+
|
543
|
+
cPKCS7Signer.defineAnnotatedMethods(SignerInfo.class);
|
544
|
+
}
|
545
|
+
|
546
|
+
public static SignerInfo create(Ruby runtime, SignerInfoWithPkey info) {
|
547
|
+
SignerInfo sinfo = new SignerInfo(runtime, (RubyClass)(((RubyModule)(runtime.getModule("OpenSSL").getConstant("PKCS7"))).getConstant("SignerInfo")));
|
548
|
+
sinfo.initWithSignerInformation(info);
|
549
|
+
return sinfo;
|
550
|
+
}
|
551
|
+
|
552
|
+
public SignerInfo(Ruby runtime, RubyClass type) {
|
553
|
+
super(runtime,type);
|
554
|
+
}
|
555
|
+
|
556
|
+
private SignerInfoWithPkey info;
|
557
|
+
|
558
|
+
private void initWithSignerInformation(SignerInfoWithPkey info) {
|
559
|
+
this.info = info;
|
560
|
+
}
|
561
|
+
|
562
|
+
SignerInfoWithPkey getSignerInfo() {
|
563
|
+
return info;
|
564
|
+
}
|
565
|
+
|
566
|
+
@JRubyMethod
|
567
|
+
public IRubyObject initialize(IRubyObject arg1, IRubyObject arg2, IRubyObject arg3) {
|
568
|
+
System.err.println("WARNING: un-implemented method called SignerInfo#initialize");
|
569
|
+
return this;
|
570
|
+
}
|
571
|
+
|
572
|
+
|
573
|
+
@JRubyMethod(name={"issuer","name"})
|
574
|
+
public IRubyObject issuer() {
|
575
|
+
return X509Name.create(getRuntime(), info.getIssuerAndSerialNumber().getName());
|
576
|
+
}
|
577
|
+
|
578
|
+
@JRubyMethod
|
579
|
+
public IRubyObject serial() {
|
580
|
+
return RubyBignum.bignorm(getRuntime(), info.getIssuerAndSerialNumber().getCertificateSerialNumber().getValue());
|
581
|
+
}
|
582
|
+
|
583
|
+
@JRubyMethod
|
584
|
+
public IRubyObject signed_time() {
|
585
|
+
System.err.println("WARNING: un-implemented method called SignerInfo#signed_time");
|
586
|
+
return getRuntime().getNil();
|
587
|
+
}
|
588
|
+
}
|
589
|
+
|
590
|
+
public static class RecipientInfo extends RubyObject {
|
591
|
+
private static ObjectAllocator RECIPIENTINFO_ALLOCATOR = new ObjectAllocator() {
|
592
|
+
public IRubyObject allocate(Ruby runtime, RubyClass klass) {
|
593
|
+
return new RecipientInfo(runtime, klass);
|
594
|
+
}
|
595
|
+
};
|
596
|
+
|
597
|
+
public static void createRecipientInfo(Ruby runtime, RubyModule mPKCS7) {
|
598
|
+
RubyClass cPKCS7Recipient = mPKCS7.defineClassUnder("RecipientInfo",runtime.getObject(),RECIPIENTINFO_ALLOCATOR);
|
599
|
+
|
600
|
+
cPKCS7Recipient.defineAnnotatedMethods(RecipientInfo.class);
|
601
|
+
}
|
602
|
+
|
603
|
+
public RecipientInfo(Ruby runtime, RubyClass type) {
|
604
|
+
super(runtime,type);
|
605
|
+
}
|
606
|
+
|
607
|
+
|
608
|
+
public static RecipientInfo create(Ruby runtime, RecipInfo info) {
|
609
|
+
RecipientInfo rinfo = new RecipientInfo(runtime, (RubyClass)(((RubyModule)(runtime.getModule("OpenSSL").getConstant("PKCS7"))).getConstant("RecipientInfo")));
|
610
|
+
rinfo.initWithRecipientInformation(info);
|
611
|
+
return rinfo;
|
612
|
+
}
|
613
|
+
|
614
|
+
private RecipInfo info;
|
615
|
+
|
616
|
+
private void initWithRecipientInformation(RecipInfo info) {
|
617
|
+
this.info = info;
|
618
|
+
}
|
619
|
+
|
620
|
+
@JRubyMethod
|
621
|
+
public IRubyObject initialize(IRubyObject arg) {
|
622
|
+
System.err.println("WARNING: un-implemented method called RecipientInfo#initialize");
|
623
|
+
return this;
|
624
|
+
}
|
625
|
+
|
626
|
+
@JRubyMethod
|
627
|
+
public IRubyObject issuer() {
|
628
|
+
return X509Name.create(getRuntime(), info.getIssuerAndSerial().getName());
|
629
|
+
}
|
630
|
+
|
631
|
+
@JRubyMethod
|
632
|
+
public IRubyObject serial() {
|
633
|
+
return RubyBignum.bignorm(getRuntime(), info.getIssuerAndSerial().getCertificateSerialNumber().getValue());
|
634
|
+
}
|
635
|
+
|
636
|
+
@JRubyMethod
|
637
|
+
public IRubyObject enc_key() {
|
638
|
+
System.err.println("WARNING: un-implemented method called RecipientInfo#enc_key");
|
639
|
+
return getRuntime().getNil();
|
640
|
+
}
|
641
|
+
}
|
642
|
+
}// PKCS7
|