encrypting dbf files

User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: encrypting dbf files

Post by Enrico Maria Giordano »

James,

are you using latest xHarbour from SVN? Can I see your linker configuration file?

EMG
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: encrypting dbf files

Post by James Bott »

Hunter,

Another question.

Do you know if the SIX driver automatically securely erases the original unencrypted DBF after it encrypts the file? Or, maybe it is encrypted in place (there is no new encrypted copy made)?

James
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: encrypting dbf files

Post by James Bott »

Enrico,
are you using latest xHarbour from SVN? Can I see your linker configuration file?
I am using FWH 13.04 with xHarbour 1.2.3 Intl. (SimpLex) (Build 20130326). I don't know if xHarbour is the latest version.

Also using Borland 5.82.

ilink.cfg contains just this:

-L"c:\bcc582\lib"

I am using buildx.bat to build the test files.

Regards,
James
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: encrypting dbf files

Post by James Bott »

Enrico,

Are you closing the file after encryption, then reopening it? I don't see that happening in your posted code. Maybe that is the issue.

James
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: encrypting dbf files

Post by Enrico Maria Giordano »

James,
James Bott wrote:Enrico,

Are you closing the file after encryption, then reopening it? I don't see that happening in your posted code. Maybe that is the issue.

James
Tried. No changes. My current sample is:

Code: Select all

FUNCTION MAIN()

    USE POLIZZE EXCLUSIVE

    ? SX_DBFENCRYPT( "EMAG" )

    ? SX_TABLETYPE()

    INKEY( 0 )

    RETURN NIL
I don't get the table POLIZZE.DBF encrypted. Can I see the sample you're using?

EMG
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: encrypting dbf files

Post by James Bott »

Enrico,

This is working for me.

Code: Select all

#include "fivewin.ch"

FUNCTION MAIN()

    local cPassword:="EHAB"

    USE xcustomer EXCLUSIVE  // unencrypted source

    copy to customer
    use
    use customer   // unencrptyed test file

    ? SX_DBFENCRYPT( cPassword )

    // you must close and then reopen the file
    use
    use customer

    ? SX_TABLETYPE()

    msgInfo(company,"Company - encrypted")

    Sx_SetPass(cPassword)

    msgInfo(company,"Company - decrypted")

    use

    RETURN NIL
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: encrypting dbf files

Post by Enrico Maria Giordano »

James,

I found the culprit: it doesn't work with memo fields. :-(

Can you confirm this?

EMG
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Re: encrypting dbf files

Post by TimStone »

I'm very interested in this thread. However, we have some other considerations.

Many of us are now working with Harbour / MSVC 2012. Antonio has been encouraging people to move up to the newer compilers. The functions you are testing and working with are only valid with xHarbour.

James, you are using the old command style for testing these files, but how well will this work with data objects ?

Regarding ADS. That's a good option for those people who use the ADS Server. However, in my tests, I'm seeing much better performance on a network ( peer to peer ) when using DBFCDX instead of the ADS Local server. I have both available, so I technically could use the ADS option ( I think ), but then I may get performance hits from people using LOCAL.

I would appreciate if you would consider these issues as you discuss the options. I, also, am finding a need to encrypt my data. With all the "integration" I find people accessing my databases without caution. When they crash the databases, they tell the client its all my fault and I should repair them. It makes for rough situations.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: encrypting dbf files

Post by James Bott »

Tim,

I see no reason it wouldn't work with data objects. We just need to subclass and add the password unlock and possibly a check to make sure the database is encrypted.

When time permits, I will test this to be certain.

James
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: encrypting dbf files

Post by Enrico Maria Giordano »

James,

did you check if the encrypting function works with memo fields? Maybe you missed my message above.

EMG
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: encrypting dbf files

Post by James Bott »

Enrico,
did you check if the encrypting function works with memo fields?
I will try to get to it today.

James
HunterEC
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: encrypting dbf files

Post by HunterEC »

James:

I don't know the encryption algorithm that it uses. It encrypts the records over the old ones, no copy is made. Undelete tools will not recover the unencrypted data.

Enrico:
It does work with memo fields since I've been using it since 1996 in my production apps.

I suggest that you compile a small program that do the initial encryption using the SIX driver and then, and only then, the DBF header will have the 1st byte changed. Afterwards you can use the DBFCDX driver.

If you wish to email me one of your files, I'll happily will try your code with your DBFs.
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: encrypting dbf files

Post by Enrico Maria Giordano »

HunterEC,
HunterEC wrote:Enrico:
It does work with memo fields since I've been using it since 1996 in my production apps.
Great! :-)
HunterEC wrote:I suggest that you compile a small program that do the initial encryption using the SIX driver and then, and only then, the DBF header will have the 1st byte changed. Afterwards you can use the DBFCDX driver.
This is my non-working sample. Please fix it. Use any tables with memo fields and xHarbour. Thank you! :-)

Code: Select all

FUNCTION MAIN()

    USE ANYTABLE EXCLUSIVE

    ? SX_DBFENCRYPT( "EMAG" )

    ? SX_TABLETYPE()

    INKEY( 0 )

    RETURN NIL
EMG
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: encrypting dbf files

Post by James Bott »

Hunter,

The following code is working fine for me without using the SIX RDD. I can confirm that the file is encrypted.

When I attempt to use either VIA SIXCDX or EXTERNAL SIXCDX I get this error:

Error: Unresolved external '_HB_FUN_SIXCDX' referenced

Any ideas? Do we really need this? Is there an include file that I am supposed to be referencing? Do you have a sample program you can share?

James

Code: Select all

// Test Six lib's DBF encryption

#include "fivewin.ch"

FUNCTION MAIN()

   use xcustomer exclusive // source file
   copy to customer        // working file
   use

   USE customer EXCLUSIVE

   ? SX_DBFENCRYPT( "EMAG" )  // returns .t.

   ? SX_TABLETYPE() // returns 2

RETURN NIL
 
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: encrypting dbf files

Post by Enrico Maria Giordano »

James,
James Bott wrote:The following code is working fine for me without using the SIX RDD.
As far as I know, SIXCDX is included in xHarbour's DBFCDX.

EMG
Post Reply