This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v20 R7
Register data key

Register data key 


 

Register data key ( curPassPhrase | curDataKey ) -> Function result 
Parameter Type   Description
curPassPhrase | curDataKey  Text, Object in Current passphrase (text) or current data encryption key (object)
Function result  Boolean in True if the encryption key has been successfully added to the 4D keychain, False if it was already in the 4D keychain

The Register data key command adds the data encryption key passed in parameter to the 4D keychain.

The 4D keychain is a set of one or more data encryption key(s) loaded in memory which 4D automatically scans when a data key is required to decrypt/encrypt a data file. For more information, please refer to Encrypting data.

In the first parameter, pass the curPassPhrase or curDataKey that defines the encryption key to add:

  • curPassPhrase: String used to generate the encryption key. When you use this parameter, an encryption key is generated.
  • curDataKey: Object (with encodedKey property) that contains the data encryption key. This key may have been generated with the New data key command.

 

Returned value

  • True if the encryption key is successfully loaded in the 4D keychain.
  • False if the same encryption key was already present in the 4D keychain. 

Example  

 C_TEXT($passphrase)
 C_BOOLEAN($added)
 
 $passphrase:=Request("Enter the passphrase:")
 If(OK=1)
    $added:=Register data key($passphrase)
 
    OPEN DATA FILE("data.4DD") //No key required, it is in the 4D keychain
 End if



See also 

4D Blog - New 4D commands to work with encrypted data
New data key

 
PROPERTIES 

Product: 4D
Theme: Data Security
Number: 1638

This command can be run in preemptive processes

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v17 R5

 
ARTICLE USAGE

4D Language Reference ( 4D v20 R7)