redcar 0.3.2dev → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (485) hide show
  1. data/CHANGES +49 -2
  2. data/README.md +2 -7
  3. data/ROADMAP.md +8 -9
  4. data/Rakefile +29 -44
  5. data/bin/redcar +11 -2
  6. data/lib/openssl/History.txt +75 -0
  7. data/lib/openssl/License.txt +30 -0
  8. data/lib/openssl/Manifest.txt +99 -0
  9. data/lib/openssl/README.txt +24 -0
  10. data/lib/openssl/Rakefile +71 -0
  11. data/lib/openssl/build.properties.SAMPLE +7 -0
  12. data/lib/openssl/build.xml +57 -0
  13. data/lib/openssl/lib/jopenssl/version.rb +5 -0
  14. data/lib/openssl/lib/openssl.rb +24 -0
  15. data/lib/openssl/lib/openssl/bn.rb +33 -0
  16. data/lib/openssl/lib/openssl/buffering.rb +239 -0
  17. data/lib/openssl/lib/openssl/cipher.rb +56 -0
  18. data/lib/openssl/lib/openssl/digest.rb +46 -0
  19. data/lib/openssl/lib/openssl/dummy.rb +34 -0
  20. data/lib/openssl/lib/openssl/dummyssl.rb +13 -0
  21. data/lib/openssl/lib/openssl/ssl.rb +135 -0
  22. data/lib/openssl/lib/openssl/x509.rb +154 -0
  23. data/lib/openssl/mocha/COPYING +3 -0
  24. data/lib/openssl/mocha/MIT-LICENSE +7 -0
  25. data/lib/openssl/mocha/README +35 -0
  26. data/lib/openssl/mocha/RELEASE +171 -0
  27. data/lib/openssl/mocha/Rakefile +147 -0
  28. data/lib/openssl/mocha/TODO +48 -0
  29. data/lib/openssl/mocha/examples/misc.rb +36 -0
  30. data/lib/openssl/mocha/examples/mocha.rb +26 -0
  31. data/lib/openssl/mocha/examples/stubba.rb +65 -0
  32. data/lib/openssl/mocha/init.rb +3 -0
  33. data/lib/openssl/mocha/lib/mocha.rb +19 -0
  34. data/lib/openssl/mocha/lib/mocha/any_instance_method.rb +35 -0
  35. data/lib/openssl/mocha/lib/mocha/auto_verify.rb +111 -0
  36. data/lib/openssl/mocha/lib/mocha/central.rb +35 -0
  37. data/lib/openssl/mocha/lib/mocha/class_method.rb +62 -0
  38. data/lib/openssl/mocha/lib/mocha/deprecation.rb +22 -0
  39. data/lib/openssl/mocha/lib/mocha/exception_raiser.rb +17 -0
  40. data/lib/openssl/mocha/lib/mocha/expectation.rb +382 -0
  41. data/lib/openssl/mocha/lib/mocha/expectation_error.rb +6 -0
  42. data/lib/openssl/mocha/lib/mocha/expectation_list.rb +45 -0
  43. data/lib/openssl/mocha/lib/mocha/infinite_range.rb +25 -0
  44. data/lib/openssl/mocha/lib/mocha/inspect.rb +39 -0
  45. data/lib/openssl/mocha/lib/mocha/instance_method.rb +8 -0
  46. data/lib/openssl/mocha/lib/mocha/is_a.rb +9 -0
  47. data/lib/openssl/mocha/lib/mocha/metaclass.rb +7 -0
  48. data/lib/openssl/mocha/lib/mocha/missing_expectation.rb +27 -0
  49. data/lib/openssl/mocha/lib/mocha/mock.rb +200 -0
  50. data/lib/openssl/mocha/lib/mocha/multiple_yields.rb +20 -0
  51. data/lib/openssl/mocha/lib/mocha/no_yields.rb +11 -0
  52. data/lib/openssl/mocha/lib/mocha/object.rb +110 -0
  53. data/lib/openssl/mocha/lib/mocha/parameter_matchers.rb +9 -0
  54. data/lib/openssl/mocha/lib/mocha/parameter_matchers/all_of.rb +39 -0
  55. data/lib/openssl/mocha/lib/mocha/parameter_matchers/any_of.rb +44 -0
  56. data/lib/openssl/mocha/lib/mocha/parameter_matchers/anything.rb +30 -0
  57. data/lib/openssl/mocha/lib/mocha/parameter_matchers/has_entry.rb +39 -0
  58. data/lib/openssl/mocha/lib/mocha/parameter_matchers/has_key.rb +39 -0
  59. data/lib/openssl/mocha/lib/mocha/parameter_matchers/has_value.rb +39 -0
  60. data/lib/openssl/mocha/lib/mocha/parameter_matchers/includes.rb +37 -0
  61. data/lib/openssl/mocha/lib/mocha/parameter_matchers/instance_of.rb +39 -0
  62. data/lib/openssl/mocha/lib/mocha/parameter_matchers/kind_of.rb +39 -0
  63. data/lib/openssl/mocha/lib/mocha/pretty_parameters.rb +28 -0
  64. data/lib/openssl/mocha/lib/mocha/return_values.rb +31 -0
  65. data/lib/openssl/mocha/lib/mocha/setup_and_teardown.rb +23 -0
  66. data/lib/openssl/mocha/lib/mocha/single_return_value.rb +24 -0
  67. data/lib/openssl/mocha/lib/mocha/single_yield.rb +18 -0
  68. data/lib/openssl/mocha/lib/mocha/standalone.rb +32 -0
  69. data/lib/openssl/mocha/lib/mocha/stub.rb +18 -0
  70. data/lib/openssl/mocha/lib/mocha/test_case_adapter.rb +49 -0
  71. data/lib/openssl/mocha/lib/mocha/yield_parameters.rb +31 -0
  72. data/lib/openssl/mocha/lib/mocha_standalone.rb +2 -0
  73. data/lib/openssl/mocha/lib/stubba.rb +2 -0
  74. data/lib/openssl/mocha/templates/html_with_google_analytics.rb +742 -0
  75. data/lib/openssl/mocha/test/acceptance/expected_invocation_count_acceptance_test.rb +187 -0
  76. data/lib/openssl/mocha/test/acceptance/mocha_acceptance_test.rb +98 -0
  77. data/lib/openssl/mocha/test/acceptance/mocked_methods_dispatch_acceptance_test.rb +71 -0
  78. data/lib/openssl/mocha/test/acceptance/parameter_matcher_acceptance_test.rb +63 -0
  79. data/lib/openssl/mocha/test/acceptance/standalone_acceptance_test.rb +131 -0
  80. data/lib/openssl/mocha/test/acceptance/stubba_acceptance_test.rb +102 -0
  81. data/lib/openssl/mocha/test/active_record_test_case.rb +36 -0
  82. data/lib/openssl/mocha/test/deprecation_disabler.rb +15 -0
  83. data/lib/openssl/mocha/test/execution_point.rb +34 -0
  84. data/lib/openssl/mocha/test/integration/mocha_test_result_integration_test.rb +105 -0
  85. data/lib/openssl/mocha/test/integration/stubba_integration_test.rb +89 -0
  86. data/lib/openssl/mocha/test/integration/stubba_test_result_integration_test.rb +85 -0
  87. data/lib/openssl/mocha/test/method_definer.rb +18 -0
  88. data/lib/openssl/mocha/test/test_helper.rb +12 -0
  89. data/lib/openssl/mocha/test/test_runner.rb +31 -0
  90. data/lib/openssl/mocha/test/unit/any_instance_method_test.rb +124 -0
  91. data/lib/openssl/mocha/test/unit/array_inspect_test.rb +16 -0
  92. data/lib/openssl/mocha/test/unit/auto_verify_test.rb +122 -0
  93. data/lib/openssl/mocha/test/unit/central_test.rb +124 -0
  94. data/lib/openssl/mocha/test/unit/class_method_test.rb +196 -0
  95. data/lib/openssl/mocha/test/unit/date_time_inspect_test.rb +21 -0
  96. data/lib/openssl/mocha/test/unit/expectation_list_test.rb +69 -0
  97. data/lib/openssl/mocha/test/unit/expectation_raiser_test.rb +28 -0
  98. data/lib/openssl/mocha/test/unit/expectation_test.rb +399 -0
  99. data/lib/openssl/mocha/test/unit/hash_inspect_test.rb +16 -0
  100. data/lib/openssl/mocha/test/unit/infinite_range_test.rb +53 -0
  101. data/lib/openssl/mocha/test/unit/metaclass_test.rb +22 -0
  102. data/lib/openssl/mocha/test/unit/missing_expectation_test.rb +45 -0
  103. data/lib/openssl/mocha/test/unit/mock_test.rb +316 -0
  104. data/lib/openssl/mocha/test/unit/multiple_yields_test.rb +18 -0
  105. data/lib/openssl/mocha/test/unit/no_yield_test.rb +18 -0
  106. data/lib/openssl/mocha/test/unit/object_inspect_test.rb +35 -0
  107. data/lib/openssl/mocha/test/unit/object_test.rb +165 -0
  108. data/lib/openssl/mocha/test/unit/parameter_matchers/all_of_test.rb +26 -0
  109. data/lib/openssl/mocha/test/unit/parameter_matchers/any_of_test.rb +26 -0
  110. data/lib/openssl/mocha/test/unit/parameter_matchers/anything_test.rb +21 -0
  111. data/lib/openssl/mocha/test/unit/parameter_matchers/has_entry_test.rb +25 -0
  112. data/lib/openssl/mocha/test/unit/parameter_matchers/has_key_test.rb +25 -0
  113. data/lib/openssl/mocha/test/unit/parameter_matchers/has_value_test.rb +25 -0
  114. data/lib/openssl/mocha/test/unit/parameter_matchers/includes_test.rb +25 -0
  115. data/lib/openssl/mocha/test/unit/parameter_matchers/instance_of_test.rb +25 -0
  116. data/lib/openssl/mocha/test/unit/parameter_matchers/kind_of_test.rb +25 -0
  117. data/lib/openssl/mocha/test/unit/parameter_matchers/stub_matcher.rb +22 -0
  118. data/lib/openssl/mocha/test/unit/pretty_parameters_test.rb +32 -0
  119. data/lib/openssl/mocha/test/unit/return_values_test.rb +63 -0
  120. data/lib/openssl/mocha/test/unit/setup_and_teardown_test.rb +76 -0
  121. data/lib/openssl/mocha/test/unit/single_return_value_test.rb +33 -0
  122. data/lib/openssl/mocha/test/unit/single_yield_test.rb +18 -0
  123. data/lib/openssl/mocha/test/unit/string_inspect_test.rb +11 -0
  124. data/lib/openssl/mocha/test/unit/stub_test.rb +24 -0
  125. data/lib/openssl/mocha/test/unit/yield_parameters_test.rb +93 -0
  126. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/FOLDERS +53 -0
  127. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/LICENSE +340 -0
  128. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/README +117 -0
  129. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/bin/coderay +77 -0
  130. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/bin/coderay_stylesheet +4 -0
  131. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay.rb +319 -0
  132. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/duo.rb +29 -0
  133. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoder.rb +173 -0
  134. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/_map.rb +8 -0
  135. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/count.rb +21 -0
  136. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/debug.rb +46 -0
  137. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/div.rb +20 -0
  138. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/html.rb +260 -0
  139. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/html/classes.rb +77 -0
  140. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/html/css.rb +65 -0
  141. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/html/numerization.rb +122 -0
  142. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/html/output.rb +195 -0
  143. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/null.rb +26 -0
  144. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/page.rb +21 -0
  145. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/span.rb +20 -0
  146. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/statistic.rb +81 -0
  147. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/text.rb +33 -0
  148. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/tokens.rb +44 -0
  149. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/xml.rb +71 -0
  150. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/encoders/yaml.rb +22 -0
  151. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/helpers/file_type.rb +182 -0
  152. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/helpers/gzip_simple.rb +122 -0
  153. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/helpers/plugin.rb +326 -0
  154. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/helpers/word_list.rb +119 -0
  155. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/scanner.rb +238 -0
  156. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/scanners/_map.rb +15 -0
  157. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/scanners/c.rb +163 -0
  158. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/scanners/debug.rb +60 -0
  159. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/scanners/delphi.rb +149 -0
  160. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/scanners/html.rb +177 -0
  161. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/scanners/nitro_xhtml.rb +133 -0
  162. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/scanners/plaintext.rb +16 -0
  163. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/scanners/rhtml.rb +73 -0
  164. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/scanners/ruby.rb +367 -0
  165. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/scanners/ruby/patterns.rb +230 -0
  166. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/scanners/xml.rb +18 -0
  167. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/style.rb +20 -0
  168. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/styles/_map.rb +7 -0
  169. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/styles/cycnus.rb +125 -0
  170. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/styles/murphy.rb +119 -0
  171. data/lib/openssl/mocha/vendor/coderay-0.7.4.215/lib/coderay/tokens.rb +368 -0
  172. data/lib/openssl/mocha/vendor/meta_project-0.4.15/CHANGES +295 -0
  173. data/lib/openssl/mocha/vendor/meta_project-0.4.15/MIT-LICENSE +21 -0
  174. data/lib/openssl/mocha/vendor/meta_project-0.4.15/README +129 -0
  175. data/lib/openssl/mocha/vendor/meta_project-0.4.15/Rakefile +152 -0
  176. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project.rb +19 -0
  177. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/open_uri.rb +22 -0
  178. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/pathname.rb +36 -0
  179. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/core_ext/string.rb +5 -0
  180. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/http/multipart.rb +32 -0
  181. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/patois.rb +1 -0
  182. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/patois/parser.rb +99 -0
  183. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project.rb +4 -0
  184. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project/base.rb +9 -0
  185. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project/codehaus.rb +1 -0
  186. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project/codehaus/codehaus_project_svn.rb +31 -0
  187. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project/trac.rb +1 -0
  188. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project/trac/trac_project.rb +54 -0
  189. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project/xforge.rb +5 -0
  190. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project/xforge/ruby_forge.rb +47 -0
  191. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project/xforge/session.rb +177 -0
  192. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project/xforge/source_forge.rb +50 -0
  193. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project/xforge/xfile.rb +45 -0
  194. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project/xforge/xforge_base.rb +85 -0
  195. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/project_analyzer.rb +36 -0
  196. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/release/freshmeat.rb +267 -0
  197. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/release/raa.rb +572 -0
  198. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/scm_web.rb +2 -0
  199. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/scm_web/browser.rb +112 -0
  200. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/scm_web/pathname.rb +89 -0
  201. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker.rb +6 -0
  202. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker/base.rb +24 -0
  203. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker/digit_issues.rb +34 -0
  204. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker/issue.rb +57 -0
  205. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker/jira.rb +2 -0
  206. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker/jira/jira_issues.rb +35 -0
  207. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker/jira/jira_tracker.rb +149 -0
  208. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker/trac.rb +1 -0
  209. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker/trac/trac_tracker.rb +33 -0
  210. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker/xforge.rb +3 -0
  211. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker/xforge/ruby_forge_tracker.rb +17 -0
  212. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker/xforge/source_forge_tracker.rb +17 -0
  213. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/tracker/xforge/xforge_tracker.rb +191 -0
  214. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/meta_project/version_parser.rb +52 -0
  215. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/rake/contrib/xforge.rb +3 -0
  216. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/rake/contrib/xforge/base.rb +64 -0
  217. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/rake/contrib/xforge/news_publisher.rb +97 -0
  218. data/lib/openssl/mocha/vendor/meta_project-0.4.15/lib/rake/contrib/xforge/release.rb +134 -0
  219. data/lib/openssl/nbproject/genfiles.properties +5 -0
  220. data/lib/openssl/nbproject/jdk.xml +157 -0
  221. data/lib/openssl/nbproject/nbjdk.properties +1 -0
  222. data/lib/openssl/nbproject/nbjdk.xml +16 -0
  223. data/lib/openssl/nbproject/project.xml +117 -0
  224. data/lib/openssl/src/java/JopensslService.java +41 -0
  225. data/lib/openssl/src/java/org/jruby/ext/openssl/ASN1.java +930 -0
  226. data/lib/openssl/src/java/org/jruby/ext/openssl/Attribute.java +132 -0
  227. data/lib/openssl/src/java/org/jruby/ext/openssl/BN.java +769 -0
  228. data/lib/openssl/src/java/org/jruby/ext/openssl/BouncyCastlePEMHandler.java +69 -0
  229. data/lib/openssl/src/java/org/jruby/ext/openssl/Callable.java +10 -0
  230. data/lib/openssl/src/java/org/jruby/ext/openssl/Cipher.java +661 -0
  231. data/lib/openssl/src/java/org/jruby/ext/openssl/CipherStrings.java +1827 -0
  232. data/lib/openssl/src/java/org/jruby/ext/openssl/Config.java +49 -0
  233. data/lib/openssl/src/java/org/jruby/ext/openssl/DefaultPEMHandler.java +44 -0
  234. data/lib/openssl/src/java/org/jruby/ext/openssl/Digest.java +207 -0
  235. data/lib/openssl/src/java/org/jruby/ext/openssl/HMAC.java +183 -0
  236. data/lib/openssl/src/java/org/jruby/ext/openssl/NetscapeSPKI.java +212 -0
  237. data/lib/openssl/src/java/org/jruby/ext/openssl/OpenSSLImpl.java +341 -0
  238. data/lib/openssl/src/java/org/jruby/ext/openssl/OpenSSLReal.java +113 -0
  239. data/lib/openssl/src/java/org/jruby/ext/openssl/PEMHandler.java +40 -0
  240. data/lib/openssl/src/java/org/jruby/ext/openssl/PKCS10CertificationRequestExt.java +159 -0
  241. data/lib/openssl/src/java/org/jruby/ext/openssl/PKCS7.java +642 -0
  242. data/lib/openssl/src/java/org/jruby/ext/openssl/PKey.java +154 -0
  243. data/lib/openssl/src/java/org/jruby/ext/openssl/PKeyDH.java +401 -0
  244. data/lib/openssl/src/java/org/jruby/ext/openssl/PKeyDSA.java +419 -0
  245. data/lib/openssl/src/java/org/jruby/ext/openssl/PKeyRSA.java +762 -0
  246. data/lib/openssl/src/java/org/jruby/ext/openssl/Random.java +103 -0
  247. data/lib/openssl/src/java/org/jruby/ext/openssl/Request.java +336 -0
  248. data/lib/openssl/src/java/org/jruby/ext/openssl/SSL.java +71 -0
  249. data/lib/openssl/src/java/org/jruby/ext/openssl/SSLContext.java +358 -0
  250. data/lib/openssl/src/java/org/jruby/ext/openssl/SSLSocket.java +561 -0
  251. data/lib/openssl/src/java/org/jruby/ext/openssl/SimpleSecretKey.java +53 -0
  252. data/lib/openssl/src/java/org/jruby/ext/openssl/Utils.java +60 -0
  253. data/lib/openssl/src/java/org/jruby/ext/openssl/X509.java +108 -0
  254. data/lib/openssl/src/java/org/jruby/ext/openssl/X509CRL.java +446 -0
  255. data/lib/openssl/src/java/org/jruby/ext/openssl/X509Cert.java +520 -0
  256. data/lib/openssl/src/java/org/jruby/ext/openssl/X509Extensions.java +751 -0
  257. data/lib/openssl/src/java/org/jruby/ext/openssl/X509Name.java +405 -0
  258. data/lib/openssl/src/java/org/jruby/ext/openssl/X509Revoked.java +111 -0
  259. data/lib/openssl/src/java/org/jruby/ext/openssl/X509Store.java +282 -0
  260. data/lib/openssl/src/java/org/jruby/ext/openssl/X509StoreCtx.java +206 -0
  261. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/ASN1Registry.java +5135 -0
  262. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/Attribute.java +79 -0
  263. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/BIO.java +345 -0
  264. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/BIOFilter.java +38 -0
  265. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/Base64BIOFilter.java +84 -0
  266. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/CipherBIOFilter.java +157 -0
  267. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/Digest.java +126 -0
  268. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/EVP.java +136 -0
  269. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/EncContent.java +178 -0
  270. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/Encrypt.java +77 -0
  271. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/Envelope.java +169 -0
  272. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/IssuerAndSerial.java +35 -0
  273. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/MemBIO.java +117 -0
  274. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/MessageDigestBIOFilter.java +76 -0
  275. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/Mime.java +245 -0
  276. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/MimeHeader.java +103 -0
  277. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/MimeParam.java +69 -0
  278. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/NotVerifiedPKCS7Exception.java +38 -0
  279. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/NullSinkBIO.java +52 -0
  280. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/PKCS7.java +1276 -0
  281. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/PKCS7Data.java +168 -0
  282. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/PKCS7DataData.java +88 -0
  283. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/PKCS7DataDigest.java +64 -0
  284. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/PKCS7DataEncrypted.java +61 -0
  285. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/PKCS7DataEnveloped.java +85 -0
  286. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/PKCS7DataSigned.java +127 -0
  287. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/PKCS7DataSignedAndEnveloped.java +91 -0
  288. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/PKCS7Exception.java +68 -0
  289. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/RecipInfo.java +244 -0
  290. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/SMIME.java +281 -0
  291. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/SignEnvelope.java +202 -0
  292. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/Signed.java +345 -0
  293. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/SignerInfoWithPkey.java +365 -0
  294. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/TypeDiscriminating.java +34 -0
  295. data/lib/openssl/src/java/org/jruby/ext/openssl/impl/utils/Base64.java +1809 -0
  296. data/lib/openssl/src/java/org/jruby/ext/openssl/util/Base64Coder.java +103 -0
  297. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/CRL.java +59 -0
  298. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/Certificate.java +57 -0
  299. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/CertificateFile.java +46 -0
  300. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/CertificateHashDir.java +46 -0
  301. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/Function0.java +43 -0
  302. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/Function1.java +43 -0
  303. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/Function2.java +43 -0
  304. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/Function3.java +43 -0
  305. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/Function4.java +43 -0
  306. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/Function5.java +43 -0
  307. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/Lookup.java +560 -0
  308. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/LookupMethod.java +84 -0
  309. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/Name.java +85 -0
  310. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/PEMInputOutput.java +1210 -0
  311. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/PKey.java +41 -0
  312. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/PolicyTree.java +36 -0
  313. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/Purpose.java +475 -0
  314. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/Store.java +377 -0
  315. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/StoreContext.java +1356 -0
  316. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/Trust.java +279 -0
  317. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/VerifyParameter.java +324 -0
  318. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/X509Aux.java +43 -0
  319. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/X509AuxCertificate.java +170 -0
  320. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/X509Error.java +70 -0
  321. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/X509Object.java +88 -0
  322. data/lib/openssl/src/java/org/jruby/ext/openssl/x509store/X509Utils.java +541 -0
  323. data/lib/openssl/test/cert_with_ec_pk.cer +27 -0
  324. data/lib/openssl/test/fixture/ca_path/72fa7371.0 +19 -0
  325. data/lib/openssl/test/fixture/ca_path/verisign.pem +19 -0
  326. data/lib/openssl/test/fixture/cacert.pem +23 -0
  327. data/lib/openssl/test/fixture/cert_localhost.pem +19 -0
  328. data/lib/openssl/test/fixture/common.pem +48 -0
  329. data/lib/openssl/test/fixture/localhost_keypair.pem +18 -0
  330. data/lib/openssl/test/fixture/max.pem +29 -0
  331. data/lib/openssl/test/fixture/purpose/b70a5bc1.0 +24 -0
  332. data/lib/openssl/test/fixture/purpose/ca/PASSWD_OF_CA_KEY_IS_1234 +0 -0
  333. data/lib/openssl/test/fixture/purpose/ca/ca_config.rb +37 -0
  334. data/lib/openssl/test/fixture/purpose/ca/cacert.pem +24 -0
  335. data/lib/openssl/test/fixture/purpose/ca/newcerts/2_cert.pem +19 -0
  336. data/lib/openssl/test/fixture/purpose/ca/newcerts/3_cert.pem +19 -0
  337. data/lib/openssl/test/fixture/purpose/ca/private/cakeypair.pem +30 -0
  338. data/lib/openssl/test/fixture/purpose/ca/serial +1 -0
  339. data/lib/openssl/test/fixture/purpose/cacert.pem +24 -0
  340. data/lib/openssl/test/fixture/purpose/scripts/gen_cert.rb +127 -0
  341. data/lib/openssl/test/fixture/purpose/scripts/gen_csr.rb +50 -0
  342. data/lib/openssl/test/fixture/purpose/scripts/init_ca.rb +66 -0
  343. data/lib/openssl/test/fixture/purpose/sslclient.pem +19 -0
  344. data/lib/openssl/test/fixture/purpose/sslclient/csr.pem +10 -0
  345. data/lib/openssl/test/fixture/purpose/sslclient/keypair.pem +15 -0
  346. data/lib/openssl/test/fixture/purpose/sslclient/sslclient.pem +19 -0
  347. data/lib/openssl/test/fixture/purpose/sslserver.pem +19 -0
  348. data/lib/openssl/test/fixture/purpose/sslserver/csr.pem +10 -0
  349. data/lib/openssl/test/fixture/purpose/sslserver/keypair.pem +15 -0
  350. data/lib/openssl/test/fixture/purpose/sslserver/sslserver.pem +19 -0
  351. data/lib/openssl/test/fixture/verisign.pem +19 -0
  352. data/lib/openssl/test/fixture/verisign_c3.pem +14 -0
  353. data/lib/openssl/test/openssl/ssl_server.rb +99 -0
  354. data/lib/openssl/test/openssl/test_asn1.rb +199 -0
  355. data/lib/openssl/test/openssl/test_cipher.rb +196 -0
  356. data/lib/openssl/test/openssl/test_digest.rb +88 -0
  357. data/lib/openssl/test/openssl/test_hmac.rb +44 -0
  358. data/lib/openssl/test/openssl/test_ns_spki.rb +69 -0
  359. data/lib/openssl/test/openssl/test_pair.rb +149 -0
  360. data/lib/openssl/test/openssl/test_pkcs7.rb +160 -0
  361. data/lib/openssl/test/openssl/test_pkey_rsa.rb +49 -0
  362. data/lib/openssl/test/openssl/test_ssl.rb +413 -0
  363. data/lib/openssl/test/openssl/test_x509cert.rb +236 -0
  364. data/lib/openssl/test/openssl/test_x509crl.rb +234 -0
  365. data/lib/openssl/test/openssl/test_x509ext.rb +95 -0
  366. data/lib/openssl/test/openssl/test_x509name.rb +281 -0
  367. data/lib/openssl/test/openssl/test_x509req.rb +178 -0
  368. data/lib/openssl/test/openssl/test_x509store.rb +245 -0
  369. data/lib/openssl/test/openssl/utils.rb +135 -0
  370. data/lib/openssl/test/pkcs7_mime_enveloped.message +19 -0
  371. data/lib/openssl/test/pkcs7_mime_signed.message +30 -0
  372. data/lib/openssl/test/pkcs7_multipart_signed.message +45 -0
  373. data/lib/openssl/test/ref/compile.rb +8 -0
  374. data/lib/openssl/test/ref/pkcs1 +0 -0
  375. data/lib/openssl/test/ref/pkcs1.c +21 -0
  376. data/lib/openssl/test/test_cipher.rb +95 -0
  377. data/lib/openssl/test/test_integration.rb +139 -0
  378. data/lib/openssl/test/test_java.rb +98 -0
  379. data/lib/openssl/test/test_java_attribute.rb +25 -0
  380. data/lib/openssl/test/test_java_bio.rb +42 -0
  381. data/lib/openssl/test/test_java_mime.rb +173 -0
  382. data/lib/openssl/test/test_java_pkcs7.rb +769 -0
  383. data/lib/openssl/test/test_java_smime.rb +177 -0
  384. data/lib/openssl/test/test_openssl.rb +34 -0
  385. data/lib/openssl/test/test_openssl_x509.rb +34 -0
  386. data/lib/openssl/test/test_parse_certificate.rb +20 -0
  387. data/lib/openssl/test/test_pkey.rb +46 -0
  388. data/lib/openssl/test/test_x509store.rb +155 -0
  389. data/lib/openssl/test/ut_eof.rb +128 -0
  390. data/lib/redcar.rb +134 -8
  391. data/lib/redcar/installer.rb +46 -11
  392. data/lib/redcar/runner.rb +2 -1
  393. data/lib/redcar/usage.rb +12 -5
  394. data/lib/redcar_quick_start.rb +37 -0
  395. data/plugins/application/features/support/env.rb +9 -1
  396. data/plugins/application/icons/redcar_icon_beta.png +0 -0
  397. data/plugins/application/lib/application.rb +113 -43
  398. data/plugins/application/lib/application/clipboard.rb +28 -4
  399. data/plugins/application/lib/application/command.rb +4 -12
  400. data/plugins/application/lib/application/command/executor.rb +2 -2
  401. data/plugins/application/lib/application/keymap.rb +39 -0
  402. data/plugins/application/lib/application/keymap/builder.rb +19 -0
  403. data/plugins/application/lib/application/speedbar.rb +33 -24
  404. data/plugins/application/lib/application/tab.rb +15 -0
  405. data/plugins/application/lib/application/window.rb +28 -5
  406. data/plugins/application/spec/application/clipboard_spec.rb +20 -1
  407. data/plugins/application/spec/application/command/executor_spec.rb +7 -2
  408. data/plugins/application/spec/application/command_spec.rb +0 -5
  409. data/plugins/application/spec/application/keymap/builder_spec.rb +17 -0
  410. data/plugins/application/spec/application/menu_spec.rb +30 -0
  411. data/plugins/application/spec/application/speedbar_spec.rb +30 -6
  412. data/plugins/application/spec/application/window_spec.rb +2 -2
  413. data/plugins/application/spec/spec_helper.rb +1 -1
  414. data/plugins/application_swt/lib/application_swt.rb +3 -0
  415. data/plugins/application_swt/lib/application_swt/dialogs/filter_list_dialog_controller.rb +10 -1
  416. data/plugins/application_swt/lib/application_swt/html_tab.rb +1 -0
  417. data/plugins/application_swt/lib/application_swt/menu.rb +4 -3
  418. data/plugins/application_swt/lib/application_swt/menu/binding_translator.rb +12 -4
  419. data/plugins/application_swt/lib/application_swt/speedbar.rb +105 -19
  420. data/plugins/application_swt/lib/application_swt/swt_wrapper.rb +2 -0
  421. data/plugins/application_swt/lib/application_swt/window.rb +55 -23
  422. data/plugins/application_swt/spec/spec_helper.rb +0 -1
  423. data/plugins/auto_completer/lib/auto_completer.rb +57 -3
  424. data/plugins/auto_indenter/lib/auto_indenter.rb +1 -1
  425. data/plugins/core/lib/core.rb +5 -3
  426. data/plugins/core/lib/core/interface.rb +73 -0
  427. data/plugins/core/lib/core/model.rb +2 -0
  428. data/plugins/core/lib/core/observable.rb +12 -1
  429. data/plugins/core/lib/core/observable_struct.rb +34 -0
  430. data/plugins/core/lib/core/plugin/storage.rb +16 -3
  431. data/plugins/core/lib/core/reentry_helpers.rb +13 -0
  432. data/plugins/core/spec/core/observable_spec.rb +13 -0
  433. data/plugins/core/spec/core/storage_spec.rb +18 -0
  434. data/plugins/core/spec/spec_helper.rb +1 -0
  435. data/plugins/edit_view/features/cut_and_paste.feature +4 -2
  436. data/plugins/edit_view/features/soft_tabs.feature +243 -0
  437. data/plugins/edit_view/features/step_definitions/editing_steps.rb +91 -2
  438. data/plugins/edit_view/features/step_definitions/tab_steps.rb +1 -1
  439. data/plugins/edit_view/features/tabs.feature +146 -0
  440. data/plugins/edit_view/lib/edit_view.rb +197 -8
  441. data/plugins/edit_view/lib/edit_view/actions/arrow_keys.rb +121 -0
  442. data/plugins/edit_view/lib/edit_view/actions/deletion.rb +30 -0
  443. data/plugins/edit_view/lib/edit_view/actions/tab.rb +66 -0
  444. data/plugins/edit_view/lib/edit_view/command.rb +0 -2
  445. data/plugins/edit_view/lib/edit_view/document.rb +62 -27
  446. data/plugins/edit_view/lib/edit_view/document/command.rb +11 -0
  447. data/plugins/edit_view/lib/edit_view/edit_tab.rb +2 -1
  448. data/plugins/edit_view/lib/edit_view/info_speedbar.rb +69 -0
  449. data/plugins/edit_view/lib/edit_view/tab_settings.rb +40 -0
  450. data/plugins/edit_view/spec/edit_view/document_spec.rb +26 -0
  451. data/plugins/edit_view/spec/spec_helper.rb +0 -1
  452. data/plugins/edit_view_swt/lib/edit_view_swt.rb +57 -69
  453. data/plugins/edit_view_swt/lib/edit_view_swt/document.rb +24 -3
  454. data/plugins/edit_view_swt/lib/edit_view_swt/edit_tab.rb +23 -6
  455. data/plugins/edit_view_swt/spec/spec_helper.rb +0 -1
  456. data/plugins/edit_view_swt/vendor/java-mateview.rb +19 -2
  457. data/plugins/encryption/encryption.rb +38 -0
  458. data/plugins/encryption/ezcrypto.rb +652 -0
  459. data/plugins/encryption/jarmor-1.1.jar +0 -0
  460. data/plugins/encryption/plugin.rb +9 -0
  461. data/plugins/execute_current_tab/lib/execute_current_tab.rb +56 -0
  462. data/plugins/execute_current_tab/plugin.rb +8 -0
  463. data/plugins/html_view/lib/html_view.rb +16 -11
  464. data/plugins/plugin_manager_ui/lib/plugin_manager_ui.rb +2 -1
  465. data/plugins/plugin_manager_ui/views/index.html.erb +22 -4
  466. data/plugins/project/lib/project.rb +140 -26
  467. data/plugins/project/lib/project/drb_service.rb +75 -0
  468. data/plugins/project/lib/project/file_mirror.rb +5 -5
  469. data/plugins/project/lib/project/find_file_dialog.rb +123 -32
  470. data/plugins/project/spec/project/file_mirror_spec.rb +10 -1
  471. data/plugins/project/spec/spec_helper.rb +0 -1
  472. data/plugins/redcar/plugin.rb +1 -1
  473. data/plugins/redcar/redcar.rb +204 -109
  474. data/plugins/redcar/spec/redcar/redcar_spec.rb +70 -0
  475. data/plugins/redcar/spec/spec_helper.rb +4 -0
  476. data/plugins/repl/lib/repl.rb +14 -7
  477. data/plugins/repl/lib/repl/internal_mirror.rb +43 -22
  478. data/plugins/repl/spec/repl/internal_mirror_spec.rb +34 -7
  479. data/plugins/repl/spec/spec_helper.rb +0 -1
  480. data/plugins/tree/spec/spec_helper.rb +0 -1
  481. data/plugins/tree_view_swt/lib/tree_view_swt.rb +1 -1
  482. data/textmate/Bundles/RedcarRepl.tmbundle/Syntaxes/InternalRuby.plist +2 -18
  483. data/textmate/Bundles/asciidoc.tmbundle/Syntaxes/AsciiDoc.tmLanguage +428 -0
  484. metadata +790 -371
  485. data/lib/redcar/boot.rb +0 -108
@@ -0,0 +1,43 @@
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.util.List;
31
+ import java.util.ArrayList;
32
+ import org.bouncycastle.asn1.DERObject;
33
+
34
+ /**
35
+ * @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
36
+ */
37
+ public class X509Aux {
38
+ public List<String> trust = new ArrayList<String>(); // String of OID's /* trusted uses */
39
+ public List<String> reject = new ArrayList<String>(); // String of OID's /* rejected uses */
40
+ public String alias; /* "friendly name" */
41
+ public byte[] keyid; /* key id of private key */
42
+ public List<DERObject> other = new ArrayList<DERObject>(); /* String of OID's of sigAlgs, other unspecified info */
43
+ }// X509_AUX
@@ -0,0 +1,170 @@
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.IOException;
31
+ import java.math.BigInteger;
32
+
33
+ import java.security.Principal;
34
+ import java.security.PublicKey;
35
+ import java.security.NoSuchAlgorithmException;
36
+ import java.security.InvalidKeyException;
37
+ import java.security.NoSuchProviderException;
38
+ import java.security.SignatureException;
39
+ import java.security.cert.CertificateException;
40
+ import java.security.cert.CertificateEncodingException;
41
+ import java.security.cert.CertificateExpiredException;
42
+ import java.security.cert.CertificateNotYetValidException;
43
+ import java.security.cert.CertificateParsingException;
44
+ import java.security.cert.X509Certificate;
45
+
46
+ import java.util.Date;
47
+ import java.util.Collection;
48
+ import java.util.List;
49
+ import java.util.Set;
50
+
51
+ import javax.security.auth.x500.X500Principal;
52
+ import org.bouncycastle.asn1.ASN1InputStream;
53
+ import org.bouncycastle.asn1.DERBitString;
54
+ import org.bouncycastle.asn1.DEROctetString;
55
+
56
+ /**
57
+ * Since regular X509Certificate doesn't represent the Aux part of a
58
+ * certification, this class uses composition and extension to contain
59
+ * both pieces of information.
60
+ *
61
+ * @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
62
+ */
63
+ public class X509AuxCertificate extends X509Certificate {
64
+ private static final long serialVersionUID = -909543379295427515L;
65
+ private final X509Certificate wrap;
66
+ private final X509Aux aux;
67
+
68
+ private boolean valid = false;
69
+ private int ex_flags = 0;
70
+
71
+ public X509AuxCertificate(X509Certificate wrap) {
72
+ this(wrap,null);
73
+ }
74
+
75
+ public X509AuxCertificate(X509Certificate wrap, X509Aux aux) {
76
+ super();
77
+ this.wrap = wrap;
78
+ this.aux = aux;
79
+ }
80
+
81
+ public X509Aux getAux() {
82
+ return this.aux;
83
+ }
84
+
85
+ public boolean isValid() {
86
+ return valid;
87
+ }
88
+
89
+ public void setValid(boolean v) {
90
+ this.valid = v;
91
+ }
92
+
93
+ public int getExFlags() {
94
+ return ex_flags;
95
+ }
96
+
97
+ public void setExFlags(int ex_flags) {
98
+ this.ex_flags = ex_flags;
99
+ }
100
+
101
+ public void checkValidity() throws CertificateExpiredException, CertificateNotYetValidException { wrap.checkValidity(); }
102
+ public void checkValidity(Date date) throws CertificateExpiredException, CertificateNotYetValidException { wrap.checkValidity(date); }
103
+ public int getBasicConstraints() { return wrap.getBasicConstraints(); }
104
+ public List<String> getExtendedKeyUsage() throws CertificateParsingException { return wrap.getExtendedKeyUsage(); }
105
+ public Collection<List<?>> getIssuerAlternativeNames() throws CertificateParsingException { return wrap.getIssuerAlternativeNames(); }
106
+ public Principal getIssuerDN() { return wrap.getIssuerDN(); }
107
+ public boolean[] getIssuerUniqueID() { return wrap.getIssuerUniqueID(); }
108
+ public X500Principal getIssuerX500Principal() { return wrap.getIssuerX500Principal(); }
109
+ public boolean[] getKeyUsage() { return wrap.getKeyUsage(); }
110
+ public Date getNotAfter() { return wrap.getNotAfter(); }
111
+ public Date getNotBefore() { return wrap.getNotBefore(); }
112
+ public BigInteger getSerialNumber() { return wrap.getSerialNumber(); }
113
+ public String getSigAlgName() { return wrap.getSigAlgName(); }
114
+ public String getSigAlgOID() { return wrap.getSigAlgOID(); }
115
+ public byte[] getSigAlgParams() { return wrap.getSigAlgParams(); }
116
+ public byte[] getSignature() { return wrap.getSignature(); }
117
+ public Collection<List<?>> getSubjectAlternativeNames() throws CertificateParsingException { return wrap.getSubjectAlternativeNames(); }
118
+ public Principal getSubjectDN() { return wrap.getSubjectDN(); }
119
+ public boolean[] getSubjectUniqueID() { return wrap.getSubjectUniqueID(); }
120
+ public X500Principal getSubjectX500Principal() { return wrap.getSubjectX500Principal(); }
121
+ public byte[] getTBSCertificate() throws CertificateEncodingException { return wrap.getTBSCertificate(); }
122
+ public int getVersion() { return wrap.getVersion(); }
123
+
124
+ public boolean equals(Object other) {
125
+ boolean ret = this == other;
126
+ if(!ret && (other instanceof X509AuxCertificate)) {
127
+ X509AuxCertificate o = (X509AuxCertificate)other;
128
+ ret = this.wrap.equals(o.wrap) && ((this.aux == null) ? o.aux == null : this.aux.equals(o.aux));
129
+ }
130
+ return ret;
131
+ }
132
+ public byte[] getEncoded() throws CertificateEncodingException { return wrap.getEncoded(); }
133
+ public PublicKey getPublicKey(){ return wrap.getPublicKey(); }
134
+ public int hashCode() {
135
+ int ret = wrap.hashCode();
136
+ ret += 3 * (aux == null ? 1 : aux.hashCode());
137
+ return ret;
138
+ }
139
+ public String toString(){ return wrap.toString(); }
140
+ public void verify(PublicKey key) throws CertificateException,NoSuchAlgorithmException,InvalidKeyException,NoSuchProviderException,SignatureException { wrap.verify(key); }
141
+ public void verify(PublicKey key, String sigProvider) throws CertificateException,NoSuchAlgorithmException,InvalidKeyException,NoSuchProviderException,SignatureException { wrap.verify(key,sigProvider); }
142
+ public Set<String> getCriticalExtensionOIDs(){ return wrap.getCriticalExtensionOIDs(); }
143
+ public byte[] getExtensionValue(String oid){ return wrap.getExtensionValue(oid); }
144
+ public Set<String> getNonCriticalExtensionOIDs(){ return wrap.getNonCriticalExtensionOIDs(); }
145
+ public boolean hasUnsupportedCriticalExtension(){ return wrap.hasUnsupportedCriticalExtension(); }
146
+
147
+ private static final String NS_CERT_TYPE_OID = "2.16.840.1.113730.1.1";
148
+ public Integer getNsCertType() throws CertificateException {
149
+ byte[] bytes = getExtensionValue(NS_CERT_TYPE_OID);
150
+ if (bytes == null) {
151
+ return null;
152
+ }
153
+ try {
154
+ Object o = new ASN1InputStream(bytes).readObject();
155
+ if (o instanceof DERBitString) {
156
+ return ((DERBitString) o).intValue();
157
+ } else if (o instanceof DEROctetString) {
158
+ // just reads initial object for nsCertType definition and ignores trailing objects.
159
+ ASN1InputStream in = new ASN1InputStream(((DEROctetString) o).getOctets());
160
+ o = in.readObject();
161
+ return ((DERBitString) o).intValue();
162
+ } else {
163
+ throw new CertificateException("unknown type from ASN1InputStream.readObject: " + o);
164
+ }
165
+ } catch (IOException ioe) {
166
+ throw new CertificateEncodingException(ioe.getMessage(), ioe);
167
+ }
168
+ }
169
+
170
+ }// X509AuxCertificate
@@ -0,0 +1,70 @@
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.util.ArrayList;
31
+ import java.util.List;
32
+
33
+ /**
34
+ * Used to handle OpenSSL errors in a sane way. These are not safe for
35
+ * multi runtimes at the moments.
36
+ *
37
+ * @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
38
+ */
39
+ public class X509Error {
40
+ private static ThreadLocal<List<ErrorException>> errors = new ThreadLocal<List<ErrorException>>();
41
+
42
+ public static class ErrorException extends Exception {
43
+ private static final long serialVersionUID = -3214495184277468063L;
44
+
45
+ private int reason;
46
+ public ErrorException(int reason) {
47
+ super();
48
+ this.reason = reason;
49
+ }
50
+ public int getReason() {
51
+ return reason;
52
+ }
53
+ }
54
+
55
+ public static synchronized void addError(int reason) {
56
+ List<ErrorException> errs = errors.get();
57
+ if(errs == null) {
58
+ errs = new ArrayList<ErrorException>();
59
+ errors.set(errs);
60
+ }
61
+ errs.add(new ErrorException(reason));
62
+ }
63
+
64
+ public static synchronized void clearErrors() {
65
+ List<ErrorException> errs = errors.get();
66
+ if(errs != null) {
67
+ errs.clear();
68
+ }
69
+ }
70
+ }// Err
@@ -0,0 +1,88 @@
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.util.List;
31
+
32
+ /**
33
+ * c: X509_OBJECT
34
+ *
35
+ * @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
36
+ */
37
+ public abstract class X509Object implements Comparable {
38
+ /**
39
+ * c: X509_OBJECT_idx_by_subject
40
+ */
41
+ public static int indexBySubject(List<? extends X509Object> h, int type, Name name) {
42
+ int ix = 0;
43
+ for(X509Object oo : h) {
44
+ if(type == oo.type() && oo.isName(name)) {
45
+ return ix;
46
+ }
47
+ }
48
+ return -1;
49
+ }
50
+
51
+ /**
52
+ * c: X509_OBJECT_retrieve_by_subject
53
+ */
54
+ public static X509Object retrieveBySubject(List<? extends X509Object> h,int type,Name name) {
55
+ for(X509Object o : h) {
56
+ if(type == o.type() && o.isName(name)) {
57
+ return o;
58
+ }
59
+ }
60
+ return null;
61
+ }
62
+
63
+ /**
64
+ * c: X509_OBJECT_retrieve_match
65
+ */
66
+ public static X509Object retrieveMatch(List<? extends X509Object> h, X509Object x) {
67
+ for(X509Object o : h) {
68
+ if(o.matches(x)) {
69
+ return o;
70
+ }
71
+ }
72
+ return null;
73
+ }
74
+
75
+ public boolean isName(Name nm) {
76
+ return false;
77
+ }
78
+
79
+ public boolean matches(X509Object o) {
80
+ return false;
81
+ }
82
+
83
+ public abstract int type();
84
+
85
+ public int compareTo(Object other) {
86
+ return type() - ((X509Object)other).type();
87
+ }
88
+ }// X509_OBJECT
@@ -0,0 +1,541 @@
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
+
31
+ import java.util.Arrays;
32
+ import org.bouncycastle.asn1.ASN1InputStream;
33
+ import org.bouncycastle.asn1.ASN1OctetString;
34
+ import org.bouncycastle.asn1.ASN1Sequence;
35
+ import org.bouncycastle.asn1.DEREncodable;
36
+ import org.bouncycastle.asn1.DEROctetString;
37
+ import org.bouncycastle.asn1.DERSequence;
38
+ import org.bouncycastle.asn1.DERTaggedObject;
39
+ import org.bouncycastle.asn1.x509.AuthorityKeyIdentifier;
40
+ import org.bouncycastle.asn1.x509.GeneralName;
41
+ import org.bouncycastle.asn1.x509.SubjectKeyIdentifier;
42
+ import org.bouncycastle.asn1.x509.X509Name;
43
+
44
+ /**
45
+ * Contains most of the functionality that beings with X509 in
46
+ * crypty/x509/x509_def.c, crypty/x509/x509_txt.c and others.
47
+ *
48
+ * @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
49
+ */
50
+ public abstract class X509Utils {
51
+ private X509Utils() {}
52
+
53
+ /**
54
+ * c: X509_get_default_private_dir
55
+ */
56
+ public static String getDefaultPrivateDir() {
57
+ return X509_PRIVATE_DIR;
58
+ }
59
+
60
+ /**
61
+ * c: X509_get_default_cert_area
62
+ */
63
+ public static String getDefaultCertificateArea() {
64
+ return X509_CERT_AREA;
65
+ }
66
+
67
+ /**
68
+ * c: X509_get_default_cert_dir
69
+ */
70
+ public static String getDefaultCertificateDirectory() {
71
+ return X509_CERT_DIR;
72
+ }
73
+
74
+ /**
75
+ * c: X509_get_default_cert_file
76
+ */
77
+ public static String getDefaultCertificateFile() {
78
+ return X509_CERT_FILE;
79
+ }
80
+
81
+ /**
82
+ * c: X509_get_default_cert_dir_env
83
+ */
84
+ public static String getDefaultCertificateDirectoryEnvironment() {
85
+ return X509_CERT_DIR_EVP;
86
+ }
87
+
88
+ /**
89
+ * c: X509_get_default_cert_file_env
90
+ */
91
+ public static String getDefaultCertificateFileEnvironment() {
92
+ return X509_CERT_FILE_EVP;
93
+ }
94
+
95
+ /**
96
+ * c: X509_verify_cert_error_string
97
+ */
98
+ public static String verifyCertificateErrorString(int n) {
99
+ switch(n){
100
+ case V_OK:
101
+ return("ok");
102
+ case V_ERR_UNABLE_TO_GET_ISSUER_CERT:
103
+ return("unable to get issuer certificate");
104
+ case V_ERR_UNABLE_TO_GET_CRL:
105
+ return("unable to get certificate CRL");
106
+ case V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE:
107
+ return("unable to decrypt certificate's signature");
108
+ case V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE:
109
+ return("unable to decrypt CRL's signature");
110
+ case V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY:
111
+ return("unable to decode issuer public key");
112
+ case V_ERR_CERT_SIGNATURE_FAILURE:
113
+ return("certificate signature failure");
114
+ case V_ERR_CRL_SIGNATURE_FAILURE:
115
+ return("CRL signature failure");
116
+ case V_ERR_CERT_NOT_YET_VALID:
117
+ return("certificate is not yet valid");
118
+ case V_ERR_CRL_NOT_YET_VALID:
119
+ return("CRL is not yet valid");
120
+ case V_ERR_CERT_HAS_EXPIRED:
121
+ return("certificate has expired");
122
+ case V_ERR_CRL_HAS_EXPIRED:
123
+ return("CRL has expired");
124
+ case V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
125
+ return("format error in certificate's notBefore field");
126
+ case V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
127
+ return("format error in certificate's notAfter field");
128
+ case V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD:
129
+ return("format error in CRL's lastUpdate field");
130
+ case V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD:
131
+ return("format error in CRL's nextUpdate field");
132
+ case V_ERR_OUT_OF_MEM:
133
+ return("out of memory");
134
+ case V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT:
135
+ return("self signed certificate");
136
+ case V_ERR_SELF_SIGNED_CERT_IN_CHAIN:
137
+ return("self signed certificate in certificate chain");
138
+ case V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY:
139
+ return("unable to get local issuer certificate");
140
+ case V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE:
141
+ return("unable to verify the first certificate");
142
+ case V_ERR_CERT_CHAIN_TOO_LONG:
143
+ return("certificate chain too long");
144
+ case V_ERR_CERT_REVOKED:
145
+ return("certificate revoked");
146
+ case V_ERR_INVALID_CA:
147
+ return ("invalid CA certificate");
148
+ case V_ERR_INVALID_NON_CA:
149
+ return ("invalid non-CA certificate (has CA markings)");
150
+ case V_ERR_PATH_LENGTH_EXCEEDED:
151
+ return ("path length constraint exceeded");
152
+ case V_ERR_PROXY_PATH_LENGTH_EXCEEDED:
153
+ return("proxy path length constraint exceeded");
154
+ case V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED:
155
+ return("proxy cerificates not allowed, please set the appropriate flag");
156
+ case V_ERR_INVALID_PURPOSE:
157
+ return ("unsupported certificate purpose");
158
+ case V_ERR_CERT_UNTRUSTED:
159
+ return ("certificate not trusted");
160
+ case V_ERR_CERT_REJECTED:
161
+ return ("certificate rejected");
162
+ case V_ERR_APPLICATION_VERIFICATION:
163
+ return("application verification failure");
164
+ case V_ERR_SUBJECT_ISSUER_MISMATCH:
165
+ return("subject issuer mismatch");
166
+ case V_ERR_AKID_SKID_MISMATCH:
167
+ return("authority and subject key identifier mismatch");
168
+ case V_ERR_AKID_ISSUER_SERIAL_MISMATCH:
169
+ return("authority and issuer serial number mismatch");
170
+ case V_ERR_KEYUSAGE_NO_CERTSIGN:
171
+ return("key usage does not include certificate signing");
172
+ case V_ERR_UNABLE_TO_GET_CRL_ISSUER:
173
+ return("unable to get CRL issuer certificate");
174
+ case V_ERR_UNHANDLED_CRITICAL_EXTENSION:
175
+ return("unhandled critical extension");
176
+ case V_ERR_KEYUSAGE_NO_CRL_SIGN:
177
+ return("key usage does not include CRL signing");
178
+ case V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE:
179
+ return("key usage does not include digital signature");
180
+ case V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION:
181
+ return("unhandled critical CRL extension");
182
+ case V_ERR_INVALID_EXTENSION:
183
+ return("invalid or inconsistent certificate extension");
184
+ case V_ERR_INVALID_POLICY_EXTENSION:
185
+ return("invalid or inconsistent certificate policy extension");
186
+ case V_ERR_NO_EXPLICIT_POLICY:
187
+ return("no explicit policy");
188
+ default:
189
+ return "error number " + n;
190
+ }
191
+ }
192
+
193
+ private static Object get(Object str) throws Exception {
194
+ return get(((DEROctetString)str).getOctets());
195
+ }
196
+
197
+ private static Object get(DEROctetString str) throws Exception {
198
+ return get(str.getOctets());
199
+ }
200
+
201
+ private static Object get(byte[] str) throws Exception {
202
+ return new ASN1InputStream(str).readObject();
203
+ }
204
+
205
+ private static String p(Object obj) throws Exception {
206
+ return obj.toString() + " [" + obj.getClass().getName() + "]";
207
+ }
208
+
209
+ /**
210
+ * c: X509_check_issued
211
+ */
212
+ public static int checkIfIssuedBy(X509AuxCertificate issuer, X509AuxCertificate subject) throws Exception {
213
+ if(!issuer.getSubjectX500Principal().equals(subject.getIssuerX500Principal())) {
214
+ return V_ERR_SUBJECT_ISSUER_MISMATCH;
215
+ }
216
+
217
+ if(subject.getExtensionValue("2.5.29.35") != null) { //authorityKeyID
218
+ // I hate ASN1 and DER
219
+ Object key = get(subject.getExtensionValue("2.5.29.35"));
220
+ if(!(key instanceof ASN1Sequence)) {
221
+ key = get(key);
222
+ }
223
+
224
+ ASN1Sequence seq = (ASN1Sequence)key;
225
+ AuthorityKeyIdentifier sakid = null;
226
+ if(seq.size() == 1 && (seq.getObjectAt(0) instanceof ASN1OctetString)) {
227
+ sakid = new AuthorityKeyIdentifier(new DERSequence(new DERTaggedObject(0, seq.getObjectAt(0))));
228
+ } else {
229
+ sakid = new AuthorityKeyIdentifier(seq);
230
+ }
231
+
232
+ if(sakid.getKeyIdentifier() != null) {
233
+ if(issuer.getExtensionValue("2.5.29.14") != null) {
234
+ DEROctetString der = (DEROctetString)get(issuer.getExtensionValue("2.5.29.14"));
235
+ if(der.getOctets().length > 20) {
236
+ der = (DEROctetString)get(der.getOctets());
237
+ }
238
+ SubjectKeyIdentifier iskid = new SubjectKeyIdentifier(der);
239
+ if(iskid.getKeyIdentifier() != null) {
240
+ if(!Arrays.equals(sakid.getKeyIdentifier(),iskid.getKeyIdentifier())) {
241
+ return V_ERR_AKID_SKID_MISMATCH;
242
+ }
243
+ }
244
+ }
245
+ }
246
+ if(sakid.getAuthorityCertSerialNumber() != null && !sakid.getAuthorityCertSerialNumber().equals(issuer.getSerialNumber())) {
247
+ return V_ERR_AKID_ISSUER_SERIAL_MISMATCH;
248
+ }
249
+ if(sakid.getAuthorityCertIssuer() != null) {
250
+ GeneralName[] gens = sakid.getAuthorityCertIssuer().getNames();
251
+ X509Name nm = null;
252
+ for(int i=0;i<gens.length;i++) {
253
+ if(gens[i].getTagNo() == GeneralName.directoryName) {
254
+ DEREncodable nameTmp = gens[i].getName();
255
+ if (nameTmp instanceof X509Name) {
256
+ nm = (X509Name)nameTmp;
257
+ } else if (nameTmp instanceof DERSequence) {
258
+ nm = new X509Name((DERSequence)nameTmp);
259
+ } else {
260
+ throw new RuntimeException("unknown name type in X509Utils: " + nameTmp);
261
+ }
262
+ break;
263
+ }
264
+ }
265
+ if(nm != null) {
266
+ if(!(new Name(nm).isEqual(issuer.getIssuerX500Principal()))) {
267
+ return V_ERR_AKID_ISSUER_SERIAL_MISMATCH;
268
+ }
269
+ }
270
+ }
271
+ }
272
+
273
+ if(subject.getExtensionValue("1.3.6.1.5.5.7.1.14") != null) {
274
+ if(issuer.getKeyUsage() != null && !issuer.getKeyUsage()[0]) { // KU_DIGITAL_SIGNATURE
275
+ return V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE;
276
+ }
277
+ } else if(issuer.getKeyUsage() != null && !issuer.getKeyUsage()[5]) { // KU_KEY_CERT_SIGN
278
+ return V_ERR_KEYUSAGE_NO_CERTSIGN;
279
+ }
280
+ return V_OK;
281
+ }
282
+
283
+ public static final String OPENSSLDIR = "/usr/local/openssl";
284
+
285
+ public static final String X509_CERT_AREA = OPENSSLDIR;
286
+ public static final String X509_CERT_DIR = OPENSSLDIR+"/certs";
287
+ public static final String X509_CERT_FILE = OPENSSLDIR+"/cert.pem";
288
+ public static final String X509_PRIVATE_DIR = OPENSSLDIR+"/private";
289
+
290
+ public static final String X509_CERT_DIR_EVP = "SSL_CERT_DIR";
291
+ public static final String X509_CERT_FILE_EVP = "SSL_CERT_FILE";
292
+
293
+ public static final Object CRYPTO_LOCK_X509_STORE = new Object();
294
+
295
+ public static final int X509_LU_RETRY=-1;
296
+ public static final int X509_LU_FAIL=0;
297
+ public static final int X509_LU_X509=1;
298
+ public static final int X509_LU_CRL=2;
299
+ public static final int X509_LU_PKEY=3;
300
+
301
+ public static final int X509_FILETYPE_PEM = 1;
302
+ public static final int X509_FILETYPE_ASN1 = 2;
303
+ public static final int X509_FILETYPE_DEFAULT = 3;
304
+
305
+ public static final int X509_L_FILE_LOAD = 1;
306
+ public static final int X509_L_ADD_DIR = 2;
307
+
308
+ public static final int V_OK = 0;
309
+ public static final int V_ERR_UNABLE_TO_GET_ISSUER_CERT = 2;
310
+ public static final int V_ERR_UNABLE_TO_GET_CRL = 3;
311
+ public static final int V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE = 4;
312
+ public static final int V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE = 5;
313
+ public static final int V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY = 6;
314
+ public static final int V_ERR_CERT_SIGNATURE_FAILURE = 7;
315
+ public static final int V_ERR_CRL_SIGNATURE_FAILURE = 8;
316
+ public static final int V_ERR_CERT_NOT_YET_VALID = 9;
317
+ public static final int V_ERR_CERT_HAS_EXPIRED = 10;
318
+ public static final int V_ERR_CRL_NOT_YET_VALID = 11;
319
+ public static final int V_ERR_CRL_HAS_EXPIRED = 12;
320
+ public static final int V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD = 13;
321
+ public static final int V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD = 14;
322
+ public static final int V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD = 15;
323
+ public static final int V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD = 16;
324
+ public static final int V_ERR_OUT_OF_MEM = 17;
325
+ public static final int V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT = 18;
326
+ public static final int V_ERR_SELF_SIGNED_CERT_IN_CHAIN = 19;
327
+ public static final int V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY = 20;
328
+ public static final int V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE = 21;
329
+ public static final int V_ERR_CERT_CHAIN_TOO_LONG = 22;
330
+ public static final int V_ERR_CERT_REVOKED = 23;
331
+ public static final int V_ERR_INVALID_CA = 24;
332
+ public static final int V_ERR_PATH_LENGTH_EXCEEDED = 25;
333
+ public static final int V_ERR_INVALID_PURPOSE = 26;
334
+ public static final int V_ERR_CERT_UNTRUSTED = 27;
335
+ public static final int V_ERR_CERT_REJECTED = 28;
336
+
337
+ public static final int V_ERR_SUBJECT_ISSUER_MISMATCH = 29;
338
+ public static final int V_ERR_AKID_SKID_MISMATCH = 30;
339
+ public static final int V_ERR_AKID_ISSUER_SERIAL_MISMATCH = 31;
340
+ public static final int V_ERR_KEYUSAGE_NO_CERTSIGN = 32;
341
+
342
+ public static final int V_ERR_UNABLE_TO_GET_CRL_ISSUER = 33;
343
+ public static final int V_ERR_UNHANDLED_CRITICAL_EXTENSION = 34;
344
+ public static final int V_ERR_KEYUSAGE_NO_CRL_SIGN = 35;
345
+ public static final int V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION = 36;
346
+ public static final int V_ERR_INVALID_NON_CA = 37;
347
+ public static final int V_ERR_PROXY_PATH_LENGTH_EXCEEDED = 38;
348
+ public static final int V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE = 39;
349
+ public static final int V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED = 40;
350
+
351
+ public static final int V_ERR_INVALID_EXTENSION = 41;
352
+ public static final int V_ERR_INVALID_POLICY_EXTENSION = 42;
353
+ public static final int V_ERR_NO_EXPLICIT_POLICY = 43;
354
+
355
+ public static final int V_ERR_APPLICATION_VERIFICATION = 50;
356
+
357
+ public static final int V_FLAG_CB_ISSUER_CHECK = 0x1;
358
+ public static final int V_FLAG_USE_CHECK_TIME = 0x2;
359
+ public static final int V_FLAG_CRL_CHECK = 0x4;
360
+ public static final int V_FLAG_CRL_CHECK_ALL = 0x8;
361
+ public static final int V_FLAG_IGNORE_CRITICAL = 0x10;
362
+ public static final int V_FLAG_STRICT = 0x20;
363
+ public static final int V_FLAG_X509_STRICT = 0x20;
364
+ public static final int V_FLAG_ALLOW_PROXY_CERTS = 0x40;
365
+ public static final int V_FLAG_POLICY_CHECK = 0x80;
366
+ public static final int V_FLAG_EXPLICIT_POLICY = 0x100;
367
+ public static final int V_FLAG_INHIBIT_ANY = 0x200;
368
+ public static final int V_FLAG_INHIBIT_MAP = 0x400;
369
+ public static final int V_FLAG_NOTIFY_POLICY = 0x800;
370
+
371
+ public static final int VP_FLAG_DEFAULT = 0x1;
372
+ public static final int VP_FLAG_OVERWRITE = 0x2;
373
+ public static final int VP_FLAG_RESET_FLAGS = 0x4;
374
+ public static final int VP_FLAG_LOCKED = 0x8;
375
+ public static final int VP_FLAG_ONCE = 0x10;
376
+
377
+ /* Internal use: mask of policy related options */
378
+ public static final int V_FLAG_POLICY_MASK = (V_FLAG_POLICY_CHECK |
379
+ V_FLAG_EXPLICIT_POLICY |
380
+ V_FLAG_INHIBIT_ANY |
381
+ V_FLAG_INHIBIT_MAP);
382
+
383
+ public static final int X509_R_BAD_X509_FILETYPE = 100;
384
+ public static final int X509_R_BASE64_DECODE_ERROR = 118;
385
+ public static final int X509_R_CANT_CHECK_DH_KEY = 114;
386
+ public static final int X509_R_CERT_ALREADY_IN_HASH_TABLE = 101;
387
+ public static final int X509_R_ERR_ASN1_LIB = 102;
388
+ public static final int X509_R_INVALID_DIRECTORY = 113;
389
+ public static final int X509_R_INVALID_FIELD_NAME = 119;
390
+ public static final int X509_R_INVALID_TRUST = 123;
391
+ public static final int X509_R_KEY_TYPE_MISMATCH = 115;
392
+ public static final int X509_R_KEY_VALUES_MISMATCH = 116;
393
+ public static final int X509_R_LOADING_CERT_DIR = 103;
394
+ public static final int X509_R_LOADING_DEFAULTS = 104;
395
+ public static final int X509_R_NO_CERT_SET_FOR_US_TO_VERIFY = 105;
396
+ public static final int X509_R_SHOULD_RETRY = 106;
397
+ public static final int X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN = 107;
398
+ public static final int X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY = 108;
399
+ public static final int X509_R_UNKNOWN_KEY_TYPE = 117;
400
+ public static final int X509_R_UNKNOWN_NID = 109;
401
+ public static final int X509_R_UNKNOWN_PURPOSE_ID = 121;
402
+ public static final int X509_R_UNKNOWN_TRUST_ID = 120;
403
+ public static final int X509_R_UNSUPPORTED_ALGORITHM = 111;
404
+ public static final int X509_R_WRONG_LOOKUP_TYPE = 112;
405
+ public static final int X509_R_WRONG_TYPE = 122;
406
+
407
+ public static final int X509_VP_FLAG_DEFAULT = 0x1;
408
+ public static final int X509_VP_FLAG_OVERWRITE = 0x2;
409
+ public static final int X509_VP_FLAG_RESET_FLAGS = 0x4;
410
+ public static final int X509_VP_FLAG_LOCKED = 0x8;
411
+ public static final int X509_VP_FLAG_ONCE = 0x10;
412
+
413
+ public static final int X509_PURPOSE_SSL_CLIENT = 1;
414
+ public static final int X509_PURPOSE_SSL_SERVER = 2;
415
+ public static final int X509_PURPOSE_NS_SSL_SERVER = 3;
416
+ public static final int X509_PURPOSE_SMIME_SIGN = 4;
417
+ public static final int X509_PURPOSE_SMIME_ENCRYPT = 5;
418
+ public static final int X509_PURPOSE_CRL_SIGN = 6;
419
+ public static final int X509_PURPOSE_ANY = 7;
420
+ public static final int X509_PURPOSE_OCSP_HELPER = 8;
421
+
422
+ public static final int X509_PURPOSE_DYNAMIC = 0x1;
423
+ public static final int X509_PURPOSE_DYNAMIC_NAME = 0x2;
424
+
425
+ public static final int X509_PURPOSE_MIN = 1;
426
+ public static final int X509_PURPOSE_MAX = 8;
427
+
428
+ public static final int X509_TRUST_DEFAULT = -1;
429
+
430
+ public static final int X509_TRUST_COMPAT = 1;
431
+ public static final int X509_TRUST_SSL_CLIENT = 2;
432
+ public static final int X509_TRUST_SSL_SERVER = 3;
433
+ public static final int X509_TRUST_EMAIL = 4;
434
+ public static final int X509_TRUST_OBJECT_SIGN = 5;
435
+ public static final int X509_TRUST_OCSP_SIGN = 6;
436
+ public static final int X509_TRUST_OCSP_REQUEST = 7;
437
+
438
+ public static final int X509_TRUST_MIN = 1;
439
+ public static final int X509_TRUST_MAX = 7;
440
+
441
+ public static final int X509_TRUST_DYNAMIC = 1;
442
+ public static final int X509_TRUST_DYNAMIC_NAME = 2;
443
+
444
+ public static final int X509_TRUST_TRUSTED = 1;
445
+ public static final int X509_TRUST_REJECTED = 2;
446
+ public static final int X509_TRUST_UNTRUSTED = 3;
447
+
448
+ public static final int NS_SSL_CLIENT=0x80;
449
+ public static final int NS_SSL_SERVER=0x40;
450
+ public static final int NS_SMIME=0x20;
451
+ public static final int NS_OBJSIGN=0x10;
452
+ public static final int NS_SSL_CA=0x04;
453
+ public static final int NS_SMIME_CA=0x02;
454
+ public static final int NS_OBJSIGN_CA=0x01;
455
+ public static final int NS_ANY_CA=(NS_SSL_CA|NS_SMIME_CA|NS_OBJSIGN_CA);
456
+
457
+ public static final int X509V3_R_BAD_IP_ADDRESS = 118;
458
+ public static final int X509V3_R_BAD_OBJECT = 119;
459
+ public static final int X509V3_R_BN_DEC2BN_ERROR = 100;
460
+ public static final int X509V3_R_BN_TO_ASN1_INTEGER_ERROR = 101;
461
+ public static final int X509V3_R_DIRNAME_ERROR = 149;
462
+ public static final int X509V3_R_DUPLICATE_ZONE_ID = 133;
463
+ public static final int X509V3_R_ERROR_CONVERTING_ZONE = 131;
464
+ public static final int X509V3_R_ERROR_CREATING_EXTENSION = 144;
465
+ public static final int X509V3_R_ERROR_IN_EXTENSION = 128;
466
+ public static final int X509V3_R_EXPECTED_A_SECTION_NAME = 137;
467
+ public static final int X509V3_R_EXTENSION_EXISTS = 145;
468
+ public static final int X509V3_R_EXTENSION_NAME_ERROR = 115;
469
+ public static final int X509V3_R_EXTENSION_NOT_FOUND = 102;
470
+ public static final int X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED = 103;
471
+ public static final int X509V3_R_EXTENSION_VALUE_ERROR = 116;
472
+ public static final int X509V3_R_ILLEGAL_EMPTY_EXTENSION = 151;
473
+ public static final int X509V3_R_ILLEGAL_HEX_DIGIT = 113;
474
+ public static final int X509V3_R_INCORRECT_POLICY_SYNTAX_TAG = 152;
475
+ public static final int X509V3_R_INVALID_BOOLEAN_STRING = 104;
476
+ public static final int X509V3_R_INVALID_EXTENSION_STRING = 105;
477
+ public static final int X509V3_R_INVALID_NAME = 106;
478
+ public static final int X509V3_R_INVALID_NULL_ARGUMENT = 107;
479
+ public static final int X509V3_R_INVALID_NULL_NAME = 108;
480
+ public static final int X509V3_R_INVALID_NULL_VALUE = 109;
481
+ public static final int X509V3_R_INVALID_NUMBER = 140;
482
+ public static final int X509V3_R_INVALID_NUMBERS = 141;
483
+ public static final int X509V3_R_INVALID_OBJECT_IDENTIFIER = 110;
484
+ public static final int X509V3_R_INVALID_OPTION = 138;
485
+ public static final int X509V3_R_INVALID_POLICY_IDENTIFIER = 134;
486
+ public static final int X509V3_R_INVALID_PROXY_POLICY_SETTING = 153;
487
+ public static final int X509V3_R_INVALID_PURPOSE = 146;
488
+ public static final int X509V3_R_INVALID_SECTION = 135;
489
+ public static final int X509V3_R_INVALID_SYNTAX = 143;
490
+ public static final int X509V3_R_ISSUER_DECODE_ERROR = 126;
491
+ public static final int X509V3_R_MISSING_VALUE = 124;
492
+ public static final int X509V3_R_NEED_ORGANIZATION_AND_NUMBERS = 142;
493
+ public static final int X509V3_R_NO_CONFIG_DATABASE = 136;
494
+ public static final int X509V3_R_NO_ISSUER_CERTIFICATE = 121;
495
+ public static final int X509V3_R_NO_ISSUER_DETAILS = 127;
496
+ public static final int X509V3_R_NO_POLICY_IDENTIFIER = 139;
497
+ public static final int X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED = 154;
498
+ public static final int X509V3_R_NO_PUBLIC_KEY = 114;
499
+ public static final int X509V3_R_NO_SUBJECT_DETAILS = 125;
500
+ public static final int X509V3_R_ODD_NUMBER_OF_DIGITS = 112;
501
+ public static final int X509V3_R_OPERATION_NOT_DEFINED = 148;
502
+ public static final int X509V3_R_OTHERNAME_ERROR = 147;
503
+ public static final int X509V3_R_POLICY_LANGUAGE_ALREADTY_DEFINED = 155;
504
+ public static final int X509V3_R_POLICY_PATH_LENGTH = 156;
505
+ public static final int X509V3_R_POLICY_PATH_LENGTH_ALREADTY_DEFINED = 157;
506
+ public static final int X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED = 158;
507
+ public static final int X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY = 159;
508
+ public static final int X509V3_R_SECTION_NOT_FOUND = 150;
509
+ public static final int X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS = 122;
510
+ public static final int X509V3_R_UNABLE_TO_GET_ISSUER_KEYID = 123;
511
+ public static final int X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT = 111;
512
+ public static final int X509V3_R_UNKNOWN_EXTENSION = 129;
513
+ public static final int X509V3_R_UNKNOWN_EXTENSION_NAME = 130;
514
+ public static final int X509V3_R_UNKNOWN_OPTION = 120;
515
+ public static final int X509V3_R_UNSUPPORTED_OPTION = 117;
516
+ public static final int X509V3_R_USER_TOO_LONG = 132;
517
+
518
+ public static final int ERR_R_FATAL=64;
519
+ public static final int ERR_R_MALLOC_FAILURE=(1|ERR_R_FATAL);
520
+ public static final int ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED=(2|ERR_R_FATAL);
521
+ public static final int ERR_R_PASSED_NULL_PARAMETER=(3|ERR_R_FATAL);
522
+ public static final int ERR_R_INTERNAL_ERROR=(4|ERR_R_FATAL);
523
+ public static final int ERR_R_DISABLED=(5|ERR_R_FATAL);
524
+
525
+ public static final int EXFLAG_BCONS=0x1;
526
+ public static final int EXFLAG_KUSAGE=0x2;
527
+ public static final int EXFLAG_XKUSAGE=0x4;
528
+ public static final int EXFLAG_NSCERT=0x8;
529
+
530
+ public static final int EXFLAG_CA=0x10;
531
+ public static final int EXFLAG_SS=0x20;
532
+ public static final int EXFLAG_V1=0x40;
533
+ public static final int EXFLAG_INVALID=0x80;
534
+ public static final int EXFLAG_SET=0x100;
535
+ public static final int EXFLAG_CRITICAL=0x200;
536
+ public static final int EXFLAG_PROXY=0x400;
537
+
538
+ public static final int EXFLAG_INVALID_POLICY=0x400;
539
+
540
+ public static final int POLICY_FLAG_ANY_POLICY = 0x2;
541
+ }// X509