Open martinl opened 7 years ago
Here is a patch, should I create a pull request?
--- ../esteid-dev/esteid.js 2017-04-29 15:46:20.000000000 +0300 +++ esteid.js 2017-04-27 10:59:02.000000000 +0300 @@ -242,8 +242,16 @@ header[0] = chunks.length === 0 ? 0x00 : 0x10 header[4] = chunk.length var cmd = Buffer.concat([header, chunk, Buffer.from([0x00])]) - apdu.check(transmit(cmd)).then(function (r) { - if (chunks.length === 0) { return resolve(apdu.data(r)) } else { return decr() } + // verify PIN1 and decrypt + return eid.verify(eid.PIN1, pin).then(function () { + apdu.check(transmit(cmd)).then(function (r) { + if (chunks.length === 0) { + return resolve(apdu.data(r)) + } + else { + return decr() + } + }) }).catch(function (reason) { console.log('Decryption failed') reject(reason)
Indeed. Please do!
Here is a patch, should I create a pull request?