public function exportToFile(string $filename, string $password = NULL) {
        $status = openssl_pkey_export_to_file(
            $this->getHandle(),
            $filename,
            $password
        );
        if(!$status) {
            throw new RuntimeException(OpenSSL::getLastError());
        }
    }