{"schema":"libjg2-1",
"vpath":"/git/",
"avatar":"/git/avatar/",
"alang":"en-US,en;q\u003d0.5",
"gen_ut":1701744253,
"reponame":"libwebsockets",
"desc":"libwebsockets lightweight C networking library",
"owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://libwebsockets.org/repo/libwebsockets",
"f":3,
"items": [
{"schema":"libjg2-1",
"cid":"d692a5c4146cc321c85934618061f589",
"oid":{ "oid": "b391e1141abdb1f46621a67a8f00f0884bf6595a", "alias": [ "refs/heads/main"]},"blobname": "include/libwebsockets/lws-jose.h", "blob": "/*\n * libwebsockets - small server side websockets and web server implementation\n *\n * Copyright (C) 2010 - 2019 Andy Green \u003candy@warmcat.com\u003e\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \u0022Software\u0022), to\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \u0022AS IS\u0022, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nenum lws_jws_jose_hdr_indexes {\n\tLJJHI_ALG,\t/* REQUIRED */\n\tLJJHI_JKU,\t/* Optional: string */\n\tLJJHI_JWK,\t/* Optional: jwk JSON object: public key: */\n\tLJJHI_KID,\t/* Optional: string */\n\tLJJHI_X5U,\t/* Optional: string: url of public key cert / chain */\n\tLJJHI_X5C,\t/* Optional: base64 (NOT -url): actual cert */\n\tLJJHI_X5T,\t/* Optional: base64url: SHA-1 of actual cert */\n\tLJJHI_X5T_S256, /* Optional: base64url: SHA-256 of actual cert */\n\tLJJHI_TYP,\t/* Optional: string: media type */\n\tLJJHI_CTY,\t/* Optional: string: content media type */\n\tLJJHI_CRIT,\t/* Optional for send, REQUIRED: array of strings:\n\t\t\t * mustn't contain standardized strings or null set */\n\n\tLJJHI_RECIPS_HDR,\n\tLJJHI_RECIPS_HDR_ALG,\n\tLJJHI_RECIPS_HDR_KID,\n\tLJJHI_RECIPS_EKEY,\n\n\tLJJHI_ENC,\t/* JWE only: Optional: string */\n\tLJJHI_ZIP,\t/* JWE only: Optional: string (\u0022DEF\u0022 \u003d deflate) */\n\n\tLJJHI_EPK,\t/* Additional arg for JWE ECDH: ephemeral public key */\n\tLJJHI_APU,\t/* Additional arg for JWE ECDH: base64url */\n\tLJJHI_APV,\t/* Additional arg for JWE ECDH: base64url */\n\tLJJHI_IV,\t/* Additional arg for JWE AES: base64url */\n\tLJJHI_TAG,\t/* Additional arg for JWE AES: base64url */\n\tLJJHI_P2S,\t/* Additional arg for JWE PBES2: base64url: salt */\n\tLJJHI_P2C,\t/* Additional arg for JWE PBES2: integer: count */\n\n\tLWS_COUNT_JOSE_HDR_ELEMENTS\n};\n\nenum lws_jose_algtype {\n\tLWS_JOSE_ENCTYPE_NONE,\n\n\tLWS_JOSE_ENCTYPE_RSASSA_PKCS1_1_5,\n\tLWS_JOSE_ENCTYPE_RSASSA_PKCS1_OAEP,\n\tLWS_JOSE_ENCTYPE_RSASSA_PKCS1_PSS,\n\n\tLWS_JOSE_ENCTYPE_ECDSA,\n\tLWS_JOSE_ENCTYPE_ECDHES,\n\n\tLWS_JOSE_ENCTYPE_AES_CBC,\n\tLWS_JOSE_ENCTYPE_AES_CFB128,\n\tLWS_JOSE_ENCTYPE_AES_CFB8,\n\tLWS_JOSE_ENCTYPE_AES_CTR,\n\tLWS_JOSE_ENCTYPE_AES_ECB,\n\tLWS_JOSE_ENCTYPE_AES_OFB,\n\tLWS_JOSE_ENCTYPE_AES_XTS,\t/* care: requires double-length key */\n\tLWS_JOSE_ENCTYPE_AES_GCM,\n};\n\n/* there's a table of these defined in lws-gencrypto-common.c */\n\nstruct lws_jose_jwe_alg {\n\tenum lws_genhash_types hash_type;\n\tenum lws_genhmac_types hmac_type;\n\tenum lws_jose_algtype algtype_signing; /* the signing cipher */\n\tenum lws_jose_algtype algtype_crypto; /* the encryption cipher */\n\tconst char *alg; /* the JWA enc alg name, eg \u0022ES512\u0022 */\n\tconst char *curve_name; /* NULL, or, eg, \u0022P-256\u0022 */\n\tunsigned short keybits_min, keybits_fixed;\n\tunsigned short ivbits;\n};\n\n/*\n * For JWS, \u0022JOSE header\u0022 is defined to be the union of...\n *\n * o JWS Protected Header\n * o JWS Unprotected Header\n *\n * For JWE, the \u0022JOSE header\u0022 is the union of...\n *\n * o JWE Protected Header\n * o JWE Shared Unprotected Header\n * o JWE Per-Recipient Unprotected Header\n */\n\n#define LWS_JWS_MAX_RECIPIENTS 3\n\nstruct lws_jws_recpient {\n\t/*\n\t * JOSE per-recipient unprotected header... for JWS this contains\n\t * protected / header / signature\n\t */\n\tstruct lws_gencrypto_keyelem unprot[LWS_COUNT_JOSE_HDR_ELEMENTS];\n\tstruct lws_jwk jwk_ephemeral;\t/* recipient ephemeral key if any */\n\tstruct lws_jwk jwk;\t\t/* recipient \u0022jwk\u0022 key if any */\n};\n\nstruct lws_jose {\n\t/* JOSE protected and unprotected header elements */\n\tstruct lws_gencrypto_keyelem e[LWS_COUNT_JOSE_HDR_ELEMENTS];\n\n\tstruct lws_jws_recpient recipient[LWS_JWS_MAX_RECIPIENTS];\n\n\tchar typ[32];\n\tchar edone[LWS_COUNT_JOSE_HDR_ELEMENTS];\n\n\t/* information from the protected header part */\n\tconst struct lws_jose_jwe_alg *alg;\n\tconst struct lws_jose_jwe_alg *enc_alg;\n\n\tint recipients; /* count of used recipient[] entries */\n};\n\n/**\n * lws_jose_init() - prepare a struct lws_jose for use\n *\n * \u005cparam jose: the jose header struct to prepare\n */\nLWS_VISIBLE LWS_EXTERN void\nlws_jose_init(struct lws_jose *jose);\n\n/**\n * lws_jose_destroy() - retire a struct lws_jose from use\n *\n * \u005cparam jose: the jose header struct to destroy\n */\nLWS_VISIBLE LWS_EXTERN void\nlws_jose_destroy(struct lws_jose *jose);\n\n/**\n * lws_gencrypto_jws_alg_to_definition() - look up a jws alg name\n *\n * \u005cparam alg: the jws alg name\n * \u005cparam jose: pointer to the pointer to the info struct to set on success\n *\n * Returns 0 if *jose set, else nonzero for failure\n */\nLWS_VISIBLE LWS_EXTERN int\nlws_gencrypto_jws_alg_to_definition(const char *alg,\n\t\t\t\t const struct lws_jose_jwe_alg **jose);\n\n/**\n * lws_gencrypto_jwe_alg_to_definition() - look up a jwe alg name\n *\n * \u005cparam alg: the jwe alg name\n * \u005cparam jose: pointer to the pointer to the info struct to set on success\n *\n * Returns 0 if *jose set, else nonzero for failure\n */\nLWS_VISIBLE LWS_EXTERN int\nlws_gencrypto_jwe_alg_to_definition(const char *alg,\n\t\t\t\t const struct lws_jose_jwe_alg **jose);\n\n/**\n * lws_gencrypto_jwe_enc_to_definition() - look up a jwe enc name\n *\n * \u005cparam alg: the jwe enc name\n * \u005cparam jose: pointer to the pointer to the info struct to set on success\n *\n * Returns 0 if *jose set, else nonzero for failure\n */\nLWS_VISIBLE LWS_EXTERN int\nlws_gencrypto_jwe_enc_to_definition(const char *enc,\n\t\t\t\t const struct lws_jose_jwe_alg **jose);\n\n/**\n * lws_jws_parse_jose() - parse a JWS JOSE header\n *\n * \u005cparam jose: the jose struct to set to parsing results\n * \u005cparam buf: the raw JOSE header\n * \u005cparam len: the length of the raw JOSE header\n * \u005cparam temp: parent-owned buffer to \u0022allocate\u0022 elements into\n * \u005cparam temp_len: amount of space available in temp\n *\n * returns 0 for success, or -1 for error\n * *\u005cp temp_len is updated to reflect the amount of \u005cp temp used if successful.\n */\nLWS_VISIBLE LWS_EXTERN int\nlws_jws_parse_jose(struct lws_jose *jose,\n\t\t const char *buf, int len, char *temp, int *temp_len);\n\n/**\n * lws_jwe_parse_jose() - parse a JWE JOSE header\n *\n * \u005cparam jose: the jose struct to set to parsing results\n * \u005cparam buf: the raw JOSE header\n * \u005cparam len: the length of the raw JOSE header\n * \u005cparam temp: parent-owned buffer to \u0022allocate\u0022 elements into\n * \u005cparam temp_len: amount of space available in temp\n *\n * returns 0 for success, or -1 for error\n * *\u005cp temp_len is updated to reflect the amount of \u005cp temp used if successful.\n */\nLWS_VISIBLE LWS_EXTERN int\nlws_jwe_parse_jose(struct lws_jose *jose,\n\t\t const char *buf, int len, char *temp, int *temp_len);\n\n","s":{"c":1701744253,"u": 364}}
],"g": 3707,"chitpc": 0,"ehitpc": 0,"indexed":0
,
"ab": 1, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}