PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
New WINDEV, WEBDEV, WINDEV Mobile 24 feature!
  • Asymmetric encryption of an envelope
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
Performs an asymmetric encryption of an envelope.
Example
// Encrypting a character string
//---------------------------------------
bufToEncrypt is Buffer = "Message to encrypt"
bufEncryptedMessage is Buffer
sPublicKeyFile is string = fExeDir() + "\PublicKey.pem"
sPublicKeyPassword is string = "xxx"

bufEncryptedMessage = EncryptAsymmetricEnvelopped(bufToEncrypt, sPublicKeyFile, ...
sPublicKeyPassword)

// Decryption  
// -------------
bufEncryptedMessage is Buffer
bufDecryptedMessage is Buffer
sPrivateKeyFile is string = fExeDir() + "\PrivateKey.pem"
sPrivateKeyPassword is string = "xxx"

bufDecryptedMessage = DecryptAsymmetricEnvelopped(bufEncryptedMessage, sPrivateKeyFile, ...
sPasswordPrivateKey)
Syntax
<Result> = EncryptAsymmetricEnvelopped(<Content to encrypt> , <Public key file> [, <Password>])
<Result>: Buffer
All the information necessary for decryption (algorithms used, encrypted key, initialization vector and encrypted buffer).
<Content to encrypt>: Character string or Buffer
Character string or buffer to encrypt.
<Public key file>: Character string (with quotes)
Name and path of the file corresponding to the public key that will be used to encrypt.
<Password>: Optional character string (with quotes)
Key file password (if required).
Remarks

Asymmetric encryption of an envelope

EncryptAsymmetricEnvelopped generates a random encryption key that will be used to to encrypt <Content to encrypt> with a symmetric algorithm.
The key is encrypted with the public key of <Public key file>.
<Result> contains a buffer that concatenates all the necessary information for the decryption (algorithms used, encrypted key, initialization buffer and encrypted buffer).
Notes:
  • The private key is encrypted using OAEP padding.
  • The message is encrypted using AES 256 in CBC with PKCS padding.
Component : wd240com.dll
Minimum version required
  • Version 24
This page is also available for…
Comments
Click [Add] to post a comment