Deprecated: Optional parameter $keys declared before required parameter $cms_id is implicitly treated as a required parameter in /home/www/dev/work/class/blog/CmsKey.php on line 75

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\php::$title is deprecated in /home/www/dev/work/website/lvesu/class/controller/blog/php.php on line 28

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\php::$outlink is deprecated in /home/www/dev/work/website/lvesu/template/blog/cms/php.manual.tpl on line 2

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\php::$status is deprecated in /home/www/dev/work/website/lvesu/template/blog/index.head.php on line 2
PHP - Manual: rnp_op_generate_key - 互联网笔记

略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: rnp_op_generate_key

2025-06-07

rnp_op_generate_key

(PECL rnp >= 0.1.1)

rnp_op_generate_keyGenerate key

说明

rnp_op_generate_key(
    RnpFFI $ffi,
    string $userid,
    string $key_alg,
    string $sub_alg = ?,
    array $options = ?
): string|false

参数

ffi

The FFI object returned by rnp_ffi_create.

userid

PGP User ID - text that is intended to represent the name and email address of the key holder.

key_alg

Primary key algorithm (i.e. 'RSA', 'DSA', etc).

sub_alg

Subkey algorithm. If not set, subkey will not be generated.

options

An associative array with options.

Key Data type 说明
"bits" integer Primary key size in bits. Applicable only to RSA, DSA and El-Gamal keys.
"hash" string Hash algorithm used in self signature or subkey binding signature.
"dsa_qbits" integer Set size of a q parameter for DSA key. Note: appropriate default value will be set, depending on key bits. However you may override it if needed.
"curve" string Set the curve used for ECC key. Note: this is only applicable for ECDSA, ECDH and SM2 keys.
"request_password" boolean Enable requesting password via password provider. This password will be used for key encryption. Password provider callback function should be set in advance by calling rnp_ffi_set_pass_provider(). Note: this setting will be ignored if password was set via"password"
"password" string Set the password used to encrypt the secret key data.
"expiration" integer Set the key and subkey expiration time in seconds.
"sub_bits" integer Subkey size in bits. Applicable only to RSA, DSA and El-Gamal keys.
"sub_hash" string Hash algorithm used in subkey self signature or subkey binding signature.
"sub_curve" string Set the curve used for ECC subkey. Note: this is only applicable for ECDSA, ECDH and SM2 keys.

返回值

Fingerprint of the generated primary key 或者在失败时返回 false. This fingerprint can be used later to reference the key in sign and encrypt operations. The key data is stored in FFI memory context and can be saved using rnp_save_keys() or rnp_save_keys_to_path().

添加备注

用户贡献的备注

此页面尚无用户贡献的备注。

官方地址:https://www.php.net/manual/en/function.rnp-op-generate-key.php

冷却塔厂家 广告
中文GPT4.0无需注册 广告
北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3