ossl_rsa 0.2.0 → 0.3.0
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/lib/ossl_rsa/file_op.rb +18 -5
- data/lib/ossl_rsa/rsa.rb +17 -2
- data/lib/ossl_rsa/version.rb +1 -1
- 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: ac8949541ed64d36f11d126f7981d3fbad99dd14
|
4
|
+
data.tar.gz: 4694f0f07b2e42f76819bfba86a60167e3ec937b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c39aa7e72c211ac4c612fe53e36824f4abc443b2240b5a71a51263f2be41ce10cd449f1d5a40331f14275cb90310b19600e36172b57f98b84ac86c48fb3ee2b9
|
7
|
+
data.tar.gz: 36fdefe2c5826bbd802cf78e8f45c19d52e632906b7ec327eae3cc90015aba74dbfb480a27e6a7fef5e89173ede5f9adda0c44eadde0eba9857f486ae722f0bd
|
data/lib/ossl_rsa/file_op.rb
CHANGED
@@ -24,22 +24,35 @@ module OsslRsa
|
|
24
24
|
def self.save(dir_path, key_pair, mode, add_now=false)
|
25
25
|
|
26
26
|
file_path_pair = create_file_path(dir_path, mode, add_now)
|
27
|
+
|
28
|
+
# save file.
|
29
|
+
save_file(key_pair, file_path_pair, mode)
|
30
|
+
end
|
31
|
+
|
32
|
+
# save file private and public key.
|
33
|
+
# @param [Hash] key_pair. private and public key pair.
|
34
|
+
# @param [Hash] save file path pair. xxx[:private] = private file path, xxx[:public] = public file path.
|
35
|
+
# @param [integer] mode pem or der.
|
36
|
+
# @return [Hash] save file path pair. xxx[:private] = private file path, xxx[:public] = public file path.
|
37
|
+
def self.save_file(key_pair, file_path_pair, mode)
|
38
|
+
|
39
|
+
save_path_pair = file_path_pair
|
27
40
|
write_mode = get_write_mode(mode)
|
28
41
|
|
29
42
|
# save file.
|
30
43
|
unless key_pair[:private].nil?
|
31
|
-
write(
|
44
|
+
write(save_path_pair[:private], write_mode, key_pair[:private])
|
32
45
|
else
|
33
|
-
|
46
|
+
save_path_pair[:private] = nil
|
34
47
|
end
|
35
48
|
|
36
49
|
unless key_pair[:public].nil?
|
37
|
-
write(
|
50
|
+
write(save_path_pair[:public], write_mode, key_pair[:public])
|
38
51
|
else
|
39
|
-
|
52
|
+
save_path_pair[:public] = nil
|
40
53
|
end
|
41
54
|
|
42
|
-
|
55
|
+
save_path_pair
|
43
56
|
end
|
44
57
|
|
45
58
|
# create save file path.
|
data/lib/ossl_rsa/rsa.rb
CHANGED
@@ -123,8 +123,23 @@ module OsslRsa
|
|
123
123
|
save_key_pair = key_pair(mode, cipher, pass)
|
124
124
|
|
125
125
|
# save file.
|
126
|
-
|
127
|
-
|
126
|
+
save_path_pair = OsslRsa::FileOp.save(dir_path, save_key_pair, mode, add_now)
|
127
|
+
save_path_pair
|
128
|
+
end
|
129
|
+
# save file key.
|
130
|
+
# filename is [private.xxx(pem or der)], [public.xxx(pem or der)]
|
131
|
+
# @param [Hash] file_path_pair save file path pair. xxx[:private] = private file path, xxx[:public] = public file path.
|
132
|
+
# @param [integer] mode pem or der.
|
133
|
+
# @param [OpenSSL::Cipher] cipher cipher instance.
|
134
|
+
# @param [String] pass password
|
135
|
+
# @return [Hash] save file path pair. xxx[:private] = private file path, xxx[:public] = public file path.
|
136
|
+
def to_specify_file(file_path_pair, mode, cipher=nil, pass=nil)
|
137
|
+
|
138
|
+
save_key_pair = key_pair(mode, cipher, pass)
|
139
|
+
|
140
|
+
# save file.
|
141
|
+
save_path_pair = OsslRsa::FileOp.save_file(save_key_pair, file_path_pair, mode)
|
142
|
+
save_path_pair
|
128
143
|
end
|
129
144
|
|
130
145
|
# private check.
|
data/lib/ossl_rsa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ossl_rsa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- h.shigemoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|