I have an application which uses AngularJs 1.5 as front end and .net framework as a backend. In my application, I have to store username and password on the database which comes from the front end.The requirement is:
Put it in a nutshell, front-end should encrypt the password and backend should have the ability to decrypt it.
I have analyzed many techniques for secure transaction of the password.
I am new to encryption and decryption handling with AngularJS. My query is about key handling.How we can securely store the key both in front-end and backend rather than hard-coding them in the code.Is there any secure way for sharing these keys.Which algorithm is best suited for my requirement? (From my analysis, I found that asymmetric is the better option for this requirement).
Not sure if this is still relevant to you, but here comes. These are quite high level and broad questions you are asking, so I'm providing you some general guidance.
I would definitely use asymmetric encryption for this. I'd most likely pick something like RSA OAEP which produces different cipher text on the same input each time thanks to the random padding. This way an attacker won't learn that much from the cipher text that he could manage to intercept.
The key exchange is a trickier topic as your end-user software most likely runs in a browser (being an Angular app). One way to handle this could be to wrap your public key in a certificate that can be verified in the browser.
There are also many other attacks and aspects you need to consider. For example how to protect your system against replay attacks and how to rotate your keys while still meeting your availability requirements. Covering all topics in this answer is not possible them to being too broad, so I leave it here.