AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de archivos externos
  • Error handling
  • Operating mode in Windows Vista (and later)
  • Encrypting/Decrypting a character string
  • Encryption in PHP
  • Encryption in Android/Java and decryption by a WINDEV application (or conversely)
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Advertencia
A partir de la versión 24, fUncrypt se conserva por motivos de compatibilidad. Esta función ha sido reemplazada por fDecrypt.
Decrypts a file that was encrypted by fEncrypt.
WINDEVWEBDEV - Código ServidorReportes y ConsultasJavaCódigo de Usuario (UMC)Ajax
// Decrypt a file
ResDecrypt = fDecrypt("C:\MyDir\EncryptedFile.txt", "C:\MyDir\DecryptedFile.txt", "Password")
Sintaxis
<Result> = fDecrypt(<Path of file to decrypt> , <Path of decrypted file> , <Password> [, <Type of encryption used> [, <Format of encrypted file>]])
<Result>: Boolean
  • True if 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.
WindowsLinux This parameter can be in Ansi or Unicode format.
AndroidWidget Android 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: In iOS/iPadOS, 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.
WindowsLinux This parameter can be in Ansi or Unicode format.
AndroidWidget Android 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: In iOS/iPadOS, 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 or Secret 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.
Novedad versión 2025
Cadenas secretas: Si utiliza el almacén de cadenas secretas, el tipo de cadena secreta utilizado para este parámetro debe ser "ANSI o Unicode string".
Para obtener más información sobre las cadenas secretas y el almacén, consulte Almacén de cadenas secretas.
Novedad versión 2025
AndroidWidget Android Las cadenas secretas no están disponibles para este parámetro en aplicaciones Android y widgets de Android.
<Type of encryption used>: Optional constant
Specifies the type of encryption used. This parameter must be identical to the one specified during the encryption.
encryptFast
(Default value)
Priority was given to the encryption speed (algorithm on 128 bits).
Java The algorithm used will be a Blowfish algorithm.
AndroidWidget Android This constant is not available.
PHP The algorithm used will be a Blowfish algorithm with 16 rounds.
encryptNoneNo encryption was performed.
encryptRC516Priority is given to the encryption security (RC5 algorithm on 16 rounds).
AndroidWidget Android JavaPHP This constant has no effect.
encryptSecurePriority was given to the encryption security (RC5 algorithm on 128 bits).
AndroidWidget Android Java The algorithm used will be a PBE algorithm (Password Based Encryption).
PHP The algorithm used will be a 128-bit RIJNDAEL algorithm.
<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.
AndroidWidget Android Java This parameter is ignored.
Observaciones

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.
WINDEVWEBDEV - Código ServidorReportes y ConsultasCódigo de Usuario (UMC)

Operating mode in Windows Vista (and later)

If this function does not work properly in Windows Vista (and later), check whether the file or directory used is not in one of the system directories (Windows directory or "Program Files" directory).
In Windows Vista (and later), with the UAC mechanism (User Account Control) enabled, you must have administrator privileges to handle and/or modify the files or directories in system directories (Windows directory or "Program Files" directory).
Programming tip: If you need to manipulate / modify files or directories, without needing administrator privileges, it is advisable:
  • avoid writing to the Windows directory or to the "Program Files" directory,
  • use the system directory of the application (returned by SysDir with the srAppDataCommun constant, for example).
Remark: Under Windows Vista (and higher), the virtualization mechanism makes applications "Vista-compatible".. If the file is created in a system directory without having sufficient rights, this file will actually be created in another directory (C:\Users\<LOGIN>AppData\Local\VirtualStore\Windows\). In this case, the file cannot be shared between several applications.

Encrypting/Decrypting a character string

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

Encryption in PHP

In PHP, the BlowFish encryption (encryptFast constant) and the RINJDAEL encryption (encryptSecure constant) are based on the MCrypt library. This library is commonly used by the PHP hosting providers 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)

Warning: the encryption/decryption algorithms used in Java and Android are not the same as those used by WINDEV. Therefore, you cannot encrypt a file in Java or Android and decrypt it with WINDEV and vice versa.
Componente: wd300std.dll
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 16/05/2025

Señalar un error o enviar una sugerencia | Ayuda local