bb.donnay-software.com

Donnay Software Web Forums
It is currently Wed May 27, 2020 9:43 pm

All times are UTC - 7 hours




Post new topic Reply to topic  [ 12 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Wed Feb 26, 2020 4:08 pm 
Offline

Joined: Wed Dec 11, 2019 7:18 am
Posts: 4
I have a problem decrypting a field that I encrypted and saved to a dbf. Encrypting and Decrypting work perfectly if I do not save it to a table. I have worked up a project based on the sample in exp20\Samples\Encrypt and attached it. Has anyone experienced this issue or have an idea what I might be doing wrong? Here is a snippet of the sample I worked up. Any help would be appreciated- Thank you

PROCEDURE MAIN()

LOCAL cKey := 'Now Is The Time For All Good Men To Come To the Aid of Their Country'
LOCAL cEncryptedString, cDecryptedString, CustNumber
cKey := Substr(cKey,1,32)
? cKey

SET DEFAULT TO .\DATA
USE CUSTOMER
//encrypt the customer number from Customer Table
CustNumber:= Cust_nmbr
cEncryptedString := Encrypt(CustNumber,cKey)

? Trim(cEncryptedString), Len(cEncryptedString),"Encrypted Cust Nmb"

DBRLOCK()
REPLACE Bill_name with Trim(cEncryptedString)
UNLOCK

//this works ->cDecryptedString := Trim(Decrypt( cEncryptedString, cKey ))
?Bill_name, Len(trim(Bill_Name)), "Bill_Name"
//this does not work
cDecryptedString := Decrypt( Trim(Bill_name), cKey )
? cDecryptedString, Len(cDecryptedString) , "Decrypted String from File"


Attachments:
ENCRYPTtoDB.zip [103.58 KiB]
Downloaded 135 times
Top
 Profile  
 
PostPosted: Thu Feb 27, 2020 5:39 am 
Offline

Joined: Sun Jan 18, 2015 11:43 am
Posts: 514
Location: Slovakia
Hi, encrypted string need more space than source string.
Have you enought field size ?


Top
 Profile  
 
PostPosted: Thu Feb 27, 2020 6:18 am 
Offline
Site Admin
User avatar

Joined: Wed Jan 27, 2010 6:58 pm
Posts: 4124
Location: Boise, Idaho USA
Encrypting creates high-order characters (higher than chr(128)).
Some databases, like DBF, cannot store those characters correctly.
Whenever I need to store encrypted data in a database, I first convert it to hexidecimal.

cHexString := DC_Var2HexString( cEncryptedString )
MYDATA->mypassword := cHexString

To convert it back:

cHexString := MYDATA->mypassword
cEncryptedString := DC_HexString2Var( cHexString )

If you don't own eXpress++, there are functions in Xbase tools for this.
BTW - A hexidecimal string is always 2x longer so the field length of the table must accomodate the longer length.

_________________
The eXpress train is coming - and it has more cars.


Top
 Profile  
 
PostPosted: Thu Feb 27, 2020 6:38 am 
Offline

Joined: Tue Feb 02, 2010 8:36 am
Posts: 21
Location: Midland Texas
Thanks Roger, we will give that a try. Kristie is working with me and will be taking over for me when I retire in the next month or so. You might remember her from when we first started using express back in 200 or so. Thanks for all of your help over the years.

Dian
Avatar Systems


Top
 Profile  
 
PostPosted: Thu Feb 27, 2020 9:00 am 
Offline

Joined: Wed Dec 11, 2019 7:18 am
Posts: 4
Thank you very much, that resolved my issue!


Top
 Profile  
 
PostPosted: Thu Feb 27, 2020 9:32 pm 
Offline

Joined: Thu Jan 28, 2010 7:07 am
Posts: 612
Location: Alachua, Florida USA
Dian wrote:
first started using express back in 200 or so.
Dian
Avatar Systems


Roger's old, but not THAT old :banana-dreads:

was this with the Clipper Winter/199 version ??

We'll be here all week folks.. don't forget to tip your waitstaff..

_________________
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT travelling around the country right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises


Top
 Profile  
 
PostPosted: Fri Feb 28, 2020 6:16 am 
Offline
Site Admin
User avatar

Joined: Wed Jan 27, 2010 6:58 pm
Posts: 4124
Location: Boise, Idaho USA
Quote:
Roger's old, but not THAT old :banana-dreads:

Have you forgotten that I was the guy who brought Clipper development out of the stone age?

The year 200 was about 2200 years more advanced than the end of the stone age.

Since then, I have been bringing Xbase++ out of the medieval age.
Actually, Dian and I have been working together since 199.

I'm way older than anyone could imagine.
Attachment:
stoneage.jpg
stoneage.jpg [ 307.75 KiB | Viewed 1759 times ]

_________________
The eXpress train is coming - and it has more cars.


Top
 Profile  
 
PostPosted: Fri Feb 28, 2020 7:27 am 
Offline

Joined: Thu Jan 28, 2010 7:07 am
Posts: 612
Location: Alachua, Florida USA
rdonnay wrote:
Quote:
Roger's old, but not THAT old :banana-dreads:

Have you forgotten that I was the guy who brought Clipper development out of the stone age?

Attachment:
stoneage.jpg


No, i haven't forgotten.. As a matter of fact, newbie, i was the guy who was sitting at the bar the first time you walked into the dBase lounge.. :lol: :lol:

(ok, your turn.. :) )

_________________
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT travelling around the country right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises


Top
 Profile  
 
PostPosted: Fri Feb 28, 2020 8:04 am 
Offline
Site Admin
User avatar

Joined: Wed Jan 27, 2010 6:58 pm
Posts: 4124
Location: Boise, Idaho USA
Quote:
you walked into the dBase lounge

Ah yes.

I recall you were drinking a glass of dBase-2 tomato juice.

I offered to spice it up for you with some Clipper vodka, Tabasco and worcestershire.

You said - "I don't compile, I'm on the wagon" :angry-extinguishflame:

_________________
The eXpress train is coming - and it has more cars.


Top
 Profile  
 
PostPosted: Sun Mar 01, 2020 3:23 pm 
Offline

Joined: Thu Jan 28, 2010 7:07 am
Posts: 612
Location: Alachua, Florida USA
rdonnay wrote:
Quote:
you walked into the dBase lounge

Ah yes.

I recall you were drinking a glass of dBase-2 tomato juice.

I offered to spice it up for you with some Clipper vodka, Tabasco and worcestershire.

You said - "I don't compile, I'm on the wagon" :angry-extinguishflame:


And then you said:

"Try compiling... The first one's free" :happy-jumpeveryone:

_________________
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT travelling around the country right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ]  Go to page 1, 2  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group