Java PBEWithMD5AndDES
Asked Answered
B

3

11

I am using password based encryption. My initial thought was to use AES to encrypt the file which contains passwords. Turns out password based encryption does not support AES. It uses DES. AFAIK des is not secure. Is PBEWithMD5AndDES secure enough to thrust my data or should i look for another implementation?

Bayreuth answered 16/8, 2009 at 16:58 Comment(2)
It seems that you are using some expressions in a confusing way. "Password based encryption" refers to a scheme where files are encrypted with a key that is derived from a passowrd. (E.g. the PKCS #5 standard is a password based encryption scheme). What you want is something different, i.e. a secure password storage/management scheme. Hence PBEWithMD5AndDES is not what you need, regardless how secure or insecure it is.Ninety
This is now a thoroughly outdated question, AES is supported for password based encryption since Java 6, although I should mention that it should only be used for in place encryption as it is lacking integrity protection.Lizliza
M
16

It appears from your comments that what you would like to do is to encrypt a file which contains sensitive information, using a password-based encryption scheme, with a password provided by the user at decrypt-time. The sensitive information in this case also happens to be passwords, but that isn't really relevant. (You should probably update the question to make this more clear).

You are doing the right thing, your problem is just that the SunJCE Java cryptography provider doesn't support AES for password-based encryption. You need to use an alternative provider which does: for example, you could use the Bouncy Castle provider with the algorithm "PBEWITHSHA256AND128BITAES-CBC-BC". (Despite the whimsical name, Bouncy Castle is well-respected).

As for "is DES secure enough for my data", well if the data you're protecting would be worth less than roughly $10,000 to an attacker, then back in 2009 it was probably just secure enough. And in 2014, if your data is worth encrypting at all, the answer is no.

Morehead answered 16/8, 2009 at 22:11 Comment(1)
You can probably replace $10,000 with $100 ... given recent advances in brute-forcing using GPUs.Unsuspected
C
3

If you have Java 6 available, everything you need is available. Check out this question and look at the accepted answer for a code sample. Since you want to encrypt files, the iv that is generated should be prepended to the file you are writing the ciphertext to, so that it is available during the decryption.

Conduct answered 18/8, 2009 at 5:36 Comment(0)
L
-1

You should not be keeping the passwords in any form other than salted hash digests.

You should then use the operating system permission system to make it such that the hashed password file is only readable by the user which validates passwords.

Leyte answered 16/8, 2009 at 17:6 Comment(1)
It is a personal application to store passwords. A toy password manager.Bayreuth

© 2022 - 2024 — McMap. All rights reserved.