Implement pinpad support as used by Portugal eID, by João Poupino

git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3744 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
martin 2009-09-25 19:29:38 +00:00
parent 6fd2220311
commit 9a95a40e81
2 changed files with 14 additions and 4 deletions

View File

@ -318,8 +318,9 @@ typedef struct sc_reader {
#define SC_PIN_CMD_CHANGE 1
#define SC_PIN_CMD_UNBLOCK 2
#define SC_PIN_CMD_USE_PINPAD 0x0001
#define SC_PIN_CMD_NEED_PADDING 0x0002
#define SC_PIN_CMD_USE_PINPAD 0x0001
#define SC_PIN_CMD_NEED_PADDING 0x0002
#define SC_PIN_CMD_IMPLICIT_CHANGE 0x0004
#define SC_PIN_ENCODING_ASCII 0
#define SC_PIN_ENCODING_BCD 1

View File

@ -1204,11 +1204,20 @@ static int part10_build_modify_pin_block(u8 * buf, size_t * size, sc_slot_info_t
tmp16 = (data->pin1.min_length << 8 ) + data->pin1.max_length;
pin_modify->wPINMaxExtraDigit = HOST_TO_CCID_16(tmp16); /* Min Max */
pin_modify->bConfirmPIN = 0x03; /* bConfirmPIN, all */
/* bConfirmPIN flags
* 0x01: New Pin, Confirm Pin
* 0x03: Enter Old Pin, New Pin, Confirm Pin
*/
pin_modify->bConfirmPIN = data->flags & SC_PIN_CMD_IMPLICIT_CHANGE ? 0x01 : 0x03;
pin_modify->bEntryValidationCondition = 0x02; /* bEntryValidationCondition, keypress only */
/* bNumberMessage flags
* 0x02: Messages seen on Pinpad display: New Pin, Confirm Pin
* 0x03: Messages seen on Pinpad display: Enter Old Pin, New Pin, Confirm Pin
* Could be 0xFF too.
*/
if (slot->capabilities & SC_SLOT_CAP_DISPLAY)
pin_modify->bNumberMessage = 0x03; /* 3 messages (because bConfirmPIN = 3), all default. Could be 0xFF too */
pin_modify->bNumberMessage = data->flags & SC_PIN_CMD_IMPLICIT_CHANGE ? 0x02 : 0x03;
else
pin_modify->bNumberMessage = 0x00; /* No messages */