Encryption & Decryption  
Author Message
Rogue Chameleon





PostPosted: 2004-9-24 2:46:00 Top

java-programmer, Encryption & Decryption 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?

--
Rogue Chameleon...



 
Will Hartung





PostPosted: 2004-9-24 3:04:00 Top

java-programmer >> Encryption & Decryption "Rogue Chameleon" <email***@***.com> wrote in message
news:email***@***.com...
> 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***@***.com)





 
Paul Lutus





PostPosted: 2004-9-24 3:09:00 Top

java-programmer >> Encryption & Decryption Rogue Chameleon wrote:

> 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.

--
Paul Lutus
http://www.arachnoid.com

 
 
John Davison





PostPosted: 2004-9-24 3:14:00 Top

java-programmer >> Encryption & Decryption Rogue Chameleon wrote:

> 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
 
 
Rogue Chameleon





PostPosted: 2004-9-24 4:03:00 Top

java-programmer >> Encryption & Decryption 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?

--
Rogue Chameleon...


"Rogue Chameleon" <email***@***.com> wrote in message
news:email***@***.com...
> 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?
>
> --
> Rogue Chameleon...
>
>
>


 
 
Sudsy





PostPosted: 2004-9-24 4:42:00 Top

java-programmer >> Encryption & Decryption Rogue Chameleon wrote:
> 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?
>

I suggest you start here:
<http://www-106.ibm.com/developerworks/webservices/library/x-xmlsecuritysuite/index.html>

 
 
Ann





PostPosted: 2004-9-24 6:31:00 Top

java-programmer >> Encryption & Decryption
"Rogue Chameleon" <email***@***.com> wrote in message
news:email***@***.com...
> 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

> 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?
>
> --
> Rogue Chameleon...
>
>
>