Points to a password protected file that contains the key on the current server.
When encrypting or decrypting data in Microsoft Dynamics NAV, an encryption key is used. Microsoft Dynamics NAV uses a single key per tenant and every tenant will have a different key. Keys can be created or imported if one exists already, as may be the case if upgrading or migrating a system from one set of hardware to another. The IMPORTENCRYPTIONKEY function allows an administrator to specify a file (password protected) which contains a key and imports it to the current Microsoft Dynamics NAV Server.
Note |
---|
In systems with multiple Microsoft Dynamics NAV Server instances, you must run the IMPORTENCRYPTIONKEY function for each instance. |
Important |
---|
Use the System Restore permission set in Microsoft Dynamics NAV to allow importing the encryption key. |
IMPORTENCRYPTIONKEY(filename, pwd) |
Parameters
- filename
- Value: String The file that contains the encryption key.
- pwd
- Value: String The password that protects the file.
Exceptions
If the import key file cannot be imported, the following error will be displayed: Import Failed. The provided encryption key file contains invalid data and could not be imported.
Example
This code example uses the ENCRYPTIONENABLED and ENCRYPTIONKEYEXISTS functions to do a check before importing the encryption key.
This example requires that you create a text constant ServerFileName.
Copy Code | |
---|---|
IF ENCRYPTIONENABLED THEN IF ENCRYPTIONKEYEXISTS THEN IF NOT CONFIRM('Encryption has been enabled and the server already contains an encryption key.\' + 'Importing a key will overwrite any existing key and may result in lost data.\\' + 'Do you wish to continue?') THEN EXIT ELSE IF NOT CONFIRM('Importing a key different from the already configured key will result in data corruption.\\' + 'Do you wish to continue?') THEN EXIT IF NOT UPLOAD('Upload encrypted key','','Encrypted Key File (*.ekey)|*.ekey','ExportedKey.ekey',ServerFileName) THEN EXIT; IMPORTENCRYPTIONKEY(ServerFileName,'This is my personal secret'); ERASE(ServerFileName); |