yaml_vault 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: feb23fdc41a0c8b4d2ad603d468c584c33cf275c
4
- data.tar.gz: 6e0248a09212c74ea1fb361e4db929ff00bf1aaa
3
+ metadata.gz: 10122ee4034384fdfb8e7c9d77c5f18a923b94a2
4
+ data.tar.gz: 3b805a5feda21783340cb71855e9b9a48daad551
5
5
  SHA512:
6
- metadata.gz: 05dd4cc17dc4e036065eb14767c9af4d9958261aaeb081952d70c017b50f384845ce86de2e7d0d27d1d9b140b60c68c79e7e2df01e9a7e401170afd6cc534ba2
7
- data.tar.gz: b7a243da6d3573a61131c7d10eebf1ea1d73501d1a1caa1de367ecf1a7d048437dbcffd357a8e8a0bd7ad078a1bb9fe90e3bb6d95b510acf406ee8e796b39a3a
6
+ metadata.gz: b12a970f34f02aa18aa63400b22de1d7a48936110346c693fc93708ea5dde8a5902893eb58b2e7d785ab119c2f0a4e2c3cde77b1067fbd9da35975ae125eac81
7
+ data.tar.gz: 350904118d1b600095a0ac764e02eb9c91b4d441fb983189396f2bcd48b4496988d91921748a4797b7cff2b6a277e4f12e8ccb1e9dbe42ec44951f6d19d59255
data/exe/yaml_vault CHANGED
@@ -14,6 +14,7 @@ class YamlVault::Cli < Thor
14
14
  class_option :cipher, type: :string, desc: "Encrypt cipher (see. OpenSSL::Cipher.ciphers)", default: "aes-256-cbc"
15
15
  class_option :key_len, type: :numeric, desc: "key length of cipher", default: 32
16
16
  class_option :digest, type: :string, desc: "Sign digest algorithm (see. OpenSSL::Digest.constants)", default: "SHA256"
17
+ class_option :signature_key_len, type: :numeric, desc: "key length of signature", default: 64
17
18
  class_option :use_sign_passphrase, type: :boolean, default: false
18
19
 
19
20
  class_option :aws_kms_key_id, type: :string
@@ -31,7 +32,8 @@ class YamlVault::Cli < Thor
31
32
  options[:cryptor],
32
33
  passphrase: passphrase,
33
34
  sign_passphrase: sign_passphrase,
34
- salt: options[:salt], cipher: options[:cipher], key_len: options[:key_len], digest: options[:digest],
35
+ salt: options[:salt], cipher: options[:cipher], key_len: options[:key_len],
36
+ digest: options[:digest], signature_key_len: options[:signature_key_len],
35
37
  aws_kms_key_id: options[:aws_kms_key_id],
36
38
  aws_region: options[:aws_region],
37
39
  aws_access_key_id: options[:aws_access_key_id],
@@ -1,3 +1,3 @@
1
1
  module YamlVault
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
data/lib/yaml_vault.rb CHANGED
@@ -17,7 +17,7 @@ module YamlVault
17
17
 
18
18
  def initialize(
19
19
  yaml_content, keys, cryptor_name = nil,
20
- passphrase: nil, sign_passphrase: nil, salt: nil, cipher: "aes-256-cbc", key_len: 32, digest: "SHA256",
20
+ passphrase: nil, sign_passphrase: nil, salt: nil, cipher: "aes-256-cbc", key_len: 32, signature_key_len: 64, digest: "SHA256",
21
21
  aws_kms_key_id: nil, aws_region: nil, aws_access_key_id: nil, aws_secret_access_key: nil
22
22
  )
23
23
  @data = YAML.load(yaml_content)
@@ -28,6 +28,7 @@ module YamlVault
28
28
  @salt = salt.to_s
29
29
  @cipher = cipher
30
30
  @key_len = key_len
31
+ @signature_key_len = signature_key_len
31
32
  @digest = digest
32
33
 
33
34
  @aws_kms_key_id = aws_kms_key_id
@@ -63,11 +64,11 @@ module YamlVault
63
64
  def get_cryptor(name)
64
65
  case name
65
66
  when "simple"
66
- ValueCryptor::Simple.new(@passphrase, @sign_passphrase, @salt, @cipher, @digest, @key_len)
67
+ ValueCryptor::Simple.new(@passphrase, @sign_passphrase, @salt, @cipher, @digest, @key_len, @signature_key_len)
67
68
  when "aws-kms", "kms"
68
69
  ValueCryptor::KMS.new(@aws_kms_key_id, region: @aws_region, aws_access_key_id: @aws_access_key_id, aws_secret_access_key: @aws_secret_access_key)
69
70
  else
70
- ValueCryptor::Simple.new(@passphrase, @sign_passphrase, @salt, @cipher, @digest, @key_len)
71
+ ValueCryptor::Simple.new(@passphrase, @sign_passphrase, @salt, @cipher, @digest, @key_len, @signature_key_len)
71
72
  end
72
73
  end
73
74
 
@@ -112,9 +113,9 @@ module YamlVault
112
113
 
113
114
  module ValueCryptor
114
115
  class Simple
115
- def initialize(passphrase, sign_passphrase, salt, cipher, digest, key_size = 32)
116
+ def initialize(passphrase, sign_passphrase, salt, cipher, digest, key_size = 32, signature_key_size = 64)
116
117
  key = ActiveSupport::KeyGenerator.new(passphrase).generate_key(salt, key_size)
117
- signature_key = ActiveSupport::KeyGenerator.new(sign_passphrase).generate_key(salt, key_size) if sign_passphrase
118
+ signature_key = ActiveSupport::KeyGenerator.new(sign_passphrase).generate_key(salt, signature_key_size) if sign_passphrase
118
119
 
119
120
  if signature_key
120
121
  @cryptor = ActiveSupport::MessageEncryptor.new(key, signature_key, cipher: cipher, digest: digest)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yaml_vault
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - joker1007