encrypting dbf files

Re: encrypting dbf files

Postby Enrico Maria Giordano » Sun Sep 29, 2013 3:44 pm

James,

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

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

Re: encrypting dbf files

Postby James Bott » Sun Sep 29, 2013 3:45 pm

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: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: encrypting dbf files

Postby James Bott » Sun Sep 29, 2013 3:52 pm

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: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: encrypting dbf files

Postby James Bott » Sun Sep 29, 2013 4:00 pm

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
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: encrypting dbf files

Postby Enrico Maria Giordano » Sun Sep 29, 2013 4:15 pm

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  Expand view  RUN
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
Enrico Maria Giordano
 
Posts: 8725
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: encrypting dbf files

Postby James Bott » Sun Sep 29, 2013 6:07 pm

Enrico,

This is working for me.

Code: Select all  Expand view  RUN
#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
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: encrypting dbf files

Postby Enrico Maria Giordano » Sun Sep 29, 2013 6:13 pm

James,

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

Can you confirm this?

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

Re: encrypting dbf files

Postby TimStone » Sun Sep 29, 2013 6:50 pm

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
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2950
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: encrypting dbf files

Postby James Bott » Sun Sep 29, 2013 7:51 pm

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
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: encrypting dbf files

Postby Enrico Maria Giordano » Mon Sep 30, 2013 2:01 pm

James,

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

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

Re: encrypting dbf files

Postby James Bott » Mon Sep 30, 2013 2:38 pm

Enrico,

did you check if the encrypting function works with memo fields?


I will try to get to it today.

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

Re: encrypting dbf files

Postby HunterEC » Tue Oct 01, 2013 5:58 am

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.
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: encrypting dbf files

Postby Enrico Maria Giordano » Tue Oct 01, 2013 8:13 am

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  Expand view  RUN
FUNCTION MAIN()

    USE ANYTABLE EXCLUSIVE

    ? SX_DBFENCRYPT( "EMAG" )

    ? SX_TABLETYPE()

    INKEY( 0 )

    RETURN NIL


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

Re: encrypting dbf files

Postby James Bott » Tue Oct 01, 2013 3:14 pm

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  Expand view  RUN
// 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
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: encrypting dbf files

Postby Enrico Maria Giordano » Tue Oct 01, 2013 3:29 pm

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
User avatar
Enrico Maria Giordano
 
Posts: 8725
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 20 guests