Implement support for encoding of keys to JWK.

Imported from https://youtrack.roxen.com/issue/PIKE-39

Reported by @grubba

When using ACME the client needs to be able to send its public API key to the server as a JWK.

Currently Pike only has support for decoding of JWK.