C# RSA encryption-decryption with my own key
C# RSA encryption-decryption SHA256 1024bit with my own private key, public key — generated with cmd or PowerShell on OpenSSL or RSACryptoServiceProvider XML.
OpenSSL generates the private key and public key.
Example1
1.Create RSA private key 1024
>openssl genrsa -out rsa-private.txt 1024
2.Create RSA public key with private key
>openssl rsa -in .\rsa-private.txt -out rsa-public.txt -pubout -outform PEM
You got a result 2 file in the directory (rsa-private.txt & rsa-public.txt)
Now we will be coding with encryption-decryption
Output
Done!
=======================================
RSACryptoServiceProvider XML
Example2
Frist create RSA public key and private key XML
You got a result to be like this and write file on the path in class StreamWriter
Second, encrypt and decrypt string follow my code below
RUN
Done!
ref :
https://www.codegrepper.com/code-examples/csharp/c%23+rsa+example
link:https://gist.github.com/ststeiger/f4b29a140b1e3fd618679f89b7f3ff4a
https://www.programmersought.com/article/7492692431/
Hope you enjoy with JBOSS-DEV
Thank you