Just to ensure you, because it is not mentioned in the manual: of course, only the public key is exported, even if you have the private key in your keyring.
PHP - Manual: gnupg_export
2024-12-21
(PECL gnupg >= 0.1)
gnupg_export — Exports a key
$identifier
, string $fingerprint
): string
Exports the key fingerprint
.
On success, this function returns the keydata.
On failure, this function returns false
.
示例 #1 Procedural gnupg_export() example
<?php
$res = gnupg_init();
$export = gnupg_export($res,"8660281B6051D071D94B5B230549F9DC851566DC");
echo $export;
?>
示例 #2 OO gnupg_export() example
<?php
$gpg = new gnupg();
$export = $gpg->export("8660281B6051D071D94B5B230549F9DC851566DC");
?>
Just to ensure you, because it is not mentioned in the manual: of course, only the public key is exported, even if you have the private key in your keyring.
官方地址:https://www.php.net/manual/en/function.gnupg-export.php