/**
  * Import a public key
  *
  * Read a PEM formatted public key from stdin and import it into the
  * RSAWalletService.
  *
  * @return void
  * @see typo3.flow:security:importprivatekey
  */
 public function importPublicKeyCommand()
 {
     $keyData = '';
     // no file_get_contents here because it does not work on php://stdin
     $fp = fopen('php://stdin', 'rb');
     while (!feof($fp)) {
         $keyData .= fgets($fp, 4096);
     }
     fclose($fp);
     $uuid = $this->rsaWalletService->registerPublicKeyFromString($keyData);
     $this->outputLine('The public key has been successfully imported. Use the following uuid to refer to it in the RSAWalletService: ' . PHP_EOL . PHP_EOL . $uuid . PHP_EOL);
 }
    /**
     * @test
     */
    public function registerPublicKeyFromStringUsesFingerprintAsUuid()
    {
        $keyString = '-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDP7ZWzP/6x3SXyt0Al9UvyCe8D
TG6y1t7ovmWGw+D2x4BtZfbEHtNhlWHFkLLXzGKdgmzm4WjSB1fWQ1lfu5L8wY+g
HofCDIScx7AMgIB7hRB9ZMDEyWN/1vgSm8+4K4jUcD6OGLJYTSAlaQ7e2ZGaAY5h
p2P76gIh+wUlPjsr/QIDAQAB
-----END PUBLIC KEY-----';
        $this->assertEquals('cfa6879e3dfcf709db4cfd8e61fdd782', $this->rsaWalletService->registerPublicKeyFromString($keyString));
    }