You are here

public static function ParagonIE_Sodium_Crypto::box_publickey in Automatic Updates 8

Same name and namespace in other branches
  1. 7 vendor/paragonie/sodium_compat/src/Crypto.php \ParagonIE_Sodium_Crypto::box_publickey()

@internal Do not use this directly. Use ParagonIE_Sodium_Compat.

Parameters

string $keypair:

Return value

string

Throws

RangeException

TypeError

7 calls to ParagonIE_Sodium_Crypto::box_publickey()
ParagonIE_Sodium_Compat::crypto_box_publickey in vendor/paragonie/sodium_compat/src/Compat.php
Extract the public key from a crypto_box keypair.
ParagonIE_Sodium_Crypto::box in vendor/paragonie/sodium_compat/src/Crypto.php
X25519 key exchange followed by XSalsa20Poly1305 symmetric encryption
ParagonIE_Sodium_Crypto::box_open in vendor/paragonie/sodium_compat/src/Crypto.php
Decrypt a message encrypted with box().
ParagonIE_Sodium_Crypto::box_seal in vendor/paragonie/sodium_compat/src/Crypto.php
X25519-XSalsa20-Poly1305 with one ephemeral X25519 keypair.
ParagonIE_Sodium_Crypto::box_seal_open in vendor/paragonie/sodium_compat/src/Crypto.php
Opens a message encrypted via box_seal().

... See full list

File

vendor/paragonie/sodium_compat/src/Crypto.php, line 624

Class

ParagonIE_Sodium_Crypto
Class ParagonIE_Sodium_Crypto

Code

public static function box_publickey($keypair) {
  if (ParagonIE_Sodium_Core_Util::strlen($keypair) !== ParagonIE_Sodium_Compat::CRYPTO_BOX_KEYPAIRBYTES) {
    throw new RangeException('Must be ParagonIE_Sodium_Compat::CRYPTO_BOX_KEYPAIRBYTES bytes long.');
  }
  return ParagonIE_Sodium_Core_Util::substr($keypair, 32, 32);
}