PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Encrypting and decrypting an external file
  • Decrypting a stream in base64binary format
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Warning
From version 24, Uncrypt is kept for backward compatibility. This function is replaced by Decrypt.
Decrypts a character string that was encrypted by Encrypt.
Versions 20 and later
Remark: If the encryption and the decryption are performed on different platforms (encryption in Android and decryption in Windows for example), use EncryptStandard and DecryptStandard. For more details, refer to the "Notes" paragraph.
New in version 20
Remark: If the encryption and the decryption are performed on different platforms (encryption in Android and decryption in Windows for example), use EncryptStandard and DecryptStandard. For more details, refer to the "Notes" paragraph.
Remark: If the encryption and the decryption are performed on different platforms (encryption in Android and decryption in Windows for example), use EncryptStandard and DecryptStandard. For more details, refer to the "Notes" paragraph.
// Cryptage d'une chaîne
ResCrypte = Encrypt("Le numéro de mon compte en Suisse est 74538290", "MotDePasse")
...
// Décryptage de la chaîne
Res = Decrypt(ResCrypte, "MotDePasse")
// Décodage de données encodées en base 64
bufDecoder is Buffer = Decrypt(bufBase64, "", cryptNone, encodeBASE64)
Syntax
<Result> = Decrypt(<Encrypted string> , <Password> [, <Type of encryption used> [, <Format of encrypted string>]])
<Result>: Character string
  • Decrypted character string,
  • Empty string ("") if an error occurred. To get the details of the error, use ErrorInfo.
<Encrypted string>: Character string
Encrypted character string. This character string was encrypted by Encrypt.
<Password>: Character string
Password used to decrypt the character string. This password must be identical to the password that was used to encrypt the character string. A long password provides better encryption security.
<Type of encryption used>: Optional constant (or combination of constants)
Specifies the type of encryption and compression performed. This parameter must be identical to the one specified during the encryption.
  • Type of encryption:
    cryptAnsiThis constant can only be used in WINDEV Mobile for Windows CE.
    The encryption is identical to the one performed in a WINDEV or WEBDEV application.
    Useful for the applications that encrypt in WINDEV Mobile and that decrypt in WINDEV for example.
    To use this constant, <Format of encrypted string> must be set to True.
    Windows This constant has no effect.
    cryptNoneNo encryption was performed.
    cryptFast
    (Default value)
    Priority was given to the encryption speed (algorithm on 128 bits).
    cryptRC516Priority was given to the encryption security (RC5 algorithm on 16 rounds).
    cryptSecurePriority was given to the encryption security (RC5 algorithm on 128 bits).
  • Type of Compression:
    compressNone
    (Default value)
    No compression is performed.
    compressShortStringThe string is compressed via an algorithm optimized for the short character strings. This compression will be efficient only if the cryptNone constant is selected and if <Format of encrypted string> corresponds to the encodeNone constant.
    compressLZWThe string is compressed before it is encrypted.
<Format of encrypted string>: Optional Integer constant
Indicates the format of the encrypted string. This parameter must be identical to the one specified during the encryption.
encodePCS or True
(Default value)
ASCII format. The encrypted file contains printable characters only.
encodeNone or FalseBinary format. The encrypted file may contain non-printable characters.
encodeBASE64BASE 64 format. The encrypted file contains printable characters only.
To decode a buffer in base 64, you also have the ability to use Decode associated with the encodeBASE64 constant.
encodeUUEncodeUUEncode format. The encrypted file contains printable characters only.
Remarks

Encrypting and decrypting an external file

To encrypt/decrypt an external file, use fEncrypt and fDecrypt.

Decrypting a stream in base64binary format

To decrypt a string encrypted in base64, you must use:
ChaîneRésult = Decrypt(ChaîneCodée, "", cryptNone, encodeBASE64)
// ou
ChaîneRésult = Décode(ChaîneCodée, encodeBASE64)
Related Examples:
The encryption functions Unit examples (WEBDEV): The encryption functions
[ + ] This example explains how to use the encryption/decryption functions of WEBDEV. This example allows you to:
- Encrypt a character string
- Decrypt a character string
The encryption functions Unit examples (WINDEV Mobile): The encryption functions
[ + ] Using the WLanguage encryption and decryption functions.
This example is used to:
- Encrypt a character string
- Decrypt a character string
Component: wd270std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment