Neos\Flow\Security\Cryptography\RsaWalletServicePhp::getPublicKey PHP Метод

getPublicKey() публичный Метод

Returns the public key for the given fingerprint
public getPublicKey ( string $fingerprint ) : OpenSslRsaKey
$fingerprint string The fingerprint of the stored key
Результат OpenSslRsaKey The public key
    public function getPublicKey($fingerprint)
    {
        if ($fingerprint === null || !isset($this->keys[$fingerprint])) {
            throw new InvalidKeyPairIdException('Invalid keypair fingerprint given', 1231438860);
        }
        return $this->keys[$fingerprint]['publicKey'];
    }

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