{"action":"created","issue":{"url":"https://api.github.com/repos/cisco/node-jose/issues/49","repository_url":"https://api.github.com/repos/cisco/node-jose","labels_url":"https://api.github.com/repos/cisco/node-jose/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/cisco/node-jose/issues/49/comments","events_url":"https://api.github.com/repos/cisco/node-jose/issues/49/events","html_url":"https://github.com/cisco/node-jose/issues/49","id":142688269,"number":49,"title":"JWS decrypt with wrong recipient key rejects with 'no key found'","user":{"login":"skoni","id":354972,"avatar_url":"https://avatars.githubusercontent.com/u/354972?v=3","gravatar_id":"","url":"https://api.github.com/users/skoni","html_url":"https://github.com/skoni","followers_url":"https://api.github.com/users/skoni/followers","following_url":"https://api.github.com/users/skoni/following{/other_user}","gists_url":"https://api.github.com/users/skoni/gists{/gist_id}","starred_url":"https://api.github.com/users/skoni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skoni/subscriptions","organizations_url":"https://api.github.com/users/skoni/orgs","repos_url":"https://api.github.com/users/skoni/repos","events_url":"https://api.github.com/users/skoni/events{/privacy}","received_events_url":"https://api.github.com/users/skoni/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-22T15:37:04Z","updated_at":"2016-04-04T11:14:58Z","closed_at":"2016-04-04T11:14:58Z","body":"If there is an error during the algorithm unwrap promise in decrypt, it will not lead to rejection of the decryption promise. `processKey` gets passed as the promise error handler. I don't understand if the intention here was to recursively call `processKey` until one key succeeds. Or if it was to run it only once, then `reject` should be passed as error handler in then of the algPromise here:\r\n\r\nhttps://github.com/cisco/node-jose/blob/master/lib/jwe/decrypt.js#L118-L127\r\n\r\nThe problem is, that errors will not get passed on to the user, e.g. when a recipients keys alg is wrong it will reject with \"no key found\", because `processKey` will run out of recipients and swallow errors."},"comment":{"url":"https://api.github.com/repos/cisco/node-jose/issues/comments/205248364","html_url":"https://github.com/cisco/node-jose/issues/49#issuecomment-205248364","issue_url":"https://api.github.com/repos/cisco/node-jose/issues/49","id":205248364,"user":{"login":"skoni","id":354972,"avatar_url":"https://avatars.githubusercontent.com/u/354972?v=3","gravatar_id":"","url":"https://api.github.com/users/skoni","html_url":"https://github.com/skoni","followers_url":"https://api.github.com/users/skoni/followers","following_url":"https://api.github.com/users/skoni/following{/other_user}","gists_url":"https://api.github.com/users/skoni/gists{/gist_id}","starred_url":"https://api.github.com/users/skoni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skoni/subscriptions","organizations_url":"https://api.github.com/users/skoni/orgs","repos_url":"https://api.github.com/users/skoni/repos","events_url":"https://api.github.com/users/skoni/events{/privacy}","received_events_url":"https://api.github.com/users/skoni/received_events","type":"User","site_admin":false},"created_at":"2016-04-04T11:14:58Z","updated_at":"2016-04-04T11:14:58Z","body":"Thanks for the answer. I'll see if i can add the error reporting."}}