Encryption & Decryption

R

Rogue Chameleon

Hi all

I've been asked to look into the encryption and decryption of attachments
sent in emails. The specific scenario is as follows:

- a file is created
- the file is to be encrypted
- the file is attached to an email and sent to a recipient
- once received, the file should be decrypted
- the file is read

At first glance, I think I should be reading up on the JCA (Java
Cryptography Architecture) and use a public key encrypt and a private key to
decrypt. Is this right?

Are there any online implementations or tutorials that you would suggest I
read to learn more about this?
 
W

Will Hartung

Rogue Chameleon said:
Hi all

I've been asked to look into the encryption and decryption of attachments
sent in emails. The specific scenario is as follows:

- a file is created
- the file is to be encrypted
- the file is attached to an email and sent to a recipient
- once received, the file should be decrypted
- the file is read

At first glance, I think I should be reading up on the JCA (Java
Cryptography Architecture) and use a public key encrypt and a private key to
decrypt. Is this right?

Are there any online implementations or tutorials that you would suggest I
read to learn more about this?

It is a maze of new vocabulary, acronyms, abbreviations, and scattered
documentation. The number of assorted bits and pieces that you need to
actually assemble boggles the mind.

Thankfully, there are some good samples at bouncycastle.org in their openpgp
directories.

And that's just the encryption part. JavaMail should be handy for the actual
message part.

I just use it, I don't claim to understand it beyond that it does what we
need it to do and I managed to make it work.

Good Luck!

Regards,

Will Hartung
([email protected])
 
P

Paul Lutus

Rogue said:
Hi all

I've been asked to look into the encryption and decryption of attachments
sent in emails. The specific scenario is as follows:

- a file is created
- the file is to be encrypted
- the file is attached to an email and sent to a recipient
- once received, the file should be decrypted
- the file is read

At first glance, I think I should be reading up on the JCA (Java
Cryptography Architecture) and use a public key encrypt and a private key
to
decrypt. Is this right?

There is an important constraint for an encrypted e-mail -- the bytes must
all be legal ASCII characters or the e-mail system will balk at accepting
it. This is why file attachments to e-mails are seemingly so large.

So add this to your list of requirements that the encrypted message must
meet.
 
J

John Davison

Rogue said:
At first glance, I think I should be reading up on the JCA (Java
Cryptography Architecture) and use a public key encrypt and a private key to
decrypt. Is this right?

[I am no expert in cryptography, mind you. ;)]

Mostly. What usually ends up happening is you use the public key to
encrypt a secret (symmetric) key, and use that secret key to actually
encrypt/decrypt the document. Reason being public key encryption is
super costly, and (from what I remember) the resulting ciphertext grows
exponentially. (If not exponentially, than say "more than you'd want it
to").
Are there any online implementations or tutorials that you would suggest I
read to learn more about this?

It's scattered all over the place. One place you might want to look for
more current/powerful encryption in Java is here:
http://www.cryptix.org/
It looks like their site is down, but you can still download the libary.

Also, don't forget to get the "Java Cryptography Extension (JCE)
Unlimited Strength Jurisdiction Policy Files" from Sun if you plan to
use JCA.

- john
 
R

Rogue Chameleon

Ok... I've managed to generate a KeyPair (public and private) and output
them to seperate files.

Now, how do I use the public key to encrypt my data.txt and how do I use the
private key to decrypt the data.txt?
 
A

Ann

Rogue Chameleon said:
Hi all

I've been asked to look into the encryption and decryption of attachments
sent in emails. The specific scenario is as follows:

- a file is created
- the file is to be encrypted
- the file is attached to an email and sent to a recipient
- once received, the file should be decrypted
- the file is read

Taking this literally,
1. up to you, can you type?
2. use the unix command "crypt" like this
"crypt < myfile > newfile"
3. use any common thing like Outlook Express
4. use the unix command "crypt" (call user and ask for the magic word)
5. up to you, don't forget your glasses
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top