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,377 @@
|
|
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.x509store;
|
29
|
+
|
30
|
+
import java.io.FileNotFoundException;
|
31
|
+
import java.security.cert.X509Certificate;
|
32
|
+
|
33
|
+
import java.util.ArrayList;
|
34
|
+
import java.util.List;
|
35
|
+
|
36
|
+
import javax.net.ssl.X509TrustManager;
|
37
|
+
|
38
|
+
/**
|
39
|
+
* c: X509_STORE
|
40
|
+
*
|
41
|
+
* @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
|
42
|
+
*/
|
43
|
+
public class Store implements X509TrustManager {
|
44
|
+
public int cache;
|
45
|
+
public List<X509Object> objs;
|
46
|
+
public List<Lookup> certificateMethods;
|
47
|
+
public VerifyParameter param;
|
48
|
+
|
49
|
+
public static interface VerifyFunction extends Function1 {
|
50
|
+
public static final VerifyFunction EMPTY = new VerifyFunction(){
|
51
|
+
public int call(Object arg0) {
|
52
|
+
return -1;
|
53
|
+
}
|
54
|
+
};
|
55
|
+
}
|
56
|
+
public static interface VerifyCallbackFunction extends Function2 {
|
57
|
+
public static final VerifyCallbackFunction EMPTY = new VerifyCallbackFunction(){
|
58
|
+
public int call(Object arg0, Object arg1) {
|
59
|
+
return -1;
|
60
|
+
}
|
61
|
+
};
|
62
|
+
}
|
63
|
+
public static interface GetIssuerFunction extends Function3 {
|
64
|
+
public static final GetIssuerFunction EMPTY = new GetIssuerFunction(){
|
65
|
+
public int call(Object arg0, Object arg1, Object arg2) {
|
66
|
+
return -1;
|
67
|
+
}
|
68
|
+
};
|
69
|
+
}
|
70
|
+
public static interface CheckIssuedFunction extends Function3 {
|
71
|
+
public static final CheckIssuedFunction EMPTY = new CheckIssuedFunction(){
|
72
|
+
public int call(Object arg0, Object arg1, Object arg2) {
|
73
|
+
return -1;
|
74
|
+
}
|
75
|
+
};
|
76
|
+
}
|
77
|
+
public static interface CheckRevocationFunction extends Function1 {
|
78
|
+
public static final CheckRevocationFunction EMPTY = new CheckRevocationFunction(){
|
79
|
+
public int call(Object arg0) {
|
80
|
+
return -1;
|
81
|
+
}
|
82
|
+
};
|
83
|
+
}
|
84
|
+
public static interface GetCRLFunction extends Function3 {
|
85
|
+
public static final GetCRLFunction EMPTY = new GetCRLFunction(){
|
86
|
+
public int call(Object arg0, Object arg1, Object arg2) {
|
87
|
+
return -1;
|
88
|
+
}
|
89
|
+
};
|
90
|
+
}
|
91
|
+
public static interface CheckCRLFunction extends Function2 {
|
92
|
+
public static final CheckCRLFunction EMPTY = new CheckCRLFunction(){
|
93
|
+
public int call(Object arg0, Object arg1) {
|
94
|
+
return -1;
|
95
|
+
}
|
96
|
+
};
|
97
|
+
}
|
98
|
+
public static interface CertificateCRLFunction extends Function3 {
|
99
|
+
public static final CertificateCRLFunction EMPTY = new CertificateCRLFunction(){
|
100
|
+
public int call(Object arg0, Object arg1, Object arg2) {
|
101
|
+
return -1;
|
102
|
+
}
|
103
|
+
};
|
104
|
+
}
|
105
|
+
public static interface CleanupFunction extends Function1 {
|
106
|
+
public static final CleanupFunction EMPTY = new CleanupFunction(){
|
107
|
+
public int call(Object arg0) {
|
108
|
+
return -1;
|
109
|
+
}
|
110
|
+
};
|
111
|
+
}
|
112
|
+
|
113
|
+
public VerifyFunction verify;
|
114
|
+
public VerifyCallbackFunction verifyCallback;
|
115
|
+
public GetIssuerFunction getIssuer;
|
116
|
+
public CheckIssuedFunction checkIssued;
|
117
|
+
public CheckRevocationFunction checkRevocation;
|
118
|
+
public GetCRLFunction getCRL;
|
119
|
+
public CheckCRLFunction checkCRL;
|
120
|
+
public CertificateCRLFunction certificateCRL;
|
121
|
+
public CleanupFunction cleanup;
|
122
|
+
|
123
|
+
public List<Object> extraData;
|
124
|
+
public int references;
|
125
|
+
|
126
|
+
/**
|
127
|
+
* c: X509_STORE_new
|
128
|
+
*/
|
129
|
+
public Store() {
|
130
|
+
objs = new ArrayList<X509Object>();
|
131
|
+
cache = 1;
|
132
|
+
certificateMethods = new ArrayList<Lookup>();
|
133
|
+
|
134
|
+
verify = VerifyFunction.EMPTY;
|
135
|
+
verifyCallback = VerifyCallbackFunction.EMPTY;
|
136
|
+
|
137
|
+
param = new VerifyParameter();
|
138
|
+
|
139
|
+
getIssuer = GetIssuerFunction.EMPTY;
|
140
|
+
checkIssued = CheckIssuedFunction.EMPTY;
|
141
|
+
checkRevocation = CheckRevocationFunction.EMPTY;
|
142
|
+
getCRL = GetCRLFunction.EMPTY;
|
143
|
+
checkCRL = CheckCRLFunction.EMPTY;
|
144
|
+
certificateCRL = CertificateCRLFunction.EMPTY;
|
145
|
+
cleanup = CleanupFunction.EMPTY;
|
146
|
+
|
147
|
+
references = 1;
|
148
|
+
extraData = new ArrayList<Object>();
|
149
|
+
this.extraData.add(null);this.extraData.add(null);this.extraData.add(null);
|
150
|
+
this.extraData.add(null);this.extraData.add(null);this.extraData.add(null);
|
151
|
+
this.extraData.add(null);this.extraData.add(null);this.extraData.add(null);
|
152
|
+
}
|
153
|
+
|
154
|
+
/**
|
155
|
+
* c: X509_STORE_set_verify_func
|
156
|
+
*/
|
157
|
+
public void setVerifyFunction(VerifyFunction func) {
|
158
|
+
verify = func;
|
159
|
+
}
|
160
|
+
|
161
|
+
/**
|
162
|
+
* c: X509_STORE_set_verify_cb_func
|
163
|
+
*/
|
164
|
+
public void setVerifyCallbackFunction(VerifyCallbackFunction func) {
|
165
|
+
verifyCallback = func;
|
166
|
+
}
|
167
|
+
|
168
|
+
/**
|
169
|
+
* c: X509_STORE_free
|
170
|
+
*/
|
171
|
+
public void free() throws Exception {
|
172
|
+
for(Lookup lu : certificateMethods) {
|
173
|
+
lu.shutdown();
|
174
|
+
lu.free();
|
175
|
+
}
|
176
|
+
if(param != null) {
|
177
|
+
param.free();
|
178
|
+
}
|
179
|
+
}
|
180
|
+
|
181
|
+
/**
|
182
|
+
* c: X509_set_ex_data
|
183
|
+
*/
|
184
|
+
public int setExtraData(int idx,Object data) {
|
185
|
+
extraData.set(idx,data);
|
186
|
+
return 1;
|
187
|
+
}
|
188
|
+
|
189
|
+
/**
|
190
|
+
* c: X509_get_ex_data
|
191
|
+
*/
|
192
|
+
public Object getExtraData(int idx) {
|
193
|
+
return extraData.get(idx);
|
194
|
+
}
|
195
|
+
|
196
|
+
/**
|
197
|
+
* c: X509_STORE_set_depth
|
198
|
+
*/
|
199
|
+
public int setDepth(int depth) {
|
200
|
+
param.setDepth(depth);
|
201
|
+
return 1;
|
202
|
+
}
|
203
|
+
|
204
|
+
/**
|
205
|
+
* c: X509_STORE_set_flags
|
206
|
+
*/
|
207
|
+
public int setFlags(long flags) {
|
208
|
+
return param.setFlags(flags);
|
209
|
+
}
|
210
|
+
|
211
|
+
/**
|
212
|
+
* c: X509_STORE_set_purpose
|
213
|
+
*/
|
214
|
+
public int setPurpose(int purpose) {
|
215
|
+
return param.setPurpose(purpose);
|
216
|
+
}
|
217
|
+
|
218
|
+
/**
|
219
|
+
* c: X509_STORE_set_trust
|
220
|
+
*/
|
221
|
+
public int setTrust(int trust) {
|
222
|
+
return param.setTrust(trust);
|
223
|
+
}
|
224
|
+
|
225
|
+
/**
|
226
|
+
* c: X509_STORE_set1_param
|
227
|
+
*/
|
228
|
+
public int setParam(VerifyParameter pm) {
|
229
|
+
return param.set(param);
|
230
|
+
}
|
231
|
+
|
232
|
+
/**
|
233
|
+
* c: X509_STORE_add_lookup
|
234
|
+
*/
|
235
|
+
public Lookup addLookup(LookupMethod m) throws Exception {
|
236
|
+
Lookup lu;
|
237
|
+
|
238
|
+
for(Lookup l : certificateMethods) {
|
239
|
+
if(l.equals(m)) {
|
240
|
+
return l;
|
241
|
+
}
|
242
|
+
}
|
243
|
+
lu = new Lookup(m);
|
244
|
+
lu.store = this;
|
245
|
+
certificateMethods.add(lu);
|
246
|
+
return lu;
|
247
|
+
}
|
248
|
+
|
249
|
+
/**
|
250
|
+
* c: X509_STORE_add_cert
|
251
|
+
*/
|
252
|
+
public int addCertificate(X509Certificate x) {
|
253
|
+
int ret = 1;
|
254
|
+
if(x == null) {
|
255
|
+
return 0;
|
256
|
+
}
|
257
|
+
|
258
|
+
Certificate obj = new Certificate();
|
259
|
+
obj.x509 = StoreContext.ensureAux(x);
|
260
|
+
|
261
|
+
synchronized(X509Utils.CRYPTO_LOCK_X509_STORE) {
|
262
|
+
if(X509Object.retrieveMatch(objs,obj) != null) {
|
263
|
+
X509Error.addError(X509Utils.X509_R_CERT_ALREADY_IN_HASH_TABLE);
|
264
|
+
ret=0;
|
265
|
+
} else {
|
266
|
+
objs.add(obj);
|
267
|
+
}
|
268
|
+
}
|
269
|
+
return ret;
|
270
|
+
}
|
271
|
+
|
272
|
+
/**
|
273
|
+
* c: X509_STORE_add_crl
|
274
|
+
*/
|
275
|
+
public int addCRL(java.security.cert.CRL x) {
|
276
|
+
int ret = 1;
|
277
|
+
if(null == x) {
|
278
|
+
return 0;
|
279
|
+
}
|
280
|
+
CRL obj = new CRL();
|
281
|
+
obj.crl = x;
|
282
|
+
|
283
|
+
synchronized(X509Utils.CRYPTO_LOCK_X509_STORE) {
|
284
|
+
if(X509Object.retrieveMatch(objs,obj) != null) {
|
285
|
+
X509Error.addError(X509Utils.X509_R_CERT_ALREADY_IN_HASH_TABLE);
|
286
|
+
ret=0;
|
287
|
+
} else {
|
288
|
+
objs.add(obj);
|
289
|
+
}
|
290
|
+
}
|
291
|
+
return ret;
|
292
|
+
}
|
293
|
+
|
294
|
+
/**
|
295
|
+
* c: X509_STORE_load_locations
|
296
|
+
*/
|
297
|
+
public int loadLocations(String file, String path) throws Exception {
|
298
|
+
Lookup lookup;
|
299
|
+
|
300
|
+
if(file != null) {
|
301
|
+
lookup = addLookup(Lookup.fileLookup());
|
302
|
+
if(lookup == null) {
|
303
|
+
return 0;
|
304
|
+
}
|
305
|
+
if(lookup.loadFile(new CertificateFile.Path(file,X509Utils.X509_FILETYPE_PEM)) != 1) {
|
306
|
+
return 0;
|
307
|
+
}
|
308
|
+
}
|
309
|
+
|
310
|
+
if(path != null) {
|
311
|
+
lookup = addLookup(Lookup.hashDirLookup());
|
312
|
+
if(lookup == null) {
|
313
|
+
return 0;
|
314
|
+
}
|
315
|
+
if(lookup.addDir(new CertificateHashDir.Dir(path,X509Utils.X509_FILETYPE_PEM)) != 1) {
|
316
|
+
return 0;
|
317
|
+
}
|
318
|
+
}
|
319
|
+
if((path == null) && (file == null)) {
|
320
|
+
return 0;
|
321
|
+
}
|
322
|
+
|
323
|
+
return 1;
|
324
|
+
}
|
325
|
+
|
326
|
+
/**
|
327
|
+
* c: X509_STORE_set_default_paths
|
328
|
+
* not used for now: invoking this method causes refering System.getenv("SSL_CERT_DIR") etc.
|
329
|
+
* We need to get the dir via evaluating "ENV['SSL_CERT_DIR']" instead of it.
|
330
|
+
*/
|
331
|
+
public int setDefaultPaths() throws Exception {
|
332
|
+
Lookup lookup;
|
333
|
+
|
334
|
+
lookup = addLookup(Lookup.fileLookup());
|
335
|
+
if(lookup == null) {
|
336
|
+
return 0;
|
337
|
+
}
|
338
|
+
try {
|
339
|
+
lookup.loadFile(new CertificateFile.Path(null,X509Utils.X509_FILETYPE_DEFAULT));
|
340
|
+
}
|
341
|
+
catch(FileNotFoundException e) {
|
342
|
+
// set_default_paths ignores FileNotFound
|
343
|
+
}
|
344
|
+
|
345
|
+
lookup = addLookup(Lookup.hashDirLookup());
|
346
|
+
if(lookup == null) {
|
347
|
+
return 0;
|
348
|
+
}
|
349
|
+
try {
|
350
|
+
lookup.addDir(new CertificateHashDir.Dir(null,X509Utils.X509_FILETYPE_DEFAULT));
|
351
|
+
}
|
352
|
+
catch(FileNotFoundException e) {
|
353
|
+
// set_default_paths ignores FileNotFound
|
354
|
+
}
|
355
|
+
|
356
|
+
X509Error.clearErrors();
|
357
|
+
|
358
|
+
return 1;
|
359
|
+
}
|
360
|
+
|
361
|
+
|
362
|
+
public void checkClientTrusted(X509Certificate[] chain, String authType) {
|
363
|
+
}
|
364
|
+
|
365
|
+
public void checkServerTrusted(X509Certificate[] chain, String authType) {
|
366
|
+
}
|
367
|
+
|
368
|
+
public X509Certificate[] getAcceptedIssuers() {
|
369
|
+
List<X509Certificate> l = new ArrayList<X509Certificate>();
|
370
|
+
for(X509Object o : objs) {
|
371
|
+
if(o instanceof Certificate) {
|
372
|
+
l.add(((Certificate)o).x509);
|
373
|
+
}
|
374
|
+
}
|
375
|
+
return (X509Certificate[])l.toArray(new X509Certificate[l.size()]);
|
376
|
+
}
|
377
|
+
}// X509_STORE
|
@@ -0,0 +1,1356 @@
|
|
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.x509store;
|
29
|
+
|
30
|
+
import java.security.PublicKey;
|
31
|
+
import java.security.cert.X509CRL;
|
32
|
+
import java.security.cert.X509Certificate;
|
33
|
+
import java.security.cert.X509Extension;
|
34
|
+
|
35
|
+
import java.util.Calendar;
|
36
|
+
import java.util.Collection;
|
37
|
+
import java.util.Date;
|
38
|
+
import java.util.ArrayList;
|
39
|
+
import java.util.List;
|
40
|
+
import java.util.Set;
|
41
|
+
import java.util.HashSet;
|
42
|
+
|
43
|
+
import org.bouncycastle.asn1.ASN1InputStream;
|
44
|
+
import org.bouncycastle.asn1.DERSequence;
|
45
|
+
import org.bouncycastle.asn1.DERInteger;
|
46
|
+
|
47
|
+
import org.jruby.ext.openssl.OpenSSLReal;
|
48
|
+
|
49
|
+
/**
|
50
|
+
* c: X509_STORE_CTX
|
51
|
+
*
|
52
|
+
* @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
|
53
|
+
*/
|
54
|
+
public class StoreContext {
|
55
|
+
public Store ctx;
|
56
|
+
public int currentMethod;
|
57
|
+
|
58
|
+
public X509AuxCertificate certificate;
|
59
|
+
public List<X509AuxCertificate> untrusted;
|
60
|
+
public List<X509CRL> crls;
|
61
|
+
|
62
|
+
public VerifyParameter param;
|
63
|
+
|
64
|
+
public List<X509AuxCertificate> otherContext;
|
65
|
+
|
66
|
+
public static interface CheckPolicyFunction extends Function1 {
|
67
|
+
public static final CheckPolicyFunction EMPTY = new CheckPolicyFunction(){
|
68
|
+
public int call(Object arg0) {
|
69
|
+
return -1;
|
70
|
+
}
|
71
|
+
};
|
72
|
+
}
|
73
|
+
|
74
|
+
public Store.VerifyFunction verify;
|
75
|
+
public Store.VerifyCallbackFunction verifyCallback;
|
76
|
+
public Store.GetIssuerFunction getIssuer;
|
77
|
+
public Store.CheckIssuedFunction checkIssued;
|
78
|
+
public Store.CheckRevocationFunction checkRevocation;
|
79
|
+
public Store.GetCRLFunction getCRL;
|
80
|
+
public Store.CheckCRLFunction checkCRL;
|
81
|
+
public Store.CertificateCRLFunction certificateCRL;
|
82
|
+
public CheckPolicyFunction checkPolicy;
|
83
|
+
public Store.CleanupFunction cleanup;
|
84
|
+
|
85
|
+
public boolean isValid;
|
86
|
+
public int lastUntrusted;
|
87
|
+
|
88
|
+
public List<X509AuxCertificate> chain; //List<X509AuxCertificate>
|
89
|
+
public PolicyTree tree;
|
90
|
+
|
91
|
+
public int explicitPolicy;
|
92
|
+
|
93
|
+
public int errorDepth;
|
94
|
+
public int error;
|
95
|
+
public X509AuxCertificate currentCertificate;
|
96
|
+
public X509AuxCertificate currentIssuer;
|
97
|
+
public java.security.cert.CRL currentCRL;
|
98
|
+
|
99
|
+
public List<Object> extraData;
|
100
|
+
|
101
|
+
/**
|
102
|
+
* c: X509_STORE_CTX_set_depth
|
103
|
+
*/
|
104
|
+
public void setDepth(int depth) {
|
105
|
+
param.setDepth(depth);
|
106
|
+
}
|
107
|
+
|
108
|
+
/**
|
109
|
+
* c: X509_STORE_CTX_set_app_data
|
110
|
+
*/
|
111
|
+
public void setApplicationData(Object data) {
|
112
|
+
setExtraData(0,data);
|
113
|
+
}
|
114
|
+
|
115
|
+
/**
|
116
|
+
* c: X509_STORE_CTX_get_app_data
|
117
|
+
*/
|
118
|
+
public Object getApplicationData() {
|
119
|
+
return getExtraData(0);
|
120
|
+
}
|
121
|
+
|
122
|
+
/**
|
123
|
+
* c: X509_STORE_CTX_get1_issuer
|
124
|
+
*/
|
125
|
+
public int getFirstIssuer(X509AuxCertificate[] issuer, X509AuxCertificate x) throws Exception {
|
126
|
+
Name xn = new Name(x.getIssuerX500Principal());
|
127
|
+
X509Object[] s_obj = new X509Object[1];
|
128
|
+
int ok = ctx == null ? 0 : getBySubject(X509Utils.X509_LU_X509,xn,s_obj);
|
129
|
+
if(ok != X509Utils.X509_LU_X509) {
|
130
|
+
if(ok == X509Utils.X509_LU_RETRY) {
|
131
|
+
X509Error.addError(X509Utils.X509_R_SHOULD_RETRY);
|
132
|
+
return -1;
|
133
|
+
} else if (ok != X509Utils.X509_LU_FAIL) {
|
134
|
+
return -1;
|
135
|
+
}
|
136
|
+
return 0;
|
137
|
+
}
|
138
|
+
X509Object obj = s_obj[0];
|
139
|
+
if(this.checkIssued.call(this,x,((Certificate)obj).x509) != 0) {
|
140
|
+
issuer[0] = ((Certificate)obj).x509;
|
141
|
+
return 1;
|
142
|
+
}
|
143
|
+
|
144
|
+
int idx = X509Object.indexBySubject(ctx.objs,X509Utils.X509_LU_X509, xn);
|
145
|
+
if(idx == -1) {
|
146
|
+
return 0;
|
147
|
+
}
|
148
|
+
|
149
|
+
/* Look through all matching certificates for a suitable issuer */
|
150
|
+
for(int i = idx; i < ctx.objs.size(); i++) {
|
151
|
+
X509Object pobj = (X509Object)ctx.objs.get(i);
|
152
|
+
if(pobj.type() != X509Utils.X509_LU_X509) {
|
153
|
+
return 0;
|
154
|
+
}
|
155
|
+
if(!xn.isEqual((((Certificate)pobj).x509).getSubjectX500Principal())) {
|
156
|
+
return 0;
|
157
|
+
}
|
158
|
+
if(this.checkIssued.call(this,x,((Certificate)pobj).x509) != 0) {
|
159
|
+
issuer[0] = ((Certificate)pobj).x509;
|
160
|
+
return 1;
|
161
|
+
}
|
162
|
+
}
|
163
|
+
return 0;
|
164
|
+
}
|
165
|
+
|
166
|
+
public static List<X509AuxCertificate> ensureAux(Collection inp) {
|
167
|
+
List<X509AuxCertificate> out = new ArrayList<X509AuxCertificate>();
|
168
|
+
for(Object o : inp) {
|
169
|
+
out.add(ensureAux((X509Certificate)o));
|
170
|
+
}
|
171
|
+
return out;
|
172
|
+
}
|
173
|
+
|
174
|
+
public static List<X509AuxCertificate> ensureAux(X509Certificate[] inp) {
|
175
|
+
List<X509AuxCertificate> o = new ArrayList<X509AuxCertificate>();
|
176
|
+
for(X509Certificate c : inp) {
|
177
|
+
o.add(ensureAux(c));
|
178
|
+
}
|
179
|
+
return o;
|
180
|
+
}
|
181
|
+
|
182
|
+
public static X509AuxCertificate ensureAux(X509Certificate i) {
|
183
|
+
if(i instanceof X509AuxCertificate) {
|
184
|
+
return (X509AuxCertificate)i;
|
185
|
+
} else {
|
186
|
+
return new X509AuxCertificate(i);
|
187
|
+
}
|
188
|
+
}
|
189
|
+
|
190
|
+
/**
|
191
|
+
* c: X509_STORE_CTX_init
|
192
|
+
*/
|
193
|
+
public int init(Store store, X509AuxCertificate x509, List<X509AuxCertificate> chain) {
|
194
|
+
int ret = 1;
|
195
|
+
this.ctx=store;
|
196
|
+
this.currentMethod=0;
|
197
|
+
this.certificate=x509;
|
198
|
+
this.untrusted=ensureAux(chain);
|
199
|
+
this.crls = null;
|
200
|
+
this.lastUntrusted=0;
|
201
|
+
this.otherContext = null;
|
202
|
+
this.isValid=false;
|
203
|
+
this.chain = null;
|
204
|
+
this.error=0;
|
205
|
+
this.explicitPolicy=0;
|
206
|
+
this.errorDepth=0;
|
207
|
+
this.currentCertificate=null;
|
208
|
+
this.currentIssuer=null;
|
209
|
+
this.tree = null;
|
210
|
+
|
211
|
+
this.param = new VerifyParameter();
|
212
|
+
|
213
|
+
if(store != null) {
|
214
|
+
ret = param.inherit(store.param);
|
215
|
+
} else {
|
216
|
+
param.flags |= X509Utils.X509_VP_FLAG_DEFAULT | X509Utils.X509_VP_FLAG_ONCE;
|
217
|
+
}
|
218
|
+
if(store != null) {
|
219
|
+
verifyCallback = store.verifyCallback;
|
220
|
+
cleanup = store.cleanup;
|
221
|
+
} else {
|
222
|
+
cleanup = Store.CleanupFunction.EMPTY;
|
223
|
+
}
|
224
|
+
|
225
|
+
if(ret != 0) {
|
226
|
+
ret = param.inherit(VerifyParameter.lookup("default"));
|
227
|
+
}
|
228
|
+
|
229
|
+
if(ret == 0) {
|
230
|
+
X509Error.addError(X509Utils.ERR_R_MALLOC_FAILURE);
|
231
|
+
return 0;
|
232
|
+
}
|
233
|
+
|
234
|
+
if(store != null && store.checkIssued != null && store.checkIssued != Store.CheckIssuedFunction.EMPTY) {
|
235
|
+
this.checkIssued = store.checkIssued;
|
236
|
+
} else {
|
237
|
+
this.checkIssued = defaultCheckIssued;
|
238
|
+
}
|
239
|
+
|
240
|
+
if(store != null && store.getIssuer != null && store.getIssuer != Store.GetIssuerFunction.EMPTY) {
|
241
|
+
this.getIssuer = store.getIssuer;
|
242
|
+
} else {
|
243
|
+
this.getIssuer = new Store.GetIssuerFunction() {
|
244
|
+
public int call(Object arg1, Object arg2, Object arg3) throws Exception {
|
245
|
+
return ((StoreContext)arg2).getFirstIssuer((X509AuxCertificate[])arg1,(X509AuxCertificate)arg3);
|
246
|
+
}
|
247
|
+
};
|
248
|
+
}
|
249
|
+
|
250
|
+
if(store != null && store.verifyCallback != null && store.verifyCallback != Store.VerifyCallbackFunction.EMPTY) {
|
251
|
+
this.verifyCallback = store.verifyCallback;
|
252
|
+
} else {
|
253
|
+
this.verifyCallback = NullCallback;
|
254
|
+
}
|
255
|
+
|
256
|
+
if(store != null && store.verify != null && store.verify != Store.VerifyFunction.EMPTY) {
|
257
|
+
this.verify = store.verify;
|
258
|
+
} else {
|
259
|
+
this.verify = internalVerify;
|
260
|
+
}
|
261
|
+
|
262
|
+
if(store != null && store.checkRevocation != null && store.checkRevocation != Store.CheckRevocationFunction.EMPTY) {
|
263
|
+
this.checkRevocation = store.checkRevocation;
|
264
|
+
} else {
|
265
|
+
this.checkRevocation = defaultCheckRevocation;
|
266
|
+
}
|
267
|
+
|
268
|
+
if(store != null && store.getCRL != null && store.getCRL != Store.GetCRLFunction.EMPTY) {
|
269
|
+
this.getCRL = store.getCRL;
|
270
|
+
} else {
|
271
|
+
this.getCRL = defaultGetCRL;
|
272
|
+
}
|
273
|
+
|
274
|
+
if(store != null && store.checkCRL != null && store.checkCRL != Store.CheckCRLFunction.EMPTY) {
|
275
|
+
this.checkCRL = store.checkCRL;
|
276
|
+
} else {
|
277
|
+
this.checkCRL = defaultCheckCRL;
|
278
|
+
}
|
279
|
+
|
280
|
+
if(store != null && store.certificateCRL != null && store.certificateCRL != Store.CertificateCRLFunction.EMPTY) {
|
281
|
+
this.certificateCRL = store.certificateCRL;
|
282
|
+
} else {
|
283
|
+
this.certificateCRL = defaultCertificateCRL;
|
284
|
+
}
|
285
|
+
|
286
|
+
this.checkPolicy = defaultCheckPolicy;
|
287
|
+
|
288
|
+
this.extraData = new ArrayList<Object>();
|
289
|
+
this.extraData.add(null);this.extraData.add(null);this.extraData.add(null);
|
290
|
+
this.extraData.add(null);this.extraData.add(null);this.extraData.add(null);
|
291
|
+
return 1;
|
292
|
+
}
|
293
|
+
|
294
|
+
/**
|
295
|
+
* c: X509_STORE_CTX_trusted_stack
|
296
|
+
*/
|
297
|
+
public void trustedStack(List<X509AuxCertificate> sk) {
|
298
|
+
otherContext = sk;
|
299
|
+
getIssuer = getIssuerStack;
|
300
|
+
}
|
301
|
+
|
302
|
+
/**
|
303
|
+
* c: X509_STORE_CTX_cleanup
|
304
|
+
*/
|
305
|
+
public void cleanup() throws Exception {
|
306
|
+
if(cleanup != null && cleanup != Store.CleanupFunction.EMPTY) {
|
307
|
+
cleanup.call(this);
|
308
|
+
}
|
309
|
+
param = null;
|
310
|
+
tree = null;
|
311
|
+
chain = null;
|
312
|
+
extraData = null;
|
313
|
+
}
|
314
|
+
|
315
|
+
/**
|
316
|
+
* c: find_issuer
|
317
|
+
*/
|
318
|
+
public X509AuxCertificate findIssuer(List<X509AuxCertificate> sk, X509AuxCertificate x) throws Exception {
|
319
|
+
for(X509AuxCertificate issuer : sk) {
|
320
|
+
if(checkIssued.call(this,x,issuer) != 0) {
|
321
|
+
return issuer;
|
322
|
+
}
|
323
|
+
}
|
324
|
+
return null;
|
325
|
+
}
|
326
|
+
|
327
|
+
/**
|
328
|
+
* c: X509_STORE_CTX_set_ex_data
|
329
|
+
*/
|
330
|
+
public int setExtraData(int idx,Object data) {
|
331
|
+
extraData.set(idx,data);
|
332
|
+
return 1;
|
333
|
+
}
|
334
|
+
|
335
|
+
/**
|
336
|
+
* c: X509_STORE_CTX_get_ex_data
|
337
|
+
*/
|
338
|
+
public Object getExtraData(int idx) {
|
339
|
+
return extraData.get(idx);
|
340
|
+
}
|
341
|
+
|
342
|
+
/**
|
343
|
+
* c: X509_STORE_CTX_get_error
|
344
|
+
*/
|
345
|
+
public int getError() {
|
346
|
+
return error;
|
347
|
+
}
|
348
|
+
|
349
|
+
/**
|
350
|
+
* c: X509_STORE_CTX_set_error
|
351
|
+
*/
|
352
|
+
public void setError(int s) {
|
353
|
+
this.error = s;
|
354
|
+
}
|
355
|
+
|
356
|
+
/**
|
357
|
+
* c: X509_STORE_CTX_get_error_depth
|
358
|
+
*/
|
359
|
+
public int getErrorDepth() {
|
360
|
+
return errorDepth;
|
361
|
+
}
|
362
|
+
|
363
|
+
/**
|
364
|
+
* c: X509_STORE_CTX_get_current_cert
|
365
|
+
*/
|
366
|
+
public X509AuxCertificate getCurrentCertificate() {
|
367
|
+
return currentCertificate;
|
368
|
+
}
|
369
|
+
|
370
|
+
/**
|
371
|
+
* c: X509_STORE_CTX_get_chain
|
372
|
+
*/
|
373
|
+
public List<X509AuxCertificate> getChain() {
|
374
|
+
return chain;
|
375
|
+
}
|
376
|
+
|
377
|
+
/**
|
378
|
+
* c: X509_STORE_CTX_get1_chain
|
379
|
+
*/
|
380
|
+
public List getFirstChain() {
|
381
|
+
if(null == chain) {
|
382
|
+
return null;
|
383
|
+
}
|
384
|
+
return new ArrayList<X509AuxCertificate>(chain);
|
385
|
+
}
|
386
|
+
|
387
|
+
/**
|
388
|
+
* c: X509_STORE_CTX_set_cert
|
389
|
+
*/
|
390
|
+
public void setCertificate(X509AuxCertificate x) {
|
391
|
+
this.certificate = x;
|
392
|
+
}
|
393
|
+
|
394
|
+
/**
|
395
|
+
* c: X509_STORE_CTX_set_chain
|
396
|
+
*/
|
397
|
+
public void setChain(List sk) {
|
398
|
+
this.untrusted = ensureAux(sk);
|
399
|
+
}
|
400
|
+
|
401
|
+
/**
|
402
|
+
* c: X509_STORE_CTX_set0_crls
|
403
|
+
*/
|
404
|
+
public void setCRLs(List<X509CRL> sk) {
|
405
|
+
this.crls = sk;
|
406
|
+
}
|
407
|
+
|
408
|
+
/**
|
409
|
+
* c: X509_STORE_CTX_set_purpose
|
410
|
+
*/
|
411
|
+
public int setPurpose(int purpose) {
|
412
|
+
return purposeInherit(0,purpose,0);
|
413
|
+
}
|
414
|
+
|
415
|
+
/**
|
416
|
+
* c: X509_STORE_CTX_set_trust
|
417
|
+
*/
|
418
|
+
public int setTrust(int trust) {
|
419
|
+
return purposeInherit(0,0,trust);
|
420
|
+
}
|
421
|
+
|
422
|
+
private void resetSettingsToWithoutStore() {
|
423
|
+
ctx = null;
|
424
|
+
this.param = new VerifyParameter();
|
425
|
+
this.param.flags |= X509Utils.X509_VP_FLAG_DEFAULT | X509Utils.X509_VP_FLAG_ONCE;
|
426
|
+
this.param.inherit(VerifyParameter.lookup("default"));
|
427
|
+
this.cleanup = Store.CleanupFunction.EMPTY;
|
428
|
+
this.checkIssued = defaultCheckIssued;
|
429
|
+
this.getIssuer = new Store.GetIssuerFunction() {
|
430
|
+
public int call(Object arg1, Object arg2, Object arg3) throws Exception {
|
431
|
+
return ((StoreContext)arg2).getFirstIssuer((X509AuxCertificate[])arg1,(X509AuxCertificate)arg3);
|
432
|
+
}
|
433
|
+
};
|
434
|
+
this.verifyCallback = NullCallback;
|
435
|
+
this.verify = internalVerify;
|
436
|
+
this.checkRevocation = defaultCheckRevocation;
|
437
|
+
this.getCRL = defaultGetCRL;
|
438
|
+
this.checkCRL = defaultCheckCRL;
|
439
|
+
this.certificateCRL = defaultCertificateCRL;
|
440
|
+
}
|
441
|
+
|
442
|
+
/**
|
443
|
+
* c: SSL_CTX_load_verify_locations
|
444
|
+
*/
|
445
|
+
public int loadVerifyLocations(String CAfile, String CApath) {
|
446
|
+
boolean reset = false;
|
447
|
+
try {
|
448
|
+
if(ctx == null) {
|
449
|
+
reset = true;
|
450
|
+
ctx = new Store();
|
451
|
+
this.param.inherit(ctx.param);
|
452
|
+
param.inherit(VerifyParameter.lookup("default"));
|
453
|
+
this.cleanup = ctx.cleanup;
|
454
|
+
if(ctx.checkIssued != null && ctx.checkIssued != Store.CheckIssuedFunction.EMPTY) {
|
455
|
+
this.checkIssued = ctx.checkIssued;
|
456
|
+
}
|
457
|
+
if(ctx.getIssuer != null && ctx.getIssuer != Store.GetIssuerFunction.EMPTY) {
|
458
|
+
this.getIssuer = ctx.getIssuer;
|
459
|
+
}
|
460
|
+
|
461
|
+
if(ctx.verifyCallback != null && ctx.verifyCallback != Store.VerifyCallbackFunction.EMPTY) {
|
462
|
+
this.verifyCallback = ctx.verifyCallback;
|
463
|
+
}
|
464
|
+
|
465
|
+
if(ctx.verify != null && ctx.verify != Store.VerifyFunction.EMPTY) {
|
466
|
+
this.verify = ctx.verify;
|
467
|
+
}
|
468
|
+
|
469
|
+
if(ctx.checkRevocation != null && ctx.checkRevocation != Store.CheckRevocationFunction.EMPTY) {
|
470
|
+
this.checkRevocation = ctx.checkRevocation;
|
471
|
+
}
|
472
|
+
|
473
|
+
if(ctx.getCRL != null && ctx.getCRL != Store.GetCRLFunction.EMPTY) {
|
474
|
+
this.getCRL = ctx.getCRL;
|
475
|
+
}
|
476
|
+
|
477
|
+
if(ctx.checkCRL != null && ctx.checkCRL != Store.CheckCRLFunction.EMPTY) {
|
478
|
+
this.checkCRL = ctx.checkCRL;
|
479
|
+
}
|
480
|
+
|
481
|
+
if(ctx.certificateCRL != null && ctx.certificateCRL != Store.CertificateCRLFunction.EMPTY) {
|
482
|
+
this.certificateCRL = ctx.certificateCRL;
|
483
|
+
}
|
484
|
+
}
|
485
|
+
|
486
|
+
int ret = ctx.loadLocations(CAfile, CApath);
|
487
|
+
if(ret == 0 && reset) resetSettingsToWithoutStore();
|
488
|
+
|
489
|
+
return ret;
|
490
|
+
} catch(Exception e) {
|
491
|
+
if(reset) {
|
492
|
+
resetSettingsToWithoutStore();
|
493
|
+
}
|
494
|
+
return 0;
|
495
|
+
}
|
496
|
+
}
|
497
|
+
|
498
|
+
/**
|
499
|
+
* c: X509_STORE_CTX_purpose_inherit
|
500
|
+
*/
|
501
|
+
public int purposeInherit(int defaultPurpose,int purpose, int trust) {
|
502
|
+
int idx;
|
503
|
+
if(purpose == 0) {
|
504
|
+
purpose = defaultPurpose;
|
505
|
+
}
|
506
|
+
if(purpose != 0) {
|
507
|
+
idx = Purpose.getByID(purpose);
|
508
|
+
if(idx == -1) {
|
509
|
+
X509Error.addError(X509Utils.X509_R_UNKNOWN_PURPOSE_ID);
|
510
|
+
return 0;
|
511
|
+
}
|
512
|
+
Purpose ptmp = Purpose.getFirst(idx);
|
513
|
+
if(ptmp.trust == X509Utils.X509_TRUST_DEFAULT) {
|
514
|
+
idx = Purpose.getByID(defaultPurpose);
|
515
|
+
if(idx == -1) {
|
516
|
+
X509Error.addError(X509Utils.X509_R_UNKNOWN_PURPOSE_ID);
|
517
|
+
return 0;
|
518
|
+
}
|
519
|
+
ptmp = Purpose.getFirst(idx);
|
520
|
+
}
|
521
|
+
if(trust == 0) {
|
522
|
+
trust = ptmp.trust;
|
523
|
+
}
|
524
|
+
}
|
525
|
+
if(trust != 0) {
|
526
|
+
idx = Trust.getByID(trust);
|
527
|
+
if(idx == -1) {
|
528
|
+
X509Error.addError(X509Utils.X509_R_UNKNOWN_TRUST_ID);
|
529
|
+
return 0;
|
530
|
+
}
|
531
|
+
}
|
532
|
+
|
533
|
+
if(purpose != 0 && param.purpose == 0) {
|
534
|
+
param.purpose = purpose;
|
535
|
+
}
|
536
|
+
if(trust != 0 && param.trust == 0) {
|
537
|
+
param.trust = trust;
|
538
|
+
}
|
539
|
+
return 1;
|
540
|
+
}
|
541
|
+
|
542
|
+
/**
|
543
|
+
* c: X509_STORE_CTX_set_flags
|
544
|
+
*/
|
545
|
+
public void setFlags(long flags) {
|
546
|
+
param.setFlags(flags);
|
547
|
+
}
|
548
|
+
|
549
|
+
/**
|
550
|
+
* c: X509_STORE_CTX_set_time
|
551
|
+
*/
|
552
|
+
public void setTime(long flags,Date t) {
|
553
|
+
param.setTime(t);
|
554
|
+
}
|
555
|
+
|
556
|
+
/**
|
557
|
+
* c: X509_STORE_CTX_set_verify_cb
|
558
|
+
*/
|
559
|
+
public void setVerifyCallback(Store.VerifyCallbackFunction verifyCallback) {
|
560
|
+
this.verifyCallback = verifyCallback;
|
561
|
+
}
|
562
|
+
|
563
|
+
/**
|
564
|
+
* c: X509_STORE_CTX_get0_policy_tree
|
565
|
+
*/
|
566
|
+
PolicyTree getPolicyTree() {
|
567
|
+
return tree;
|
568
|
+
}
|
569
|
+
|
570
|
+
/**
|
571
|
+
* c: X509_STORE_CTX_get_explicit_policy
|
572
|
+
*/
|
573
|
+
public int getExplicitPolicy() {
|
574
|
+
return explicitPolicy;
|
575
|
+
}
|
576
|
+
|
577
|
+
/**
|
578
|
+
* c: X509_STORE_CTX_get0_param
|
579
|
+
*/
|
580
|
+
public VerifyParameter getParam() {
|
581
|
+
return param;
|
582
|
+
}
|
583
|
+
|
584
|
+
/**
|
585
|
+
* c: X509_STORE_CTX_set0_param
|
586
|
+
*/
|
587
|
+
public void setParam(VerifyParameter param) {
|
588
|
+
this.param = param;
|
589
|
+
}
|
590
|
+
|
591
|
+
/**
|
592
|
+
* c: X509_STORE_CTX_set_default
|
593
|
+
*/
|
594
|
+
public int setDefault(String name) {
|
595
|
+
VerifyParameter p = VerifyParameter.lookup(name);
|
596
|
+
if(p == null) {
|
597
|
+
return 0;
|
598
|
+
}
|
599
|
+
return param.inherit(p);
|
600
|
+
}
|
601
|
+
|
602
|
+
/**
|
603
|
+
* c: X509_STORE_get_by_subject
|
604
|
+
*/
|
605
|
+
public int getBySubject(int type,Name name,X509Object[] ret) throws Exception {
|
606
|
+
Store c = ctx;
|
607
|
+
|
608
|
+
X509Object tmp = X509Object.retrieveBySubject(c.objs,type,name);
|
609
|
+
if(tmp == null) {
|
610
|
+
for(int i=currentMethod; i<c.certificateMethods.size(); i++) {
|
611
|
+
Lookup lu = (Lookup)c.certificateMethods.get(i);
|
612
|
+
X509Object[] stmp = new X509Object[1];
|
613
|
+
int j = lu.bySubject(type,name,stmp);
|
614
|
+
if(j<0) {
|
615
|
+
currentMethod = i;
|
616
|
+
return j;
|
617
|
+
} else if(j>0) {
|
618
|
+
tmp = stmp[0];
|
619
|
+
break;
|
620
|
+
}
|
621
|
+
}
|
622
|
+
currentMethod = 0;
|
623
|
+
if(tmp == null) {
|
624
|
+
return 0;
|
625
|
+
}
|
626
|
+
}
|
627
|
+
ret[0] = tmp;
|
628
|
+
return 1;
|
629
|
+
}
|
630
|
+
|
631
|
+
/**
|
632
|
+
* c: X509_verify_cert
|
633
|
+
*/
|
634
|
+
public int verifyCertificate() throws Exception {
|
635
|
+
X509AuxCertificate x,xtmp=null,chain_ss = null;
|
636
|
+
//X509_NAME xn;
|
637
|
+
int bad_chain = 0;
|
638
|
+
int depth,i,ok=0;
|
639
|
+
int num;
|
640
|
+
Store.VerifyCallbackFunction cb;
|
641
|
+
List<X509AuxCertificate> sktmp = null;
|
642
|
+
if(certificate == null) {
|
643
|
+
X509Error.addError(X509Utils.X509_R_NO_CERT_SET_FOR_US_TO_VERIFY);
|
644
|
+
return -1;
|
645
|
+
}
|
646
|
+
cb=verifyCallback;
|
647
|
+
|
648
|
+
if(null == chain) {
|
649
|
+
chain = new ArrayList<X509AuxCertificate>();
|
650
|
+
chain.add(certificate);
|
651
|
+
lastUntrusted = 1;
|
652
|
+
}
|
653
|
+
|
654
|
+
if(untrusted != null) {
|
655
|
+
sktmp = new ArrayList<X509AuxCertificate>(untrusted);
|
656
|
+
}
|
657
|
+
num = chain.size();
|
658
|
+
x = chain.get(num-1);
|
659
|
+
depth = param.depth;
|
660
|
+
for(;;) {
|
661
|
+
if(depth < num) {
|
662
|
+
break;
|
663
|
+
}
|
664
|
+
|
665
|
+
if(checkIssued.call(this,x,x) != 0) {
|
666
|
+
break;
|
667
|
+
}
|
668
|
+
|
669
|
+
if(untrusted != null) {
|
670
|
+
xtmp = findIssuer(sktmp,x);
|
671
|
+
if(xtmp != null) {
|
672
|
+
chain.add(xtmp);
|
673
|
+
sktmp.remove(xtmp);
|
674
|
+
lastUntrusted++;
|
675
|
+
x = xtmp;
|
676
|
+
num++;
|
677
|
+
continue;
|
678
|
+
}
|
679
|
+
}
|
680
|
+
break;
|
681
|
+
}
|
682
|
+
|
683
|
+
i = chain.size();
|
684
|
+
x = (X509AuxCertificate)chain.get(i-1);
|
685
|
+
|
686
|
+
if(checkIssued.call(this,x,x) != 0) {
|
687
|
+
if(chain.size() == 1) {
|
688
|
+
X509AuxCertificate[] p_xtmp = new X509AuxCertificate[]{xtmp};
|
689
|
+
ok = getIssuer.call(p_xtmp,this,x);
|
690
|
+
xtmp = p_xtmp[0];
|
691
|
+
if(ok <= 0 || !x.equals(xtmp)) {
|
692
|
+
error = X509Utils.V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT;
|
693
|
+
currentCertificate = x;
|
694
|
+
errorDepth = i-1;
|
695
|
+
bad_chain = 1;
|
696
|
+
ok = cb.call(new Integer(0),this);
|
697
|
+
if(ok == 0) {
|
698
|
+
return ok;
|
699
|
+
}
|
700
|
+
} else {
|
701
|
+
x = xtmp;
|
702
|
+
chain.set(i-1,x);
|
703
|
+
lastUntrusted = 0;
|
704
|
+
}
|
705
|
+
} else {
|
706
|
+
chain_ss = chain.remove(chain.size()-1);
|
707
|
+
lastUntrusted--;
|
708
|
+
num--;
|
709
|
+
x = chain.get(num-1);
|
710
|
+
}
|
711
|
+
}
|
712
|
+
for(;;) {
|
713
|
+
if(depth<num) {
|
714
|
+
break;
|
715
|
+
}
|
716
|
+
//xn = new X509_NAME(x.getIssuerX500Principal());
|
717
|
+
if(checkIssued.call(this,x,x) != 0) {
|
718
|
+
break;
|
719
|
+
}
|
720
|
+
X509AuxCertificate[] p_xtmp = new X509AuxCertificate[]{xtmp};
|
721
|
+
ok = getIssuer.call(p_xtmp,this,x);
|
722
|
+
xtmp = p_xtmp[0];
|
723
|
+
if(ok < 0) {
|
724
|
+
return ok;
|
725
|
+
}
|
726
|
+
if(ok == 0) {
|
727
|
+
break;
|
728
|
+
}
|
729
|
+
x = xtmp;
|
730
|
+
chain.add(x);
|
731
|
+
num++;
|
732
|
+
}
|
733
|
+
|
734
|
+
//xn = new X509_NAME(x.getIssuerX500Principal());
|
735
|
+
if(checkIssued.call(this,x,x) == 0) {
|
736
|
+
if(chain_ss == null || checkIssued.call(this,x,chain_ss) == 0) {
|
737
|
+
if(lastUntrusted >= num) {
|
738
|
+
error = X509Utils.V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY;
|
739
|
+
} else {
|
740
|
+
error = X509Utils.V_ERR_UNABLE_TO_GET_ISSUER_CERT;
|
741
|
+
}
|
742
|
+
currentCertificate = x;
|
743
|
+
} else {
|
744
|
+
chain.add(chain_ss);
|
745
|
+
num++;
|
746
|
+
lastUntrusted = num;
|
747
|
+
currentCertificate = chain_ss;
|
748
|
+
error = X509Utils.V_ERR_SELF_SIGNED_CERT_IN_CHAIN;
|
749
|
+
chain_ss = null;
|
750
|
+
}
|
751
|
+
errorDepth = num-1;
|
752
|
+
bad_chain = 1;
|
753
|
+
ok = cb.call(new Integer(0),this);
|
754
|
+
if(ok == 0) {
|
755
|
+
return ok;
|
756
|
+
}
|
757
|
+
}
|
758
|
+
|
759
|
+
ok = checkChainExtensions();
|
760
|
+
if(ok == 0) {
|
761
|
+
return ok;
|
762
|
+
}
|
763
|
+
|
764
|
+
if(param.trust > 0) {
|
765
|
+
ok = checkTrust();
|
766
|
+
}
|
767
|
+
if(ok == 0) {
|
768
|
+
return ok;
|
769
|
+
}
|
770
|
+
|
771
|
+
ok = checkRevocation.call(this);
|
772
|
+
if(ok == 0) {
|
773
|
+
return ok;
|
774
|
+
}
|
775
|
+
|
776
|
+
if(verify != null && verify != Store.VerifyFunction.EMPTY) {
|
777
|
+
ok = verify.call(this);
|
778
|
+
} else {
|
779
|
+
ok = internalVerify.call(this);
|
780
|
+
}
|
781
|
+
if(ok == 0) {
|
782
|
+
return ok;
|
783
|
+
}
|
784
|
+
|
785
|
+
if(bad_chain == 0 && (param.flags & X509Utils.V_FLAG_POLICY_CHECK) != 0) {
|
786
|
+
ok = checkPolicy.call(this);
|
787
|
+
}
|
788
|
+
return ok;
|
789
|
+
}
|
790
|
+
|
791
|
+
|
792
|
+
private final static Set<String> CRITICAL_EXTENSIONS = new HashSet<String>();
|
793
|
+
static {
|
794
|
+
CRITICAL_EXTENSIONS.add("2.16.840.1.113730.1.1"); // netscape cert type, NID 71
|
795
|
+
CRITICAL_EXTENSIONS.add("2.5.29.15"); // key usage, NID 83
|
796
|
+
CRITICAL_EXTENSIONS.add("2.5.29.17"); // subject alt name, NID 85
|
797
|
+
CRITICAL_EXTENSIONS.add("2.5.29.19"); // basic constraints, NID 87
|
798
|
+
CRITICAL_EXTENSIONS.add("2.5.29.37"); // ext key usage, NID 126
|
799
|
+
CRITICAL_EXTENSIONS.add("1.3.6.1.5.5.7.1.14"); // proxy cert info, NID 661
|
800
|
+
}
|
801
|
+
|
802
|
+
private static boolean supportsCriticalExtension(String oid) {
|
803
|
+
return CRITICAL_EXTENSIONS.contains(oid);
|
804
|
+
}
|
805
|
+
|
806
|
+
private static boolean unhandledCritical(X509Extension xx) {
|
807
|
+
if(xx.getCriticalExtensionOIDs() == null || xx.getCriticalExtensionOIDs().size() == 0) {
|
808
|
+
return false;
|
809
|
+
}
|
810
|
+
for(String ss : xx.getCriticalExtensionOIDs()) {
|
811
|
+
if(!supportsCriticalExtension(ss)) {
|
812
|
+
return true;
|
813
|
+
}
|
814
|
+
}
|
815
|
+
return false;
|
816
|
+
}
|
817
|
+
|
818
|
+
/**
|
819
|
+
* c: check_chain_extensions
|
820
|
+
*/
|
821
|
+
public int checkChainExtensions() throws Exception {
|
822
|
+
int ok=0, must_be_ca;
|
823
|
+
X509AuxCertificate x;
|
824
|
+
Store.VerifyCallbackFunction cb;
|
825
|
+
int proxy_path_length = 0;
|
826
|
+
int allow_proxy_certs = (param.flags & X509Utils.V_FLAG_ALLOW_PROXY_CERTS) != 0 ? 1 : 0;
|
827
|
+
cb = verifyCallback;
|
828
|
+
must_be_ca = -1;
|
829
|
+
|
830
|
+
try {
|
831
|
+
if (System.getenv("OPENSSL_ALLOW_PROXY_CERTS") != null && !"false".equalsIgnoreCase((String) System.getenv("OPENSSL_ALLOW_PROXY_CERTS"))) {
|
832
|
+
allow_proxy_certs = 1;
|
833
|
+
}
|
834
|
+
} catch (Error e) {
|
835
|
+
// just ignore if we can't use System.getenv
|
836
|
+
}
|
837
|
+
|
838
|
+
for(int i = 0; i<lastUntrusted;i++) {
|
839
|
+
int ret;
|
840
|
+
x = chain.get(i);
|
841
|
+
if((param.flags & X509Utils.V_FLAG_IGNORE_CRITICAL) == 0 && unhandledCritical(x)) {
|
842
|
+
error = X509Utils.V_ERR_UNHANDLED_CRITICAL_EXTENSION;
|
843
|
+
errorDepth = i;
|
844
|
+
currentCertificate = x;
|
845
|
+
ok = cb.call(new Integer(0),this);
|
846
|
+
if(ok == 0) {
|
847
|
+
return ok;
|
848
|
+
}
|
849
|
+
}
|
850
|
+
if(allow_proxy_certs == 0 && x.getExtensionValue("1.3.6.1.5.5.7.1.14") != null) {
|
851
|
+
error = X509Utils.V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED;
|
852
|
+
errorDepth = i;
|
853
|
+
currentCertificate = x;
|
854
|
+
ok = cb.call(new Integer(0),this);
|
855
|
+
if(ok == 0) {
|
856
|
+
return ok;
|
857
|
+
}
|
858
|
+
}
|
859
|
+
|
860
|
+
ret = Purpose.checkCA(x);
|
861
|
+
switch(must_be_ca) {
|
862
|
+
case -1:
|
863
|
+
if((param.flags & X509Utils.V_FLAG_X509_STRICT) != 0 && ret != 1 && ret != 0) {
|
864
|
+
ret = 0;
|
865
|
+
error = X509Utils.V_ERR_INVALID_CA;
|
866
|
+
} else {
|
867
|
+
ret = 1;
|
868
|
+
}
|
869
|
+
break;
|
870
|
+
case 0:
|
871
|
+
if(ret != 0) {
|
872
|
+
ret = 0;
|
873
|
+
error = X509Utils.V_ERR_INVALID_NON_CA;
|
874
|
+
} else {
|
875
|
+
ret = 1;
|
876
|
+
}
|
877
|
+
break;
|
878
|
+
default:
|
879
|
+
if(ret == 0 || ((param.flags & X509Utils.V_FLAG_X509_STRICT) != 0 && ret != 1)) {
|
880
|
+
ret = 0;
|
881
|
+
error = X509Utils.V_ERR_INVALID_CA;
|
882
|
+
} else {
|
883
|
+
ret = 1;
|
884
|
+
}
|
885
|
+
break;
|
886
|
+
}
|
887
|
+
if(ret == 0) {
|
888
|
+
errorDepth = i;
|
889
|
+
currentCertificate = x;
|
890
|
+
ok = cb.call(new Integer(0),this);
|
891
|
+
if(ok == 0) {
|
892
|
+
return ok;
|
893
|
+
}
|
894
|
+
}
|
895
|
+
if(param.purpose > 0) {
|
896
|
+
ret = Purpose.checkPurpose(x,param.purpose, must_be_ca > 0 ? 1 : 0);
|
897
|
+
if(ret == 0 || ((param.flags & X509Utils.V_FLAG_X509_STRICT) != 0 && ret != 1)) {
|
898
|
+
error = X509Utils.V_ERR_INVALID_PURPOSE;
|
899
|
+
errorDepth = i;
|
900
|
+
currentCertificate = x;
|
901
|
+
ok = cb.call(new Integer(0),this);
|
902
|
+
if(ok == 0) {
|
903
|
+
return ok;
|
904
|
+
}
|
905
|
+
}
|
906
|
+
}
|
907
|
+
|
908
|
+
if(i > 1 && x.getBasicConstraints() != -1 && x.getBasicConstraints() != Integer.MAX_VALUE && (i > (x.getBasicConstraints() + proxy_path_length + 1))) {
|
909
|
+
error = X509Utils.V_ERR_PATH_LENGTH_EXCEEDED;
|
910
|
+
errorDepth = i;
|
911
|
+
currentCertificate = x;
|
912
|
+
ok = cb.call(new Integer(0),this);
|
913
|
+
if(ok == 0) {
|
914
|
+
return ok;
|
915
|
+
}
|
916
|
+
}
|
917
|
+
|
918
|
+
if(x.getExtensionValue("1.3.6.1.5.5.7.1.14") != null) {
|
919
|
+
DERSequence pci = (DERSequence)new ASN1InputStream(x.getExtensionValue("1.3.6.1.5.5.7.1.14")).readObject();
|
920
|
+
if(pci.size() > 0 && pci.getObjectAt(0) instanceof DERInteger) {
|
921
|
+
int pcpathlen = ((DERInteger)pci.getObjectAt(0)).getValue().intValue();
|
922
|
+
if(i > pcpathlen) {
|
923
|
+
error = X509Utils.V_ERR_PROXY_PATH_LENGTH_EXCEEDED;
|
924
|
+
errorDepth = i;
|
925
|
+
currentCertificate = x;
|
926
|
+
ok = cb.call(new Integer(0),this);
|
927
|
+
if(ok == 0) {
|
928
|
+
return ok;
|
929
|
+
}
|
930
|
+
}
|
931
|
+
}
|
932
|
+
proxy_path_length++;
|
933
|
+
must_be_ca = 0;
|
934
|
+
} else {
|
935
|
+
must_be_ca = 1;
|
936
|
+
}
|
937
|
+
}
|
938
|
+
return 1;
|
939
|
+
}
|
940
|
+
|
941
|
+
/**
|
942
|
+
* c: X509_check_trust
|
943
|
+
*/
|
944
|
+
public int checkTrust() throws Exception {
|
945
|
+
int i,ok;
|
946
|
+
X509AuxCertificate x;
|
947
|
+
Store.VerifyCallbackFunction cb;
|
948
|
+
cb = verifyCallback;
|
949
|
+
i = chain.size()-1;
|
950
|
+
x = chain.get(i);
|
951
|
+
ok = Trust.checkTrust(x,param.trust,0);
|
952
|
+
if(ok == X509Utils.X509_TRUST_TRUSTED) {
|
953
|
+
return 1;
|
954
|
+
}
|
955
|
+
errorDepth = 1;
|
956
|
+
currentCertificate = x;
|
957
|
+
if(ok == X509Utils.X509_TRUST_REJECTED) {
|
958
|
+
error = X509Utils.V_ERR_CERT_REJECTED;
|
959
|
+
} else {
|
960
|
+
error = X509Utils.V_ERR_CERT_UNTRUSTED;
|
961
|
+
}
|
962
|
+
return cb.call(new Integer(0),this);
|
963
|
+
}
|
964
|
+
|
965
|
+
/**
|
966
|
+
* c: check_cert_time
|
967
|
+
*/
|
968
|
+
public int checkCertificateTime(X509AuxCertificate x) throws Exception {
|
969
|
+
Date ptime = null;
|
970
|
+
|
971
|
+
if((param.flags & X509Utils.V_FLAG_USE_CHECK_TIME) != 0) {
|
972
|
+
ptime = this.param.checkTime;
|
973
|
+
} else {
|
974
|
+
ptime = Calendar.getInstance().getTime();
|
975
|
+
}
|
976
|
+
if(!x.getNotBefore().before(ptime)) {
|
977
|
+
error = X509Utils.V_ERR_CERT_NOT_YET_VALID;
|
978
|
+
currentCertificate = x;
|
979
|
+
if(verifyCallback.call(new Integer(0),this) == 0) {
|
980
|
+
return 0;
|
981
|
+
}
|
982
|
+
}
|
983
|
+
if(!x.getNotAfter().after(ptime)) {
|
984
|
+
error = X509Utils.V_ERR_CERT_HAS_EXPIRED;
|
985
|
+
currentCertificate = x;
|
986
|
+
if(verifyCallback.call(new Integer(0),this) == 0) {
|
987
|
+
return 0;
|
988
|
+
}
|
989
|
+
}
|
990
|
+
return 1;
|
991
|
+
}
|
992
|
+
|
993
|
+
/**
|
994
|
+
* c: check_cert
|
995
|
+
*/
|
996
|
+
public int checkCertificate() throws Exception {
|
997
|
+
X509CRL[] crl = new X509CRL[1];
|
998
|
+
X509AuxCertificate x;
|
999
|
+
int ok,cnum;
|
1000
|
+
cnum = errorDepth;
|
1001
|
+
x = chain.get(cnum);
|
1002
|
+
currentCertificate = x;
|
1003
|
+
ok = getCRL.call(this,crl,x);
|
1004
|
+
if(ok == 0) {
|
1005
|
+
error = X509Utils.V_ERR_UNABLE_TO_GET_CRL;
|
1006
|
+
ok = verifyCallback.call(new Integer(0), this);
|
1007
|
+
currentCRL = null;
|
1008
|
+
return ok;
|
1009
|
+
}
|
1010
|
+
currentCRL = crl[0];
|
1011
|
+
ok = checkCRL.call(this, crl[0]);
|
1012
|
+
if(ok == 0) {
|
1013
|
+
currentCRL = null;
|
1014
|
+
return ok;
|
1015
|
+
}
|
1016
|
+
ok = certificateCRL.call(this,crl[0],x);
|
1017
|
+
currentCRL = null;
|
1018
|
+
return ok;
|
1019
|
+
}
|
1020
|
+
|
1021
|
+
/**
|
1022
|
+
* c: check_crl_time
|
1023
|
+
*/
|
1024
|
+
public int checkCRLTime(X509CRL crl, int notify) throws Exception {
|
1025
|
+
currentCRL = crl;
|
1026
|
+
Date ptime = null;
|
1027
|
+
|
1028
|
+
if((param.flags & X509Utils.V_FLAG_USE_CHECK_TIME) != 0) {
|
1029
|
+
ptime = this.param.checkTime;
|
1030
|
+
} else {
|
1031
|
+
ptime = Calendar.getInstance().getTime();
|
1032
|
+
}
|
1033
|
+
|
1034
|
+
if(!crl.getThisUpdate().before(ptime)) {
|
1035
|
+
error=X509Utils.V_ERR_CRL_NOT_YET_VALID;
|
1036
|
+
if(notify == 0 || verifyCallback.call(new Integer(0),this) == 0) {
|
1037
|
+
return 0;
|
1038
|
+
}
|
1039
|
+
}
|
1040
|
+
if(crl.getNextUpdate() != null && !crl.getNextUpdate().after(ptime)) {
|
1041
|
+
error=X509Utils.V_ERR_CRL_HAS_EXPIRED;
|
1042
|
+
if(notify == 0 || verifyCallback.call(new Integer(0),this) == 0) {
|
1043
|
+
return 0;
|
1044
|
+
}
|
1045
|
+
}
|
1046
|
+
|
1047
|
+
currentCRL = null;
|
1048
|
+
return 1;
|
1049
|
+
}
|
1050
|
+
|
1051
|
+
/**
|
1052
|
+
* c: get_crl_sk
|
1053
|
+
*/
|
1054
|
+
public int getCRLStack(X509CRL[] pcrl, Name nm, List<X509CRL> crls) throws Exception {
|
1055
|
+
X509CRL best_crl = null;
|
1056
|
+
if(null != crls) {
|
1057
|
+
for(X509CRL crl : crls) {
|
1058
|
+
if(!nm.isEqual(crl.getIssuerX500Principal())) {
|
1059
|
+
continue;
|
1060
|
+
}
|
1061
|
+
if(checkCRLTime(crl,0) != 0) {
|
1062
|
+
pcrl[0] = crl;
|
1063
|
+
return 1;
|
1064
|
+
}
|
1065
|
+
best_crl = crl;
|
1066
|
+
}
|
1067
|
+
}
|
1068
|
+
if(best_crl != null) {
|
1069
|
+
pcrl[0] = best_crl;
|
1070
|
+
}
|
1071
|
+
return 0;
|
1072
|
+
}
|
1073
|
+
|
1074
|
+
/**
|
1075
|
+
* c: get_issuer_sk
|
1076
|
+
*/
|
1077
|
+
public final static Store.GetIssuerFunction getIssuerStack = new Store.GetIssuerFunction() {
|
1078
|
+
public int call(Object a1, Object a2, Object a3) throws Exception {
|
1079
|
+
X509AuxCertificate[] issuer = (X509AuxCertificate[])a1;
|
1080
|
+
StoreContext ctx = (StoreContext)a2;
|
1081
|
+
X509AuxCertificate x = (X509AuxCertificate)a3;
|
1082
|
+
issuer[0] = ctx.findIssuer(ctx.otherContext,x);
|
1083
|
+
if(issuer[0] != null) {
|
1084
|
+
return 1;
|
1085
|
+
} else {
|
1086
|
+
return 0;
|
1087
|
+
}
|
1088
|
+
}
|
1089
|
+
};
|
1090
|
+
|
1091
|
+
/**
|
1092
|
+
* c: check_issued
|
1093
|
+
*/
|
1094
|
+
public final static Store.CheckIssuedFunction defaultCheckIssued = new Store.CheckIssuedFunction() {
|
1095
|
+
public int call(Object a1, Object a2, Object a3) throws Exception {
|
1096
|
+
StoreContext ctx = (StoreContext)a1;
|
1097
|
+
X509AuxCertificate x = (X509AuxCertificate)a2;
|
1098
|
+
X509AuxCertificate issuer = (X509AuxCertificate)a3;
|
1099
|
+
int ret = X509Utils.checkIfIssuedBy(issuer,x);
|
1100
|
+
if(ret == X509Utils.V_OK) {
|
1101
|
+
return 1;
|
1102
|
+
}
|
1103
|
+
if((ctx.param.flags & X509Utils.V_FLAG_CB_ISSUER_CHECK) == 0) {
|
1104
|
+
return 0;
|
1105
|
+
}
|
1106
|
+
ctx.error = ret;
|
1107
|
+
ctx.currentCertificate = x;
|
1108
|
+
ctx.currentIssuer = issuer;
|
1109
|
+
return ctx.verifyCallback.call(new Integer(0),ctx);
|
1110
|
+
}
|
1111
|
+
};
|
1112
|
+
|
1113
|
+
/**
|
1114
|
+
* c: null_callback
|
1115
|
+
*/
|
1116
|
+
public final static Store.VerifyCallbackFunction NullCallback = new Store.VerifyCallbackFunction() {
|
1117
|
+
public int call(Object a1, Object a2) {
|
1118
|
+
return ((Integer)a1).intValue();
|
1119
|
+
}
|
1120
|
+
};
|
1121
|
+
|
1122
|
+
/**
|
1123
|
+
* c: internal_verify
|
1124
|
+
*/
|
1125
|
+
public final static Store.VerifyFunction internalVerify = new Store.VerifyFunction() {
|
1126
|
+
public int call(Object a1) throws Exception {
|
1127
|
+
StoreContext ctx = (StoreContext)a1;
|
1128
|
+
Store.VerifyCallbackFunction cb = ctx.verifyCallback;
|
1129
|
+
int n = ctx.chain.size();
|
1130
|
+
ctx.errorDepth = n-1;
|
1131
|
+
n--;
|
1132
|
+
X509AuxCertificate xi = ctx.chain.get(n);
|
1133
|
+
X509AuxCertificate xs = null;
|
1134
|
+
int ok = 0;
|
1135
|
+
if(ctx.checkIssued.call(ctx,xi,xi) != 0) {
|
1136
|
+
xs = xi;
|
1137
|
+
} else {
|
1138
|
+
if(n<=0) {
|
1139
|
+
ctx.error = X509Utils.V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE;
|
1140
|
+
ctx.currentCertificate = xi;
|
1141
|
+
ok = cb.call(new Integer(0),ctx);
|
1142
|
+
return ok;
|
1143
|
+
} else {
|
1144
|
+
n--;
|
1145
|
+
ctx.errorDepth = n;
|
1146
|
+
xs = ctx.chain.get(n);
|
1147
|
+
}
|
1148
|
+
}
|
1149
|
+
while(n>=0) {
|
1150
|
+
ctx.errorDepth = n;
|
1151
|
+
if(!xs.isValid()) {
|
1152
|
+
try {
|
1153
|
+
xs.verify(xi.getPublicKey());
|
1154
|
+
} catch(Exception e) {
|
1155
|
+
/*
|
1156
|
+
System.err.println("n: " + n);
|
1157
|
+
System.err.println("verifying: " + xs);
|
1158
|
+
System.err.println("verifying with issuer?: " + xi);
|
1159
|
+
System.err.println("verifying with issuer.key?: " + xi.getPublicKey());
|
1160
|
+
System.err.println("exception: " + e);
|
1161
|
+
*/
|
1162
|
+
ctx.error = X509Utils.V_ERR_CERT_SIGNATURE_FAILURE;
|
1163
|
+
ctx.currentCertificate = xs;
|
1164
|
+
ok = cb.call(new Integer(0),ctx);
|
1165
|
+
if(ok == 0) {
|
1166
|
+
return ok;
|
1167
|
+
}
|
1168
|
+
}
|
1169
|
+
}
|
1170
|
+
xs.setValid(true);
|
1171
|
+
ok = ctx.checkCertificateTime(xs);
|
1172
|
+
if(ok == 0) {
|
1173
|
+
return ok;
|
1174
|
+
}
|
1175
|
+
ctx.currentIssuer = xi;
|
1176
|
+
ctx.currentCertificate = xs;
|
1177
|
+
ok = cb.call(new Integer(1),ctx);
|
1178
|
+
if(ok == 0) {
|
1179
|
+
return ok;
|
1180
|
+
}
|
1181
|
+
n--;
|
1182
|
+
if(n>=0) {
|
1183
|
+
xi = xs;
|
1184
|
+
xs = ctx.chain.get(n);
|
1185
|
+
}
|
1186
|
+
}
|
1187
|
+
ok = 1;
|
1188
|
+
return ok;
|
1189
|
+
}
|
1190
|
+
};
|
1191
|
+
|
1192
|
+
/**
|
1193
|
+
* c: check_revocation
|
1194
|
+
*/
|
1195
|
+
public final static Store.CheckRevocationFunction defaultCheckRevocation = new Store.CheckRevocationFunction() {
|
1196
|
+
public int call(Object a1) throws Exception {
|
1197
|
+
StoreContext ctx = (StoreContext)a1;
|
1198
|
+
int last,ok=0;
|
1199
|
+
if((ctx.param.flags & X509Utils.V_FLAG_CRL_CHECK) == 0) {
|
1200
|
+
return 1;
|
1201
|
+
}
|
1202
|
+
if((ctx.param.flags & X509Utils.V_FLAG_CRL_CHECK_ALL) != 0) {
|
1203
|
+
last = ctx.chain.size() -1;
|
1204
|
+
} else {
|
1205
|
+
last = 0;
|
1206
|
+
}
|
1207
|
+
for(int i=0;i<=last;i++) {
|
1208
|
+
ctx.errorDepth = i;
|
1209
|
+
ok = ctx.checkCertificate();
|
1210
|
+
if(ok == 0) {
|
1211
|
+
return 0;
|
1212
|
+
}
|
1213
|
+
}
|
1214
|
+
return 1;
|
1215
|
+
}
|
1216
|
+
};
|
1217
|
+
|
1218
|
+
/**
|
1219
|
+
* c: get_crl
|
1220
|
+
*/
|
1221
|
+
public final static Store.GetCRLFunction defaultGetCRL = new Store.GetCRLFunction() {
|
1222
|
+
public int call(Object a1, Object a2, Object a3) throws Exception {
|
1223
|
+
StoreContext ctx = (StoreContext)a1;
|
1224
|
+
X509CRL[] pcrl = (X509CRL[])a2;
|
1225
|
+
X509AuxCertificate x = (X509AuxCertificate)a3;
|
1226
|
+
Name nm = new Name(x.getIssuerX500Principal());
|
1227
|
+
X509CRL[] crl = new X509CRL[1];
|
1228
|
+
int ok = ctx.getCRLStack(crl,nm,ctx.crls);
|
1229
|
+
if(ok != 0) {
|
1230
|
+
pcrl[0] = crl[0];
|
1231
|
+
return 1;
|
1232
|
+
}
|
1233
|
+
X509Object[] xobj = new X509Object[1];
|
1234
|
+
ok = ctx.getBySubject(X509Utils.X509_LU_CRL,nm,xobj);
|
1235
|
+
if(ok == 0) {
|
1236
|
+
if(crl[0] != null) {
|
1237
|
+
pcrl[0] = crl[0];
|
1238
|
+
return 1;
|
1239
|
+
}
|
1240
|
+
return 0;
|
1241
|
+
}
|
1242
|
+
pcrl[0] = (X509CRL)(((CRL)xobj[0]).crl);
|
1243
|
+
return 1;
|
1244
|
+
}
|
1245
|
+
};
|
1246
|
+
|
1247
|
+
/**
|
1248
|
+
* c: check_crl
|
1249
|
+
*/
|
1250
|
+
public final static Store.CheckCRLFunction defaultCheckCRL = new Store.CheckCRLFunction() {
|
1251
|
+
public int call(Object a1, Object a2) throws Exception {
|
1252
|
+
StoreContext ctx = (StoreContext)a1;
|
1253
|
+
final X509CRL crl = (X509CRL)a2;
|
1254
|
+
X509AuxCertificate issuer = null;
|
1255
|
+
int ok = 0,chnum,cnum;
|
1256
|
+
cnum = ctx.errorDepth;
|
1257
|
+
chnum = ctx.chain.size()-1;
|
1258
|
+
if(cnum < chnum) {
|
1259
|
+
issuer = ctx.chain.get(cnum+1);
|
1260
|
+
} else {
|
1261
|
+
issuer = ctx.chain.get(chnum);
|
1262
|
+
if(ctx.checkIssued.call(ctx,issuer,issuer) == 0) {
|
1263
|
+
ctx.error = X509Utils.V_ERR_UNABLE_TO_GET_CRL_ISSUER;
|
1264
|
+
ok = ctx.verifyCallback.call(new Integer(0),ctx);
|
1265
|
+
if(ok == 0) {
|
1266
|
+
return ok;
|
1267
|
+
}
|
1268
|
+
}
|
1269
|
+
}
|
1270
|
+
|
1271
|
+
if(issuer != null) {
|
1272
|
+
if(issuer.getKeyUsage() != null && !issuer.getKeyUsage()[6]) {
|
1273
|
+
ctx.error = X509Utils.V_ERR_KEYUSAGE_NO_CRL_SIGN;
|
1274
|
+
ok = ctx.verifyCallback.call(new Integer(0),ctx);
|
1275
|
+
if(ok == 0) {
|
1276
|
+
return ok;
|
1277
|
+
}
|
1278
|
+
}
|
1279
|
+
final PublicKey ikey = issuer.getPublicKey();
|
1280
|
+
if(ikey == null) {
|
1281
|
+
ctx.error = X509Utils.V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY;
|
1282
|
+
ok = ctx.verifyCallback.call(new Integer(0),ctx);
|
1283
|
+
if(ok == 0) {
|
1284
|
+
return ok;
|
1285
|
+
}
|
1286
|
+
} else {
|
1287
|
+
final boolean[] result = new boolean[1];
|
1288
|
+
OpenSSLReal.doWithBCProvider(new Runnable() {
|
1289
|
+
public void run() {
|
1290
|
+
try {
|
1291
|
+
crl.verify(ikey);
|
1292
|
+
result[0] = true;
|
1293
|
+
} catch(java.security.GeneralSecurityException e) {
|
1294
|
+
result[0] = false;
|
1295
|
+
}
|
1296
|
+
}
|
1297
|
+
});
|
1298
|
+
|
1299
|
+
if(!result[0]) {
|
1300
|
+
ctx.error= X509Utils.V_ERR_CRL_SIGNATURE_FAILURE;
|
1301
|
+
ok = ctx.verifyCallback.call(new Integer(0),ctx);
|
1302
|
+
if(ok == 0) {
|
1303
|
+
return ok;
|
1304
|
+
}
|
1305
|
+
}
|
1306
|
+
}
|
1307
|
+
}
|
1308
|
+
|
1309
|
+
ok = ctx.checkCRLTime(crl,1);
|
1310
|
+
if(ok == 0) {
|
1311
|
+
return ok;
|
1312
|
+
}
|
1313
|
+
return 1;
|
1314
|
+
}
|
1315
|
+
};
|
1316
|
+
|
1317
|
+
/**
|
1318
|
+
* c: cert_crl
|
1319
|
+
*/
|
1320
|
+
public final static Store.CertificateCRLFunction defaultCertificateCRL = new Store.CertificateCRLFunction() {
|
1321
|
+
public int call(Object a1, Object a2, Object a3) throws Exception {
|
1322
|
+
StoreContext ctx = (StoreContext)a1;
|
1323
|
+
X509CRL crl = (X509CRL)a2;
|
1324
|
+
X509AuxCertificate x = (X509AuxCertificate)a3;
|
1325
|
+
int ok;
|
1326
|
+
if(crl.getRevokedCertificate(x.getSerialNumber()) != null) {
|
1327
|
+
ctx.error = X509Utils.V_ERR_CERT_REVOKED;
|
1328
|
+
ok = ctx.verifyCallback.call(new Integer(0), ctx);
|
1329
|
+
if(ok == 0) {
|
1330
|
+
return 0;
|
1331
|
+
}
|
1332
|
+
}
|
1333
|
+
if((ctx.param.flags & X509Utils.V_FLAG_IGNORE_CRITICAL) != 0) {
|
1334
|
+
return 1;
|
1335
|
+
}
|
1336
|
+
|
1337
|
+
if(crl.getCriticalExtensionOIDs() != null && crl.getCriticalExtensionOIDs().size()>0) {
|
1338
|
+
ctx.error = X509Utils.V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION;
|
1339
|
+
ok = ctx.verifyCallback.call(new Integer(0), ctx);
|
1340
|
+
if(ok == 0) {
|
1341
|
+
return 0;
|
1342
|
+
}
|
1343
|
+
}
|
1344
|
+
return 1;
|
1345
|
+
}
|
1346
|
+
};
|
1347
|
+
|
1348
|
+
/**
|
1349
|
+
* c: check_policy
|
1350
|
+
*/
|
1351
|
+
public final static CheckPolicyFunction defaultCheckPolicy = new CheckPolicyFunction() {
|
1352
|
+
public int call(Object a1) throws Exception {
|
1353
|
+
return 1;
|
1354
|
+
}
|
1355
|
+
};
|
1356
|
+
}// X509_STORE_CTX
|