User bio
404 bio not found
Member since Oct 23, 2023
Replies:

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

}

Certifications & Credly badges:
David has no Certifications & Credly badges yet.
Global Masters badges:
David has no Global Masters badges yet.
Followers:
David has no followers yet.
Following:
David has not followed anybody yet.