NAME
DesfireAPI :: Authentification functions
COPYRIGHT
(c) 2009 SpringCard - www.springcard.com
DESCRIPTION
Implementation of the various DESFIRE authentification functions.
NAME
Authenticate
DESCRIPTION
Perform authentication using the specified DES or 3DES key on the currently selected DESFIRE application. This is the legacy function, available even on DESFIRE EV0. The generated session key is afterwards used for non-ISO ciphering or macing.
SYNOPSIS
[[sprox_desfire.dll]] SWORD SPROX_Desfire_Authenticate(BYTE bKeyNumber, const BYTE pbAccessKey[16]); [[sprox_desfire_ex.dll]] SWORD SPROXx_Desfire_Authenticate(SPROX_INSTANCE rInst, BYTE bKeyNumber, const BYTE pbAccessKey[16]); [[pcsc_desfire.dll]] LONG SCardDesfire_Authenticate(SCARDHANDLE hCard, BYTE bKeyNumber, const BYTE pbAccessKey[16]);
INPUTS
BYTE bKeyNumber : number of the key (KeyNo) const BYTE pbAccessKey[16] : 16-byte Access Key (DES/3DES2K keys)
RETURNS
DF_OPERATION_OK : authentication succeed Other code if internal or communication error has occured.
NOTES
Both DES and 3DES keys are stored in strings consisting of 16 bytes : * If the 2nd half of the key string is equal to the 1st half, the key is handled as a single DES key by the DESFIRE card. * If the 2nd half of the key string is NOT equal to the 1st half, the key is handled as a 3DES key.
SEE ALSO
AuthenticateIso24 AuthenticateIso AuthenticateAes ChangeKeySettings GetKeySettings ChangeKey GetKeyVersion
NAME
AuthenticateAes
DESCRIPTION
Perform authentication using the specified AES key on the currently selected DESFIRE application. This function is not available on DESFIRE EV0 cards. The generated session key is afterwards used for ISO ciphering or CMACing.
SYNOPSIS
[[sprox_desfire.dll]] SWORD SPROX_Desfire_AuthenticateAes(BYTE bKeyNumber, const BYTE pbAccessKey[16]); [[sprox_desfire_ex.dll]] SWORD SPROXx_Desfire_AuthenticateAes(SPROX_INSTANCE rInst, BYTE bKeyNumber, const BYTE pbAccessKey[16]); [[pcsc_desfire.dll]] LONG SCardDesfire_AuthenticateAes(SCARDHANDLE hCard, BYTE bKeyNumber, const BYTE pbAccessKey[16]);
INPUTS
BYTE bKeyNumber : number of the key (KeyNo) const BYTE pbAccessKey[16] : 16-byte Access Key (AES)
RETURNS
DF_OPERATION_OK : authentication succeed Other code if internal or communication error has occured.
NOTES
AES keys are always 128-bit long.
SEE ALSO
Authenticate AuthenticateIso24 AuthenticateIso ChangeKeySettings GetKeySettings ChangeKey GetKeyVersion
NAME
AuthenticateIso
DESCRIPTION
Perform authentication using the specified 3DES key on the currently selected DESFIRE application. The generated session key is afterwards used for ISO ciphering or CMACing. This function is not available on DESFIRE EV0 cards.
SYNOPSIS
[[sprox_desfire.dll]] SWORD SPROX_Desfire_AuthenticateIso(BYTE bKeyNumber, const BYTE pbAccessKey[16]); [[sprox_desfire_ex.dll]] SWORD SPROXx_Desfire_AuthenticateIso(SPROX_INSTANCE rInst, BYTE bKeyNumber, const BYTE pbAccessKey[16]); [[pcsc_desfire.dll]] LONG SCardDesfire_AuthenticateIso(SCARDHANDLE hCard, BYTE bKeyNumber, const BYTE pbAccessKey[16]);
INPUTS
BYTE bKeyNumber : number of the key (KeyNo) const BYTE pbAccessKey[16] : 16-byte Access Key (DES/3DES2K keys)
RETURNS
DF_OPERATION_OK : authentication succeed Other code if internal or communication error has occured.
NOTES
Both DES and 3DES keys are stored in strings consisting of 16 bytes : - If the 2nd half of the key string is equal to the 1st half, the 64-bit key is handled as a single DES key by the DESFIRE card (well, actually there are only 56 significant bits). - If the 2nd half of the key string is NOT equal to the 1st half, the key is a 128 bit 3DES key (well, actually there are only 112 significant bits).
SEE ALSO
Authenticate AuthenticateIso24 AuthenticateAes ChangeKeySettings GetKeySettings ChangeKey GetKeyVersion
NAME
AuthenticateIso24
DESCRIPTION
Perform authentication using the specified 3DES key on the currently selected DESFIRE application. The generated session key is afterwards used for ISO ciphering or CMACing. This function is not available on DESFIRE EV0 cards.
SYNOPSIS
[[sprox_desfire.dll]] SWORD SPROX_Desfire_AuthenticateIso24(BYTE bKeyNumber, const BYTE pbAccessKey[24]); [[sprox_desfire_ex.dll]] SWORD SPROXx_Desfire_AuthenticateIso24(SPROX_INSTANCE rInst, BYTE bKeyNumber, const BYTE pbAccessKey[24]); [[pcsc_desfire.dll]] LONG SCardDesfire_AuthenticateIso24(SCARDHANDLE hCard, BYTE bKeyNumber, const BYTE pbAccessKey[24]);
INPUTS
BYTE bKeyNumber : number of the key (KeyNo) const BYTE pbAccessKey[24] : 24-byte Access Key (DES/3DES2K/3DES3K keys)
RETURNS
DF_OPERATION_OK : authentication succeed Other code if internal or communication error has occured.
NOTES
Both DES and 3DES keys are stored in strings consisting of 24 bytes : - If the 2nd third of the key string is equal to the 1st third, the 64-bit key is handled as a single DES key by the DESFIRE card (well, actually there are only 56 significant bits). - If the 2nd third of the key string is NOT equal to the 1st third AND the 3rd third is equal to the 1st third, the key is a 128 bit 3DES key (well, actually there are only 112 significant bits). - Overwise, the key is a 192 bit 3DES key "3DES3K mode" (well, actually (well, actually there are only 168 significant bits).
SEE ALSO
Authenticate AuthenticateIso AuthenticateAes ChangeKeySettings GetKeySettings ChangeKey GetKeyVersion