rho-tau-extensions 5.5.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (661) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +2 -0
  3. data/LICENSE +21 -0
  4. data/README.md +6 -0
  5. data/Rakefile +90 -0
  6. data/libs/crosswalk.rb +2 -0
  7. data/libs/crosswalk/crosswalk.rb +2 -0
  8. data/libs/crosswalk/ext.yml +21 -0
  9. data/libs/crosswalk/ext/Crosswalk.xml +27 -0
  10. data/libs/crosswalk/ext/build +19 -0
  11. data/libs/crosswalk/ext/build.bat +29 -0
  12. data/libs/crosswalk/ext/platform/android/AndroidManifest.xml +9 -0
  13. data/libs/crosswalk/ext/platform/android/Rakefile +141 -0
  14. data/libs/crosswalk/ext/platform/android/adds/lib/armeabi/libxwalkcore.so +0 -0
  15. data/libs/crosswalk/ext/platform/android/adds/lib/armeabi/libxwalkdummy.so +0 -0
  16. data/libs/crosswalk/ext/platform/android/adds/lib/x86/libxwalkcore.so +0 -0
  17. data/libs/crosswalk/ext/platform/android/adds/lib/x86/libxwalkdummy.so +0 -0
  18. data/libs/crosswalk/ext/platform/android/adds/lib/xwalk_core_library_java.jar +0 -0
  19. data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/bubble.9.png +0 -0
  20. data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/bubble_arrow_up.png +0 -0
  21. data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/color_picker_advanced_select_handle.png +0 -0
  22. data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/crosswalk.png +0 -0
  23. data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/dropdown_popup_background_down.9.png +0 -0
  24. data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/dropdown_popup_background_up.9.png +0 -0
  25. data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/ic_menu_share_holo_light.png +0 -0
  26. data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/ic_search.png +0 -0
  27. data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/ic_warning.png +0 -0
  28. data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/ondemand_overlay.9.png +0 -0
  29. data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/verify_checkmark.png +0 -0
  30. data/libs/crosswalk/ext/platform/android/adds/res/drawable-ldpi/crosswalk.png +0 -0
  31. data/libs/crosswalk/ext/platform/android/adds/res/drawable-mdpi/crosswalk.png +0 -0
  32. data/libs/crosswalk/ext/platform/android/adds/res/drawable-v21/button_borderless_compat.xml +10 -0
  33. data/libs/crosswalk/ext/platform/android/adds/res/drawable-v21/button_compat.xml +9 -0
  34. data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/bubble.9.png +0 -0
  35. data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/bubble_arrow_up.png +0 -0
  36. data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/color_picker_advanced_select_handle.png +0 -0
  37. data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/crosswalk.png +0 -0
  38. data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/dropdown_popup_background_down.9.png +0 -0
  39. data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/dropdown_popup_background_up.9.png +0 -0
  40. data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/ic_menu_share_holo_light.png +0 -0
  41. data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/ic_search.png +0 -0
  42. data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/ic_warning.png +0 -0
  43. data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/ondemand_overlay.9.png +0 -0
  44. data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/verify_checkmark.png +0 -0
  45. data/libs/crosswalk/ext/platform/android/adds/res/drawable-xxhdpi/ic_menu_share_holo_light.png +0 -0
  46. data/libs/crosswalk/ext/platform/android/adds/res/drawable-xxhdpi/ic_search.png +0 -0
  47. data/libs/crosswalk/ext/platform/android/adds/res/drawable-xxhdpi/ic_warning.png +0 -0
  48. data/libs/crosswalk/ext/platform/android/adds/res/drawable-xxhdpi/verify_checkmark.png +0 -0
  49. data/libs/crosswalk/ext/platform/android/adds/res/drawable-xxxhdpi/ic_menu_share_holo_light.png +0 -0
  50. data/libs/crosswalk/ext/platform/android/adds/res/drawable-xxxhdpi/ic_search.png +0 -0
  51. data/libs/crosswalk/ext/platform/android/adds/res/drawable-xxxhdpi/ic_warning.png +0 -0
  52. data/libs/crosswalk/ext/platform/android/adds/res/drawable-xxxhdpi/verify_checkmark.png +0 -0
  53. data/libs/crosswalk/ext/platform/android/adds/res/drawable/autofill_chip_inset.xml +15 -0
  54. data/libs/crosswalk/ext/platform/android/adds/res/drawable/bubble.9.png +0 -0
  55. data/libs/crosswalk/ext/platform/android/adds/res/drawable/bubble_arrow_up.png +0 -0
  56. data/libs/crosswalk/ext/platform/android/adds/res/drawable/button_compat_shape.xml +9 -0
  57. data/libs/crosswalk/ext/platform/android/adds/res/drawable/color_button_background.xml +36 -0
  58. data/libs/crosswalk/ext/platform/android/adds/res/drawable/color_picker_advanced_select_handle.png +0 -0
  59. data/libs/crosswalk/ext/platform/android/adds/res/drawable/color_picker_border.xml +12 -0
  60. data/libs/crosswalk/ext/platform/android/adds/res/drawable/dropdown_label_color.xml +11 -0
  61. data/libs/crosswalk/ext/platform/android/adds/res/drawable/dropdown_popup_background.xml +13 -0
  62. data/libs/crosswalk/ext/platform/android/adds/res/drawable/dropdown_popup_background_down.9.png +0 -0
  63. data/libs/crosswalk/ext/platform/android/adds/res/drawable/dropdown_popup_background_up.9.png +0 -0
  64. data/libs/crosswalk/ext/platform/android/adds/res/drawable/ic_menu_share_holo_light.png +0 -0
  65. data/libs/crosswalk/ext/platform/android/adds/res/drawable/ic_search.png +0 -0
  66. data/libs/crosswalk/ext/platform/android/adds/res/drawable/ic_warning.png +0 -0
  67. data/libs/crosswalk/ext/platform/android/adds/res/drawable/launchscreen_bg.xml +19 -0
  68. data/libs/crosswalk/ext/platform/android/adds/res/drawable/ondemand_overlay.9.png +0 -0
  69. data/libs/crosswalk/ext/platform/android/adds/res/drawable/verify_checkmark.png +0 -0
  70. data/libs/crosswalk/ext/platform/android/adds/res/layout-land/date_time_picker_dialog.xml +42 -0
  71. data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/autofill_keyboard_accessory_item.xml +40 -0
  72. data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/autofill_suggestion_item.xml +18 -0
  73. data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/color_picker_advanced_component.xml +46 -0
  74. data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/color_picker_dialog_content.xml +51 -0
  75. data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/color_picker_dialog_title.xml +41 -0
  76. data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/date_time_suggestion.xml +35 -0
  77. data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/dropdown_item.xml +58 -0
  78. data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/multi_field_time_picker_dialog.xml +122 -0
  79. data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/two_field_date_picker.xml +38 -0
  80. data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/validation_message_bubble.xml +72 -0
  81. data/libs/crosswalk/ext/platform/android/adds/res/layout/autofill_keyboard_accessory_icon.xml +13 -0
  82. data/libs/crosswalk/ext/platform/android/adds/res/layout/autofill_keyboard_accessory_item.xml +17 -0
  83. data/libs/crosswalk/ext/platform/android/adds/res/layout/autofill_suggestion_item.xml +7 -0
  84. data/libs/crosswalk/ext/platform/android/adds/res/layout/color_picker_advanced_component.xml +30 -0
  85. data/libs/crosswalk/ext/platform/android/adds/res/layout/color_picker_dialog_content.xml +36 -0
  86. data/libs/crosswalk/ext/platform/android/adds/res/layout/color_picker_dialog_title.xml +25 -0
  87. data/libs/crosswalk/ext/platform/android/adds/res/layout/date_time_picker_dialog.xml +42 -0
  88. data/libs/crosswalk/ext/platform/android/adds/res/layout/date_time_suggestion.xml +16 -0
  89. data/libs/crosswalk/ext/platform/android/adds/res/layout/dropdown_item.xml +34 -0
  90. data/libs/crosswalk/ext/platform/android/adds/res/layout/multi_field_time_picker_dialog.xml +50 -0
  91. data/libs/crosswalk/ext/platform/android/adds/res/layout/two_field_date_picker.xml +26 -0
  92. data/libs/crosswalk/ext/platform/android/adds/res/layout/validation_message_bubble.xml +47 -0
  93. data/libs/crosswalk/ext/platform/android/adds/res/menu/select_action_menu.xml +54 -0
  94. data/libs/crosswalk/ext/platform/android/adds/res/raw/contacts_api.js +206 -0
  95. data/libs/crosswalk/ext/platform/android/adds/res/raw/device_capabilities_api.js +231 -0
  96. data/libs/crosswalk/ext/platform/android/adds/res/raw/empty.wav +0 -0
  97. data/libs/crosswalk/ext/platform/android/adds/res/raw/icudtl.dat +0 -0
  98. data/libs/crosswalk/ext/platform/android/adds/res/raw/launch_screen_api.js +9 -0
  99. data/libs/crosswalk/ext/platform/android/adds/res/raw/messaging_api.js +359 -0
  100. data/libs/crosswalk/ext/platform/android/adds/res/raw/presentation_api.js +144 -0
  101. data/libs/crosswalk/ext/platform/android/adds/res/raw/wifidirect_api.js +227 -0
  102. data/libs/crosswalk/ext/platform/android/adds/res/raw/xwalk.pak +0 -0
  103. data/libs/crosswalk/ext/platform/android/adds/res/values-am/android_content_strings.xml +15 -0
  104. data/libs/crosswalk/ext/platform/android/adds/res/values-am/android_ui_strings.xml +47 -0
  105. data/libs/crosswalk/ext/platform/android/adds/res/values-ar/android_content_strings.xml +15 -0
  106. data/libs/crosswalk/ext/platform/android/adds/res/values-ar/android_ui_strings.xml +47 -0
  107. data/libs/crosswalk/ext/platform/android/adds/res/values-bg/android_content_strings.xml +15 -0
  108. data/libs/crosswalk/ext/platform/android/adds/res/values-bg/android_ui_strings.xml +47 -0
  109. data/libs/crosswalk/ext/platform/android/adds/res/values-ca/android_content_strings.xml +15 -0
  110. data/libs/crosswalk/ext/platform/android/adds/res/values-ca/android_ui_strings.xml +47 -0
  111. data/libs/crosswalk/ext/platform/android/adds/res/values-cs/android_content_strings.xml +15 -0
  112. data/libs/crosswalk/ext/platform/android/adds/res/values-cs/android_ui_strings.xml +47 -0
  113. data/libs/crosswalk/ext/platform/android/adds/res/values-da/android_content_strings.xml +15 -0
  114. data/libs/crosswalk/ext/platform/android/adds/res/values-da/android_ui_strings.xml +47 -0
  115. data/libs/crosswalk/ext/platform/android/adds/res/values-de/android_content_strings.xml +15 -0
  116. data/libs/crosswalk/ext/platform/android/adds/res/values-de/android_ui_strings.xml +47 -0
  117. data/libs/crosswalk/ext/platform/android/adds/res/values-el/android_content_strings.xml +15 -0
  118. data/libs/crosswalk/ext/platform/android/adds/res/values-el/android_ui_strings.xml +47 -0
  119. data/libs/crosswalk/ext/platform/android/adds/res/values-en-rGB/android_content_strings.xml +15 -0
  120. data/libs/crosswalk/ext/platform/android/adds/res/values-en-rGB/android_ui_strings.xml +47 -0
  121. data/libs/crosswalk/ext/platform/android/adds/res/values-es-rUS/android_content_strings.xml +15 -0
  122. data/libs/crosswalk/ext/platform/android/adds/res/values-es-rUS/android_ui_strings.xml +47 -0
  123. data/libs/crosswalk/ext/platform/android/adds/res/values-es/android_content_strings.xml +15 -0
  124. data/libs/crosswalk/ext/platform/android/adds/res/values-es/android_ui_strings.xml +47 -0
  125. data/libs/crosswalk/ext/platform/android/adds/res/values-fa/android_content_strings.xml +15 -0
  126. data/libs/crosswalk/ext/platform/android/adds/res/values-fa/android_ui_strings.xml +47 -0
  127. data/libs/crosswalk/ext/platform/android/adds/res/values-fi/android_content_strings.xml +15 -0
  128. data/libs/crosswalk/ext/platform/android/adds/res/values-fi/android_ui_strings.xml +47 -0
  129. data/libs/crosswalk/ext/platform/android/adds/res/values-fr/android_content_strings.xml +15 -0
  130. data/libs/crosswalk/ext/platform/android/adds/res/values-fr/android_ui_strings.xml +47 -0
  131. data/libs/crosswalk/ext/platform/android/adds/res/values-hi/android_content_strings.xml +15 -0
  132. data/libs/crosswalk/ext/platform/android/adds/res/values-hi/android_ui_strings.xml +47 -0
  133. data/libs/crosswalk/ext/platform/android/adds/res/values-hr/android_content_strings.xml +15 -0
  134. data/libs/crosswalk/ext/platform/android/adds/res/values-hr/android_ui_strings.xml +47 -0
  135. data/libs/crosswalk/ext/platform/android/adds/res/values-hu/android_content_strings.xml +15 -0
  136. data/libs/crosswalk/ext/platform/android/adds/res/values-hu/android_ui_strings.xml +47 -0
  137. data/libs/crosswalk/ext/platform/android/adds/res/values-in/android_content_strings.xml +15 -0
  138. data/libs/crosswalk/ext/platform/android/adds/res/values-in/android_ui_strings.xml +47 -0
  139. data/libs/crosswalk/ext/platform/android/adds/res/values-it/android_content_strings.xml +15 -0
  140. data/libs/crosswalk/ext/platform/android/adds/res/values-it/android_ui_strings.xml +47 -0
  141. data/libs/crosswalk/ext/platform/android/adds/res/values-iw/android_content_strings.xml +15 -0
  142. data/libs/crosswalk/ext/platform/android/adds/res/values-iw/android_ui_strings.xml +47 -0
  143. data/libs/crosswalk/ext/platform/android/adds/res/values-ja/android_content_strings.xml +15 -0
  144. data/libs/crosswalk/ext/platform/android/adds/res/values-ja/android_ui_strings.xml +47 -0
  145. data/libs/crosswalk/ext/platform/android/adds/res/values-ko/android_content_strings.xml +15 -0
  146. data/libs/crosswalk/ext/platform/android/adds/res/values-ko/android_ui_strings.xml +47 -0
  147. data/libs/crosswalk/ext/platform/android/adds/res/values-lt/android_content_strings.xml +15 -0
  148. data/libs/crosswalk/ext/platform/android/adds/res/values-lt/android_ui_strings.xml +47 -0
  149. data/libs/crosswalk/ext/platform/android/adds/res/values-lv/android_content_strings.xml +15 -0
  150. data/libs/crosswalk/ext/platform/android/adds/res/values-lv/android_ui_strings.xml +47 -0
  151. data/libs/crosswalk/ext/platform/android/adds/res/values-nb/android_content_strings.xml +15 -0
  152. data/libs/crosswalk/ext/platform/android/adds/res/values-nb/android_ui_strings.xml +47 -0
  153. data/libs/crosswalk/ext/platform/android/adds/res/values-nl/android_content_strings.xml +15 -0
  154. data/libs/crosswalk/ext/platform/android/adds/res/values-nl/android_ui_strings.xml +47 -0
  155. data/libs/crosswalk/ext/platform/android/adds/res/values-pl/android_content_strings.xml +15 -0
  156. data/libs/crosswalk/ext/platform/android/adds/res/values-pl/android_ui_strings.xml +47 -0
  157. data/libs/crosswalk/ext/platform/android/adds/res/values-pt-rBR/android_content_strings.xml +15 -0
  158. data/libs/crosswalk/ext/platform/android/adds/res/values-pt-rBR/android_ui_strings.xml +47 -0
  159. data/libs/crosswalk/ext/platform/android/adds/res/values-pt-rPT/android_content_strings.xml +15 -0
  160. data/libs/crosswalk/ext/platform/android/adds/res/values-pt-rPT/android_ui_strings.xml +47 -0
  161. data/libs/crosswalk/ext/platform/android/adds/res/values-ro/android_content_strings.xml +15 -0
  162. data/libs/crosswalk/ext/platform/android/adds/res/values-ro/android_ui_strings.xml +47 -0
  163. data/libs/crosswalk/ext/platform/android/adds/res/values-ru/android_content_strings.xml +15 -0
  164. data/libs/crosswalk/ext/platform/android/adds/res/values-ru/android_ui_strings.xml +47 -0
  165. data/libs/crosswalk/ext/platform/android/adds/res/values-sk/android_content_strings.xml +15 -0
  166. data/libs/crosswalk/ext/platform/android/adds/res/values-sk/android_ui_strings.xml +47 -0
  167. data/libs/crosswalk/ext/platform/android/adds/res/values-sl/android_content_strings.xml +15 -0
  168. data/libs/crosswalk/ext/platform/android/adds/res/values-sl/android_ui_strings.xml +47 -0
  169. data/libs/crosswalk/ext/platform/android/adds/res/values-sr/android_content_strings.xml +15 -0
  170. data/libs/crosswalk/ext/platform/android/adds/res/values-sr/android_ui_strings.xml +47 -0
  171. data/libs/crosswalk/ext/platform/android/adds/res/values-sv/android_content_strings.xml +15 -0
  172. data/libs/crosswalk/ext/platform/android/adds/res/values-sv/android_ui_strings.xml +47 -0
  173. data/libs/crosswalk/ext/platform/android/adds/res/values-sw/android_content_strings.xml +15 -0
  174. data/libs/crosswalk/ext/platform/android/adds/res/values-sw/android_ui_strings.xml +47 -0
  175. data/libs/crosswalk/ext/platform/android/adds/res/values-th/android_content_strings.xml +15 -0
  176. data/libs/crosswalk/ext/platform/android/adds/res/values-th/android_ui_strings.xml +47 -0
  177. data/libs/crosswalk/ext/platform/android/adds/res/values-tl/android_content_strings.xml +15 -0
  178. data/libs/crosswalk/ext/platform/android/adds/res/values-tl/android_ui_strings.xml +47 -0
  179. data/libs/crosswalk/ext/platform/android/adds/res/values-tr/android_content_strings.xml +15 -0
  180. data/libs/crosswalk/ext/platform/android/adds/res/values-tr/android_ui_strings.xml +47 -0
  181. data/libs/crosswalk/ext/platform/android/adds/res/values-uk/android_content_strings.xml +15 -0
  182. data/libs/crosswalk/ext/platform/android/adds/res/values-uk/android_ui_strings.xml +47 -0
  183. data/libs/crosswalk/ext/platform/android/adds/res/values-v14/theme.xml +16 -0
  184. data/libs/crosswalk/ext/platform/android/adds/res/values-v17/styles.xml +19 -0
  185. data/libs/crosswalk/ext/platform/android/adds/res/values-v17/ui_java_styles.xml +41 -0
  186. data/libs/crosswalk/ext/platform/android/adds/res/values-v21/styles.xml +14 -0
  187. data/libs/crosswalk/ext/platform/android/adds/res/values-v21/ui_java_styles.xml +14 -0
  188. data/libs/crosswalk/ext/platform/android/adds/res/values-vi/android_content_strings.xml +15 -0
  189. data/libs/crosswalk/ext/platform/android/adds/res/values-vi/android_ui_strings.xml +47 -0
  190. data/libs/crosswalk/ext/platform/android/adds/res/values-zh-rCN/android_content_strings.xml +15 -0
  191. data/libs/crosswalk/ext/platform/android/adds/res/values-zh-rCN/android_ui_strings.xml +47 -0
  192. data/libs/crosswalk/ext/platform/android/adds/res/values-zh-rTW/android_content_strings.xml +15 -0
  193. data/libs/crosswalk/ext/platform/android/adds/res/values-zh-rTW/android_ui_strings.xml +47 -0
  194. data/libs/crosswalk/ext/platform/android/adds/res/values/android_content_strings.xml +15 -0
  195. data/libs/crosswalk/ext/platform/android/adds/res/values/android_ui_strings.xml +47 -0
  196. data/libs/crosswalk/ext/platform/android/adds/res/values/android_xwalk_strings.xml +17 -0
  197. data/libs/crosswalk/ext/platform/android/adds/res/values/ui_java_attrs.xml +9 -0
  198. data/libs/crosswalk/ext/platform/android/adds/res/values/ui_java_dimens.xml +31 -0
  199. data/libs/crosswalk/ext/platform/android/adds/res/values/ui_java_strings.xml +16 -0
  200. data/libs/crosswalk/ext/platform/android/adds/res/values/ui_java_styles.xml +101 -0
  201. data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_app_strings.xml +28 -0
  202. data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_attrs.xml +11 -0
  203. data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_colors.xml +13 -0
  204. data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_core_internal_java_strings.xml +16 -0
  205. data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_core_java_strings.xml +16 -0
  206. data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_dimens.xml +11 -0
  207. data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_resources_list.xml +7 -0
  208. data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_styles.xml +40 -0
  209. data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_values.xml +10 -0
  210. data/libs/crosswalk/ext/platform/android/ext_java.files +14 -0
  211. data/libs/crosswalk/ext/platform/android/ext_native.files +7 -0
  212. data/libs/crosswalk/ext/platform/android/jni/Crosswalk_impl.cpp +61 -0
  213. data/libs/crosswalk/ext/platform/android/src/com/rho/crosswalk/Crosswalk.java +14 -0
  214. data/libs/crosswalk/ext/platform/android/src/com/rho/crosswalk/CrosswalkFactory.java +18 -0
  215. data/libs/crosswalk/ext/platform/android/src/com/rho/crosswalk/CrosswalkSingleton.java +24 -0
  216. data/libs/crosswalk/ext/platform/android/src/com/tautechnologies/tau/crosswalk/CrosswalkExtension.java +16 -0
  217. data/libs/crosswalk/ext/platform/android/src/com/tautechnologies/tau/crosswalk/RhodesListener.java +18 -0
  218. data/libs/crosswalk/ext/platform/android/src/com/tautechnologies/tau/crosswalk/TauXWResourceClient.java +182 -0
  219. data/libs/crosswalk/ext/platform/android/src/com/tautechnologies/tau/crosswalk/TauXWUIClient.java +125 -0
  220. data/libs/crosswalk/ext/platform/android/src/com/tautechnologies/tau/crosswalk/TauXWalkWebView.java +368 -0
  221. data/libs/crosswalk/ext/platform/iphone/Crosswalk.xcodeproj/project.pbxproj +368 -0
  222. data/libs/crosswalk/ext/platform/iphone/Crosswalk_Prefix.pch +7 -0
  223. data/libs/crosswalk/ext/platform/iphone/Rakefile +73 -0
  224. data/libs/crosswalk/ext/platform/iphone/impl/Crosswalk.h +14 -0
  225. data/libs/crosswalk/ext/platform/iphone/impl/Crosswalk.m +24 -0
  226. data/libs/crosswalk/ext/platform/iphone/impl/CrosswalkFactorySingleton.m +16 -0
  227. data/libs/crosswalk/ext/platform/iphone/impl/CrosswalkSetup.m +9 -0
  228. data/libs/crosswalk/ext/platform/iphone/impl/CrosswalkSingleton.h +17 -0
  229. data/libs/crosswalk/ext/platform/iphone/impl/CrosswalkSingleton.m +23 -0
  230. data/libs/crosswalk/ext/platform/iphone/impl/readme.txt +7 -0
  231. data/libs/crosswalk/ext/platform/qt/Crosswalk.pro +66 -0
  232. data/libs/crosswalk/ext/platform/qt/Rakefile +35 -0
  233. data/libs/crosswalk/ext/platform/qt/src/Crosswalk_impl.cpp +77 -0
  234. data/libs/crosswalk/ext/platform/wm/Crosswalk.sln +52 -0
  235. data/libs/crosswalk/ext/platform/wm/Crosswalk.vcproj +714 -0
  236. data/libs/crosswalk/ext/platform/wm/Crosswalk.vsprops +15 -0
  237. data/libs/crosswalk/ext/platform/wm/src/Crosswalk_impl.cpp +77 -0
  238. data/libs/crosswalk/ext/platform/wp8/Crosswalk.props +18 -0
  239. data/libs/crosswalk/ext/platform/wp8/Crosswalk.vcxproj +170 -0
  240. data/libs/crosswalk/ext/platform/wp8/Crosswalk.vcxproj.filters +50 -0
  241. data/libs/crosswalk/ext/platform/wp8/CrosswalkImpl.csproj +119 -0
  242. data/libs/crosswalk/ext/platform/wp8/CrosswalkImpl.props +8 -0
  243. data/libs/crosswalk/ext/platform/wp8/CrosswalkImpl.targets +7 -0
  244. data/libs/crosswalk/ext/platform/wp8/CrosswalkLib.props +18 -0
  245. data/libs/crosswalk/ext/platform/wp8/CrosswalkLib.vcxproj +185 -0
  246. data/libs/crosswalk/ext/platform/wp8/CrosswalkLib.vcxproj.filters +58 -0
  247. data/libs/crosswalk/ext/platform/wp8/src/Crosswalk_impl.cpp +76 -0
  248. data/libs/crosswalk/ext/platform/wp8/src/Crosswalk_impl.cs +69 -0
  249. data/libs/crosswalk/ext/platform/wp8/src/Properties/AssemblyInfo.cs +37 -0
  250. data/libs/enterprise-barcode/ext.yml +13 -0
  251. data/libs/enterprise-barcode/ext/barcode.xml +2144 -0
  252. data/libs/enterprise-barcode/ext/build +17 -0
  253. data/libs/enterprise-barcode/ext/build.bat +29 -0
  254. data/libs/enterprise-barcode/ext/platform/android/AndroidManifest.xml +31 -0
  255. data/libs/enterprise-barcode/ext/platform/android/ZXing_Info/AUTHORS +58 -0
  256. data/libs/enterprise-barcode/ext/platform/android/ZXing_Info/CHANGES +266 -0
  257. data/libs/enterprise-barcode/ext/platform/android/ZXing_Info/COPYING +201 -0
  258. data/libs/enterprise-barcode/ext/platform/android/ZXing_Info/README +11 -0
  259. data/libs/enterprise-barcode/ext/platform/android/additional_files/res/drawable-hdpi/cancel_icon.png +0 -0
  260. data/libs/enterprise-barcode/ext/platform/android/additional_files/res/drawable-hdpi/ok_icon.png +0 -0
  261. data/libs/enterprise-barcode/ext/platform/android/additional_files/res/drawable-hdpi/retake_icon.png +0 -0
  262. data/libs/enterprise-barcode/ext/platform/android/additional_files/res/drawable/cancel_icon.png +0 -0
  263. data/libs/enterprise-barcode/ext/platform/android/additional_files/res/drawable/ok_icon.png +0 -0
  264. data/libs/enterprise-barcode/ext/platform/android/additional_files/res/drawable/retake_icon.png +0 -0
  265. data/libs/enterprise-barcode/ext/platform/android/additional_files/res/layout/capture.xml +122 -0
  266. data/libs/enterprise-barcode/ext/platform/android/additional_files/res/raw/beep.ogg +0 -0
  267. data/libs/enterprise-barcode/ext/platform/android/additional_files/res/values/attrs.xml +20 -0
  268. data/libs/enterprise-barcode/ext/platform/android/additional_files/res/values/colors.xml +42 -0
  269. data/libs/enterprise-barcode/ext/platform/android/additional_files/res/values/ids.xml +31 -0
  270. data/libs/enterprise-barcode/ext/platform/android/adds/lib/armeabi/liballbarcode.a +0 -0
  271. data/libs/enterprise-barcode/ext/platform/android/adds/lib/x86/liballbarcode.a +0 -0
  272. data/libs/enterprise-barcode/ext/platform/android/allbarcode.jar +0 -0
  273. data/libs/enterprise-barcode/ext/platform/iphone/Barcode.xcodeproj/project.pbxproj +524 -0
  274. data/libs/enterprise-barcode/ext/platform/iphone/Barcode_Prefix.pch +7 -0
  275. data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeCallbackHelper.h +27 -0
  276. data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeCallbackHelper.mm +231 -0
  277. data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeViewController.h +95 -0
  278. data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeViewController.m +1017 -0
  279. data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeViewFactory.h +7 -0
  280. data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeViewFactory.mm +58 -0
  281. data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeViewFactoryRegister.mm +18 -0
  282. data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeViewManager.h +16 -0
  283. data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeViewManager.mm +32 -0
  284. data/libs/enterprise-barcode/ext/platform/iphone/Classes/ImageProvider.cpp +25 -0
  285. data/libs/enterprise-barcode/ext/platform/iphone/Classes/ImageProvider.h +15 -0
  286. data/libs/enterprise-barcode/ext/platform/iphone/Classes/ImageProvider.mm +159 -0
  287. data/libs/enterprise-barcode/ext/platform/iphone/Classes/barcode.m +123 -0
  288. data/libs/enterprise-barcode/ext/platform/iphone/Rakefile +69 -0
  289. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/COPYING +27 -0
  290. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarCameraSimulator.h +45 -0
  291. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarCaptureReader.h +111 -0
  292. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarHelpController.h +60 -0
  293. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarImage.h +69 -0
  294. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarImageScanner.h +51 -0
  295. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarReaderController.h +142 -0
  296. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarReaderView.h +135 -0
  297. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarReaderViewController.h +130 -0
  298. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarSDK.h +34 -0
  299. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarSymbol.h +71 -0
  300. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar.h +1497 -0
  301. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Decoder.h +202 -0
  302. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Exception.h +187 -0
  303. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Image.h +321 -0
  304. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/ImageScanner.h +130 -0
  305. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Processor.h +223 -0
  306. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Scanner.h +162 -0
  307. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Symbol.h +528 -0
  308. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Video.h +170 -0
  309. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Window.h +136 -0
  310. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/LICENSE +504 -0
  311. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/README +59 -0
  312. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Resources/zbar-back.png +0 -0
  313. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Resources/zbar-help.html +88 -0
  314. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Resources/zbar-helpicons.png +0 -0
  315. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Resources/zbar-samples.png +0 -0
  316. data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/libzbar.a +0 -0
  317. data/libs/enterprise-barcode/ext/platform/iphone/impl/Barcode.h +21 -0
  318. data/libs/enterprise-barcode/ext/platform/iphone/impl/Barcode.m +132 -0
  319. data/libs/enterprise-barcode/ext/platform/iphone/impl/BarcodeFactory.h +10 -0
  320. data/libs/enterprise-barcode/ext/platform/iphone/impl/BarcodeFactory.m +16 -0
  321. data/libs/enterprise-barcode/ext/platform/iphone/impl/BarcodeFactorySingleton.m +16 -0
  322. data/libs/enterprise-barcode/ext/platform/iphone/impl/BarcodeSetup.m +8 -0
  323. data/libs/enterprise-barcode/ext/platform/iphone/impl/BarcodeSingleton.h +17 -0
  324. data/libs/enterprise-barcode/ext/platform/iphone/impl/BarcodeSingleton.m +22 -0
  325. data/libs/enterprise-barcode/ext/platform/iphone/impl/readme.txt +7 -0
  326. data/libs/enterprise-barcode/ext/platform/wm/Barcode.sln +44 -0
  327. data/libs/enterprise-barcode/ext/platform/wm/Barcode.vcproj +836 -0
  328. data/libs/enterprise-barcode/ext/platform/wm/Barcode.vsprops +15 -0
  329. data/libs/enterprise-barcode/ext/platform/wm/readme.txt +0 -0
  330. data/libs/enterprise-barcode/ext/platform/wm/src/Barcode_impl.cpp +376 -0
  331. data/libs/enterprise-barcode/ext/platform/wm/src/DecodeNotifier.cpp +173 -0
  332. data/libs/enterprise-barcode/ext/platform/wm/src/DecodeNotifier.h +149 -0
  333. data/libs/enterprise-barcode/ext/platform/wm/src/EMDKInterfaceAbstraction.cpp +476 -0
  334. data/libs/enterprise-barcode/ext/platform/wm/src/GetDecoderProperties.cpp +1195 -0
  335. data/libs/enterprise-barcode/ext/platform/wm/src/GetScannerProperties.cpp +553 -0
  336. data/libs/enterprise-barcode/ext/platform/wm/src/KeyInjector.cpp +177 -0
  337. data/libs/enterprise-barcode/ext/platform/wm/src/KeyInjector.h +40 -0
  338. data/libs/enterprise-barcode/ext/platform/wm/src/NotificationLoader.cpp +76 -0
  339. data/libs/enterprise-barcode/ext/platform/wm/src/NotificationLoader.h +44 -0
  340. data/libs/enterprise-barcode/ext/platform/wm/src/RSM.cpp +1211 -0
  341. data/libs/enterprise-barcode/ext/platform/wm/src/Scanner.cpp +2609 -0
  342. data/libs/enterprise-barcode/ext/platform/wm/src/Scanner.h +1099 -0
  343. data/libs/enterprise-barcode/ext/platform/wm/src/ScannerDefines.h +322 -0
  344. data/libs/enterprise-barcode/ext/platform/wm/src/SetDecoderProperties.cpp +2106 -0
  345. data/libs/enterprise-barcode/ext/platform/wm/src/SetScannerProperties.cpp +1060 -0
  346. data/libs/enterprise-barcode/ext/platform/wm/src/Utilities.cpp +184 -0
  347. data/libs/enterprise-barcode/ext/platform/wp8/BarcodeImpl.csproj +119 -0
  348. data/libs/enterprise-barcode/ext/platform/wp8/BarcodeImpl.props +8 -0
  349. data/libs/enterprise-barcode/ext/platform/wp8/BarcodeImpl.targets +35 -0
  350. data/libs/enterprise-barcode/ext/platform/wp8/BarcodeLib.props +18 -0
  351. data/libs/enterprise-barcode/ext/platform/wp8/BarcodeLib.vcxproj +185 -0
  352. data/libs/enterprise-barcode/ext/platform/wp8/BarcodeLib.vcxproj.filters +58 -0
  353. data/libs/enterprise-barcode/ext/platform/wp8/lib/ARM/Nokia.Graphics.Imaging.dll +0 -0
  354. data/libs/enterprise-barcode/ext/platform/wp8/lib/ARM/Nokia.Graphics.Imaging.winmd +0 -0
  355. data/libs/enterprise-barcode/ext/platform/wp8/lib/ARM/Nokia.Graphics.Imaging.xml +4813 -0
  356. data/libs/enterprise-barcode/ext/platform/wp8/lib/ARM/Nokia.InteropServices.WindowsRuntime.dll +0 -0
  357. data/libs/enterprise-barcode/ext/platform/wp8/lib/ARM/Nokia.InteropServices.WindowsRuntime.winmd +0 -0
  358. data/libs/enterprise-barcode/ext/platform/wp8/lib/ARM/Nokia.InteropServices.WindowsRuntime.xml +41 -0
  359. data/libs/enterprise-barcode/ext/platform/wp8/lib/ARM/OpticalReaderLib.dll +0 -0
  360. data/libs/enterprise-barcode/ext/platform/wp8/lib/BarcodeReaderLib.XML +68 -0
  361. data/libs/enterprise-barcode/ext/platform/wp8/lib/BarcodeReaderLib.dll +0 -0
  362. data/libs/enterprise-barcode/ext/platform/wp8/lib/BarcodeReaderLib/BarcodeReaderLib.csproj +120 -0
  363. data/libs/enterprise-barcode/ext/platform/wp8/lib/BarcodeReaderLib/BarcodeReaderLib.sln +34 -0
  364. data/libs/enterprise-barcode/ext/platform/wp8/lib/BarcodeReaderLib/CameraNavigatePage.xaml +32 -0
  365. data/libs/enterprise-barcode/ext/platform/wp8/lib/BarcodeReaderLib/CameraNavigatePage.xaml.cs +235 -0
  366. data/libs/enterprise-barcode/ext/platform/wp8/lib/BarcodeReaderLib/OpticalReaderTask.cs +182 -0
  367. data/libs/enterprise-barcode/ext/platform/wp8/lib/BarcodeReaderLib/Properties/AssemblyInfo.cs +37 -0
  368. data/libs/enterprise-barcode/ext/platform/wp8/lib/Nokia.Graphics.Imaging.Managed.dll +0 -0
  369. data/libs/enterprise-barcode/ext/platform/wp8/lib/Nokia.Graphics.Imaging.Managed.xml +341 -0
  370. data/libs/enterprise-barcode/ext/platform/wp8/lib/x86/Nokia.Graphics.Imaging.dll +0 -0
  371. data/libs/enterprise-barcode/ext/platform/wp8/lib/x86/Nokia.Graphics.Imaging.winmd +0 -0
  372. data/libs/enterprise-barcode/ext/platform/wp8/lib/x86/Nokia.Graphics.Imaging.xml +4813 -0
  373. data/libs/enterprise-barcode/ext/platform/wp8/lib/x86/Nokia.InteropServices.WindowsRuntime.dll +0 -0
  374. data/libs/enterprise-barcode/ext/platform/wp8/lib/x86/Nokia.InteropServices.WindowsRuntime.winmd +0 -0
  375. data/libs/enterprise-barcode/ext/platform/wp8/lib/x86/Nokia.InteropServices.WindowsRuntime.xml +41 -0
  376. data/libs/enterprise-barcode/ext/platform/wp8/lib/x86/OpticalReaderLib.dll +0 -0
  377. data/libs/enterprise-barcode/ext/platform/wp8/lib/zxing.wp8.0.XML +10324 -0
  378. data/libs/enterprise-barcode/ext/platform/wp8/lib/zxing.wp8.0.dll +0 -0
  379. data/libs/enterprise-barcode/ext/platform/wp8/src/Barcode_impl.cs +630 -0
  380. data/libs/enterprise-barcode/ext/platform/wp8/src/Properties/AssemblyInfo.cs +37 -0
  381. data/libs/enterprise-barcode/public/api/generated/Rho.Barcode.js +772 -0
  382. data/libs/ie/rhobrowser.dll +0 -0
  383. data/libs/nodejs.rb +2 -0
  384. data/libs/nodejs/ext.yml +25 -0
  385. data/libs/nodejs/ext/Nodejs.xml +37 -0
  386. data/libs/nodejs/ext/build +19 -0
  387. data/libs/nodejs/ext/build.bat +29 -0
  388. data/libs/nodejs/ext/platform/android/Rakefile +161 -0
  389. data/libs/nodejs/ext/platform/android/ext_native.files +8 -0
  390. data/libs/nodejs/ext/platform/android/jxCore/jx.h +134 -0
  391. data/libs/nodejs/ext/platform/android/jxCore/jx_result.h +221 -0
  392. data/libs/nodejs/ext/platform/android/jxCore/libcares_arm.a +0 -0
  393. data/libs/nodejs/ext/platform/android/jxCore/libcares_ia32.a +0 -0
  394. data/libs/nodejs/ext/platform/android/jxCore/libcares_x64.a +0 -0
  395. data/libs/nodejs/ext/platform/android/jxCore/libchrome_zlib_arm.a +0 -0
  396. data/libs/nodejs/ext/platform/android/jxCore/libchrome_zlib_ia32.a +0 -0
  397. data/libs/nodejs/ext/platform/android/jxCore/libchrome_zlib_x64.a +0 -0
  398. data/libs/nodejs/ext/platform/android/jxCore/libhttp_parser_arm.a +0 -0
  399. data/libs/nodejs/ext/platform/android/jxCore/libhttp_parser_ia32.a +0 -0
  400. data/libs/nodejs/ext/platform/android/jxCore/libhttp_parser_x64.a +0 -0
  401. data/libs/nodejs/ext/platform/android/jxCore/libjx_arm.a +0 -0
  402. data/libs/nodejs/ext/platform/android/jxCore/libjx_ia32.a +0 -0
  403. data/libs/nodejs/ext/platform/android/jxCore/libjx_x64.a +0 -0
  404. data/libs/nodejs/ext/platform/android/jxCore/libopenssl_arm.a +0 -0
  405. data/libs/nodejs/ext/platform/android/jxCore/libopenssl_ia32.a +0 -0
  406. data/libs/nodejs/ext/platform/android/jxCore/libopenssl_x64.a +0 -0
  407. data/libs/nodejs/ext/platform/android/jxCore/libsqlite3_arm.a +0 -0
  408. data/libs/nodejs/ext/platform/android/jxCore/libsqlite3_ia32.a +0 -0
  409. data/libs/nodejs/ext/platform/android/jxCore/libsqlite3_x64.a +0 -0
  410. data/libs/nodejs/ext/platform/android/jxCore/libuv_arm.a +0 -0
  411. data/libs/nodejs/ext/platform/android/jxCore/libuv_ia32.a +0 -0
  412. data/libs/nodejs/ext/platform/android/jxCore/libuv_x64.a +0 -0
  413. data/libs/nodejs/ext/platform/android/jxCore/libv8_base_arm.a +0 -0
  414. data/libs/nodejs/ext/platform/android/jxCore/libv8_base_ia32.a +0 -0
  415. data/libs/nodejs/ext/platform/android/jxCore/libv8_base_x64.a +0 -0
  416. data/libs/nodejs/ext/platform/android/jxCore/libv8_nosnapshot_arm.a +0 -0
  417. data/libs/nodejs/ext/platform/android/jxCore/libv8_nosnapshot_ia32.a +0 -0
  418. data/libs/nodejs/ext/platform/android/jxCore/libv8_nosnapshot_x64.a +0 -0
  419. data/libs/nodejs/ext/platform/iphone/Nodejs.xcodeproj/project.pbxproj +350 -0
  420. data/libs/nodejs/ext/platform/iphone/Nodejs_Prefix.pch +7 -0
  421. data/libs/nodejs/ext/platform/iphone/Rakefile +73 -0
  422. data/libs/nodejs/ext/platform/iphone/jxCore/jx.h +134 -0
  423. data/libs/nodejs/ext/platform/iphone/jxCore/jx_result.h +221 -0
  424. data/libs/nodejs/ext/platform/iphone/jxCore/libcares.a +0 -0
  425. data/libs/nodejs/ext/platform/iphone/jxCore/libchrome_zlib.a +0 -0
  426. data/libs/nodejs/ext/platform/iphone/jxCore/libhttp_parser.a +0 -0
  427. data/libs/nodejs/ext/platform/iphone/jxCore/libjx.a +0 -0
  428. data/libs/nodejs/ext/platform/iphone/jxCore/libmozjs.a +0 -0
  429. data/libs/nodejs/ext/platform/iphone/jxCore/libopenssl.a +0 -0
  430. data/libs/nodejs/ext/platform/iphone/jxCore/libsqlite3.a +0 -0
  431. data/libs/nodejs/ext/platform/iphone/jxCore/libuv.a +0 -0
  432. data/libs/nodejs/ext/shared/jxcore/jx.h +134 -0
  433. data/libs/nodejs/ext/shared/jxcore/jx_result.h +221 -0
  434. data/libs/nodejs/ext/shared/jxcoretau.cpp +454 -0
  435. data/libs/nodejs/ext/shared/jxcoretau.h +20 -0
  436. data/libs/nodejs/ext/shared/nodejs_impl.cpp +106 -0
  437. data/libs/nodejs/nodejs.rb +2 -0
  438. data/libs/openssl-edge.rb +2 -0
  439. data/libs/openssl-edge/ext.yml +4 -0
  440. data/libs/openssl-edge/ext/Rakefile +145 -0
  441. data/libs/openssl-edge/ext/android/Rakefile +107 -0
  442. data/libs/openssl-edge/ext/android/ext_native.files +32 -0
  443. data/libs/openssl-edge/ext/android/extconf.h +91 -0
  444. data/libs/openssl-edge/ext/build +12 -0
  445. data/libs/openssl-edge/ext/build.bat +5 -0
  446. data/libs/openssl-edge/ext/extconf.rb +141 -0
  447. data/libs/openssl-edge/ext/openssl.pro +109 -0
  448. data/libs/openssl-edge/ext/openssl.sln +52 -0
  449. data/libs/openssl-edge/ext/openssl.vcproj +1010 -0
  450. data/libs/openssl-edge/ext/openssl_missing.c +1163 -0
  451. data/libs/openssl-edge/ext/openssl_missing.h +537 -0
  452. data/libs/openssl-edge/ext/ossl.c +1203 -0
  453. data/libs/openssl-edge/ext/ossl.h +242 -0
  454. data/libs/openssl-edge/ext/ossl_asn1.c +2008 -0
  455. data/libs/openssl-edge/ext/ossl_asn1.h +66 -0
  456. data/libs/openssl-edge/ext/ossl_bio.c +118 -0
  457. data/libs/openssl-edge/ext/ossl_bio.h +19 -0
  458. data/libs/openssl-edge/ext/ossl_bn.c +1153 -0
  459. data/libs/openssl-edge/ext/ossl_bn.h +23 -0
  460. data/libs/openssl-edge/ext/ossl_cipher.c +1085 -0
  461. data/libs/openssl-edge/ext/ossl_cipher.h +20 -0
  462. data/libs/openssl-edge/ext/ossl_config.c +89 -0
  463. data/libs/openssl-edge/ext/ossl_config.h +19 -0
  464. data/libs/openssl-edge/ext/ossl_digest.c +453 -0
  465. data/libs/openssl-edge/ext/ossl_digest.h +20 -0
  466. data/libs/openssl-edge/ext/ossl_engine.c +580 -0
  467. data/libs/openssl-edge/ext/ossl_engine.h +19 -0
  468. data/libs/openssl-edge/ext/ossl_hmac.c +398 -0
  469. data/libs/openssl-edge/ext/ossl_hmac.h +18 -0
  470. data/libs/openssl-edge/ext/ossl_ns_spki.c +406 -0
  471. data/libs/openssl-edge/ext/ossl_ns_spki.h +19 -0
  472. data/libs/openssl-edge/ext/ossl_ocsp.c +2013 -0
  473. data/libs/openssl-edge/ext/ossl_ocsp.h +23 -0
  474. data/libs/openssl-edge/ext/ossl_pkcs12.c +261 -0
  475. data/libs/openssl-edge/ext/ossl_pkcs12.h +13 -0
  476. data/libs/openssl-edge/ext/ossl_pkcs5.c +180 -0
  477. data/libs/openssl-edge/ext/ossl_pkcs5.h +6 -0
  478. data/libs/openssl-edge/ext/ossl_pkcs7.c +1157 -0
  479. data/libs/openssl-edge/ext/ossl_pkcs7.h +20 -0
  480. data/libs/openssl-edge/ext/ossl_pkey.c +469 -0
  481. data/libs/openssl-edge/ext/ossl_pkey.h +245 -0
  482. data/libs/openssl-edge/ext/ossl_pkey_dh.c +650 -0
  483. data/libs/openssl-edge/ext/ossl_pkey_dsa.c +672 -0
  484. data/libs/openssl-edge/ext/ossl_pkey_ec.c +1806 -0
  485. data/libs/openssl-edge/ext/ossl_pkey_rsa.c +768 -0
  486. data/libs/openssl-edge/ext/ossl_rand.c +238 -0
  487. data/libs/openssl-edge/ext/ossl_rand.h +18 -0
  488. data/libs/openssl-edge/ext/ossl_ssl.c +2724 -0
  489. data/libs/openssl-edge/ext/ossl_ssl.h +41 -0
  490. data/libs/openssl-edge/ext/ossl_ssl_session.c +352 -0
  491. data/libs/openssl-edge/ext/ossl_version.h +15 -0
  492. data/libs/openssl-edge/ext/ossl_x509.c +186 -0
  493. data/libs/openssl-edge/ext/ossl_x509.h +119 -0
  494. data/libs/openssl-edge/ext/ossl_x509attr.c +328 -0
  495. data/libs/openssl-edge/ext/ossl_x509cert.c +863 -0
  496. data/libs/openssl-edge/ext/ossl_x509crl.c +565 -0
  497. data/libs/openssl-edge/ext/ossl_x509ext.c +480 -0
  498. data/libs/openssl-edge/ext/ossl_x509name.c +547 -0
  499. data/libs/openssl-edge/ext/ossl_x509req.c +492 -0
  500. data/libs/openssl-edge/ext/ossl_x509revoked.c +279 -0
  501. data/libs/openssl-edge/ext/ossl_x509store.c +846 -0
  502. data/libs/openssl-edge/ext/ruby_missing.h +32 -0
  503. data/libs/openssl-edge/openssl-edge.rb +2 -0
  504. data/libs/openssl-edge/openssl.rb +24 -0
  505. data/libs/openssl-edge/openssl/bn.rb +35 -0
  506. data/libs/openssl-edge/openssl/buffering.rb +341 -0
  507. data/libs/openssl-edge/openssl/cipher.rb +65 -0
  508. data/libs/openssl-edge/openssl/digest.rb +61 -0
  509. data/libs/openssl-edge/openssl/ssl-internal.rb +180 -0
  510. data/libs/openssl-edge/openssl/ssl.rb +1 -0
  511. data/libs/openssl-edge/openssl/x509-internal.rb +153 -0
  512. data/libs/openssl-edge/openssl/x509.rb +1 -0
  513. data/libs/openssl.so-edge.rb +2 -0
  514. data/libs/openssl.so-edge/ext.yml +8 -0
  515. data/libs/openssl.so-edge/ext/Rakefile +140 -0
  516. data/libs/openssl.so-edge/ext/android/armeabi/libcrypto.a +0 -0
  517. data/libs/openssl.so-edge/ext/android/armeabi/libssl.a +0 -0
  518. data/libs/openssl.so-edge/ext/android/x86/libcrypto.a +0 -0
  519. data/libs/openssl.so-edge/ext/android/x86/libssl.a +0 -0
  520. data/libs/openssl.so-edge/ext/build +12 -0
  521. data/libs/openssl.so-edge/ext/build.bat +1 -0
  522. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/dh/dh_locl.h +56 -0
  523. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/dsa/dsa_locl.h +76 -0
  524. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/evp/evp_locl.h +66 -0
  525. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/hmac/hmac_lcl.h +33 -0
  526. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/asn1_int.h +94 -0
  527. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/async.h +14 -0
  528. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/bn_conf.h +28 -0
  529. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/bn_dh.h +17 -0
  530. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/bn_int.h +82 -0
  531. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/bn_srp.h +32 -0
  532. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/chacha.h +49 -0
  533. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/cryptlib.h +81 -0
  534. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/cryptlib_int.h +31 -0
  535. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/dso_conf.h +16 -0
  536. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/engine.h +20 -0
  537. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/err_int.h +17 -0
  538. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/evp_int.h +382 -0
  539. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/md32_common.h +383 -0
  540. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/objects.h +12 -0
  541. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/poly1305.h +19 -0
  542. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/rand.h +20 -0
  543. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/x509_int.h +267 -0
  544. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/ocsp/ocsp_lcl.h +216 -0
  545. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/rsa/rsa_locl.h +96 -0
  546. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/x509/x509_lcl.h +142 -0
  547. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/e_os.h +520 -0
  548. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/bio.h +26 -0
  549. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/comp.h +12 -0
  550. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/conf.h +32 -0
  551. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/constant_time_locl.h +185 -0
  552. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/dane.h +103 -0
  553. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/dso.h +216 -0
  554. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/err.h +15 -0
  555. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/numbers.h +68 -0
  556. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/o_dir.h +63 -0
  557. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/o_str.h +17 -0
  558. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/thread_once.h +42 -0
  559. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/__DECC_INCLUDE_EPILOGUE.H +16 -0
  560. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/__DECC_INCLUDE_PROLOGUE.H +20 -0
  561. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/aes.h +92 -0
  562. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/asn1.h +1096 -0
  563. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/asn1_mac.h +10 -0
  564. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/asn1t.h +924 -0
  565. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/async.h +98 -0
  566. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/bio.h +854 -0
  567. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/blowfish.h +61 -0
  568. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/bn.h +575 -0
  569. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/buffer.h +76 -0
  570. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/camellia.h +83 -0
  571. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/cast.h +53 -0
  572. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/cmac.h +41 -0
  573. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/cms.h +512 -0
  574. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/comp.h +72 -0
  575. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/conf.h +216 -0
  576. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/conf_api.h +40 -0
  577. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/crypto.h +463 -0
  578. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ct.h +518 -0
  579. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/des.h +174 -0
  580. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/dh.h +343 -0
  581. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/dsa.h +282 -0
  582. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/dtls1.h +56 -0
  583. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/e_os2.h +311 -0
  584. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ebcdic.h +33 -0
  585. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ec.h +1581 -0
  586. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ecdh.h +10 -0
  587. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ecdsa.h +10 -0
  588. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/engine.h +842 -0
  589. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/err.h +259 -0
  590. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/evp.h +1586 -0
  591. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/hmac.h +49 -0
  592. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/idea.h +64 -0
  593. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/kdf.h +75 -0
  594. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/lhash.h +204 -0
  595. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/md2.h +44 -0
  596. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/md4.h +51 -0
  597. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/md5.h +50 -0
  598. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/mdc2.h +42 -0
  599. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/modes.h +203 -0
  600. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/obj_mac.h +4577 -0
  601. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/objects.h +1097 -0
  602. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ocsp.h +409 -0
  603. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/opensslconf.h +169 -0
  604. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/opensslconf.h.in +141 -0
  605. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/opensslv.h +105 -0
  606. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ossl_typ.h +190 -0
  607. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/pem.h +501 -0
  608. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/pem2.h +20 -0
  609. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/pkcs12.h +282 -0
  610. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/pkcs7.h +404 -0
  611. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/rand.h +89 -0
  612. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/rc2.h +51 -0
  613. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/rc4.h +36 -0
  614. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/rc5.h +63 -0
  615. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ripemd.h +47 -0
  616. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/rsa.h +588 -0
  617. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/safestack.h +164 -0
  618. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/seed.h +98 -0
  619. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/sha.h +119 -0
  620. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/srp.h +131 -0
  621. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/srtp.h +50 -0
  622. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ssl.h +2527 -0
  623. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ssl2.h +24 -0
  624. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ssl3.h +307 -0
  625. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/stack.h +78 -0
  626. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/symhacks.h +52 -0
  627. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/tls1.h +972 -0
  628. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ts.h +643 -0
  629. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/txt_db.h +57 -0
  630. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ui.h +368 -0
  631. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/whrlpool.h +48 -0
  632. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/x509.h +1123 -0
  633. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/x509_vfy.h +539 -0
  634. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/x509v3.h +1005 -0
  635. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/ssl/packet_locl.h +555 -0
  636. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/ssl/record/record.h +240 -0
  637. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/ssl/record/record_locl.h +114 -0
  638. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/ssl/ssl_locl.h +2127 -0
  639. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/ssl/statem/statem.h +123 -0
  640. data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/ssl/statem/statem_locl.h +124 -0
  641. data/libs/openssl.so-edge/openssl.so.rb +2 -0
  642. data/libs/webkit.rb +2 -0
  643. data/libs/webkit/ext.yml +4 -0
  644. data/libs/webkit/ext/build +12 -0
  645. data/libs/webkit/ext/build.bat +7 -0
  646. data/libs/webkit/ext/wm/Rakefile +61 -0
  647. data/libs/webkit/ext/wm/RhoMsgs.cpp +17 -0
  648. data/libs/webkit/ext/wm/RhoMsgs.h +14 -0
  649. data/libs/webkit/ext/wm/RhoWKBrowserEngine.cpp +736 -0
  650. data/libs/webkit/ext/wm/RhoWKBrowserEngine.h +105 -0
  651. data/libs/webkit/ext/wm/lib/npapi/rhobridge.dll +0 -0
  652. data/libs/webkit/ext/wm/lib/rhoengine_defs.h +80 -0
  653. data/libs/webkit/ext/wm/lib/rhowebkit.dll +0 -0
  654. data/libs/webkit/ext/wm/webkit.sln +36 -0
  655. data/libs/webkit/ext/wm/webkit.suo +0 -0
  656. data/libs/webkit/ext/wm/webkit.vcproj +800 -0
  657. data/libs/webkit/ext/wm/webkit.vsprops +20 -0
  658. data/libs/webkit/webkit.rb +2 -0
  659. data/rho-tau-extensions.gemspec +23 -0
  660. data/version +1 -0
  661. metadata +705 -0
@@ -0,0 +1,19 @@
1
+ /*
2
+ * 'OpenSSL for Ruby' project
3
+ * Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
4
+ * All rights reserved.
5
+ */
6
+ /*
7
+ * This program is licensed under the same licence as Ruby.
8
+ * (See the file 'LICENCE'.)
9
+ */
10
+ #if !defined(_OSSL_NS_SPKI_H_)
11
+ #define _OSSL_NS_SPKI_H_
12
+
13
+ extern VALUE mNetscape;
14
+ extern VALUE cSPKI;
15
+ extern VALUE eSPKIError;
16
+
17
+ void Init_ossl_ns_spki(void);
18
+
19
+ #endif /* _OSSL_NS_SPKI_H_ */
@@ -0,0 +1,2013 @@
1
+ /*
2
+ * 'OpenSSL for Ruby' project
3
+ * Copyright (C) 2003 Michal Rokos <m.rokos@sh.cvut.cz>
4
+ * Copyright (C) 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
5
+ * All rights reserved.
6
+ */
7
+ /*
8
+ * This program is licensed under the same licence as Ruby.
9
+ * (See the file 'LICENCE'.)
10
+ */
11
+ #include "ossl.h"
12
+
13
+ #if !defined(OPENSSL_NO_OCSP)
14
+
15
+ #define NewOCSPReq(klass) \
16
+ TypedData_Wrap_Struct((klass), &ossl_ocsp_request_type, 0)
17
+ #define SetOCSPReq(obj, req) do { \
18
+ if(!(req)) ossl_raise(rb_eRuntimeError, "Request wasn't initialized!"); \
19
+ RTYPEDDATA_DATA(obj) = (req); \
20
+ } while (0)
21
+ #define GetOCSPReq(obj, req) do { \
22
+ TypedData_Get_Struct((obj), OCSP_REQUEST, &ossl_ocsp_request_type, (req)); \
23
+ if(!(req)) ossl_raise(rb_eRuntimeError, "Request wasn't initialized!"); \
24
+ } while (0)
25
+ #define SafeGetOCSPReq(obj, req) do { \
26
+ OSSL_Check_Kind((obj), cOCSPReq); \
27
+ GetOCSPReq((obj), (req)); \
28
+ } while (0)
29
+
30
+ #define NewOCSPRes(klass) \
31
+ TypedData_Wrap_Struct((klass), &ossl_ocsp_response_type, 0)
32
+ #define SetOCSPRes(obj, res) do { \
33
+ if(!(res)) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \
34
+ RTYPEDDATA_DATA(obj) = (res); \
35
+ } while (0)
36
+ #define GetOCSPRes(obj, res) do { \
37
+ TypedData_Get_Struct((obj), OCSP_RESPONSE, &ossl_ocsp_response_type, (res)); \
38
+ if(!(res)) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \
39
+ } while (0)
40
+ #define SafeGetOCSPRes(obj, res) do { \
41
+ OSSL_Check_Kind((obj), cOCSPRes); \
42
+ GetOCSPRes((obj), (res)); \
43
+ } while (0)
44
+
45
+ #define NewOCSPBasicRes(klass) \
46
+ TypedData_Wrap_Struct((klass), &ossl_ocsp_basicresp_type, 0)
47
+ #define SetOCSPBasicRes(obj, res) do { \
48
+ if(!(res)) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \
49
+ RTYPEDDATA_DATA(obj) = (res); \
50
+ } while (0)
51
+ #define GetOCSPBasicRes(obj, res) do { \
52
+ TypedData_Get_Struct((obj), OCSP_BASICRESP, &ossl_ocsp_basicresp_type, (res)); \
53
+ if(!(res)) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \
54
+ } while (0)
55
+ #define SafeGetOCSPBasicRes(obj, res) do { \
56
+ OSSL_Check_Kind((obj), cOCSPBasicRes); \
57
+ GetOCSPBasicRes((obj), (res)); \
58
+ } while (0)
59
+
60
+ #define NewOCSPSingleRes(klass) \
61
+ TypedData_Wrap_Struct((klass), &ossl_ocsp_singleresp_type, 0)
62
+ #define SetOCSPSingleRes(obj, res) do { \
63
+ if(!(res)) ossl_raise(rb_eRuntimeError, "SingleResponse wasn't initialized!"); \
64
+ RTYPEDDATA_DATA(obj) = (res); \
65
+ } while (0)
66
+ #define GetOCSPSingleRes(obj, res) do { \
67
+ TypedData_Get_Struct((obj), OCSP_SINGLERESP, &ossl_ocsp_singleresp_type, (res)); \
68
+ if(!(res)) ossl_raise(rb_eRuntimeError, "SingleResponse wasn't initialized!"); \
69
+ } while (0)
70
+ #define SafeGetOCSPSingleRes(obj, res) do { \
71
+ OSSL_Check_Kind((obj), cOCSPSingleRes); \
72
+ GetOCSPSingleRes((obj), (res)); \
73
+ } while (0)
74
+
75
+ #define NewOCSPCertId(klass) \
76
+ TypedData_Wrap_Struct((klass), &ossl_ocsp_certid_type, 0)
77
+ #define SetOCSPCertId(obj, cid) do { \
78
+ if(!(cid)) ossl_raise(rb_eRuntimeError, "Cert ID wasn't initialized!"); \
79
+ RTYPEDDATA_DATA(obj) = (cid); \
80
+ } while (0)
81
+ #define GetOCSPCertId(obj, cid) do { \
82
+ TypedData_Get_Struct((obj), OCSP_CERTID, &ossl_ocsp_certid_type, (cid)); \
83
+ if(!(cid)) ossl_raise(rb_eRuntimeError, "Cert ID wasn't initialized!"); \
84
+ } while (0)
85
+ #define SafeGetOCSPCertId(obj, cid) do { \
86
+ OSSL_Check_Kind((obj), cOCSPCertId); \
87
+ GetOCSPCertId((obj), (cid)); \
88
+ } while (0)
89
+
90
+ VALUE mOCSP;
91
+ VALUE eOCSPError;
92
+ VALUE cOCSPReq;
93
+ VALUE cOCSPRes;
94
+ VALUE cOCSPBasicRes;
95
+ VALUE cOCSPSingleRes;
96
+ VALUE cOCSPCertId;
97
+
98
+ static void
99
+ ossl_ocsp_request_free(void *ptr)
100
+ {
101
+ OCSP_REQUEST_free(ptr);
102
+ }
103
+
104
+ static const rb_data_type_t ossl_ocsp_request_type = {
105
+ "OpenSSL/OCSP/REQUEST",
106
+ {
107
+ 0, ossl_ocsp_request_free,
108
+ },
109
+ 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
110
+ };
111
+
112
+ static void
113
+ ossl_ocsp_response_free(void *ptr)
114
+ {
115
+ OCSP_RESPONSE_free(ptr);
116
+ }
117
+
118
+ static const rb_data_type_t ossl_ocsp_response_type = {
119
+ "OpenSSL/OCSP/RESPONSE",
120
+ {
121
+ 0, ossl_ocsp_response_free,
122
+ },
123
+ 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
124
+ };
125
+
126
+ static void
127
+ ossl_ocsp_basicresp_free(void *ptr)
128
+ {
129
+ OCSP_BASICRESP_free(ptr);
130
+ }
131
+
132
+ static const rb_data_type_t ossl_ocsp_basicresp_type = {
133
+ "OpenSSL/OCSP/BASICRESP",
134
+ {
135
+ 0, ossl_ocsp_basicresp_free,
136
+ },
137
+ 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
138
+ };
139
+
140
+ static void
141
+ ossl_ocsp_singleresp_free(void *ptr)
142
+ {
143
+ OCSP_SINGLERESP_free(ptr);
144
+ }
145
+
146
+ static const rb_data_type_t ossl_ocsp_singleresp_type = {
147
+ "OpenSSL/OCSP/SINGLERESP",
148
+ {
149
+ 0, ossl_ocsp_singleresp_free,
150
+ },
151
+ 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
152
+ };
153
+
154
+ static void
155
+ ossl_ocsp_certid_free(void *ptr)
156
+ {
157
+ OCSP_CERTID_free(ptr);
158
+ }
159
+
160
+ static const rb_data_type_t ossl_ocsp_certid_type = {
161
+ "OpenSSL/OCSP/CERTID",
162
+ {
163
+ 0, ossl_ocsp_certid_free,
164
+ },
165
+ 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
166
+ };
167
+
168
+ /*
169
+ * Public
170
+ */
171
+ static VALUE
172
+ ossl_ocspcertid_new(OCSP_CERTID *cid)
173
+ {
174
+ VALUE obj = NewOCSPCertId(cOCSPCertId);
175
+ SetOCSPCertId(obj, cid);
176
+ return obj;
177
+ }
178
+
179
+ /*
180
+ * OCSP::Resquest
181
+ */
182
+ static VALUE
183
+ ossl_ocspreq_alloc(VALUE klass)
184
+ {
185
+ OCSP_REQUEST *req;
186
+ VALUE obj;
187
+
188
+ obj = NewOCSPReq(klass);
189
+ if (!(req = OCSP_REQUEST_new()))
190
+ ossl_raise(eOCSPError, NULL);
191
+ SetOCSPReq(obj, req);
192
+
193
+ return obj;
194
+ }
195
+
196
+ static VALUE
197
+ ossl_ocspreq_initialize_copy(VALUE self, VALUE other)
198
+ {
199
+ OCSP_REQUEST *req, *req_old, *req_new;
200
+
201
+ rb_check_frozen(self);
202
+ GetOCSPReq(self, req_old);
203
+ SafeGetOCSPReq(other, req);
204
+
205
+ req_new = ASN1_item_dup(ASN1_ITEM_rptr(OCSP_REQUEST), req);
206
+ if (!req_new)
207
+ ossl_raise(eOCSPError, "ASN1_item_dup");
208
+
209
+ SetOCSPReq(self, req_new);
210
+ OCSP_REQUEST_free(req_old);
211
+
212
+ return self;
213
+ }
214
+
215
+ /*
216
+ * call-seq:
217
+ * OpenSSL::OCSP::Request.new -> request
218
+ * OpenSSL::OCSP::Request.new(request_der) -> request
219
+ *
220
+ * Creates a new OpenSSL::OCSP::Request. The request may be created empty or
221
+ * from a +request_der+ string.
222
+ */
223
+
224
+ static VALUE
225
+ ossl_ocspreq_initialize(int argc, VALUE *argv, VALUE self)
226
+ {
227
+ VALUE arg;
228
+ OCSP_REQUEST *req, *req_new;
229
+ const unsigned char *p;
230
+
231
+ rb_scan_args(argc, argv, "01", &arg);
232
+ if(!NIL_P(arg)){
233
+ GetOCSPReq(self, req);
234
+ arg = ossl_to_der_if_possible(arg);
235
+ StringValue(arg);
236
+ p = (unsigned char *)RSTRING_PTR(arg);
237
+ req_new = d2i_OCSP_REQUEST(NULL, &p, RSTRING_LEN(arg));
238
+ if (!req_new)
239
+ ossl_raise(eOCSPError, "d2i_OCSP_REQUEST");
240
+ SetOCSPReq(self, req_new);
241
+ OCSP_REQUEST_free(req);
242
+ }
243
+
244
+ return self;
245
+ }
246
+
247
+ /*
248
+ * call-seq:
249
+ * request.add_nonce(nonce = nil) -> request
250
+ *
251
+ * Adds a +nonce+ to the OCSP request. If no nonce is given a random one will
252
+ * be generated.
253
+ *
254
+ * The nonce is used to prevent replay attacks but some servers do not support
255
+ * it.
256
+ */
257
+
258
+ static VALUE
259
+ ossl_ocspreq_add_nonce(int argc, VALUE *argv, VALUE self)
260
+ {
261
+ OCSP_REQUEST *req;
262
+ VALUE val;
263
+ int ret;
264
+
265
+ rb_scan_args(argc, argv, "01", &val);
266
+ if(NIL_P(val)) {
267
+ GetOCSPReq(self, req);
268
+ ret = OCSP_request_add1_nonce(req, NULL, -1);
269
+ }
270
+ else{
271
+ StringValue(val);
272
+ GetOCSPReq(self, req);
273
+ ret = OCSP_request_add1_nonce(req, (unsigned char *)RSTRING_PTR(val), RSTRING_LENINT(val));
274
+ }
275
+ if(!ret) ossl_raise(eOCSPError, NULL);
276
+
277
+ return self;
278
+ }
279
+
280
+ /*
281
+ * call-seq:
282
+ * request.check_nonce(response) -> result
283
+ *
284
+ * Checks the nonce validity for this request and +response+.
285
+ *
286
+ * The return value is one of the following:
287
+ *
288
+ * -1 :: nonce in request only.
289
+ * 0 :: nonces both present and not equal.
290
+ * 1 :: nonces present and equal.
291
+ * 2 :: nonces both absent.
292
+ * 3 :: nonce present in response only.
293
+ *
294
+ * For most responses, clients can check +result+ > 0. If a responder doesn't
295
+ * handle nonces <code>result.nonzero?</code> may be necessary. A result of
296
+ * <code>0</code> is always an error.
297
+ */
298
+
299
+ static VALUE
300
+ ossl_ocspreq_check_nonce(VALUE self, VALUE basic_resp)
301
+ {
302
+ OCSP_REQUEST *req;
303
+ OCSP_BASICRESP *bs;
304
+ int res;
305
+
306
+ GetOCSPReq(self, req);
307
+ SafeGetOCSPBasicRes(basic_resp, bs);
308
+ res = OCSP_check_nonce(req, bs);
309
+
310
+ return INT2NUM(res);
311
+ }
312
+
313
+ /*
314
+ * call-seq:
315
+ * request.add_certid(certificate_id) -> request
316
+ *
317
+ * Adds +certificate_id+ to the request.
318
+ */
319
+
320
+ static VALUE
321
+ ossl_ocspreq_add_certid(VALUE self, VALUE certid)
322
+ {
323
+ OCSP_REQUEST *req;
324
+ OCSP_CERTID *id, *id_new;
325
+
326
+ GetOCSPReq(self, req);
327
+ GetOCSPCertId(certid, id);
328
+
329
+ if (!(id_new = OCSP_CERTID_dup(id)))
330
+ ossl_raise(eOCSPError, "OCSP_CERTID_dup");
331
+ if (!OCSP_request_add0_id(req, id_new)) {
332
+ OCSP_CERTID_free(id_new);
333
+ ossl_raise(eOCSPError, "OCSP_request_add0_id");
334
+ }
335
+
336
+ return self;
337
+ }
338
+
339
+ /*
340
+ * call-seq:
341
+ * request.certid -> [certificate_id, ...]
342
+ *
343
+ * Returns all certificate IDs in this request.
344
+ */
345
+
346
+ static VALUE
347
+ ossl_ocspreq_get_certid(VALUE self)
348
+ {
349
+ OCSP_REQUEST *req;
350
+ OCSP_ONEREQ *one;
351
+ OCSP_CERTID *id;
352
+ VALUE ary, tmp;
353
+ int i, count;
354
+
355
+ GetOCSPReq(self, req);
356
+ count = OCSP_request_onereq_count(req);
357
+ ary = (count > 0) ? rb_ary_new() : Qnil;
358
+ for(i = 0; i < count; i++){
359
+ one = OCSP_request_onereq_get0(req, i);
360
+ tmp = NewOCSPCertId(cOCSPCertId);
361
+ if(!(id = OCSP_CERTID_dup(OCSP_onereq_get0_id(one))))
362
+ ossl_raise(eOCSPError, NULL);
363
+ SetOCSPCertId(tmp, id);
364
+ rb_ary_push(ary, tmp);
365
+ }
366
+
367
+ return ary;
368
+ }
369
+
370
+ /*
371
+ * call-seq:
372
+ * request.sign(cert, key, certs = nil, flags = 0, digest = nil) -> self
373
+ *
374
+ * Signs this OCSP request using +cert+, +key+ and optional +digest+. If
375
+ * +digest+ is not specified, SHA-1 is used. +certs+ is an optional Array of
376
+ * additional certificates which are included in the request in addition to
377
+ * the signer certificate. Note that if +certs+ is nil or not given, flag
378
+ * OpenSSL::OCSP::NOCERTS is enabled. Pass an empty array to include only the
379
+ * signer certificate.
380
+ *
381
+ * +flags+ can be a bitwise OR of the following constants:
382
+ *
383
+ * OpenSSL::OCSP::NOCERTS::
384
+ * Don't include any certificates in the request. +certs+ will be ignored.
385
+ */
386
+ static VALUE
387
+ ossl_ocspreq_sign(int argc, VALUE *argv, VALUE self)
388
+ {
389
+ VALUE signer_cert, signer_key, certs, flags, digest;
390
+ OCSP_REQUEST *req;
391
+ X509 *signer;
392
+ EVP_PKEY *key;
393
+ STACK_OF(X509) *x509s = NULL;
394
+ unsigned long flg = 0;
395
+ const EVP_MD *md;
396
+ int ret;
397
+
398
+ rb_scan_args(argc, argv, "23", &signer_cert, &signer_key, &certs, &flags, &digest);
399
+ GetOCSPReq(self, req);
400
+ signer = GetX509CertPtr(signer_cert);
401
+ key = GetPrivPKeyPtr(signer_key);
402
+ if (!NIL_P(flags))
403
+ flg = NUM2INT(flags);
404
+ if (NIL_P(digest))
405
+ md = EVP_sha1();
406
+ else
407
+ md = GetDigestPtr(digest);
408
+ if (NIL_P(certs))
409
+ flg |= OCSP_NOCERTS;
410
+ else
411
+ x509s = ossl_x509_ary2sk(certs);
412
+
413
+ ret = OCSP_request_sign(req, signer, key, md, x509s, flg);
414
+ sk_X509_pop_free(x509s, X509_free);
415
+ if (!ret) ossl_raise(eOCSPError, NULL);
416
+
417
+ return self;
418
+ }
419
+
420
+ /*
421
+ * call-seq:
422
+ * request.verify(certificates, store, flags = 0) -> true or false
423
+ *
424
+ * Verifies this request using the given +certificates+ and +store+.
425
+ * +certificates+ is an array of OpenSSL::X509::Certificate, +store+ is an
426
+ * OpenSSL::X509::Store.
427
+ */
428
+
429
+ static VALUE
430
+ ossl_ocspreq_verify(int argc, VALUE *argv, VALUE self)
431
+ {
432
+ VALUE certs, store, flags;
433
+ OCSP_REQUEST *req;
434
+ STACK_OF(X509) *x509s;
435
+ X509_STORE *x509st;
436
+ int flg, result;
437
+
438
+ rb_scan_args(argc, argv, "21", &certs, &store, &flags);
439
+ GetOCSPReq(self, req);
440
+ x509st = GetX509StorePtr(store);
441
+ flg = NIL_P(flags) ? 0 : NUM2INT(flags);
442
+ x509s = ossl_x509_ary2sk(certs);
443
+ result = OCSP_request_verify(req, x509s, x509st, flg);
444
+ sk_X509_pop_free(x509s, X509_free);
445
+ if (result <= 0)
446
+ ossl_clear_error();
447
+
448
+ return result > 0 ? Qtrue : Qfalse;
449
+ }
450
+
451
+ /*
452
+ * Returns this request as a DER-encoded string
453
+ */
454
+
455
+ static VALUE
456
+ ossl_ocspreq_to_der(VALUE self)
457
+ {
458
+ OCSP_REQUEST *req;
459
+ VALUE str;
460
+ unsigned char *p;
461
+ long len;
462
+
463
+ GetOCSPReq(self, req);
464
+ if((len = i2d_OCSP_REQUEST(req, NULL)) <= 0)
465
+ ossl_raise(eOCSPError, NULL);
466
+ str = rb_str_new(0, len);
467
+ p = (unsigned char *)RSTRING_PTR(str);
468
+ if(i2d_OCSP_REQUEST(req, &p) <= 0)
469
+ ossl_raise(eOCSPError, NULL);
470
+ ossl_str_adjust(str, p);
471
+
472
+ return str;
473
+ }
474
+
475
+ /*
476
+ * OCSP::Response
477
+ */
478
+
479
+ /* call-seq:
480
+ * OpenSSL::OCSP::Response.create(status, basic_response = nil) -> response
481
+ *
482
+ * Creates an OpenSSL::OCSP::Response from +status+ and +basic_response+.
483
+ */
484
+
485
+ static VALUE
486
+ ossl_ocspres_s_create(VALUE klass, VALUE status, VALUE basic_resp)
487
+ {
488
+ OCSP_BASICRESP *bs;
489
+ OCSP_RESPONSE *res;
490
+ VALUE obj;
491
+ int st = NUM2INT(status);
492
+
493
+ if(NIL_P(basic_resp)) bs = NULL;
494
+ else GetOCSPBasicRes(basic_resp, bs); /* NO NEED TO DUP */
495
+ obj = NewOCSPRes(klass);
496
+ if(!(res = OCSP_response_create(st, bs)))
497
+ ossl_raise(eOCSPError, NULL);
498
+ SetOCSPRes(obj, res);
499
+
500
+ return obj;
501
+ }
502
+
503
+ static VALUE
504
+ ossl_ocspres_alloc(VALUE klass)
505
+ {
506
+ OCSP_RESPONSE *res;
507
+ VALUE obj;
508
+
509
+ obj = NewOCSPRes(klass);
510
+ if(!(res = OCSP_RESPONSE_new()))
511
+ ossl_raise(eOCSPError, NULL);
512
+ SetOCSPRes(obj, res);
513
+
514
+ return obj;
515
+ }
516
+
517
+ static VALUE
518
+ ossl_ocspres_initialize_copy(VALUE self, VALUE other)
519
+ {
520
+ OCSP_RESPONSE *res, *res_old, *res_new;
521
+
522
+ rb_check_frozen(self);
523
+ GetOCSPRes(self, res_old);
524
+ SafeGetOCSPRes(other, res);
525
+
526
+ res_new = ASN1_item_dup(ASN1_ITEM_rptr(OCSP_RESPONSE), res);
527
+ if (!res_new)
528
+ ossl_raise(eOCSPError, "ASN1_item_dup");
529
+
530
+ SetOCSPRes(self, res_new);
531
+ OCSP_RESPONSE_free(res_old);
532
+
533
+ return self;
534
+ }
535
+
536
+ /*
537
+ * call-seq:
538
+ * OpenSSL::OCSP::Response.new -> response
539
+ * OpenSSL::OCSP::Response.new(response_der) -> response
540
+ *
541
+ * Creates a new OpenSSL::OCSP::Response. The response may be created empty or
542
+ * from a +response_der+ string.
543
+ */
544
+
545
+ static VALUE
546
+ ossl_ocspres_initialize(int argc, VALUE *argv, VALUE self)
547
+ {
548
+ VALUE arg;
549
+ OCSP_RESPONSE *res, *res_new;
550
+ const unsigned char *p;
551
+
552
+ rb_scan_args(argc, argv, "01", &arg);
553
+ if(!NIL_P(arg)){
554
+ GetOCSPRes(self, res);
555
+ arg = ossl_to_der_if_possible(arg);
556
+ StringValue(arg);
557
+ p = (unsigned char *)RSTRING_PTR(arg);
558
+ res_new = d2i_OCSP_RESPONSE(NULL, &p, RSTRING_LEN(arg));
559
+ if (!res_new)
560
+ ossl_raise(eOCSPError, "d2i_OCSP_RESPONSE");
561
+ SetOCSPRes(self, res_new);
562
+ OCSP_RESPONSE_free(res);
563
+ }
564
+
565
+ return self;
566
+ }
567
+
568
+ /*
569
+ * call-seq:
570
+ * response.status -> Integer
571
+ *
572
+ * Returns the status of the response.
573
+ */
574
+
575
+ static VALUE
576
+ ossl_ocspres_status(VALUE self)
577
+ {
578
+ OCSP_RESPONSE *res;
579
+ int st;
580
+
581
+ GetOCSPRes(self, res);
582
+ st = OCSP_response_status(res);
583
+
584
+ return INT2NUM(st);
585
+ }
586
+
587
+ /*
588
+ * call-seq:
589
+ * response.status_string -> String
590
+ *
591
+ * Returns a status string for the response.
592
+ */
593
+
594
+ static VALUE
595
+ ossl_ocspres_status_string(VALUE self)
596
+ {
597
+ OCSP_RESPONSE *res;
598
+ int st;
599
+
600
+ GetOCSPRes(self, res);
601
+ st = OCSP_response_status(res);
602
+
603
+ return rb_str_new2(OCSP_response_status_str(st));
604
+ }
605
+
606
+ /*
607
+ * call-seq:
608
+ * response.basic
609
+ *
610
+ * Returns a BasicResponse for this response
611
+ */
612
+
613
+ static VALUE
614
+ ossl_ocspres_get_basic(VALUE self)
615
+ {
616
+ OCSP_RESPONSE *res;
617
+ OCSP_BASICRESP *bs;
618
+ VALUE ret;
619
+
620
+ GetOCSPRes(self, res);
621
+ ret = NewOCSPBasicRes(cOCSPBasicRes);
622
+ if(!(bs = OCSP_response_get1_basic(res)))
623
+ return Qnil;
624
+ SetOCSPBasicRes(ret, bs);
625
+
626
+ return ret;
627
+ }
628
+
629
+ /*
630
+ * call-seq:
631
+ * response.to_der -> String
632
+ *
633
+ * Returns this response as a DER-encoded string.
634
+ */
635
+
636
+ static VALUE
637
+ ossl_ocspres_to_der(VALUE self)
638
+ {
639
+ OCSP_RESPONSE *res;
640
+ VALUE str;
641
+ long len;
642
+ unsigned char *p;
643
+
644
+ GetOCSPRes(self, res);
645
+ if((len = i2d_OCSP_RESPONSE(res, NULL)) <= 0)
646
+ ossl_raise(eOCSPError, NULL);
647
+ str = rb_str_new(0, len);
648
+ p = (unsigned char *)RSTRING_PTR(str);
649
+ if(i2d_OCSP_RESPONSE(res, &p) <= 0)
650
+ ossl_raise(eOCSPError, NULL);
651
+ ossl_str_adjust(str, p);
652
+
653
+ return str;
654
+ }
655
+
656
+ /*
657
+ * OCSP::BasicResponse
658
+ */
659
+ static VALUE
660
+ ossl_ocspbres_alloc(VALUE klass)
661
+ {
662
+ OCSP_BASICRESP *bs;
663
+ VALUE obj;
664
+
665
+ obj = NewOCSPBasicRes(klass);
666
+ if(!(bs = OCSP_BASICRESP_new()))
667
+ ossl_raise(eOCSPError, NULL);
668
+ SetOCSPBasicRes(obj, bs);
669
+
670
+ return obj;
671
+ }
672
+
673
+ static VALUE
674
+ ossl_ocspbres_initialize_copy(VALUE self, VALUE other)
675
+ {
676
+ OCSP_BASICRESP *bs, *bs_old, *bs_new;
677
+
678
+ rb_check_frozen(self);
679
+ GetOCSPBasicRes(self, bs_old);
680
+ SafeGetOCSPBasicRes(other, bs);
681
+
682
+ bs_new = ASN1_item_dup(ASN1_ITEM_rptr(OCSP_BASICRESP), bs);
683
+ if (!bs_new)
684
+ ossl_raise(eOCSPError, "ASN1_item_dup");
685
+
686
+ SetOCSPBasicRes(self, bs_new);
687
+ OCSP_BASICRESP_free(bs_old);
688
+
689
+ return self;
690
+ }
691
+
692
+ /*
693
+ * call-seq:
694
+ * OpenSSL::OCSP::BasicResponse.new(der_string = nil) -> basic_response
695
+ *
696
+ * Creates a new BasicResponse. If +der_string+ is given, decodes +der_string+
697
+ * as DER.
698
+ */
699
+
700
+ static VALUE
701
+ ossl_ocspbres_initialize(int argc, VALUE *argv, VALUE self)
702
+ {
703
+ VALUE arg;
704
+ OCSP_BASICRESP *res, *res_new;
705
+ const unsigned char *p;
706
+
707
+ rb_scan_args(argc, argv, "01", &arg);
708
+ if (!NIL_P(arg)) {
709
+ GetOCSPBasicRes(self, res);
710
+ arg = ossl_to_der_if_possible(arg);
711
+ StringValue(arg);
712
+ p = (unsigned char *)RSTRING_PTR(arg);
713
+ res_new = d2i_OCSP_BASICRESP(NULL, &p, RSTRING_LEN(arg));
714
+ if (!res_new)
715
+ ossl_raise(eOCSPError, "d2i_OCSP_BASICRESP");
716
+ SetOCSPBasicRes(self, res_new);
717
+ OCSP_BASICRESP_free(res);
718
+ }
719
+
720
+ return self;
721
+ }
722
+
723
+ /*
724
+ * call-seq:
725
+ * basic_response.copy_nonce(request) -> Integer
726
+ *
727
+ * Copies the nonce from +request+ into this response. Returns 1 on success
728
+ * and 0 on failure.
729
+ */
730
+
731
+ static VALUE
732
+ ossl_ocspbres_copy_nonce(VALUE self, VALUE request)
733
+ {
734
+ OCSP_BASICRESP *bs;
735
+ OCSP_REQUEST *req;
736
+ int ret;
737
+
738
+ GetOCSPBasicRes(self, bs);
739
+ SafeGetOCSPReq(request, req);
740
+ ret = OCSP_copy_nonce(bs, req);
741
+
742
+ return INT2NUM(ret);
743
+ }
744
+
745
+ /*
746
+ * call-seq:
747
+ * basic_response.add_nonce(nonce = nil)
748
+ *
749
+ * Adds +nonce+ to this response. If no nonce was provided a random nonce
750
+ * will be added.
751
+ */
752
+
753
+ static VALUE
754
+ ossl_ocspbres_add_nonce(int argc, VALUE *argv, VALUE self)
755
+ {
756
+ OCSP_BASICRESP *bs;
757
+ VALUE val;
758
+ int ret;
759
+
760
+ rb_scan_args(argc, argv, "01", &val);
761
+ if(NIL_P(val)) {
762
+ GetOCSPBasicRes(self, bs);
763
+ ret = OCSP_basic_add1_nonce(bs, NULL, -1);
764
+ }
765
+ else{
766
+ StringValue(val);
767
+ GetOCSPBasicRes(self, bs);
768
+ ret = OCSP_basic_add1_nonce(bs, (unsigned char *)RSTRING_PTR(val), RSTRING_LENINT(val));
769
+ }
770
+ if(!ret) ossl_raise(eOCSPError, NULL);
771
+
772
+ return self;
773
+ }
774
+
775
+ static VALUE
776
+ add_status_convert_time(VALUE obj)
777
+ {
778
+ ASN1_TIME *time;
779
+
780
+ if (RB_INTEGER_TYPE_P(obj))
781
+ time = X509_gmtime_adj(NULL, NUM2INT(obj));
782
+ else
783
+ time = ossl_x509_time_adjust(NULL, obj);
784
+
785
+ if (!time)
786
+ ossl_raise(eOCSPError, NULL);
787
+
788
+ return (VALUE)time;
789
+ }
790
+
791
+ /*
792
+ * call-seq:
793
+ * basic_response.add_status(certificate_id, status, reason, revocation_time, this_update, next_update, extensions) -> basic_response
794
+ *
795
+ * Adds a certificate status for +certificate_id+. +status+ is the status, and
796
+ * must be one of these:
797
+ *
798
+ * - OpenSSL::OCSP::V_CERTSTATUS_GOOD
799
+ * - OpenSSL::OCSP::V_CERTSTATUS_REVOKED
800
+ * - OpenSSL::OCSP::V_CERTSTATUS_UNKNOWN
801
+ *
802
+ * +reason+ and +revocation_time+ can be given only when +status+ is
803
+ * OpenSSL::OCSP::V_CERTSTATUS_REVOKED. +reason+ describes the reason for the
804
+ * revocation, and must be one of OpenSSL::OCSP::REVOKED_STATUS_* constants.
805
+ * +revocation_time+ is the time when the certificate is revoked.
806
+ *
807
+ * +this_update+ and +next_update+ indicate the time at which ths status is
808
+ * verified to be correct and the time at or before which newer information
809
+ * will be available, respectively. +next_update+ is optional.
810
+ *
811
+ * +extensions+ is an Array of OpenSSL::X509::Extension to be included in the
812
+ * SingleResponse. This is also optional.
813
+ *
814
+ * Note that the times, +revocation_time+, +this_update+ and +next_update+
815
+ * can be specified in either of Integer or Time object. If they are Integer, it
816
+ * is treated as the relative seconds from the current time.
817
+ */
818
+ static VALUE
819
+ ossl_ocspbres_add_status(VALUE self, VALUE cid, VALUE status,
820
+ VALUE reason, VALUE revtime,
821
+ VALUE thisupd, VALUE nextupd, VALUE ext)
822
+ {
823
+ OCSP_BASICRESP *bs;
824
+ OCSP_SINGLERESP *single;
825
+ OCSP_CERTID *id;
826
+ ASN1_TIME *ths = NULL, *nxt = NULL, *rev = NULL;
827
+ int st, rsn = 0, error = 0, rstatus = 0;
828
+ long i;
829
+ VALUE tmp;
830
+
831
+ GetOCSPBasicRes(self, bs);
832
+ SafeGetOCSPCertId(cid, id);
833
+ st = NUM2INT(status);
834
+ if (!NIL_P(ext)) { /* All ext's members must be X509::Extension */
835
+ ext = rb_check_array_type(ext);
836
+ for (i = 0; i < RARRAY_LEN(ext); i++)
837
+ OSSL_Check_Kind(RARRAY_AREF(ext, i), cX509Ext);
838
+ }
839
+
840
+ if (st == V_OCSP_CERTSTATUS_REVOKED) {
841
+ rsn = NUM2INT(reason);
842
+ tmp = rb_protect(add_status_convert_time, revtime, &rstatus);
843
+ if (rstatus) goto err;
844
+ rev = (ASN1_TIME *)tmp;
845
+ }
846
+
847
+ tmp = rb_protect(add_status_convert_time, thisupd, &rstatus);
848
+ if (rstatus) goto err;
849
+ ths = (ASN1_TIME *)tmp;
850
+
851
+ if (!NIL_P(nextupd)) {
852
+ tmp = rb_protect(add_status_convert_time, nextupd, &rstatus);
853
+ if (rstatus) goto err;
854
+ nxt = (ASN1_TIME *)tmp;
855
+ }
856
+
857
+ if(!(single = OCSP_basic_add1_status(bs, id, st, rsn, rev, ths, nxt))){
858
+ error = 1;
859
+ goto err;
860
+ }
861
+
862
+ if(!NIL_P(ext)){
863
+ X509_EXTENSION *x509ext;
864
+
865
+ for(i = 0; i < RARRAY_LEN(ext); i++){
866
+ x509ext = GetX509ExtPtr(RARRAY_AREF(ext, i));
867
+ if(!OCSP_SINGLERESP_add_ext(single, x509ext, -1)){
868
+ error = 1;
869
+ goto err;
870
+ }
871
+ }
872
+ }
873
+
874
+ err:
875
+ ASN1_TIME_free(ths);
876
+ ASN1_TIME_free(nxt);
877
+ ASN1_TIME_free(rev);
878
+ if(error) ossl_raise(eOCSPError, NULL);
879
+ if(rstatus) rb_jump_tag(rstatus);
880
+
881
+ return self;
882
+ }
883
+
884
+ /*
885
+ * call-seq:
886
+ * basic_response.status -> statuses
887
+ *
888
+ * Returns an Array of statuses for this response. Each status contains a
889
+ * CertificateId, the status (0 for good, 1 for revoked, 2 for unknown), the
890
+ * reason for the status, the revocation time, the time of this update, the time
891
+ * for the next update and a list of OpenSSL::X509::Extensions.
892
+ *
893
+ * This should be superseded by BasicResponse#responses and #find_response that
894
+ * return SingleResponse.
895
+ */
896
+ static VALUE
897
+ ossl_ocspbres_get_status(VALUE self)
898
+ {
899
+ OCSP_BASICRESP *bs;
900
+ OCSP_SINGLERESP *single;
901
+ OCSP_CERTID *cid;
902
+ ASN1_TIME *revtime, *thisupd, *nextupd;
903
+ int status, reason;
904
+ X509_EXTENSION *x509ext;
905
+ VALUE ret, ary, ext;
906
+ int count, ext_count, i, j;
907
+
908
+ GetOCSPBasicRes(self, bs);
909
+ ret = rb_ary_new();
910
+ count = OCSP_resp_count(bs);
911
+ for(i = 0; i < count; i++){
912
+ single = OCSP_resp_get0(bs, i);
913
+ if(!single) continue;
914
+
915
+ revtime = thisupd = nextupd = NULL;
916
+ status = OCSP_single_get0_status(single, &reason, &revtime,
917
+ &thisupd, &nextupd);
918
+ if(status < 0) continue;
919
+ if(!(cid = OCSP_CERTID_dup((OCSP_CERTID *)OCSP_SINGLERESP_get0_id(single)))) /* FIXME */
920
+ ossl_raise(eOCSPError, NULL);
921
+ ary = rb_ary_new();
922
+ rb_ary_push(ary, ossl_ocspcertid_new(cid));
923
+ rb_ary_push(ary, INT2NUM(status));
924
+ rb_ary_push(ary, INT2NUM(reason));
925
+ rb_ary_push(ary, revtime ? asn1time_to_time(revtime) : Qnil);
926
+ rb_ary_push(ary, thisupd ? asn1time_to_time(thisupd) : Qnil);
927
+ rb_ary_push(ary, nextupd ? asn1time_to_time(nextupd) : Qnil);
928
+ ext = rb_ary_new();
929
+ ext_count = OCSP_SINGLERESP_get_ext_count(single);
930
+ for(j = 0; j < ext_count; j++){
931
+ x509ext = OCSP_SINGLERESP_get_ext(single, j);
932
+ rb_ary_push(ext, ossl_x509ext_new(x509ext));
933
+ }
934
+ rb_ary_push(ary, ext);
935
+ rb_ary_push(ret, ary);
936
+ }
937
+
938
+ return ret;
939
+ }
940
+
941
+ static VALUE ossl_ocspsres_new(OCSP_SINGLERESP *);
942
+
943
+ /*
944
+ * call-seq:
945
+ * basic_response.responses -> Array of SingleResponse
946
+ *
947
+ * Returns an Array of SingleResponse for this BasicResponse.
948
+ */
949
+
950
+ static VALUE
951
+ ossl_ocspbres_get_responses(VALUE self)
952
+ {
953
+ OCSP_BASICRESP *bs;
954
+ VALUE ret;
955
+ int count, i;
956
+
957
+ GetOCSPBasicRes(self, bs);
958
+ count = OCSP_resp_count(bs);
959
+ ret = rb_ary_new2(count);
960
+
961
+ for (i = 0; i < count; i++) {
962
+ OCSP_SINGLERESP *sres, *sres_new;
963
+
964
+ sres = OCSP_resp_get0(bs, i);
965
+ sres_new = ASN1_item_dup(ASN1_ITEM_rptr(OCSP_SINGLERESP), sres);
966
+ if (!sres_new)
967
+ ossl_raise(eOCSPError, "ASN1_item_dup");
968
+
969
+ rb_ary_push(ret, ossl_ocspsres_new(sres_new));
970
+ }
971
+
972
+ return ret;
973
+ }
974
+
975
+
976
+ /*
977
+ * call-seq:
978
+ * basic_response.find_response(certificate_id) -> SingleResponse | nil
979
+ *
980
+ * Returns a SingleResponse whose CertId matches with +certificate_id+, or nil
981
+ * if this BasicResponse does not contain it.
982
+ */
983
+ static VALUE
984
+ ossl_ocspbres_find_response(VALUE self, VALUE target)
985
+ {
986
+ OCSP_BASICRESP *bs;
987
+ OCSP_SINGLERESP *sres, *sres_new;
988
+ OCSP_CERTID *id;
989
+ int n;
990
+
991
+ SafeGetOCSPCertId(target, id);
992
+ GetOCSPBasicRes(self, bs);
993
+
994
+ if ((n = OCSP_resp_find(bs, id, -1)) == -1)
995
+ return Qnil;
996
+
997
+ sres = OCSP_resp_get0(bs, n);
998
+ sres_new = ASN1_item_dup(ASN1_ITEM_rptr(OCSP_SINGLERESP), sres);
999
+ if (!sres_new)
1000
+ ossl_raise(eOCSPError, "ASN1_item_dup");
1001
+
1002
+ return ossl_ocspsres_new(sres_new);
1003
+ }
1004
+
1005
+ /*
1006
+ * call-seq:
1007
+ * basic_response.sign(cert, key, certs = nil, flags = 0, digest = nil) -> self
1008
+ *
1009
+ * Signs this OCSP response using the +cert+, +key+ and optional +digest+. This
1010
+ * behaves in the similar way as OpenSSL::OCSP::Request#sign.
1011
+ *
1012
+ * +flags+ can include:
1013
+ * OpenSSL::OCSP::NOCERTS:: don't include certificates
1014
+ * OpenSSL::OCSP::NOTIME:: don't set producedAt
1015
+ * OpenSSL::OCSP::RESPID_KEY:: use signer's public key hash as responderID
1016
+ */
1017
+
1018
+ static VALUE
1019
+ ossl_ocspbres_sign(int argc, VALUE *argv, VALUE self)
1020
+ {
1021
+ VALUE signer_cert, signer_key, certs, flags, digest;
1022
+ OCSP_BASICRESP *bs;
1023
+ X509 *signer;
1024
+ EVP_PKEY *key;
1025
+ STACK_OF(X509) *x509s = NULL;
1026
+ unsigned long flg = 0;
1027
+ const EVP_MD *md;
1028
+ int ret;
1029
+
1030
+ rb_scan_args(argc, argv, "23", &signer_cert, &signer_key, &certs, &flags, &digest);
1031
+ GetOCSPBasicRes(self, bs);
1032
+ signer = GetX509CertPtr(signer_cert);
1033
+ key = GetPrivPKeyPtr(signer_key);
1034
+ if (!NIL_P(flags))
1035
+ flg = NUM2INT(flags);
1036
+ if (NIL_P(digest))
1037
+ md = EVP_sha1();
1038
+ else
1039
+ md = GetDigestPtr(digest);
1040
+ if (NIL_P(certs))
1041
+ flg |= OCSP_NOCERTS;
1042
+ else
1043
+ x509s = ossl_x509_ary2sk(certs);
1044
+
1045
+ ret = OCSP_basic_sign(bs, signer, key, md, x509s, flg);
1046
+ sk_X509_pop_free(x509s, X509_free);
1047
+ if (!ret) ossl_raise(eOCSPError, NULL);
1048
+
1049
+ return self;
1050
+ }
1051
+
1052
+ /*
1053
+ * call-seq:
1054
+ * basic_response.verify(certificates, store, flags = 0) -> true or false
1055
+ *
1056
+ * Verifies the signature of the response using the given +certificates+ and
1057
+ * +store+. This works in the similar way as OpenSSL::OCSP::Request#verify.
1058
+ */
1059
+ static VALUE
1060
+ ossl_ocspbres_verify(int argc, VALUE *argv, VALUE self)
1061
+ {
1062
+ VALUE certs, store, flags;
1063
+ OCSP_BASICRESP *bs;
1064
+ STACK_OF(X509) *x509s;
1065
+ X509_STORE *x509st;
1066
+ int flg, result;
1067
+
1068
+ rb_scan_args(argc, argv, "21", &certs, &store, &flags);
1069
+ GetOCSPBasicRes(self, bs);
1070
+ x509st = GetX509StorePtr(store);
1071
+ flg = NIL_P(flags) ? 0 : NUM2INT(flags);
1072
+ x509s = ossl_x509_ary2sk(certs);
1073
+ #if (OPENSSL_VERSION_NUMBER < 0x1000202fL) || defined(LIBRESSL_VERSION_NUMBER)
1074
+ /*
1075
+ * OpenSSL had a bug that it doesn't use the certificates in x509s for
1076
+ * verifying the chain. This can be a problem when the response is signed by
1077
+ * a certificate issued by an intermediate CA.
1078
+ *
1079
+ * root_ca
1080
+ * |
1081
+ * intermediate_ca
1082
+ * |-------------|
1083
+ * end_entity ocsp_signer
1084
+ *
1085
+ * When the certificate hierarchy is like this, and the response contains
1086
+ * only ocsp_signer certificate, the following code wrongly fails.
1087
+ *
1088
+ * store = OpenSSL::X509::Store.new; store.add_cert(root_ca)
1089
+ * basic_response.verify([intermediate_ca], store)
1090
+ *
1091
+ * So add the certificates in x509s to the embedded certificates list first.
1092
+ *
1093
+ * This is fixed in OpenSSL 0.9.8zg, 1.0.0s, 1.0.1n, 1.0.2b. But it still
1094
+ * exists in LibreSSL 2.1.10, 2.2.9, 2.3.6, 2.4.1.
1095
+ */
1096
+ if (!(flg & (OCSP_NOCHAIN | OCSP_NOVERIFY)) &&
1097
+ sk_X509_num(x509s) && sk_X509_num(bs->certs)) {
1098
+ int i;
1099
+
1100
+ bs = ASN1_item_dup(ASN1_ITEM_rptr(OCSP_BASICRESP), bs);
1101
+ if (!bs) {
1102
+ sk_X509_pop_free(x509s, X509_free);
1103
+ ossl_raise(eOCSPError, "ASN1_item_dup");
1104
+ }
1105
+
1106
+ for (i = 0; i < sk_X509_num(x509s); i++) {
1107
+ if (!OCSP_basic_add1_cert(bs, sk_X509_value(x509s, i))) {
1108
+ sk_X509_pop_free(x509s, X509_free);
1109
+ OCSP_BASICRESP_free(bs);
1110
+ ossl_raise(eOCSPError, "OCSP_basic_add1_cert");
1111
+ }
1112
+ }
1113
+ result = OCSP_basic_verify(bs, x509s, x509st, flg);
1114
+ OCSP_BASICRESP_free(bs);
1115
+ }
1116
+ else {
1117
+ result = OCSP_basic_verify(bs, x509s, x509st, flg);
1118
+ }
1119
+ #else
1120
+ result = OCSP_basic_verify(bs, x509s, x509st, flg);
1121
+ #endif
1122
+ sk_X509_pop_free(x509s, X509_free);
1123
+ if (result <= 0)
1124
+ ossl_clear_error();
1125
+
1126
+ return result > 0 ? Qtrue : Qfalse;
1127
+ }
1128
+
1129
+ /*
1130
+ * call-seq:
1131
+ * basic_response.to_der -> String
1132
+ *
1133
+ * Encodes this basic response into a DER-encoded string.
1134
+ */
1135
+ static VALUE
1136
+ ossl_ocspbres_to_der(VALUE self)
1137
+ {
1138
+ OCSP_BASICRESP *res;
1139
+ VALUE str;
1140
+ long len;
1141
+ unsigned char *p;
1142
+
1143
+ GetOCSPBasicRes(self, res);
1144
+ if ((len = i2d_OCSP_BASICRESP(res, NULL)) <= 0)
1145
+ ossl_raise(eOCSPError, NULL);
1146
+ str = rb_str_new(0, len);
1147
+ p = (unsigned char *)RSTRING_PTR(str);
1148
+ if (i2d_OCSP_BASICRESP(res, &p) <= 0)
1149
+ ossl_raise(eOCSPError, NULL);
1150
+ ossl_str_adjust(str, p);
1151
+
1152
+ return str;
1153
+ }
1154
+
1155
+ /*
1156
+ * OCSP::SingleResponse
1157
+ */
1158
+ static VALUE
1159
+ ossl_ocspsres_new(OCSP_SINGLERESP *sres)
1160
+ {
1161
+ VALUE obj;
1162
+
1163
+ obj = NewOCSPSingleRes(cOCSPSingleRes);
1164
+ SetOCSPSingleRes(obj, sres);
1165
+
1166
+ return obj;
1167
+ }
1168
+
1169
+ static VALUE
1170
+ ossl_ocspsres_alloc(VALUE klass)
1171
+ {
1172
+ OCSP_SINGLERESP *sres;
1173
+ VALUE obj;
1174
+
1175
+ obj = NewOCSPSingleRes(klass);
1176
+ if (!(sres = OCSP_SINGLERESP_new()))
1177
+ ossl_raise(eOCSPError, NULL);
1178
+ SetOCSPSingleRes(obj, sres);
1179
+
1180
+ return obj;
1181
+ }
1182
+
1183
+ /*
1184
+ * call-seq:
1185
+ * OpenSSL::OCSP::SingleResponse.new(der_string) -> SingleResponse
1186
+ *
1187
+ * Creates a new SingleResponse from +der_string+.
1188
+ */
1189
+ static VALUE
1190
+ ossl_ocspsres_initialize(VALUE self, VALUE arg)
1191
+ {
1192
+ OCSP_SINGLERESP *res, *res_new;
1193
+ const unsigned char *p;
1194
+
1195
+ arg = ossl_to_der_if_possible(arg);
1196
+ StringValue(arg);
1197
+ GetOCSPSingleRes(self, res);
1198
+
1199
+ p = (unsigned char*)RSTRING_PTR(arg);
1200
+ res_new = d2i_OCSP_SINGLERESP(NULL, &p, RSTRING_LEN(arg));
1201
+ if (!res_new)
1202
+ ossl_raise(eOCSPError, "d2i_OCSP_SINGLERESP");
1203
+ SetOCSPSingleRes(self, res_new);
1204
+ OCSP_SINGLERESP_free(res);
1205
+
1206
+ return self;
1207
+ }
1208
+
1209
+ static VALUE
1210
+ ossl_ocspsres_initialize_copy(VALUE self, VALUE other)
1211
+ {
1212
+ OCSP_SINGLERESP *sres, *sres_old, *sres_new;
1213
+
1214
+ rb_check_frozen(self);
1215
+ GetOCSPSingleRes(self, sres_old);
1216
+ SafeGetOCSPSingleRes(other, sres);
1217
+
1218
+ sres_new = ASN1_item_dup(ASN1_ITEM_rptr(OCSP_SINGLERESP), sres);
1219
+ if (!sres_new)
1220
+ ossl_raise(eOCSPError, "ASN1_item_dup");
1221
+
1222
+ SetOCSPSingleRes(self, sres_new);
1223
+ OCSP_SINGLERESP_free(sres_old);
1224
+
1225
+ return self;
1226
+ }
1227
+
1228
+ /*
1229
+ * call-seq:
1230
+ * single_response.check_validity(nsec = 0, maxsec = -1) -> true | false
1231
+ *
1232
+ * Checks the validity of thisUpdate and nextUpdate fields of this
1233
+ * SingleResponse. This checks the current time is within the range thisUpdate
1234
+ * to nextUpdate.
1235
+ *
1236
+ * It is possible that the OCSP request takes a few seconds or the time is not
1237
+ * accurate. To avoid rejecting a valid response, this method allows the times
1238
+ * to be within +nsec+ of the current time.
1239
+ *
1240
+ * Some responders don't set the nextUpdate field. This may cause a very old
1241
+ * response to be considered valid. The +maxsec+ parameter can be used to limit
1242
+ * the age of responses.
1243
+ */
1244
+ static VALUE
1245
+ ossl_ocspsres_check_validity(int argc, VALUE *argv, VALUE self)
1246
+ {
1247
+ OCSP_SINGLERESP *sres;
1248
+ ASN1_GENERALIZEDTIME *this_update, *next_update;
1249
+ VALUE nsec_v, maxsec_v;
1250
+ int nsec, maxsec, status, ret;
1251
+
1252
+ rb_scan_args(argc, argv, "02", &nsec_v, &maxsec_v);
1253
+ nsec = NIL_P(nsec_v) ? 0 : NUM2INT(nsec_v);
1254
+ maxsec = NIL_P(maxsec_v) ? -1 : NUM2INT(maxsec_v);
1255
+
1256
+ GetOCSPSingleRes(self, sres);
1257
+ status = OCSP_single_get0_status(sres, NULL, NULL, &this_update, &next_update);
1258
+ if (status < 0)
1259
+ ossl_raise(eOCSPError, "OCSP_single_get0_status");
1260
+
1261
+ ret = OCSP_check_validity(this_update, next_update, nsec, maxsec);
1262
+
1263
+ if (ret)
1264
+ return Qtrue;
1265
+ else {
1266
+ ossl_clear_error();
1267
+ return Qfalse;
1268
+ }
1269
+ }
1270
+
1271
+ /*
1272
+ * call-seq:
1273
+ * single_response.certid -> CertificateId
1274
+ *
1275
+ * Returns the CertificateId for which this SingleResponse is.
1276
+ */
1277
+ static VALUE
1278
+ ossl_ocspsres_get_certid(VALUE self)
1279
+ {
1280
+ OCSP_SINGLERESP *sres;
1281
+ OCSP_CERTID *id;
1282
+
1283
+ GetOCSPSingleRes(self, sres);
1284
+ id = OCSP_CERTID_dup((OCSP_CERTID *)OCSP_SINGLERESP_get0_id(sres)); /* FIXME */
1285
+
1286
+ return ossl_ocspcertid_new(id);
1287
+ }
1288
+
1289
+ /*
1290
+ * call-seq:
1291
+ * single_response.cert_status -> Integer
1292
+ *
1293
+ * Returns the status of the certificate identified by the certid.
1294
+ * The return value may be one of these constant:
1295
+ *
1296
+ * - V_CERTSTATUS_GOOD
1297
+ * - V_CERTSTATUS_REVOKED
1298
+ * - V_CERTSTATUS_UNKNOWN
1299
+ *
1300
+ * When the status is V_CERTSTATUS_REVOKED, the time at which the certificate
1301
+ * was revoked can be retrieved by #revocation_time.
1302
+ */
1303
+ static VALUE
1304
+ ossl_ocspsres_get_cert_status(VALUE self)
1305
+ {
1306
+ OCSP_SINGLERESP *sres;
1307
+ int status;
1308
+
1309
+ GetOCSPSingleRes(self, sres);
1310
+ status = OCSP_single_get0_status(sres, NULL, NULL, NULL, NULL);
1311
+ if (status < 0)
1312
+ ossl_raise(eOCSPError, "OCSP_single_get0_status");
1313
+
1314
+ return INT2NUM(status);
1315
+ }
1316
+
1317
+ /*
1318
+ * call-seq:
1319
+ * single_response.this_update -> Time
1320
+ */
1321
+ static VALUE
1322
+ ossl_ocspsres_get_this_update(VALUE self)
1323
+ {
1324
+ OCSP_SINGLERESP *sres;
1325
+ int status;
1326
+ ASN1_GENERALIZEDTIME *time;
1327
+
1328
+ GetOCSPSingleRes(self, sres);
1329
+ status = OCSP_single_get0_status(sres, NULL, NULL, &time, NULL);
1330
+ if (status < 0)
1331
+ ossl_raise(eOCSPError, "OCSP_single_get0_status");
1332
+
1333
+ return asn1time_to_time(time); /* will handle NULL */
1334
+ }
1335
+
1336
+ /*
1337
+ * call-seq:
1338
+ * single_response.next_update -> Time | nil
1339
+ */
1340
+ static VALUE
1341
+ ossl_ocspsres_get_next_update(VALUE self)
1342
+ {
1343
+ OCSP_SINGLERESP *sres;
1344
+ int status;
1345
+ ASN1_GENERALIZEDTIME *time;
1346
+
1347
+ GetOCSPSingleRes(self, sres);
1348
+ status = OCSP_single_get0_status(sres, NULL, NULL, NULL, &time);
1349
+ if (status < 0)
1350
+ ossl_raise(eOCSPError, "OCSP_single_get0_status");
1351
+
1352
+ return asn1time_to_time(time);
1353
+ }
1354
+
1355
+ /*
1356
+ * call-seq:
1357
+ * single_response.revocation_time -> Time | nil
1358
+ */
1359
+ static VALUE
1360
+ ossl_ocspsres_get_revocation_time(VALUE self)
1361
+ {
1362
+ OCSP_SINGLERESP *sres;
1363
+ int status;
1364
+ ASN1_GENERALIZEDTIME *time;
1365
+
1366
+ GetOCSPSingleRes(self, sres);
1367
+ status = OCSP_single_get0_status(sres, NULL, &time, NULL, NULL);
1368
+ if (status < 0)
1369
+ ossl_raise(eOCSPError, "OCSP_single_get0_status");
1370
+ if (status != V_OCSP_CERTSTATUS_REVOKED)
1371
+ ossl_raise(eOCSPError, "certificate is not revoked");
1372
+
1373
+ return asn1time_to_time(time);
1374
+ }
1375
+
1376
+ /*
1377
+ * call-seq:
1378
+ * single_response.revocation_reason -> Integer | nil
1379
+ */
1380
+ static VALUE
1381
+ ossl_ocspsres_get_revocation_reason(VALUE self)
1382
+ {
1383
+ OCSP_SINGLERESP *sres;
1384
+ int status, reason;
1385
+
1386
+ GetOCSPSingleRes(self, sres);
1387
+ status = OCSP_single_get0_status(sres, &reason, NULL, NULL, NULL);
1388
+ if (status < 0)
1389
+ ossl_raise(eOCSPError, "OCSP_single_get0_status");
1390
+ if (status != V_OCSP_CERTSTATUS_REVOKED)
1391
+ ossl_raise(eOCSPError, "certificate is not revoked");
1392
+
1393
+ return INT2NUM(reason);
1394
+ }
1395
+
1396
+ /*
1397
+ * call-seq:
1398
+ * single_response.extensions -> Array of X509::Extension
1399
+ */
1400
+ static VALUE
1401
+ ossl_ocspsres_get_extensions(VALUE self)
1402
+ {
1403
+ OCSP_SINGLERESP *sres;
1404
+ X509_EXTENSION *ext;
1405
+ int count, i;
1406
+ VALUE ary;
1407
+
1408
+ GetOCSPSingleRes(self, sres);
1409
+
1410
+ count = OCSP_SINGLERESP_get_ext_count(sres);
1411
+ ary = rb_ary_new2(count);
1412
+ for (i = 0; i < count; i++) {
1413
+ ext = OCSP_SINGLERESP_get_ext(sres, i);
1414
+ rb_ary_push(ary, ossl_x509ext_new(ext)); /* will dup */
1415
+ }
1416
+
1417
+ return ary;
1418
+ }
1419
+
1420
+ /*
1421
+ * call-seq:
1422
+ * single_response.to_der -> String
1423
+ *
1424
+ * Encodes this SingleResponse into a DER-encoded string.
1425
+ */
1426
+ static VALUE
1427
+ ossl_ocspsres_to_der(VALUE self)
1428
+ {
1429
+ OCSP_SINGLERESP *sres;
1430
+ VALUE str;
1431
+ long len;
1432
+ unsigned char *p;
1433
+
1434
+ GetOCSPSingleRes(self, sres);
1435
+ if ((len = i2d_OCSP_SINGLERESP(sres, NULL)) <= 0)
1436
+ ossl_raise(eOCSPError, NULL);
1437
+ str = rb_str_new(0, len);
1438
+ p = (unsigned char *)RSTRING_PTR(str);
1439
+ if (i2d_OCSP_SINGLERESP(sres, &p) <= 0)
1440
+ ossl_raise(eOCSPError, NULL);
1441
+ ossl_str_adjust(str, p);
1442
+
1443
+ return str;
1444
+ }
1445
+
1446
+
1447
+ /*
1448
+ * OCSP::CertificateId
1449
+ */
1450
+ static VALUE
1451
+ ossl_ocspcid_alloc(VALUE klass)
1452
+ {
1453
+ OCSP_CERTID *id;
1454
+ VALUE obj;
1455
+
1456
+ obj = NewOCSPCertId(klass);
1457
+ if(!(id = OCSP_CERTID_new()))
1458
+ ossl_raise(eOCSPError, NULL);
1459
+ SetOCSPCertId(obj, id);
1460
+
1461
+ return obj;
1462
+ }
1463
+
1464
+ static VALUE
1465
+ ossl_ocspcid_initialize_copy(VALUE self, VALUE other)
1466
+ {
1467
+ OCSP_CERTID *cid, *cid_old, *cid_new;
1468
+
1469
+ rb_check_frozen(self);
1470
+ GetOCSPCertId(self, cid_old);
1471
+ SafeGetOCSPCertId(other, cid);
1472
+
1473
+ cid_new = OCSP_CERTID_dup(cid);
1474
+ if (!cid_new)
1475
+ ossl_raise(eOCSPError, "OCSP_CERTID_dup");
1476
+
1477
+ SetOCSPCertId(self, cid_new);
1478
+ OCSP_CERTID_free(cid_old);
1479
+
1480
+ return self;
1481
+ }
1482
+
1483
+ /*
1484
+ * call-seq:
1485
+ * OpenSSL::OCSP::CertificateId.new(subject, issuer, digest = nil) -> certificate_id
1486
+ * OpenSSL::OCSP::CertificateId.new(der_string) -> certificate_id
1487
+ *
1488
+ * Creates a new OpenSSL::OCSP::CertificateId for the given +subject+ and
1489
+ * +issuer+ X509 certificates. The +digest+ is used to compute the
1490
+ * certificate ID and must be an OpenSSL::Digest instance.
1491
+ *
1492
+ * If only one argument is given, decodes it as DER representation of a
1493
+ * certificate ID.
1494
+ */
1495
+
1496
+ static VALUE
1497
+ ossl_ocspcid_initialize(int argc, VALUE *argv, VALUE self)
1498
+ {
1499
+ OCSP_CERTID *id, *newid;
1500
+ VALUE subject, issuer, digest;
1501
+
1502
+ GetOCSPCertId(self, id);
1503
+ if (rb_scan_args(argc, argv, "12", &subject, &issuer, &digest) == 1) {
1504
+ VALUE arg;
1505
+ const unsigned char *p;
1506
+
1507
+ arg = ossl_to_der_if_possible(subject);
1508
+ StringValue(arg);
1509
+ p = (unsigned char *)RSTRING_PTR(arg);
1510
+ newid = d2i_OCSP_CERTID(NULL, &p, RSTRING_LEN(arg));
1511
+ if (!newid)
1512
+ ossl_raise(eOCSPError, "d2i_OCSP_CERTID");
1513
+ }
1514
+ else {
1515
+ X509 *x509s, *x509i;
1516
+ const EVP_MD *md;
1517
+
1518
+ x509s = GetX509CertPtr(subject); /* NO NEED TO DUP */
1519
+ x509i = GetX509CertPtr(issuer); /* NO NEED TO DUP */
1520
+ md = !NIL_P(digest) ? GetDigestPtr(digest) : NULL;
1521
+
1522
+ newid = OCSP_cert_to_id(md, x509s, x509i);
1523
+ if (!newid)
1524
+ ossl_raise(eOCSPError, "OCSP_cert_to_id");
1525
+ }
1526
+
1527
+ SetOCSPCertId(self, newid);
1528
+ OCSP_CERTID_free(id);
1529
+
1530
+ return self;
1531
+ }
1532
+
1533
+ /*
1534
+ * call-seq:
1535
+ * certificate_id.cmp(other) -> true or false
1536
+ *
1537
+ * Compares this certificate id with +other+ and returns true if they are the
1538
+ * same.
1539
+ */
1540
+ static VALUE
1541
+ ossl_ocspcid_cmp(VALUE self, VALUE other)
1542
+ {
1543
+ OCSP_CERTID *id, *id2;
1544
+ int result;
1545
+
1546
+ GetOCSPCertId(self, id);
1547
+ SafeGetOCSPCertId(other, id2);
1548
+ result = OCSP_id_cmp(id, id2);
1549
+
1550
+ return (result == 0) ? Qtrue : Qfalse;
1551
+ }
1552
+
1553
+ /*
1554
+ * call-seq:
1555
+ * certificate_id.cmp_issuer(other) -> true or false
1556
+ *
1557
+ * Compares this certificate id's issuer with +other+ and returns true if
1558
+ * they are the same.
1559
+ */
1560
+
1561
+ static VALUE
1562
+ ossl_ocspcid_cmp_issuer(VALUE self, VALUE other)
1563
+ {
1564
+ OCSP_CERTID *id, *id2;
1565
+ int result;
1566
+
1567
+ GetOCSPCertId(self, id);
1568
+ SafeGetOCSPCertId(other, id2);
1569
+ result = OCSP_id_issuer_cmp(id, id2);
1570
+
1571
+ return (result == 0) ? Qtrue : Qfalse;
1572
+ }
1573
+
1574
+ /*
1575
+ * call-seq:
1576
+ * certificate_id.serial -> Integer
1577
+ *
1578
+ * Returns the serial number of the certificate for which status is being
1579
+ * requested.
1580
+ */
1581
+ static VALUE
1582
+ ossl_ocspcid_get_serial(VALUE self)
1583
+ {
1584
+ OCSP_CERTID *id;
1585
+ ASN1_INTEGER *serial;
1586
+
1587
+ GetOCSPCertId(self, id);
1588
+ OCSP_id_get0_info(NULL, NULL, NULL, &serial, id);
1589
+
1590
+ return asn1integer_to_num(serial);
1591
+ }
1592
+
1593
+ /*
1594
+ * call-seq:
1595
+ * certificate_id.issuer_name_hash -> String
1596
+ *
1597
+ * Returns the issuerNameHash of this certificate ID, the hash of the
1598
+ * issuer's distinguished name calculated with the hashAlgorithm.
1599
+ */
1600
+ static VALUE
1601
+ ossl_ocspcid_get_issuer_name_hash(VALUE self)
1602
+ {
1603
+ OCSP_CERTID *id;
1604
+ ASN1_OCTET_STRING *name_hash;
1605
+ VALUE ret;
1606
+
1607
+ GetOCSPCertId(self, id);
1608
+ OCSP_id_get0_info(&name_hash, NULL, NULL, NULL, id);
1609
+
1610
+ ret = rb_str_new(NULL, name_hash->length * 2);
1611
+ ossl_bin2hex(name_hash->data, RSTRING_PTR(ret), name_hash->length);
1612
+
1613
+ return ret;
1614
+ }
1615
+
1616
+ /*
1617
+ * call-seq:
1618
+ * certificate_id.issuer_key_hash -> String
1619
+ *
1620
+ * Returns the issuerKeyHash of this certificate ID, the hash of the issuer's
1621
+ * public key.
1622
+ */
1623
+ static VALUE
1624
+ ossl_ocspcid_get_issuer_key_hash(VALUE self)
1625
+ {
1626
+ OCSP_CERTID *id;
1627
+ ASN1_OCTET_STRING *key_hash;
1628
+ VALUE ret;
1629
+
1630
+ GetOCSPCertId(self, id);
1631
+ OCSP_id_get0_info(NULL, NULL, &key_hash, NULL, id);
1632
+
1633
+ ret = rb_str_new(NULL, key_hash->length * 2);
1634
+ ossl_bin2hex(key_hash->data, RSTRING_PTR(ret), key_hash->length);
1635
+
1636
+ return ret;
1637
+ }
1638
+
1639
+ /*
1640
+ * call-seq:
1641
+ * certificate_id.hash_algorithm -> String
1642
+ *
1643
+ * Returns the ln (long name) of the hash algorithm used to generate
1644
+ * the issuerNameHash and the issuerKeyHash values.
1645
+ */
1646
+ static VALUE
1647
+ ossl_ocspcid_get_hash_algorithm(VALUE self)
1648
+ {
1649
+ OCSP_CERTID *id;
1650
+ ASN1_OBJECT *oid;
1651
+ BIO *out;
1652
+
1653
+ GetOCSPCertId(self, id);
1654
+ OCSP_id_get0_info(NULL, &oid, NULL, NULL, id);
1655
+
1656
+ if (!(out = BIO_new(BIO_s_mem())))
1657
+ ossl_raise(eOCSPError, "BIO_new");
1658
+
1659
+ if (!i2a_ASN1_OBJECT(out, oid)) {
1660
+ BIO_free(out);
1661
+ ossl_raise(eOCSPError, "i2a_ASN1_OBJECT");
1662
+ }
1663
+ return ossl_membio2str(out);
1664
+ }
1665
+
1666
+ /*
1667
+ * call-seq:
1668
+ * certificate_id.to_der -> String
1669
+ *
1670
+ * Encodes this certificate identifier into a DER-encoded string.
1671
+ */
1672
+ static VALUE
1673
+ ossl_ocspcid_to_der(VALUE self)
1674
+ {
1675
+ OCSP_CERTID *id;
1676
+ VALUE str;
1677
+ long len;
1678
+ unsigned char *p;
1679
+
1680
+ GetOCSPCertId(self, id);
1681
+ if ((len = i2d_OCSP_CERTID(id, NULL)) <= 0)
1682
+ ossl_raise(eOCSPError, NULL);
1683
+ str = rb_str_new(0, len);
1684
+ p = (unsigned char *)RSTRING_PTR(str);
1685
+ if (i2d_OCSP_CERTID(id, &p) <= 0)
1686
+ ossl_raise(eOCSPError, NULL);
1687
+ ossl_str_adjust(str, p);
1688
+
1689
+ return str;
1690
+ }
1691
+
1692
+ void
1693
+ Init_ossl_ocsp(void)
1694
+ {
1695
+ #if 0
1696
+ mOSSL = rb_define_module("OpenSSL");
1697
+ eOSSLError = rb_define_class_under(mOSSL, "OpenSSLError", rb_eStandardError);
1698
+ #endif
1699
+
1700
+ /*
1701
+ * OpenSSL::OCSP implements Online Certificate Status Protocol requests
1702
+ * and responses.
1703
+ *
1704
+ * Creating and sending an OCSP request requires a subject certificate
1705
+ * that contains an OCSP URL in an authorityInfoAccess extension and the
1706
+ * issuer certificate for the subject certificate. First, load the issuer
1707
+ * and subject certificates:
1708
+ *
1709
+ * subject = OpenSSL::X509::Certificate.new subject_pem
1710
+ * issuer = OpenSSL::X509::Certificate.new issuer_pem
1711
+ *
1712
+ * To create the request we need to create a certificate ID for the
1713
+ * subject certificate so the CA knows which certificate we are asking
1714
+ * about:
1715
+ *
1716
+ * digest = OpenSSL::Digest::SHA1.new
1717
+ * certificate_id =
1718
+ * OpenSSL::OCSP::CertificateId.new subject, issuer, digest
1719
+ *
1720
+ * Then create a request and add the certificate ID to it:
1721
+ *
1722
+ * request = OpenSSL::OCSP::Request.new
1723
+ * request.add_certid certificate_id
1724
+ *
1725
+ * Adding a nonce to the request protects against replay attacks but not
1726
+ * all CA process the nonce.
1727
+ *
1728
+ * request.add_nonce
1729
+ *
1730
+ * To submit the request to the CA for verification we need to extract the
1731
+ * OCSP URI from the subject certificate:
1732
+ *
1733
+ * authority_info_access = subject.extensions.find do |extension|
1734
+ * extension.oid == 'authorityInfoAccess'
1735
+ * end
1736
+ *
1737
+ * descriptions = authority_info_access.value.split "\n"
1738
+ * ocsp = descriptions.find do |description|
1739
+ * description.start_with? 'OCSP'
1740
+ * end
1741
+ *
1742
+ * require 'uri'
1743
+ *
1744
+ * ocsp_uri = URI ocsp[/URI:(.*)/, 1]
1745
+ *
1746
+ * To submit the request we'll POST the request to the OCSP URI (per RFC
1747
+ * 2560). Note that we only handle HTTP requests and don't handle any
1748
+ * redirects in this example, so this is insufficient for serious use.
1749
+ *
1750
+ * require 'net/http'
1751
+ *
1752
+ * http_response =
1753
+ * Net::HTTP.start ocsp_uri.hostname, ocsp.port do |http|
1754
+ * http.post ocsp_uri.path, request.to_der,
1755
+ * 'content-type' => 'application/ocsp-request'
1756
+ * end
1757
+ *
1758
+ * response = OpenSSL::OCSP::Response.new http_response.body
1759
+ * response_basic = response.basic
1760
+ *
1761
+ * First we check if the response has a valid signature. Without a valid
1762
+ * signature we cannot trust it. If you get a failure here you may be
1763
+ * missing a system certificate store or may be missing the intermediate
1764
+ * certificates.
1765
+ *
1766
+ * store = OpenSSL::X509::Store.new
1767
+ * store.set_default_paths
1768
+ *
1769
+ * unless response_basic.verify [], store then
1770
+ * raise 'response is not signed by a trusted certificate'
1771
+ * end
1772
+ *
1773
+ * The response contains the status information (success/fail). We can
1774
+ * display the status as a string:
1775
+ *
1776
+ * puts response.status_string #=> successful
1777
+ *
1778
+ * Next we need to know the response details to determine if the response
1779
+ * matches our request. First we check the nonce. Again, not all CAs
1780
+ * support a nonce. See Request#check_nonce for the meanings of the
1781
+ * return values.
1782
+ *
1783
+ * p request.check_nonce basic_response #=> value from -1 to 3
1784
+ *
1785
+ * Then extract the status information for the certificate from the basic
1786
+ * response.
1787
+ *
1788
+ * single_response = basic_response.find_response(certificate_id)
1789
+ *
1790
+ * unless single_response
1791
+ * raise 'basic_response does not have the status for the certificiate'
1792
+ * end
1793
+ *
1794
+ * Then check the validity. A status issued in the future must be rejected.
1795
+ *
1796
+ * unless single_response.check_validity
1797
+ * raise 'this_update is in the future or next_update time has passed'
1798
+ * end
1799
+ *
1800
+ * case single_response.cert_status
1801
+ * when OpenSSL::OCSP::V_CERTSTATUS_GOOD
1802
+ * puts 'certificate is still valid'
1803
+ * when OpenSSL::OCSP::V_CERTSTATUS_REVOKED
1804
+ * puts "certificate has been revoked at #{single_response.revocation_time}"
1805
+ * when OpenSSL::OCSP::V_CERTSTATUS_UNKNOWN
1806
+ * puts 'responder doesn't know about the certificate'
1807
+ * end
1808
+ */
1809
+
1810
+ mOCSP = rb_define_module_under(mOSSL, "OCSP");
1811
+
1812
+ /*
1813
+ * OCSP error class.
1814
+ */
1815
+
1816
+ eOCSPError = rb_define_class_under(mOCSP, "OCSPError", eOSSLError);
1817
+
1818
+ /*
1819
+ * An OpenSSL::OCSP::Request contains the certificate information for
1820
+ * determining if a certificate has been revoked or not. A Request can be
1821
+ * created for a certificate or from a DER-encoded request created
1822
+ * elsewhere.
1823
+ */
1824
+
1825
+ cOCSPReq = rb_define_class_under(mOCSP, "Request", rb_cObject);
1826
+ rb_define_alloc_func(cOCSPReq, ossl_ocspreq_alloc);
1827
+ rb_define_copy_func(cOCSPReq, ossl_ocspreq_initialize_copy);
1828
+ rb_define_method(cOCSPReq, "initialize", ossl_ocspreq_initialize, -1);
1829
+ rb_define_method(cOCSPReq, "add_nonce", ossl_ocspreq_add_nonce, -1);
1830
+ rb_define_method(cOCSPReq, "check_nonce", ossl_ocspreq_check_nonce, 1);
1831
+ rb_define_method(cOCSPReq, "add_certid", ossl_ocspreq_add_certid, 1);
1832
+ rb_define_method(cOCSPReq, "certid", ossl_ocspreq_get_certid, 0);
1833
+ rb_define_method(cOCSPReq, "sign", ossl_ocspreq_sign, -1);
1834
+ rb_define_method(cOCSPReq, "verify", ossl_ocspreq_verify, -1);
1835
+ rb_define_method(cOCSPReq, "to_der", ossl_ocspreq_to_der, 0);
1836
+
1837
+ /*
1838
+ * An OpenSSL::OCSP::Response contains the status of a certificate check
1839
+ * which is created from an OpenSSL::OCSP::Request.
1840
+ */
1841
+
1842
+ cOCSPRes = rb_define_class_under(mOCSP, "Response", rb_cObject);
1843
+ rb_define_singleton_method(cOCSPRes, "create", ossl_ocspres_s_create, 2);
1844
+ rb_define_alloc_func(cOCSPRes, ossl_ocspres_alloc);
1845
+ rb_define_copy_func(cOCSPRes, ossl_ocspres_initialize_copy);
1846
+ rb_define_method(cOCSPRes, "initialize", ossl_ocspres_initialize, -1);
1847
+ rb_define_method(cOCSPRes, "status", ossl_ocspres_status, 0);
1848
+ rb_define_method(cOCSPRes, "status_string", ossl_ocspres_status_string, 0);
1849
+ rb_define_method(cOCSPRes, "basic", ossl_ocspres_get_basic, 0);
1850
+ rb_define_method(cOCSPRes, "to_der", ossl_ocspres_to_der, 0);
1851
+
1852
+ /*
1853
+ * An OpenSSL::OCSP::BasicResponse contains the status of a certificate
1854
+ * check which is created from an OpenSSL::OCSP::Request. A
1855
+ * BasicResponse is more detailed than a Response.
1856
+ */
1857
+
1858
+ cOCSPBasicRes = rb_define_class_under(mOCSP, "BasicResponse", rb_cObject);
1859
+ rb_define_alloc_func(cOCSPBasicRes, ossl_ocspbres_alloc);
1860
+ rb_define_copy_func(cOCSPBasicRes, ossl_ocspbres_initialize_copy);
1861
+ rb_define_method(cOCSPBasicRes, "initialize", ossl_ocspbres_initialize, -1);
1862
+ rb_define_method(cOCSPBasicRes, "copy_nonce", ossl_ocspbres_copy_nonce, 1);
1863
+ rb_define_method(cOCSPBasicRes, "add_nonce", ossl_ocspbres_add_nonce, -1);
1864
+ rb_define_method(cOCSPBasicRes, "add_status", ossl_ocspbres_add_status, 7);
1865
+ rb_define_method(cOCSPBasicRes, "status", ossl_ocspbres_get_status, 0);
1866
+ rb_define_method(cOCSPBasicRes, "responses", ossl_ocspbres_get_responses, 0);
1867
+ rb_define_method(cOCSPBasicRes, "find_response", ossl_ocspbres_find_response, 1);
1868
+ rb_define_method(cOCSPBasicRes, "sign", ossl_ocspbres_sign, -1);
1869
+ rb_define_method(cOCSPBasicRes, "verify", ossl_ocspbres_verify, -1);
1870
+ rb_define_method(cOCSPBasicRes, "to_der", ossl_ocspbres_to_der, 0);
1871
+
1872
+ /*
1873
+ * An OpenSSL::OCSP::SingleResponse represents an OCSP SingleResponse
1874
+ * structure, which contains the basic information of the status of the
1875
+ * certificate.
1876
+ */
1877
+ cOCSPSingleRes = rb_define_class_under(mOCSP, "SingleResponse", rb_cObject);
1878
+ rb_define_alloc_func(cOCSPSingleRes, ossl_ocspsres_alloc);
1879
+ rb_define_copy_func(cOCSPSingleRes, ossl_ocspsres_initialize_copy);
1880
+ rb_define_method(cOCSPSingleRes, "initialize", ossl_ocspsres_initialize, 1);
1881
+ rb_define_method(cOCSPSingleRes, "check_validity", ossl_ocspsres_check_validity, -1);
1882
+ rb_define_method(cOCSPSingleRes, "certid", ossl_ocspsres_get_certid, 0);
1883
+ rb_define_method(cOCSPSingleRes, "cert_status", ossl_ocspsres_get_cert_status, 0);
1884
+ rb_define_method(cOCSPSingleRes, "this_update", ossl_ocspsres_get_this_update, 0);
1885
+ rb_define_method(cOCSPSingleRes, "next_update", ossl_ocspsres_get_next_update, 0);
1886
+ rb_define_method(cOCSPSingleRes, "revocation_time", ossl_ocspsres_get_revocation_time, 0);
1887
+ rb_define_method(cOCSPSingleRes, "revocation_reason", ossl_ocspsres_get_revocation_reason, 0);
1888
+ rb_define_method(cOCSPSingleRes, "extensions", ossl_ocspsres_get_extensions, 0);
1889
+ rb_define_method(cOCSPSingleRes, "to_der", ossl_ocspsres_to_der, 0);
1890
+
1891
+ /*
1892
+ * An OpenSSL::OCSP::CertificateId identifies a certificate to the CA so
1893
+ * that a status check can be performed.
1894
+ */
1895
+
1896
+ cOCSPCertId = rb_define_class_under(mOCSP, "CertificateId", rb_cObject);
1897
+ rb_define_alloc_func(cOCSPCertId, ossl_ocspcid_alloc);
1898
+ rb_define_copy_func(cOCSPCertId, ossl_ocspcid_initialize_copy);
1899
+ rb_define_method(cOCSPCertId, "initialize", ossl_ocspcid_initialize, -1);
1900
+ rb_define_method(cOCSPCertId, "cmp", ossl_ocspcid_cmp, 1);
1901
+ rb_define_method(cOCSPCertId, "cmp_issuer", ossl_ocspcid_cmp_issuer, 1);
1902
+ rb_define_method(cOCSPCertId, "serial", ossl_ocspcid_get_serial, 0);
1903
+ rb_define_method(cOCSPCertId, "issuer_name_hash", ossl_ocspcid_get_issuer_name_hash, 0);
1904
+ rb_define_method(cOCSPCertId, "issuer_key_hash", ossl_ocspcid_get_issuer_key_hash, 0);
1905
+ rb_define_method(cOCSPCertId, "hash_algorithm", ossl_ocspcid_get_hash_algorithm, 0);
1906
+ rb_define_method(cOCSPCertId, "to_der", ossl_ocspcid_to_der, 0);
1907
+
1908
+ /* Internal error in issuer */
1909
+ rb_define_const(mOCSP, "RESPONSE_STATUS_INTERNALERROR", INT2NUM(OCSP_RESPONSE_STATUS_INTERNALERROR));
1910
+
1911
+ /* Illegal confirmation request */
1912
+ rb_define_const(mOCSP, "RESPONSE_STATUS_MALFORMEDREQUEST", INT2NUM(OCSP_RESPONSE_STATUS_MALFORMEDREQUEST));
1913
+
1914
+ /* The certificate was revoked for an unknown reason */
1915
+ rb_define_const(mOCSP, "REVOKED_STATUS_NOSTATUS", INT2NUM(OCSP_REVOKED_STATUS_NOSTATUS));
1916
+
1917
+ /* You must sign the request and resubmit */
1918
+ rb_define_const(mOCSP, "RESPONSE_STATUS_SIGREQUIRED", INT2NUM(OCSP_RESPONSE_STATUS_SIGREQUIRED));
1919
+
1920
+ /* Response has valid confirmations */
1921
+ rb_define_const(mOCSP, "RESPONSE_STATUS_SUCCESSFUL", INT2NUM(OCSP_RESPONSE_STATUS_SUCCESSFUL));
1922
+
1923
+ /* Try again later */
1924
+ rb_define_const(mOCSP, "RESPONSE_STATUS_TRYLATER", INT2NUM(OCSP_RESPONSE_STATUS_TRYLATER));
1925
+
1926
+ /* The certificate subject's name or other information changed */
1927
+ rb_define_const(mOCSP, "REVOKED_STATUS_AFFILIATIONCHANGED", INT2NUM(OCSP_REVOKED_STATUS_AFFILIATIONCHANGED));
1928
+
1929
+ /* This CA certificate was revoked due to a key compromise */
1930
+ rb_define_const(mOCSP, "REVOKED_STATUS_CACOMPROMISE", INT2NUM(OCSP_REVOKED_STATUS_CACOMPROMISE));
1931
+
1932
+ /* The certificate is on hold */
1933
+ rb_define_const(mOCSP, "REVOKED_STATUS_CERTIFICATEHOLD", INT2NUM(OCSP_REVOKED_STATUS_CERTIFICATEHOLD));
1934
+
1935
+ /* The certificate is no longer needed */
1936
+ rb_define_const(mOCSP, "REVOKED_STATUS_CESSATIONOFOPERATION", INT2NUM(OCSP_REVOKED_STATUS_CESSATIONOFOPERATION));
1937
+
1938
+ /* The certificate was revoked due to a key compromise */
1939
+ rb_define_const(mOCSP, "REVOKED_STATUS_KEYCOMPROMISE", INT2NUM(OCSP_REVOKED_STATUS_KEYCOMPROMISE));
1940
+
1941
+ /* The certificate was previously on hold and should now be removed from
1942
+ * the CRL */
1943
+ rb_define_const(mOCSP, "REVOKED_STATUS_REMOVEFROMCRL", INT2NUM(OCSP_REVOKED_STATUS_REMOVEFROMCRL));
1944
+
1945
+ /* The certificate was superseded by a new certificate */
1946
+ rb_define_const(mOCSP, "REVOKED_STATUS_SUPERSEDED", INT2NUM(OCSP_REVOKED_STATUS_SUPERSEDED));
1947
+
1948
+ /* Your request is unauthorized. */
1949
+ rb_define_const(mOCSP, "RESPONSE_STATUS_UNAUTHORIZED", INT2NUM(OCSP_RESPONSE_STATUS_UNAUTHORIZED));
1950
+
1951
+ /* The certificate was revoked for an unspecified reason */
1952
+ rb_define_const(mOCSP, "REVOKED_STATUS_UNSPECIFIED", INT2NUM(OCSP_REVOKED_STATUS_UNSPECIFIED));
1953
+
1954
+ /* Do not include certificates in the response */
1955
+ rb_define_const(mOCSP, "NOCERTS", INT2NUM(OCSP_NOCERTS));
1956
+
1957
+ /* Do not search certificates contained in the response for a signer */
1958
+ rb_define_const(mOCSP, "NOINTERN", INT2NUM(OCSP_NOINTERN));
1959
+
1960
+ /* Do not check the signature on the response */
1961
+ rb_define_const(mOCSP, "NOSIGS", INT2NUM(OCSP_NOSIGS));
1962
+
1963
+ /* Do not verify the certificate chain on the response */
1964
+ rb_define_const(mOCSP, "NOCHAIN", INT2NUM(OCSP_NOCHAIN));
1965
+
1966
+ /* Do not verify the response at all */
1967
+ rb_define_const(mOCSP, "NOVERIFY", INT2NUM(OCSP_NOVERIFY));
1968
+
1969
+ /* Do not check trust */
1970
+ rb_define_const(mOCSP, "NOEXPLICIT", INT2NUM(OCSP_NOEXPLICIT));
1971
+
1972
+ /* (This flag is not used by OpenSSL 1.0.1g) */
1973
+ rb_define_const(mOCSP, "NOCASIGN", INT2NUM(OCSP_NOCASIGN));
1974
+
1975
+ /* (This flag is not used by OpenSSL 1.0.1g) */
1976
+ rb_define_const(mOCSP, "NODELEGATED", INT2NUM(OCSP_NODELEGATED));
1977
+
1978
+ /* Do not make additional signing certificate checks */
1979
+ rb_define_const(mOCSP, "NOCHECKS", INT2NUM(OCSP_NOCHECKS));
1980
+
1981
+ /* Do not verify additional certificates */
1982
+ rb_define_const(mOCSP, "TRUSTOTHER", INT2NUM(OCSP_TRUSTOTHER));
1983
+
1984
+ /* Identify the response by signing the certificate key ID */
1985
+ rb_define_const(mOCSP, "RESPID_KEY", INT2NUM(OCSP_RESPID_KEY));
1986
+
1987
+ /* Do not include producedAt time in response */
1988
+ rb_define_const(mOCSP, "NOTIME", INT2NUM(OCSP_NOTIME));
1989
+
1990
+ /* Indicates the certificate is not revoked but does not necessarily mean
1991
+ * the certificate was issued or that this response is within the
1992
+ * certificate's validity interval */
1993
+ rb_define_const(mOCSP, "V_CERTSTATUS_GOOD", INT2NUM(V_OCSP_CERTSTATUS_GOOD));
1994
+ /* Indicates the certificate has been revoked either permanently or
1995
+ * temporarily (on hold). */
1996
+ rb_define_const(mOCSP, "V_CERTSTATUS_REVOKED", INT2NUM(V_OCSP_CERTSTATUS_REVOKED));
1997
+
1998
+ /* Indicates the responder does not know about the certificate being
1999
+ * requested. */
2000
+ rb_define_const(mOCSP, "V_CERTSTATUS_UNKNOWN", INT2NUM(V_OCSP_CERTSTATUS_UNKNOWN));
2001
+
2002
+ /* The responder ID is based on the key name. */
2003
+ rb_define_const(mOCSP, "V_RESPID_NAME", INT2NUM(V_OCSP_RESPID_NAME));
2004
+
2005
+ /* The responder ID is based on the public key. */
2006
+ rb_define_const(mOCSP, "V_RESPID_KEY", INT2NUM(V_OCSP_RESPID_KEY));
2007
+ }
2008
+ #else
2009
+ void
2010
+ Init_ossl_ocsp(void)
2011
+ {
2012
+ }
2013
+ #endif