Generates a new keypair and returns a fingerprint to refer to it
public generateNewKeypair ( boolean $usedForPasswords = false ) : string | ||
$usedForPasswords | boolean | TRUE if this keypair should be used to encrypt passwords (then decryption won't be allowed!). |
Результат | string | The RSA public key fingerprint for reference |
/** * @test */ public function shutdownDoesNotSavesKeysToKeystoreFileIfKeysWereNotModified() { $this->assertFalse(file_exists('vfs://Foo/EncryptionKey')); $keyPairUuid = $this->rsaWalletService->generateNewKeypair(true); $this->rsaWalletService->shutdownObject(); $this->assertTrue(file_exists('vfs://Foo/EncryptionKey')); $this->rsaWalletService->initializeObject(); $this->rsaWalletService->getPublicKey($keyPairUuid); // Hack: remove the file so we can actually detect if shutdown() would write it: unlink('vfs://Foo/EncryptionKey'); $this->rsaWalletService->shutdownObject(); $this->assertFalse(file_exists('vfs://Foo/EncryptionKey')); }
/** * Generate a public/private key pair and add it to the RSAWalletService * * @param boolean $usedForPasswords If the private key should be used for passwords * @return void * @see neos.flow:security:importprivatekey */ public function generateKeyPairCommand($usedForPasswords = false) { $fingerprint = $this->rsaWalletService->generateNewKeypair($usedForPasswords); $this->outputLine('The key pair has been successfully generated. Use the following fingerprint to refer to it in the RSAWalletService: ' . PHP_EOL . PHP_EOL . $fingerprint . PHP_EOL); }