10 git_dir = File.join(File.dirname(__FILE__), ".git")
11 if File.directory?(git_dir)
12 head = File.read("#{git_dir}/HEAD").strip.split[-1]
13 @@git_rev = File.read(File.join(git_dir, head))
18 content_type "application/json"
20 result = { :available => true, :protoversion => 1, :server => "MSVA-Ruby 0.00001" }
21 result[:git_revision] = @@git_rev if @@git_rev
26 content_type "application/json"
29 params = JSON.parse(request.body.string)
30 rescue JSON::ParserError
31 halt({ :valid => false, :message => "couldn't parse JSON query"}.to_json)
34 unless (params["pkc"] && params["pkc"]["type"] == "x509der")
35 halt({ :valid => false, :message => "pkc not present or of not-understood type" }.to_json)
38 data = params["pkc"]["data"].pack("C*")
39 pkey = OpenSSL::X509::Certificate.new(data).public_key
41 { :valid => false, :message => "Just testing!!" }.to_json
44 # TODO: fill in if we need to do so
45 # post '/extracerts' do
49 content_type "application/json"
51 { :status => 404, :message => "not found" }.to_json