certie 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/certie.rb +18 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: abc0197ecfa93b01239a134fdb325a023ec592af745a9e1059c34fc8b73f2590
4
- data.tar.gz: 6d343288fc2d0f87d48f6e9e5d825fada99ec9d991e92bd9fbbe171de8fe6ff7
3
+ metadata.gz: 1a3c56f3a3837a12b682a1f2ff1afe8259c32f62ee6e34873f3ca77a2c503849
4
+ data.tar.gz: e19b2ea7b7a3fa9fe158ea17dbd3972a7fa9cc731b2d88660ce87f69c369646f
5
5
  SHA512:
6
- metadata.gz: 7e5d2109226252edd3bf798ec4979aaaefac17766aa35c515222fca8788a5591d4c3cf33055997f3f01e511d4b808f30dbf1f1b1ed1e20a7513dec9e7d19cdfd
7
- data.tar.gz: 4f01c0f776deaf0e42197b256dd2f34c06bd5c6bfa1b4df88708530428da932d9774c4efc1e5d32011ca17cb8355875bc9fa8a10ecc2277b28f4f982d4d57ac9
6
+ metadata.gz: 5027aa317621f51cf8838b67e62c137f52b9382811ecc3745a05021b92a00e6fae977daae625e5a147987b297ed318da810f9f2f2cd41e959e28725aebbac242
7
+ data.tar.gz: 4c381be9da66e76aa331ed8e5fb70f33374609d585a508a424223e520ce86fef596357aa1f7a9b0f2c589cb2df1188f0a7b7979593adb10677f8dbff2ba4a278
@@ -7,12 +7,21 @@ class CertificateWrapper
7
7
  def self.load_subject_prefix
8
8
  filename = "#{Dir.home}/.certie_subjprefix"
9
9
  if File.exists?(filename)
10
- @@subject_prefix = File.read(filename).chomp!
10
+ @@subject_prefix = File.read(filename).chomp
11
11
  else
12
12
  File.write(filename, @@subject_prefix)
13
13
  end
14
14
  end
15
15
 
16
+ def self.file_cat(output_file, input_array)
17
+ File.open output_file, 'w' do |outfile|
18
+ input_array.each do |iter_infile|
19
+ outfile.write(File.read(iter_infile))
20
+ outfile.write "\n"
21
+ end
22
+ end
23
+ end
24
+
16
25
  def self.get_counter_next
17
26
  serial = 0
18
27
  if File.exists?('serial.txt')
@@ -90,9 +99,12 @@ class CertificateWrapper
90
99
  end
91
100
  end
92
101
 
93
- # TODO: Find an alternative to invoking OpenSSL and cat
102
+ # TODO: Find an alternative to invoking OpenSSL and cat - OpenSSL v2.2.0 seems to have private_to_pem in OpenSSL::PKey
94
103
  `openssl pkcs8 -topk8 -inform pem -in "#{cn}.rsa" -out "#{cn}.key" -nocrypt`
95
- `cat "#{cn}.cert" "#{cn}.key" > "#{cn}.pem"`
104
+
105
+ # TODO: Test replacement of the system call cat with file_cat
106
+ # `cat "#{cn}.cert" "#{cn}.key" > "#{cn}.pem"`
107
+ file_cat "#{cn}.pem", ["#{cn}.cert", "#{cn}.key"]
96
108
  end
97
109
 
98
110
 
@@ -110,3 +122,6 @@ class CertificateWrapper
110
122
  create_certificate cn
111
123
  end
112
124
  end
125
+
126
+ # key = OpenSSL::PKey::RSA.new 2048
127
+ # puts key.private_to_pem
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: certie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katkam Nitin Reddy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-22 00:00:00.000000000 Z
11
+ date: 2020-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: openssl