|
| SAMDESfireCrypto () |
| Constructor.
|
|
virtual | ~SAMDESfireCrypto () |
| Destructor.
|
|
ByteVector | authenticateHostP1 (std::shared_ptr< DESFireKey > key, ByteVector encRndB, unsigned char keyno) |
|
void | authenticateHostP2 (unsigned char keyno, ByteVector encRndA1, std::shared_ptr< DESFireKey > key) |
|
ByteVector | sam_crc_encrypt (ByteVector d_sessionKey, ByteVector vectordata, std::shared_ptr< DESFireKey > key) const |
|
| DESFireCrypto () |
| Constructor.
|
|
virtual | ~DESFireCrypto () |
| Destructor.
|
|
void | appendDecipherData (const ByteVector &data) |
| Decipher data step 2.
|
|
virtual ByteVector | desfireDecrypt (size_t length) |
| Get the deciphered data into a buffer.
|
|
virtual bool | verifyMAC (bool end, const ByteVector &data) |
| Verify MAC into the buffer.
|
|
virtual ByteVector | generateMAC (unsigned char cmd, const ByteVector &data) |
| Generate MAC for the total buffer.
|
|
virtual ByteVector | desfireEncrypt (const ByteVector &data, const ByteVector ¶m=ByteVector(), bool calccrc=true) |
| Encrypt a buffer for the DESFire card.
|
|
ByteVector | iso_encipherData (bool end, const ByteVector &data, const ByteVector ¶m=ByteVector()) |
|
ByteVector | desfire_iso_encrypt (const ByteVector &key, const ByteVector &data, std::shared_ptr< openssl::OpenSSLSymmetricCipher > cipher, const ByteVector ¶m=ByteVector(), bool calccrc=true) |
| Return data part for the encrypted communication mode for WriteData / WriteRecord.
|
|
ByteVector | desfire_iso_decrypt (const ByteVector &key, const ByteVector &data, std::shared_ptr< openssl::OpenSSLSymmetricCipher > cipher, size_t datalen) |
| Decrypt and verify data part of the decrypted communication mode for ReadData / ReadRecords.
|
|
ByteVector | desfire_iso_decrypt (const ByteVector &data, size_t length) |
| Decrypt and verify data part of the decrypted communication mode for ReadData / ReadRecords.
|
|
ByteVector | desfire_cmac (const ByteVector &key, std::shared_ptr< openssl::OpenSSLSymmetricCipher > cipherMAC, const ByteVector &data) |
| Return data part for the encrypted communication mode.
|
|
ByteVector | desfire_cmac (const ByteVector &data) |
| Return data part for the encrypted communication mode.
|
|
virtual ByteVector | authenticate_PICC1 (unsigned char keyno, ByteVector diversify, const ByteVector &encRndB) |
| Authenticate on the card, step 1 for mutual authentication.
|
|
virtual void | authenticate_PICC2 (unsigned char keyno, const ByteVector &encRndA) |
| Authenticate on the card, step 2 for mutual authentication.
|
|
ByteVector | iso_authenticate_PICC1 (unsigned char keyno, ByteVector diversify, const ByteVector &encRndB, unsigned int randomlen) |
| Authenticate on the card, step 1 for mutual authentication using ISO command.
|
|
void | iso_authenticate_PICC2 (unsigned char keyno, const ByteVector &encRndA1, unsigned int randomlen) |
| Authenticate on the card, step 2 for mutual authentication using ISO command.
|
|
ByteVector | aes_authenticate_PICC1 (unsigned char keyno, ByteVector diversify, const ByteVector &encRndB) |
| Authenticate on the card, step 1 for mutual authentication using AES.
|
|
ByteVector | aes_authenticate_PICC1_GENERIC (unsigned char keyno, const std::shared_ptr< Key > &key, const ByteVector &encRndB) |
|
void | aes_authenticate_PICC2 (unsigned char keyno, const ByteVector &encRndA1) |
| Authenticate on the card, step 2 for mutual authentication using AES.
|
|
void | aes_authenticate_PICC2_GENERIC (unsigned char keyno, const std::shared_ptr< Key > &key, const ByteVector &encRndA1) |
|
void | initBuf () |
| Init buffer for temporised data.
|
|
void | selectApplication (size_t aid) |
| Select an application.
|
|
virtual ByteVector | changeKey_PICC (uint8_t keyno, ByteVector oldKeyDiversify, std::shared_ptr< DESFireKey > newkey, ByteVector newKeyDiversify, unsigned char keysetno=0) |
| Change key into the card.
|
|
void | setCryptoContext (ByteVector identifier) |
|
void | createApplication (int aid, uint8_t maxKeySlotNb, uint8_t maxNbKeys, DESFireKeyType cryptoMethod) |
|
void | setIdentifier (ByteVector identifier) |
|
ByteVector | getIdentifier () const |
|
virtual void | setDefaultKeysAt (std::shared_ptr< Location > location) |
| Set default keys for the type card in memory at a specific location.
|
|
virtual void | setKey (size_t aid, uint8_t keyslot, uint8_t keyno, std::shared_ptr< DESFireKey > key) |
| Set one of the DESFire keys of this profile.
|
|
virtual void | setKeyInAllKeySet (size_t aid, uint8_t keySlotNb, uint8_t nbKeys, std::shared_ptr< DESFireKey > key) |
| Set one of the DESFire keys of this keyset.
|
|
virtual void | clearKeys () |
| Clear all keys in memory.
|
|
std::shared_ptr< DESFireKey > | getKey (uint8_t keyslot, uint8_t keyno) const |
| Get a key in memory from the current application.
|
|
SignatureResult | get_last_signature () const |
|
|
static short | desfire_crc16 (const void *data, size_t dataLength) |
| Calculate ISO14443 Type A compatible CRC-16. This is ITU-T V.41, not ISO 3309. The differences:
|
|
static uint32_t | desfire_crc32 (const void *data, size_t dataLength) |
| Calculate CRC-32.
|
|
static ByteVector | desfire_CBC_send (const ByteVector &key, const ByteVector &iv, const ByteVector &data) |
| Perform DESFire CBC decryption operation, which is used for authentication and data encryption.
|
|
static ByteVector | desfire_CBC_receive (const ByteVector &key, const ByteVector &iv, const ByteVector &data) |
| Perform DESFire CBC "decryption" operation which is used for decrypting data received from DESFire.
|
|
static ByteVector | desfire_CBC_mac (const ByteVector &key, const ByteVector &iv, const ByteVector &data) |
| Perform DESFire CBC encryption operation, which is used for MAC calculation and verification. The algorithm is actually a standard DES CBC. CBC-MAC / ISO 9797-1 MAC Algorithm 1.
|
|
static ByteVector | sam_CBC_send (const ByteVector &key, const ByteVector &iv, const ByteVector &data) |
| Preform standard CBC encryption operation, which is used for DESFire SAM cryptograms.
|
|
static ByteVector | desfire_mac (const ByteVector &key, ByteVector data) |
| Return data with the DESFire MAC attached.
|
|
static ByteVector | desfire_encrypt (const ByteVector &key, ByteVector data, bool calccrc=true) |
| Return data part for the encrypted communication mode for WriteData / WriteRecord.
|
|
static ByteVector | sam_encrypt (const ByteVector &key, ByteVector data) |
| Return data part for the encrypted communication mode for WriteData / WriteRecord.
|
|
static ByteVector | desfire_decrypt (const ByteVector &key, const ByteVector &data, size_t datalen) |
| Decrypt and verify data part of the decrypted communication mode for ReadData / ReadRecords.
|
|
static void | getKey (std::shared_ptr< DESFireKey > key, ByteVector diversify, ByteVector &keydiv) |
| Get key diversified.
|
|
static void | getKeyVersioned (std::shared_ptr< DESFireKey > key, ByteVector &keyversioned) |
| Get DES key versionned.
|
|
static std::shared_ptr< DESFireKey > | getDefaultKey (DESFireKeyType keyType) |
| Get the default key for an algorithm.
|
|
CryptoMethod | d_auth_method |
| The current authentication method.
|
|
std::shared_ptr< openssl::OpenSSLSymmetricCipher > | d_cipher |
| The current cipher.
|
|
unsigned int | d_mac_size |
| The MAC size.
|
|
ByteVector | d_sessionKey |
| The current session key.
|
|
ByteVector | d_authkey |
| The authentication key.
|
|
ByteVector | d_lastIV |
| The last Initialization Vector (DESFire native mode).
|
|
unsigned int | d_currentAid |
| The current Application ID.
|
|
unsigned char | d_currentKeyNo |
| The current Key number.
|
|
std::unique_ptr< IKSCryptoWrapper > | iks_wrapper_ |
|
bool | getKey (size_t aid, uint8_t keyset, uint8_t keyno, ByteVector diversify, ByteVector &keydiv) |
| Get key from memory.
|
|
bool | getKey (uint8_t keyset, uint8_t keyno, ByteVector diversify, ByteVector &keydiv) |
| Get key from memory.
|
|
std::shared_ptr< DESFireKey > | getKey (size_t aid, uint8_t keyslot, uint8_t keyno) const |
| Get one of the DESFire keys of this profile.
|
|
std::map< std::tuple< size_t, uint8_t, uint8_t >, std::shared_ptr< DESFireKey > > | d_keys |
|
ByteVector | d_buf |
| The temporised buffer.
|
|
ByteVector | d_last_left |
| The last left buffer for card command.
|
|
ByteVector | d_rndA |
| The random number A.
|
|
ByteVector | d_rndB |
| The random number B.
|
|
ByteVector | d_identifier |
| The card identifier use for key diversification.
|
|
SAM cryptographic functions.