sym 2.6.0 → 2.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -27
- data/lib/sym/version.rb +19 -22
- data/sym.gemspec +20 -7
- metadata +40 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 632c170e04c0683202d0f555dc5c0a1605e9f358
|
4
|
+
data.tar.gz: 3ed88bd3e490657a665e69911698cdbcfb25db92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 044bdb0bbe730dae5399c11694fdc214c847217cc72c76df301fc14fb59b8cccb1aec7f7fd5da3e5ffa6d3a1c9cf2f426a1e4bff89429984407fa22dab1cb2c3
|
7
|
+
data.tar.gz: 26b4d27351d37ce6a9bb0eca94732cbb7d2a58501c65bd9a392380ea15aa45703e3ac754802a930cb712cfec4b637daccd5ff809ece85a16d2f54554409aa5dd
|
data/README.md
CHANGED
@@ -244,45 +244,33 @@ You can encrypt the private key using a custom password. This is highly recommen
|
|
244
244
|
|
245
245
|
For this purpose, two more instance methods exist:
|
246
246
|
|
247
|
-
*
|
248
|
-
*
|
247
|
+
* `#encr_password(data, password, iv = nil)`
|
248
|
+
* `#decr_password(encrypted_data, password, iv = nil)`
|
249
249
|
|
250
250
|
They can be used independently of `encr` and `decr` to encrypt/decrypt any data with a password.
|
251
251
|
|
252
|
-
<a name="
|
253
|
-
|
254
|
-
### `Sym::Application`
|
252
|
+
<a name="magic-file"></a>
|
255
253
|
|
256
|
-
|
257
|
-
|
258
|
-
The class is instantiated with a hash that would be otherwise generated by parsing CLI arguments, typical `options`. For example, to generate the key, pass `generate: true` — essentially any flag in it's long form can be converted into a hash member.
|
254
|
+
### Using `Sym::MagicFile` API for Reading/Writing Encrypted/Decrypted data
|
259
255
|
|
260
|
-
|
261
|
-
|
262
|
-
```ruby
|
263
|
-
require 'sym/application'
|
256
|
+
This is probably the easiest way to leverage Sym-encrypted files in your application — by loading them into memory with `Sym::MagicFile`. This class provides a very simple API while supporting all of the convenience features of the rich application API (see below).
|
264
257
|
|
265
|
-
|
266
|
-
# => '75ngenJpB6zL47/8Wo7Ne6JN1pnOsqNEcIqblItpfg4='
|
267
|
-
```
|
268
|
-
|
269
|
-
### `Sym::MagicFile` for Reading Encrypted Data
|
270
|
-
|
271
|
-
This is probably the easiest way to leverage Sym-encrypted files, by loading them into memory.
|
272
|
-
|
273
|
-
`Sym::MagicFile` provides a very simple API for loading and reading encrypted files
|
274
|
-
into memory, while supporting all of the convenience features of the rich
|
275
|
-
application API.
|
276
|
-
|
277
|
-
You initialize this class with just two things: a `pathname` to a file (encrypted
|
258
|
+
You instantiate `Sym::MagicFile` with just two parameters: a `pathname` to a file (encrypted
|
278
259
|
or not), and the `key` identifier. The identifier can either be a filename, or
|
279
260
|
OS-X Keychain entry, or environment variable name, etc — basically it is resolve
|
280
261
|
like any other `-k <value>` CLI flag.
|
281
262
|
|
282
|
-
|
263
|
+
The following methods are available:
|
264
|
+
|
265
|
+
* `#encrypt` — returns an encrypted string representing the encrypted contents ofa file specified by the pathname.
|
266
|
+
* `#decrypt` — returns a decrypted string representing the decrypted contents of a file specified by the pathname.
|
267
|
+
* `#encrypt_to(filename)` — encrypts the contents of a file specified by the pathname, and writes the result to a `filename`.
|
268
|
+
* `#decrypt_to(filename)` — decrypts the contents of a file specified by the pathname, and writes the result to a `filename`.
|
269
|
+
|
270
|
+
#### Example: Using `Sym::MagicFile` with the `RailsConfig` (or `Settings`) gem
|
283
271
|
|
284
272
|
In this example, we assume that the environment variable `$PRIVATE_KEY` contain
|
285
|
-
the key to be used in decryption.
|
273
|
+
the key to be used in decryption.
|
286
274
|
|
287
275
|
```ruby
|
288
276
|
require 'sym/magic_file'
|
@@ -307,6 +295,23 @@ Settings.add_source!(
|
|
307
295
|
Settings.reload!
|
308
296
|
```
|
309
297
|
|
298
|
+
<a name="rubyapi-app"></a>
|
299
|
+
|
300
|
+
### Using `Sym::Application` API
|
301
|
+
|
302
|
+
Since the command line interface offers much more than just encryption/decryption of data with a key, majority of these features are available through `Sym::Application` instance.
|
303
|
+
|
304
|
+
The class is instantiated with a hash that would be otherwise generated by parsing CLI arguments, typical `options`. For example, to generate the key, pass `generate: true` — essentially any flag in it's long form can be converted into a hash member.
|
305
|
+
|
306
|
+
Here is an example:
|
307
|
+
|
308
|
+
```ruby
|
309
|
+
require 'sym/application'
|
310
|
+
|
311
|
+
key = Sym::Application.new(generate: true).execute
|
312
|
+
# => '75ngenJpB6zL47/8Wo7Ne6JN1pnOsqNEcIqblItpfg4='
|
313
|
+
```
|
314
|
+
|
310
315
|
### Ruby API Conclusion
|
311
316
|
|
312
317
|
Using `Sym`'s rich ruby API you can perform both low-level encryption/decryption, as well as high-level management of encrypted files. By using `Sym::MagicFile` and/or `Sym::Application` classes you can access the entire set of functionality expressed vi the CLI, described in details below.
|
data/lib/sym/version.rb
CHANGED
@@ -1,28 +1,25 @@
|
|
1
1
|
module Sym
|
2
|
-
VERSION
|
2
|
+
VERSION = '2.6.1'
|
3
3
|
DESCRIPTION = <<-eof
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
Unlike many modern encryption tools, sym focuses on the streamlined interface (CLI),
|
9
|
-
and offers many time-saving features that make encryption/decryption of application
|
10
|
-
secrets and other sensitive data as seamless as possible.
|
11
|
-
|
12
|
-
You can encrypt the key itself with a password, for an additional layer of security.
|
13
|
-
You can choose to save the key to OS-X Keychain, making it difficult to get the key
|
14
|
-
when only disk is accessible. Using memcached or DRb sym can cache passwords so that
|
15
|
-
you don't have to retype it too often. Finally, the -t flag (edit mode) decrypts
|
16
|
-
the file on the fly, and lets you edit the unencrypted contents in $EDITOR.
|
4
|
+
### Sym — Symmetric Encryption Made Easy
|
5
|
+
|
6
|
+
**Sym** is a ruby library (gem) that offers both the command line interface (CLI) and a set of rich Ruby APIs, which make it rather trivial to add encryption and decryption of sensitive data to your development or deployment flow. As a layer of additional security, you can encrypt the private key itself with a password.
|
17
7
|
|
18
|
-
|
19
|
-
keychain, or CLI argument — all of the above become arguments of -k flag: one
|
20
|
-
flag to define the key no matter where it lives.
|
8
|
+
Unlike many other existing encryption tools, Sym focuses on getting out of the way — by offering its streamlined interface, hoping to make encryption of application secrets nearly completely transparent to the developers.
|
21
9
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
10
|
+
For the data encryption Sym uses a symmetric 256-bit key with the `AES-256-CBC` cipher, same cipher as used by the US Government. For password-protecting the key Sym uses `AES-128-CBC` cipher. The resulting data is zlib-compressed and base64-encoded. The keys are also base64 encoded for easy copying/pasting/etc.
|
11
|
+
|
12
|
+
### Massive Time Savers
|
13
|
+
|
14
|
+
Sym accomplishes encryption transparency by combining convenience features:
|
15
|
+
|
16
|
+
* Sym can read the private key from multiple source types, such as: a pathname to a file, an environment variable name, a keychain entry, or CLI argument. You simply pass either of these to the `-k` flag — one flag that works for all source types
|
17
|
+
* By utilizing OS-X Keychain on a Mac, Sym offers truly secure way of storing the key on a local machine, much more secure then storing it on a file system
|
18
|
+
* By using a local password cache (activated with `-c`) via an in-memory provider such as memcached or `drb`, sym invocations take advantage of password cache, and only ask for a password once per a configurable time period
|
19
|
+
* By using `SYM_ARGS` environment variable, where common flags can be saved. This is activated with `sym -A`
|
20
|
+
* By reading the key from the default key source file `~/.sym.key` which requires no flags at all
|
21
|
+
* By utilizing the `--negate` option to quickly encrypt a regular file, or decrypt an encrypted file with extension `.enc`
|
22
|
+
* By implementing the `-t` (edit) mode, that opens an encrypted file in your `$EDITOR`, and replaces the encrypted version upon save & exit, optionally creating a backup.
|
23
|
+
* By offering the `Sym::MagicFile` ruby API to easily read encrypted files into memory.
|
27
24
|
eof
|
28
25
|
end
|
data/sym.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ['Konstantin Gredeskoul']
|
10
10
|
spec.email = %w(kigster@gmail.com)
|
11
11
|
|
12
|
-
spec.summary = %q{
|
12
|
+
spec.summary = %q{Dead-simple and easy to use encryption library on top of OpenSSL, offering rich Ruby API as well as feature-rich CLI able to generate a key, encrypt/decrypt data, password-protect the keys, cache passwords, and more. Strong cipher "aes-256-cbc" used by US Government is behind data encryption.}
|
13
13
|
|
14
14
|
spec.description = Sym::DESCRIPTION
|
15
15
|
|
@@ -21,16 +21,29 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
spec.required_ruby_version = '>= 2.2'
|
23
23
|
spec.post_install_message = <<-EOF
|
24
|
-
Thank you for installing this gem! We hope you like it :)
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
Thank you for installing Sym!
|
26
|
+
|
27
|
+
BLOG POST
|
28
|
+
=========
|
29
|
+
http://kig.re/2017/03/10/dead-simple-encryption-with-sym.html
|
30
|
+
|
31
|
+
BASH COMPLETION
|
32
|
+
===============
|
33
|
+
To enable bash command line completion, please run the following
|
34
|
+
command, which appends sym's shell completion wrapper to the file
|
35
|
+
specified in arguments to -B/--bash-support flag.
|
29
36
|
|
30
37
|
sym -B ~/.bash_profile
|
38
|
+
source ~/.bash_profile
|
31
39
|
|
32
|
-
Thank you for
|
33
|
-
|
40
|
+
Thank you for using Sym and happy crypting :)
|
41
|
+
|
42
|
+
For bonus points, run 'symit -h' after installing and loading bash
|
43
|
+
completion.
|
44
|
+
|
45
|
+
@kigster on Github, @kig on Twitter.
|
46
|
+
|
34
47
|
EOF
|
35
48
|
spec.add_dependency 'colored2', '~> 3'
|
36
49
|
spec.add_dependency 'slop', '~> 4.3'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sym
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Gredeskoul
|
@@ -206,23 +206,34 @@ dependencies:
|
|
206
206
|
- - ">="
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0'
|
209
|
-
description: "
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
209
|
+
description: "### Sym — Symmetric Encryption Made Easy\n \n**Sym** is a ruby library
|
210
|
+
(gem) that offers both the command line interface (CLI) and a set of rich Ruby APIs,
|
211
|
+
which make it rather trivial to add encryption and decryption of sensitive data
|
212
|
+
to your development or deployment flow. As a layer of additional security, you can
|
213
|
+
encrypt the private key itself with a password. \n\nUnlike many other existing encryption
|
214
|
+
tools, Sym focuses on getting out of the way — by offering its streamlined interface,
|
215
|
+
hoping to make encryption of application secrets nearly completely transparent to
|
216
|
+
the developers. \n\nFor the data encryption Sym uses a symmetric 256-bit key with
|
217
|
+
the `AES-256-CBC` cipher, same cipher as used by the US Government. For password-protecting
|
218
|
+
the key Sym uses `AES-128-CBC` cipher. The resulting data is zlib-compressed and
|
219
|
+
base64-encoded. The keys are also base64 encoded for easy copying/pasting/etc.\n
|
220
|
+
\ \n### Massive Time Savers\n\nSym accomplishes encryption transparency by combining
|
221
|
+
convenience features:\n\n * Sym can read the private key from multiple source types,
|
222
|
+
such as: a pathname to a file, an environment variable name, a keychain entry, or
|
223
|
+
CLI argument. You simply pass either of these to the `-k` flag — one flag that works
|
224
|
+
for all source types\n * By utilizing OS-X Keychain on a Mac, Sym offers truly secure
|
225
|
+
way of storing the key on a local machine, much more secure then storing it on a
|
226
|
+
file system\n * By using a local password cache (activated with `-c`) via an in-memory
|
227
|
+
provider such as memcached or `drb`, sym invocations take advantage of password
|
228
|
+
cache, and only ask for a password once per a configurable time period\n * By using
|
229
|
+
`SYM_ARGS` environment variable, where common flags can be saved. This is activated
|
230
|
+
with `sym -A`\n * By reading the key from the default key source file `~/.sym.key`
|
231
|
+
which requires no flags at all\n * By utilizing the `--negate` option to quickly
|
232
|
+
encrypt a regular file, or decrypt an encrypted file with extension `.enc`\n * By
|
233
|
+
implementing the `-t` (edit) mode, that opens an encrypted file in your `$EDITOR`,
|
234
|
+
and replaces the encrypted version upon save & exit, optionally creating a backup.\n
|
235
|
+
* By offering the `Sym::MagicFile` ruby API to easily read encrypted files into
|
236
|
+
memory.\n"
|
226
237
|
email:
|
227
238
|
- kigster@gmail.com
|
228
239
|
executables:
|
@@ -306,11 +317,13 @@ files:
|
|
306
317
|
homepage: https://github.com/kigster/sym
|
307
318
|
licenses: []
|
308
319
|
metadata: {}
|
309
|
-
post_install_message: "
|
310
|
-
|
311
|
-
appends sym's shell completion to the file
|
312
|
-
flag.\n\n sym -B ~/.bash_profile\n
|
313
|
-
|
320
|
+
post_install_message: "\nThank you for installing Sym! \n\nBLOG POST\n=========\nhttp://kig.re/2017/03/10/dead-simple-encryption-with-sym.html\n\nBASH
|
321
|
+
COMPLETION\n===============\nTo enable bash command line completion, please run
|
322
|
+
the following \ncommand, which appends sym's shell completion wrapper to the file
|
323
|
+
\nspecified in arguments to -B/--bash-support flag.\n\n sym -B ~/.bash_profile\n
|
324
|
+
\ source ~/.bash_profile\n \nThank you for using Sym and happy crypting :)\n\nFor
|
325
|
+
bonus points, run 'symit -h' after installing and loading bash\ncompletion.\n\n@kigster
|
326
|
+
on Github, @kig on Twitter.\n\n"
|
314
327
|
rdoc_options: []
|
315
328
|
require_paths:
|
316
329
|
- lib
|
@@ -329,6 +342,8 @@ rubyforge_project:
|
|
329
342
|
rubygems_version: 2.5.2
|
330
343
|
signing_key:
|
331
344
|
specification_version: 4
|
332
|
-
summary:
|
333
|
-
|
345
|
+
summary: Dead-simple and easy to use encryption library on top of OpenSSL, offering
|
346
|
+
rich Ruby API as well as feature-rich CLI able to generate a key, encrypt/decrypt
|
347
|
+
data, password-protect the keys, cache passwords, and more. Strong cipher "aes-256-cbc"
|
348
|
+
used by US Government is behind data encryption.
|
334
349
|
test_files: []
|