This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20.6
Decrypt data BLOB
|
Decrypt data BLOB ( blobToDecrypt ; keyObject | passPhrase ; salt ; decryptedBLOB ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
blobToDecrypt | BLOB |
![]() |
BLOB to decrypt | |||||
keyObject | passPhrase | Object, Text |
![]() |
JSON object containing the encryption key or passphrase for direct encryption key generation (text) | |||||
salt | Longint |
![]() |
Additional salt for algorithm | |||||
decryptedBLOB | BLOB |
![]() |
decrypted BLOB | |||||
Function result | Boolean |
![]() |
True if decryption has been correctly performed, False otherwise | |||||
The Decrypt data BLOB command decrypts the blobToDecrypt parameter with the same algorithm as 4D uses to decrypt data (AES-256) and returns the result in decryptedBLOB.
You can use either a keyObject or a passPhrase to decrypt the BLOB:
The number passed in the salt parameter of Decrypt data BLOB must match the one used for encryption.
If the decryption is successful, the decrypted data is returned in the decryptedBLOB parameter and the command returns True.
In case of error, the BLOB is returned empty and the command returns false.
The following example shows how to decrypt an encrypted file located in the RESOURCES folder of the database:
var $fileToDecrypt;$decryptedFile : 4D.File
var $blobToDecrypt;$decryptedBlob : Blob
var $result : Boolean
$fileToDecrypt:=File("/RESOURCES/encryptedConfidential.txt")
$decryptedFile:=File("/RESOURCES/decryptedConfidential.txt")
$blobToDecrypt:=$fileToDecrypt.getContent()
$result:=Decrypt data BLOB($blobToDecrypt;"myPassPhrase";MAXLONG;$decryptedBlob)
$decryptedFile.setContent($decryptedBlob)
The passPhrase and salt used for decryption are identical to the passPhrase and salt used for encryption (see the Encrypt data BLOB example).
Encrypt data BLOB
Encrypt data file
Encrypt your own data with the 4D algorithm
New data key
Product: 4D
Theme: Data Security
Number:
1774
Created: 4D v19
4D Language Reference ( 4D v20)
4D Language Reference ( 4D v20.1)
4D Language Reference ( 4D v20.2)
4D Language Reference ( 4D v20.3)
4D Language Reference ( 4D v20.4)
4D Language Reference ( 4D v20.5)
4D Language Reference ( 4D v20.6)