sym 0.1.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +25 -0
  3. data/.document +2 -0
  4. data/.gitignore +6 -2
  5. data/.rspec +1 -1
  6. data/.rubocop.yml +1156 -0
  7. data/.travis.yml +10 -2
  8. data/.yardopts +5 -0
  9. data/Gemfile +2 -0
  10. data/LICENSE +22 -0
  11. data/MANAGING-KEYS.md +67 -0
  12. data/README.md +444 -12
  13. data/Rakefile +10 -2
  14. data/bin/sym.bash-completion +24 -0
  15. data/exe/keychain +38 -0
  16. data/exe/sym +20 -0
  17. data/lib/sym.rb +110 -2
  18. data/lib/sym/app.rb +56 -0
  19. data/lib/sym/app/args.rb +42 -0
  20. data/lib/sym/app/cli.rb +192 -0
  21. data/lib/sym/app/commands.rb +56 -0
  22. data/lib/sym/app/commands/command.rb +77 -0
  23. data/lib/sym/app/commands/delete_keychain_item.rb +17 -0
  24. data/lib/sym/app/commands/encrypt_decrypt.rb +26 -0
  25. data/lib/sym/app/commands/generate_key.rb +37 -0
  26. data/lib/sym/app/commands/open_editor.rb +97 -0
  27. data/lib/sym/app/commands/print_key.rb +15 -0
  28. data/lib/sym/app/commands/show_examples.rb +76 -0
  29. data/lib/sym/app/commands/show_help.rb +16 -0
  30. data/lib/sym/app/commands/show_language_examples.rb +81 -0
  31. data/lib/sym/app/commands/show_version.rb +14 -0
  32. data/lib/sym/app/input/handler.rb +41 -0
  33. data/lib/sym/app/keychain.rb +135 -0
  34. data/lib/sym/app/nlp.rb +18 -0
  35. data/lib/sym/app/nlp/constants.rb +32 -0
  36. data/lib/sym/app/nlp/translator.rb +61 -0
  37. data/lib/sym/app/nlp/usage.rb +72 -0
  38. data/lib/sym/app/output.rb +15 -0
  39. data/lib/sym/app/output/base.rb +61 -0
  40. data/lib/sym/app/output/file.rb +18 -0
  41. data/lib/sym/app/output/noop.rb +14 -0
  42. data/lib/sym/app/output/stdout.rb +13 -0
  43. data/lib/sym/app/password/cache.rb +63 -0
  44. data/lib/sym/app/private_key/base64_decoder.rb +17 -0
  45. data/lib/sym/app/private_key/decryptor.rb +71 -0
  46. data/lib/sym/app/private_key/detector.rb +42 -0
  47. data/lib/sym/app/private_key/handler.rb +44 -0
  48. data/lib/sym/app/short_name.rb +10 -0
  49. data/lib/sym/application.rb +114 -0
  50. data/lib/sym/cipher_handler.rb +46 -0
  51. data/lib/sym/configuration.rb +39 -0
  52. data/lib/sym/data.rb +23 -0
  53. data/lib/sym/data/decoder.rb +28 -0
  54. data/lib/sym/data/encoder.rb +24 -0
  55. data/lib/sym/data/wrapper_struct.rb +43 -0
  56. data/lib/sym/encrypted_file.rb +34 -0
  57. data/lib/sym/errors.rb +37 -0
  58. data/lib/sym/extensions/class_methods.rb +12 -0
  59. data/lib/sym/extensions/instance_methods.rb +114 -0
  60. data/lib/sym/version.rb +1 -1
  61. data/sym.gemspec +34 -15
  62. metadata +224 -9
@@ -0,0 +1,39 @@
1
+ module Sym
2
+ # This class encapsulates application configuration, and exports
3
+ # a familiar method +#configure+ for defining configuration in a
4
+ # block.
5
+ #
6
+ # It's values are requested by the library upon encryption or
7
+ # decryption, or any other operation.
8
+ #
9
+ # == Example
10
+ #
11
+ # The following is an actual initialization from the code of this
12
+ # library. You may override any of the value defined below in your
13
+ # code, but _before_ you _use_ library's encryption methods.
14
+ #
15
+ # Sym::Configuration.configure do |config|
16
+ # config.password_cipher = 'AES-128-CBC' #
17
+ # config.data_cipher = 'AES-256-CBC'
18
+ # config.private_key_cipher = config.data_cipher
19
+ # config.compression_enabled = true
20
+ # config.compression_level = Zlib::BEST_COMPRESSION
21
+ # end
22
+ class Configuration
23
+ class << self
24
+ attr_accessor :config
25
+
26
+ def configure
27
+ self.config ||= Configuration.new
28
+ yield config if block_given?
29
+ end
30
+
31
+ def property(name)
32
+ self.config.send(name)
33
+ end
34
+ end
35
+
36
+ attr_accessor :data_cipher, :password_cipher, :private_key_cipher
37
+ attr_accessor :compression_enabled, :compression_level
38
+ end
39
+ end
data/lib/sym/data.rb ADDED
@@ -0,0 +1,23 @@
1
+ require_relative 'errors'
2
+ require 'base64'
3
+ require 'zlib'
4
+
5
+ require_relative 'data/wrapper_struct'
6
+ require_relative 'data/encoder'
7
+ require_relative 'data/decoder'
8
+
9
+ module Sym
10
+ # This module is responsible for taking arbitrary data of any format, and safely compressing
11
+ # the result of `Marshal.dump(data)` using Zlib, and then doing `#urlsafe_encode64` encoding
12
+ # to convert it to a string,
13
+ module Data
14
+ def encode(data, compress = true)
15
+ Encoder.new(data, compress).data_encoded
16
+ end
17
+
18
+ def decode(data_encoded, compress = nil)
19
+ Decoder.new(data_encoded, compress).data
20
+ end
21
+ end
22
+ end
23
+
@@ -0,0 +1,28 @@
1
+ require_relative '../errors'
2
+ require 'base64'
3
+ require 'zlib'
4
+ module Sym
5
+ module Data
6
+ class Decoder
7
+ attr_accessor :data, :data_encoded, :data
8
+
9
+ def initialize(data_encoded, compress)
10
+ self.data_encoded = data_encoded
11
+ self.data = begin
12
+ Base64.urlsafe_decode64(data_encoded)
13
+ rescue
14
+ data_encoded
15
+ end
16
+
17
+ if compress.nil? || compress # auto-guess
18
+ self.data = begin
19
+ Zlib::Inflate.inflate(data)
20
+ rescue Zlib::Error => e
21
+ data
22
+ end
23
+ end
24
+ self.data = Marshal.load(data)
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,24 @@
1
+ require 'base64'
2
+ require 'zlib'
3
+
4
+ require 'sym/errors'
5
+ require 'sym/configuration'
6
+
7
+ module Sym
8
+ module Data
9
+ class Encoder
10
+ attr_accessor :data, :data_encoded
11
+
12
+ def initialize(data, compress)
13
+ self.data = data
14
+ self.data_encoded = Marshal.dump(data)
15
+ self.data_encoded = Zlib::Deflate.deflate(data_encoded, compression_level) if compress
16
+ self.data_encoded = Base64.urlsafe_encode64(data_encoded)
17
+ end
18
+
19
+ def compression_level
20
+ Sym::Configuration.config.compression_level
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,43 @@
1
+ require_relative '../errors'
2
+ module Sym
3
+ module Data
4
+ class WrapperStruct < Struct.new(
5
+ :encrypted_data, # [Blob] Binary encrypted data (possibly compressed)
6
+ :iv, # [String] IV used to encrypt the data
7
+ :cipher_name, # [String] Name of the cipher used
8
+ :salt, # [Integer] For password-encrypted data this is the salt
9
+ :version, # [Integer] Version of the cipher used
10
+ :compress # [Boolean] indicates if compression should be applied
11
+ )
12
+
13
+ VERSION = 1
14
+
15
+ attr_accessor :compressed
16
+
17
+ def initialize(
18
+ encrypted_data:, # [Blob] Binary encrypted data (possibly compressed)
19
+ iv:, # [String] IV used to encrypt the data
20
+ cipher_name:, # [String] Name of the cipher used
21
+ salt: nil, # [Integer] For password-encrypted data this is the salt
22
+ version: VERSION, # [Integer] Version of the cipher used
23
+ compress: Sym::Configuration.config.compression_enabled
24
+ )
25
+ super(encrypted_data, iv, cipher_name, salt, version, compress)
26
+ end
27
+
28
+ def config
29
+ Sym::Configuration.config
30
+ end
31
+
32
+ def serialize
33
+ Marshal.dump(self)
34
+ end
35
+
36
+ def self.deserialize(data)
37
+ Marshal.load(data)
38
+ end
39
+ end
40
+ end
41
+ end
42
+
43
+
@@ -0,0 +1,34 @@
1
+ require 'sym'
2
+ require 'sym/application'
3
+ require 'sym/app/args'
4
+
5
+ module Sym
6
+ # This class provides a convenience wrapper for opening and reading
7
+ # encrypted files as they were regular files, and then possibly writing
8
+ # changes to them later.
9
+
10
+ class EncryptedFile
11
+
12
+ include Sym
13
+
14
+ attr_reader :application, :file, :key_id, :key_type, :app_args
15
+
16
+ def initialize(file:, key_id:, key_type:)
17
+ @file = file
18
+ @key_id = key_id
19
+ @key_type = key_type.to_sym
20
+ @app_args = { file: file, key_type => key_id, decrypt: true }
21
+ @application = Sym::Application.new(self.app_args)
22
+ end
23
+
24
+ def read
25
+ @content = application.execute! unless @content
26
+ @content
27
+ end
28
+
29
+ def write
30
+ Sym::Application.new(file: file, key_type => key_id, encrypt: true, output: file).execute
31
+ end
32
+ end
33
+ end
34
+
data/lib/sym/errors.rb ADDED
@@ -0,0 +1,37 @@
1
+ module Sym
2
+ # All public exceptions of this library are here.
3
+ module Errors
4
+ # Exceptions superclass for this library.
5
+ class Sym::Errors::Error < StandardError; end
6
+
7
+ # No secret has been provided for encryption or decryption
8
+ class InsufficientOptionsError < Sym::Errors::Error; end
9
+
10
+ class PasswordError < Sym::Errors::Error; end
11
+ class PasswordsDontMatch < Sym::Errors::PasswordError; end
12
+ class PasswordTooShort < Sym::Errors::PasswordError; end
13
+
14
+ class EditorExitedAbnormally < Sym::Errors::Error; end
15
+
16
+ class FileNotFound < Sym::Errors::Error; end
17
+
18
+ class DataEncodingVersionMismatch< Sym::Errors::Error; end
19
+
20
+ class KeyError < Sym::Errors::Error; end
21
+ class InvalidEncodingPrivateKey < Sym::Errors::KeyError; end
22
+ class InvalidPasswordPrivateKey < Sym::Errors::KeyError; end
23
+ class NoPrivateKeyFound < Sym::Errors::KeyError; end
24
+
25
+ class KeyChainCommandError < Sym::Errors::Error; end
26
+
27
+ # Method was called on an abstract class. Override such methods in
28
+ # subclasses, and use subclasses for instantiation of objects.
29
+ class AbstractMethodCalled < ArgumentError
30
+ def initialize(method, message = nil)
31
+ super("Abstract method call, on #{method}" + (message || ''))
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+
@@ -0,0 +1,12 @@
1
+ require 'base64'
2
+ require 'sym/cipher_handler'
3
+
4
+ module Sym
5
+ module Extensions
6
+ module ClassMethods
7
+ def self.extended(klass)
8
+ klass.extend Sym::CipherHandler::ClassMethods
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,114 @@
1
+ require 'sym'
2
+ require 'sym/data'
3
+ require 'sym/cipher_handler'
4
+ require 'openssl'
5
+ module Sym
6
+ module Extensions
7
+ # This is the module that is really included in your class
8
+ # when you include +Sym+.
9
+ #
10
+ # The module provides easy access to the encryption configuration
11
+ # via the +#encryption_config+ method, as well as two key
12
+ # methods: +#encr+ and +#decr+.
13
+ #
14
+ # Methods +#encr_password+ and +#decr_password+ provide a good
15
+ # example of how this module can be extended to provide more uses
16
+ # of various ciphers, by calling into the private +_encr+ and +_decr+
17
+ # methods.f
18
+ module InstanceMethods
19
+ include Sym::Data
20
+ include Sym::CipherHandler
21
+
22
+ def encryption_config
23
+ Sym::Configuration.config
24
+ end
25
+
26
+ # Expects key to be a base64 encoded key
27
+ def encr(data, key, iv = nil)
28
+ raise Sym::Errors::NoPrivateKeyFound if key.nil?
29
+ _encr(data, encryption_config.data_cipher, iv) do |cipher_struct|
30
+ cipher_struct.cipher.key = decode_key(key)
31
+ end
32
+ end
33
+
34
+ # Expects key to be a base64 encoded key
35
+ def decr(encrypted_data, key, iv = nil)
36
+ raise Sym::Errors::NoPrivateKeyFound if key.nil?
37
+ _decr(encrypted_data, encryption_config.data_cipher, iv) do |cipher_struct|
38
+ cipher_struct.cipher.key = decode_key(key)
39
+ end
40
+ end
41
+
42
+ def encr_password(data, password, iv = nil)
43
+ _encr(data, encryption_config.password_cipher, iv) do |cipher_struct|
44
+ key, salt = _key_from_password(cipher_struct.cipher, password)
45
+ cipher_struct.cipher.key = key
46
+ cipher_struct.salt = salt
47
+ end
48
+ end
49
+
50
+ def decr_password(encrypted_data, password, iv = nil)
51
+ _decr(encrypted_data, encryption_config.password_cipher, iv) do |cipher_struct|
52
+ key, = _key_from_password(cipher_struct.cipher, password, cipher_struct.salt)
53
+ cipher_struct.cipher.key = key
54
+ end
55
+ end
56
+
57
+ private
58
+
59
+ def decode_key(encoded_key)
60
+ Base64.urlsafe_decode64(encoded_key)
61
+ rescue
62
+ encoded_key
63
+ end
64
+
65
+ def _key_from_password(cipher, password, salt = nil)
66
+ key_len = cipher.key_len
67
+ salt ||= OpenSSL::Random.random_bytes 16
68
+ iter = 20000
69
+ digest = OpenSSL::Digest::SHA256.new
70
+ key = OpenSSL::PKCS5.pbkdf2_hmac(password, salt, iter, key_len, digest)
71
+ return key, salt
72
+ end
73
+
74
+ # Expects key to be a base64 encoded key data
75
+ def _encr(data, cipher_name, iv = nil, &block)
76
+ data, compression_enabled = encode_incoming_data(data)
77
+ cipher_struct = create_cipher(direction: :encrypt,
78
+ cipher_name: cipher_name,
79
+ iv: iv)
80
+
81
+ yield cipher_struct if block_given?
82
+
83
+ encrypted_data = update_cipher(cipher_struct.cipher, data)
84
+ wrapper_struct = WrapperStruct.new(
85
+ encrypted_data: encrypted_data,
86
+ iv: cipher_struct.iv,
87
+ cipher_name: cipher_struct.cipher.name,
88
+ salt: cipher_struct.salt,
89
+ compress: !compression_enabled)
90
+ encode(wrapper_struct, false)
91
+ end
92
+
93
+ # Expects key to be a base64 encoded key data
94
+ def _decr(encoded_data, cipher_name, iv = nil, &block)
95
+ wrapper_struct = decode(encoded_data)
96
+ cipher_struct = create_cipher(cipher_name: cipher_name,
97
+ iv: wrapper_struct.iv,
98
+ direction: :decrypt,
99
+ salt: wrapper_struct.salt)
100
+ yield cipher_struct if block_given?
101
+ decode(update_cipher(cipher_struct.cipher, wrapper_struct.encrypted_data))
102
+ end
103
+
104
+
105
+ def encode_incoming_data(data)
106
+ compression_enabled = !data.respond_to?(:size) || (data.size > 100 && encryption_config.compression_enabled)
107
+ data = encode(data, compression_enabled)
108
+ [data, compression_enabled]
109
+ end
110
+
111
+ end
112
+ end
113
+ end
114
+
data/lib/sym/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sym
2
- VERSION = "0.1.0"
2
+ VERSION = '2.0.0'
3
3
  end
data/sym.gemspec CHANGED
@@ -2,25 +2,44 @@
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'sym/version'
5
-
5
+ BASH_COMPLETION = File.read("#{lib}/../bin/sym.bash-completion")
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "sym"
7
+ spec.name = 'sym'
8
8
  spec.version = Sym::VERSION
9
- spec.authors = ["Konstantin Gredeskoul"]
10
- spec.email = ["kigster@gmail.com"]
9
+ spec.authors = ['Konstantin Gredeskoul']
10
+ spec.email = %w(kigster@gmail.com)
11
11
 
12
- spec.summary = %q{Sym encryption}
13
- spec.description = %q{Sym encryption}
14
- spec.homepage = "https://github.com/kigster/sym"
12
+ spec.summary = %q{Simple tool to encrypt/decrypt data using symmetric aes-256-cbc encryption with a private key and an IV vector}
13
+ spec.description = %q{Store sensitive data safely as encrypted strings or entire files, using symmetric aes-256-cbc encryption/decryption with a secret key and an IV vector, and YAML-friendly base64-encoded encrypted result.}
14
+ spec.homepage = 'https://github.com/kigster/sym'
15
15
 
16
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
- f.match(%r{^(test|spec|features)/})
18
- end
19
- spec.bindir = "exe"
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = 'exe'
20
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
- spec.require_paths = ["lib"]
19
+ spec.require_paths = ['lib']
20
+ spec.required_ruby_version = '>= 2.2'
21
+ spec.post_install_message = "
22
+
23
+ Please copy and paste the following BASH function into your ~/.bashrc or
24
+ equivalent, in order to enable command completion:
25
+
26
+ #{BASH_COMPLETION}
27
+
28
+ Thank you for installing Sym!
29
+ -- KG (github.com/kigster)
30
+ "
31
+
32
+ spec.add_dependency 'colored2', '~> 2.0'
33
+ spec.add_dependency 'slop', '~> 4.3'
34
+ spec.add_dependency 'activesupport'
35
+ spec.add_dependency 'highline', '~> 1.7'
36
+ spec.add_dependency 'clipboard', '~> 1.1'
37
+ spec.add_dependency 'coin', '~> 0.1.8'
22
38
 
23
- spec.add_development_dependency "bundler", "~> 1.13"
24
- spec.add_development_dependency "rake", "~> 10.0"
25
- spec.add_development_dependency "rspec", "~> 3.0"
39
+ spec.add_development_dependency 'aruba'
40
+ spec.add_development_dependency 'codeclimate-test-reporter'
41
+ spec.add_development_dependency 'bundler', '~> 1.12'
42
+ spec.add_development_dependency 'rake', '~> 10.0'
43
+ spec.add_development_dependency 'rspec', '~> 3.0'
44
+ spec.add_development_dependency 'yard', '~> 0.9'
26
45
  end
metadata CHANGED
@@ -1,29 +1,141 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sym
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Gredeskoul
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-10 00:00:00.000000000 Z
11
+ date: 2016-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: colored2
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: slop
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '4.3'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '4.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: activesupport
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: highline
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.7'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.7'
69
+ - !ruby/object:Gem::Dependency
70
+ name: clipboard
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.1'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.1'
83
+ - !ruby/object:Gem::Dependency
84
+ name: coin
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.1.8
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.1.8
97
+ - !ruby/object:Gem::Dependency
98
+ name: aruba
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: codeclimate-test-reporter
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
13
125
  - !ruby/object:Gem::Dependency
14
126
  name: bundler
15
127
  requirement: !ruby/object:Gem::Requirement
16
128
  requirements:
17
129
  - - "~>"
18
130
  - !ruby/object:Gem::Version
19
- version: '1.13'
131
+ version: '1.12'
20
132
  type: :development
21
133
  prerelease: false
22
134
  version_requirements: !ruby/object:Gem::Requirement
23
135
  requirements:
24
136
  - - "~>"
25
137
  - !ruby/object:Gem::Version
26
- version: '1.13'
138
+ version: '1.12'
27
139
  - !ruby/object:Gem::Dependency
28
140
  name: rake
29
141
  requirement: !ruby/object:Gem::Requirement
@@ -52,28 +164,130 @@ dependencies:
52
164
  - - "~>"
53
165
  - !ruby/object:Gem::Version
54
166
  version: '3.0'
55
- description: Sym encryption
167
+ - !ruby/object:Gem::Dependency
168
+ name: yard
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '0.9'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '0.9'
181
+ description: Store sensitive data safely as encrypted strings or entire files, using
182
+ symmetric aes-256-cbc encryption/decryption with a secret key and an IV vector,
183
+ and YAML-friendly base64-encoded encrypted result.
56
184
  email:
57
185
  - kigster@gmail.com
58
- executables: []
186
+ executables:
187
+ - keychain
188
+ - sym
59
189
  extensions: []
60
190
  extra_rdoc_files: []
61
191
  files:
192
+ - ".codeclimate.yml"
193
+ - ".document"
62
194
  - ".gitignore"
63
195
  - ".rspec"
196
+ - ".rubocop.yml"
64
197
  - ".travis.yml"
198
+ - ".yardopts"
65
199
  - Gemfile
200
+ - LICENSE
201
+ - MANAGING-KEYS.md
66
202
  - README.md
67
203
  - Rakefile
68
204
  - bin/console
69
205
  - bin/setup
206
+ - bin/sym.bash-completion
207
+ - exe/keychain
208
+ - exe/sym
70
209
  - lib/sym.rb
210
+ - lib/sym/app.rb
211
+ - lib/sym/app/args.rb
212
+ - lib/sym/app/cli.rb
213
+ - lib/sym/app/commands.rb
214
+ - lib/sym/app/commands/command.rb
215
+ - lib/sym/app/commands/delete_keychain_item.rb
216
+ - lib/sym/app/commands/encrypt_decrypt.rb
217
+ - lib/sym/app/commands/generate_key.rb
218
+ - lib/sym/app/commands/open_editor.rb
219
+ - lib/sym/app/commands/print_key.rb
220
+ - lib/sym/app/commands/show_examples.rb
221
+ - lib/sym/app/commands/show_help.rb
222
+ - lib/sym/app/commands/show_language_examples.rb
223
+ - lib/sym/app/commands/show_version.rb
224
+ - lib/sym/app/input/handler.rb
225
+ - lib/sym/app/keychain.rb
226
+ - lib/sym/app/nlp.rb
227
+ - lib/sym/app/nlp/constants.rb
228
+ - lib/sym/app/nlp/translator.rb
229
+ - lib/sym/app/nlp/usage.rb
230
+ - lib/sym/app/output.rb
231
+ - lib/sym/app/output/base.rb
232
+ - lib/sym/app/output/file.rb
233
+ - lib/sym/app/output/noop.rb
234
+ - lib/sym/app/output/stdout.rb
235
+ - lib/sym/app/password/cache.rb
236
+ - lib/sym/app/private_key/base64_decoder.rb
237
+ - lib/sym/app/private_key/decryptor.rb
238
+ - lib/sym/app/private_key/detector.rb
239
+ - lib/sym/app/private_key/handler.rb
240
+ - lib/sym/app/short_name.rb
241
+ - lib/sym/application.rb
242
+ - lib/sym/cipher_handler.rb
243
+ - lib/sym/configuration.rb
244
+ - lib/sym/data.rb
245
+ - lib/sym/data/decoder.rb
246
+ - lib/sym/data/encoder.rb
247
+ - lib/sym/data/wrapper_struct.rb
248
+ - lib/sym/encrypted_file.rb
249
+ - lib/sym/errors.rb
250
+ - lib/sym/extensions/class_methods.rb
251
+ - lib/sym/extensions/instance_methods.rb
71
252
  - lib/sym/version.rb
72
253
  - sym.gemspec
73
254
  homepage: https://github.com/kigster/sym
74
255
  licenses: []
75
256
  metadata: {}
76
- post_install_message:
257
+ post_install_message: |2
258
+
259
+
260
+ Please copy and paste the following BASH function into your ~/.bashrc or
261
+ equivalent, in order to enable command completion:
262
+
263
+ #!/usr/bin/env bash
264
+ #
265
+ # Sym command line completion
266
+ #
267
+ # © 2015-2016, Konstantin Gredeskoul, https://github.com/kigster/sym
268
+ # MIT LICENSE
269
+ #
270
+
271
+ _sym() {
272
+ local SYM_OPTS SYM_POINTS cur prev
273
+
274
+ cur="${COMP_WORDS[COMP_CWORD]}"
275
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
276
+
277
+ COMPREPLY=()
278
+
279
+ SYM_COMP_OPTIONS=$(sym --dictionary)
280
+ [[ $COMP_CWORD == 1 ]] && SYM_COMP_OPTIONS="${SYM_COMP_OPTIONS} ${SYM_COMMANDS}"
281
+ COMPREPLY=( $(compgen -W "${SYM_COMP_OPTIONS}" -- ${cur}) )
282
+ return 0
283
+ }
284
+
285
+ complete -F _sym sym
286
+
287
+
288
+
289
+ Thank you for installing Sym!
290
+ -- KG (github.com/kigster)
77
291
  rdoc_options: []
78
292
  require_paths:
79
293
  - lib
@@ -81,7 +295,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
295
  requirements:
82
296
  - - ">="
83
297
  - !ruby/object:Gem::Version
84
- version: '0'
298
+ version: '2.2'
85
299
  required_rubygems_version: !ruby/object:Gem::Requirement
86
300
  requirements:
87
301
  - - ">="
@@ -92,5 +306,6 @@ rubyforge_project:
92
306
  rubygems_version: 2.5.1
93
307
  signing_key:
94
308
  specification_version: 4
95
- summary: Sym encryption
309
+ summary: Simple tool to encrypt/decrypt data using symmetric aes-256-cbc encryption
310
+ with a private key and an IV vector
96
311
  test_files: []