public function shutdownObject()
    {
        if ($this->saveKeysOnShutdown === false) {
            return;
        }

        $temporaryKeystorePathAndFilename = $this->keystorePathAndFilename . Utility\Algorithms::generateRandomString(13) . '.temp';
        $result = file_put_contents($temporaryKeystorePathAndFilename, serialize($this->keys));

        if ($result === false) {
            throw new SecurityException('The temporary keystore file "' . $temporaryKeystorePathAndFilename . '" could not be written.', 1305812921);
        }
        $i = 0;
        while (($result = rename($temporaryKeystorePathAndFilename, $this->keystorePathAndFilename)) === false && $i < 5) {
            $i++;
        }
        if ($result === false) {
            throw new SecurityException('The keystore file "' . $this->keystorePathAndFilename . '" could not be written.', 1305812938);
        }
    }