Subject Re: [firebird-support] I want to store encrypted passwords in a VARCHAR(50) field
Author Mark Rotteveel
On 23-11-2012 11:45, Mark Rotteveel wrote:
> On 23-11-2012 00:12, red_october2009 wrote:
>> I am using Delphi 7 and CryptoPressStream. When encrypted, the encrypted string could include "control" type characters that I'm worried could mimic an "End of Record" character.
>>
>> Is there any danger that the encrypted password string, when stored in the DB, could corrupt the table or DB? Should I use a different field type than VARCHAR(50) ?
>>
>> (Not sure if I want to use a BLOB SUB_TYPE 0 field for this... seems overkill)
>>
>> Thanks in advance for any help you can provide.
>
> Just use VARCHAR(50) CHARACTER SET OCTETS. Firebird doesn't actually use
> any 'end of record' characters or other control characters, so that
> isn't an issue. The only problem are with character set conversions,
> that is why you use OCTETS: it is simply all bytes (comparable to the
> VARBINARY types in other database).

As an addendum: if you can't use OCTETS (eg because your connection
library doesn't fully support it), then you can always first base64 it
and store it in a ASCII field (or any other characterset derived from
ASCII), just make sure your field is long enough to support the overhead
of base64.

Mark
--
Mark Rotteveel