This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v18.4
dataStore.provideDataKey( )
|
dataStore.provideDataKey ( curPassPhrase | curDataKey ) -> Result | ||||||||
Parameter | Type | Description | ||||||
curPassPhrase | curDataKey | Text, Object |
![]() |
Current passphrase (text) or current data encryption key (object) | |||||
Result | Object |
![]() |
Result of the encryption key matching | |||||
The dataStore.provideDataKey( ) method allows providing a data encryption key for the current data file of the datastore and detects if the key matches the encrypted data. This command can be used when opening an encrypted database, or when executing any encryption operation that requires the encryption key, such as re-encrypting the data file.
Notes:
In the parameter, pass the curPassPhrase or curDataKey that matches the database:
If a valid data encryption key is provided, it is added to the keyChain in memory and the encryption mode is enabled:
Result
The result of the command is described in the returned object:
Property | Type | Description | |
success | Boolean | True if the provided encryption key matches the encrypted data, False otherwise | |
Properties below are returned only if success is FALSE | |||
status | Number | Error code (4 if the provided encryption key is wrong) | |
statusText | Text | Error message | |
errors | Collection | Stack of errors. The first error has the highest index | |
[ ].componentSignature | Text | Internal component name | |
[ ].errCode | Number | Error number | |
[ ].message | Text | Error message |
If no curPassphrase or curDataKey is given, dataStore.provideDataKey( ) returns null (no error is generated).
C_OBJECT($keyStatus)
C_TEXT($passphrase)
$passphrase:=Request("Enter the passphrase")
If(OK=1)
$keyStatus:=ds.provideDataKey($passphrase)
If($keyStatus.success)
ALERT("You have provided a valid encryption key")
Else
ALERT("You have provided an invalid encryption key, you will not be able to work with encrypted data")
End if
End if
4D Blog - New 4D commands to work with encrypted data
Data file encryption status
Encrypt data file
New data key
Product: 4D
Theme: ORDA - DataStore
Created: 4D v17 R5
4D Language Reference ( 4D v18)
4D Language Reference ( 4D v18.4)
4D Language Reference ( 4D v18.6)