1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

jwk: crypto tool: add --alg commandline arg

This commit is contained in:
Andy Green 2019-01-27 16:08:34 +08:00
parent bedc358dde
commit ed4db457c9
2 changed files with 8 additions and 5 deletions

View file

@ -28,6 +28,7 @@ Commandline option|Meaning
-v <curve>|For EC keys, the curve, eg, "P-384"... this implies the key bits
--kid "ID string"|Key identity string
--use "use[ use]"|Key use restriction (mutually exclusive with --key-ops): sig, enc
--alg <alg>|Specify the algorithm the key is designed for, eg "RSA1_5"
--key-ops "op[ op]"|Key valid operations (mutually exclusive with --use): sign, verify, encrypt, decrypt, wrapKey, unwrapKey, deriveKey, deriveBits
-c|Format the jwk as a linebroken C string
--public <filepath>|Only output the full, private key, not the public version first

View file

@ -67,15 +67,14 @@ format_c(int fd, const char *key)
int main(int argc, const char **argv)
{
struct lws_context_creation_info info;
struct lws_context *context;
const char *p;
int result = 0, logs = LLL_USER | LLL_ERR | LLL_WARN | LLL_NOTICE;
int bits = 4096;
enum lws_gencrypto_kty kty = LWS_GENCRYPTO_KTY_RSA;
struct lws_context_creation_info info;
const char *curve = "P-256", *p;
struct lws_context *context;
struct lws_jwk jwk;
int bits = 4096;
char key[32768];
const char *curve = "P-256";
int vl = sizeof(key);
if ((p = lws_cmdline_option(argc, argv, "-d")))
@ -129,6 +128,9 @@ int main(int argc, const char **argv)
if ((p = lws_cmdline_option(argc, argv, "--use")))
lws_jwk_strdup_meta(&jwk, JWK_META_USE, p, strlen(p));
if ((p = lws_cmdline_option(argc, argv, "--alg")))
lws_jwk_strdup_meta(&jwk, JWK_META_ALG, p, strlen(p));
if ((p = lws_cmdline_option(argc, argv, "--key-ops")))
lws_jwk_strdup_meta(&jwk, JWK_META_KEY_OPS, p, strlen(p));