Einzelnen Beitrag anzeigen

Benutzerbild von joachimd
joachimd

Registriert seit: 17. Feb 2005
Ort: Weitingen
672 Beiträge
 
Delphi 10.4 Sydney
 
#5

Re: Advantage Database Server - Verschlüsselung - Abfragen

  Alt 29. Jan 2008, 14:00
Zitat von BOH:
Öhm, Joachim, ich hab bei AdsTable kein EncryptionPassword, dem ich ein Passwort zuweisen kann... Hab auch nichts ähnliches gefunden...
Ich habe schon lange nicht mehr mit der 6er gearbeitet, sorry. Du hattest mit AdsEnableencryption doch recht und ich lag falsch (habe es mit AdsEncryptTable verwechselt). Wie schön einfach die gute neue Welt doch ist
In meiner Version des ADS TDataset wird das Passwort wie folgt übergeben:

Delphi-Quellcode:
   {* If the user supplied an encryption password, enable encryption now. *}
   if ( FstrEncryptionPassword <> '' ) then
   begin
      {*
      * If the table isn't encrypted, and we call AdsEnableEncryption, it will
      * put the password into the table header, effectively encrypting all new
      * record updates. That is not the desired effect here, so first see if
      * the table is encrypted. Also check to see if encryption is already
      * enabled (which it is if opening a dictionary table) and don't enable
      * it twice.
       *}

      ACECheck( self, ACE.AdsIsTableEncrypted( Result, @usEncrypted ) );
      ACECheck( self, ACE.AdsIsEncryptionEnabled( Result, @usEncryptionEnabled ) );
      if ( ( usEncrypted = ADS_TRUE ) and ( usEncryptionEnabled <> ADS_TRUE ) ) then
         ACECheck( self, ACE.AdsEnableEncryption( Result, PChar(FstrEncryptionPassword) ) );
   end;
Die beiden Variablen sind vom Typ UNSIGNED16, Result ist das zurückzugebende Tabellenhandle (ADSHANDLE). Insgesamt dürfte die Abfrage direkt mit den Komponenten also so aussehen:

Delphi-Quellcode:
  
if (AdsTable1.AdsIsTableEncrypted and not AdsTable1.AdsIsEncryptionEnabled)
  then AdsTable1.AdsEnableEncryption('geheim');
Joachim Dürr
Joachim Dürr Softwareengineering
http://www.jd-engineering.de
  Mit Zitat antworten Zitat