PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Encrypting and decrypting an external file
  • Decrypting a stream in base64binary format
  • Encryption in PHP
  • Encryption in Android/Java and decryption by a WINDEV application (or conversely)
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.
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 "Remarks" paragraph.
// Encrypt a string
ResEncrypt = Encrypt("The number of my bank account in Switzerland is 74538290", "Password")
...
// Decrypt the string
Res = Decrypt(ResEncrypt, "Password")
// Decode the data encoded in base 64
bufDecode is Buffer = Decrypt(bufBase64, "", crypteNone, 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 more details on 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.
    WINDEVWEBDEV - Server codeWindowsLinuxUniversal Windows 10 AppAndroidAndroid Widget JavaPHP This constant has no effect.
    cryptFast
    (Default value)
    Priority was given to the encryption speed (algorithm on 128 bits).
    Java The algorithm used will be a Blowfish algorithm.
    AndroidAndroid Widget This constant is not supported.
    PHP The algorithm used will be a Blowfish algorithm with 16 rounds.
    cryptNoneNo encryption was performed.
    cryptRC516Priority was given to the encryption security (RC5 algorithm on 16 rounds).
    AndroidAndroid Widget JavaPHP This constant has no effect.
    cryptSecurePriority was given to the encryption security (RC5 algorithm on 128 bits).
    AndroidAndroid Widget Java The algorithm used will be a PBE algorithm (Password Based Encryption).
    PHP The algorithm used will be a 128-bit RINJDAEL algorithm.
  • Type of Compression:
    compressLZWThe string is compressed before it is encrypted.
    AndroidAndroid Widget JavaPHP This constant has no effect.
    compressNone
    (Default value)
    No compression is performed.
    AndroidAndroid Widget JavaPHP This constant has no effect.
    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.
    AndroidAndroid Widget JavaPHP This constant has no effect.
<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.
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.
encodeNone or FalseBinary format. The encrypted file may contain non-printable characters.
encodePCS or True
(Default value)
ASCII format. The encrypted file contains printable characters only.
encodeUUEncodeUUEncode format. The encrypted file contains printable characters only.
AndroidAndroid Widget Java This parameter is ignored.
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:
ResultString = Decrypt(EncryptedString, "", cryptNone, encodeBASE64)
// or
ResultString = Decrypt(EncryptedString, encodeBASE64)
PHP

Encryption in PHP

In PHP, the BlowFish encryption (cryptFast constant) and the RINJDAEL encryption (cryptSecure constant) are based on the MCrypt library. This library is commonly used by the PHP hosting companies and therefore it is always enabled. This library can be downloaded from the PHP site.
To enable (if necessary) this library locally, the following elements are required:
  • PHP installed.
  • the PHP.INI file found in the Windows directory must include the "extension=php_mcrypt.dll" line.
  • the php_mcrypt.dll file must exist in the directory of PHP extensions. This directory is defined in the PHP.INI file by the "extension_dir" variable.
AndroidJava

Encryption in Android/Java and decryption by a WINDEV application (or conversely)

Caution: the encryption/decryption algorithms used in Java and Android differ from the ones used by WINDEV. Therefore, you cannot encrypt a character string in Java or Android and decrypt it with WINDEV (and conversely).
To encrypt a character string in Java or Android and to decrypt it with WINDEV (or conversely), use EncryptStandard and DecryptStandard.
Component: wd280std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment