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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3837b5a7b4215e642b02c31dcd47161c9e0c27b6
4
- data.tar.gz: 5bf7b2be6864fb700f81301b97a6f07060dd893c
3
+ metadata.gz: ac8949541ed64d36f11d126f7981d3fbad99dd14
4
+ data.tar.gz: 4694f0f07b2e42f76819bfba86a60167e3ec937b
5
5
  SHA512:
6
- metadata.gz: d6d20e3f2bf9fa55a0ff4de7dbfc5ea429e4eccfc5432a658dd3ac819b5a26d892ad51d2f330ce8cbdd5af63dc297389b29acf5ac9f0f354417330aa50956fd1
7
- data.tar.gz: 470b51541155dbd4753dc89ea71bd27c3fcb2ed3cc481a77c96d1bf18c6e0b056345ce3ed24d62fe1371bc7a56f3b814673f80e4aa1bbda2b3ef1e2dec7fca7b
6
+ metadata.gz: c39aa7e72c211ac4c612fe53e36824f4abc443b2240b5a71a51263f2be41ce10cd449f1d5a40331f14275cb90310b19600e36172b57f98b84ac86c48fb3ee2b9
7
+ data.tar.gz: 36fdefe2c5826bbd802cf78e8f45c19d52e632906b7ec327eae3cc90015aba74dbfb480a27e6a7fef5e89173ede5f9adda0c44eadde0eba9857f486ae722f0bd
@@ -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(file_path_pair[:private], write_mode, key_pair[:private])
44
+ write(save_path_pair[:private], write_mode, key_pair[:private])
32
45
  else
33
- file_path_pair[:private] = nil
46
+ save_path_pair[:private] = nil
34
47
  end
35
48
 
36
49
  unless key_pair[:public].nil?
37
- write(file_path_pair[:public], write_mode, key_pair[:public])
50
+ write(save_path_pair[:public], write_mode, key_pair[:public])
38
51
  else
39
- file_path_pair[:public] = nil
52
+ save_path_pair[:public] = nil
40
53
  end
41
54
 
42
- file_path_pair
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
- file_path_pair = OsslRsa::FileOp.save(dir_path, save_key_pair, mode, add_now)
127
- file_path_pair
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.
@@ -1,3 +1,3 @@
1
1
  module OsslRsa
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
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.2.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-05 00:00:00.000000000 Z
11
+ date: 2016-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler