/** @var resource $ofp */
$ofp =
fopen($outputFile, 'wb'
);
if (!
is_resource($ofp)) { fclose($ifp);
throw new SodiumException('Could not open output file for writing'
);
} /** @var string $ephKeypair */
$ephKeypair = ParagonIE_Sodium_Compat::
crypto_box_keypair();
/** @var string $msgKeypair */
$msgKeypair = ParagonIE_Sodium_Compat::
crypto_box_keypair_from_secretkey_and_publickey( ParagonIE_Sodium_Compat::
crypto_box_secretkey($ephKeypair),
$publicKey );
/** @var string $ephemeralPK */
$ephemeralPK = ParagonIE_Sodium_Compat::
crypto_box_publickey($ephKeypair);
/** @var string $nonce */
$nonce = ParagonIE_Sodium_Compat::
crypto_generichash( $ephemeralPK .
$publicKey,
'',