Neos\Flow\Security\Cryptography\RsaWalletServicePhp::destroyKeypair PHP Method

destroyKeypair() public method

Destroys the keypair identified by the given fingerprint
public destroyKeypair ( string $fingerprint ) : void
$fingerprint string The fingerprint
return void
    public function destroyKeypair($fingerprint)
    {
        if ($fingerprint === null || !isset($this->keys[$fingerprint])) {
            throw new InvalidKeyPairIdException('Invalid keypair fingerprint given', 1231438863);
        }
        unset($this->keys[$fingerprint]);
        $this->saveKeysOnShutdown = true;
    }

Usage Example

 /**
  * @test
  */
 public function shutdownSavesKeysToKeystoreFileIfKeysWereModified()
 {
     $this->assertFalse(file_exists('vfs://Foo/EncryptionKey'));
     $keyPairUuid = $this->rsaWalletService->generateNewKeypair(true);
     $this->rsaWalletService->shutdownObject();
     $this->assertTrue(file_exists('vfs://Foo/EncryptionKey'));
     $this->rsaWalletService->destroyKeypair($keyPairUuid);
     $this->rsaWalletService->initializeObject();
     $this->rsaWalletService->getPublicKey($keyPairUuid);
 }