Skip to content

Stdlib: openssl_pkey_new/get_private/export lifecycle (#6295) - #16593

Merged
PurHur merged 3 commits into
masterfrom
fix/6295-openssl-pkey-lifecycle
Jul 5, 2026
Merged

PurHur merged 3 commits into
masterfrom
fix/6295-openssl-pkey-lifecycle

Conversation

@PurHur

@PurHur PurHur commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • Implement openssl_pkey_new(), openssl_pkey_get_private(), and openssl_pkey_export() in ext/openssl/ using libcrypto FFI (VmOpensslPkeyNative) — php-src reference: ext/openssl/xp.c.
  • Register OPENSSL_KEYTYPE_* constants and OpenSSLAsymmetricKey wrapping via VmOpensslObjects::wrapKey().
  • Add openssl_pkey_export to BuiltinByRefParams so the PEM out-parameter binds by reference (same pattern as openssl_sign).

Root cause

openssl_pkey_new was a stub throwing LogicException; export/get_private were unregistered. By-ref export arg was missing from BuiltinByRefParams, so $out stayed empty despite a successful export.

Verification

php bin/vm.php test/repro/maintainer_gap_openssl_pkey_lifecycle.php
# ok

vendor/bin/phpunit test/compliance/VMTest.php --filter openssl_pkey_lifecycle
# OK (1 test, 1 assertion)

./script/ci-fast.sh
# exit 0 (inventory + spine sync + VM driver probe)

Closes #6295

Made with Cursor

…FI (#6295)

Wire RSA key generation and PEM import/export through VmOpensslPkeyNative,
register OPENSSL_KEYTYPE_* constants, and mark openssl_pkey_export out param
by-reference so Zend-parity lifecycle works on VM.

Co-authored-by: Cursor <cursoragent@cursor.com>
PurHur and others added 2 commits July 5, 2026 18:34
Resolve generated-doc conflicts by taking master; spine sync remains green.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 0d38399 into master Jul 5, 2026
@PurHur
PurHur deleted the fix/6295-openssl-pkey-lifecycle branch July 5, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stdlib: openssl_pkey_new/openssl_pkey_get_private/openssl_pkey_export — key pair API missing (ext/openssl/xp.c)

1 participant