rho-tau-extensions 5.5.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +2 -0
- data/LICENSE +21 -0
- data/README.md +6 -0
- data/Rakefile +90 -0
- data/libs/crosswalk.rb +2 -0
- data/libs/crosswalk/crosswalk.rb +2 -0
- data/libs/crosswalk/ext.yml +21 -0
- data/libs/crosswalk/ext/Crosswalk.xml +27 -0
- data/libs/crosswalk/ext/build +19 -0
- data/libs/crosswalk/ext/build.bat +29 -0
- data/libs/crosswalk/ext/platform/android/AndroidManifest.xml +9 -0
- data/libs/crosswalk/ext/platform/android/Rakefile +141 -0
- data/libs/crosswalk/ext/platform/android/adds/lib/armeabi/libxwalkcore.so +0 -0
- data/libs/crosswalk/ext/platform/android/adds/lib/armeabi/libxwalkdummy.so +0 -0
- data/libs/crosswalk/ext/platform/android/adds/lib/x86/libxwalkcore.so +0 -0
- data/libs/crosswalk/ext/platform/android/adds/lib/x86/libxwalkdummy.so +0 -0
- data/libs/crosswalk/ext/platform/android/adds/lib/xwalk_core_library_java.jar +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/bubble.9.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/bubble_arrow_up.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/color_picker_advanced_select_handle.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/crosswalk.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/dropdown_popup_background_down.9.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/dropdown_popup_background_up.9.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/ic_menu_share_holo_light.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/ic_search.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/ic_warning.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/ondemand_overlay.9.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/verify_checkmark.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-ldpi/crosswalk.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-mdpi/crosswalk.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-v21/button_borderless_compat.xml +10 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-v21/button_compat.xml +9 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/bubble.9.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/bubble_arrow_up.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/color_picker_advanced_select_handle.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/crosswalk.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/dropdown_popup_background_down.9.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/dropdown_popup_background_up.9.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/ic_menu_share_holo_light.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/ic_search.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/ic_warning.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/ondemand_overlay.9.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/verify_checkmark.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xxhdpi/ic_menu_share_holo_light.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xxhdpi/ic_search.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xxhdpi/ic_warning.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xxhdpi/verify_checkmark.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xxxhdpi/ic_menu_share_holo_light.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xxxhdpi/ic_search.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xxxhdpi/ic_warning.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xxxhdpi/verify_checkmark.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/autofill_chip_inset.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/bubble.9.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/bubble_arrow_up.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/button_compat_shape.xml +9 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/color_button_background.xml +36 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/color_picker_advanced_select_handle.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/color_picker_border.xml +12 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/dropdown_label_color.xml +11 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/dropdown_popup_background.xml +13 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/dropdown_popup_background_down.9.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/dropdown_popup_background_up.9.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/ic_menu_share_holo_light.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/ic_search.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/ic_warning.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/launchscreen_bg.xml +19 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/ondemand_overlay.9.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/verify_checkmark.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout-land/date_time_picker_dialog.xml +42 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/autofill_keyboard_accessory_item.xml +40 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/autofill_suggestion_item.xml +18 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/color_picker_advanced_component.xml +46 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/color_picker_dialog_content.xml +51 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/color_picker_dialog_title.xml +41 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/date_time_suggestion.xml +35 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/dropdown_item.xml +58 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/multi_field_time_picker_dialog.xml +122 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/two_field_date_picker.xml +38 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/validation_message_bubble.xml +72 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout/autofill_keyboard_accessory_icon.xml +13 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout/autofill_keyboard_accessory_item.xml +17 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout/autofill_suggestion_item.xml +7 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout/color_picker_advanced_component.xml +30 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout/color_picker_dialog_content.xml +36 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout/color_picker_dialog_title.xml +25 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout/date_time_picker_dialog.xml +42 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout/date_time_suggestion.xml +16 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout/dropdown_item.xml +34 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout/multi_field_time_picker_dialog.xml +50 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout/two_field_date_picker.xml +26 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout/validation_message_bubble.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/menu/select_action_menu.xml +54 -0
- data/libs/crosswalk/ext/platform/android/adds/res/raw/contacts_api.js +206 -0
- data/libs/crosswalk/ext/platform/android/adds/res/raw/device_capabilities_api.js +231 -0
- data/libs/crosswalk/ext/platform/android/adds/res/raw/empty.wav +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/raw/icudtl.dat +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/raw/launch_screen_api.js +9 -0
- data/libs/crosswalk/ext/platform/android/adds/res/raw/messaging_api.js +359 -0
- data/libs/crosswalk/ext/platform/android/adds/res/raw/presentation_api.js +144 -0
- data/libs/crosswalk/ext/platform/android/adds/res/raw/wifidirect_api.js +227 -0
- data/libs/crosswalk/ext/platform/android/adds/res/raw/xwalk.pak +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-am/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-am/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-ar/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-ar/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-bg/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-bg/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-ca/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-ca/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-cs/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-cs/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-da/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-da/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-de/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-de/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-el/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-el/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-en-rGB/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-en-rGB/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-es-rUS/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-es-rUS/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-es/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-es/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-fa/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-fa/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-fi/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-fi/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-fr/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-fr/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-hi/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-hi/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-hr/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-hr/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-hu/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-hu/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-in/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-in/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-it/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-it/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-iw/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-iw/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-ja/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-ja/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-ko/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-ko/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-lt/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-lt/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-lv/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-lv/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-nb/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-nb/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-nl/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-nl/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-pl/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-pl/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-pt-rBR/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-pt-rBR/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-pt-rPT/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-pt-rPT/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-ro/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-ro/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-ru/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-ru/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-sk/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-sk/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-sl/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-sl/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-sr/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-sr/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-sv/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-sv/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-sw/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-sw/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-th/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-th/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-tl/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-tl/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-tr/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-tr/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-uk/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-uk/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-v14/theme.xml +16 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-v17/styles.xml +19 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-v17/ui_java_styles.xml +41 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-v21/styles.xml +14 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-v21/ui_java_styles.xml +14 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-vi/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-vi/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-zh-rCN/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-zh-rCN/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-zh-rTW/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-zh-rTW/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/android_xwalk_strings.xml +17 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/ui_java_attrs.xml +9 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/ui_java_dimens.xml +31 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/ui_java_strings.xml +16 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/ui_java_styles.xml +101 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_app_strings.xml +28 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_attrs.xml +11 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_colors.xml +13 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_core_internal_java_strings.xml +16 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_core_java_strings.xml +16 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_dimens.xml +11 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_resources_list.xml +7 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_styles.xml +40 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_values.xml +10 -0
- data/libs/crosswalk/ext/platform/android/ext_java.files +14 -0
- data/libs/crosswalk/ext/platform/android/ext_native.files +7 -0
- data/libs/crosswalk/ext/platform/android/jni/Crosswalk_impl.cpp +61 -0
- data/libs/crosswalk/ext/platform/android/src/com/rho/crosswalk/Crosswalk.java +14 -0
- data/libs/crosswalk/ext/platform/android/src/com/rho/crosswalk/CrosswalkFactory.java +18 -0
- data/libs/crosswalk/ext/platform/android/src/com/rho/crosswalk/CrosswalkSingleton.java +24 -0
- data/libs/crosswalk/ext/platform/android/src/com/tautechnologies/tau/crosswalk/CrosswalkExtension.java +16 -0
- data/libs/crosswalk/ext/platform/android/src/com/tautechnologies/tau/crosswalk/RhodesListener.java +18 -0
- data/libs/crosswalk/ext/platform/android/src/com/tautechnologies/tau/crosswalk/TauXWResourceClient.java +182 -0
- data/libs/crosswalk/ext/platform/android/src/com/tautechnologies/tau/crosswalk/TauXWUIClient.java +125 -0
- data/libs/crosswalk/ext/platform/android/src/com/tautechnologies/tau/crosswalk/TauXWalkWebView.java +368 -0
- data/libs/crosswalk/ext/platform/iphone/Crosswalk.xcodeproj/project.pbxproj +368 -0
- data/libs/crosswalk/ext/platform/iphone/Crosswalk_Prefix.pch +7 -0
- data/libs/crosswalk/ext/platform/iphone/Rakefile +73 -0
- data/libs/crosswalk/ext/platform/iphone/impl/Crosswalk.h +14 -0
- data/libs/crosswalk/ext/platform/iphone/impl/Crosswalk.m +24 -0
- data/libs/crosswalk/ext/platform/iphone/impl/CrosswalkFactorySingleton.m +16 -0
- data/libs/crosswalk/ext/platform/iphone/impl/CrosswalkSetup.m +9 -0
- data/libs/crosswalk/ext/platform/iphone/impl/CrosswalkSingleton.h +17 -0
- data/libs/crosswalk/ext/platform/iphone/impl/CrosswalkSingleton.m +23 -0
- data/libs/crosswalk/ext/platform/iphone/impl/readme.txt +7 -0
- data/libs/crosswalk/ext/platform/qt/Crosswalk.pro +66 -0
- data/libs/crosswalk/ext/platform/qt/Rakefile +35 -0
- data/libs/crosswalk/ext/platform/qt/src/Crosswalk_impl.cpp +77 -0
- data/libs/crosswalk/ext/platform/wm/Crosswalk.sln +52 -0
- data/libs/crosswalk/ext/platform/wm/Crosswalk.vcproj +714 -0
- data/libs/crosswalk/ext/platform/wm/Crosswalk.vsprops +15 -0
- data/libs/crosswalk/ext/platform/wm/src/Crosswalk_impl.cpp +77 -0
- data/libs/crosswalk/ext/platform/wp8/Crosswalk.props +18 -0
- data/libs/crosswalk/ext/platform/wp8/Crosswalk.vcxproj +170 -0
- data/libs/crosswalk/ext/platform/wp8/Crosswalk.vcxproj.filters +50 -0
- data/libs/crosswalk/ext/platform/wp8/CrosswalkImpl.csproj +119 -0
- data/libs/crosswalk/ext/platform/wp8/CrosswalkImpl.props +8 -0
- data/libs/crosswalk/ext/platform/wp8/CrosswalkImpl.targets +7 -0
- data/libs/crosswalk/ext/platform/wp8/CrosswalkLib.props +18 -0
- data/libs/crosswalk/ext/platform/wp8/CrosswalkLib.vcxproj +185 -0
- data/libs/crosswalk/ext/platform/wp8/CrosswalkLib.vcxproj.filters +58 -0
- data/libs/crosswalk/ext/platform/wp8/src/Crosswalk_impl.cpp +76 -0
- data/libs/crosswalk/ext/platform/wp8/src/Crosswalk_impl.cs +69 -0
- data/libs/crosswalk/ext/platform/wp8/src/Properties/AssemblyInfo.cs +37 -0
- data/libs/enterprise-barcode/ext.yml +13 -0
- data/libs/enterprise-barcode/ext/barcode.xml +2144 -0
- data/libs/enterprise-barcode/ext/build +17 -0
- data/libs/enterprise-barcode/ext/build.bat +29 -0
- data/libs/enterprise-barcode/ext/platform/android/AndroidManifest.xml +31 -0
- data/libs/enterprise-barcode/ext/platform/android/ZXing_Info/AUTHORS +58 -0
- data/libs/enterprise-barcode/ext/platform/android/ZXing_Info/CHANGES +266 -0
- data/libs/enterprise-barcode/ext/platform/android/ZXing_Info/COPYING +201 -0
- data/libs/enterprise-barcode/ext/platform/android/ZXing_Info/README +11 -0
- data/libs/enterprise-barcode/ext/platform/android/additional_files/res/drawable-hdpi/cancel_icon.png +0 -0
- data/libs/enterprise-barcode/ext/platform/android/additional_files/res/drawable-hdpi/ok_icon.png +0 -0
- data/libs/enterprise-barcode/ext/platform/android/additional_files/res/drawable-hdpi/retake_icon.png +0 -0
- data/libs/enterprise-barcode/ext/platform/android/additional_files/res/drawable/cancel_icon.png +0 -0
- data/libs/enterprise-barcode/ext/platform/android/additional_files/res/drawable/ok_icon.png +0 -0
- data/libs/enterprise-barcode/ext/platform/android/additional_files/res/drawable/retake_icon.png +0 -0
- data/libs/enterprise-barcode/ext/platform/android/additional_files/res/layout/capture.xml +122 -0
- data/libs/enterprise-barcode/ext/platform/android/additional_files/res/raw/beep.ogg +0 -0
- data/libs/enterprise-barcode/ext/platform/android/additional_files/res/values/attrs.xml +20 -0
- data/libs/enterprise-barcode/ext/platform/android/additional_files/res/values/colors.xml +42 -0
- data/libs/enterprise-barcode/ext/platform/android/additional_files/res/values/ids.xml +31 -0
- data/libs/enterprise-barcode/ext/platform/android/adds/lib/armeabi/liballbarcode.a +0 -0
- data/libs/enterprise-barcode/ext/platform/android/adds/lib/x86/liballbarcode.a +0 -0
- data/libs/enterprise-barcode/ext/platform/android/allbarcode.jar +0 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Barcode.xcodeproj/project.pbxproj +524 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Barcode_Prefix.pch +7 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeCallbackHelper.h +27 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeCallbackHelper.mm +231 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeViewController.h +95 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeViewController.m +1017 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeViewFactory.h +7 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeViewFactory.mm +58 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeViewFactoryRegister.mm +18 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeViewManager.h +16 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeViewManager.mm +32 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/ImageProvider.cpp +25 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/ImageProvider.h +15 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/ImageProvider.mm +159 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/barcode.m +123 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Rakefile +69 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/COPYING +27 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarCameraSimulator.h +45 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarCaptureReader.h +111 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarHelpController.h +60 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarImage.h +69 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarImageScanner.h +51 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarReaderController.h +142 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarReaderView.h +135 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarReaderViewController.h +130 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarSDK.h +34 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarSymbol.h +71 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar.h +1497 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Decoder.h +202 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Exception.h +187 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Image.h +321 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/ImageScanner.h +130 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Processor.h +223 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Scanner.h +162 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Symbol.h +528 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Video.h +170 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Window.h +136 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/LICENSE +504 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/README +59 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Resources/zbar-back.png +0 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Resources/zbar-help.html +88 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Resources/zbar-helpicons.png +0 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Resources/zbar-samples.png +0 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/libzbar.a +0 -0
- data/libs/enterprise-barcode/ext/platform/iphone/impl/Barcode.h +21 -0
- data/libs/enterprise-barcode/ext/platform/iphone/impl/Barcode.m +132 -0
- data/libs/enterprise-barcode/ext/platform/iphone/impl/BarcodeFactory.h +10 -0
- data/libs/enterprise-barcode/ext/platform/iphone/impl/BarcodeFactory.m +16 -0
- data/libs/enterprise-barcode/ext/platform/iphone/impl/BarcodeFactorySingleton.m +16 -0
- data/libs/enterprise-barcode/ext/platform/iphone/impl/BarcodeSetup.m +8 -0
- data/libs/enterprise-barcode/ext/platform/iphone/impl/BarcodeSingleton.h +17 -0
- data/libs/enterprise-barcode/ext/platform/iphone/impl/BarcodeSingleton.m +22 -0
- data/libs/enterprise-barcode/ext/platform/iphone/impl/readme.txt +7 -0
- data/libs/enterprise-barcode/ext/platform/wm/Barcode.sln +44 -0
- data/libs/enterprise-barcode/ext/platform/wm/Barcode.vcproj +836 -0
- data/libs/enterprise-barcode/ext/platform/wm/Barcode.vsprops +15 -0
- data/libs/enterprise-barcode/ext/platform/wm/readme.txt +0 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/Barcode_impl.cpp +376 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/DecodeNotifier.cpp +173 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/DecodeNotifier.h +149 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/EMDKInterfaceAbstraction.cpp +476 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/GetDecoderProperties.cpp +1195 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/GetScannerProperties.cpp +553 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/KeyInjector.cpp +177 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/KeyInjector.h +40 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/NotificationLoader.cpp +76 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/NotificationLoader.h +44 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/RSM.cpp +1211 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/Scanner.cpp +2609 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/Scanner.h +1099 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/ScannerDefines.h +322 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/SetDecoderProperties.cpp +2106 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/SetScannerProperties.cpp +1060 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/Utilities.cpp +184 -0
- data/libs/enterprise-barcode/ext/platform/wp8/BarcodeImpl.csproj +119 -0
- data/libs/enterprise-barcode/ext/platform/wp8/BarcodeImpl.props +8 -0
- data/libs/enterprise-barcode/ext/platform/wp8/BarcodeImpl.targets +35 -0
- data/libs/enterprise-barcode/ext/platform/wp8/BarcodeLib.props +18 -0
- data/libs/enterprise-barcode/ext/platform/wp8/BarcodeLib.vcxproj +185 -0
- data/libs/enterprise-barcode/ext/platform/wp8/BarcodeLib.vcxproj.filters +58 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/ARM/Nokia.Graphics.Imaging.dll +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/ARM/Nokia.Graphics.Imaging.winmd +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/ARM/Nokia.Graphics.Imaging.xml +4813 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/ARM/Nokia.InteropServices.WindowsRuntime.dll +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/ARM/Nokia.InteropServices.WindowsRuntime.winmd +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/ARM/Nokia.InteropServices.WindowsRuntime.xml +41 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/ARM/OpticalReaderLib.dll +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/BarcodeReaderLib.XML +68 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/BarcodeReaderLib.dll +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/BarcodeReaderLib/BarcodeReaderLib.csproj +120 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/BarcodeReaderLib/BarcodeReaderLib.sln +34 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/BarcodeReaderLib/CameraNavigatePage.xaml +32 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/BarcodeReaderLib/CameraNavigatePage.xaml.cs +235 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/BarcodeReaderLib/OpticalReaderTask.cs +182 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/BarcodeReaderLib/Properties/AssemblyInfo.cs +37 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/Nokia.Graphics.Imaging.Managed.dll +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/Nokia.Graphics.Imaging.Managed.xml +341 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/x86/Nokia.Graphics.Imaging.dll +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/x86/Nokia.Graphics.Imaging.winmd +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/x86/Nokia.Graphics.Imaging.xml +4813 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/x86/Nokia.InteropServices.WindowsRuntime.dll +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/x86/Nokia.InteropServices.WindowsRuntime.winmd +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/x86/Nokia.InteropServices.WindowsRuntime.xml +41 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/x86/OpticalReaderLib.dll +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/zxing.wp8.0.XML +10324 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/zxing.wp8.0.dll +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/src/Barcode_impl.cs +630 -0
- data/libs/enterprise-barcode/ext/platform/wp8/src/Properties/AssemblyInfo.cs +37 -0
- data/libs/enterprise-barcode/public/api/generated/Rho.Barcode.js +772 -0
- data/libs/ie/rhobrowser.dll +0 -0
- data/libs/nodejs.rb +2 -0
- data/libs/nodejs/ext.yml +25 -0
- data/libs/nodejs/ext/Nodejs.xml +37 -0
- data/libs/nodejs/ext/build +19 -0
- data/libs/nodejs/ext/build.bat +29 -0
- data/libs/nodejs/ext/platform/android/Rakefile +161 -0
- data/libs/nodejs/ext/platform/android/ext_native.files +8 -0
- data/libs/nodejs/ext/platform/android/jxCore/jx.h +134 -0
- data/libs/nodejs/ext/platform/android/jxCore/jx_result.h +221 -0
- data/libs/nodejs/ext/platform/android/jxCore/libcares_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libcares_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libcares_x64.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libchrome_zlib_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libchrome_zlib_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libchrome_zlib_x64.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libhttp_parser_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libhttp_parser_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libhttp_parser_x64.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libjx_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libjx_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libjx_x64.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libopenssl_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libopenssl_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libopenssl_x64.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libsqlite3_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libsqlite3_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libsqlite3_x64.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libuv_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libuv_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libuv_x64.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libv8_base_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libv8_base_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libv8_base_x64.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libv8_nosnapshot_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libv8_nosnapshot_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libv8_nosnapshot_x64.a +0 -0
- data/libs/nodejs/ext/platform/iphone/Nodejs.xcodeproj/project.pbxproj +350 -0
- data/libs/nodejs/ext/platform/iphone/Nodejs_Prefix.pch +7 -0
- data/libs/nodejs/ext/platform/iphone/Rakefile +73 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/jx.h +134 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/jx_result.h +221 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/libcares.a +0 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/libchrome_zlib.a +0 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/libhttp_parser.a +0 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/libjx.a +0 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/libmozjs.a +0 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/libopenssl.a +0 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/libsqlite3.a +0 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/libuv.a +0 -0
- data/libs/nodejs/ext/shared/jxcore/jx.h +134 -0
- data/libs/nodejs/ext/shared/jxcore/jx_result.h +221 -0
- data/libs/nodejs/ext/shared/jxcoretau.cpp +454 -0
- data/libs/nodejs/ext/shared/jxcoretau.h +20 -0
- data/libs/nodejs/ext/shared/nodejs_impl.cpp +106 -0
- data/libs/nodejs/nodejs.rb +2 -0
- data/libs/openssl-edge.rb +2 -0
- data/libs/openssl-edge/ext.yml +4 -0
- data/libs/openssl-edge/ext/Rakefile +145 -0
- data/libs/openssl-edge/ext/android/Rakefile +107 -0
- data/libs/openssl-edge/ext/android/ext_native.files +32 -0
- data/libs/openssl-edge/ext/android/extconf.h +91 -0
- data/libs/openssl-edge/ext/build +12 -0
- data/libs/openssl-edge/ext/build.bat +5 -0
- data/libs/openssl-edge/ext/extconf.rb +141 -0
- data/libs/openssl-edge/ext/openssl.pro +109 -0
- data/libs/openssl-edge/ext/openssl.sln +52 -0
- data/libs/openssl-edge/ext/openssl.vcproj +1010 -0
- data/libs/openssl-edge/ext/openssl_missing.c +1163 -0
- data/libs/openssl-edge/ext/openssl_missing.h +537 -0
- data/libs/openssl-edge/ext/ossl.c +1203 -0
- data/libs/openssl-edge/ext/ossl.h +242 -0
- data/libs/openssl-edge/ext/ossl_asn1.c +2008 -0
- data/libs/openssl-edge/ext/ossl_asn1.h +66 -0
- data/libs/openssl-edge/ext/ossl_bio.c +118 -0
- data/libs/openssl-edge/ext/ossl_bio.h +19 -0
- data/libs/openssl-edge/ext/ossl_bn.c +1153 -0
- data/libs/openssl-edge/ext/ossl_bn.h +23 -0
- data/libs/openssl-edge/ext/ossl_cipher.c +1085 -0
- data/libs/openssl-edge/ext/ossl_cipher.h +20 -0
- data/libs/openssl-edge/ext/ossl_config.c +89 -0
- data/libs/openssl-edge/ext/ossl_config.h +19 -0
- data/libs/openssl-edge/ext/ossl_digest.c +453 -0
- data/libs/openssl-edge/ext/ossl_digest.h +20 -0
- data/libs/openssl-edge/ext/ossl_engine.c +580 -0
- data/libs/openssl-edge/ext/ossl_engine.h +19 -0
- data/libs/openssl-edge/ext/ossl_hmac.c +398 -0
- data/libs/openssl-edge/ext/ossl_hmac.h +18 -0
- data/libs/openssl-edge/ext/ossl_ns_spki.c +406 -0
- data/libs/openssl-edge/ext/ossl_ns_spki.h +19 -0
- data/libs/openssl-edge/ext/ossl_ocsp.c +2013 -0
- data/libs/openssl-edge/ext/ossl_ocsp.h +23 -0
- data/libs/openssl-edge/ext/ossl_pkcs12.c +261 -0
- data/libs/openssl-edge/ext/ossl_pkcs12.h +13 -0
- data/libs/openssl-edge/ext/ossl_pkcs5.c +180 -0
- data/libs/openssl-edge/ext/ossl_pkcs5.h +6 -0
- data/libs/openssl-edge/ext/ossl_pkcs7.c +1157 -0
- data/libs/openssl-edge/ext/ossl_pkcs7.h +20 -0
- data/libs/openssl-edge/ext/ossl_pkey.c +469 -0
- data/libs/openssl-edge/ext/ossl_pkey.h +245 -0
- data/libs/openssl-edge/ext/ossl_pkey_dh.c +650 -0
- data/libs/openssl-edge/ext/ossl_pkey_dsa.c +672 -0
- data/libs/openssl-edge/ext/ossl_pkey_ec.c +1806 -0
- data/libs/openssl-edge/ext/ossl_pkey_rsa.c +768 -0
- data/libs/openssl-edge/ext/ossl_rand.c +238 -0
- data/libs/openssl-edge/ext/ossl_rand.h +18 -0
- data/libs/openssl-edge/ext/ossl_ssl.c +2724 -0
- data/libs/openssl-edge/ext/ossl_ssl.h +41 -0
- data/libs/openssl-edge/ext/ossl_ssl_session.c +352 -0
- data/libs/openssl-edge/ext/ossl_version.h +15 -0
- data/libs/openssl-edge/ext/ossl_x509.c +186 -0
- data/libs/openssl-edge/ext/ossl_x509.h +119 -0
- data/libs/openssl-edge/ext/ossl_x509attr.c +328 -0
- data/libs/openssl-edge/ext/ossl_x509cert.c +863 -0
- data/libs/openssl-edge/ext/ossl_x509crl.c +565 -0
- data/libs/openssl-edge/ext/ossl_x509ext.c +480 -0
- data/libs/openssl-edge/ext/ossl_x509name.c +547 -0
- data/libs/openssl-edge/ext/ossl_x509req.c +492 -0
- data/libs/openssl-edge/ext/ossl_x509revoked.c +279 -0
- data/libs/openssl-edge/ext/ossl_x509store.c +846 -0
- data/libs/openssl-edge/ext/ruby_missing.h +32 -0
- data/libs/openssl-edge/openssl-edge.rb +2 -0
- data/libs/openssl-edge/openssl.rb +24 -0
- data/libs/openssl-edge/openssl/bn.rb +35 -0
- data/libs/openssl-edge/openssl/buffering.rb +341 -0
- data/libs/openssl-edge/openssl/cipher.rb +65 -0
- data/libs/openssl-edge/openssl/digest.rb +61 -0
- data/libs/openssl-edge/openssl/ssl-internal.rb +180 -0
- data/libs/openssl-edge/openssl/ssl.rb +1 -0
- data/libs/openssl-edge/openssl/x509-internal.rb +153 -0
- data/libs/openssl-edge/openssl/x509.rb +1 -0
- data/libs/openssl.so-edge.rb +2 -0
- data/libs/openssl.so-edge/ext.yml +8 -0
- data/libs/openssl.so-edge/ext/Rakefile +140 -0
- data/libs/openssl.so-edge/ext/android/armeabi/libcrypto.a +0 -0
- data/libs/openssl.so-edge/ext/android/armeabi/libssl.a +0 -0
- data/libs/openssl.so-edge/ext/android/x86/libcrypto.a +0 -0
- data/libs/openssl.so-edge/ext/android/x86/libssl.a +0 -0
- data/libs/openssl.so-edge/ext/build +12 -0
- data/libs/openssl.so-edge/ext/build.bat +1 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/dh/dh_locl.h +56 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/dsa/dsa_locl.h +76 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/evp/evp_locl.h +66 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/hmac/hmac_lcl.h +33 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/asn1_int.h +94 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/async.h +14 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/bn_conf.h +28 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/bn_dh.h +17 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/bn_int.h +82 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/bn_srp.h +32 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/chacha.h +49 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/cryptlib.h +81 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/cryptlib_int.h +31 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/dso_conf.h +16 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/engine.h +20 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/err_int.h +17 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/evp_int.h +382 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/md32_common.h +383 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/objects.h +12 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/poly1305.h +19 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/rand.h +20 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/x509_int.h +267 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/ocsp/ocsp_lcl.h +216 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/rsa/rsa_locl.h +96 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/x509/x509_lcl.h +142 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/e_os.h +520 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/bio.h +26 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/comp.h +12 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/conf.h +32 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/constant_time_locl.h +185 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/dane.h +103 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/dso.h +216 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/err.h +15 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/numbers.h +68 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/o_dir.h +63 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/o_str.h +17 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/thread_once.h +42 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/__DECC_INCLUDE_EPILOGUE.H +16 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/__DECC_INCLUDE_PROLOGUE.H +20 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/aes.h +92 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/asn1.h +1096 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/asn1_mac.h +10 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/asn1t.h +924 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/async.h +98 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/bio.h +854 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/blowfish.h +61 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/bn.h +575 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/buffer.h +76 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/camellia.h +83 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/cast.h +53 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/cmac.h +41 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/cms.h +512 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/comp.h +72 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/conf.h +216 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/conf_api.h +40 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/crypto.h +463 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ct.h +518 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/des.h +174 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/dh.h +343 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/dsa.h +282 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/dtls1.h +56 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/e_os2.h +311 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ebcdic.h +33 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ec.h +1581 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ecdh.h +10 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ecdsa.h +10 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/engine.h +842 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/err.h +259 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/evp.h +1586 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/hmac.h +49 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/idea.h +64 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/kdf.h +75 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/lhash.h +204 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/md2.h +44 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/md4.h +51 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/md5.h +50 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/mdc2.h +42 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/modes.h +203 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/obj_mac.h +4577 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/objects.h +1097 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ocsp.h +409 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/opensslconf.h +169 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/opensslconf.h.in +141 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/opensslv.h +105 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ossl_typ.h +190 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/pem.h +501 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/pem2.h +20 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/pkcs12.h +282 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/pkcs7.h +404 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/rand.h +89 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/rc2.h +51 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/rc4.h +36 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/rc5.h +63 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ripemd.h +47 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/rsa.h +588 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/safestack.h +164 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/seed.h +98 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/sha.h +119 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/srp.h +131 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/srtp.h +50 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ssl.h +2527 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ssl2.h +24 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ssl3.h +307 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/stack.h +78 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/symhacks.h +52 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/tls1.h +972 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ts.h +643 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/txt_db.h +57 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ui.h +368 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/whrlpool.h +48 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/x509.h +1123 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/x509_vfy.h +539 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/x509v3.h +1005 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/ssl/packet_locl.h +555 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/ssl/record/record.h +240 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/ssl/record/record_locl.h +114 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/ssl/ssl_locl.h +2127 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/ssl/statem/statem.h +123 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/ssl/statem/statem_locl.h +124 -0
- data/libs/openssl.so-edge/openssl.so.rb +2 -0
- data/libs/webkit.rb +2 -0
- data/libs/webkit/ext.yml +4 -0
- data/libs/webkit/ext/build +12 -0
- data/libs/webkit/ext/build.bat +7 -0
- data/libs/webkit/ext/wm/Rakefile +61 -0
- data/libs/webkit/ext/wm/RhoMsgs.cpp +17 -0
- data/libs/webkit/ext/wm/RhoMsgs.h +14 -0
- data/libs/webkit/ext/wm/RhoWKBrowserEngine.cpp +736 -0
- data/libs/webkit/ext/wm/RhoWKBrowserEngine.h +105 -0
- data/libs/webkit/ext/wm/lib/npapi/rhobridge.dll +0 -0
- data/libs/webkit/ext/wm/lib/rhoengine_defs.h +80 -0
- data/libs/webkit/ext/wm/lib/rhowebkit.dll +0 -0
- data/libs/webkit/ext/wm/webkit.sln +36 -0
- data/libs/webkit/ext/wm/webkit.suo +0 -0
- data/libs/webkit/ext/wm/webkit.vcproj +800 -0
- data/libs/webkit/ext/wm/webkit.vsprops +20 -0
- data/libs/webkit/webkit.rb +2 -0
- data/rho-tau-extensions.gemspec +23 -0
- data/version +1 -0
- metadata +705 -0
@@ -0,0 +1,23 @@
|
|
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_BN_H_)
|
11
|
+
#define _OSSL_BN_H_
|
12
|
+
|
13
|
+
extern VALUE cBN;
|
14
|
+
extern VALUE eBNError;
|
15
|
+
|
16
|
+
extern BN_CTX *ossl_bn_ctx;
|
17
|
+
|
18
|
+
VALUE ossl_bn_new(const BIGNUM *);
|
19
|
+
BIGNUM *GetBNPtr(VALUE);
|
20
|
+
void Init_ossl_bn(void);
|
21
|
+
|
22
|
+
|
23
|
+
#endif /* _OSS_BN_H_ */
|
@@ -0,0 +1,1085 @@
|
|
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
|
+
#include "ossl.h"
|
11
|
+
|
12
|
+
#define NewCipher(klass) \
|
13
|
+
TypedData_Wrap_Struct((klass), &ossl_cipher_type, 0)
|
14
|
+
#define AllocCipher(obj, ctx) do { \
|
15
|
+
(ctx) = EVP_CIPHER_CTX_new(); \
|
16
|
+
if (!(ctx)) \
|
17
|
+
ossl_raise(rb_eRuntimeError, NULL); \
|
18
|
+
RTYPEDDATA_DATA(obj) = (ctx); \
|
19
|
+
} while (0)
|
20
|
+
#define GetCipherInit(obj, ctx) do { \
|
21
|
+
TypedData_Get_Struct((obj), EVP_CIPHER_CTX, &ossl_cipher_type, (ctx)); \
|
22
|
+
} while (0)
|
23
|
+
#define GetCipher(obj, ctx) do { \
|
24
|
+
GetCipherInit((obj), (ctx)); \
|
25
|
+
if (!(ctx)) { \
|
26
|
+
ossl_raise(rb_eRuntimeError, "Cipher not inititalized!"); \
|
27
|
+
} \
|
28
|
+
} while (0)
|
29
|
+
#define SafeGetCipher(obj, ctx) do { \
|
30
|
+
OSSL_Check_Kind((obj), cCipher); \
|
31
|
+
GetCipher((obj), (ctx)); \
|
32
|
+
} while (0)
|
33
|
+
|
34
|
+
/*
|
35
|
+
* Classes
|
36
|
+
*/
|
37
|
+
VALUE cCipher;
|
38
|
+
VALUE eCipherError;
|
39
|
+
static ID id_auth_tag_len;
|
40
|
+
|
41
|
+
static VALUE ossl_cipher_alloc(VALUE klass);
|
42
|
+
static void ossl_cipher_free(void *ptr);
|
43
|
+
|
44
|
+
static const rb_data_type_t ossl_cipher_type = {
|
45
|
+
"OpenSSL/Cipher",
|
46
|
+
{
|
47
|
+
0, ossl_cipher_free,
|
48
|
+
},
|
49
|
+
0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
|
50
|
+
};
|
51
|
+
|
52
|
+
/*
|
53
|
+
* PUBLIC
|
54
|
+
*/
|
55
|
+
const EVP_CIPHER *
|
56
|
+
GetCipherPtr(VALUE obj)
|
57
|
+
{
|
58
|
+
if (rb_obj_is_kind_of(obj, cCipher)) {
|
59
|
+
EVP_CIPHER_CTX *ctx;
|
60
|
+
|
61
|
+
GetCipher(obj, ctx);
|
62
|
+
|
63
|
+
return EVP_CIPHER_CTX_cipher(ctx);
|
64
|
+
}
|
65
|
+
else {
|
66
|
+
const EVP_CIPHER *cipher;
|
67
|
+
|
68
|
+
StringValueCStr(obj);
|
69
|
+
cipher = EVP_get_cipherbyname(RSTRING_PTR(obj));
|
70
|
+
if (!cipher)
|
71
|
+
ossl_raise(rb_eArgError,
|
72
|
+
"unsupported cipher algorithm: %"PRIsVALUE, obj);
|
73
|
+
|
74
|
+
return cipher;
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
VALUE
|
79
|
+
ossl_cipher_new(const EVP_CIPHER *cipher)
|
80
|
+
{
|
81
|
+
VALUE ret;
|
82
|
+
EVP_CIPHER_CTX *ctx;
|
83
|
+
|
84
|
+
ret = ossl_cipher_alloc(cCipher);
|
85
|
+
AllocCipher(ret, ctx);
|
86
|
+
if (EVP_CipherInit_ex(ctx, cipher, NULL, NULL, NULL, -1) != 1)
|
87
|
+
ossl_raise(eCipherError, NULL);
|
88
|
+
|
89
|
+
return ret;
|
90
|
+
}
|
91
|
+
|
92
|
+
/*
|
93
|
+
* PRIVATE
|
94
|
+
*/
|
95
|
+
static void
|
96
|
+
ossl_cipher_free(void *ptr)
|
97
|
+
{
|
98
|
+
EVP_CIPHER_CTX_free(ptr);
|
99
|
+
}
|
100
|
+
|
101
|
+
static VALUE
|
102
|
+
ossl_cipher_alloc(VALUE klass)
|
103
|
+
{
|
104
|
+
return NewCipher(klass);
|
105
|
+
}
|
106
|
+
|
107
|
+
/*
|
108
|
+
* call-seq:
|
109
|
+
* Cipher.new(string) -> cipher
|
110
|
+
*
|
111
|
+
* The string must contain a valid cipher name like "AES-128-CBC" or "3DES".
|
112
|
+
*
|
113
|
+
* A list of cipher names is available by calling OpenSSL::Cipher.ciphers.
|
114
|
+
*/
|
115
|
+
static VALUE
|
116
|
+
ossl_cipher_initialize(VALUE self, VALUE str)
|
117
|
+
{
|
118
|
+
EVP_CIPHER_CTX *ctx;
|
119
|
+
const EVP_CIPHER *cipher;
|
120
|
+
char *name;
|
121
|
+
unsigned char dummy_key[EVP_MAX_KEY_LENGTH] = { 0 };
|
122
|
+
|
123
|
+
name = StringValueCStr(str);
|
124
|
+
GetCipherInit(self, ctx);
|
125
|
+
if (ctx) {
|
126
|
+
ossl_raise(rb_eRuntimeError, "Cipher already inititalized!");
|
127
|
+
}
|
128
|
+
AllocCipher(self, ctx);
|
129
|
+
if (!(cipher = EVP_get_cipherbyname(name))) {
|
130
|
+
ossl_raise(rb_eRuntimeError, "unsupported cipher algorithm (%"PRIsVALUE")", str);
|
131
|
+
}
|
132
|
+
/*
|
133
|
+
* EVP_CipherInit_ex() allows to specify NULL to key and IV, however some
|
134
|
+
* ciphers don't handle well (OpenSSL's bug). [Bug #2768]
|
135
|
+
*
|
136
|
+
* The EVP which has EVP_CIPH_RAND_KEY flag (such as DES3) allows
|
137
|
+
* uninitialized key, but other EVPs (such as AES) does not allow it.
|
138
|
+
* Calling EVP_CipherUpdate() without initializing key causes SEGV so we
|
139
|
+
* set the data filled with "\0" as the key by default.
|
140
|
+
*/
|
141
|
+
if (EVP_CipherInit_ex(ctx, cipher, NULL, dummy_key, NULL, -1) != 1)
|
142
|
+
ossl_raise(eCipherError, NULL);
|
143
|
+
|
144
|
+
return self;
|
145
|
+
}
|
146
|
+
|
147
|
+
static VALUE
|
148
|
+
ossl_cipher_copy(VALUE self, VALUE other)
|
149
|
+
{
|
150
|
+
EVP_CIPHER_CTX *ctx1, *ctx2;
|
151
|
+
|
152
|
+
rb_check_frozen(self);
|
153
|
+
if (self == other) return self;
|
154
|
+
|
155
|
+
GetCipherInit(self, ctx1);
|
156
|
+
if (!ctx1) {
|
157
|
+
AllocCipher(self, ctx1);
|
158
|
+
}
|
159
|
+
SafeGetCipher(other, ctx2);
|
160
|
+
if (EVP_CIPHER_CTX_copy(ctx1, ctx2) != 1)
|
161
|
+
ossl_raise(eCipherError, NULL);
|
162
|
+
|
163
|
+
return self;
|
164
|
+
}
|
165
|
+
|
166
|
+
static void*
|
167
|
+
add_cipher_name_to_ary(const OBJ_NAME *name, VALUE ary)
|
168
|
+
{
|
169
|
+
rb_ary_push(ary, rb_str_new2(name->name));
|
170
|
+
return NULL;
|
171
|
+
}
|
172
|
+
|
173
|
+
/*
|
174
|
+
* call-seq:
|
175
|
+
* OpenSSL::Cipher.ciphers -> array[string...]
|
176
|
+
*
|
177
|
+
* Returns the names of all available ciphers in an array.
|
178
|
+
*/
|
179
|
+
static VALUE
|
180
|
+
ossl_s_ciphers(VALUE self)
|
181
|
+
{
|
182
|
+
VALUE ary;
|
183
|
+
|
184
|
+
ary = rb_ary_new();
|
185
|
+
OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH,
|
186
|
+
(void(*)(const OBJ_NAME*,void*))add_cipher_name_to_ary,
|
187
|
+
(void*)ary);
|
188
|
+
|
189
|
+
return ary;
|
190
|
+
}
|
191
|
+
|
192
|
+
/*
|
193
|
+
* call-seq:
|
194
|
+
* cipher.reset -> self
|
195
|
+
*
|
196
|
+
* Fully resets the internal state of the Cipher. By using this, the same
|
197
|
+
* Cipher instance may be used several times for encryption or decryption tasks.
|
198
|
+
*
|
199
|
+
* Internally calls EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, -1).
|
200
|
+
*/
|
201
|
+
static VALUE
|
202
|
+
ossl_cipher_reset(VALUE self)
|
203
|
+
{
|
204
|
+
EVP_CIPHER_CTX *ctx;
|
205
|
+
|
206
|
+
GetCipher(self, ctx);
|
207
|
+
if (EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, -1) != 1)
|
208
|
+
ossl_raise(eCipherError, NULL);
|
209
|
+
|
210
|
+
return self;
|
211
|
+
}
|
212
|
+
|
213
|
+
static VALUE
|
214
|
+
ossl_cipher_init(int argc, VALUE *argv, VALUE self, int mode)
|
215
|
+
{
|
216
|
+
EVP_CIPHER_CTX *ctx;
|
217
|
+
unsigned char key[EVP_MAX_KEY_LENGTH], *p_key = NULL;
|
218
|
+
unsigned char iv[EVP_MAX_IV_LENGTH], *p_iv = NULL;
|
219
|
+
VALUE pass, init_v;
|
220
|
+
|
221
|
+
if(rb_scan_args(argc, argv, "02", &pass, &init_v) > 0){
|
222
|
+
/*
|
223
|
+
* oops. this code mistakes salt for IV.
|
224
|
+
* We deprecated the arguments for this method, but we decided
|
225
|
+
* keeping this behaviour for backward compatibility.
|
226
|
+
*/
|
227
|
+
VALUE cname = rb_class_path(rb_obj_class(self));
|
228
|
+
rb_warn("arguments for %"PRIsVALUE"#encrypt and %"PRIsVALUE"#decrypt were deprecated; "
|
229
|
+
"use %"PRIsVALUE"#pkcs5_keyivgen to derive key and IV",
|
230
|
+
cname, cname, cname);
|
231
|
+
StringValue(pass);
|
232
|
+
GetCipher(self, ctx);
|
233
|
+
if (NIL_P(init_v)) memcpy(iv, "OpenSSL for Ruby rulez!", sizeof(iv));
|
234
|
+
else{
|
235
|
+
StringValue(init_v);
|
236
|
+
if (EVP_MAX_IV_LENGTH > RSTRING_LEN(init_v)) {
|
237
|
+
memset(iv, 0, EVP_MAX_IV_LENGTH);
|
238
|
+
memcpy(iv, RSTRING_PTR(init_v), RSTRING_LEN(init_v));
|
239
|
+
}
|
240
|
+
else memcpy(iv, RSTRING_PTR(init_v), sizeof(iv));
|
241
|
+
}
|
242
|
+
EVP_BytesToKey(EVP_CIPHER_CTX_cipher(ctx), EVP_md5(), iv,
|
243
|
+
(unsigned char *)RSTRING_PTR(pass), RSTRING_LENINT(pass), 1, key, NULL);
|
244
|
+
p_key = key;
|
245
|
+
p_iv = iv;
|
246
|
+
}
|
247
|
+
else {
|
248
|
+
GetCipher(self, ctx);
|
249
|
+
}
|
250
|
+
if (EVP_CipherInit_ex(ctx, NULL, NULL, p_key, p_iv, mode) != 1) {
|
251
|
+
ossl_raise(eCipherError, NULL);
|
252
|
+
}
|
253
|
+
|
254
|
+
return self;
|
255
|
+
}
|
256
|
+
|
257
|
+
/*
|
258
|
+
* call-seq:
|
259
|
+
* cipher.encrypt -> self
|
260
|
+
*
|
261
|
+
* Initializes the Cipher for encryption.
|
262
|
+
*
|
263
|
+
* Make sure to call Cipher#encrypt or Cipher#decrypt before using any of the
|
264
|
+
* following methods:
|
265
|
+
* * [#key=, #iv=, #random_key, #random_iv, #pkcs5_keyivgen]
|
266
|
+
*
|
267
|
+
* Internally calls EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, 1).
|
268
|
+
*/
|
269
|
+
static VALUE
|
270
|
+
ossl_cipher_encrypt(int argc, VALUE *argv, VALUE self)
|
271
|
+
{
|
272
|
+
return ossl_cipher_init(argc, argv, self, 1);
|
273
|
+
}
|
274
|
+
|
275
|
+
/*
|
276
|
+
* call-seq:
|
277
|
+
* cipher.decrypt -> self
|
278
|
+
*
|
279
|
+
* Initializes the Cipher for decryption.
|
280
|
+
*
|
281
|
+
* Make sure to call Cipher#encrypt or Cipher#decrypt before using any of the
|
282
|
+
* following methods:
|
283
|
+
* * [#key=, #iv=, #random_key, #random_iv, #pkcs5_keyivgen]
|
284
|
+
*
|
285
|
+
* Internally calls EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, 0).
|
286
|
+
*/
|
287
|
+
static VALUE
|
288
|
+
ossl_cipher_decrypt(int argc, VALUE *argv, VALUE self)
|
289
|
+
{
|
290
|
+
return ossl_cipher_init(argc, argv, self, 0);
|
291
|
+
}
|
292
|
+
|
293
|
+
/*
|
294
|
+
* call-seq:
|
295
|
+
* cipher.pkcs5_keyivgen(pass, salt = nil, iterations = 2048, digest = "MD5") -> nil
|
296
|
+
*
|
297
|
+
* Generates and sets the key/IV based on a password.
|
298
|
+
*
|
299
|
+
* *WARNING*: This method is only PKCS5 v1.5 compliant when using RC2, RC4-40,
|
300
|
+
* or DES with MD5 or SHA1. Using anything else (like AES) will generate the
|
301
|
+
* key/iv using an OpenSSL specific method. This method is deprecated and
|
302
|
+
* should no longer be used. Use a PKCS5 v2 key generation method from
|
303
|
+
* OpenSSL::PKCS5 instead.
|
304
|
+
*
|
305
|
+
* === Parameters
|
306
|
+
* * +salt+ must be an 8 byte string if provided.
|
307
|
+
* * +iterations+ is a integer with a default of 2048.
|
308
|
+
* * +digest+ is a Digest object that defaults to 'MD5'
|
309
|
+
*
|
310
|
+
* A minimum of 1000 iterations is recommended.
|
311
|
+
*
|
312
|
+
*/
|
313
|
+
static VALUE
|
314
|
+
ossl_cipher_pkcs5_keyivgen(int argc, VALUE *argv, VALUE self)
|
315
|
+
{
|
316
|
+
EVP_CIPHER_CTX *ctx;
|
317
|
+
const EVP_MD *digest;
|
318
|
+
VALUE vpass, vsalt, viter, vdigest;
|
319
|
+
unsigned char key[EVP_MAX_KEY_LENGTH], iv[EVP_MAX_IV_LENGTH], *salt = NULL;
|
320
|
+
int iter;
|
321
|
+
|
322
|
+
rb_scan_args(argc, argv, "13", &vpass, &vsalt, &viter, &vdigest);
|
323
|
+
StringValue(vpass);
|
324
|
+
if(!NIL_P(vsalt)){
|
325
|
+
StringValue(vsalt);
|
326
|
+
if(RSTRING_LEN(vsalt) != PKCS5_SALT_LEN)
|
327
|
+
ossl_raise(eCipherError, "salt must be an 8-octet string");
|
328
|
+
salt = (unsigned char *)RSTRING_PTR(vsalt);
|
329
|
+
}
|
330
|
+
iter = NIL_P(viter) ? 2048 : NUM2INT(viter);
|
331
|
+
digest = NIL_P(vdigest) ? EVP_md5() : GetDigestPtr(vdigest);
|
332
|
+
GetCipher(self, ctx);
|
333
|
+
EVP_BytesToKey(EVP_CIPHER_CTX_cipher(ctx), digest, salt,
|
334
|
+
(unsigned char *)RSTRING_PTR(vpass), RSTRING_LENINT(vpass), iter, key, iv);
|
335
|
+
if (EVP_CipherInit_ex(ctx, NULL, NULL, key, iv, -1) != 1)
|
336
|
+
ossl_raise(eCipherError, NULL);
|
337
|
+
OPENSSL_cleanse(key, sizeof key);
|
338
|
+
OPENSSL_cleanse(iv, sizeof iv);
|
339
|
+
|
340
|
+
return Qnil;
|
341
|
+
}
|
342
|
+
|
343
|
+
static int
|
344
|
+
ossl_cipher_update_long(EVP_CIPHER_CTX *ctx, unsigned char *out, long *out_len_ptr,
|
345
|
+
const unsigned char *in, long in_len)
|
346
|
+
{
|
347
|
+
int out_part_len;
|
348
|
+
int limit = INT_MAX / 2 + 1;
|
349
|
+
long out_len = 0;
|
350
|
+
|
351
|
+
do {
|
352
|
+
int in_part_len = in_len > limit ? limit : (int)in_len;
|
353
|
+
|
354
|
+
if (!EVP_CipherUpdate(ctx, out ? (out + out_len) : 0,
|
355
|
+
&out_part_len, in, in_part_len))
|
356
|
+
return 0;
|
357
|
+
|
358
|
+
out_len += out_part_len;
|
359
|
+
in += in_part_len;
|
360
|
+
} while ((in_len -= limit) > 0);
|
361
|
+
|
362
|
+
if (out_len_ptr)
|
363
|
+
*out_len_ptr = out_len;
|
364
|
+
|
365
|
+
return 1;
|
366
|
+
}
|
367
|
+
|
368
|
+
/*
|
369
|
+
* call-seq:
|
370
|
+
* cipher.update(data [, buffer]) -> string or buffer
|
371
|
+
*
|
372
|
+
* Encrypts data in a streaming fashion. Hand consecutive blocks of data
|
373
|
+
* to the +update+ method in order to encrypt it. Returns the encrypted
|
374
|
+
* data chunk. When done, the output of Cipher#final should be additionally
|
375
|
+
* added to the result.
|
376
|
+
*
|
377
|
+
* If +buffer+ is given, the encryption/decryption result will be written to
|
378
|
+
* it. +buffer+ will be resized automatically.
|
379
|
+
*/
|
380
|
+
static VALUE
|
381
|
+
ossl_cipher_update(int argc, VALUE *argv, VALUE self)
|
382
|
+
{
|
383
|
+
EVP_CIPHER_CTX *ctx;
|
384
|
+
unsigned char *in;
|
385
|
+
long in_len, out_len;
|
386
|
+
VALUE data, str;
|
387
|
+
|
388
|
+
rb_scan_args(argc, argv, "11", &data, &str);
|
389
|
+
|
390
|
+
StringValue(data);
|
391
|
+
in = (unsigned char *)RSTRING_PTR(data);
|
392
|
+
if ((in_len = RSTRING_LEN(data)) == 0)
|
393
|
+
ossl_raise(rb_eArgError, "data must not be empty");
|
394
|
+
GetCipher(self, ctx);
|
395
|
+
out_len = in_len+EVP_CIPHER_CTX_block_size(ctx);
|
396
|
+
if (out_len <= 0) {
|
397
|
+
ossl_raise(rb_eRangeError,
|
398
|
+
"data too big to make output buffer: %ld bytes", in_len);
|
399
|
+
}
|
400
|
+
|
401
|
+
if (NIL_P(str)) {
|
402
|
+
str = rb_str_new(0, out_len);
|
403
|
+
} else {
|
404
|
+
StringValue(str);
|
405
|
+
rb_str_resize(str, out_len);
|
406
|
+
}
|
407
|
+
|
408
|
+
if (!ossl_cipher_update_long(ctx, (unsigned char *)RSTRING_PTR(str), &out_len, in, in_len))
|
409
|
+
ossl_raise(eCipherError, NULL);
|
410
|
+
assert(out_len < RSTRING_LEN(str));
|
411
|
+
rb_str_set_len(str, out_len);
|
412
|
+
|
413
|
+
return str;
|
414
|
+
}
|
415
|
+
|
416
|
+
/*
|
417
|
+
* call-seq:
|
418
|
+
* cipher.final -> string
|
419
|
+
*
|
420
|
+
* Returns the remaining data held in the cipher object. Further calls to
|
421
|
+
* Cipher#update or Cipher#final will return garbage. This call should always
|
422
|
+
* be made as the last call of an encryption or decryption operation, after
|
423
|
+
* after having fed the entire plaintext or ciphertext to the Cipher instance.
|
424
|
+
*
|
425
|
+
* If an authenticated cipher was used, a CipherError is raised if the tag
|
426
|
+
* could not be authenticated successfully. Only call this method after
|
427
|
+
* setting the authentication tag and passing the entire contents of the
|
428
|
+
* ciphertext into the cipher.
|
429
|
+
*/
|
430
|
+
static VALUE
|
431
|
+
ossl_cipher_final(VALUE self)
|
432
|
+
{
|
433
|
+
EVP_CIPHER_CTX *ctx;
|
434
|
+
int out_len;
|
435
|
+
VALUE str;
|
436
|
+
|
437
|
+
GetCipher(self, ctx);
|
438
|
+
str = rb_str_new(0, EVP_CIPHER_CTX_block_size(ctx));
|
439
|
+
if (!EVP_CipherFinal_ex(ctx, (unsigned char *)RSTRING_PTR(str), &out_len))
|
440
|
+
ossl_raise(eCipherError, NULL);
|
441
|
+
assert(out_len <= RSTRING_LEN(str));
|
442
|
+
rb_str_set_len(str, out_len);
|
443
|
+
|
444
|
+
return str;
|
445
|
+
}
|
446
|
+
|
447
|
+
/*
|
448
|
+
* call-seq:
|
449
|
+
* cipher.name -> string
|
450
|
+
*
|
451
|
+
* Returns the name of the cipher which may differ slightly from the original
|
452
|
+
* name provided.
|
453
|
+
*/
|
454
|
+
static VALUE
|
455
|
+
ossl_cipher_name(VALUE self)
|
456
|
+
{
|
457
|
+
EVP_CIPHER_CTX *ctx;
|
458
|
+
|
459
|
+
GetCipher(self, ctx);
|
460
|
+
|
461
|
+
return rb_str_new2(EVP_CIPHER_name(EVP_CIPHER_CTX_cipher(ctx)));
|
462
|
+
}
|
463
|
+
|
464
|
+
/*
|
465
|
+
* call-seq:
|
466
|
+
* cipher.key = string -> string
|
467
|
+
*
|
468
|
+
* Sets the cipher key. To generate a key, you should either use a secure
|
469
|
+
* random byte string or, if the key is to be derived from a password, you
|
470
|
+
* should rely on PBKDF2 functionality provided by OpenSSL::PKCS5. To
|
471
|
+
* generate a secure random-based key, Cipher#random_key may be used.
|
472
|
+
*
|
473
|
+
* Only call this method after calling Cipher#encrypt or Cipher#decrypt.
|
474
|
+
*/
|
475
|
+
static VALUE
|
476
|
+
ossl_cipher_set_key(VALUE self, VALUE key)
|
477
|
+
{
|
478
|
+
EVP_CIPHER_CTX *ctx;
|
479
|
+
int key_len;
|
480
|
+
|
481
|
+
StringValue(key);
|
482
|
+
GetCipher(self, ctx);
|
483
|
+
|
484
|
+
key_len = EVP_CIPHER_CTX_key_length(ctx);
|
485
|
+
if (RSTRING_LEN(key) != key_len)
|
486
|
+
ossl_raise(rb_eArgError, "key must be %d bytes", key_len);
|
487
|
+
|
488
|
+
if (EVP_CipherInit_ex(ctx, NULL, NULL, (unsigned char *)RSTRING_PTR(key), NULL, -1) != 1)
|
489
|
+
ossl_raise(eCipherError, NULL);
|
490
|
+
|
491
|
+
return key;
|
492
|
+
}
|
493
|
+
|
494
|
+
/*
|
495
|
+
* call-seq:
|
496
|
+
* cipher.iv = string -> string
|
497
|
+
*
|
498
|
+
* Sets the cipher IV. Please note that since you should never be using ECB
|
499
|
+
* mode, an IV is always explicitly required and should be set prior to
|
500
|
+
* encryption. The IV itself can be safely transmitted in public, but it
|
501
|
+
* should be unpredictable to prevent certain kinds of attacks. You may use
|
502
|
+
* Cipher#random_iv to create a secure random IV.
|
503
|
+
*
|
504
|
+
* Only call this method after calling Cipher#encrypt or Cipher#decrypt.
|
505
|
+
*
|
506
|
+
* If not explicitly set, the OpenSSL default of an all-zeroes ("\\0") IV is
|
507
|
+
* used.
|
508
|
+
*/
|
509
|
+
static VALUE
|
510
|
+
ossl_cipher_set_iv(VALUE self, VALUE iv)
|
511
|
+
{
|
512
|
+
EVP_CIPHER_CTX *ctx;
|
513
|
+
int iv_len = 0;
|
514
|
+
|
515
|
+
StringValue(iv);
|
516
|
+
GetCipher(self, ctx);
|
517
|
+
|
518
|
+
#if defined(HAVE_AUTHENTICATED_ENCRYPTION)
|
519
|
+
if (EVP_CIPHER_CTX_flags(ctx) & EVP_CIPH_FLAG_AEAD_CIPHER)
|
520
|
+
iv_len = (int)(VALUE)EVP_CIPHER_CTX_get_app_data(ctx);
|
521
|
+
#endif
|
522
|
+
if (!iv_len)
|
523
|
+
iv_len = EVP_CIPHER_CTX_iv_length(ctx);
|
524
|
+
if (RSTRING_LEN(iv) != iv_len)
|
525
|
+
ossl_raise(rb_eArgError, "iv must be %d bytes", iv_len);
|
526
|
+
|
527
|
+
if (EVP_CipherInit_ex(ctx, NULL, NULL, NULL, (unsigned char *)RSTRING_PTR(iv), -1) != 1)
|
528
|
+
ossl_raise(eCipherError, NULL);
|
529
|
+
|
530
|
+
return iv;
|
531
|
+
}
|
532
|
+
|
533
|
+
#ifdef HAVE_AUTHENTICATED_ENCRYPTION
|
534
|
+
/*
|
535
|
+
* call-seq:
|
536
|
+
* cipher.auth_data = string -> string
|
537
|
+
*
|
538
|
+
* Sets the cipher's additional authenticated data. This field must be
|
539
|
+
* set when using AEAD cipher modes such as GCM or CCM. If no associated
|
540
|
+
* data shall be used, this method must *still* be called with a value of "".
|
541
|
+
* The contents of this field should be non-sensitive data which will be
|
542
|
+
* added to the ciphertext to generate the authentication tag which validates
|
543
|
+
* the contents of the ciphertext.
|
544
|
+
*
|
545
|
+
* The AAD must be set prior to encryption or decryption. In encryption mode,
|
546
|
+
* it must be set after calling Cipher#encrypt and setting Cipher#key= and
|
547
|
+
* Cipher#iv=. When decrypting, the authenticated data must be set after key,
|
548
|
+
* iv and especially *after* the authentication tag has been set. I.e. set it
|
549
|
+
* only after calling Cipher#decrypt, Cipher#key=, Cipher#iv= and
|
550
|
+
* Cipher#auth_tag= first.
|
551
|
+
*/
|
552
|
+
static VALUE
|
553
|
+
ossl_cipher_set_auth_data(VALUE self, VALUE data)
|
554
|
+
{
|
555
|
+
EVP_CIPHER_CTX *ctx;
|
556
|
+
unsigned char *in;
|
557
|
+
long in_len, out_len;
|
558
|
+
|
559
|
+
StringValue(data);
|
560
|
+
|
561
|
+
in = (unsigned char *) RSTRING_PTR(data);
|
562
|
+
in_len = RSTRING_LEN(data);
|
563
|
+
|
564
|
+
GetCipher(self, ctx);
|
565
|
+
|
566
|
+
if (!ossl_cipher_update_long(ctx, NULL, &out_len, in, in_len))
|
567
|
+
ossl_raise(eCipherError, "couldn't set additional authenticated data");
|
568
|
+
|
569
|
+
return data;
|
570
|
+
}
|
571
|
+
|
572
|
+
/*
|
573
|
+
* call-seq:
|
574
|
+
* cipher.auth_tag(tag_len = 16) -> String
|
575
|
+
*
|
576
|
+
* Gets the authentication tag generated by Authenticated Encryption Cipher
|
577
|
+
* modes (GCM for example). This tag may be stored along with the ciphertext,
|
578
|
+
* then set on the decryption cipher to authenticate the contents of the
|
579
|
+
* ciphertext against changes. If the optional integer parameter +tag_len+ is
|
580
|
+
* given, the returned tag will be +tag_len+ bytes long. If the parameter is
|
581
|
+
* omitted, the default length of 16 bytes or the length previously set by
|
582
|
+
* #auth_tag_len= will be used. For maximum security, the longest possible
|
583
|
+
* should be chosen.
|
584
|
+
*
|
585
|
+
* The tag may only be retrieved after calling Cipher#final.
|
586
|
+
*/
|
587
|
+
static VALUE
|
588
|
+
ossl_cipher_get_auth_tag(int argc, VALUE *argv, VALUE self)
|
589
|
+
{
|
590
|
+
VALUE vtag_len, ret;
|
591
|
+
EVP_CIPHER_CTX *ctx;
|
592
|
+
int tag_len = 16;
|
593
|
+
|
594
|
+
rb_scan_args(argc, argv, "01", &vtag_len);
|
595
|
+
if (NIL_P(vtag_len))
|
596
|
+
vtag_len = rb_attr_get(self, id_auth_tag_len);
|
597
|
+
if (!NIL_P(vtag_len))
|
598
|
+
tag_len = NUM2INT(vtag_len);
|
599
|
+
|
600
|
+
GetCipher(self, ctx);
|
601
|
+
|
602
|
+
if (!(EVP_CIPHER_CTX_flags(ctx) & EVP_CIPH_FLAG_AEAD_CIPHER))
|
603
|
+
ossl_raise(eCipherError, "authentication tag not supported by this cipher");
|
604
|
+
|
605
|
+
ret = rb_str_new(NULL, tag_len);
|
606
|
+
if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, tag_len, RSTRING_PTR(ret)))
|
607
|
+
ossl_raise(eCipherError, "retrieving the authentication tag failed");
|
608
|
+
|
609
|
+
return ret;
|
610
|
+
}
|
611
|
+
|
612
|
+
/*
|
613
|
+
* call-seq:
|
614
|
+
* cipher.auth_tag = string -> string
|
615
|
+
*
|
616
|
+
* Sets the authentication tag to verify the contents of the
|
617
|
+
* ciphertext. The tag must be set after calling Cipher#decrypt,
|
618
|
+
* Cipher#key= and Cipher#iv=, but before assigning the associated
|
619
|
+
* authenticated data using Cipher#auth_data= and of course, before
|
620
|
+
* decrypting any of the ciphertext. After all decryption is
|
621
|
+
* performed, the tag is verified automatically in the call to
|
622
|
+
* Cipher#final.
|
623
|
+
*
|
624
|
+
* For OCB mode, the tag length must be supplied with #auth_tag_len=
|
625
|
+
* beforehand.
|
626
|
+
*/
|
627
|
+
static VALUE
|
628
|
+
ossl_cipher_set_auth_tag(VALUE self, VALUE vtag)
|
629
|
+
{
|
630
|
+
EVP_CIPHER_CTX *ctx;
|
631
|
+
unsigned char *tag;
|
632
|
+
int tag_len;
|
633
|
+
|
634
|
+
StringValue(vtag);
|
635
|
+
tag = (unsigned char *) RSTRING_PTR(vtag);
|
636
|
+
tag_len = RSTRING_LENINT(vtag);
|
637
|
+
|
638
|
+
GetCipher(self, ctx);
|
639
|
+
if (!(EVP_CIPHER_CTX_flags(ctx) & EVP_CIPH_FLAG_AEAD_CIPHER))
|
640
|
+
ossl_raise(eCipherError, "authentication tag not supported by this cipher");
|
641
|
+
|
642
|
+
if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, tag_len, tag))
|
643
|
+
ossl_raise(eCipherError, "unable to set AEAD tag");
|
644
|
+
|
645
|
+
return vtag;
|
646
|
+
}
|
647
|
+
|
648
|
+
/*
|
649
|
+
* call-seq:
|
650
|
+
* cipher.auth_tag_len = Integer -> Integer
|
651
|
+
*
|
652
|
+
* Sets the length of the authentication tag to be generated or to be given for
|
653
|
+
* AEAD ciphers that requires it as in input parameter. Note that not all AEAD
|
654
|
+
* ciphers support this method.
|
655
|
+
*
|
656
|
+
* In OCB mode, the length must be supplied both when encrypting and when
|
657
|
+
* decrypting, and must be before specifying an IV.
|
658
|
+
*/
|
659
|
+
static VALUE
|
660
|
+
ossl_cipher_set_auth_tag_len(VALUE self, VALUE vlen)
|
661
|
+
{
|
662
|
+
int tag_len = NUM2INT(vlen);
|
663
|
+
EVP_CIPHER_CTX *ctx;
|
664
|
+
|
665
|
+
GetCipher(self, ctx);
|
666
|
+
if (!(EVP_CIPHER_CTX_flags(ctx) & EVP_CIPH_FLAG_AEAD_CIPHER))
|
667
|
+
ossl_raise(eCipherError, "AEAD not supported by this cipher");
|
668
|
+
|
669
|
+
if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, tag_len, NULL))
|
670
|
+
ossl_raise(eCipherError, "unable to set authentication tag length");
|
671
|
+
|
672
|
+
/* for #auth_tag */
|
673
|
+
rb_ivar_set(self, id_auth_tag_len, INT2NUM(tag_len));
|
674
|
+
|
675
|
+
return vlen;
|
676
|
+
}
|
677
|
+
|
678
|
+
/*
|
679
|
+
* call-seq:
|
680
|
+
* cipher.authenticated? -> boolean
|
681
|
+
*
|
682
|
+
* Indicated whether this Cipher instance uses an Authenticated Encryption
|
683
|
+
* mode.
|
684
|
+
*/
|
685
|
+
static VALUE
|
686
|
+
ossl_cipher_is_authenticated(VALUE self)
|
687
|
+
{
|
688
|
+
EVP_CIPHER_CTX *ctx;
|
689
|
+
|
690
|
+
GetCipher(self, ctx);
|
691
|
+
|
692
|
+
return (EVP_CIPHER_CTX_flags(ctx) & EVP_CIPH_FLAG_AEAD_CIPHER) ? Qtrue : Qfalse;
|
693
|
+
}
|
694
|
+
|
695
|
+
/*
|
696
|
+
* call-seq:
|
697
|
+
* cipher.iv_len = integer -> integer
|
698
|
+
*
|
699
|
+
* Sets the IV/nonce length of the Cipher. Normally block ciphers don't allow
|
700
|
+
* changing the IV length, but some make use of IV for 'nonce'. You may need
|
701
|
+
* this for interoperability with other applications.
|
702
|
+
*/
|
703
|
+
static VALUE
|
704
|
+
ossl_cipher_set_iv_length(VALUE self, VALUE iv_length)
|
705
|
+
{
|
706
|
+
int len = NUM2INT(iv_length);
|
707
|
+
EVP_CIPHER_CTX *ctx;
|
708
|
+
|
709
|
+
GetCipher(self, ctx);
|
710
|
+
if (!(EVP_CIPHER_CTX_flags(ctx) & EVP_CIPH_FLAG_AEAD_CIPHER))
|
711
|
+
ossl_raise(eCipherError, "cipher does not support AEAD");
|
712
|
+
|
713
|
+
if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, len, NULL))
|
714
|
+
ossl_raise(eCipherError, "unable to set IV length");
|
715
|
+
|
716
|
+
/*
|
717
|
+
* EVP_CIPHER_CTX_iv_length() returns the default length. So we need to save
|
718
|
+
* the length somewhere. Luckily currently we aren't using app_data.
|
719
|
+
*/
|
720
|
+
EVP_CIPHER_CTX_set_app_data(ctx, (void *)(VALUE)len);
|
721
|
+
|
722
|
+
return iv_length;
|
723
|
+
}
|
724
|
+
#else
|
725
|
+
#define ossl_cipher_set_auth_data rb_f_notimplement
|
726
|
+
#define ossl_cipher_get_auth_tag rb_f_notimplement
|
727
|
+
#define ossl_cipher_set_auth_tag rb_f_notimplement
|
728
|
+
#define ossl_cipher_set_auth_tag_len rb_f_notimplement
|
729
|
+
#define ossl_cipher_is_authenticated rb_f_notimplement
|
730
|
+
#define ossl_cipher_set_iv_length rb_f_notimplement
|
731
|
+
#endif
|
732
|
+
|
733
|
+
/*
|
734
|
+
* call-seq:
|
735
|
+
* cipher.key_len = integer -> integer
|
736
|
+
*
|
737
|
+
* Sets the key length of the cipher. If the cipher is a fixed length cipher
|
738
|
+
* then attempting to set the key length to any value other than the fixed
|
739
|
+
* value is an error.
|
740
|
+
*
|
741
|
+
* Under normal circumstances you do not need to call this method (and probably shouldn't).
|
742
|
+
*
|
743
|
+
* See EVP_CIPHER_CTX_set_key_length for further information.
|
744
|
+
*/
|
745
|
+
static VALUE
|
746
|
+
ossl_cipher_set_key_length(VALUE self, VALUE key_length)
|
747
|
+
{
|
748
|
+
int len = NUM2INT(key_length);
|
749
|
+
EVP_CIPHER_CTX *ctx;
|
750
|
+
|
751
|
+
GetCipher(self, ctx);
|
752
|
+
if (EVP_CIPHER_CTX_set_key_length(ctx, len) != 1)
|
753
|
+
ossl_raise(eCipherError, NULL);
|
754
|
+
|
755
|
+
return key_length;
|
756
|
+
}
|
757
|
+
|
758
|
+
/*
|
759
|
+
* call-seq:
|
760
|
+
* cipher.padding = integer -> integer
|
761
|
+
*
|
762
|
+
* Enables or disables padding. By default encryption operations are padded using standard block padding and the
|
763
|
+
* padding is checked and removed when decrypting. If the pad parameter is zero then no padding is performed, the
|
764
|
+
* total amount of data encrypted or decrypted must then be a multiple of the block size or an error will occur.
|
765
|
+
*
|
766
|
+
* See EVP_CIPHER_CTX_set_padding for further information.
|
767
|
+
*/
|
768
|
+
static VALUE
|
769
|
+
ossl_cipher_set_padding(VALUE self, VALUE padding)
|
770
|
+
{
|
771
|
+
EVP_CIPHER_CTX *ctx;
|
772
|
+
int pad = NUM2INT(padding);
|
773
|
+
|
774
|
+
GetCipher(self, ctx);
|
775
|
+
if (EVP_CIPHER_CTX_set_padding(ctx, pad) != 1)
|
776
|
+
ossl_raise(eCipherError, NULL);
|
777
|
+
return padding;
|
778
|
+
}
|
779
|
+
|
780
|
+
/*
|
781
|
+
* call-seq:
|
782
|
+
* cipher.key_len -> integer
|
783
|
+
*
|
784
|
+
* Returns the key length in bytes of the Cipher.
|
785
|
+
*/
|
786
|
+
static VALUE
|
787
|
+
ossl_cipher_key_length(VALUE self)
|
788
|
+
{
|
789
|
+
EVP_CIPHER_CTX *ctx;
|
790
|
+
|
791
|
+
GetCipher(self, ctx);
|
792
|
+
|
793
|
+
return INT2NUM(EVP_CIPHER_CTX_key_length(ctx));
|
794
|
+
}
|
795
|
+
|
796
|
+
/*
|
797
|
+
* call-seq:
|
798
|
+
* cipher.iv_len -> integer
|
799
|
+
*
|
800
|
+
* Returns the expected length in bytes for an IV for this Cipher.
|
801
|
+
*/
|
802
|
+
static VALUE
|
803
|
+
ossl_cipher_iv_length(VALUE self)
|
804
|
+
{
|
805
|
+
EVP_CIPHER_CTX *ctx;
|
806
|
+
int len = 0;
|
807
|
+
|
808
|
+
GetCipher(self, ctx);
|
809
|
+
#if defined(HAVE_AUTHENTICATED_ENCRYPTION)
|
810
|
+
if (EVP_CIPHER_CTX_flags(ctx) & EVP_CIPH_FLAG_AEAD_CIPHER)
|
811
|
+
len = (int)(VALUE)EVP_CIPHER_CTX_get_app_data(ctx);
|
812
|
+
#endif
|
813
|
+
if (!len)
|
814
|
+
len = EVP_CIPHER_CTX_iv_length(ctx);
|
815
|
+
|
816
|
+
return INT2NUM(len);
|
817
|
+
}
|
818
|
+
|
819
|
+
/*
|
820
|
+
* call-seq:
|
821
|
+
* cipher.block_size -> integer
|
822
|
+
*
|
823
|
+
* Returns the size in bytes of the blocks on which this Cipher operates on.
|
824
|
+
*/
|
825
|
+
static VALUE
|
826
|
+
ossl_cipher_block_size(VALUE self)
|
827
|
+
{
|
828
|
+
EVP_CIPHER_CTX *ctx;
|
829
|
+
|
830
|
+
GetCipher(self, ctx);
|
831
|
+
|
832
|
+
return INT2NUM(EVP_CIPHER_CTX_block_size(ctx));
|
833
|
+
}
|
834
|
+
|
835
|
+
/*
|
836
|
+
* INIT
|
837
|
+
*/
|
838
|
+
void
|
839
|
+
Init_ossl_cipher(void)
|
840
|
+
{
|
841
|
+
#if 0
|
842
|
+
mOSSL = rb_define_module("OpenSSL");
|
843
|
+
eOSSLError = rb_define_class_under(mOSSL, "OpenSSLError", rb_eStandardError);
|
844
|
+
#endif
|
845
|
+
|
846
|
+
/* Document-class: OpenSSL::Cipher
|
847
|
+
*
|
848
|
+
* Provides symmetric algorithms for encryption and decryption. The
|
849
|
+
* algorithms that are available depend on the particular version
|
850
|
+
* of OpenSSL that is installed.
|
851
|
+
*
|
852
|
+
* === Listing all supported algorithms
|
853
|
+
*
|
854
|
+
* A list of supported algorithms can be obtained by
|
855
|
+
*
|
856
|
+
* puts OpenSSL::Cipher.ciphers
|
857
|
+
*
|
858
|
+
* === Instantiating a Cipher
|
859
|
+
*
|
860
|
+
* There are several ways to create a Cipher instance. Generally, a
|
861
|
+
* Cipher algorithm is categorized by its name, the key length in bits
|
862
|
+
* and the cipher mode to be used. The most generic way to create a
|
863
|
+
* Cipher is the following
|
864
|
+
*
|
865
|
+
* cipher = OpenSSL::Cipher.new('<name>-<key length>-<mode>')
|
866
|
+
*
|
867
|
+
* That is, a string consisting of the hyphenated concatenation of the
|
868
|
+
* individual components name, key length and mode. Either all uppercase
|
869
|
+
* or all lowercase strings may be used, for example:
|
870
|
+
*
|
871
|
+
* cipher = OpenSSL::Cipher.new('AES-128-CBC')
|
872
|
+
*
|
873
|
+
* For each algorithm supported, there is a class defined under the
|
874
|
+
* Cipher class that goes by the name of the cipher, e.g. to obtain an
|
875
|
+
* instance of AES, you could also use
|
876
|
+
*
|
877
|
+
* # these are equivalent
|
878
|
+
* cipher = OpenSSL::Cipher::AES.new(128, :CBC)
|
879
|
+
* cipher = OpenSSL::Cipher::AES.new(128, 'CBC')
|
880
|
+
* cipher = OpenSSL::Cipher::AES.new('128-CBC')
|
881
|
+
*
|
882
|
+
* Finally, due to its wide-spread use, there are also extra classes
|
883
|
+
* defined for the different key sizes of AES
|
884
|
+
*
|
885
|
+
* cipher = OpenSSL::Cipher::AES128.new(:CBC)
|
886
|
+
* cipher = OpenSSL::Cipher::AES192.new(:CBC)
|
887
|
+
* cipher = OpenSSL::Cipher::AES256.new(:CBC)
|
888
|
+
*
|
889
|
+
* === Choosing either encryption or decryption mode
|
890
|
+
*
|
891
|
+
* Encryption and decryption are often very similar operations for
|
892
|
+
* symmetric algorithms, this is reflected by not having to choose
|
893
|
+
* different classes for either operation, both can be done using the
|
894
|
+
* same class. Still, after obtaining a Cipher instance, we need to
|
895
|
+
* tell the instance what it is that we intend to do with it, so we
|
896
|
+
* need to call either
|
897
|
+
*
|
898
|
+
* cipher.encrypt
|
899
|
+
*
|
900
|
+
* or
|
901
|
+
*
|
902
|
+
* cipher.decrypt
|
903
|
+
*
|
904
|
+
* on the Cipher instance. This should be the first call after creating
|
905
|
+
* the instance, otherwise configuration that has already been set could
|
906
|
+
* get lost in the process.
|
907
|
+
*
|
908
|
+
* === Choosing a key
|
909
|
+
*
|
910
|
+
* Symmetric encryption requires a key that is the same for the encrypting
|
911
|
+
* and for the decrypting party and after initial key establishment should
|
912
|
+
* be kept as private information. There are a lot of ways to create
|
913
|
+
* insecure keys, the most notable is to simply take a password as the key
|
914
|
+
* without processing the password further. A simple and secure way to
|
915
|
+
* create a key for a particular Cipher is
|
916
|
+
*
|
917
|
+
* cipher = OpenSSL::AES256.new(:CFB)
|
918
|
+
* cipher.encrypt
|
919
|
+
* key = cipher.random_key # also sets the generated key on the Cipher
|
920
|
+
*
|
921
|
+
* If you absolutely need to use passwords as encryption keys, you
|
922
|
+
* should use Password-Based Key Derivation Function 2 (PBKDF2) by
|
923
|
+
* generating the key with the help of the functionality provided by
|
924
|
+
* OpenSSL::PKCS5.pbkdf2_hmac_sha1 or OpenSSL::PKCS5.pbkdf2_hmac.
|
925
|
+
*
|
926
|
+
* Although there is Cipher#pkcs5_keyivgen, its use is deprecated and
|
927
|
+
* it should only be used in legacy applications because it does not use
|
928
|
+
* the newer PKCS#5 v2 algorithms.
|
929
|
+
*
|
930
|
+
* === Choosing an IV
|
931
|
+
*
|
932
|
+
* The cipher modes CBC, CFB, OFB and CTR all need an "initialization
|
933
|
+
* vector", or short, IV. ECB mode is the only mode that does not require
|
934
|
+
* an IV, but there is almost no legitimate use case for this mode
|
935
|
+
* because of the fact that it does not sufficiently hide plaintext
|
936
|
+
* patterns. Therefore
|
937
|
+
*
|
938
|
+
* <b>You should never use ECB mode unless you are absolutely sure that
|
939
|
+
* you absolutely need it</b>
|
940
|
+
*
|
941
|
+
* Because of this, you will end up with a mode that explicitly requires
|
942
|
+
* an IV in any case. Note that for backwards compatibility reasons,
|
943
|
+
* setting an IV is not explicitly mandated by the Cipher API. If not
|
944
|
+
* set, OpenSSL itself defaults to an all-zeroes IV ("\\0", not the
|
945
|
+
* character). Although the IV can be seen as public information, i.e.
|
946
|
+
* it may be transmitted in public once generated, it should still stay
|
947
|
+
* unpredictable to prevent certain kinds of attacks. Therefore, ideally
|
948
|
+
*
|
949
|
+
* <b>Always create a secure random IV for every encryption of your
|
950
|
+
* Cipher</b>
|
951
|
+
*
|
952
|
+
* A new, random IV should be created for every encryption of data. Think
|
953
|
+
* of the IV as a nonce (number used once) - it's public but random and
|
954
|
+
* unpredictable. A secure random IV can be created as follows
|
955
|
+
*
|
956
|
+
* cipher = ...
|
957
|
+
* cipher.encrypt
|
958
|
+
* key = cipher.random_key
|
959
|
+
* iv = cipher.random_iv # also sets the generated IV on the Cipher
|
960
|
+
*
|
961
|
+
* Although the key is generally a random value, too, it is a bad choice
|
962
|
+
* as an IV. There are elaborate ways how an attacker can take advantage
|
963
|
+
* of such an IV. As a general rule of thumb, exposing the key directly
|
964
|
+
* or indirectly should be avoided at all cost and exceptions only be
|
965
|
+
* made with good reason.
|
966
|
+
*
|
967
|
+
* === Calling Cipher#final
|
968
|
+
*
|
969
|
+
* ECB (which should not be used) and CBC are both block-based modes.
|
970
|
+
* This means that unlike for the other streaming-based modes, they
|
971
|
+
* operate on fixed-size blocks of data, and therefore they require a
|
972
|
+
* "finalization" step to produce or correctly decrypt the last block of
|
973
|
+
* data by appropriately handling some form of padding. Therefore it is
|
974
|
+
* essential to add the output of OpenSSL::Cipher#final to your
|
975
|
+
* encryption/decryption buffer or you will end up with decryption errors
|
976
|
+
* or truncated data.
|
977
|
+
*
|
978
|
+
* Although this is not really necessary for streaming-mode ciphers, it is
|
979
|
+
* still recommended to apply the same pattern of adding the output of
|
980
|
+
* Cipher#final there as well - it also enables you to switch between
|
981
|
+
* modes more easily in the future.
|
982
|
+
*
|
983
|
+
* === Encrypting and decrypting some data
|
984
|
+
*
|
985
|
+
* data = "Very, very confidential data"
|
986
|
+
*
|
987
|
+
* cipher = OpenSSL::Cipher::AES.new(128, :CBC)
|
988
|
+
* cipher.encrypt
|
989
|
+
* key = cipher.random_key
|
990
|
+
* iv = cipher.random_iv
|
991
|
+
*
|
992
|
+
* encrypted = cipher.update(data) + cipher.final
|
993
|
+
* ...
|
994
|
+
* decipher = OpenSSL::Cipher::AES.new(128, :CBC)
|
995
|
+
* decipher.decrypt
|
996
|
+
* decipher.key = key
|
997
|
+
* decipher.iv = iv
|
998
|
+
*
|
999
|
+
* plain = decipher.update(encrypted) + decipher.final
|
1000
|
+
*
|
1001
|
+
* puts data == plain #=> true
|
1002
|
+
*
|
1003
|
+
* === Authenticated Encryption and Associated Data (AEAD)
|
1004
|
+
*
|
1005
|
+
* If the OpenSSL version used supports it, an Authenticated Encryption
|
1006
|
+
* mode (such as GCM or CCM) should always be preferred over any
|
1007
|
+
* unauthenticated mode. Currently, OpenSSL supports AE only in combination
|
1008
|
+
* with Associated Data (AEAD) where additional associated data is included
|
1009
|
+
* in the encryption process to compute a tag at the end of the encryption.
|
1010
|
+
* This tag will also be used in the decryption process and by verifying
|
1011
|
+
* its validity, the authenticity of a given ciphertext is established.
|
1012
|
+
*
|
1013
|
+
* This is superior to unauthenticated modes in that it allows to detect
|
1014
|
+
* if somebody effectively changed the ciphertext after it had been
|
1015
|
+
* encrypted. This prevents malicious modifications of the ciphertext that
|
1016
|
+
* could otherwise be exploited to modify ciphertexts in ways beneficial to
|
1017
|
+
* potential attackers.
|
1018
|
+
*
|
1019
|
+
* An associated data is used where there is additional information, such as
|
1020
|
+
* headers or some metadata, that must be also authenticated but not
|
1021
|
+
* necessarily need to be encrypted. If no associated data is needed for
|
1022
|
+
* encryption and later decryption, the OpenSSL library still requires a
|
1023
|
+
* value to be set - "" may be used in case none is available.
|
1024
|
+
*
|
1025
|
+
* An example using the GCM (Galois/Counter Mode). You have 16 bytes +key+,
|
1026
|
+
* 12 bytes (96 bits) +nonce+ and the associated data +auth_data+. Be sure
|
1027
|
+
* not to reuse the +key+ and +nonce+ pair. Reusing an nonce ruins the
|
1028
|
+
* security gurantees of GCM mode.
|
1029
|
+
*
|
1030
|
+
* cipher = OpenSSL::Cipher::AES.new(128, :GCM).encrypt
|
1031
|
+
* cipher.key = key
|
1032
|
+
* cipher.iv = nonce
|
1033
|
+
* cipher.auth_data = auth_data
|
1034
|
+
*
|
1035
|
+
* encrypted = cipher.update(data) + cipher.final
|
1036
|
+
* tag = cipher.auth_tag # produces 16 bytes tag by default
|
1037
|
+
*
|
1038
|
+
* Now you are the receiver. You know the +key+ and have received +nonce+,
|
1039
|
+
* +auth_data+, +encrypted+ and +tag+ through an untrusted network. Note
|
1040
|
+
* that GCM accepts an arbitrary length tag between 1 and 16 bytes. You may
|
1041
|
+
* additionally need to check that the received tag has the correct length,
|
1042
|
+
* or you allow attackers to forge a valid single byte tag for the tampered
|
1043
|
+
* ciphertext with a probability of 1/256.
|
1044
|
+
*
|
1045
|
+
* raise "tag is truncated!" unless tag.bytesize == 16
|
1046
|
+
* decipher = OpenSSL::Cipher::AES.new(128, :GCM).decrypt
|
1047
|
+
* decipher.key = key
|
1048
|
+
* decipher.iv = nonce
|
1049
|
+
* decipher.auth_tag = tag
|
1050
|
+
* decipher.auth_data = auth_data
|
1051
|
+
*
|
1052
|
+
* decrypted = decipher.update(encrypted) + decipher.final
|
1053
|
+
*
|
1054
|
+
* puts data == decrypted #=> true
|
1055
|
+
*/
|
1056
|
+
cCipher = rb_define_class_under(mOSSL, "Cipher", rb_cObject);
|
1057
|
+
eCipherError = rb_define_class_under(cCipher, "CipherError", eOSSLError);
|
1058
|
+
|
1059
|
+
rb_define_alloc_func(cCipher, ossl_cipher_alloc);
|
1060
|
+
rb_define_copy_func(cCipher, ossl_cipher_copy);
|
1061
|
+
rb_define_module_function(cCipher, "ciphers", ossl_s_ciphers, 0);
|
1062
|
+
rb_define_method(cCipher, "initialize", ossl_cipher_initialize, 1);
|
1063
|
+
rb_define_method(cCipher, "reset", ossl_cipher_reset, 0);
|
1064
|
+
rb_define_method(cCipher, "encrypt", ossl_cipher_encrypt, -1);
|
1065
|
+
rb_define_method(cCipher, "decrypt", ossl_cipher_decrypt, -1);
|
1066
|
+
rb_define_method(cCipher, "pkcs5_keyivgen", ossl_cipher_pkcs5_keyivgen, -1);
|
1067
|
+
rb_define_method(cCipher, "update", ossl_cipher_update, -1);
|
1068
|
+
rb_define_method(cCipher, "final", ossl_cipher_final, 0);
|
1069
|
+
rb_define_method(cCipher, "name", ossl_cipher_name, 0);
|
1070
|
+
rb_define_method(cCipher, "key=", ossl_cipher_set_key, 1);
|
1071
|
+
rb_define_method(cCipher, "auth_data=", ossl_cipher_set_auth_data, 1);
|
1072
|
+
rb_define_method(cCipher, "auth_tag=", ossl_cipher_set_auth_tag, 1);
|
1073
|
+
rb_define_method(cCipher, "auth_tag", ossl_cipher_get_auth_tag, -1);
|
1074
|
+
rb_define_method(cCipher, "auth_tag_len=", ossl_cipher_set_auth_tag_len, 1);
|
1075
|
+
rb_define_method(cCipher, "authenticated?", ossl_cipher_is_authenticated, 0);
|
1076
|
+
rb_define_method(cCipher, "key_len=", ossl_cipher_set_key_length, 1);
|
1077
|
+
rb_define_method(cCipher, "key_len", ossl_cipher_key_length, 0);
|
1078
|
+
rb_define_method(cCipher, "iv=", ossl_cipher_set_iv, 1);
|
1079
|
+
rb_define_method(cCipher, "iv_len=", ossl_cipher_set_iv_length, 1);
|
1080
|
+
rb_define_method(cCipher, "iv_len", ossl_cipher_iv_length, 0);
|
1081
|
+
rb_define_method(cCipher, "block_size", ossl_cipher_block_size, 0);
|
1082
|
+
rb_define_method(cCipher, "padding=", ossl_cipher_set_padding, 1);
|
1083
|
+
|
1084
|
+
id_auth_tag_len = rb_intern_const("auth_tag_len");
|
1085
|
+
}
|