Skip to content

Instantly share code, notes, and snippets.

@ritou
Created September 10, 2020 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ritou/83ca842350e268be75b44983e80a11fc to your computer and use it in GitHub Desktop.
Save ritou/83ca842350e268be75b44983e80a11fc to your computer and use it in GitHub Desktop.
iex(1)> JOSE.crypto_fallback(true)
:ok
iex(2)> JOSE.JWK.generate_key({:okp, :Ed25519})
%JOSE.JWK{
  fields: %{},
  keys: :undefined,
  kty: {:jose_jwk_kty_okp_ed25519,
   <<162, 30, 40, 233, 122, 159, 105, 49, 218, 101, 29, 205, 178, 236, 20, 132,
     14, 29, 119, 147, 44, 162, 49, 141, 96, 128, 117, 109, 21, 56, 64, 160, 4,
     85, 38, 35, 107, 152, 114, 169, 229, 195, 83, 153, 229, ...>>}
}
iex(3)> JOSE.JWK.generate_key({:okp, :Ed25519ph})
%JOSE.JWK{
  fields: %{},
  keys: :undefined,
  kty: {:jose_jwk_kty_okp_ed25519ph,
   <<55, 88, 172, 95, 11, 143, 175, 88, 189, 206, 60, 236, 143, 84, 241, 177,
     171, 111, 106, 153, 62, 86, 75, 130, 23, 154, 90, 173, 213, 116, 80, 0,
     148, 242, 43, 232, 141, 39, 249, 69, 107, 221, 21, 161, 209, ...>>}
}
iex(4)> JOSE.JWK.generate_key({:okp, :Ed448})    
%JOSE.JWK{
  fields: %{},
  keys: :undefined,
  kty: {:jose_jwk_kty_okp_ed448,
   <<177, 102, 174, 35, 244, 48, 58, 170, 136, 182, 115, 116, 75, 200, 34, 134,
     101, 121, 192, 18, 217, 64, 82, 209, 133, 181, 196, 171, 168, 120, 55, 129,
     130, 164, 20, 35, 43, 136, 232, 228, 82, 29, 140, 78, 78, ...>>}
}
iex(5)> JOSE.JWK.generate_key({:okp, :Ed448ph})
%JOSE.JWK{
  fields: %{},
  keys: :undefined,
  kty: {:jose_jwk_kty_okp_ed448ph,
   <<113, 6, 211, 32, 95, 120, 253, 103, 150, 236, 82, 24, 155, 116, 252, 115,
     43, 198, 85, 245, 69, 87, 17, 219, 117, 66, 54, 36, 187, 218, 70, 215, 217,
     0, 48, 79, 72, 199, 200, 77, 46, 230, 59, 162, 53, ...>>}
}
iex(6)> JOSE.JWK.generate_key({:okp, :X25519}) 
%JOSE.JWK{
  fields: %{},
  keys: :undefined,
  kty: {:jose_jwk_kty_okp_x25519,
   <<160, 219, 156, 233, 1, 124, 33, 35, 51, 112, 48, 189, 127, 1, 102, 132,
     215, 28, 70, 37, 235, 79, 176, 37, 244, 157, 181, 107, 42, 220, 245, 65, 0,
     242, 207, 108, 236, 29, 49, 90, 27, 121, 152, 34, 157, ...>>}
}
iex(7)> JOSE.JWK.generate_key({:okp, :X448})   
%JOSE.JWK{
  fields: %{},
  keys: :undefined,
  kty: {:jose_jwk_kty_okp_x448,
   <<5, 103, 85, 217, 117, 24, 31, 201, 242, 251, 220, 5, 87, 61, 230, 188, 163,
     75, 4, 144, 0, 152, 81, 188, 111, 241, 99, 24, 112, 8, 205, 174, 42, 31,
     50, 223, 159, 152, 19, 30, 107, 198, 224, 209, 224, ...>>}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment