ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
  • 3DES encryption
EncryptStandard (Example)
3DES encryption
This example is used to perform a 3DES encryption in an URL.
// Cryptage 3DES utilisé dans une URL
// ----------------------------------------
bufCryptéeRésultat is Buffer
bufACrypter is Buffer = "Message à crypter"
bufCléMD5 is Buffer
bufClé is Buffer = "Clé de cryptage"
 
// Hash la clé en MD5
bufCléMD5 = HashString(HA_MD5_128, bufClé)
// MD5 donne un résultat sur 128 bits (16 octets)
// Complète la clé de cryptage sur 192 bits (24 octets)
// car 3DES nécessite des clés de 192 bits (3x64 bits)
// Pour cela, il faut répéter les 64 premiers bits (8 premiers octets)
// du début à la fin de la clé
bufCléMD5 = bufCléMD5 + bufCléMD5[[TO 8]]
// Crypte en 3DES
bufCryptéeRésultat = EncryptStandard(bufACrypter, bufCléMD5, crypt3DES, ...
cryptCBC, cryptPaddingPKCS)
// Passe le résultat en base64 pour être "lisible", et sans retour chariot
bufCryptéeRésultat = Replace(Encrypt(bufCryptéeRésultat, "", ...
cryptNone, encodeBASE64), CR, "")
// Encode le tout pour pouvoir le passer sur une URL à un site
sParamètreURL is string = URLEncode(bufCryptéeRésultat)
Minimum version required
  • Version 20
This page is also available for…
Comments
Click [Add] to post a comment