{"action":"created","issue":{"url":"https://api.github.com/repos/cisco/node-jose/issues/133","repository_url":"https://api.github.com/repos/cisco/node-jose","labels_url":"https://api.github.com/repos/cisco/node-jose/issues/133/labels{/name}","comments_url":"https://api.github.com/repos/cisco/node-jose/issues/133/comments","events_url":"https://api.github.com/repos/cisco/node-jose/issues/133/events","html_url":"https://github.com/cisco/node-jose/issues/133","id":256671927,"number":133,"title":"alg A128GCMKW encryption/decryption","user":{"login":"panva","id":241506,"avatar_url":"https://avatars3.githubusercontent.com/u/241506?v=4","gravatar_id":"","url":"https://api.github.com/users/panva","html_url":"https://github.com/panva","followers_url":"https://api.github.com/users/panva/followers","following_url":"https://api.github.com/users/panva/following{/other_user}","gists_url":"https://api.github.com/users/panva/gists{/gist_id}","starred_url":"https://api.github.com/users/panva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/panva/subscriptions","organizations_url":"https://api.github.com/users/panva/orgs","repos_url":"https://api.github.com/users/panva/repos","events_url":"https://api.github.com/users/panva/events{/privacy}","received_events_url":"https://api.github.com/users/panva/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-09-11T11:38:04Z","updated_at":"2017-09-11T16:27:13Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Hello @linuxwolf, \r\n\r\ni'm unable to get `A128GCMKW` alg compact JWE to work. Not sure if there's something obvious i'm doing wrong, i would appreciate your help. Should I be including `tag` and `iv` in the header(fields)? It encrypts without `tag` just fine. But i cannot get decrypt to work, even with the same key(store) as shown below.\r\n\r\n```js\r\nconst jose = require('node-jose');\r\nconst format = 'compact';\r\nconst clientKS = jose.JWK.createKeyStore();\r\nconst secret = 'GfsT479VMy5ZZZPquadPbN3wKzaFGYo1CTkb0IFFzDNODLEAuC2GUV3QsTye3xNQ';\r\nconst alg = 'A128GCMKW';\r\nconst base64url = require('base64url');\r\nconst crypto = require('crypto');\r\nconst payload = JSON.stringify({ foo: 'bar' });\r\nconst fields = { alg };\r\n\r\nconst bufferderived = crypto.createHash('sha256')\r\n      .update(secret)\r\n      .digest()\r\n      .slice(0, 128 / 8);\r\n\r\nclientKS.add({\r\n  k: base64url(bufferderived), kty: 'oct',\r\n}).then(() => {\r\n  fields.iv = base64url(crypto.randomBytes(12)); // doesn't encrypt without iv\r\n  fields.tag = base64url(crypto.randomBytes(16)); // does encrypt without tag\r\n  return jose.JWE.createEncrypt({ format, fields }, { key: clientKS.get(), reference: false })\r\n    .update(payload)\r\n    .final();\r\n}).then((crypted) => {\r\n  console.log(crypted)\r\n  return jose.JWE.createDecrypt(clientKS.get()).decrypt(crypted);\r\n}).then(console.log)\r\n\r\n// > Error: no key found\r\n```"},"comment":{"url":"https://api.github.com/repos/cisco/node-jose/issues/comments/328583421","html_url":"https://github.com/cisco/node-jose/issues/133#issuecomment-328583421","issue_url":"https://api.github.com/repos/cisco/node-jose/issues/133","id":328583421,"user":{"login":"linuxwolf","id":757401,"avatar_url":"https://avatars3.githubusercontent.com/u/757401?v=4","gravatar_id":"","url":"https://api.github.com/users/linuxwolf","html_url":"https://github.com/linuxwolf","followers_url":"https://api.github.com/users/linuxwolf/followers","following_url":"https://api.github.com/users/linuxwolf/following{/other_user}","gists_url":"https://api.github.com/users/linuxwolf/gists{/gist_id}","starred_url":"https://api.github.com/users/linuxwolf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linuxwolf/subscriptions","organizations_url":"https://api.github.com/users/linuxwolf/orgs","repos_url":"https://api.github.com/users/linuxwolf/repos","events_url":"https://api.github.com/users/linuxwolf/events{/privacy}","received_events_url":"https://api.github.com/users/linuxwolf/received_events","type":"User","site_admin":false},"created_at":"2017-09-11T16:27:13Z","updated_at":"2017-09-11T16:27:13Z","author_association":"MEMBER","body":"The latter (`p2c` and `p2s`) I expect, and is more an inconvenience than an outright error."}}
{"actor":{"display_login":"linuxwolf"}}