]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/mifarehost.c
CHG: some magic generation1 tags is not following protocol and answers to the "halt...
[proxmark3-svn] / client / mifarehost.c
index d3f4a4cde6f55b64a4c75dfb9dd9dd1c2ecb9e21..dc3b988ae8cddc9367fc3b09ace1a0e454bc6cfa 100644 (file)
@@ -630,3 +630,29 @@ int mfTraceDecode(uint8_t *data_src, int len, bool wantSaveToEmlFile) {
 \r
        return 0;\r
 }\r
+\r
+int tryDecryptWord(uint32_t nt, uint32_t ar_enc, uint32_t at_enc, uint8_t *data, int len){\r
+       /*\r
+       uint32_t nt;      // tag challenge\r
+       uint32_t nr_enc;  // encrypted reader challenge\r
+       uint32_t ar_enc;  // encrypted reader response\r
+       uint32_t at_enc;  // encrypted tag response\r
+       */\r
+\r
+       struct Crypto1State *pcs = NULL;\r
+       \r
+       ks2 = ar_enc ^ prng_successor(nt, 64);\r
+       ks3 = at_enc ^ prng_successor(nt, 96);\r
+       \r
+       PrintAndLog("Decrypting data with:");\r
+       PrintAndLog("      nt: %08x",nt);\r
+       PrintAndLog("  ar_enc: %08x",ar_enc);\r
+       PrintAndLog("  at_enc: %08x",at_enc);\r
+       PrintAndLog("\nEncrypted data: [%s]", sprint_hex(data,len) );\r
+\r
+       pcs = lfsr_recovery64(ks2, ks3);\r
+       mf_crypto1_decrypt(pcs, data, len, FALSE);\r
+       PrintAndLog("Decrypted data: [%s]", sprint_hex(data,len) );\r
+       crypto1_destroy(pcs);\r
+       return 0;\r
+}\r
Impressum, Datenschutz