115: def self.mkhash(dir, cert, certfile)
116:
117: hash = "%08x" % cert.issuer.hash
118: hashpath = nil
119: 10.times { |i|
120: path = File.join(dir, "%s.%s" % [hash, i])
121: if FileTest.exists?(path)
122: if FileTest.symlink?(path)
123: dest = File.readlink(path)
124: if dest == certfile
125:
126: hashpath = path
127: break
128: else
129: next
130: end
131: else
132: next
133: end
134: end
135:
136: File.symlink(certfile, path)
137:
138: hashpath = path
139: break
140: }
141:
142:
143: return hashpath
144: end