ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE


  • Error handling
  • Encrypting/Decrypting a character string
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, fCrypt is kept for backward compatibility. This function is replaced by fEncrypt.
Encrypts a file in binary or ASCII format.
Remark: This file can be decrypted by fDecrypt.
Syntax
<Result> = fEncrypt(<Path of file to encrypt> , <Path of encrypted file> , <Password> [, <Type of encryption> [, <Format of encrypted file>]])
<Result>: Boolean
  • True if the encryption was performed,
  • False otherwise. To get more details on the error, use ErrorInfo with the errMessage constant.
<Path of file to encrypt>: Character string
Name and full (or relative) path of the file to encrypt (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 setup 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 setup directory or one of its subdirectories.
<Path of encrypted file>: Character string
Name and full (or relative) path of the encrypted 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 setup 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 setup directory or one of its subdirectories.
<Password>: Character string
Password used to encrypt the file. This password will be used to decrypt the encrypted file (fDecrypt). A long password provides better encryption security.
<Type of encryption>: Optional constant
Indicates the type of encryption:
cryptFast
(Default value)
Priority is given to the encryption speed (algorithm on 128 bits).
AndroidAndroid Widget This constant is not available.
cryptNoneNo encryption is performed.
cryptRC516Priority is given to the encryption security (RC5 algorithm on 16 rounds).
AndroidAndroid Widget This constant has no effect.
cryptSecurePriority is 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
Indicates the format of the encrypted file:
encodeBASE64BASE 64 format.
The file is encrypted with the BASE64 algorithm. The encrypted file will be larger (about 30%) than the initial file.
This format can be used to insert an encrypted file into the email body for example.
encodeNone or FalseBinary format.
The encrypted file may contain non-printable characters. The file will be larger (about 4 bytes) than the initial file.
encodePCS or True
(Default value)
ASCII format.
The encrypted file will contain printable characters only. The encrypted file will be larger (about 30%) than the initial file.
This format can be used to insert an encrypted file into the email body for example.
encodeUUEncodeUUEncode format.
The file is encrypted with the UUEncode algorithm. The encrypted file will be larger (about 30%) than the initial file.
This format can be used to insert an encrypted file into the email body for example.

AndroidAndroid Widget This parameter is ignored.
Remarks

Error handling

fEncrypt throws an error in the following cases:
  • the file to encrypt does not exist,
  • the file to encrypt is locked,
  • the path of the file to encrypt is invalid,
  • <Password> is an empty string,
  • the user has no read rights on the file to encrypt,
  • the user has no write rights on the encrypted file.

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 (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: wd280std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment