timmerk / cardpeek

Automatically exported from code.google.com/p/cardpeek
Other
1 stars 0 forks source link

card.verify needs P2 parameter #42

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Currently card.verify can only set the P1 parameter. But the OpenPGP card for 
example requires several different values for P2.

The following replacement worked for me:

    function card.verify(pin, p1, p2)
        local command, length

        p1 = p1 or 0x00
        p2 = p2 or 0x00
        pin = bytes.new_from_chars(pin)
        length = #pin
        command = bytes.new(8,card.CLA,0x20,p1,p2,length,pin)
        return card.send(command)
    end

Cardpeek Version: 0.8.2-win32

Original issue reported on code.google.com by ashei...@gmail.com on 6 Apr 2014 at 5:18

GoogleCodeExporter commented 9 years ago
Cool, issue 42 ;-)

Original comment by ashei...@gmail.com on 6 Apr 2014 at 5:20

GoogleCodeExporter commented 9 years ago
Thanks!

Regarding issue "42": I can't guarantee to provide an answer to the "Ultimate 
Question of Life, the Universe, and Everything" but I will integrate your 
suggestion ;-)

card.verify was actually only recently added to cardpeek for the VIVA card in 
Portugal, so it was not extensively tested for completeness/conformance with 
standards. 

Original comment by L...@gmx.com on 7 Apr 2014 at 10:29

GoogleCodeExporter commented 9 years ago
I made the changes in the latest version of SVN (see revision 533).
I will close this issue for now.

Original comment by L...@gmx.com on 27 Apr 2014 at 2:15

GoogleCodeExporter commented 9 years ago

Original comment by L...@gmx.com on 27 Apr 2014 at 2:15