{"action":"created","issue":{"url":"https://api.github.com/repos/cisco/node-jose/issues/76","repository_url":"https://api.github.com/repos/cisco/node-jose","labels_url":"https://api.github.com/repos/cisco/node-jose/issues/76/labels{/name}","comments_url":"https://api.github.com/repos/cisco/node-jose/issues/76/comments","events_url":"https://api.github.com/repos/cisco/node-jose/issues/76/events","html_url":"https://github.com/cisco/node-jose/issues/76","id":179973754,"number":76,"title":"Does node-jose support RSA-OAEP-256 key encryption algorithm?","user":{"login":"ygc16","id":21053405,"avatar_url":"https://avatars.githubusercontent.com/u/21053405?v=3","gravatar_id":"","url":"https://api.github.com/users/ygc16","html_url":"https://github.com/ygc16","followers_url":"https://api.github.com/users/ygc16/followers","following_url":"https://api.github.com/users/ygc16/following{/other_user}","gists_url":"https://api.github.com/users/ygc16/gists{/gist_id}","starred_url":"https://api.github.com/users/ygc16/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ygc16/subscriptions","organizations_url":"https://api.github.com/users/ygc16/orgs","repos_url":"https://api.github.com/users/ygc16/repos","events_url":"https://api.github.com/users/ygc16/events{/privacy}","received_events_url":"https://api.github.com/users/ygc16/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-29T07:37:18Z","updated_at":"2016-10-03T02:04:17Z","closed_at":null,"body":"Hi,\r\n\r\nDoes _node-jose_ support `RSA-OAEP-256` key encryption algorithm?\r\n\r\nWhen debugging why a test is failing, we found out that the root cause of the problem is this error:\r\n\r\n    Invalid RSAES-OAEP padding.\r\n\r\n**NOTE:** The JWE payload we are trying to decrypt is produced by a Java app that has Oracle's _Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files_.\r\n\r\nThanks in advance,\r\nJacob."},"comment":{"url":"https://api.github.com/repos/cisco/node-jose/issues/comments/251013034","html_url":"https://github.com/cisco/node-jose/issues/76#issuecomment-251013034","issue_url":"https://api.github.com/repos/cisco/node-jose/issues/76","id":251013034,"user":{"login":"ygc16","id":21053405,"avatar_url":"https://avatars.githubusercontent.com/u/21053405?v=3","gravatar_id":"","url":"https://api.github.com/users/ygc16","html_url":"https://github.com/ygc16","followers_url":"https://api.github.com/users/ygc16/followers","following_url":"https://api.github.com/users/ygc16/following{/other_user}","gists_url":"https://api.github.com/users/ygc16/gists{/gist_id}","starred_url":"https://api.github.com/users/ygc16/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ygc16/subscriptions","organizations_url":"https://api.github.com/users/ygc16/orgs","repos_url":"https://api.github.com/users/ygc16/repos","events_url":"https://api.github.com/users/ygc16/events{/privacy}","received_events_url":"https://api.github.com/users/ygc16/received_events","type":"User","site_admin":false},"created_at":"2016-10-03T02:04:17Z","updated_at":"2016-10-03T02:04:17Z","body":"Hi,\r\n\r\nThe content we are trying to decrypt looks like this:\r\n\r\n```json\r\n{\r\n  \"protected\": \"...\",\r\n  \"unprotected\": {},\r\n  \"recipients\": [\r\n    {\r\n      \"header\": {\r\n        \"kid\": \"my-key-id\",\r\n        \"alg\": \"RSA-OAEP-256\"\r\n      },\r\n      \"encrypted_key\": \"...\"\r\n    }\r\n  ],\r\n  \"iv\": \"...\",\r\n  \"ciphertext\": \"...\",\r\n  \"tag\": \"...\"\r\n}\r\n```\r\n\r\nAnd it is encrypted with an RSA 2048 (RSA-256-OAEP) KEK (key encryption key) and AES/256/GCM/NoPadding for CEK (content encryption key).\r\n\r\nWe import the private key using code that is similar to this:\r\n\r\n```javascript\r\nvar privateKey = fs.readFileSync('./test/spec/my-key-id.prv.der');\r\nkeyStore.add(privateKey, 'pkcs8');\r\n```\r\n\r\nAnd then decrypt the JWE payload using:\r\n\r\n```javascript\r\njose.JWE.createDecrypt(keyStore).decrypt(theJsonWebEncryptionStr);\r\n```\r\n\r\nWhich throws the aforementioned key not found error.\r\n\r\nIt is not obvious how we can:\r\n\r\n* Set the KID for the loaded private key\r\n* Set the content encryption algorithm (`AES/256/GCM/NoPadding`)\r\n\r\nDo you have any examples showing how these two tasks can be done?\r\n\r\nThanks,\r\nJacob."}}
{"actor":{"display_login":"ygc16"}}