Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Stored procedures
Encrypts a buffer using an asymmetric encryption algorithm (RSA) that requires a public key and a private key.
This encrypted message can be decrypted:
// Encrypting a character string
bufToEncrypt is Buffer = "Message to encrypt"
bufEncryptedMessage is Buffer
sPublicKeyFile is string = fExeDir() + "\PublicKey.pem"
sPublicKeyPassword is string = "xxx"
bufEncryptedMessage = EncryptAsymmetric(bufToEncrypt, sPublicKeyFile, ...
sPublicKeyPassword, cryptPaddingPKCS1)
// Decryption  
// -------------
bufEncryptedMessage is Buffer
bufDecryptedMessage is Buffer
sPrivateKeyFile is string = fExeDir() + "\PrivateKey.pem"
sPrivateKeyPassword is string = "xxx"
bufDecryptedMessage = DecryptAsymmetric(bufEncryptedMessage, sPrivateKeyFile, ...
sPrivateKeyPassword, cryptPaddingPKCS1)
<Result> = EncryptAsymmetric(<Content to encrypt> , <Public key file> [, <Password> [, <Padding>]])
<Result>: Character string or Buffer
Result of encryption for the specified message.
<Content to encrypt>: Buffer
Buffer to encrypt.
Caution: The size of the message to be encrypted must be smaller than the size of the key minus the minimum padding size (11 bytes for PKCS1 and 41 for OAEP).
For example, for a 4096-bit key and OAEP padding, the message cannot exceed 471 bytes.
<Public key file>: Character string (with quotes)
Name and path of the file corresponding to the public key that will be used to encrypt. pem, der and p12 key formats are supported.
<Password>: Optional character string (with quotes)
Key file password (if required).
<Padding>: Optional Integer constant
Padding mode of encrypted data to be compatible with the size required by the encryption algorithms by blocks:
(Default value)
Padding according to the PKCS 1 algorithm (Public Key Cryptographic Standards).
cryptPaddingOAEPPadding according to the OAEP algorithm (Optimal Asymmetric Encryption Padding).
Related Examples:
Asymmetric encryption Unit examples (WINDEV): Asymmetric encryption
[ + ] Using the asymmetric encryption functions (EncryptAsymmetric, DecryptAsymmetric)
Business / UI classification: Business Logic
Component: wd260com.dll
Minimum version required
  • Version 24
This page is also available for…
Click [Add] to post a comment