If you want to save a string encrypted by any means that may have NULL in it, encode and decode the encrypted data as Base64 using the routines in Soap.EncdDecd.pas (EncdDecd.pas in older versions).
And Use the correct encryption, either from Microsoft CryptoAPI, or from embedded Delphi implementations, such as DCPCrypt .
If you store passwords to access your system, consider hashing (and salting) instead. Obviously, if these are passwords for connecting to other systems, you cannot do this.
var B64: string; begin B64 := EncodeString(#6'r'#0'abc'); ADOQuery1.Append; ADOQuery1S.Value := B64; ADOQuery1.Post; end;
source share