Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
crypto_box_keypair example
throw
new
SodiumException
(
'Could not open input file for reading'
)
;
}
/** @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 */
}
if
(
!
is_callable
(
'\\Sodium\\crypto_box_keypair'
)
)
{
/** * @see ParagonIE_Sodium_Compat::crypto_box_keypair() * @return string * @throws \SodiumException * @throws \TypeError */
function
crypto_box_keypair
(
)
{
return
ParagonIE_Sodium_Compat::
crypto_box_keypair
(
)
;
}
}
if
(
!
is_callable
(
'\\Sodium\\crypto_box_keypair_from_secretkey_and_publickey'
)
)
{
/** * @see ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey() * @param string $sk * @param string $pk * @return string * @throws \SodiumException * @throws \TypeError */
}
if
(
!
is_callable
(
'sodium_crypto_box_keypair'
)
)
{
/** * @see ParagonIE_Sodium_Compat::crypto_box_keypair() * @return string * @throws SodiumException * @throws TypeError */
function
sodium_crypto_box_keypair
(
)
{
return
ParagonIE_Sodium_Compat::
crypto_box_keypair
(
)
;
}
}
if
(
!
is_callable
(
'sodium_crypto_box_keypair_from_secretkey_and_publickey'
)
)
{
/** * @see ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey() * @param string $secret_key * @param string $public_key * @return string * @throws SodiumException * @throws TypeError */