NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Matthew51 on August 23, 2016, 03:06:09 PM

Title: Storing encrypted data
Post by: Matthew51 on August 23, 2016, 03:06:09 PM
I need to store payment tokens, and I want to encrypt them.  Encrypting the data and storing it isn't hard.  My question is how to store the decryption key.  The server and database are both on the same server.  It's an SQL database.  I want to avoid the computer equivalent of locking your door, then hanging the key next to the lock.

Thanks
Matthew
Title: Re: Storing encrypted data
Post by: kevin plummer on August 23, 2016, 05:12:22 PM
It's a good question. I googled best practice and sounds like no perfect way but there are methods to make it harder if hacked.


http://stackoverflow.com/questions/723653/storing-encryption-keys-best-practices (http://stackoverflow.com/questions/723653/storing-encryption-keys-best-practices)
Title: Re: Storing encrypted data
Post by: Matthew51 on August 26, 2016, 03:18:37 PM
I did the same with similar results.  The idea of breaking the key into part from that link I think I'll use.  It can easily be scaled up by keeping the key parts on other computers in the future.
Title: Re: Storing encrypted data
Post by: Matthew51 on September 19, 2016, 03:33:30 PM
And here I thought doing an xor on a string would be easy.  The only xor function I can find is the one in clarion, and it only takes a long.  The only way way I see to do it is to:
1 read the string into a string theory
2 Break the sting into bytes
3 Store the bytes in longs
4 repeat 1-3 for the other key part
5 xor the longs
6 puts the longs back into the string parts
7 put the whole string back together

Anyone else ever done this, and if so did you find an easier way?
Title: Re: Storing encrypted data
Post by: Bruce on September 20, 2016, 01:44:38 AM
Hi Matthew,
using OVER it gets a bit simpler.

password       String(100)
overpassword  Long,Dim(25),Over(Password)

  Loop x = 1 to 25
    overpassword[ x] = BXOR(overpassword[ x],123456789)
  end


what would be interesting is a StringTheory method that XOR's on string with another string...

cheers
Bruce
Title: Re: Storing encrypted data
Post by: Matthew51 on September 20, 2016, 12:07:13 PM
Exactly the simple code I was looking for!  I was surprised string theory didn't already do that.  It does everything else I want and more.