wollte das AESEncoding speichern und laden, bringt die Sache nicht decodiert!
Code: Alles auswählen
; AESEncoder SPECIHERN
;
Global KKeyFile.s = "D:\TESTKEY.txt"
Global *CipheredString   
Global *DecipheredString   
Global String$ = "Hello this is a test for AES"
*CipheredString   = AllocateMemory(Len(String$) + SizeOf(Character)) ; Platz für den null-terminierten String
*DecipheredString = AllocateMemory(Len(String$) + SizeOf(Character)) ; mit seiner abschließenden Null (ASCII-Modus)
If AESEncoder(@String$, *CipheredString, Len(String$), ?Key, 128, 0, #PB_Cipher_ECB)
  Debug "Ciphered: "+PeekS(*CipheredString)
  ; --------------------------
  KeyFile = CreateFile(#PB_Any, KKeyFile)   
  WriteStringN(KeyFile, PeekS(*CipheredString),#PB_Ascii)  
  ; SetFileAttributes(KKeyFile, #PB_FileSystem_ReadOnly)
  CloseFile(KeyFile)   
  ; --------------------------
  AESDecoder(*CipheredString, *DecipheredString, Len(String$), ?Key, 128, 0, #PB_Cipher_ECB)
  Debug "Deciphered: "+PeekS(*DecipheredString)
  ; --------------------------
EndIf
DataSection
  Key:
  Data.b $06, $a9, $21, $40, $36, $b8, $a1, $5b, $51, $2e, $03, $d5, $34, $12, $00, $06
EndDataSection
Code: Alles auswählen
; ------------------------------------------------
; TESTKEY.Key LESEN
; ------------------------------------------------
Global KKEY_FILE.s = "D:\TESTKEY.txt"
; ------------------------------------------------
Global String$
Global *CipheredString 
Global *DecipheredString
; ------------------------------------------------
; wenn die Datei ge?ffnet werden konnte, setzen wir fort...
If ReadFile(0,KKEY_FILE) 
  ; sich wiederholende Schleife bis das Ende der Datei ("end of file") erreicht ist
  While Eof(0) = 0                 
    ; Key Laden
    String$ = ReadString(0,#PB_Ascii)  
  Wend
  CloseFile(0)     
Else
  Beep_(1200,350)
EndIf
; ------------------------------------------------
Debug "String$: "+String$
; ------------------------------------------------
*CipheredString   = AllocateMemory(Len(String$) + SizeOf(Character)) ; Platz für den null-terminierten String
*DecipheredString = AllocateMemory(Len(String$) + SizeOf(Character)) ; mit seiner abschließenden Null (ASCII-Modus)
  ; --------------------------
AESDecoder(*CipheredString, *DecipheredString, StringByteLength(String$) + SizeOf(Character), ?Key, 128, 0, #PB_Cipher_ECB)
Debug "Deciphered: "+PeekS(*DecipheredString)
; ------------------------------------------------
DataSection
  Key:
  Data.b $06, $a9, $21, $40, $36, $b8, $a1, $5b, $51, $2e, $03, $d5, $34, $12, $00, $06
EndDataSection
-Gruss ... Velindos!




