Просмотр исходного кода

Correct key calculation for save as SR

Eric Betts 1 год назад
Родитель
Сommit
f65e802ddd
2 измененных файлов с 7 добавлено и 0 удалено
  1. 5 0
      seader_credential.c
  2. 2 0
      seader_credential.h

+ 5 - 0
seader_credential.c

@@ -12,6 +12,7 @@
 
 static const char* seader_file_header = "Flipper Seader Credential";
 static const uint32_t seader_file_version = 1;
+extern const uint8_t picopass_iclass_key[];
 
 SeaderCredential* seader_credential_alloc() {
     SeaderCredential* seader_dev = malloc(sizeof(SeaderCredential));
@@ -394,6 +395,10 @@ bool seader_credential_save_picopass(SeaderCredential* cred, const char* name) {
     bool use_load_path = true;
     bool saved = false;
     bool withSIO = cred->save_format == SeaderCredentialSaveFormatSR;
+    if(withSIO) {
+        loclass_iclass_calc_div_key(cred->diversifier, picopass_iclass_key, debit_key, false);
+    }
+
     FlipperFormat* file = flipper_format_file_alloc(cred->storage);
     FuriString* temp_str = furi_string_alloc();
 

+ 2 - 0
seader_credential.h

@@ -5,6 +5,8 @@
 #include <storage/storage.h>
 #include <dialogs/dialogs.h>
 #include "protocol/picopass_protocol.h"
+#include <optimized_ikeys.h>
+#include <optimized_cipher.h>
 
 #define SEADER_CRED_NAME_MAX_LEN 22
 #define SEADER_APP_EXTENSION     ".credential"