cifrado 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/.gitignore +18 -0
- data/CHANGELOG.md +44 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +247 -0
- data/RELEASE.md +10 -0
- data/Rakefile +21 -0
- data/TODO.md +6 -0
- data/bin/cifrado +7 -0
- data/cifrado.gemspec +31 -0
- data/gem-public_cert.pem +20 -0
- data/lib/cifrado.rb +48 -0
- data/lib/cifrado/cli.rb +140 -0
- data/lib/cifrado/cli/cinema.rb +81 -0
- data/lib/cifrado/cli/delete.rb +36 -0
- data/lib/cifrado/cli/download.rb +54 -0
- data/lib/cifrado/cli/jukebox.rb +94 -0
- data/lib/cifrado/cli/list.rb +64 -0
- data/lib/cifrado/cli/post.rb +10 -0
- data/lib/cifrado/cli/progressbar.rb +86 -0
- data/lib/cifrado/cli/saio.rb +11 -0
- data/lib/cifrado/cli/saio/base.rb +20 -0
- data/lib/cifrado/cli/saio/bootstrap.rb +118 -0
- data/lib/cifrado/cli/saio/destroy.rb +16 -0
- data/lib/cifrado/cli/saio/scripts/saio.sh.erb +445 -0
- data/lib/cifrado/cli/set_acl.rb +10 -0
- data/lib/cifrado/cli/setup.rb +64 -0
- data/lib/cifrado/cli/stat.rb +41 -0
- data/lib/cifrado/cli/upload.rb +269 -0
- data/lib/cifrado/config.rb +18 -0
- data/lib/cifrado/core_ext/ruby18_base64.rb +15 -0
- data/lib/cifrado/crypto_services.rb +218 -0
- data/lib/cifrado/file_splitter.rb +67 -0
- data/lib/cifrado/rate_limit.rb +23 -0
- data/lib/cifrado/streaming_downloader.rb +49 -0
- data/lib/cifrado/streaming_uploader.rb +57 -0
- data/lib/cifrado/swift_client.rb +313 -0
- data/lib/cifrado/utils.rb +59 -0
- data/lib/cifrado/version.rb +3 -0
- data/tests/cli/list_tests.rb +28 -0
- data/tests/cli/upload_multi_tests.rb +94 -0
- data/tests/cli/upload_tests.rb +167 -0
- data/tests/cli_tests.rb +2 -0
- data/tests/crypto_services_tests.rb +145 -0
- data/tests/file_splitter_tests.rb +61 -0
- data/tests/helper.rb +117 -0
- data/tests/swift_client/create_directory.rb +14 -0
- data/tests/swift_client/download_tests.rb +208 -0
- data/tests/swift_client/file_available.rb +25 -0
- data/tests/swift_client/head_tests.rb +34 -0
- data/tests/swift_client/match_tests.rb +29 -0
- data/tests/swift_client/upload_tests.rb +70 -0
- data/tests/swift_client_tests.rb +29 -0
- data/tests/utils_tests.rb +33 -0
- data/vendor/fog/.document +3 -0
- data/vendor/fog/.gitignore +23 -0
- data/vendor/fog/.irbrc +82 -0
- data/vendor/fog/.travis.yml +21 -0
- data/vendor/fog/README.cifrado +3 -0
- data/vendor/fog/README.md +156 -0
- data/vendor/fog/RELEASE.md +39 -0
- data/vendor/fog/changelog.txt +4156 -0
- data/vendor/fog/fog.gemspec +70 -0
- data/vendor/fog/lib/fog.rb +17 -0
- data/vendor/fog/lib/fog/cdn.rb +30 -0
- data/vendor/fog/lib/fog/compute.rb +127 -0
- data/vendor/fog/lib/fog/compute/models/server.rb +73 -0
- data/vendor/fog/lib/fog/core.rb +38 -0
- data/vendor/fog/lib/fog/core/attributes.rb +221 -0
- data/vendor/fog/lib/fog/core/collection.rb +145 -0
- data/vendor/fog/lib/fog/core/connection.rb +36 -0
- data/vendor/fog/lib/fog/core/credentials.rb +65 -0
- data/vendor/fog/lib/fog/core/current_machine.rb +34 -0
- data/vendor/fog/lib/fog/core/deprecated_connection_accessors.rb +41 -0
- data/vendor/fog/lib/fog/core/deprecation.rb +23 -0
- data/vendor/fog/lib/fog/core/errors.rb +108 -0
- data/vendor/fog/lib/fog/core/hmac.rb +48 -0
- data/vendor/fog/lib/fog/core/json.rb +34 -0
- data/vendor/fog/lib/fog/core/logger.rb +45 -0
- data/vendor/fog/lib/fog/core/mock.rb +92 -0
- data/vendor/fog/lib/fog/core/model.rb +79 -0
- data/vendor/fog/lib/fog/core/parser.rb +116 -0
- data/vendor/fog/lib/fog/core/provider.rb +35 -0
- data/vendor/fog/lib/fog/core/scp.rb +96 -0
- data/vendor/fog/lib/fog/core/service.rb +223 -0
- data/vendor/fog/lib/fog/core/ssh.rb +137 -0
- data/vendor/fog/lib/fog/core/time.rb +32 -0
- data/vendor/fog/lib/fog/core/timeout.rb +11 -0
- data/vendor/fog/lib/fog/core/wait_for.rb +15 -0
- data/vendor/fog/lib/fog/digitalocean.rb +9 -0
- data/vendor/fog/lib/fog/digitalocean/compute.rb +100 -0
- data/vendor/fog/lib/fog/digitalocean/examples/getting_started.md +106 -0
- data/vendor/fog/lib/fog/digitalocean/models/compute/flavor.rb +14 -0
- data/vendor/fog/lib/fog/digitalocean/models/compute/flavors.rb +25 -0
- data/vendor/fog/lib/fog/digitalocean/models/compute/image.rb +15 -0
- data/vendor/fog/lib/fog/digitalocean/models/compute/images.rb +25 -0
- data/vendor/fog/lib/fog/digitalocean/models/compute/region.rb +14 -0
- data/vendor/fog/lib/fog/digitalocean/models/compute/regions.rb +25 -0
- data/vendor/fog/lib/fog/digitalocean/models/compute/server.rb +150 -0
- data/vendor/fog/lib/fog/digitalocean/models/compute/servers.rb +27 -0
- data/vendor/fog/lib/fog/digitalocean/requests/compute/create_server.rb +49 -0
- data/vendor/fog/lib/fog/digitalocean/requests/compute/create_ssh_key.rb +26 -0
- data/vendor/fog/lib/fog/digitalocean/requests/compute/destroy_server.rb +28 -0
- data/vendor/fog/lib/fog/digitalocean/requests/compute/get_server_details.rb +25 -0
- data/vendor/fog/lib/fog/digitalocean/requests/compute/list_flavors.rb +25 -0
- data/vendor/fog/lib/fog/digitalocean/requests/compute/list_images.rb +25 -0
- data/vendor/fog/lib/fog/digitalocean/requests/compute/list_regions.rb +25 -0
- data/vendor/fog/lib/fog/digitalocean/requests/compute/list_servers.rb +25 -0
- data/vendor/fog/lib/fog/digitalocean/requests/compute/list_ssh_keys.rb +25 -0
- data/vendor/fog/lib/fog/digitalocean/requests/compute/power_cycle_server.rb +25 -0
- data/vendor/fog/lib/fog/digitalocean/requests/compute/power_off_server.rb +25 -0
- data/vendor/fog/lib/fog/digitalocean/requests/compute/power_on_server.rb +25 -0
- data/vendor/fog/lib/fog/digitalocean/requests/compute/reboot_server.rb +25 -0
- data/vendor/fog/lib/fog/digitalocean/requests/compute/shutdown_server.rb +25 -0
- data/vendor/fog/lib/fog/dns.rb +59 -0
- data/vendor/fog/lib/fog/identity.rb +27 -0
- data/vendor/fog/lib/fog/image.rb +24 -0
- data/vendor/fog/lib/fog/local.rb +11 -0
- data/vendor/fog/lib/fog/local/models/storage/directories.rb +33 -0
- data/vendor/fog/lib/fog/local/models/storage/directory.rb +57 -0
- data/vendor/fog/lib/fog/local/models/storage/file.rb +131 -0
- data/vendor/fog/lib/fog/local/models/storage/files.rb +87 -0
- data/vendor/fog/lib/fog/local/storage.rb +103 -0
- data/vendor/fog/lib/fog/network.rb +26 -0
- data/vendor/fog/lib/fog/openstack.rb +214 -0
- data/vendor/fog/lib/fog/openstack/README.identity.md +69 -0
- data/vendor/fog/lib/fog/openstack/compute.rb +423 -0
- data/vendor/fog/lib/fog/openstack/identity.rb +299 -0
- data/vendor/fog/lib/fog/openstack/image.rb +217 -0
- data/vendor/fog/lib/fog/openstack/models/compute/address.rb +71 -0
- data/vendor/fog/lib/fog/openstack/models/compute/addresses.rb +33 -0
- data/vendor/fog/lib/fog/openstack/models/compute/flavor.rb +45 -0
- data/vendor/fog/lib/fog/openstack/models/compute/flavors.rb +28 -0
- data/vendor/fog/lib/fog/openstack/models/compute/host.rb +29 -0
- data/vendor/fog/lib/fog/openstack/models/compute/hosts.rb +32 -0
- data/vendor/fog/lib/fog/openstack/models/compute/image.rb +58 -0
- data/vendor/fog/lib/fog/openstack/models/compute/images.rb +33 -0
- data/vendor/fog/lib/fog/openstack/models/compute/key_pair.rb +60 -0
- data/vendor/fog/lib/fog/openstack/models/compute/key_pairs.rb +31 -0
- data/vendor/fog/lib/fog/openstack/models/compute/metadata.rb +68 -0
- data/vendor/fog/lib/fog/openstack/models/compute/metadatum.rb +29 -0
- data/vendor/fog/lib/fog/openstack/models/compute/network.rb +13 -0
- data/vendor/fog/lib/fog/openstack/models/compute/networks.rb +29 -0
- data/vendor/fog/lib/fog/openstack/models/compute/security_group.rb +44 -0
- data/vendor/fog/lib/fog/openstack/models/compute/security_groups.rb +27 -0
- data/vendor/fog/lib/fog/openstack/models/compute/server.rb +278 -0
- data/vendor/fog/lib/fog/openstack/models/compute/servers.rb +44 -0
- data/vendor/fog/lib/fog/openstack/models/compute/snapshot.rb +44 -0
- data/vendor/fog/lib/fog/openstack/models/compute/snapshots.rb +26 -0
- data/vendor/fog/lib/fog/openstack/models/compute/tenant.rb +24 -0
- data/vendor/fog/lib/fog/openstack/models/compute/tenants.rb +24 -0
- data/vendor/fog/lib/fog/openstack/models/compute/volume.rb +59 -0
- data/vendor/fog/lib/fog/openstack/models/compute/volumes.rb +26 -0
- data/vendor/fog/lib/fog/openstack/models/identity/ec2_credential.rb +44 -0
- data/vendor/fog/lib/fog/openstack/models/identity/ec2_credentials.rb +53 -0
- data/vendor/fog/lib/fog/openstack/models/identity/role.rb +50 -0
- data/vendor/fog/lib/fog/openstack/models/identity/roles.rb +21 -0
- data/vendor/fog/lib/fog/openstack/models/identity/tenant.rb +62 -0
- data/vendor/fog/lib/fog/openstack/models/identity/tenants.rb +29 -0
- data/vendor/fog/lib/fog/openstack/models/identity/user.rb +70 -0
- data/vendor/fog/lib/fog/openstack/models/identity/users.rb +32 -0
- data/vendor/fog/lib/fog/openstack/models/image/image.rb +91 -0
- data/vendor/fog/lib/fog/openstack/models/image/images.rb +60 -0
- data/vendor/fog/lib/fog/openstack/models/meta_parent.rb +33 -0
- data/vendor/fog/lib/fog/openstack/models/network/floating_ip.rb +52 -0
- data/vendor/fog/lib/fog/openstack/models/network/floating_ips.rb +34 -0
- data/vendor/fog/lib/fog/openstack/models/network/network.rb +47 -0
- data/vendor/fog/lib/fog/openstack/models/network/networks.rb +34 -0
- data/vendor/fog/lib/fog/openstack/models/network/port.rb +53 -0
- data/vendor/fog/lib/fog/openstack/models/network/ports.rb +34 -0
- data/vendor/fog/lib/fog/openstack/models/network/subnet.rb +56 -0
- data/vendor/fog/lib/fog/openstack/models/network/subnets.rb +34 -0
- data/vendor/fog/lib/fog/openstack/models/storage/directories.rb +39 -0
- data/vendor/fog/lib/fog/openstack/models/storage/directory.rb +50 -0
- data/vendor/fog/lib/fog/openstack/models/storage/file.rb +152 -0
- data/vendor/fog/lib/fog/openstack/models/storage/files.rb +94 -0
- data/vendor/fog/lib/fog/openstack/models/volume/volume.rb +47 -0
- data/vendor/fog/lib/fog/openstack/models/volume/volumes.rb +27 -0
- data/vendor/fog/lib/fog/openstack/network.rb +247 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/add_fixed_ip.rb +29 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/allocate_address.rb +42 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/associate_address.rb +27 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/attach_volume.rb +38 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/boot_from_snapshot.rb +41 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/change_server_password.rb +24 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/confirm_resize_server.rb +24 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/create_flavor.rb +85 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/create_image.rb +49 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/create_key_pair.rb +49 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/create_security_group.rb +52 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/create_security_group_rule.rb +59 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/create_server.rb +131 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/create_volume.rb +54 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/create_volume_snapshot.rb +47 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/delete_flavor.rb +28 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/delete_image.rb +40 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/delete_key_pair.rb +31 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/delete_metadata.rb +28 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/delete_security_group.rb +33 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/delete_security_group_rule.rb +31 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/delete_server.rb +38 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/delete_snapshot.rb +26 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/delete_volume.rb +26 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/detach_volume.rb +26 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/disassociate_address.rb +27 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/get_address.rb +41 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/get_console_output.rb +28 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/get_flavor_details.rb +43 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/get_host_details.rb +74 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/get_image_details.rb +33 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/get_limits.rb +93 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/get_metadata.rb +29 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/get_quota.rb +31 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/get_quota_defaults.rb +31 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/get_security_group.rb +49 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/get_server_details.rb +32 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/get_server_volumes.rb +23 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/get_snapshot_details.rb +39 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/get_usage.rb +53 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/get_vnc_console.rb +40 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/get_volume_details.rb +42 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/list_address_pools.rb +23 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/list_addresses.rb +32 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/list_all_addresses.rb +64 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/list_flavors.rb +38 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/list_flavors_detail.rb +38 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/list_hosts.rb +32 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/list_images.rb +33 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/list_images_detail.rb +39 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/list_key_pairs.rb +39 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/list_metadata.rb +28 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/list_private_addresses.rb +32 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/list_public_addresses.rb +32 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/list_security_groups.rb +50 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/list_servers.rb +37 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/list_servers_detail.rb +44 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/list_snapshots.rb +32 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/list_tenants.rb +45 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/list_usages.rb +43 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/list_volumes.rb +51 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/live_migrate_server.rb +31 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/migrate_server.rb +24 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/pause_server.rb +24 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/reboot_server.rb +24 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/rebuild_server.rb +31 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/release_address.rb +34 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/remove_fixed_ip.rb +29 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/rescue_server.rb +24 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/reset_server_state.rb +24 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/resize_server.rb +24 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/resume_server.rb +24 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/revert_resize_server.rb +30 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/server_action.rb +18 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/server_actions.rb +27 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/server_diagnostics.rb +25 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/set_metadata.rb +45 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/set_tenant.rb +21 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/suspend_server.rb +24 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/unpause_server.rb +24 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/update_metadata.rb +46 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/update_quota.rb +32 -0
- data/vendor/fog/lib/fog/openstack/requests/compute/update_server.rb +35 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/add_user_to_tenant.rb +34 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/check_token.rb +23 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/create_ec2_credential.rb +58 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/create_role.rb +37 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/create_tenant.rb +32 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/create_user.rb +47 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/create_user_role.rb +26 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/delete_ec2_credential.rb +44 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/delete_role.rb +32 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/delete_tenant.rb +31 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/delete_user.rb +32 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/delete_user_role.rb +26 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/get_ec2_credential.rb +49 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/get_role.rb +28 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/get_tenant.rb +31 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/get_tenants_by_id.rb +23 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/get_tenants_by_name.rb +23 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/get_user_by_id.rb +34 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/get_user_by_name.rb +31 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/list_ec2_credentials.rb +44 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/list_endpoints_for_token.rb +23 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/list_roles.rb +36 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/list_roles_for_user_on_tenant.rb +30 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/list_tenants.rb +45 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/list_user_global_roles.rb +22 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/list_users.rb +34 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/remove_user_from_tenant.rb +20 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/set_tenant.rb +21 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/update_tenant.rb +28 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/update_user.rb +36 -0
- data/vendor/fog/lib/fog/openstack/requests/identity/validate_token.rb +23 -0
- data/vendor/fog/lib/fog/openstack/requests/image/add_member_to_image.rb +23 -0
- data/vendor/fog/lib/fog/openstack/requests/image/create_image.rb +79 -0
- data/vendor/fog/lib/fog/openstack/requests/image/delete_image.rb +25 -0
- data/vendor/fog/lib/fog/openstack/requests/image/get_image.rb +45 -0
- data/vendor/fog/lib/fog/openstack/requests/image/get_image_by_id.rb +32 -0
- data/vendor/fog/lib/fog/openstack/requests/image/get_image_members.rb +29 -0
- data/vendor/fog/lib/fog/openstack/requests/image/get_shared_images.rb +29 -0
- data/vendor/fog/lib/fog/openstack/requests/image/list_public_images.rb +32 -0
- data/vendor/fog/lib/fog/openstack/requests/image/list_public_images_detailed.rb +31 -0
- data/vendor/fog/lib/fog/openstack/requests/image/remove_member_from_image.rb +23 -0
- data/vendor/fog/lib/fog/openstack/requests/image/set_tenant.rb +21 -0
- data/vendor/fog/lib/fog/openstack/requests/image/update_image.rb +70 -0
- data/vendor/fog/lib/fog/openstack/requests/image/update_image_members.rb +37 -0
- data/vendor/fog/lib/fog/openstack/requests/network/associate_floating_ip.rb +49 -0
- data/vendor/fog/lib/fog/openstack/requests/network/create_floating_ip.rb +50 -0
- data/vendor/fog/lib/fog/openstack/requests/network/create_network.rb +44 -0
- data/vendor/fog/lib/fog/openstack/requests/network/create_port.rb +52 -0
- data/vendor/fog/lib/fog/openstack/requests/network/create_subnet.rb +56 -0
- data/vendor/fog/lib/fog/openstack/requests/network/delete_floating_ip.rb +30 -0
- data/vendor/fog/lib/fog/openstack/requests/network/delete_network.rb +30 -0
- data/vendor/fog/lib/fog/openstack/requests/network/delete_port.rb +30 -0
- data/vendor/fog/lib/fog/openstack/requests/network/delete_subnet.rb +30 -0
- data/vendor/fog/lib/fog/openstack/requests/network/disassociate_floating_ip.rb +49 -0
- data/vendor/fog/lib/fog/openstack/requests/network/get_floating_ip.rb +42 -0
- data/vendor/fog/lib/fog/openstack/requests/network/get_network.rb +42 -0
- data/vendor/fog/lib/fog/openstack/requests/network/get_port.rb +48 -0
- data/vendor/fog/lib/fog/openstack/requests/network/get_subnet.rb +49 -0
- data/vendor/fog/lib/fog/openstack/requests/network/list_floating_ips.rb +27 -0
- data/vendor/fog/lib/fog/openstack/requests/network/list_networks.rb +27 -0
- data/vendor/fog/lib/fog/openstack/requests/network/list_ports.rb +27 -0
- data/vendor/fog/lib/fog/openstack/requests/network/list_subnets.rb +27 -0
- data/vendor/fog/lib/fog/openstack/requests/network/set_tenant.rb +21 -0
- data/vendor/fog/lib/fog/openstack/requests/network/update_network.rb +41 -0
- data/vendor/fog/lib/fog/openstack/requests/network/update_port.rb +44 -0
- data/vendor/fog/lib/fog/openstack/requests/network/update_subnet.rb +44 -0
- data/vendor/fog/lib/fog/openstack/requests/storage/copy_object.rb +27 -0
- data/vendor/fog/lib/fog/openstack/requests/storage/delete_container.rb +22 -0
- data/vendor/fog/lib/fog/openstack/requests/storage/delete_object.rb +23 -0
- data/vendor/fog/lib/fog/openstack/requests/storage/get_container.rb +44 -0
- data/vendor/fog/lib/fog/openstack/requests/storage/get_containers.rb +33 -0
- data/vendor/fog/lib/fog/openstack/requests/storage/get_object.rb +29 -0
- data/vendor/fog/lib/fog/openstack/requests/storage/get_object_https_url.rb +51 -0
- data/vendor/fog/lib/fog/openstack/requests/storage/head_container.rb +28 -0
- data/vendor/fog/lib/fog/openstack/requests/storage/head_containers.rb +25 -0
- data/vendor/fog/lib/fog/openstack/requests/storage/head_object.rb +23 -0
- data/vendor/fog/lib/fog/openstack/requests/storage/post_set_meta_temp_url_key.rb +37 -0
- data/vendor/fog/lib/fog/openstack/requests/storage/put_container.rb +22 -0
- data/vendor/fog/lib/fog/openstack/requests/storage/put_object.rb +30 -0
- data/vendor/fog/lib/fog/openstack/requests/storage/put_object_manifest.rb +25 -0
- data/vendor/fog/lib/fog/openstack/requests/volume/create_volume.rb +54 -0
- data/vendor/fog/lib/fog/openstack/requests/volume/create_volume_snapshot.rb +47 -0
- data/vendor/fog/lib/fog/openstack/requests/volume/delete_snapshot.rb +26 -0
- data/vendor/fog/lib/fog/openstack/requests/volume/delete_volume.rb +26 -0
- data/vendor/fog/lib/fog/openstack/requests/volume/get_snapshot_details.rb +39 -0
- data/vendor/fog/lib/fog/openstack/requests/volume/get_volume_details.rb +42 -0
- data/vendor/fog/lib/fog/openstack/requests/volume/list_snapshots.rb +32 -0
- data/vendor/fog/lib/fog/openstack/requests/volume/list_volumes.rb +55 -0
- data/vendor/fog/lib/fog/openstack/requests/volume/set_tenant.rb +21 -0
- data/vendor/fog/lib/fog/openstack/storage.rb +162 -0
- data/vendor/fog/lib/fog/openstack/volume.rb +219 -0
- data/vendor/fog/lib/fog/providers.rb +2 -0
- data/vendor/fog/lib/fog/schema/data_validator.rb +154 -0
- data/vendor/fog/lib/fog/storage.rb +97 -0
- data/vendor/fog/lib/fog/version.rb +3 -0
- data/vendor/fog/lib/fog/volume.rb +25 -0
- metadata +576 -0
- metadata.gz.sig +0 -0
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'digest/sha1'
|
2
|
+
|
3
|
+
module Cifrado
|
4
|
+
module Utils
|
5
|
+
|
6
|
+
def prettify_backtrace(e)
|
7
|
+
Log.debug e.class
|
8
|
+
Log.debug e.backtrace.join("\nDEBUG: ")
|
9
|
+
end
|
10
|
+
|
11
|
+
def mime_type(file)
|
12
|
+
mime = `/usr/bin/file -b --mime-type #{Shellwords.escape(file)} 2>/dev/null`.strip.chomp
|
13
|
+
mime.empty? ? nil : mime
|
14
|
+
end
|
15
|
+
|
16
|
+
def clean_object_name(obj)
|
17
|
+
Pathname.new(obj.gsub(/^(\/+|.\/)/,'')).cleanpath.to_s
|
18
|
+
end
|
19
|
+
|
20
|
+
def unix_time(secs)
|
21
|
+
(Time.at secs.to_i).to_s
|
22
|
+
end
|
23
|
+
|
24
|
+
def decrypt_filename(name, password, options = {})
|
25
|
+
cipher = CryptoEngineAES.new password
|
26
|
+
cipher.decrypt name
|
27
|
+
end
|
28
|
+
|
29
|
+
def encrypt_filename(name, password, options = {})
|
30
|
+
cipher = CryptoEngineAES.new password
|
31
|
+
cipher.encrypt name
|
32
|
+
end
|
33
|
+
|
34
|
+
def humanize_bytes(bytes)
|
35
|
+
m = bytes.to_i
|
36
|
+
units = %w[Bytes KB MB GB TB PB]
|
37
|
+
while (m/1024.0) >= 1
|
38
|
+
m = m/1024.0
|
39
|
+
units.shift
|
40
|
+
end
|
41
|
+
return "%.2f #{units[0]}" % m
|
42
|
+
end
|
43
|
+
|
44
|
+
def calculate_chunks(file)
|
45
|
+
# File size in bytes
|
46
|
+
size = File.size(file)
|
47
|
+
if size >= 1 and size <= 10485760
|
48
|
+
1
|
49
|
+
# if file >= 20MB and <= 50MB, split in chunks of 10MB
|
50
|
+
elsif size > 10485760 and size <= 104857600
|
51
|
+
size/10485760
|
52
|
+
# split in chunk of 100 MB
|
53
|
+
else
|
54
|
+
size/104857600
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
Shindo.tests('Cifrado | CLI#list') do
|
2
|
+
|
3
|
+
cleanup
|
4
|
+
|
5
|
+
tests '#list' do
|
6
|
+
test 'container has 1 element' do
|
7
|
+
obj = create_bin_payload 1
|
8
|
+
cli = Cifrado::CLI.new
|
9
|
+
cli.options = {
|
10
|
+
:insecure => true,
|
11
|
+
:no_progressbar => true
|
12
|
+
}
|
13
|
+
cli.upload 'cifrado-tests', obj
|
14
|
+
(cli.list 'cifrado-tests').size == 1
|
15
|
+
end
|
16
|
+
test 'cifrado-tests-list container exists' do
|
17
|
+
dir = client.service.directories.create :key => 'cifrado-tests-list'
|
18
|
+
cli = Cifrado::CLI.new
|
19
|
+
cli.options = {
|
20
|
+
:insecure => true,
|
21
|
+
:no_progressbar => true
|
22
|
+
}
|
23
|
+
!(cli.list.find { |d| d == 'cifrado-tests-list' }).nil?
|
24
|
+
dir.destroy
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
include Cifrado::Utils
|
2
|
+
|
3
|
+
Shindo.tests('Cifrado | CLI#upload') do
|
4
|
+
|
5
|
+
cfg = YAML.load_file(
|
6
|
+
File.join(ENV['HOME'], '.config/cifrado/cifradorc')
|
7
|
+
) rescue nil
|
8
|
+
cli_options = {
|
9
|
+
:insecure => true,
|
10
|
+
:no_progressbar => true
|
11
|
+
}
|
12
|
+
cli_options.merge!(cfg[:cli_options]) if cfg
|
13
|
+
cli = Cifrado::CLI.new
|
14
|
+
cli.options = cli_options
|
15
|
+
|
16
|
+
tests '#upload' do
|
17
|
+
tests 'upload 2 files' do
|
18
|
+
clean_test_container
|
19
|
+
obj = create_bin_payload 1
|
20
|
+
obj2 = create_bin_payload 2
|
21
|
+
uploaded = cli.upload test_container_name, obj, obj2
|
22
|
+
|
23
|
+
test "2 files uploaded" do
|
24
|
+
uploaded.size == 2
|
25
|
+
end
|
26
|
+
test "MD5 for #{obj} matches" do
|
27
|
+
cli.stat(test_container_name, obj)['Etag'] == Digest::MD5.file(obj).to_s
|
28
|
+
end
|
29
|
+
test "MD5 for #{obj2} matches" do
|
30
|
+
cli.stat(test_container_name, obj2)['Etag'] == Digest::MD5.file(obj2).to_s
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
tests 'upload 1 file and one directory' do
|
36
|
+
clean_test_container
|
37
|
+
obj = create_bin_payload 1
|
38
|
+
# Dir with 3 files
|
39
|
+
tmpdir = populate_tmpdir
|
40
|
+
uploaded = cli.upload test_container_name, obj, tmpdir
|
41
|
+
test '4 files uploaded' do
|
42
|
+
uploaded.size == 4
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
tests 'encrypt and segment 2 files and one directory' do
|
47
|
+
clean_test_container
|
48
|
+
obj = create_bin_payload 100
|
49
|
+
tmpdir = populate_tmpdir
|
50
|
+
cli.options = {
|
51
|
+
:segments => 3,
|
52
|
+
:encrypt => 's:foobar'
|
53
|
+
}.merge cli_options
|
54
|
+
# Dir with 3 files
|
55
|
+
uploaded = cli.upload test_container_name, obj, tmpdir
|
56
|
+
test '12 files + 4 segments uploaded' do
|
57
|
+
# 4 files * 3 segments + 4 manifests
|
58
|
+
uploaded.size == 16
|
59
|
+
end
|
60
|
+
|
61
|
+
cli.list(test_container_name).each do |o|
|
62
|
+
test 'uploads have encryption header' do
|
63
|
+
!cli.stat(test_container_name, o)['X-Object-Meta-Encrypted-Name'].nil?
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
tests 'uploads can be downloaded and decrypted' do
|
68
|
+
tmpdir_out = create_tmpdir
|
69
|
+
cli.options = {
|
70
|
+
:decrypt => true,
|
71
|
+
:passphrase => 'foobar',
|
72
|
+
:output => tmpdir_out
|
73
|
+
}.merge cli_options
|
74
|
+
downloads = cli.download test_container_name
|
75
|
+
test 'downloaded 4 files' do
|
76
|
+
downloads.size == 4
|
77
|
+
end
|
78
|
+
test '4 files found' do
|
79
|
+
( Dir["#{tmpdir_out}/**/*"].reject { |f| File.directory?(f) } ).size == 4
|
80
|
+
end
|
81
|
+
|
82
|
+
uploaded = ( Dir["#{tmpdir_out}/**/*"].reject { |f| File.directory?(f) } )
|
83
|
+
uploaded.map! { |f| File.basename(f) }
|
84
|
+
((Dir["#{tmpdir}/*"] << obj).map { |f| File.basename(f) }).each do |f|
|
85
|
+
test "filename #{f} was decrypted" do
|
86
|
+
uploaded.include? f
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
@@ -0,0 +1,167 @@
|
|
1
|
+
include Cifrado::Utils
|
2
|
+
|
3
|
+
Shindo.tests('Cifrado | CLI#upload') do
|
4
|
+
|
5
|
+
cfg = YAML.load_file(
|
6
|
+
File.join(ENV['HOME'], '.config/cifrado/cifradorc')
|
7
|
+
) rescue nil
|
8
|
+
cli_options = {
|
9
|
+
:insecure => true,
|
10
|
+
:no_progressbar => true
|
11
|
+
}
|
12
|
+
cli_options.merge!(cfg[:cli_options]) if cfg
|
13
|
+
|
14
|
+
tests '#upload' do
|
15
|
+
tests 'segmented uploads' do
|
16
|
+
obj = create_bin_payload 1*1024
|
17
|
+
cli = Cifrado::CLI.new
|
18
|
+
cli.options = {
|
19
|
+
:segments => 3
|
20
|
+
}.merge cli_options
|
21
|
+
segments = cli.upload 'cifrado-tests', obj
|
22
|
+
test "#{test_container.key} is a Hash" do
|
23
|
+
cli.stat('cifrado-tests', obj).is_a?(Hash)
|
24
|
+
end
|
25
|
+
test "uploaded 4 segments" do
|
26
|
+
segments.size == 4
|
27
|
+
end
|
28
|
+
test "segment matches /segments/..." do
|
29
|
+
!segments.last.match(/segments\/\d+.\d{2}\/\d+\/00000003$/).nil?
|
30
|
+
end
|
31
|
+
test 'uploaded segments not uploaded twice' do
|
32
|
+
segments = cli.upload 'cifrado-tests', obj
|
33
|
+
segments.size == 0
|
34
|
+
end
|
35
|
+
end
|
36
|
+
tests 'single uploads' do
|
37
|
+
obj = create_bin_payload 1
|
38
|
+
cli = Cifrado::CLI.new
|
39
|
+
cli.options = cli_options
|
40
|
+
cli.upload 'cifrado-tests', obj
|
41
|
+
test 'upload ok' do
|
42
|
+
cli.stat('cifrado-tests', obj).is_a?(Hash)
|
43
|
+
end
|
44
|
+
test 'do not uploaded twice' do
|
45
|
+
segments = cli.upload 'cifrado-tests', obj
|
46
|
+
segments.size == 0
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
tests 'encrypted uploads' do
|
51
|
+
obj = create_bin_payload 1
|
52
|
+
cli = Cifrado::CLI.new
|
53
|
+
cli.options = {
|
54
|
+
:encrypt => 'a:rubiojr'
|
55
|
+
}.merge cli_options
|
56
|
+
obj_path = (cli.upload 'cifrado-tests', obj).first
|
57
|
+
test 'stat' do
|
58
|
+
cli.stat('cifrado-tests', obj_path).is_a?(Hash)
|
59
|
+
end
|
60
|
+
test 'X-Object-Meta-Encrypted-Name' do
|
61
|
+
!cli.stat('cifrado-tests', obj_path)['X-Object-Meta-Encrypted-Name'].nil?
|
62
|
+
end
|
63
|
+
test 'decrypted name matches' do
|
64
|
+
header = cli.stat('cifrado-tests', obj_path)['X-Object-Meta-Encrypted-Name']
|
65
|
+
decrypted_name = decrypt_filename header,
|
66
|
+
cli.config[:password] + cli.config[:secure_random]
|
67
|
+
decrypted_name == obj
|
68
|
+
end
|
69
|
+
|
70
|
+
clean_test_container
|
71
|
+
obj1 = create_bin_payload 1, "/tmp/cifrado-upload-dir/foo"
|
72
|
+
obj2 = create_bin_payload 1, "/tmp/cifrado-upload-dir/bar/foo"
|
73
|
+
obj3 = create_bin_payload 1, "/tmp/cifrado-upload-dir/stuff/bar/foo"
|
74
|
+
cli.upload test_container.key, "/tmp/cifrado-upload-dir/"
|
75
|
+
sleep 2
|
76
|
+
test 'directory upload' do
|
77
|
+
test_container.files.size == 3
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
tests 'encrypted segmented uploads' do
|
82
|
+
clean_test_container
|
83
|
+
obj = create_bin_payload 1*1024
|
84
|
+
cli = Cifrado::CLI.new
|
85
|
+
cli.options = {
|
86
|
+
:segments => 3,
|
87
|
+
:encrypt => 'a:rubiojr'
|
88
|
+
}.merge cli_options
|
89
|
+
segments = cli.upload 'cifrado-tests', obj
|
90
|
+
test 'stat' do
|
91
|
+
cli.stat('cifrado-tests', segments.first).is_a?(Hash)
|
92
|
+
end
|
93
|
+
# If the file size after encryption (GPG uses compression by default)
|
94
|
+
# is smaller than 4096*3, the number of segments will be less than 3
|
95
|
+
# in this case, so the following test will not work.
|
96
|
+
test 'segments number' do
|
97
|
+
# 1 plus manifest
|
98
|
+
segments.size == 4
|
99
|
+
end
|
100
|
+
test 'segment name matches' do
|
101
|
+
!segments.last.match(/segments\/\d+.\d{2}\/\d+\/00000003$/).nil?
|
102
|
+
end
|
103
|
+
count = 0
|
104
|
+
segments.each do |s|
|
105
|
+
count += 1
|
106
|
+
if count == 1
|
107
|
+
test "segment #{s} has encryption header" do
|
108
|
+
!cli.stat(test_container.key, s)['X-Object-Meta-Encrypted-Name'].nil?
|
109
|
+
end
|
110
|
+
test "manifest #{s} name can be decrypted" do
|
111
|
+
header = cli.stat(test_container.key, s)['X-Object-Meta-Encrypted-Name']
|
112
|
+
decrypted_name = decrypt_filename header,
|
113
|
+
cli.config[:password] + cli.config[:secure_random]
|
114
|
+
decrypted_name == obj
|
115
|
+
end
|
116
|
+
else
|
117
|
+
test "segment #{s} has encryption header" do
|
118
|
+
!cli.stat(test_container_segments_name, s)['X-Object-Meta-Encrypted-Name'].nil?
|
119
|
+
end
|
120
|
+
test "segment #{s} name can be decrypted" do
|
121
|
+
header = cli.stat(test_container_segments_name, s)['X-Object-Meta-Encrypted-Name']
|
122
|
+
decrypted_name = decrypt_filename header,
|
123
|
+
cli.config[:password] + cli.config[:secure_random]
|
124
|
+
(decrypted_name =~ /#{obj}\/segments\//) == 0
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
tests 'encrypted symmetric segmented uploads' do
|
131
|
+
clean_test_container
|
132
|
+
obj = create_bin_payload 1*1024
|
133
|
+
cli = Cifrado::CLI.new
|
134
|
+
cli.options = {
|
135
|
+
:segments => 3,
|
136
|
+
:encrypt => 's:foobar'
|
137
|
+
}.merge cli_options
|
138
|
+
segments = cli.upload 'cifrado-tests', obj
|
139
|
+
test "HEAD manifest returns a Hash" do
|
140
|
+
cli.stat(test_container.key, segments.first).is_a?(Hash)
|
141
|
+
end
|
142
|
+
test "4 segments found" do
|
143
|
+
segments.size == 4
|
144
|
+
end
|
145
|
+
test "segment name matches /segments\/\d+.\d{2}\/\d+\/00000003" do
|
146
|
+
!segments.last.match(/segments\/\d+.\d{2}\/\d+\/00000003$/).nil?
|
147
|
+
end
|
148
|
+
test "#{test_container_segments_name} container found" do
|
149
|
+
cli.stat(test_container.key).is_a?(Hash)
|
150
|
+
end
|
151
|
+
test "#{test_container_segments_name} container hash 3 segments" do
|
152
|
+
cli.list(test_container_segments_name).size == 3
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
test 'encrypted symmetric uploads' do
|
157
|
+
obj = create_bin_payload 1
|
158
|
+
cli = Cifrado::CLI.new
|
159
|
+
cli.options = {
|
160
|
+
:encrypt => 's:foobar',
|
161
|
+
}.merge cli_options
|
162
|
+
obj_path = (cli.upload 'cifrado-tests', obj).first
|
163
|
+
!cli.stat('cifrado-tests', obj_path)['X-Object-Meta-Encrypted-Name'].nil?
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
end
|
data/tests/cli_tests.rb
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
Shindo.tests('Cifrado | CryptoServices') do
|
2
|
+
|
3
|
+
obj = create_bin_payload 1
|
4
|
+
|
5
|
+
tests('#decrypt') do
|
6
|
+
|
7
|
+
tests('asymmetric') do
|
8
|
+
test '1MB file' do
|
9
|
+
t1 = tmpfile
|
10
|
+
t2 = tmpfile
|
11
|
+
File.open(t1, 'w') { |f| f.puts 'foo' }
|
12
|
+
s = CryptoServices.new :type => :asymmetric,
|
13
|
+
:recipient => 'rubiojr@frameos.org'
|
14
|
+
output = s.encrypt t1, "#{t1}.encrypted"
|
15
|
+
output = s.decrypt output, t2
|
16
|
+
File.readlines(output).first.strip.chomp == 'foo' and \
|
17
|
+
t2 == output
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
tests('symmetric') do
|
22
|
+
test '1MB file' do
|
23
|
+
t1 = tmpfile
|
24
|
+
t2 = tmpfile
|
25
|
+
File.open(t1, 'w') { |f| f.puts 'foo' }
|
26
|
+
s = CryptoServices.new :type => :symmetric,
|
27
|
+
:passphrase => passphrase
|
28
|
+
output = s.encrypt t1, "#{t1}.encrypted"
|
29
|
+
output = s.decrypt output, t2
|
30
|
+
File.readlines(output).first.strip.chomp == 'foo' and
|
31
|
+
t2 == output
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
tests('#encrypt') do
|
38
|
+
|
39
|
+
tests('asymmetric') do
|
40
|
+
test '1MB file' do
|
41
|
+
s = CryptoServices.new :type => :asymmetric,
|
42
|
+
:recipient => 'rubiojr@frameos.org'
|
43
|
+
output = s.encrypt obj, "#{obj}.encrypted"
|
44
|
+
out = `file #{obj}.encrypted`
|
45
|
+
!out.match(/GPG encrypted/).nil? and File.exist?(output)
|
46
|
+
end
|
47
|
+
|
48
|
+
test 'with ASCII armor' do
|
49
|
+
s = CryptoServices.new :type => :asymmetric,
|
50
|
+
:gpg_extra_args => ['--armor'],
|
51
|
+
:recipient => 'rubiojr@frameos.org'
|
52
|
+
out = s.encrypt obj, "#{obj}.encrypted"
|
53
|
+
!File.read(out).match(/BEGIN PGP MESSAGE/m).nil?
|
54
|
+
end
|
55
|
+
|
56
|
+
test 'with encrypted name' do
|
57
|
+
s = CryptoServices.new :type => :asymmetric,
|
58
|
+
:encrypt_name => true,
|
59
|
+
:recipient => 'rubiojr@frameos.org'
|
60
|
+
out = s.encrypt obj, "#{obj}"
|
61
|
+
dir = File.dirname(obj)
|
62
|
+
(out != obj) and File.exist?(out)
|
63
|
+
end
|
64
|
+
|
65
|
+
raises ArgumentError, 'with wrong gpg binary' do
|
66
|
+
s = CryptoServices.new :type => :asymmetric,
|
67
|
+
:recipient => 'rubiojr@frameos.org',
|
68
|
+
:gpg_binary => '/fffoobar'
|
69
|
+
s.encrypt obj, "#{obj}.encrypted"
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
tests('symmetric') do
|
75
|
+
test '1MB file' do
|
76
|
+
obj = create_bin_payload 1
|
77
|
+
s = CryptoServices.new :type => :symmetric,
|
78
|
+
:passphrase => passphrase
|
79
|
+
output = s.encrypt obj, "#{obj}.encrypted"
|
80
|
+
CryptoServices.encrypted?("#{obj}.encrypted") and File.exist?(output)
|
81
|
+
end
|
82
|
+
test 'with encrypted name' do
|
83
|
+
s = CryptoServices.new :type => :symmetric,
|
84
|
+
:encrypt_name => true,
|
85
|
+
:passphrase => passphrase
|
86
|
+
out = s.encrypt obj, "#{obj}"
|
87
|
+
out != obj and File.exist?(out)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
test 'asymmetric encrypt to stdout' do
|
94
|
+
obj = create_bin_payload 1
|
95
|
+
s = CryptoServices.new :type => :asymmetric,
|
96
|
+
:recipient => 'rubiojr@frameos.org',
|
97
|
+
:gpg_extra_args => ['--armor']
|
98
|
+
out = s.encrypt obj, "#{obj}.encrypted"
|
99
|
+
out.match(/BEGIN PGP MESSAGE/m).nil?
|
100
|
+
end
|
101
|
+
|
102
|
+
test 'symmetric encrypt to stdout' do
|
103
|
+
obj = create_bin_payload 1
|
104
|
+
s = CryptoServices.new :type => :symmetric,
|
105
|
+
:passphrase => passphrase,
|
106
|
+
:gpg_extra_args => ['--armor']
|
107
|
+
out = s.encrypt obj, "#{obj}.encrypted"
|
108
|
+
out.match(/BEGIN PGP MESSAGE/m).nil?
|
109
|
+
end
|
110
|
+
|
111
|
+
test '::encrypted?' do
|
112
|
+
obj = create_bin_payload 1
|
113
|
+
s = CryptoServices.new :type => :asymmetric,
|
114
|
+
:recipient => 'rubiojr@frameos.org'
|
115
|
+
s.encrypt obj, "#{obj}.encrypted"
|
116
|
+
CryptoServices.encrypted? "#{obj}.encrypted"
|
117
|
+
end
|
118
|
+
test 'not ::encrypted?' do
|
119
|
+
obj = create_bin_payload 1
|
120
|
+
!CryptoServices.encrypted? "#{obj}"
|
121
|
+
end
|
122
|
+
|
123
|
+
clean_test_payloads
|
124
|
+
end
|
125
|
+
|
126
|
+
Shindo.tests('Cifrado | CryptoEngineAES') do
|
127
|
+
tests('#encrypt') do
|
128
|
+
|
129
|
+
test('with aes256') do
|
130
|
+
cipher = CryptoEngineAES.new 'foobar'
|
131
|
+
out = cipher.encrypt 'blahblah secret'
|
132
|
+
out != 'blahblah secret'
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
tests('#decrypt') do
|
137
|
+
|
138
|
+
test('with aes256') do
|
139
|
+
cipher = CryptoEngineAES.new 'foobar'
|
140
|
+
out = cipher.decrypt 'U2FsdGVkX194CTByrfUY/rcz4ccnuXqiinW81bKGOGg='
|
141
|
+
out == 'blahblah secret'
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
145
|
+
end
|