• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 532
  • Last Modified:

Encryption

Hey, I am /pretty/ sure that this is possible, but not positive.

Say I have information froma program, and I want to save it so I can read it again later, I know I can and how to write it to a file, and I also already know how to read it from a file.

Now, what I was wondering, is it possible for me to make it so that this information is encrypted in some way, and even make the file not readable or something except by Java so that it doesn't get editted and nothing gets stolen from it.

Is it possible/practical to make my own encryption technique, how complicated would I have to make it.

Can anyone steer me in the right direction on this, I am making a custom program right now and saving stuff but it is so easy for someone to just edit it because normally I save stuff as .txt so its easy to read, even if I make something up and save it as like a .hgfa or something, you can still read it no problem if you open it right >_<, its kind of angering.

Thanks in advance.

Mark
0
simpsons17371
Asked:
simpsons17371
6 Solutions
 
callrsCommented:
http://www.snapfiles.com/Freeware/security/fwencrypt.html     File Encryption Tools

Quick Macros (quickmacros.com) also has built-in encryption functions for encrypting/decrypting text.

Is this he type of stuff you're looking for?

Truecrypt is one of the best encryption programs. And it's free.
0
 
callrsCommented:
http://www.thefreecountry.com/security/encryption.shtml     Free Encryption / Cryptographic Software, Free On the Fly Encryption, Steganography, Free Disk Encryption Tools, Free Public Key Encryption Software (thefreecountry.com)
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
simpsons17371Author Commented:
Callrs, thats not quite what I am looking for, those seem to encrypt files once they exist.  I suppose I could make those work, but I was looking more along the lines of what hoomanv posted, something that encrypts while in java.

I don't seem to really follow how to put it in there though.  Basically I would be writing to a file, and then encrypting the information with a normal java encryption.  Couldn't anyone just use the unencryption class file to just unecrypt what I just did?

How hard is it would you say to make my own encryption technique?

Should I encrypt the text and then put it in a file and then maybe encrypt it again, or just encrypt the file?

Mark

0
 
hoomanvCommented:
0
 
CEHJCommented:
Be careful how you store the key if you use encryption. If it's stored with the app, it would be reasonably simple to crack.

As far as stopping other people writing to the file is concerned, that's the remit of the OS, but you can make a call to it thorough Java with Runtime.exec. On XP, you could exec cacls, but see:

http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
0
 
callrsCommented:
From what I know of java, you can take someone's code & de-compile it into very readable code... so what you want may not be possible without a change of the Java language specification.

Or if you just want to read & write DATA to/from a file,  I see no reason why you can't encrypt it using Java. You can encrypt/decrypt using C++ for example, so just use some open source encryption code or some simple code off the net & build on that.

http://javaalmanac.com/egs/javax.crypto/DesFile.html     Encrypting a File or Stream with DES (Java Developers Almanac Example)
http://www.codeguru.com/forum/archive/index.php/t-40117.html     CodeGuru Forums - Java Encryption
http://www.devx.com/Java/10MinuteSolution/21385     Encrypt Sensitive Configuration Data with Java
http://www.phptr.com/articles/article.asp?p=170967&seqNum=10&rl=1     Cryptography with Java > Cryptography with crypttool

Google for: java encrypt files
etc.
0
 
objectsCommented:
0
 
Mayank SAssociate Director - Product EngineeringCommented:
>> Is it possible/practical to make my own encryption technique, how complicated would I have to make it.

I think it would be better to use a standard encryption technology - just make sure the key is secure :)

>> you can take someone's code & de-compile it into very readable code

You can use an obfuscator.
0
 
frubeCommented:
>> Is it possible/practical to make my own encryption technique, how complicated would I have to make it.

If you really wanted to write your own code for this then you can use an extremely basic encryption technique known as substitution which would involve writing a symmetric encryption algorithm. This is the process of swapping each letter in the alphabet with a different one with an integer key value. For example if you were to have a key of 3 then;

- every 'A' character would become 'D'
- every 'B' character would become 'E'
- every 'C' character would become 'F'

You probably encountered such techniques in basic puzzle books in maths class at school, so as you would imagine these techniques are not difficult to crack at all with the aid of a computer, but would be taxing for a human to decipher. If sensitive information such as passwords are being saved then this solution would not be appropriate at all, it would simply render the file incomprehensible to the human eye.

If you need to truly secure the file then you should look at the different options that Java provides in the JCE (Java Cryptography Extension) in the link below.

http://java.sun.com/j2se/1.5.0/docs/guide/security/CryptoSpec.html
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now