ich habe eine ähnliche Frage unter Procedure create self aber dieses mal geht es auch darum den
Crypto API Aufruf zu Inegrieren, woebei ich mir nicht sicher bin ob ich das korrekt verstanden habe
http://www.lazarusforum.de/viewtopic.php?f=55&t=9441
Mein Projekt Migräne Tagebuch findet Ihr hier:
http://www.lazarusforum.de/viewtopic.php?f=17&t=9368
Ausgelagerte Procedure:
Code: Alles auswählen
Procedure TForm1.RunOnece_one (Sender: TObject);
var
INI:TINIFile;
fromMail,toMail,smtp,UserName,Passwort,port:String;
Hash: TDCP_ripemd160;
Digest: array[0..19] of byte; // RipeMD-160 produces a 160bit digest (20bytes)
Source: TFileStream;
i: integer;
s: string;
j: integer;
Cipher: TDCP_rc6;
KeyStr: string;
begin
INI := TINIFile.Create('./log/crashreport.ini');
fromMail := INI.ReadString('INIDB','from','');
toMail := INI.ReadString('INIDB','to','');
smtp := INI.ReadString('INIDB','smtp','');
port := INI.ReadString('INIDB','port','');
UserName := INI.ReadString('INIDB','User','');
Passwort := INI.ReadString('INIDB','Password','');
fromMail:='cschaer131@bluewin.ch';
toMail:='cschaer131@bluewin.ch';
smtp:='smtpauth.bluewin.ch';
port:='25';
UserName:='cschaer131';
Passwort:='DaSiStM31NP477W0Rt';
Hash:= TDCP_ripemd160.Create(Self); // create the hash
Hash.Init ;
Hash.UpdateStr(toMail);
Hash.Final(Digest); // produce the digest
Source.Free;
s:= '';
for i:= 0 to 19 do
s:= s + IntToHex(Digest[i],2);
KeyStr:= s;
//if InputQuery('Passphrase','Enter passphrase',KeyStr) then // get the passphrase
begin
Cipher:= TDCP_rc6.Create(Self);
Cipher.InitStr(KeyStr,TDCP_sha1); // initialize the cipher with a hash of the passphrase
for j:= 0 to Memo1.Lines.Count-1 do // encrypt the contents of the memo
Memo1.Lines[j]:= Cipher.EncryptString(Memo1.Lines[j]);
Passwort:=Memo1.Lines[j];
Cipher.Burn;
Cipher.Free;
end;
Writeln('from : '+fromMail);
Writeln('to : '+toMail);
Writeln('smtp : '+smtp);
Writeln('port : '+port);
Writeln('User : '+UserName);
Writeln('Password : '+Passwort);
Readln;
end;
in der INI und das Passwort soll nicht klartext sein.
Aufgerufen wird diese Procedure dann wie im andrenen Post über den aufruf:
Code: Alles auswählen
RunOnece_one(self);
frage ob das geht:
Code: Alles auswählen
if not FileExists('./ini/crashreport.ini') then
RunOnece_one(self);
Vielleicht kann mir jemand von Euch weiter Helfen.
Viele Grüsse
Chris
Source Code zum Projekt
https://github.com/lycaner/Migraene-Tag ... a49ffce97e