As far as I know, SIXCDX is included in xHarbour's DBFCDX.
That was the conclusion that I came to. Probably Hunter has not tried it recently and thus his statement that you have to use the Six driver to encrypt.
James
As far as I know, SIXCDX is included in xHarbour's DBFCDX.
James Bott wrote:Enrico,
As far as I know, SIXCDX is included in xHarbour's DBFCDX.
That was the conclusion that I came to. Probably Hunter has not tried it recently and thus his statement that you have to use the Six driver to encrypt.
James
Enrico,
I am unable to encrypt memo files too.
Hunter,
Are you perhaps using the original SIX library instead of the xHarbour one?
Maybe memo field encryption has not yet been implemented in the xHarbour version.
James
------------
Description: Sx_Encrypt() and it related function Sx_Decrypt() provide
an easy way to integrate data security to a system. The
encryption engine provides security through the use of a
64-bit (8 byte) security code and multi-adaptive computa-
tion. Multi-adaptive computation ensures a wide uniqueness
within the outputted encrypted string. If a string of all
blanks were encrypted you would see a wide distribution of
characters. This ensures a reasonable amount of security
at a small speed penalty.
Of course, the best way to protect your data is to keep it
away from those who shouldn't have access to it. Protect
your passwords, and don't store them in .DBF files.
This encryption/decryption method is _not_ DES (Data
Encryption Standard) compliant, so it can be used in
programs distributed both in the US and Overseas.
More on encrypted memo fields:
This SIX driver apparently doesn't work with memo files. However, I think we can come up with a workaround. You will need to do something like the following.
1) Create a DBF without a memo field (this can be encrypted using SX_DBFENCRYPT(). There needs to be a primary-key field containing a unique non-blank value. Use the primary key field to link to another DBF containing only a memo field.
2) Create a subclass of TDatabase (or TData) and write new save() and load() methods. In these methods you need to automatically lookup the memo field associated with the original primary-key. Then encrypt or decypt the memo field data as needed.
The above will make everything transparent and automatic.
James
Regarding my previous message, you will also need to add new Append() and Delete() methods. These will need to add and delete records from both files.
James
James, Enrico:
I do encrypt my DBFs with a 16 bit Clipper utility program using the SIX driver. Memos do encrypt. In 32 bit you can encrypt the memo field before storing it with the Sx_encrypt (cPassword) function and that's it (in case that the memo fields does not get encrypted).
HunterEC wrote:James, Enrico:
I do encrypt my DBFs with a 16 bit Clipper utility program using the SIX driver. Memos do encrypt. In 32 bit you can encrypt the memo field before storing it with the Sx_encrypt (cPassword) function and that's it (in case that the memo fields does not get encrypted).
Enrico:
If you can email me (morenoec2007 at hotmail dot com) your program or a sample program and your DBFs, I'll give it a try. Thank you.
HunterEC wrote:Enrico:
If you can email me (morenoec2007 at hotmail dot com) your program or a sample program and your DBFs, I'll give it a try. Thank you.
FUNCTION MAIN()
DBCREATE( "MYTEST", { { "TEST1", "C", 35, 0 },;
{ "TEST2", "M", 10, 0 } } )
USE MYTEST EXCLUSIVE
APPEND BLANK
REPLACE FIELD -> test1 WITH "Test1"
REPLACE FIELD -> test2 WITH "Test2"
CLOSE
USE MYTEST EXCLUSIVE
? SX_DBFENCRYPT( "EMAG" )
? SX_ENCRYPT( "EMAG" )
? SX_TABLETYPE()
CLOSE
INKEY( 0 )
RETURN NILI do encrypt my DBFs with a 16 bit Clipper utility program using the SIX driver. Memos do encrypt. In 32 bit you can encrypt the memo field before storing it with the Sx_encrypt (cPassword) function and that's it (in case that the memo fields does not get encrypted).
James Bott wrote:Do you know why memo field encryption was never implemented in 32bits?
It was a Przemek decision.
//------------------------
Func ENCRYPT( TO_DO )
Local PadBack,Done,Qaz
PadBack := Len(To_Do)
*msginfo( "Padback" )
*msginfo( PadBack )
Done := " "
TO_DO := ALLTRIM(TO_DO)
FOR QAZ := LEN(TO_DO) to 1 STEP -1
DONE := DONE + CHR(ASC(SUBSTR(TO_DO, QAZ, 1)) + 104)
NEXT
*MsgInfo( "In Encrypt" )
*MsgInfo( Done )
*msginfo( Len( Done ))
RETURN( Fill_Out( Done, PadBack ))
//--------------------
Func DENCRYPT( TO_DO )
LOCAL PADBACK := LEN(TO_DO), DONE := " ", QAZ
TO_DO := ALLTRIM(TO_DO)
FOR QAZ := LEN(TO_DO) to 1 STEP -1
DONE := DONE + CHR(ASC(SUBSTR(TO_DO, QAZ, 1)) - 104)
NEXT
RETURN( FILL_OUT(DONE, PADBACK))
//----------------------
Func FILL_OUT( Done, PadBack )
* MsgInfo( "In Fill_Out Pcount")
* msginfo( pcount())
* Msginfo( len( done ))
IF PCOUNT() = 1
PadBack := 80
ELSE
* msginfo( "Initial PadBack" )
* msginfo( PadBack )
IF TYPE("PadBack") = "C"
PadBack := VAL(PadBack)
ENDIF
* PadBack := IIF(PadBack <= 1, 80, PadBack)
If PadBack >= 1
Else
PadBack := 80
Endif
* PadBack := IIF(PadBack < 1, 80, PadBack)
* msginfo( "End PadBack")
* msginfo( PadBack )
ENDIF
*msginfo( "if PadBack <= len(Done)")
*msginfo( PadBack)
*msginfo( len(Done))
IF PadBack <= LEN(Done)
* Msginfo( "Return Done")
* Msginfo( Done )
* msginfo( len(done ))
RETURN(Done)
ENDIF
RETURN(Done + SPACE(PadBack - LEN(Done)))Rick Lipkin wrote:To All
There functions have served me well over the years .. I copied this ( public domain ) code from an old Clipper Tools book some time ago and have modified it from time to time.