Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #10690 > unrolled thread

Encrypting data in DBF file

Started bysimon@abersoftware.co.uk
First post2017-06-19 01:52 -0700
Last post2017-07-17 13:30 -0700
Articles 13 — 7 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Encrypting data in DBF file simon@abersoftware.co.uk - 2017-06-19 01:52 -0700
    Re: Encrypting data in DBF file "Wolfgang Riedmann" <wriedmann@gmail.com> - 2017-06-19 11:34 +0200
    Re: Encrypting data in DBF file simon@abersoftware.co.uk - 2017-06-19 03:25 -0700
      Re: Encrypting data in DBF file "Wolfgang Riedmann" <wriedmann@gmail.com> - 2017-06-19 14:01 +0200
        Re: Encrypting data in DBF file simon@abersoftware.co.uk - 2017-06-19 05:38 -0700
    Re: Encrypting data in DBF file JohnMartens <martens@tennishulp.info> - 2017-06-19 14:02 +0200
      Re: Encrypting data in DBF file simon@abersoftware.co.uk - 2017-06-19 05:47 -0700
    Re: Encrypting data in DBF file dlzc <dlzc1@cox.net> - 2017-06-19 07:32 -0700
      Re: Encrypting data in DBF file simon@abersoftware.co.uk - 2017-06-19 09:15 -0700
        Re: Encrypting data in DBF file "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2017-06-19 22:46 +0200
    Re: Encrypting data in DBF file "Dirk (Belgium)" <dirk.dot.herijgers@pbprojects.dot.be> - 2017-06-20 08:24 +0000
    Re: Encrypting data in DBF file Martin <Martin@spam.spam> - 2017-06-26 09:27 +0100
    Re: Encrypting data in DBF file simon@abersoftware.co.uk - 2017-07-17 13:30 -0700

#10690 — Encrypting data in DBF file

Fromsimon@abersoftware.co.uk
Date2017-06-19 01:52 -0700
SubjectEncrypting data in DBF file
Message-ID<691ec839-e8ee-4a71-a067-a8c4e1ca70b3@googlegroups.com>
Hi All,

Anyone have any thoughts on best way to encrypt data fields that are stored in DBF file.

The reason is just to stop people looking at the DBF file from outside the application.

My initial thoughts were to subclass DbServer and overwrite the fieldget / fieldput methods to encrypt / decrypt the data. I've created an EncDbServer Class (copy of DbServer from SDK) and updated the Fieldget / Fieldput methods.

I have a StdDataWindow that I open and pass in the EncDbServer object. This doesn't seem to use the fieldget / fieldput methods from the EncDbServer.

Is this the best approach or should I just use my own gather / scatter methods for this data window?

Appreciate any ideas or thoughts on best way to achieve this.

Simon



[toc] | [next] | [standalone]


#10691

From"Wolfgang Riedmann" <wriedmann@gmail.com>
Date2017-06-19 11:34 +0200
Message-ID<eqpk56Fd0tfU1@mid.individual.net>
In reply to#10690
Hi Simon,

you should NOT copy the class from the SDK, but build an own class that
is inherited from the VO DBServer class:

class EncDBServer inherit DBServer

method FieldPut( uField, uValue ) class EncDBServer

	return super:FieldPut( uField, Encrypt( uValue ) )

method FieldGet( uField ) class EncDBServer

	return Decrypt( super:FieldGet( uField ) )

I'm using similar things for many years now, but now I have a big
problem in the migration to .NET as I store binary data in the DBF and
the Vulcan RDD does an automatic Ansi to UTF conversion. Therefore I
would store the encrypted data only after a mime-enconding.

Wolfgang



simon@abersoftware.co.uk wrote:

> Hi All,
> 
> Anyone have any thoughts on best way to encrypt data fields that are
> stored in DBF file.
> 
> The reason is just to stop people looking at the DBF file from
> outside the application.
> 
> My initial thoughts were to subclass DbServer and overwrite the
> fieldget / fieldput methods to encrypt / decrypt the data. I've
> created an EncDbServer Class (copy of DbServer from SDK) and updated
> the Fieldget / Fieldput methods.
> 
> I have a StdDataWindow that I open and pass in the EncDbServer
> object. This doesn't seem to use the fieldget / fieldput methods from
> the EncDbServer.
> 
> Is this the best approach or should I just use my own gather /
> scatter methods for this data window?
> 
> Appreciate any ideas or thoughts on best way to achieve this.
> 
> Simon



-- 

[toc] | [prev] | [next] | [standalone]


#10692

Fromsimon@abersoftware.co.uk
Date2017-06-19 03:25 -0700
Message-ID<b0763f9d-1b58-48e3-923e-49821b5afff1@googlegroups.com>
In reply to#10690
On Monday, June 19, 2017 at 9:52:44 AM UTC+1, si...@abersoftware.co.uk wrote:
> Hi All,
> 
> Anyone have any thoughts on best way to encrypt data fields that are stored in DBF file.
> 
> The reason is just to stop people looking at the DBF file from outside the application.
> 
> My initial thoughts were to subclass DbServer and overwrite the fieldget / fieldput methods to encrypt / decrypt the data. I've created an EncDbServer Class (copy of DbServer from SDK) and updated the Fieldget / Fieldput methods.
> 
> I have a StdDataWindow that I open and pass in the EncDbServer object. This doesn't seem to use the fieldget / fieldput methods from the EncDbServer.
> 
> Is this the best approach or should I just use my own gather / scatter methods for this data window?
> 
> Appreciate any ideas or thoughts on best way to achieve this.
> 
> Simon

Hi Wolfgang,
Thanks for the reply.

I did try that at first and had the same results - the data window methods dont use the fieldget from the dbserver. (I was trying to cut out some of the inheritance to see if I could find out what actual method was bring called.)

I use the bBrowser on the same window and that control behaves properly!

I guess its using a datawindow:fieldget() but have tried catching it there but no luck.

Simon

[toc] | [prev] | [next] | [standalone]


#10693

From"Wolfgang Riedmann" <wriedmann@gmail.com>
Date2017-06-19 14:01 +0200
Message-ID<eqpspmFf00bU1@mid.individual.net>
In reply to#10692
Hi Simon,

then try to use NoIVarGet()/NoIVarPut() methods of the server.

Maybe the StdDataWindow works in a different manner and tries to use
the access/assign variables of the server class.


Wolfgang

simon@abersoftware.co.uk wrote:

> On Monday, June 19, 2017 at 9:52:44 AM UTC+1,
> si...@abersoftware.co.uk wrote:
> > Hi All,
> > 
> > Anyone have any thoughts on best way to encrypt data fields that
> > are stored in DBF file.
> > 
> > The reason is just to stop people looking at the DBF file from
> > outside the application.
> > 
> > My initial thoughts were to subclass DbServer and overwrite the
> > fieldget / fieldput methods to encrypt / decrypt the data. I've
> > created an EncDbServer Class (copy of DbServer from SDK) and
> > updated the Fieldget / Fieldput methods.
> > 
> > I have a StdDataWindow that I open and pass in the EncDbServer
> > object. This doesn't seem to use the fieldget / fieldput methods
> > from the EncDbServer.
> > 
> > Is this the best approach or should I just use my own gather /
> > scatter methods for this data window?
> > 
> > Appreciate any ideas or thoughts on best way to achieve this.
> > 
> > Simon
> 
> Hi Wolfgang,
> Thanks for the reply.
> 
> I did try that at first and had the same results - the data window
> methods dont use the fieldget from the dbserver. (I was trying to cut
> out some of the inheritance to see if I could find out what actual
> method was bring called.)
> 
> I use the bBrowser on the same window and that control behaves
> properly!
> 
> I guess its using a datawindow:fieldget() but have tried catching it
> there but no luck.
> 
> Simon



-- 

[toc] | [prev] | [next] | [standalone]


#10695

Fromsimon@abersoftware.co.uk
Date2017-06-19 05:38 -0700
Message-ID<422251c5-f859-4638-9ec4-d1a34d0eef3d@googlegroups.com>
In reply to#10693
On Monday, June 19, 2017 at 1:02:00 PM UTC+1, Wolfgang Riedmann wrote:
> Hi Simon,
> 
> then try to use NoIVarGet()/NoIVarPut() methods of the server.
> 
> Maybe the StdDataWindow works in a different manner and tries to use
> the access/assign variables of the server class.
> 
> 
> Wolfgang
> 
> simon@abersoftware.co.uk wrote:
> 
> > On Monday, June 19, 2017 at 9:52:44 AM UTC+1,
> > si...@abersoftware.co.uk wrote:
> > > Hi All,
> > > 
> > > Anyone have any thoughts on best way to encrypt data fields that
> > > are stored in DBF file.
> > > 
> > > The reason is just to stop people looking at the DBF file from
> > > outside the application.
> > > 
> > > My initial thoughts were to subclass DbServer and overwrite the
> > > fieldget / fieldput methods to encrypt / decrypt the data. I've
> > > created an EncDbServer Class (copy of DbServer from SDK) and
> > > updated the Fieldget / Fieldput methods.
> > > 
> > > I have a StdDataWindow that I open and pass in the EncDbServer
> > > object. This doesn't seem to use the fieldget / fieldput methods
> > > from the EncDbServer.
> > > 
> > > Is this the best approach or should I just use my own gather /
> > > scatter methods for this data window?
> > > 
> > > Appreciate any ideas or thoughts on best way to achieve this.
> > > 
> > > Simon
> > 
> > Hi Wolfgang,
> > Thanks for the reply.
> > 
> > I did try that at first and had the same results - the data window
> > methods dont use the fieldget from the dbserver. (I was trying to cut
> > out some of the inheritance to see if I could find out what actual
> > method was bring called.)
> > 
> > I use the bBrowser on the same window and that control behaves
> > properly!
> > 
> > I guess its using a datawindow:fieldget() but have tried catching it
> > there but no luck.
> > 
> > Simon
> 
> 
> 
> --

Hi Wolfgang,

That was the answer - NoIvarGet / NoIvarPut.

Well done - and many thanks! I'd never have thought of those!

Now hopefully - with just 4 updated methods I can have an Encrypted DBF and not worry about whether file is encrypted or not in the coding of the system.

Simon

[toc] | [prev] | [next] | [standalone]


#10694

FromJohnMartens <martens@tennishulp.info>
Date2017-06-19 14:02 +0200
Message-ID<oi8e9b$s5m$1@dont-email.me>
In reply to#10690
2 possible and simple solutions:

1 Rename the DBF to another extension, this will prevent dummies 
clicking the file that will open Excel en be able to look into the data

2 Use Truecrypt to crypt the data files in a TC volume. Open TC with the 
right password om the system where your app runs before opening your 
app. Other people will nog be able to open the TC file

John

Op 19-6-2017 om 10:52 schreef simon@abersoftware.co.uk:
> Hi All,
> 
> Anyone have any thoughts on best way to encrypt data fields that are stored in DBF file.
> 
> The reason is just to stop people looking at the DBF file from outside the application.
> 
> My initial thoughts were to subclass DbServer and overwrite the fieldget / fieldput methods to encrypt / decrypt the data. I've created an EncDbServer Class (copy of DbServer from SDK) and updated the Fieldget / Fieldput methods.
> 
> I have a StdDataWindow that I open and pass in the EncDbServer object. This doesn't seem to use the fieldget / fieldput methods from the EncDbServer.
> 
> Is this the best approach or should I just use my own gather / scatter methods for this data window?
> 
> Appreciate any ideas or thoughts on best way to achieve this.
> 
> Simon
> 
> 
> 
> 

[toc] | [prev] | [next] | [standalone]


#10696

Fromsimon@abersoftware.co.uk
Date2017-06-19 05:47 -0700
Message-ID<99297e50-936b-4cf0-9815-2f18e6200735@googlegroups.com>
In reply to#10694
Hi John,

Both good ideas for protecting data but the first is a little too easy to get around and the second possibly too hard to get around! (Especially if the person loses the TrueCrypt password!)

I'm looking at preventing easy access to some data - more for confidentiality than for security I suppose. Say names and addresses for example. I didn't want people to be able to copy the dbf and then see these details.

It looks like Wolfgangs solution with NoIvarGet/Put are the methods that are called. As I dont use the DBF editor my fields dont have their own Access and Assign methods so I guess this makes sense -I just would never have thought to look at them!

Simon

On Monday, June 19, 2017 at 1:02:15 PM UTC+1, JohnMartens wrote:
> 2 possible and simple solutions:
> 
> 1 Rename the DBF to another extension, this will prevent dummies 
> clicking the file that will open Excel en be able to look into the data
> 
> 2 Use Truecrypt to crypt the data files in a TC volume. Open TC with the 
> right password om the system where your app runs before opening your 
> app. Other people will nog be able to open the TC file
> 
> John
> 
> Op 19-6-2017 om 10:52 schreef simon@abersoftware.co.uk:
> > Hi All,
> > 
> > Anyone have any thoughts on best way to encrypt data fields that are stored in DBF file.
> > 
> > The reason is just to stop people looking at the DBF file from outside the application.
> > 
> > My initial thoughts were to subclass DbServer and overwrite the fieldget / fieldput methods to encrypt / decrypt the data. I've created an EncDbServer Class (copy of DbServer from SDK) and updated the Fieldget / Fieldput methods.
> > 
> > I have a StdDataWindow that I open and pass in the EncDbServer object. This doesn't seem to use the fieldget / fieldput methods from the EncDbServer.
> > 
> > Is this the best approach or should I just use my own gather / scatter methods for this data window?
> > 
> > Appreciate any ideas or thoughts on best way to achieve this.
> > 
> > Simon
> > 
> > 
> > 
> >

[toc] | [prev] | [next] | [standalone]


#10697

Fromdlzc <dlzc1@cox.net>
Date2017-06-19 07:32 -0700
Message-ID<8ae5a1da-1714-4c1f-ae44-6a200adaa7c6@googlegroups.com>
In reply to#10690
Dear si...:

On Monday, June 19, 2017 at 1:52:44 AM UTC-7, si...@abersoftware.co.uk wrote:
...
> Anyone have any thoughts on best way to encrypt data
> fields that are stored in DBF file.
> 
> The reason is just to stop people looking at the DBF
> file from outside the application.

Move from DBF to SQL.
... or ...
Move DBF to server, and only provide access to the DBF data via Terminal Services.
... or ...
Use the methods of a hierarchical database, and keep data in several different "synced" data files.
... or ...
Can also copy/move/reattrib the DBF from a hidden directory or state, as the first step in program execution, while your splash screen displays.

... for "lightweight" (non run-time intensive) methods.

David A. Smith

[toc] | [prev] | [next] | [standalone]


#10699

Fromsimon@abersoftware.co.uk
Date2017-06-19 09:15 -0700
Message-ID<59280bd0-b66a-4026-b67a-e51d289db700@googlegroups.com>
In reply to#10697
On Monday, June 19, 2017 at 3:32:31 PM UTC+1, dlzc wrote:
> Dear si...:
> 
> On Monday, June 19, 2017 at 1:52:44 AM UTC-7, si...@abersoftware.co.uk wrote:
> ...
> > Anyone have any thoughts on best way to encrypt data
> > fields that are stored in DBF file.
> > 
> > The reason is just to stop people looking at the DBF
> > file from outside the application.
> 
> Move from DBF to SQL.
> ... or ...
> Move DBF to server, and only provide access to the DBF data via Terminal Services.
> ... or ...
> Use the methods of a hierarchical database, and keep data in several different "synced" data files.
> ... or ...
> Can also copy/move/reattrib the DBF from a hidden directory or state, as the first step in program execution, while your splash screen displays.
> 
> ... for "lightweight" (non run-time intensive) methods.
> 
> David A. Smith
Hi David,

I like the idea of the hidden file but want to keep installation and setup as simple as possible.

Moving to SQL would be nice but no time at the moment. Will switch eventually though.

Having the field encrypted in the datafile gives some level of protection and if the IT people secure their systems properly then will be fine for my case.

I just need to test on a few different systems to make sure it doesn't mess up with different character sets / conversions etc.

Simon

[toc] | [prev] | [next] | [standalone]


#10702

From"Urs Eggmann" <Urs.Eggmann@shinternet.ch>
Date2017-06-19 22:46 +0200
Message-ID<eqqrhdFm72sU2@mid.individual.net>
In reply to#10699
Hi Simon,

On t h website of the user group Bodensee ( www.voug-bodensee.net )  you can 
find two samples for encrypting db files:
CryptoFalle.zip   And  CryptDB.zip

A trap you can fall in are the blanks at the end of a field content. If you 
encrypt a string, that is shorter as the field length, the blanks at the end 
are also encrypted and savet to the field. On decryption of e fieldcontent, 
the resulting string contains blanks.

regards
Urs


<simon@abersoftware.co.uk> schrieb im Newsbeitrag 
news:59280bd0-b66a-4026-b67a-e51d289db700@googlegroups.com...
> On Monday, June 19, 2017 at 3:32:31 PM UTC+1, dlzc wrote:
>> Dear si...:
>>
>> On Monday, June 19, 2017 at 1:52:44 AM UTC-7, si...@abersoftware.co.uk 
>> wrote:
>> ...
>> > Anyone have any thoughts on best way to encrypt data
>> > fields that are stored in DBF file.
>> >
>> > The reason is just to stop people looking at the DBF
>> > file from outside the application.
>>
>> Move from DBF to SQL.
>> ... or ...
>> Move DBF to server, and only provide access to the DBF data via Terminal 
>> Services.
>> ... or ...
>> Use the methods of a hierarchical database, and keep data in several 
>> different "synced" data files.
>> ... or ...
>> Can also copy/move/reattrib the DBF from a hidden directory or state, as 
>> the first step in program execution, while your splash screen displays.
>>
>> ... for "lightweight" (non run-time intensive) methods.
>>
>> David A. Smith
> Hi David,
>
> I like the idea of the hidden file but want to keep installation and setup 
> as simple as possible.
>
> Moving to SQL would be nice but no time at the moment. Will switch 
> eventually though.
>
> Having the field encrypted in the datafile gives some level of protection 
> and if the IT people secure their systems properly then will be fine for 
> my case.
>
> I just need to test on a few different systems to make sure it doesn't 
> mess up with different character sets / conversions etc.
>
> Simon 

[toc] | [prev] | [next] | [standalone]


#10704

From"Dirk (Belgium)" <dirk.dot.herijgers@pbprojects.dot.be>
Date2017-06-20 08:24 +0000
Message-ID<oiam4h$ac4$1@dont-email.me>
In reply to#10690
Hi Simon,

I have send you a private mail...

simon@abersoftware.co.uk wrote:

> Hi All,
> 
> Anyone have any thoughts on best way to encrypt data fields that are
> stored in DBF file.
> 
> The reason is just to stop people looking at the DBF file from
> outside the application.
> 
> My initial thoughts were to subclass DbServer and overwrite the
> fieldget / fieldput methods to encrypt / decrypt the data. I've
> created an EncDbServer Class (copy of DbServer from SDK) and updated
> the Fieldget / Fieldput methods.
> 
> I have a StdDataWindow that I open and pass in the EncDbServer
> object. This doesn't seem to use the fieldget / fieldput methods from
> the EncDbServer.
> 
> Is this the best approach or should I just use my own gather /
> scatter methods for this data window?
> 
> Appreciate any ideas or thoughts on best way to achieve this.
> 
> Simon

[toc] | [prev] | [next] | [standalone]


#10726

FromMartin <Martin@spam.spam>
Date2017-06-26 09:27 +0100
Message-ID<oiqg9s$oh$1@dont-email.me>
In reply to#10690
Use a hidden directory on the server to store the data, only the server 
has rights to read write create.


Needs ADS

On 19/06/2017 09:52, simon@abersoftware.co.uk wrote:
> Hi All,
> 
> Anyone have any thoughts on best way to encrypt data fields that are stored in DBF file.
> 
> The reason is just to stop people looking at the DBF file from outside the application.
> 
> My initial thoughts were to subclass DbServer and overwrite the fieldget / fieldput methods to encrypt / decrypt the data. I've created an EncDbServer Class (copy of DbServer from SDK) and updated the Fieldget / Fieldput methods.
> 
> I have a StdDataWindow that I open and pass in the EncDbServer object. This doesn't seem to use the fieldget / fieldput methods from the EncDbServer.
> 
> Is this the best approach or should I just use my own gather / scatter methods for this data window?
> 
> Appreciate any ideas or thoughts on best way to achieve this.
> 
> Simon
> 
> 
> 
> 

[toc] | [prev] | [next] | [standalone]


#10769

Fromsimon@abersoftware.co.uk
Date2017-07-17 13:30 -0700
Message-ID<975051c7-20cc-424b-b70e-628b6f2d1217@googlegroups.com>
In reply to#10690
Hi All,

Thanks for all the answers...

Thought I'd post my solution for a subclassed DbServer

CLASS EncDbServer INHERIT StdDbServer
	PROTECT aNoEncrypt AS ARRAY
METHOD FIELDGET(uField) CLASS EncDBServer
	LOCAL uRetVal AS USUAL

	uRetVal := SUPER:FIELDGET(uField)

	IF AScan(SELF:aNoEncrypt,AsSymbol(uField)) = 0
		IF !IsNil(uRetVal)
			IF !Empty(uRetVal)
				IF IsString(uRetVal)
					uRetVal := Crypt(uRetVal, "AN-ENCRYPTION-KEY")
				ENDIF
			ENDIF
		ENDIF
	ENDIF
	RETURN uRetVal
METHOD FIELDPUT(uField, uValue) CLASS EncDBServer

	IF AScan(SELF:aNoEncrypt,AsSymbol(uField)) = 0
		IF !IsNil(uValue)
			IF !Empty(uValue)
				IF IsString(uValue)
					uValue := Crypt(uValue, "AN-ENCRYPTION-KEY")
				ENDIF
			ENDIF
		ENDIF
	ENDIF
	RETURN SUPER:FIELDPUT(uField, uValue)
METHOD NoIVarGet(symFieldName) CLASS EncDBServer
	LOCAL uRetVal AS USUAL

	uRetVal := SUPER:NoIVarGet(symFieldName)

	IF AScan(SELF:aNoEncrypt,symFieldName) = 0
		IF !IsNil(uRetVal)
			IF !Empty(uRetVal)
				IF IsString(uRetVal)
					uRetVal := Crypt(uRetVal, "AN-ENCRYPTION-KEY")
				ENDIF
			ENDIF
		ENDIF
	ENDIF

	RETURN uRetVal
METHOD NoIVarPut(symFieldName, uValue) CLASS EncDBServer

	IF AScan(SELF:aNoEncrypt,symFieldName) = 0
		IF !IsNil(uValue)
			IF !Empty(uValue)
				IF IsString(uValue)
					uValue := Crypt(uValue, "AN-ENCRYPTION-KEY")
				ENDIF
			ENDIF
		ENDIF
	ENDIF

	RETURN SUPER:NoIVarPut(symFieldName, uValue)

Simon


On Monday, June 19, 2017 at 9:52:44 AM UTC+1, si...@abersoftware.co.uk wrote:
> Hi All,
> 
> Anyone have any thoughts on best way to encrypt data fields that are stored in DBF file.
> 
> The reason is just to stop people looking at the DBF file from outside the application.
> 
> My initial thoughts were to subclass DbServer and overwrite the fieldget / fieldput methods to encrypt / decrypt the data. I've created an EncDbServer Class (copy of DbServer from SDK) and updated the Fieldget / Fieldput methods.
> 
> I have a StdDataWindow that I open and pass in the EncDbServer object. This doesn't seem to use the fieldget / fieldput methods from the EncDbServer.
> 
> Is this the best approach or should I just use my own gather / scatter methods for this data window?
> 
> Appreciate any ideas or thoughts on best way to achieve this.
> 
> Simon

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web