Hello everybody,
Good health to everyone !! May a treatment for COVID-19 be available SOON !!!!!!.
I want to encrypt/sign a conversation between two programs with a one time public/private key pair.
How do you generate such a pair with VFP code?
Thank you very much.
Alex
Here you go:
do wwDotNetBridge
LOCAL loBridge as wwDotNetBridge
loBridge = GetwwDotnetBridge()
loRSA = loBridge.CreateInstance("System.Security.Cryptography.RSACryptoServiceProvider",2048)
? loBridge.cErrorMsg
lcPublic = loRSA.ToXmlString(.F.)
lcPrivate = loRSA.ToXmlString(.T.)
? lcPublic
? lcPrivate
Now using that is a bit more of an exercise... The RSACryptoServiceProvider class allows you to load keys and verify them too.
What are you trying to do here? Applications rarely need this private/public encryption. This is more for big known entities where clients need to ensure the server they're talking to can be verified that the server is what they're claiming to be.
For application encryption you can just use symetric keys for two-way encryption or asymetric hashes for one way encryption (like user passwords)...
+++ Rick ---
Good question. I know it's overkill but I confess I want to learn the technique.
The application is a web portal where our customers' employees ask questions that are resolved by sending an encrypted query to a program that is running alongside our desktop app. It's a Rube-Goldberg-contraption to provide a web interface to a desktop application.
Thanks for the answer.
Stay healthy !!!
Alex