# Cryptography used for login and signing transactions

My bank uses a smartcard reader (separate module not connected to the computer) as depicted below:

When I need to log into my account it provides me with a challenge and I need to provide some details:

I need to provide the 8 digits, enter my pin and then it returns an 8 number sequence which is then to be entered after which you are logged in.

A similar mechanism is employed for signing transactions but using the M2 button (blue one) rather than the M1 and instead of a random number you need to first give the amount and then the timestamp. I'm interested in the cryptography used behind it (if it's symmetric, assymetric or a combination of both) and how the signing is actually done.

a user guide can be found here.

-
Mine is completly deterministic (no timestamps at all). I've also noticed it gives two groups of numbers (5432 2222) with the last group being almost always the same. A bit less relevant, the reader can be hacked into an interface for the card so as to mount a power analysis attack. Although a bit localized to the specific model of your bank, good question. –  rath Jul 24 '13 at 14:33
I know it's quite specific, I know other banks use this as well in some form (at least here and in the UK) –  Lucas Kauffman Jul 24 '13 at 14:37
Such short numbers point to symmetric crypto. –  CodesInChaos Jul 28 '13 at 8:25
They are made in various forms by Vasco. I know they are based on an internal clock which is why they are useless if the battery runs out. The timestamp is normally send as part of the signature (I think the first 4 digits on my Rabo random reader). Then there is some kind of hash calculation that somehow depends on the card for security. The safety is mainly achieved because you have to sign for each real time transaction. –  Maarten Bodewes Jul 28 '13 at 10:37

## 1 Answer

While I am not familiar with this particular device or bank, this looks a lot like Chip Authentication Program (CAP)

It's fairly standard in the UK, where banks use this to authenticate initiating a bank transfer to a new recipient. There is a python implementation (for study - it's obviously a bad idea to actually use this, as it would permit your PIN to be captured by malware on your local PC) available at http://sites.uclouvain.be/EMV-CAP/Application/

As I understand the protocol, your smartcard is used to sign a "cancel transaction" request using a shared MAC key (the key being securely stored on the smartcard). There is more information on the protocol at the wikipedia page: https://en.wikipedia.org/wiki/Chip_Authentication_Program#Protocol_details

-