I use the same key for both operation, my bad, but even using the private and the public key don't get me to the goal
ClassMethod UnitTest()
{
set inputPlainText = "David"
set privKeyFileName = "C:\temp\toto.pem"
set pubKeyFileName = "C:\temp\toto_pub.pem"
// Lire la clé privée depuis le fichier
set privobjCharFile = ##class(%Stream.FileCharacter).%New()
set privobjCharFile.Filename = privKeyFileName
set privKey = privobjCharFile.Read()
// Lire la clé publique depuis le fichier
set pubobjCharFile = ##class(%Stream.FileCharacter).%New()
set pubobjCharFile.Filename = pubKeyFileName
set pubKey = pubobjCharFile.Read()
// Chiffrer le texte en utilisant RSA
set encryptedText = $System.Encryption.RSAEncrypt(inputPlainText, privKey)
// Déchiffrer le texte en utilisant RSA avec la clé publique
set decryptedText = $System.Encryption.RSADecrypt(encryptedText, pubKey)
// retour
quit decryptedText
}
Bravo Muhammad very helpful, I need today to deep dive in docker, and you help me a lot
I found
But I Don't understand what is going on...
The same code is working find If I call it from the terminal
But If I'm debug the code from Visual Studio Code the decrypt is allways returning me empty string.
Do you see what is going on ???