mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
ADD: @marshmellow42's decrypt crypto-1 method,
ADD: @piwi's latest commit to PM3 Master, aiming at the WDR in "hf mf mifare".
This commit is contained in:
parent
e98572a1e2
commit
3bc7b13d23
6 changed files with 99 additions and 31 deletions
|
@ -634,19 +634,25 @@ int mfTraceDecode(uint8_t *data_src, int len, bool wantSaveToEmlFile) {
|
|||
int tryDecryptWord(uint32_t nt, uint32_t ar_enc, uint32_t at_enc, uint8_t *data, int len){
|
||||
/*
|
||||
uint32_t nt; // tag challenge
|
||||
uint32_t nr_enc; // encrypted reader challenge
|
||||
uint32_t ar_enc; // encrypted reader response
|
||||
uint32_t at_enc; // encrypted tag response
|
||||
*/
|
||||
if (traceCrypto1) {
|
||||
crypto1_destroy(traceCrypto1);
|
||||
}
|
||||
|
||||
struct Crypto1State *pcs = NULL;
|
||||
|
||||
ks2 = ar_enc ^ prng_successor(nt, 64);
|
||||
ks3 = at_enc ^ prng_successor(nt, 96);
|
||||
traceCrypto1 = lfsr_recovery64(ks2, ks3);
|
||||
|
||||
mf_crypto1_decrypt(traceCrypto1, data, len, 0);
|
||||
|
||||
PrintAndLog("Decrypting data with:");
|
||||
PrintAndLog(" nt: %08x",nt);
|
||||
PrintAndLog(" ar_enc: %08x",ar_enc);
|
||||
PrintAndLog(" at_enc: %08x",at_enc);
|
||||
PrintAndLog("\nEncrypted data: [%s]", sprint_hex(data,len) );
|
||||
|
||||
pcs = lfsr_recovery64(ks2, ks3);
|
||||
mf_crypto1_decrypt(pcs, data, len, FALSE);
|
||||
PrintAndLog("Decrypted data: [%s]", sprint_hex(data,len) );
|
||||
crypto1_destroy(traceCrypto1);
|
||||
crypto1_destroy(pcs);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue