Page 1 of 1

To Antonio:

PostPosted: Thu Jul 04, 2013 8:22 am
by HunterEC
Antonio:

I want to follow your advice to move from xHarbour to Harbour but Harbour does not support the RDD SIX driver. This RDD allows for transparent record and table encryption. Any suggestions ? Thank you.

Re: To Antonio:

PostPosted: Thu Jul 04, 2013 9:50 am
by Antonio Linares
Gustavo,

If there is no source code for the Six RDD, then I would advice not to use it, to avoid future problems.

What Six functionality do you use that DBFCDX RDD does not support ?

Re: To Antonio:

PostPosted: Thu Jul 04, 2013 9:51 am
by Antonio Linares
If you just need the encryption, you could encrypt the data before saving it and later decrypt it when you read it,

Re: To Antonio:

PostPosted: Thu Jul 04, 2013 6:53 pm
by HunterEC
Antonio:

I use it for the encryption. If I am to encrypt the data myself, instead of being done automatically by the driver, I have to change all numeric, date and logical fields to character types so I can store the encrypted values. This will add a lot of overhead to the app and also will make reporting lot much harder to implement. The SIX libraries in xHarbour are: SDE61.DLL & SDECDX61.DLL

For those of us that develop software for health related business encryption is a must due to HIPAA regulations (patient confidentiality).

Maybe it can be incorporated in a future FW release.

Thank you.

Re: To Antonio:

PostPosted: Thu Jul 04, 2013 7:53 pm
by Antonio Linares
Gustavo,

How do you tell Six to activate the encryption ?

Is it a function call ? What syntax ? thanks

Re: To Antonio:

PostPosted: Thu Jul 04, 2013 8:57 pm
by Marc Vanzegbroeck
Antonio,

I use to use the six-driver also when I was still using Clipper5.2e + FW
The syntax to use a password was:
Code: Select all  Expand view
USE myfile SHARED new PASSWORD "MyPassword"

When you did for example:
Code: Select all  Expand view
repl firma with 'Mijn Firma"

it was automaticly encrypted in the DBF.

With xHarbour + FWH I use now
Code: Select all  Expand view
repl firma with sx_encrypt("Mijn Firma","MyPassword")


I use sx_decrypt() to read it again.

Does functions like that are also available with Harbour?

Re: To Antonio:

PostPosted: Fri Jul 05, 2013 3:32 am
by Antonio Linares
Marc,

Harbour provides a very good support for Six. In fact we can do:

#include "hbsix.ch"

USE "customer" PASSWORD "mypass"
Sx_DdfEncrypt()

There is some important info about Six bugs that Przemek detected related to memo fields:
https://groups.google.com/forum/#!searchin/harbour-devel/encrypt/harbour-devel/rY8rn70IBI0/d-HoKNhkWQAJ

When I was adding support for SIX3 encryption to [x]Harbour i blocked
it for tables with memos. I made it intentionally when I found few
serious bugs in SIX3 implementation when tables with memos are encrypted.
I didn't want to replicate them and make [x]Harbour RDDs bug compatible
with SIX3 because SIX3 is corrupting data in some cases.
I left them to the moment when I'll find some spare time to precisely
document SIX3 bugs and differences in new implementation.
Meanwhile I decided to block support for SIX3 encrypted tables with
memos to not have backward compatibility problems with data created
by [x]Harbour RDDs before I'll introduce workarounds for SIX3 bugs.

Re: To Antonio:

PostPosted: Fri Jul 05, 2013 4:57 am
by HunterEC
Antonio:

Marc pointed out the correct syntax via the USE filename VIA SIX PASSWORD "mypassword" (password cannot be greater than 8 chars).
Also this is correct:
Code: Select all  Expand view
USE filename VIA SIX
Sx_SetPass("mypassword")    // this sets the password for the current workarea, can be used to change the default password for a DBF
 


When storing data there's nothing new to do:
Code: Select all  Expand view
REPLACE Field1 WITH cChar, Field2 WITH dDate, etc.
 

And the record is stored in encrypted form.

The DOS/Clipper 5.2e Six driver changes the byte that defines the presence or not of a memo field in the DBF header as follows:
1. CHR(6) - encrypted table (no Memo field)
2. CHR(134) - encrypted table with memo file (.DBT) DBFNDX driver CHR(131) - NO encryption
3. CHR(230) - encrypted table with memo file (.SMT) SIXNSX driver CHR(229) - NO encryption
4. CHR(246) - encrypted table with memo file (.FPT) SIXCDX driver CHR(245) - NO encryption

On the link you provided the PRG is using DBFNSX as the driver. On xHarbour the driver is SIX. Also the person is migrating from 16 bit. Under 16 bit you can define the default block size for memo fields. Maybe that's the cause for data corruption. I think that you, as our guru, should test it with a small program.

Thank you Antonio.

Re: To Antonio:

PostPosted: Fri Jul 05, 2013 4:16 pm
by nageswaragunupudi
I answered your post on sub-grouping in reports.
Mr Antonio is actively attending to the other post.

Re: To Antonio:

PostPosted: Fri Jul 05, 2013 5:31 pm
by James Bott
There is also the possibility of subclassing TDatabase to provide automatic encryption/decryption. All we need to do is modify the Load() and Save() methods to do the encryption and decryption. If your program is already using TDatabase, the new class would just be a plugin replacement. Otherwise you would need to convert to using database object syntax, but this could allow you to eliminate lots of code.

As for this requiring more overhead than the SIX driver, I don't think it would. The encryption/decryption is just being done in a different section of code.

Encryption is something all of us need to be thinking about.

Regards,
James

Re: To Antonio:

PostPosted: Fri Jul 05, 2013 7:40 pm
by Antonio Linares
Gustavo,

What I meant is that as far as I know, you can encrypt/decrypt with any RDD using the syntax, as Harbour seems to support it:

USE "name" VIA "whatever" PASSWORD "mypass"

I have not tested it myself, but thats what I seemed to me

Re: To Antonio:

PostPosted: Wed Jul 10, 2013 4:56 pm
by HunterEC
Antonio:

Does the DBUSEAREA() function supports a password parameter ? I use this function to open files instead of the USE command.
Thank you.

Re: To Antonio:

PostPosted: Wed Jul 10, 2013 6:11 pm
by Enrico Maria Giordano
HunterEC wrote:Antonio:

Does the DBUSEAREA() function supports a password parameter ? I use this function to open files instead of the USE command.
Thank you.


No, you have to use Sx_SetPass() function.

EMG