ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / External file functions
  • Error handling
  • Encrypting/Decrypting a character string
  • 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, fUncrypt is kept for backward compatibility. This function has been replaced with fDecrypt.
Decrypts a file that was encrypted by fEncrypt.
Syntax
<Result> = fDecrypt(<Path of file to decrypt> , <Path of decrypted file> , <Password> [, <Type of encryption used> [, <Format of encrypted file>]])
<Result>: Boolean
  • True if the decryption has been completed,
  • False otherwise. To get more details on the error, use ErrorInfo with the errMessage constant.
<Path of file to decrypt>: Character string
Name and full (or relative) path of the file to decrypt (up to 260 characters). A UNC path can be used. This file must have been encrypted by fEncrypt.
AndroidAndroid Widget This parameter can correspond to a full path or a path relative to the current directory (returned by fCurrentDir). This parameter is case-sensitive.
Reminder: In Android, the file system is read-only on the device and on the emulator. An application can only write to its installation directory or one of its subdirectories, as well as to the external memory (SDCard).
iPhone/iPadIOS WidgetMac Catalyst This parameter can correspond to a full path or a path relative to the current directory (returned by fCurrentDir). This parameter is case-sensitive.
Reminder: On iPhone/iPad, the file system is read-only on the device and on the emulator. An application can only write to its installation directory or one of its subdirectories.
<Path of decrypted file>: Character string
Name and full (or relative) path of the decrypted file (up to 260 characters). A UNC path can be used.
AndroidAndroid Widget This parameter can correspond to a full path or a path relative to the current directory (returned by fCurrentDir). This parameter is case-sensitive.
Reminder: In Android, the file system is read-only on the device and on the emulator. An application can only write to its installation directory or one of its subdirectories, as well as to the external memory (SDCard).
iPhone/iPadIOS WidgetMac Catalyst This parameter can correspond to a full path or a path relative to the current directory (returned by fCurrentDir). This parameter is case-sensitive.
Reminder: On iPhone/iPad, the file system is read-only on the device and on the emulator. An application can only write to its installation directory or one of its subdirectories.
<Password>: Character string
Password used to decrypt the file. This password must be identical to the password used to encrypt the file. A long password provides better encryption security.
<Type of encryption used>: Optional constant
Specifies the type of encryption used. This parameter must be identical to the one specified during the encryption.
cryptFast
(Default value)
Priority was given to the encryption speed (algorithm on 128 bits).
AndroidAndroid Widget This constant is not available.
cryptNoneNo encryption was performed.
cryptRC516Priority is given to the encryption security (RC5 algorithm on 16 rounds).
AndroidAndroid Widget This constant has no effect.
cryptSecurePriority was given to the encryption security (RC5 algorithm on 128 bits).
AndroidAndroid Widget The algorithm used will be a PBE algorithm (Password Based Encryption).
<Format of encrypted file>: Optional Integer constant
Specifies the format of the encrypted file. This parameter must be identical to the one specified during the encryption.
encodeBASE64BASE 64 format. The encrypted file will contain printable characters only.
encodeNone or False
(Default value)
Binary format. The encrypted file may contain non-printable characters.
encodePCS or TrueASCII format. The encrypted file will contain printable characters only.
encodeUUEncodeUUEncode format. The encrypted file will contain printable characters only.
AndroidAndroid Widget This parameter is ignored.
Remarks

Error handling

fDecrypt throws an error in the following cases:
  • the file to decrypt does not exist or it is locked,
  • the path of the file to decrypt is invalid,
  • the <Password> is an empty string or it differs from the <Password> used to encrypt the file,
  • the <Type of encryption used> differs from the <Type of encryption> specified during the encryption,
  • the <Format of encrypted file> differs from the one specified during the encryption,
  • the user has no read rights on the file to decrypt,
  • the user has no write rights on the file to decrypt.
  • a Unicode string was used for the <Path of file to decrypt> or for the <Path of decrypted file> in an operating system such as Windows 98 or Windows Me.

Encrypting/Decrypting a character string

To encrypt/decrypt a character string, use Encrypt and Decrypt.
Android

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 file in Java or Android and decrypt it with WINDEV (and conversely).
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): The encryption functions
[ + ] Using the encryption/decryption functions of WINDEV.
This example is used 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: wd290std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 07/04/2023

Send a report | Local help