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

initializeObject() public method

Initializes the rsa wallet service by fetching the keys from the keystore file
public initializeObject ( ) : void
return void
    public function initializeObject()
    {
        if (file_exists($this->keystorePathAndFilename)) {
            $this->keys = unserialize(file_get_contents($this->keystorePathAndFilename));
        }
        $this->saveKeysOnShutdown = false;
    }

Usage Example

 /**
  * @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'));
 }