encryption 1.1.4 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/Gemfile.lock +1 -1
- data/README.md +16 -14
- data/encryption.gemspec +1 -1
- data/lib/encryption.rb +1 -1
- data/lib/modules/symmetric.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
ZDVlZmQ5YWMzY2MwYjQ1NjI1YTViMTcxOGRhMGI0Y2YxYzkxZDQ1OA==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
ZTc2Y2E2OGI2ZDc0Yjc1NzNkOWZiYzEzMTVlNDJlOGY2ZmZkYjE1OQ==
|
|
7
7
|
!binary "U0hBNTEy":
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
OTkxOWU0MTUxYjkwMmY1YWUyZjE5NTI0NmJhNjgxMTVlZTQxNWY1Mzg2ODYx
|
|
10
|
+
YTE3ZmVkNTk5YjZmOWJlMWVmNzk5MTRhN2MzYWM1MTQwN2ZmMzkzYzgzN2Vj
|
|
11
|
+
M2JhYWM0OTZmYzA1MjU5OGY4MDAzZGM1MmMyNjMwYThhMTFiZTk=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
ODRhOGZmNDc0YjRhNjA4MTQyOWE5ZDMyZTYwOWM2YjcyZWM2ODUwNWYwOWU3
|
|
14
|
+
NmRmNjEzOTQxMzg5MmU0MTZjMTNhNzcwZjUxNTBiMTBlYmQyMzI2N2UxODUy
|
|
15
|
+
YTcyODZkODI2YjQ0ODJjOWUwMTJhNGFkNDM2MTIyY2EyYTk1NWQ=
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
Encryption
|
|
2
2
|
==========
|
|
3
|
-
|
|
3
|
+
[](http://badge.fury.io/rb/encryption)
|
|
4
4
|
[](https://codeclimate.com/github/Itehnological/encryption)
|
|
5
5
|
[](https://travis-ci.org/Itehnological/encryption)
|
|
6
6
|
|
|
7
|
-
A simple wrapper for the OpenSSL Cipher library
|
|
7
|
+
A simple wrapper for the OpenSSL Cipher library for Ruby and Rails applications.
|
|
8
|
+
This gem provides you with an easy way to encrypt and decrypt any data using both symmetrical and asymmetrical algorithms.
|
|
8
9
|
|
|
9
10
|
Installation
|
|
10
11
|
------------
|
|
@@ -25,7 +26,7 @@ Symmetric encryption
|
|
|
25
26
|
A simple example of how the gem works:
|
|
26
27
|
```ruby
|
|
27
28
|
Encryption.key = "Secretly yours,\n very long encryption key"
|
|
28
|
-
data = "this is to
|
|
29
|
+
data = "this is to stay secret"
|
|
29
30
|
encrypted_str = Encryption.encrypt(data)
|
|
30
31
|
Encryption.decrypt(encrypted_str) == data # true
|
|
31
32
|
```
|
|
@@ -36,7 +37,7 @@ Encryption.decrypt(encrypted_str) == data # true
|
|
|
36
37
|
```ruby
|
|
37
38
|
encryptor = Encryption::Symmetric.new
|
|
38
39
|
encryptor.key = "Secretly yours,\n very long encryption key"
|
|
39
|
-
data = "this is to
|
|
40
|
+
data = "this is to stay secret"
|
|
40
41
|
encrypted_str = encryptor.encrypt(data)
|
|
41
42
|
encryptor.decrypt(encrypted_str) == data # true
|
|
42
43
|
```
|
|
@@ -45,22 +46,23 @@ encryptor.decrypt(encrypted_str) == data # true
|
|
|
45
46
|
-------------
|
|
46
47
|
For symmetric encryption / decryption you need to set an encryption key. The rest of the settings are optional. Here is a list of all of them:
|
|
47
48
|
`Encryption.key` - Your encryption key
|
|
48
|
-
`Encryption.iv # Optional` - Encryption initialization vector. Defaults to the
|
|
49
|
-
`Encryption.cipher # Optional` - Your encryption algorithm. Defaults to `aes-256-cbc` _(Optional)_
|
|
49
|
+
`Encryption.iv # Optional` - Encryption initialization vector. Defaults to the character `"\0"` _(Optional)_
|
|
50
|
+
`Encryption.cipher # Optional` - Your encryption algorithm. Defaults to `aes-256-cbc` _(Optional)_
|
|
51
|
+
|
|
50
52
|
Run `openssl list-cipher-commands` in the terminal to list all installed ciphers or call `OpenSSL::Cipher.ciphers` in _Ruby_, which will return an array, containing all available algorithms.
|
|
51
53
|
|
|
52
54
|
You can optionally configure both a global instance and a custom instance with a _block_:
|
|
53
55
|
```ruby
|
|
54
56
|
Encryption.config do |config|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
config.key = "don't look at me!"
|
|
58
|
+
config.iv = "is there a better way to initialize OpenSSL?"
|
|
59
|
+
config.cipher = "camellia-128-ecb" # if you feel adventurous
|
|
58
60
|
end
|
|
59
61
|
```
|
|
60
62
|
|
|
61
63
|
Asymmetric encryption (public/private key encryption)
|
|
62
64
|
-----------------------------------------------------
|
|
63
|
-
The `encryption` gem also provides easier
|
|
65
|
+
The `encryption` gem also provides easier syntax for asymmetric encryption.
|
|
64
66
|
|
|
65
67
|
Generating keypair
|
|
66
68
|
------------------
|
|
@@ -128,7 +130,7 @@ License
|
|
|
128
130
|
-------
|
|
129
131
|
This gem is distributed under The MIT License.
|
|
130
132
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
Author
|
|
134
|
+
------
|
|
135
|
+
Itay Grudev
|
|
136
|
+

|
data/encryption.gemspec
CHANGED
|
@@ -2,7 +2,7 @@ require 'date'
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = 'encryption'
|
|
5
|
-
s.version = '1.1.
|
|
5
|
+
s.version = '1.1.5'
|
|
6
6
|
s.date = Date.today.to_s
|
|
7
7
|
s.summary = 'A simple wrapper for the OpenSSL Cipher library'
|
|
8
8
|
s.description = 'Encryption provides a simple interface for symmetric / asymmetric encryption with the OpenSSL Cipher library'
|
data/lib/encryption.rb
CHANGED
data/lib/modules/symmetric.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: encryption
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Itay Grudev
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-04-
|
|
11
|
+
date: 2013-04-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Encryption provides a simple interface for symmetric / asymmetric encryption
|
|
14
14
|
with the OpenSSL Cipher library
|