?
Solved

Encryption

Posted on 2006-06-24
12
Medium Priority
?
527 Views
Last Modified: 2008-01-16
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
Comment
Question by:simpsons17371
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 
LVL 30

Expert Comment

by:callrs
ID: 16977605
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
 
LVL 30

Expert Comment

by:callrs
ID: 16977609
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
 
LVL 14

Accepted Solution

by:
hoomanv earned 280 total points
ID: 16977628
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 1

Author Comment

by:simpsons17371
ID: 16977651
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
 
LVL 14

Expert Comment

by:hoomanv
ID: 16977654
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 264 total points
ID: 16978229
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
 
LVL 30

Assisted Solution

by:callrs
callrs earned 264 total points
ID: 16978889
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
 
LVL 92

Assisted Solution

by:objects
objects earned 264 total points
ID: 16980250
0
 
LVL 30

Assisted Solution

by:Mayank S
Mayank S earned 264 total points
ID: 16981190
>> 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
 
LVL 2

Assisted Solution

by:frube
frube earned 264 total points
ID: 16985859
>> 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

Independent Software Vendors: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month15 days, 7 hours left to enroll

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question