Reputation: 297
I am stuck into a task where I want to Encrypt the user password with RSA public key into Angular 7 and same decrypt with private key into C# Please help me into this task Many many thanks in advance.
Upvotes: 1
Views: 6216
Reputation: 11
node-forge can be used at angular
import * as Forge from 'node-forge';
encryptWithPublicKey(valueToEncrypt: string): string {
const rsa = Forge.pki.publicKeyFromPem(this.publicKey);
const encryptedBytes = rsa.encrypt(valueToEncrypt.toString(),'RSAES-PKCS1-V1_5');
return window.btoa(encryptedBytes)
}
}
Upvotes: 0
Reputation: 297
Here are some Link which are help full in this task:
Below libs are helpful in generating RSA Asymmetric Encryption:(Angular)
node-rsa: https://www.npmjs.com/package/node-rsa
quick-encrypt: https://www.npmjs.com/package/quick-encrypt
asymmetric-crypto: https://www.npmjs.com/package/asymmetric-crypto
Upvotes: 2