PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
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
Encrypts a buffer using an asymmetric encryption algorithm (RSA) that requires a public key and a private key.
This encrypted message can be decrypted:
  • with the DecryptAsymmetric function.
  • with third-party software (using the same padding options).
Versions 25 and later
Android Widget This function is now available in Android widget mode.
Android This function is now available for Android applications.
New in version 25
Android Widget This function is now available in Android widget mode.
Android This function is now available for Android applications.
Android Widget This function is now available in Android widget mode.
Android This function is now available for Android applications.
Example
// Cryptage d'une chaîne de caractères
//---------------------------------------
bufACrypter is Buffer = "Message à crypter"
bufMessageCrypté is Buffer
sFichierCléPublique is string = fExeDir() + "\ClePublique.pem"
sMotDePasseCléPublique is string = "xxx"
 
bufMessageCrypté = EncryptAsymmetric(bufACrypter, sFichierCléPublique, ...
sMotDePasseCléPublique, cryptPaddingPKCS1)
 
// Décryptage  
// -------------
bufMessageCrypté is Buffer
bufMessageDécrypté is Buffer
sFichierCléPrivée is string = fExeDir() + "\ClePrivee.pem"
sMotDePasseCléPrivée is string = "xxx"
 
bufMessageDécrypté = DecryptAsymmetric(bufMessageCrypté, sFichierCléPrivée, ...
sMotDePasseCléPrivée, cryptPaddingPKCS1)
Syntax
<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
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
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:
cryptPaddingPKCS1
(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: wd270com.dll
Minimum version required
  • Version 24
This page is also available for…
Comments
Click [Add] to post a comment