Before I answer your questions, here are a few principles that will make the answers easier to understand.
- Keep network usage to a minimum. All transmissions are vulnerabilities. You are using the network to synchronize passwords between devices. All of the other functions should be performed locally on a cached database.
- Sensitive data should stay encrypted whenever possible. Whenever data is not being used, leave it encrypted. Even in memory. Plaintext passwords are naked targets. They should only exist for the brief moments when the user needs them.
- Hiding secrets is not the only goal of cryptography. There are four goals in cryptography: confidentiality (hiding secrets); authenticity (verifying that people are who they say they are, and things are from where they say they're from); integrity (verifying that data has not been corrupted); and non-repudiation (don't worry about this one for now).
Now to your questions.
1. Question
should I decrypt the passwords on the server and send them plain text by SSL or should I send the encrypted password and encrypted private key and let the extension decrypt both.
The local application should decrypt both. Remember, we are only using the network to synchronize data between devices. Everything else should be done locally.
The user's whole archive of passwords should be cached on their local device. They are stored encrypted by the user's password (and key or whatever). When the user logs into the password manager application, he gives the application his password and/or key. This gives the password manager application the power to decrypt the database and read the user's passwords.
Basically, the answer is that you do need to decrypt the passwords in JavaScript. But you shouldn't be getting them from the server unless your local cache needs an update.
the problem here is that Java and JavaScript Crypto Libraries aren't creating them the same, so I might need to call a java application from the extension.
No, you don't need to call a Java application from JavaScript. The cryptographic standards you're using are completely interoperable. If you aren't able to make them work together, then you're probably making a mistake.
2. Question
I'm currently using RSA/ECB/PKCS1Padding as the Algorithm for encrypting text with public and private keys, I know, there is also AES, but I need public/private keys for my application, and therefore I want to ask if this algorithm is secure enough for saving passwords.
The first thing you need to know about this is that you probably are still using AES encryption. Symmetric encryption is an important part of asymmetric encryption. RSA keys are not capable of encrypting more than a few hundred bytes. Here's the basic procedure.
Encryption
- Generate symmetric key A
- Encrypt message M using A
- Use the public RSA key to encrypt A
- Send A+M (both encrypted) to the recipient
Decryption
- Decrypt A using private RSA key.
- Decrypt M using A
Also, your question about whether RSA is strong enough is impossible to answer. It depends on your teacher's standards.
3. Question
is there anything that is better in the Java Standard Library
Yes. I don't know what is strong enough for your teacher. But Java certainly has stronger options.
SHA1 is the weakest of all the SHAs. The strongest of all the SHAs is SHA3-512. Adding HMAC makes it even stronger. AES is also much stronger than DES. PBE is kind of ambiguous. I usually prefer to specify PBKDF2 if I need something very strong.