public static function ParagonIE_Sodium_Compat::crypto_box_publickey in Automatic Updates 8
Same name and namespace in other branches
- 7 vendor/paragonie/sodium_compat/src/Compat.php \ParagonIE_Sodium_Compat::crypto_box_publickey()
Extract the public key from a crypto_box keypair.
@psalm-suppress MixedArgument
Parameters
string $keypair Keypair containing secret and public key:
Return value
string Your crypto_box public key
Throws
SodiumException
TypeError
4 calls to ParagonIE_Sodium_Compat::crypto_box_publickey()
- ParagonIE_Sodium_File::box_seal in vendor/
paragonie/ sodium_compat/ src/ File.php - Seal a file (rather than a string). Uses less memory than ParagonIE_Sodium_Compat::crypto_box_seal(), but produces the same result.
- ParagonIE_Sodium_File::box_seal_open in vendor/
paragonie/ sodium_compat/ src/ File.php - Open a sealed file (rather than a string). Uses less memory than ParagonIE_Sodium_Compat::crypto_box_seal_open(), but produces the same result.
- php72compat.php in vendor/
paragonie/ sodium_compat/ lib/ php72compat.php - sodium_compat.php in vendor/
paragonie/ sodium_compat/ lib/ sodium_compat.php
File
- vendor/
paragonie/ sodium_compat/ src/ Compat.php, line 1272
Class
Code
public static function crypto_box_publickey($keypair) {
/* Type checks: */
ParagonIE_Sodium_Core_Util::declareScalarType($keypair, 'string', 1);
/* Input validation: */
if (ParagonIE_Sodium_Core_Util::strlen($keypair) !== self::CRYPTO_BOX_KEYPAIRBYTES) {
throw new SodiumException('Argument 1 must be CRYPTO_BOX_KEYPAIRBYTES long.');
}
if (self::useNewSodiumAPI()) {
return (string) sodium_crypto_box_publickey($keypair);
}
if (self::use_fallback('crypto_box_publickey')) {
return (string) call_user_func('\\Sodium\\crypto_box_publickey', $keypair);
}
if (PHP_INT_SIZE === 4) {
return ParagonIE_Sodium_Crypto32::box_publickey($keypair);
}
return ParagonIE_Sodium_Crypto::box_publickey($keypair);
}