trocla 0.0.11 → 0.0.12
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 +4 -4
- data/README.md +6 -1
- data/lib/VERSION +1 -1
- data/lib/trocla/formats/x509.rb +20 -3
- data/lib/trocla/util.rb +1 -1
- data/trocla.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aedf1283f7a8f2526fa0fbacc4a528fe1ca7766b
|
4
|
+
data.tar.gz: 65c068af80a674b2a7aa3783398e1949b9b6f099
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 512edf03fd9448678710db03cc436790242263407857a3a60f3daeb316dc397c2543722b0a5a077e8714c16f658a4d090eb7c0bddb7b1715a3d46ea49612a6d9
|
7
|
+
data.tar.gz: 902809c87796656c33b21106a9780fee8d84db92fa8fe92a1e60d543a325dfe7f7b2cb31eb7ff60d44ed1ad57d2fb8365a72d645d0acbcb4cd94ac5fc11bfd9a
|
data/README.md
CHANGED
@@ -127,6 +127,11 @@ Simply build and install the gem.
|
|
127
127
|
|
128
128
|
## Update & Changes
|
129
129
|
|
130
|
+
### to 0.0.12
|
131
|
+
|
132
|
+
1. change from sha1 signature for the x509 format to sha2
|
133
|
+
1. Fix an issue where shellsafe characters might have already been initialized with shell-unsafe characters. Plz review any shell-safe character passwords regarding this problem. See the [fix](https://github.com/duritong/trocla/pull/19) for more information. Thanks [asquelt](https://github.com/asquelt) for the fix.
|
134
|
+
|
130
135
|
### to 0.0.8
|
131
136
|
|
132
137
|
1. be sure to update as well the moneta gem, trocla now uses the official moneta releases and supports current avaiable versions.
|
@@ -147,6 +152,6 @@ Simply build and install the gem.
|
|
147
152
|
|
148
153
|
## Copyright
|
149
154
|
|
150
|
-
Copyright (c)
|
155
|
+
Copyright (c) 2014 mh. See LICENSE.txt for
|
151
156
|
further details.
|
152
157
|
|
data/lib/VERSION
CHANGED
data/lib/trocla/formats/x509.rb
CHANGED
@@ -17,6 +17,7 @@ class Trocla::Formats::X509 < Trocla::Formats::Base
|
|
17
17
|
else
|
18
18
|
raise "You need to pass \"subject\" or \"CN\" as an option to use this format"
|
19
19
|
end
|
20
|
+
hash = options['hash'] || 'sha2'
|
20
21
|
sign_with = options['ca'] || nil
|
21
22
|
keysize = options['keysize'] || 2048
|
22
23
|
serial = options['serial'] || 1
|
@@ -42,14 +43,14 @@ class Trocla::Formats::X509 < Trocla::Formats::Base
|
|
42
43
|
begin
|
43
44
|
subj = OpenSSL::X509::Name.parse(subject)
|
44
45
|
request = mkreq(subj, key.public_key)
|
45
|
-
request.sign(key,
|
46
|
+
request.sign(key, signature(hash))
|
46
47
|
rescue Exception => e
|
47
48
|
raise "Certificate request #{subject} creation failed: #{e.message}"
|
48
49
|
end
|
49
50
|
|
50
51
|
begin
|
51
52
|
csr_cert = mkcert(caserial, request.subject, ca, request.public_key, days, altnames)
|
52
|
-
csr_cert.sign(cakey,
|
53
|
+
csr_cert.sign(cakey, signature(hash))
|
53
54
|
setserial(sign_with, caserial)
|
54
55
|
rescue Exception => e
|
55
56
|
raise "Certificate #{subject} signing failed: #{e.message}"
|
@@ -60,7 +61,7 @@ class Trocla::Formats::X509 < Trocla::Formats::Base
|
|
60
61
|
begin
|
61
62
|
subj = OpenSSL::X509::Name.parse(subject)
|
62
63
|
cert = mkcert(serial, subj, nil, key.public_key, days, altnames)
|
63
|
-
cert.sign(key,
|
64
|
+
cert.sign(key, signature(hash))
|
64
65
|
rescue Exception => e
|
65
66
|
raise "Self-signed certificate #{subject} creation failed: #{e.message}"
|
66
67
|
end
|
@@ -72,6 +73,22 @@ class Trocla::Formats::X509 < Trocla::Formats::Base
|
|
72
73
|
|
73
74
|
# nice help: https://gist.github.com/mitfik/1922961
|
74
75
|
|
76
|
+
def signature(hash = 'sha2')
|
77
|
+
if hash == 'sha1'
|
78
|
+
OpenSSL::Digest::SHA1.new
|
79
|
+
elsif hash == 'sha224'
|
80
|
+
OpenSSL::Digest::SHA224.new
|
81
|
+
elsif hash == 'sha2' || hash == 'sha256'
|
82
|
+
OpenSSL::Digest::SHA256.new
|
83
|
+
elsif hash == 'sha384'
|
84
|
+
OpenSSL::Digest::SHA384.new
|
85
|
+
elsif hash == 'sha512'
|
86
|
+
OpenSSL::Digest::SHA512.new
|
87
|
+
else
|
88
|
+
raise "Unrecognized hash: #{hash}"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
75
92
|
def mkkey(len)
|
76
93
|
OpenSSL::PKey::RSA.generate(len)
|
77
94
|
end
|
data/lib/trocla/util.rb
CHANGED
@@ -27,7 +27,7 @@ class Trocla
|
|
27
27
|
@chars ||= shellsafe + special_chars
|
28
28
|
end
|
29
29
|
def shellsafe
|
30
|
-
@
|
30
|
+
@shellsafe ||= alphanumeric + shellsafe_chars
|
31
31
|
end
|
32
32
|
def alphanumeric
|
33
33
|
@alphanumeric ||= ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a
|
data/trocla.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: trocla 0.0.
|
5
|
+
# stub: trocla 0.0.12 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "trocla"
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.12"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["mh"]
|
14
|
-
s.date = "2014-
|
14
|
+
s.date = "2014-12-25"
|
15
15
|
s.description = "Trocla helps you to generate random passwords and to store them in various formats (plain, MD5, bcrypt) for later retrival."
|
16
16
|
s.email = "mh+trocla@immerda.ch"
|
17
17
|
s.executables = ["trocla"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trocla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: moneta
|