| 4D v18New data key | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | 
    4D v18
 New data key 
         | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| New data key ( passPhrase ) -> Function result | ||||||||
| Parameter | Type | Description | ||||||
| passPhrase | Text |   | Passphrase to use to generate the AES data encryption key | |||||
| Function result | Object |   | Object containing the key (encodedKey property) | |||||
The New data key command generates a binary data encryption key from the text passed in the passPhrase parameter.
The encoded key can be saved locally, in order to be stored on an removable device, like an USB key (see Storing data encryption keys in files in the 4D Design Reference). Connecting this device to the machine that hosts the encrypted database will automatically allow the user to access the encrypted data.
You can pass any character in passPhrase. The same passPhrase will always produce the same data encryption key.
Returned value
The returned object contains the following property:
| Property | Type | Description | 
| encodedKey | Text | AES encryption key (SHA 256-bit) generated from the passPhrase | 
If an empty string was passed in passPhrase, the command returns null.
You want to save an encryption key in a .4DKeyChain file:
 C_OBJECT($dataKey)
 C_TEXT($passphrase)
 
 $passphrase:=Request("Enter the passphrase:")
 If(OK=1)
    $dataKey:=New data key($passphrase)
    TEXT TO DOCUMENT("generatedKey.4DKeyChain";JSON Stringify($dataKey))
 End if
									4D Blog - New 4D commands to work with encrypted data
									
									dataStore.provideDataKey( )
									
									Discover data key
									
									Encrypt data file
									
									Register data key
									
	Product:  4D
	Theme:  Data Security
	Number:  
        1611
        
        
        
	
	Created:  4D v17 R5
	
	
	4D Language Reference ( 4D v18)
	
	
	
 Add a comment
Add a comment