/** * Stores the given keypair and returns its fingerprint. * * The SSH fingerprint of the RSA public key will be used as an identifier for * consistent key access. * * @param OpenSslRsaKey $publicKey The public key * @param OpenSslRsaKey $privateKey The private key * @param boolean $usedForPasswords TRUE if this keypair should be used to encrypt passwords (then decryption won't be allowed!). * @return string The fingerprint which is used as an identifier for storing the key pair */ private function storeKeyPair($publicKey, $privateKey, $usedForPasswords) { $publicKeyFingerprint = $this->getFingerprintByPublicKey($publicKey->getKeyString()); $keyPair = []; $keyPair['publicKey'] = $publicKey; $keyPair['privateKey'] = $privateKey; $keyPair['usedForPasswords'] = $usedForPasswords; $this->keys[$publicKeyFingerprint] = $keyPair; $this->saveKeysOnShutdown = true; return $publicKeyFingerprint; }