cerebus 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +27 -7
- data/lib/cerebus.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -2,12 +2,23 @@
|
|
2
2
|
|
3
3
|
## Summary
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
strings.
|
9
|
-
|
10
|
-
|
5
|
+
Cerebus was the many headed guardian at the entrance of hell. So... he
|
6
|
+
guards things of little value, kind of like this library. This is a simple
|
7
|
+
library which wraps openssl to provide a (hopefully) secure encryption
|
8
|
+
system for arbitrary strings. The aim was to remove all the hard stuff and
|
9
|
+
make it blindingly easy to encrypt and decrypt strings. Of course, this
|
10
|
+
doesn't mean you can ignore basic crypographic best practices. Play safe,
|
11
|
+
this is serious stuff.
|
12
|
+
|
13
|
+
It uses an RSA public key to encryt a Blowfish key which is used to
|
14
|
+
encrypt the data. Decryption uses the RSA private key to decrypt the
|
15
|
+
Blowfish key and then the data. Which is a fairly common pattern. It
|
16
|
+
would be easy to adapt to use AES-256, IDEA or any of the other popular
|
17
|
+
block cyphers.
|
18
|
+
|
19
|
+
The main value of this library is hiding the implementation internals of
|
20
|
+
such a common operation. I couldn't find anything off-the-shelf that
|
21
|
+
made this easy.
|
11
22
|
|
12
23
|
## Examples
|
13
24
|
|
@@ -19,7 +30,16 @@ cleartext = 'It is a secret to everybody!'
|
|
19
30
|
encrypted = Cerebus.encrypt cleartext, 'test/keys/public.pem'
|
20
31
|
```
|
21
32
|
|
22
|
-
|
33
|
+
Decryption is similarly simple.
|
34
|
+
|
35
|
+
```
|
36
|
+
require 'cerebus'
|
37
|
+
cleartext = Cerebus.decrypt encrypted_text, 'test/keys/private.pem',
|
38
|
+
'pass phrase'
|
39
|
+
```
|
40
|
+
|
41
|
+
Passphrase can be optionally left off and you will be prompted for it on
|
42
|
+
the terminal. For rails just add it to the Gemfile and bundle install.
|
23
43
|
|
24
44
|
## Making Keys
|
25
45
|
|
data/lib/cerebus.rb
CHANGED