You need to sign in to do that
Don't have an account?
Jagadeesh Angadi
How to decrypt a message using asymmetric RSA algorithm?
I have a private key with me, I have to decrypt a message using my private key with asymmetric RSA algorithm, Please help with the documentation or sample code on how to decrypt a message using asymmetric RSA.
You should be able to make use of Crypto Class available in Apex which provides methods for creating digests, message authentication codes, and signatures, as well as encrypting and decrypting information.
Reference link for documentation:
https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_classes_restful_crypto.htm
Reference link for example code:
https://rajvakati.com/2018/03/11/apex-crypto-example/
Hope above information helps, Please mark as Best Answer so that it can help others in the future.
Thanks.
Please take a note of following:
The only similarity both RSA and AES has is that they are encryption algorithms.
RSA :
- It is an asymmetric key algorithm. Meaning, it uses 2 different keys (Public key and Private key) for encryption and decryption. Public key is available to open world, where as private key is possessed by owner.
- Public Key encryption is used for exchanging data.
- Private Key encryption is used for authentication of owner.(digital signatures)
- It is stream cipher algorithm. Meaning, entire data is encrypted at once, which takes more computational power. Hence it is slow. Mainly used for exchanging little information such as symmetric keys.
- RSA's strength and weaknesses lies in the factoring large integers.
AES :- It is a symmetric key algorithm. Meaning, same key is used for both encryption and decryption.
- It is a 128-block cipher algorithm. Meaning, the data is divided into chunks of fixed length data(128 bits). The chunks are processed in AES where each round is dependent on output of its predecessor. Large data can be encrypted using AES.
- AES's strength is in the possible key permutations using Rijndael finite field method internally.
Hope it helps. Cheers.