public function download_for_offline_usage(string $srcpath, string $targetpath): void {
        $this->systemwebdavclient->open();
        $webdavendpoint = issuer_management::parse_endpoint_url('webdav', $this->issuer);
        $srcpath = ltrim($srcpath, '/');
        $sourcepath = $webdavendpoint['path'] . $srcpath;

        // Write file into temp location.
        if (!$this->systemwebdavclient->get_file($sourcepath, $targetpath)) {
            $this->systemwebdavclient->close();
            throw new repository_exception('cannotdownload', 'repository');
        }
        $this->systemwebdavclient->close();
    }