simple_encrypt 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/VERSION +1 -0
  3. data/lib/simple_encrypt.rb +14 -0
  4. metadata +45 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 637aaa72db7a4491537b53d7f9d7e04856897401
4
+ data.tar.gz: 9dfb0844a55eedcc32ceb6941c3a468460bafb45
5
+ SHA512:
6
+ metadata.gz: c9756c3177c3302691c5ea2b1bf433536a9ad3854cbfaecd461194d75cc6fb97c31ced0e93fac9c39d81a7b8c9378754c3662043143d194da4de96130dddf14e
7
+ data.tar.gz: 57de80e8eb66dfb679dd64064d18d176d2be1e2848e2b8ed5e87cfd17dd9d85f3d5097fff0f44e7d2e72b5964a6bdeb1dae5c1b1dd6963d791d53acbc9f41d2d
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,14 @@
1
+ require 'base64'
2
+ require 'openssl'
3
+
4
+ module SimpleEncrypt
5
+ def encrypt_with_public_key(string, public_key)
6
+ encrypted_string = OpenSSL::PKey::RSA.new(public_key).public_encrypt(string)
7
+ Base64.urlsafe_encode64(encrypted_string)
8
+ end
9
+
10
+ def decrypt_with_private_key(encrypted_string, private_key)
11
+ OpenSSL::PKey::RSA.new(private_key).
12
+ private_decrypt(Base64.urlsafe_decode64(encrypted_string))
13
+ end
14
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: simple_encrypt
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Dmitriy Zaporozhets
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-12 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Simple string encryption and decryption using public/private keys
14
+ email: dmitriy.zaporozhets@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - VERSION
20
+ - lib/simple_encrypt.rb
21
+ homepage: http://rubygems.org/gems/simple_encrypt
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 2.4.5
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: Wrapper around OpenSSL encryption
45
+ test_files: []