array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.sodium-crypto-box-publickey-from-secretkey.php', 1 => 'sodium_crypto_box_publickey_from_secretkey', ), 'up' => array ( 0 => 'ref.sodium.php', 1 => 'Sodium 函数', ), 'prev' => array ( 0 => 'function.sodium-crypto-box-open.php', 1 => 'sodium_crypto_box_open', ), 'next' => array ( 0 => 'function.sodium-crypto-box-publickey.php', 1 => 'sodium_crypto_box_publickey', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/sodium/functions/sodium-crypto-box-publickey-from-secretkey.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 7 >= 7.2.0, PHP 8)
sodium_crypto_box_publickey_from_secretkey — Calculate the public key from a secret key
Given a secret key, calculate the corresponding public key.
This only works with the type of keys intended for use with crypto_box() (which uses Elliptic Curve Diffie-Hellman over the Montgomery curve, Curve25519; abbreviated as X25519), not crypto_sign() (which uses Edwards Digital Signature Algorithm over the Edwards Curve with the corresponding paramaters; abbreviated Ed25519).
secret_key
X25519 secret key
X25519 public key.