[fix] sha512 key size is 89

This commit is contained in:
Laurent Peuch 2018-01-03 20:51:12 +01:00
parent 41e2e480bb
commit dae4f16d11

View file

@ -115,7 +115,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].encode('ascii-8bit')) public_key = Base64.decode64(params[:public_key].encode('ascii-8bit'))
unless public_key.length == 24 or public_key.length == 32 unless public_key.length == 24 or public_key.length == 89
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
end end