Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"en-US,en;q\u003d0.5", "gen_ut":1580273272, "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", "oid":{ "oid": "00d206d2b27969cf83df45059058e34d37a47b49", "alias": [ "refs/heads/master"]},"tree": [ { "name": "CMakeLists.txt","mode": "33188", "size":1998}, { "name": "README.md","mode": "33188", "size":3014}, { "name": "key-rsa-4096.private","mode": "33188", "size":3180}, { "name": "key-rsa-4096.pub","mode": "33188", "size":730}, { "name": "main.c","mode": "33188", "size":5965}],"s":{"c":1580273272,"u": 470}} ,{"schema":"libjg2-1", "cid":"2c44f612f4a8df607b33395cbb87461a", "oid":{ "oid": "00d206d2b27969cf83df45059058e34d37a47b49", "alias": [ "refs/heads/master"]},"blobname": "minimal-examples/crypto/minimal-crypto-jwe/README.md", "blob": "# lws minimal example for JWE\n\nDemonstrates how to encrypt and decrypt using JWE and JWK, providing a\ncommandline tool for creating encrypted JWE and decoding them.\n\n## build\n\n```\n $ cmake . \u0026\u0026 make\n```\n\n## usage\n\nStdin is either the plaintext (if encrypting) or JWE (if decrypting).\n\nStdout is either the JWE (if encrypting) or plaintext (if decrypting).\n\nYou must pass a private or public key JWK file in the -k option if encrypting,\nand must pass a private key JWK file in the -k option if decrypting. To be\nclear, for asymmetric keys the public part of the key is required to encrypt,\nand the private part required to decrypt.\n\nFor convenience, a pair of public and private keys are provided,\n`key-rsa-4096.private` and `key-rsa-4096.pub`, these were produced with just\n\n```\n $ lws-crypto-jwk -t RSA -b 4096 --public key-rsa-4096.pub \u003ekey-rsa-4096.private\n```\n\nSimilar keys for EC modes may be produced with\n\n```\n $ lws-crypto-jwk -t EC -v P-256 --public key-ecdh-p-256.pub \u003ekey-ecdh-p-256.private\n```\n\nand for AES (\u0022octet\u0022) symmetric keys\n\n```\n $ lws-crypto-jwk -t OCT -b 128 \u003ekey-aes-128.private\n```\n\nJWEs produced with openssl and mbedtls backends are completely interchangeable.\n\nCommandline option|Meaning\n---|---\n-d \u003cloglevel\u003e|Debug verbosity in decimal, eg, -d15\n-e \u0022\u003ccek cipher alg\u003e \u003cpayload enc alg\u003e\u0022|Encrypt (default is decrypt), eg, -e \u0022RSA1_5 A128CBC-HS256\u0022. For decrypt, the cipher information comes from the input JWE.\n-k \u003cjwk file\u003e|JWK file to encrypt or decrypt with\n-c|Format the JWE as a linebroken C string\n-f|Output flattened representation (instead of compact by default)\n\n```\n $ echo -n \u0022plaintext0123456\u0022 | ./lws-crypto-jwe -k key-rsa-4096.private -e \u0022RSA1_5 A128CBC-HS256\u0022\n[2018/12/19 16:20:25:6519] USER: LWS JWE example tool\n[2018/12/19 16:20:25:6749] NOTICE: Creating Vhost 'default' (serving disabled), 1 protocols, IPv6 off\neyJhbGciOiJSU0ExXzUiLCAiZW5jIjoiQTEyOENCQy1IUzI1NiJ9.ivFr7qzx-pQ4V_edbjpdvR9OwWL9KmojPE2rXQM52oLtW0BtnxZu2_ezqhsAelyIcaworgfobs3u4bslXHMFbeJJjPb5xD0fBDe64OYXZH1NpUGTMJh9Ka4CrJ2B3xhxe7EByGAuGqmluqE0Yezj7rhSw7vlr5JAwuOJ8FaGa8aZ8ldki5G5h_S2Furlbjdcw3Rrxk7mCoMHcLoqzfZtggMPwGAMFogCqcwUo7oSLbBeGaa6hpMbfSysugseWdr8TzObQKPM52k6iVAlGwRaOg_qdLMgZiYRhHA6nFKTQd7XBbNY6qAS8sPuj7Zz344tF3RSfJ0zX_telG71sOtVv5fMpeDU-eCdpOWlCBfu6J6FQfAFu6SJryM4ajGOif09CwFI5qUQ33SOfQfS_M3nqSyd6Vu5M4lsDrb5wK7_XX5gqUwvI9wicf_8WWR-CQomRF-JvEASnA2SIf8QqYfa8R2rP9q6Md4vwO4EZrtxIsMDPsH-4ZEFu7vDjyy09QfIWWsnEb8-UgpVXensgt2m_2bZ76r1VB8-0nZLMwMyEhaH2wra9vX2FWao5UkmNJ7ht300f4_V6QzMFoePpwCvsufWBW6jcQLB-frCWe6uitWaZHEB4LxmNPKzQSz4QwwTKhpF1jNn8Xh1-w1m-2h0gj-oe-S8QBwPveqhPI1p2fI.snuhUTXHNu5mJ6dEPQqg6g.yl36qC4o0GE4nrquQ2YyCg.Vf0MoT7_kUrZdCNWXhq1DQ\n```\n\nNotice the logging is on stderr, and the output alone on stdout.\n\nYou can also pipe the output of the encrypt action directly into the decrypt\naction, eg\n\n```\n $ echo -n \u0022plaintext0123456\u0022 | \u005c\n ./lws-crypto-jwe -k key-rsa-4096.pub -e \u0022RSA1_5 A128CBC-HS256\u0022 | \u005c\n ./lws-crypto-jwe -k key-rsa-4096.private\n```\n\nprints the plaintext on stdout.\n","s":{"c":1580273272,"u": 222}} ],"g": 2209,"chitpc": 0,"ehitpc": 0, "indexed":0 }