The current definition of copy database API states
/// Copies a canned databaes from the given path to a new database with the given name and
/// the configuration. The new database will be created at the directory specified in the
/// configuration. Without given the database configuration, the default configuration that
/// is equivalent to setting all properties in the configuration to nil will be used.
/// - Parameters:
/// - path: The source database path.
/// - name: The name of the new database to be created.
/// - config: The database configuration for the new database name.
Requirement: Copy (unencrypted) database and encrypt the target copy
Expected: Specify encryptionKey in config and expect it to work
Observed: Arcane exception is thrown. Turns out that encryptionKey thats specified in config is expected is for decrypting source database
There are several related issues here
1) API spec is not aligned. If config is for target, there cannot not be expectation of providing decryption key for source db in that config. Seems like we should have a different option for specifying key for encrypted source database
2) Error log is non-informative. I don't have it at hand but you can test it and you will see that it provides no indication of the mistake
3) API documentation needs to be updated to describe what should be expected (and what one should do if they want to encrypt target database)