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,53 @@
1
+ /***** BEGIN LICENSE BLOCK *****
2
+ * Version: CPL 1.0/GPL 2.0/LGPL 2.1
3
+ *
4
+ * The contents of this file are subject to the Common Public
5
+ * License Version 1.0 (the "License"); you may not use this file
6
+ * except in compliance with the License. You may obtain a copy of
7
+ * the License at http://www.eclipse.org/legal/cpl-v10.html
8
+ *
9
+ * Software distributed under the License is distributed on an "AS
10
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
11
+ * implied. See the License for the specific language governing
12
+ * rights and limitations under the License.
13
+ *
14
+ * Copyright (C) 2006 Ola Bini <ola@ologix.com>
15
+ *
16
+ * Alternatively, the contents of this file may be used under the terms of
17
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
18
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
19
+ * in which case the provisions of the GPL or the LGPL are applicable instead
20
+ * of those above. If you wish to allow use of your version of this file only
21
+ * under the terms of either the GPL or the LGPL, and not to allow others to
22
+ * use your version of this file under the terms of the CPL, indicate your
23
+ * decision by deleting the provisions above and replace them with the notice
24
+ * and other provisions required by the GPL or the LGPL. If you do not delete
25
+ * the provisions above, a recipient may use your version of this file under
26
+ * the terms of any one of the CPL, the GPL or the LGPL.
27
+ ***** END LICENSE BLOCK *****/
28
+ package org.jruby.ext.openssl;
29
+
30
+ import java.security.Key;
31
+
32
+ import javax.crypto.SecretKey;
33
+
34
+ /**
35
+ * @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
36
+ */
37
+ public class SimpleSecretKey implements Key, SecretKey {
38
+ private static final long serialVersionUID = -3941646158676294788L;
39
+
40
+ private final byte[] value;
41
+ public SimpleSecretKey(byte[] value) {
42
+ this.value = value;
43
+ }
44
+ public String getAlgorithm() {
45
+ return null;
46
+ }
47
+ public byte[] getEncoded() {
48
+ return value;
49
+ }
50
+ public String getFormat() {
51
+ return "RAW";
52
+ }
53
+ }// SimpleSecretKey
@@ -0,0 +1,60 @@
1
+ /***** BEGIN LICENSE BLOCK *****
2
+ * Version: CPL 1.0/GPL 2.0/LGPL 2.1
3
+ *
4
+ * The contents of this file are subject to the Common Public
5
+ * License Version 1.0 (the "License"); you may not use this file
6
+ * except in compliance with the License. You may obtain a copy of
7
+ * the License at http://www.eclipse.org/legal/cpl-v10.html
8
+ *
9
+ * Software distributed under the License is distributed on an "AS
10
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
11
+ * implied. See the License for the specific language governing
12
+ * rights and limitations under the License.
13
+ *
14
+ * Copyright (C) 2006 Ola Bini <ola@ologix.com>
15
+ *
16
+ * Alternatively, the contents of this file may be used under the terms of
17
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
18
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
19
+ * in which case the provisions of the GPL or the LGPL are applicable instead
20
+ * of those above. If you wish to allow use of your version of this file only
21
+ * under the terms of either the GPL or the LGPL, and not to allow others to
22
+ * use your version of this file under the terms of the CPL, indicate your
23
+ * decision by deleting the provisions above and replace them with the notice
24
+ * and other provisions required by the GPL or the LGPL. If you do not delete
25
+ * the provisions above, a recipient may use your version of this file under
26
+ * the terms of any one of the CPL, the GPL or the LGPL.
27
+ ***** END LICENSE BLOCK *****/
28
+ package org.jruby.ext.openssl;
29
+
30
+ /**
31
+ * @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
32
+ */
33
+ public class Utils {
34
+ private Utils() {}
35
+ public static String toHex(byte[] val) {
36
+ StringBuffer out = new StringBuffer();
37
+ for(int i=0,j=val.length;i<j;i++) {
38
+ String ve = Integer.toString((((int)((char)val[i])) & 0xFF),16);
39
+ if(ve.length() == 1) {
40
+ ve = "0" + ve;
41
+ }
42
+ out.append(ve);
43
+ }
44
+ return out.toString();
45
+ }
46
+
47
+ public static String toHex(byte[] val, char sep) {
48
+ StringBuffer out = new StringBuffer();
49
+ String sap = "";
50
+ for(int i=0,j=val.length;i<j;i++) {
51
+ String ve = Integer.toString((((int)((char)val[i])) & 0xFF),16);
52
+ if(ve.length() == 1) {
53
+ ve = "0" + ve;
54
+ }
55
+ out.append(sap).append(ve);
56
+ sap = ""+(char)sep;
57
+ }
58
+ return out.toString().toUpperCase();
59
+ }
60
+ }// Utils
@@ -0,0 +1,108 @@
1
+ /***** BEGIN LICENSE BLOCK *****
2
+ * Version: CPL 1.0/GPL 2.0/LGPL 2.1
3
+ *
4
+ * The contents of this file are subject to the Common Public
5
+ * License Version 1.0 (the "License"); you may not use this file
6
+ * except in compliance with the License. You may obtain a copy of
7
+ * the License at http://www.eclipse.org/legal/cpl-v10.html
8
+ *
9
+ * Software distributed under the License is distributed on an "AS
10
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
11
+ * implied. See the License for the specific language governing
12
+ * rights and limitations under the License.
13
+ *
14
+ * Copyright (C) 2006 Ola Bini <ola@ologix.com>
15
+ *
16
+ * Alternatively, the contents of this file may be used under the terms of
17
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
18
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
19
+ * in which case the provisions of the GPL or the LGPL are applicable instead
20
+ * of those above. If you wish to allow use of your version of this file only
21
+ * under the terms of either the GPL or the LGPL, and not to allow others to
22
+ * use your version of this file under the terms of the CPL, indicate your
23
+ * decision by deleting the provisions above and replace them with the notice
24
+ * and other provisions required by the GPL or the LGPL. If you do not delete
25
+ * the provisions above, a recipient may use your version of this file under
26
+ * the terms of any one of the CPL, the GPL or the LGPL.
27
+ ***** END LICENSE BLOCK *****/
28
+ package org.jruby.ext.openssl;
29
+
30
+ import org.jruby.Ruby;
31
+ import org.jruby.RubyModule;
32
+
33
+ /**
34
+ * @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
35
+ */
36
+ public class X509 {
37
+ public static void createX509(Ruby runtime, RubyModule ossl) {
38
+ RubyModule mX509 = ossl.defineModuleUnder("X509");
39
+
40
+ X509Name.createX509Name(runtime,mX509);
41
+ X509Cert.createX509Cert(runtime,mX509);
42
+ X509Extensions.createX509Ext(runtime,mX509);
43
+ X509CRL.createX509CRL(runtime,mX509);
44
+ X509Revoked.createX509Revoked(runtime,mX509);
45
+ X509Store.createX509Store(runtime,mX509);
46
+ Request.createRequest(runtime,mX509);
47
+ Attribute.createAttribute(runtime,mX509);
48
+
49
+ mX509.setConstant("V_OK",runtime.newFixnum(0));
50
+ mX509.setConstant("V_ERR_UNABLE_TO_GET_ISSUER_CERT",runtime.newFixnum(2));
51
+ mX509.setConstant("V_ERR_UNABLE_TO_GET_CRL",runtime.newFixnum(3));
52
+ mX509.setConstant("V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE",runtime.newFixnum(4));
53
+ mX509.setConstant("V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE",runtime.newFixnum(5));
54
+ mX509.setConstant("V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY",runtime.newFixnum(6));
55
+ mX509.setConstant("V_ERR_CERT_SIGNATURE_FAILURE",runtime.newFixnum(7));
56
+ mX509.setConstant("V_ERR_CRL_SIGNATURE_FAILURE",runtime.newFixnum(8));
57
+ mX509.setConstant("V_ERR_CERT_NOT_YET_VALID",runtime.newFixnum(9));
58
+ mX509.setConstant("V_ERR_CERT_HAS_EXPIRED",runtime.newFixnum(10));
59
+ mX509.setConstant("V_ERR_CRL_NOT_YET_VALID",runtime.newFixnum(11));
60
+ mX509.setConstant("V_ERR_CRL_HAS_EXPIRED",runtime.newFixnum(12));
61
+ mX509.setConstant("V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD",runtime.newFixnum(13));
62
+ mX509.setConstant("V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD",runtime.newFixnum(14));
63
+ mX509.setConstant("V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD",runtime.newFixnum(15));
64
+ mX509.setConstant("V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD",runtime.newFixnum(16));
65
+ mX509.setConstant("V_ERR_OUT_OF_MEM",runtime.newFixnum(17));
66
+ mX509.setConstant("V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT",runtime.newFixnum(18));
67
+ mX509.setConstant("V_ERR_SELF_SIGNED_CERT_IN_CHAIN",runtime.newFixnum(19));
68
+ mX509.setConstant("V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY",runtime.newFixnum(20));
69
+ mX509.setConstant("V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE",runtime.newFixnum(21));
70
+ mX509.setConstant("V_ERR_CERT_CHAIN_TOO_LONG",runtime.newFixnum(22));
71
+ mX509.setConstant("V_ERR_CERT_REVOKED",runtime.newFixnum(23));
72
+ mX509.setConstant("V_ERR_INVALID_CA",runtime.newFixnum(24));
73
+ mX509.setConstant("V_ERR_PATH_LENGTH_EXCEEDED",runtime.newFixnum(25));
74
+ mX509.setConstant("V_ERR_INVALID_PURPOSE",runtime.newFixnum(26));
75
+ mX509.setConstant("V_ERR_CERT_UNTRUSTED",runtime.newFixnum(27));
76
+ mX509.setConstant("V_ERR_CERT_REJECTED",runtime.newFixnum(28));
77
+ mX509.setConstant("V_ERR_SUBJECT_ISSUER_MISMATCH",runtime.newFixnum(29));
78
+ mX509.setConstant("V_ERR_AKID_SKID_MISMATCH",runtime.newFixnum(30));
79
+ mX509.setConstant("V_ERR_AKID_ISSUER_SERIAL_MISMATCH",runtime.newFixnum(31));
80
+ mX509.setConstant("V_ERR_KEYUSAGE_NO_CERTSIGN",runtime.newFixnum(32));
81
+ mX509.setConstant("V_ERR_APPLICATION_VERIFICATION",runtime.newFixnum(50));
82
+ mX509.setConstant("V_FLAG_CRL_CHECK",runtime.newFixnum(4));
83
+ mX509.setConstant("V_FLAG_CRL_CHECK_ALL",runtime.newFixnum(8));
84
+ mX509.setConstant("PURPOSE_SSL_CLIENT",runtime.newFixnum(1));
85
+ mX509.setConstant("PURPOSE_SSL_SERVER",runtime.newFixnum(2));
86
+ mX509.setConstant("PURPOSE_NS_SSL_SERVER",runtime.newFixnum(3));
87
+ mX509.setConstant("PURPOSE_SMIME_SIGN",runtime.newFixnum(4));
88
+ mX509.setConstant("PURPOSE_SMIME_ENCRYPT",runtime.newFixnum(5));
89
+ mX509.setConstant("PURPOSE_CRL_SIGN",runtime.newFixnum(6));
90
+ mX509.setConstant("PURPOSE_ANY",runtime.newFixnum(7));
91
+ mX509.setConstant("PURPOSE_OCSP_HELPER",runtime.newFixnum(8));
92
+ mX509.setConstant("TRUST_COMPAT",runtime.newFixnum(1));
93
+ mX509.setConstant("TRUST_SSL_CLIENT",runtime.newFixnum(2));
94
+ mX509.setConstant("TRUST_SSL_SERVER",runtime.newFixnum(3));
95
+ mX509.setConstant("TRUST_EMAIL",runtime.newFixnum(4));
96
+ mX509.setConstant("TRUST_OBJECT_SIGN",runtime.newFixnum(5));
97
+ mX509.setConstant("TRUST_OCSP_SIGN",runtime.newFixnum(6));
98
+ mX509.setConstant("TRUST_OCSP_REQUEST",runtime.newFixnum(7));
99
+
100
+ // These should eventually point to correct things.
101
+ mX509.setConstant("DEFAULT_CERT_AREA", runtime.newString("/usr/lib/ssl"));
102
+ mX509.setConstant("DEFAULT_CERT_DIR", runtime.newString("/usr/lib/ssl/certs"));
103
+ mX509.setConstant("DEFAULT_CERT_FILE", runtime.newString("/usr/lib/ssl/cert.pem"));
104
+ mX509.setConstant("DEFAULT_CERT_DIR_ENV", runtime.newString("SSL_CERT_DIR"));
105
+ mX509.setConstant("DEFAULT_CERT_FILE_ENV", runtime.newString("SSL_CERT_FILE"));
106
+ mX509.setConstant("DEFAULT_PRIVATE_DIR", runtime.newString("/usr/lib/ssl/private"));
107
+ }
108
+ }// X509
@@ -0,0 +1,446 @@
1
+ /***** BEGIN LICENSE BLOCK *****
2
+ * Version: CPL 1.0/GPL 2.0/LGPL 2.1
3
+ *
4
+ * The contents of this file are subject to the Common Public
5
+ * License Version 1.0 (the "License"); you may not use this file
6
+ * except in compliance with the License. You may obtain a copy of
7
+ * the License at http://www.eclipse.org/legal/cpl-v10.html
8
+ *
9
+ * Software distributed under the License is distributed on an "AS
10
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
11
+ * implied. See the License for the specific language governing
12
+ * rights and limitations under the License.
13
+ *
14
+ * Copyright (C) 2006, 2007 Ola Bini <ola@ologix.com>
15
+ *
16
+ * Alternatively, the contents of this file may be used under the terms of
17
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
18
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
19
+ * in which case the provisions of the GPL or the LGPL are applicable instead
20
+ * of those above. If you wish to allow use of your version of this file only
21
+ * under the terms of either the GPL or the LGPL, and not to allow others to
22
+ * use your version of this file under the terms of the CPL, indicate your
23
+ * decision by deleting the provisions above and replace them with the notice
24
+ * and other provisions required by the GPL or the LGPL. If you do not delete
25
+ * the provisions above, a recipient may use your version of this file under
26
+ * the terms of any one of the CPL, the GPL or the LGPL.
27
+ ***** END LICENSE BLOCK *****/
28
+ package org.jruby.ext.openssl;
29
+
30
+ import java.io.ByteArrayInputStream;
31
+ import java.io.StringReader;
32
+ import java.io.StringWriter;
33
+ import java.math.BigInteger;
34
+ import java.security.GeneralSecurityException;
35
+ import java.security.cert.CertificateFactory;
36
+ import java.text.DateFormat;
37
+ import java.text.SimpleDateFormat;
38
+ import java.util.ArrayList;
39
+ import java.util.Hashtable;
40
+ import java.util.Iterator;
41
+ import java.util.List;
42
+
43
+ import org.bouncycastle.asn1.ASN1EncodableVector;
44
+ import org.bouncycastle.asn1.ASN1InputStream;
45
+ import org.bouncycastle.asn1.DERBoolean;
46
+ import org.bouncycastle.asn1.DEREncodable;
47
+ import org.bouncycastle.asn1.DERInteger;
48
+ import org.bouncycastle.asn1.DERObject;
49
+ import org.bouncycastle.asn1.DERObjectIdentifier;
50
+ import org.bouncycastle.asn1.DERSequence;
51
+ import org.bouncycastle.asn1.DERTaggedObject;
52
+ import org.bouncycastle.jce.provider.PEMUtil;
53
+ import org.bouncycastle.x509.X509V2CRLGenerator;
54
+ import org.jruby.Ruby;
55
+ import org.jruby.RubyArray;
56
+ import org.jruby.RubyClass;
57
+ import org.jruby.RubyModule;
58
+ import org.jruby.RubyNumeric;
59
+ import org.jruby.RubyObject;
60
+ import org.jruby.RubyString;
61
+ import org.jruby.RubyTime;
62
+ import org.jruby.anno.JRubyMethod;
63
+ import org.jruby.exceptions.RaiseException;
64
+ import org.jruby.ext.openssl.impl.utils.Base64;
65
+ import org.jruby.ext.openssl.x509store.PEMInputOutput;
66
+ import org.jruby.runtime.Block;
67
+ import org.jruby.runtime.ObjectAllocator;
68
+ import org.jruby.runtime.ThreadContext;
69
+ import org.jruby.runtime.builtin.IRubyObject;
70
+
71
+ /**
72
+ * @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
73
+ */
74
+ public class X509CRL extends RubyObject {
75
+ private static ObjectAllocator X509CRL_ALLOCATOR = new ObjectAllocator() {
76
+ public IRubyObject allocate(Ruby runtime, RubyClass klass) {
77
+ return new X509CRL(runtime, klass);
78
+ }
79
+ };
80
+
81
+ public static void createX509CRL(Ruby runtime, RubyModule mX509) {
82
+ RubyClass cX509CRL = mX509.defineClassUnder("CRL",runtime.getObject(),X509CRL_ALLOCATOR);
83
+ RubyClass openSSLError = runtime.getModule("OpenSSL").getClass("OpenSSLError");
84
+ mX509.defineClassUnder("CRLError",openSSLError,openSSLError.getAllocator());
85
+
86
+ cX509CRL.defineAnnotatedMethods(X509CRL.class);
87
+ }
88
+
89
+ private IRubyObject version;
90
+ private IRubyObject issuer;
91
+ private IRubyObject last_update;
92
+ private IRubyObject next_update;
93
+ private IRubyObject revoked;
94
+ private List<IRubyObject> extensions;
95
+
96
+ private IRubyObject sig_alg;
97
+
98
+ private boolean changed = true;
99
+
100
+ private X509V2CRLGenerator generator = new X509V2CRLGenerator();
101
+ private java.security.cert.X509CRL crl;
102
+
103
+ private DERObject crl_v;
104
+
105
+ java.security.cert.X509CRL getCRL() {
106
+ return crl;
107
+ }
108
+
109
+ public X509CRL(Ruby runtime, RubyClass type) {
110
+ super(runtime,type);
111
+ }
112
+
113
+ @JRubyMethod(name="initialize", rest=true, frame=true)
114
+ public IRubyObject _initialize(IRubyObject[] args, Block block) throws Exception {
115
+ // System.err.println("WARNING: unimplemented method called: CRL#initialize");
116
+ extensions = new ArrayList<IRubyObject>();
117
+ if(org.jruby.runtime.Arity.checkArgumentCount(getRuntime(),args,0,1) == 0) {
118
+ version = getRuntime().getNil();
119
+ issuer = getRuntime().getNil();
120
+ last_update = getRuntime().getNil();
121
+ next_update = getRuntime().getNil();
122
+ revoked = getRuntime().newArray();
123
+ return this;
124
+ }
125
+
126
+ ByteArrayInputStream bis = new ByteArrayInputStream(args[0].convertToString().getBytes());
127
+ CertificateFactory cf = CertificateFactory.getInstance("X.509",OpenSSLReal.PROVIDER);
128
+ crl = (java.security.cert.X509CRL)cf.generateCRL(bis);
129
+
130
+ byte[] crl_bytes = args[0].convertToString().getBytes();
131
+ // Parse PEM if we ever get passed some PEM contents
132
+ try {
133
+ StringReader in = new StringReader(args[0].toString());
134
+ byte[] bytes = PEMInputOutput.readPEMToDER(in);
135
+ if (bytes != null)
136
+ crl_bytes = bytes;
137
+ in.close();
138
+ }
139
+ catch(Exception e) {
140
+ // this is not PEM encoded, let's use the default argument
141
+ }
142
+
143
+ crl_v = new ASN1InputStream(new ByteArrayInputStream(crl_bytes)).readObject();
144
+
145
+ DEREncodable v0 = ((DERSequence)(((DERSequence)crl_v).getObjectAt(0))).getObjectAt(0);
146
+ if(v0 instanceof DERInteger) {
147
+ set_version(getRuntime().newFixnum(((DERInteger)v0).getValue().intValue()));
148
+ } else {
149
+ set_version(getRuntime().newFixnum(2));
150
+ }
151
+ set_last_update(RubyTime.newTime(getRuntime(),crl.getThisUpdate().getTime()));
152
+ set_next_update(RubyTime.newTime(getRuntime(),crl.getNextUpdate().getTime()));
153
+ ThreadContext tc = getRuntime().getCurrentContext();
154
+ set_issuer(((RubyModule)(getRuntime().getModule("OpenSSL").getConstant("X509"))).getConstant("Name").callMethod(tc,"new",RubyString.newString(getRuntime(), crl.getIssuerX500Principal().getEncoded())));
155
+
156
+ revoked = getRuntime().newArray();
157
+
158
+ DERSequence seqa = (DERSequence)((DERSequence)crl_v).getObjectAt(0);
159
+ DERObject maybe_ext = (DERObject)seqa.getObjectAt(seqa.size()-1);
160
+ if(maybe_ext instanceof DERTaggedObject && ((DERTaggedObject)maybe_ext).getTagNo() == 0) {
161
+ DERSequence exts = (DERSequence)((DERTaggedObject)maybe_ext).getObject();
162
+ for(int i=0;i<exts.size();i++) {
163
+ DERSequence seq2 = (DERSequence)exts.getObjectAt(i);
164
+ boolean critical = false;
165
+ String oid = ((DERObjectIdentifier)seq2.getObjectAt(0)).getId();
166
+ if(seq2.getObjectAt(1) == DERBoolean.TRUE) {
167
+ critical = true;
168
+ }
169
+ byte[] value = crl.getExtensionValue(oid);
170
+ IRubyObject mASN1 = ((RubyModule)(getRuntime().getModule("OpenSSL"))).getConstant("ASN1");
171
+ IRubyObject rValue = null;
172
+ try {
173
+ rValue = ASN1.decode(mASN1,ASN1.decode(mASN1,RubyString.newString(getRuntime(), value)).callMethod(tc,"value"));
174
+ } catch(Exception e) {
175
+ rValue = RubyString.newString(getRuntime(), value);
176
+ }
177
+ X509Extensions.Extension ext1 = (X509Extensions.Extension)(((RubyModule)(getRuntime().getModule("OpenSSL").getConstant("X509"))).getConstant("Extension").callMethod(tc,"new"));
178
+ ext1.setRealOid(ext1.getObjectIdentifier(oid));
179
+ ext1.setRealValue(rValue);
180
+ ext1.setRealCritical(critical);
181
+ add_extension(ext1);
182
+ }
183
+ }
184
+
185
+ changed = false;
186
+ return this;
187
+ }
188
+
189
+ @JRubyMethod
190
+ public IRubyObject initialize_copy(IRubyObject obj) {
191
+ System.err.println("WARNING: unimplemented method called: CRL#init_copy");
192
+ if(this == obj) {
193
+ return this;
194
+ }
195
+ checkFrozen();
196
+ return this;
197
+ }
198
+
199
+ @JRubyMethod(name={"to_pem","to_s"})
200
+ public IRubyObject to_pem() throws Exception {
201
+ StringWriter w = new StringWriter();
202
+ PEMInputOutput.writeX509CRL(w,crl);
203
+ w.close();
204
+ return getRuntime().newString(w.toString());
205
+ }
206
+
207
+ @JRubyMethod
208
+ public IRubyObject to_der() throws Exception {
209
+ return RubyString.newString(getRuntime(), crl_v.getEncoded());
210
+ }
211
+
212
+ private static final String IND8 = " ";
213
+ private static final String IND12 = " ";
214
+ private static final String IND16 = " ";
215
+ private static final DateFormat ASN_DATE = new SimpleDateFormat("MMM dd HH:mm:ss yyyy zzz");
216
+ @JRubyMethod
217
+ public IRubyObject to_text() throws Exception {
218
+ StringBuffer sbe = new StringBuffer();
219
+ sbe.append("Certificate Revocation List (CRL):\n");
220
+ sbe.append(IND8).append("Version ").append(RubyNumeric.fix2int(version)+1).append(" (0x");
221
+ sbe.append(Integer.toString(RubyNumeric.fix2int(version),16)).append(")\n");
222
+ sbe.append(IND8).append("Signature Algorithm: ").append(ASN1.nid2ln(getRuntime(),ASN1.obj2nid(getRuntime(),((DERObjectIdentifier)((DERSequence)((DERSequence)crl_v).getObjectAt(1)).getObjectAt(0))))).append("\n");
223
+ sbe.append(IND8).append("Issuer: ").append(issuer()).append("\n");
224
+ sbe.append(IND8).append("Last Update: ").append(ASN_DATE.format(((RubyTime)last_update()).getJavaDate())).append("\n");
225
+ if(!next_update().isNil()) {
226
+ sbe.append(IND8).append("Next Update: ").append(ASN_DATE.format(((RubyTime)next_update()).getJavaDate())).append("\n");
227
+ } else {
228
+ sbe.append(IND8).append("Next Update: NONE\n");
229
+ }
230
+ if(extensions.size()>0) {
231
+ sbe.append(IND8).append("CRL extensions\n");
232
+ for(Iterator<IRubyObject> iter = extensions.iterator();iter.hasNext();) {
233
+ X509Extensions.Extension ext = (X509Extensions.Extension)iter.next();
234
+ DERObjectIdentifier oiden = ext.getRealOid();
235
+ sbe.append(IND12).append(ASN1.o2a(getRuntime(),oiden)).append(": ");
236
+ if(ext.getRealCritical()) {
237
+ sbe.append("critical");
238
+ }
239
+ sbe.append("\n");
240
+ sbe.append(IND16).append(ext.value()).append("\n");
241
+ }
242
+ }
243
+ /*
244
+ 114 rev = X509_CRL_get_REVOKED(x);
245
+ 115
246
+ 116 if(sk_X509_REVOKED_num(rev) > 0)
247
+ 117 BIO_printf(out, "Revoked Certificates:\n");
248
+ 118 else BIO_printf(out, "No Revoked Certificates.\n");
249
+ 119
250
+ 120 for(i = 0; i < sk_X509_REVOKED_num(rev); i++) {
251
+ 121 r = sk_X509_REVOKED_value(rev, i);
252
+ 122 BIO_printf(out," Serial Number: ");
253
+ 123 i2a_ASN1_INTEGER(out,r->serialNumber);
254
+ 124 BIO_printf(out,"\n Revocation Date: ");
255
+ 125 ASN1_TIME_print(out,r->revocationDate);
256
+ 126 BIO_printf(out,"\n");
257
+ 127 X509V3_extensions_print(out, "CRL entry extensions",
258
+ 128 r->extensions, 0, 8);
259
+ 129 }
260
+ 130 X509_signature_print(out, x->sig_alg, x->signature);
261
+ 131
262
+ */
263
+ return getRuntime().newString(sbe.toString());
264
+ }
265
+
266
+ @JRubyMethod
267
+ public IRubyObject version() {
268
+ return this.version;
269
+ }
270
+
271
+ @JRubyMethod(name="version=")
272
+ public IRubyObject set_version(IRubyObject val) {
273
+ if(!val.equals(this.version)) {
274
+ changed = true;
275
+ }
276
+ this.version = val;
277
+ return val;
278
+ }
279
+
280
+ @JRubyMethod
281
+ public IRubyObject signature_algorithm() {
282
+ return sig_alg;
283
+ }
284
+
285
+ @JRubyMethod
286
+ public IRubyObject issuer() {
287
+ return this.issuer;
288
+ }
289
+
290
+ @JRubyMethod(name="issuer=")
291
+ public IRubyObject set_issuer(IRubyObject val) {
292
+ if(!val.equals(this.issuer)) {
293
+ changed = true;
294
+ }
295
+ this.issuer = val;
296
+ generator.setIssuerDN(((X509Name)issuer).getRealName());
297
+ return val;
298
+ }
299
+
300
+ @JRubyMethod
301
+ public IRubyObject last_update() {
302
+ return this.last_update;
303
+ }
304
+
305
+ @JRubyMethod(name="last_update=")
306
+ public IRubyObject set_last_update(IRubyObject val) {
307
+ changed = true;
308
+ last_update = val.callMethod(getRuntime().getCurrentContext(),"getutc");
309
+ ((RubyTime)last_update).setMicroseconds(0);
310
+ generator.setThisUpdate(((RubyTime)last_update).getJavaDate());
311
+ this.last_update = val;
312
+ return val;
313
+ }
314
+
315
+ @JRubyMethod
316
+ public IRubyObject next_update() {
317
+ return this.next_update;
318
+ }
319
+
320
+ @JRubyMethod(name="next_update=")
321
+ public IRubyObject set_next_update(IRubyObject val) {
322
+ changed = true;
323
+ next_update = val.callMethod(getRuntime().getCurrentContext(),"getutc");
324
+ ((RubyTime)next_update).setMicroseconds(0);
325
+ generator.setNextUpdate(((RubyTime)next_update).getJavaDate());
326
+ this.next_update = val;
327
+ return val;
328
+ }
329
+
330
+ @JRubyMethod
331
+ public IRubyObject revoked() {
332
+ return this.revoked;
333
+ }
334
+
335
+ @JRubyMethod(name="revoked=")
336
+ public IRubyObject set_revoked(IRubyObject val) {
337
+ changed = true;
338
+ this.revoked = val;
339
+ return val;
340
+ }
341
+
342
+ @JRubyMethod
343
+ public IRubyObject add_revoked(IRubyObject val) {
344
+ changed = true;
345
+ this.revoked.callMethod(getRuntime().getCurrentContext(),"<<",val);
346
+ return val;
347
+ }
348
+
349
+ @JRubyMethod
350
+ public IRubyObject extensions() {
351
+ return getRuntime().newArray(this.extensions);
352
+ }
353
+
354
+ @SuppressWarnings("unchecked")
355
+ @JRubyMethod(name="extensions=")
356
+ public IRubyObject set_extensions(IRubyObject val) {
357
+ this.extensions = ((RubyArray)val).getList();
358
+ return val;
359
+ }
360
+
361
+ @JRubyMethod
362
+ public IRubyObject add_extension(IRubyObject val) {
363
+ this.extensions.add(val);
364
+ return val;
365
+ }
366
+
367
+ @JRubyMethod
368
+ public IRubyObject sign(final IRubyObject key, IRubyObject digest) throws Exception {
369
+ //System.err.println("WARNING: unimplemented method called: CRL#sign");
370
+ // Have to obey some artificial constraints of the OpenSSL implementation. Stupid.
371
+ String keyAlg = ((PKey)key).getAlgorithm();
372
+ String digAlg = ((Digest)digest).getAlgorithm();
373
+
374
+ if(("DSA".equalsIgnoreCase(keyAlg) && "MD5".equalsIgnoreCase(digAlg)) ||
375
+ ("RSA".equalsIgnoreCase(keyAlg) && "DSS1".equals(((Digest)digest).name().toString())) ||
376
+ ("DSA".equalsIgnoreCase(keyAlg) && "SHA1".equals(((Digest)digest).name().toString()))) {
377
+ throw new RaiseException(getRuntime(), (RubyClass)(((RubyModule)(getRuntime().getModule("OpenSSL").getConstant("X509"))).getConstant("CRLError")), null, true);
378
+ }
379
+
380
+ sig_alg = getRuntime().newString(digAlg);
381
+ generator.setSignatureAlgorithm(digAlg + "WITH" + keyAlg);
382
+
383
+ for(Iterator iter = ((RubyArray)revoked).getList().iterator();iter.hasNext();) {
384
+ X509Revoked rev = (X509Revoked)iter.next();
385
+ BigInteger serial = new BigInteger(rev.callMethod(getRuntime().getCurrentContext(),"serial").toString());
386
+ IRubyObject t1 = rev.callMethod(getRuntime().getCurrentContext(),"time").callMethod(getRuntime().getCurrentContext(),"getutc");
387
+ ((RubyTime)t1).setMicroseconds(0);
388
+ // Extensions ignored, for now
389
+ generator.addCRLEntry(serial,((RubyTime)t1).getJavaDate(),new org.bouncycastle.asn1.x509.X509Extensions(new Hashtable()));
390
+ }
391
+
392
+ for(Iterator<IRubyObject> iter = extensions.iterator();iter.hasNext();) {
393
+ Object arg = iter.next();
394
+ generator.addExtension(((X509Extensions.Extension)arg).getRealOid(),((X509Extensions.Extension)arg).getRealCritical(),((X509Extensions.Extension)arg).getRealValueBytes());
395
+ }
396
+
397
+ OpenSSLReal.doWithBCProvider(new Runnable() {
398
+ public void run() {
399
+ try {
400
+ crl = generator.generate(((PKey)key).getPrivateKey(),"BC");
401
+ } catch(GeneralSecurityException e) {
402
+ }
403
+ }
404
+ });
405
+
406
+ crl_v = new ASN1InputStream(new ByteArrayInputStream(crl.getEncoded())).readObject();
407
+ DERSequence v1 = (DERSequence)(((DERSequence)crl_v).getObjectAt(0));
408
+ ASN1EncodableVector build1 = new ASN1EncodableVector();
409
+ int copyIndex = 0;
410
+ if(v1.getObjectAt(0) instanceof DERInteger) {
411
+ copyIndex++;
412
+ }
413
+ build1.add(new DERInteger(new java.math.BigInteger(version.toString())));
414
+ while(copyIndex < v1.size()) {
415
+ build1.add(v1.getObjectAt(copyIndex++));
416
+ }
417
+ ASN1EncodableVector build2 = new ASN1EncodableVector();
418
+ build2.add(new DERSequence(build1));
419
+ build2.add(((DERSequence)crl_v).getObjectAt(1));
420
+ build2.add(((DERSequence)crl_v).getObjectAt(2));
421
+ crl_v = new DERSequence(build2);
422
+ changed = false;
423
+ return this;
424
+ }
425
+
426
+ @JRubyMethod
427
+ public IRubyObject verify(final IRubyObject key) {
428
+ if(changed) {
429
+ return getRuntime().getFalse();
430
+ }
431
+
432
+ final boolean[] result = new boolean[1];
433
+ OpenSSLReal.doWithBCProvider(new Runnable() {
434
+ public void run() {
435
+ try {
436
+ crl.verify(((PKey)key).getPublicKey());
437
+ result[0] = true;
438
+ } catch(java.security.GeneralSecurityException e) {
439
+ result[0] = false;
440
+ }
441
+ }
442
+ });
443
+
444
+ return result[0] ? getRuntime().getTrue() : getRuntime().getFalse();
445
+ }
446
+ }// X509CRL