Solved

Encryption

Posted on 2006-06-24
12
514 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 70 total points
ID: 16977628
0
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!

 
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 66 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 66 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 66 total points
ID: 16980250
0
 
LVL 30

Assisted Solution

by:Mayank S
Mayank S earned 66 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 66 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
hibernate example for saving data 19 77
Desingning Refactoring existing code 2 31
JavaFX TableView not displaying correctly 3 109
IBM TS2900 (3572) Tape Autoloader Java? 12 61
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

726 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