PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

  • 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/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Warning
From version 22, this function is kept for backward compatibility. We recommend that you use CryptStandard and UncryptStandard.
Decrypts a character string that was encrypted by Crypt.
Versions 20 and later
Note: If the encryption and the decryption are performed on different platforms (encryption in Android and decryption in Windows for example), use CryptStandard and UncryptStandard. See "Remarks" for more details.
New in version 20
Note: If the encryption and the decryption are performed on different platforms (encryption in Android and decryption in Windows for example), use CryptStandard and UncryptStandard. See "Remarks" for more details.
Note: If the encryption and the decryption are performed on different platforms (encryption in Android and decryption in Windows for example), use CryptStandard and UncryptStandard. See "Remarks" for more details.
Versions 15 and later
Android This function is now available for the Android applications.
New in version 15
Android This function is now available for the Android applications.
Android This function is now available for the Android applications.
Versions 16 and later
PHP This function is now available for the PHP sites.
WINDEVLinux This function is now available for the WINDEV applications in Linux.
New in version 16
PHP This function is now available for the PHP sites.
WINDEVLinux This function is now available for the WINDEV applications in Linux.
PHP This function is now available for the PHP sites.
WINDEVLinux This function is now available for the WINDEV applications in Linux.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
// Encrypt a string
ResEncrypt = Crypt("The number of my bank account in Switzerland is 74538290", "Password")
...
// Decrypt the string
Res = Uncrypt(ResEncrypt, "Password")
// Decode the data encoded in base 64
bufDecode is Buffer = Uncrypt(bufBase64, "", crypteNone, encodeBASE64)
Syntax
<Result> = Uncrypt(<Encrypted String> , <Password> [, <Type of Encryption Used> [, <Format of Encrypted String>]])
<Result>: Character string
  • Decrypted character string,
  • Empty string ("") if an error occurred. To find out the error details, use ErrorInfo.
<Encrypted String>: Character string (with quotes)
Encrypted character string. This character string was encrypted by Crypt.
<Password>: Character string (with quotes)
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:
    cryptAnsiWindows Mobile This 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 codeWindowsLinuxAndroidAndroid Widget Universal Windows 10 AppJavaPHP This constant has no effect.
    cryptNoneNo encryption was performed.
    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.
    Versions 16 and later
    PHP The algorithm used will be a Blowfish algorithm with 16 rounds.
    New in version 16
    PHP The algorithm used will be a Blowfish algorithm with 16 rounds.
    PHP The algorithm used will be a Blowfish algorithm with 16 rounds.
    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).
    Versions 16 and later
    PHP The algorithm used will be a 128-bit RINJDAEL algorithm.
    New in version 16
    PHP The algorithm used will be a 128-bit RINJDAEL algorithm.
    PHP The algorithm used will be a 128-bit RINJDAEL algorithm.
  • Type of compression:
    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.
    compressLZWThe string is compressed before it is encrypted.
    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.
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.
AndroidAndroid Widget Java This parameter is ignored.
Remarks

Encrypting and decrypting an external file

To encrypt/decrypt an external file, use fCrypt and fUncrypt.

Decrypting a stream in base64binary format

To decrypt a string encrypted in base64, you must use:
ResultString = Uncrypt(EncryptedString, "", cryptNone, encodeBASE64)
// or
ResultString = Uncrypt(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).
Versions 20 and later
To encrypt a character string in Java or Android and to decrypt it with WINDEV (or conversely), use CryptStandard and UncryptStandard.
New in version 20
To encrypt a character string in Java or Android and to decrypt it with WINDEV (or conversely), use CryptStandard and UncryptStandard.
To encrypt a character string in Java or Android and to decrypt it with WINDEV (or conversely), use CryptStandard and UncryptStandard.
Related Examples:
The Crypt functions Unit examples (WEBDEV): The Crypt 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 Crypt functions Unit examples (WINDEV): The Crypt functions
[ + ] Using the encryption/decryption functions of WINDEV.
This example is used to:
- Encrypt a character string
- Decrypt a character string
The Crypt functions Unit examples (WINDEV Mobile): The Crypt functions
[ + ] Using the WLanguage encryption and decryption functions.
This example is used to:
- Encrypt a character string
- Decrypt a character string
Components
WINDEVWEBDEV - Server codeReports and Queries wd230std.dll
Windows Mobile wp230std.dll
Java wd230java.jar
Linux wd230std.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Exemplo Transformar Base String 64 Em Pdf
s_xml_documento is string="D:\amarildo\Giuliano_Sapucaia\xmlserv_15417338000110\xmlserv_Retorno\12-nfsepdf.xml"
s_meu_xml is string=fLoadText(s_xml_documento)
XMLDocument("XML1",s_meu_xml)
s_string_em_formato_base64 is string=XMLRead("XML1","/resPedidoLoteNFSePDF/NFS-ePDF")
s_transforma_pdf is string = Uncrypt(s_string_em_formato_base64 ,"",cryptNone,encodeBASE64)
//No Mobile // s_transforma_pdf = Uncrypt(s_string_em_formato_base64 ,"",cryptNone)
// //no Mobile o ultimo parâmetro e ignorado
fSaveBuffer("E:\aleva\teste3.pdf",s_transforma_pdf)
ShellExecute("E:\aleva\teste3.pdf")

//Blog com Video e Exemplo
http://windevdesenvolvimento.blogspot.com.br/2016/03/curso-windev-string-004-transformar.html
De matos AMARILDO
Mar. 03 2016