I have an RSA Private key file in my folder; how do I use it for string type value encryption in C#?
Loading
I have an RSA Private key file in my folder; how do I use it for string type value encryption in C#?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rajkiran SwainPosted Mar 29, 2023, 8:26 PM
Naimish MakwanaPosted Mar 29, 2023, 9:32 AM
Hello Piyush,
Please try below code:
Function that takes a string value and an RSA private key file path as input, and returns the encrypted value as a Base64-encoded string:
To use this function, simply call it with the string value you want to encrypt and the file path of the RSA private key:
Thanks
Naimish Makwana