Kimvais
Kimvais

Reputation: 39588

How to send the <keygen> public key to the server?

I have the example html code from W3

<!DOCTYPE html>
<html>
<body>

<form action="/" method="post" id="keygen-form">
  Username: <input type="text" name="usr_name">
   <keygen name="pubkey" challenge="246813579" KEYTYPE="EC"
    KEYPARAMS="secp256r1" id="keygen-form">
  <input type="submit">
</form>

<p><strong>Note:</strong> The keygen tag is not supported in Internet Explorer.</p>

</body>
</html>

However, wjhen posted to server, only field in the form is usr_name Results are the same both on Safari and Chrome.

Any idea how to use this properly?

Upvotes: 0

Views: 279

Answers (2)

jake_feyereisen
jake_feyereisen

Reputation: 739

This question is over a year old, but in case an 85th person views this, <keygen> has been deprecated by Chrome and marked for removal.

Deprecation notice: https://www.chromestatus.com/features/5716060992962560

Intent to Deprecate and Reasons: https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/pX5NbX0Xack/discussion%5B1-25%5D

The second article details some alternatives.

Upvotes: 1

David Mulder
David Mulder

Reputation: 27020

You're right, for reasons unknown to me the EC keytype is not supported/not working on webkit (which both Chrome and Safari are) and the only one I was able to get working in Chrome was the default RSA type. E.g.:

<keygen name="RSA public key" challenge="123456789" KEYTYPE="RSA">

On Firefox however the RSA, DSA and EC are all supported as expected. Especially with new features like this it's a good idea to always check in different browsers (and safari is not worth testing in, as they either support less or the same as Chrome).

And beyond that you should realize that w3schools has nothing to do with w3 and is a terrible source of information. (Just checked their <keygen> page). You are far better of checking <keygen> on MDN, although even that article is a bit limited to my taste.

Upvotes: 1

Related Questions