sahithi chowdary
sahithi chowdary

Reputation: 21

Encryption and decryption common for angular and java

I am looking for an encryption algorithm with a secret key which can be used both for angular 7 and Java. I am not familiar with angular 7 and there is now of knowing any algorithms in angular.

Upvotes: 0

Views: 958

Answers (1)

Karol Dowbecki
Karol Dowbecki

Reputation: 44960

Any standard algorithm should work, both Java and JavaScript have libraries that support standard algorithms e.g. JSEncrypt can be used with Angular.

However with symmetric cryptography (e.g. AES) your key will be exposed in the client and just like rest of the JavaScript code can be accessed by the user.

Depending on your requirements it might be better to use asymmetric cryptography (e.g. RSA) to ensure that private key used to encrypt never leaves the server.

Upvotes: 1

Related Questions