{"title":"System.ExportEncryptionKey(Text) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/system/system-exportencryptionkey-method/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/system/system-exportencryptionkey-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/system/system-exportencryptionkey-method","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Returns a password protected temporary filepath containing the encryption key.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"System.ExportEncryptionKey(Text) Method","slug":"systemexportencryptionkeytext-method","at":0,"chars":2142},{"level":2,"title":"Syntax","slug":"syntax","at":708,"chars":148},{"level":2,"title":"Parameters","slug":"parameters","at":856,"chars":104},{"level":2,"title":"Return Value","slug":"return-value","at":960,"chars":101},{"level":2,"title":"Remarks","slug":"remarks","at":1061,"chars":242},{"level":2,"title":"Example","slug":"example","at":1303,"chars":705},{"level":2,"title":"Related information","slug":"related-information","at":2008,"chars":134}],"text":"# System.ExportEncryptionKey(Text) Method\n> Version: _Available or changed with runtime version 1.0._\nReturns a password protected temporary filepath containing the encryption key. When encrypting or decrypting data in Dynamics 365 Business Central, an encryption key is used. A single key is used per tenant and every tenant will have a different key. Keys can be exported to a file which may be necessary in the case of upgrading or migrating a system from one set of hardware to another. The EXPORTENCRYPTIONKEY method allows an administrator to specify a destination file for the key and specify a password protection for the file.\n> NOTE\n> This method is supported only in Business Central on-premises.\n## Syntax\n```al\nPath :=   System.ExportEncryptionKey(Password: Text)\n```\n> NOTE\n> This method can be invoked without specifying the data type name.\n## Parameters\nPassword\nType: ../text/text-data-type\nSpecifies the password for the encryption key file.\n## Return Value\nPath\nType: ../text/text-data-type\nA temporary filepath to where the key is exported.\n## Remarks\n> NOTE\n> This applies only to on-premises versions of Business Central.\nIf encryption is not enabled or the encryption key is not found, the following error will be displayed: An encryption key is required to complete the request.\n## Example\nThis code example uses the ExportEncryptionKey method to return a password protected file that contains an encryption key. With the Download method the file is sent from the Dynamics 365 Business Central service computer to the client computer.\nThis example requires that you create the following text constants: ExportFileName and ClientFileName.\n```al\nif not EncryptionEnabled then\n    Error('Encryption has not been enabled.');\n    ExportFileName := ExportEncryptionKey('This is my personal secret');\n\n    ClientFileName := 'ExportedKey.ekey';\n    Download(ExportFileName,'Save the encrypted key file','','Encrypted Key File (*.ekey)|*.ekey',ClientFileName);\n\n    Erase(ExportFileName);\n```\n## Related information\nsystem-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}