base64 dns key

This commit is contained in:
Kload 2013-07-07 11:17:58 +00:00
parent 9bbf3af4fa
commit e1f16c3722

View file

@ -72,6 +72,7 @@ end
before path do before path do
if params.has_key?("public_key") if params.has_key?("public_key")
public_key = Base64.decode64(params[:public_key]) public_key = Base64.decode64(params[:public_key])
puts public_key
unless public_key.length == 24 unless public_key.length == 24
halt 400, { :error => "Key is invalid: #{public_key.to_s.encode('UTF-8', {:invalid => :replace, :undef => :replace, :replace => '?'})}" }.to_json halt 400, { :error => "Key is invalid: #{public_key.to_s.encode('UTF-8', {:invalid => :replace, :undef => :replace, :replace => '?'})}" }.to_json
end end