Page 1 of 1

Ciphers

Posted: 14 Oct 2011, 10:49
by Rajiv
Hey guys - I need some regarding ciphers! First of all - how do you generate a cipher?

Re: Ciphers

Posted: 14 Oct 2011, 10:55
by Hman
You don't generate a cipher, a cipher generates you.

http://en.wikipedia.org/wiki/Cipher

Re: Ciphers

Posted: 14 Oct 2011, 10:56
by Monty
dtpqwnkts

Re: Ciphers

Posted: 14 Oct 2011, 10:59
by Rajiv
Phew. This is gonna take a long time to grasp...

Re: Ciphers

Posted: 14 Oct 2011, 12:42
by Bladerunner
Rajiv wrote:Phew. This is gonna take a long time to grasp...
What exactly do you need a cipher for?

Re: Ciphers

Posted: 14 Oct 2011, 16:15
by Rajiv
Its an IT project. We need to do research and stuff - then we need to code a program in Java that can encrypt and decrypt a file...

Re: Ciphers

Posted: 14 Oct 2011, 16:27
by rustypup
you're writing your own security provider classes or is this simply an attempt to introduce you to the security API?
  • 1) Pick a cipher: Asyncrhonous/Synchronous
    2) Use the security API to create the necessary digests/keys
You may want to spend some time understanding what Base64 conversion is and why it is a necessary component when dealing with encrypted IO...

Re: Ciphers

Posted: 14 Oct 2011, 20:58
by Bladerunner
Rajiv wrote:Its an IT project. We need to do research and stuff - then we need to code a program in Java that can encrypt and decrypt a file...
How big are the files? Can you load it into a byte array and shift it?

Re: Ciphers

Posted: 14 Oct 2011, 23:20
by RuadRauFlessa
Bladerunner wrote:
Rajiv wrote:Its an IT project. We need to do research and stuff - then we need to code a program in Java that can encrypt and decrypt a file...
How big are the files? Can you load it into a byte array and shift it?
Exactly what you will be doing. The encryption APIs of Java work from Streams. It could be a buffered byte array or not it does not matter.

Re: Ciphers

Posted: 15 Oct 2011, 08:43
by Bladerunner
RuadRauFlessa wrote:
Bladerunner wrote:
Rajiv wrote:Its an IT project. We need to do research and stuff - then we need to code a program in Java that can encrypt and decrypt a file...
How big are the files? Can you load it into a byte array and shift it?
Exactly what you will be doing. The encryption APIs of Java work from Streams. It could be a buffered byte array or not it does not matter.
Yes but if it's a big file you'd rather take a bunch of bytes at a time, encrypt them, and write them to a new file. When you're done with all the segments you close the filestream.

If it's small, like a text file or word doc, you could probably load the whole file into a byte array.

Re: Ciphers

Posted: 18 Oct 2011, 16:17
by Rajiv
It would be a small file based on my problem statement.
The rubric for the project says I need to state the inputs, processing and the outputs. The input would be the file that needs to be encrypted/decrypted, right?
How do I structure the 'processing' part and the 'output' part?

Re: Ciphers

Posted: 18 Oct 2011, 16:37
by rustypup
there are millions of examples out there...

the trick is understanding what best practices are and why they're considered best practices... (just be thankful you weren't asked to deploy a CA and fiddle with SSL)..

you may also want to consider playing with something like bouncycastle - purely because the legal wrangling in yank-land sees java shipped with a severely limited provider implementation...

have you ever dabbled in cryptography or is this your first visit? - because there's a lot of groundwork you need to cover...

Re: Ciphers

Posted: 18 Oct 2011, 16:38
by Rajiv
first visit...

Re: Ciphers

Posted: 18 Oct 2011, 17:07
by rustypup
symmetric
  • :-fast and far more secure
    :-security relies on trust between parties, (shared password/key)
    :-typically used on large amounts of data
    :-susceptible to volume attacks
asymmetric
  • :-slow
    :-security is adaptive and can be negotiated on the fly using disposable key-pairs..
    :-typically used on small data sets
    :-susceptible to digest and volume attacks...
in the real world you will generally encounter a blend of the 2... an asymmetric session would be used to exchange some form of salting data in order for both parties to create a disposable symmetric cipher for that session...

because the salt is random it has the appearance of noise so even if the asymmetric cipher is compromised there's a relatively low risk of having the symmetric cipher compromised as well...

by the sound of things, your project would be best suited to the symmetric cipher approach? - asymmetric would require that you store/share the private/public keys...

Re: Ciphers

Posted: 18 Oct 2011, 17:11
by Rajiv
OK thanks. Any more info?

Re: Ciphers

Posted: 18 Oct 2011, 17:28
by rustypup
Jav Cryptography Extension - Reference Guide - simple encryption... (although i would advise using AES over DES...)

i wasn't kidding.. this example is reproduced everywhere...

Re: Ciphers

Posted: 18 Oct 2011, 17:37
by Rajiv
Thank you!!!!! That info is what I need for the 3rd step of my project!!!!!