simple-gnupg-keyserver 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/simpleHKP.rb +10 -7
- metadata +2 -2
data/lib/simpleHKP.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'uri'
|
2
2
|
require 'pp'
|
3
|
-
#require 'yaml'
|
4
3
|
require 'fileutils'
|
5
4
|
|
6
5
|
# This code was inspired by:
|
@@ -41,7 +40,7 @@ require 'fileutils'
|
|
41
40
|
|
42
41
|
class SimpleHKP
|
43
42
|
|
44
|
-
VERSION = "1.
|
43
|
+
VERSION = "1.1.0"
|
45
44
|
|
46
45
|
def loadKeys
|
47
46
|
@keyLookupData = Hash.new
|
@@ -57,8 +56,10 @@ class SimpleHKP
|
|
57
56
|
def loadHtml
|
58
57
|
puts "SimpleHKP: loading html partials" if @debug
|
59
58
|
Dir.chdir(@htmlDir) do
|
60
|
-
@headerHtml =
|
61
|
-
@headerHtml << "<
|
59
|
+
@headerHtml = "<html><head>"
|
60
|
+
@headerHtml << " <title>#{@title}</title>\n"
|
61
|
+
@headerHtml << "</head><body class=\"simpleHKP-body\">\n"
|
62
|
+
@headerHtml << "<p><a href=\"/\">#{@title}</a></p>"
|
62
63
|
@headerHtml = File.open('header.html','r').read if
|
63
64
|
File.exists?('header.html')
|
64
65
|
puts @headerHtml if @debug
|
@@ -113,6 +114,7 @@ class SimpleHKP
|
|
113
114
|
#
|
114
115
|
defaultOptions = {
|
115
116
|
'debug' => false,
|
117
|
+
'title' => 'SimpleHKP',
|
116
118
|
'simpleHKPdir' => 'simpleHKP',
|
117
119
|
'keyDir' => 'keys',
|
118
120
|
'mediaDir' => 'media',
|
@@ -136,6 +138,7 @@ class SimpleHKP
|
|
136
138
|
# setup the required variables
|
137
139
|
#
|
138
140
|
@debug = @options['debug']
|
141
|
+
@title = @options['title']
|
139
142
|
@baseDir = @options['simpleHKPdir']
|
140
143
|
@keyDir = @baseDir+'/'+@options['keyDir']
|
141
144
|
@mediaDir = @baseDir+'/'+@options['mediaDir']
|
@@ -330,7 +333,7 @@ class SimpleHKP
|
|
330
333
|
@body << '<h1 class="simpleHKP-keyAsckeyId">Key: '+keyID+'</h1>'
|
331
334
|
@body << '<h2 class="simpleHKP-keyDataTitle">Key data:</h2>'
|
332
335
|
@body << '<pre class="simpleHKP-keyData">'
|
333
|
-
@body << @keyLookupData[keyFile]
|
336
|
+
@body << @keyLookupData[keyFile].gsub(/\\x3a/,':')
|
334
337
|
@body << '</pre>'
|
335
338
|
@body << '<h2 class="simpleHKP-keyAscTitle">Key contents:</h2>'
|
336
339
|
@body << '<pre class="simpleHKP-keyAsc">'
|
@@ -350,7 +353,7 @@ class SimpleHKP
|
|
350
353
|
@keyLookupData[keyFile].each_line do | aLine |
|
351
354
|
next unless aLine =~ /^pub/
|
352
355
|
keyData = aLine.split(/:/)
|
353
|
-
keyInfo.push(keyData[9]) # -1 = user ID
|
356
|
+
keyInfo.push(keyData[9].gsub(/\\x3a/,':')) # -1 = user ID
|
354
357
|
keyInfo.push(keyData[4]) # 0 = key ID
|
355
358
|
keyInfo.push(keyData[3]) # 1 = key type (algorithm)
|
356
359
|
keyInfo.push(keyData[2]) # 2 = key length
|
@@ -378,7 +381,7 @@ class SimpleHKP
|
|
378
381
|
#
|
379
382
|
keys = Array.new
|
380
383
|
@keyLookupData.each_pair do | aKeyFile, keyData |
|
381
|
-
next unless keyData =~ searchRegexp
|
384
|
+
next unless keyData.gsub(/\\x3a/,':') =~ searchRegexp
|
382
385
|
puts "FOUND #{aKeyFile} (#{keyData})" if @debug
|
383
386
|
keys.push(aKeyFile)
|
384
387
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-gnupg-keyserver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-03-
|
12
|
+
date: 2015-03-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rdoc
|