(Some) EC JKW parameters need left zero byte padding

Issue #5 resolved
Brian Campbell repo owner created an issue

JWA's definition of EC JKW parameters has "The length of this octet string MUST be the full size of a coordinate for the curve specified in the 'crv' parameter." which isn't being done.

For example, for this public key,

"MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQBCCAc9n4N7ZOr_tTu" + "wAOmPKi4qTp5X3su6O3010hxmBYj9zI4u_0dm6UZa0LsjdfvcAET6vH3mEApvGKpDWrRsAA_nJhyQ20ca7Nn0Zvyiq54FfCAblGK7kuduF" + "BTPkxv9eOjiaeGp7V_f3qV1kxS_Il2LY7Tc5l2GSlW-SzYKxgek

the JWK (as of 0.3.4) that jose4j will produce is: {"kty":"EC","x":"AQggHPZ-De2Tq_7U7v8ADpjyouKk6eV97Lujt9NdIcZgWI_cyOLv9HZulGWtC7I3X73ABE-rx95hAKbxiqQ1q0bA","y":"nJhyQ20ca7Nn0Zvyiq54FfCAblGK7kuduFBTPkxv9eOjiaeGp7V_f3qV1kxS_Il2LY7Tc5l2GSlW-SzYKxgek","crv":"P-521"}

but it should produce this:

Notice the y value in the second JWK is left padded with zero bytes to be the full size of the coordinate (66 bytes for P-521).

The text around d is a little different but nets out to the same thing. We need to know or figure out the expected full size and, if the actual integer value doesn't use that many bytes, then left pad it with zeros.

List threads on x and y: http://www.ietf.org/mail-archive/web/jose/current/msg03946.html http://www.ietf.org/mail-archive/web/jose/current/msg03901.html

and d: http://www.ietf.org/mail-archive/web/jose/current/msg03949.html

Spec: http://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-20#section-6.2