Display the drop-down list

openssl_pkey_new()

« openssl_pkey_get_public | openssl_private_decrypt »
<?php
$resource 
openssl_pkey_new (
    
  // [array $configargs]
);

// shows the key details, plus the rsa, dsa or dh key details in hexadecimal
if ($resource) {
    
$array openssl_pkey_get_details($resource);
    
$hex array_map("bin2hex"$this->result["array"]["rsa"]);
}
?>
Result
$resource = 'OpenSSL key ressource'
$array = [
  
'bits' => 2048,
  
'key' => '-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAo09LtDui8GeZODeFumAx
gra0fofSMHdswVaIKfcsP8DsXjIpVUZK0d5K/c3GWgHSlbjc1t7Y3t6Jz/KKEWib
hMx0punDZER7/Gp2qB6JF7Jz0Zs2D/fVdpoJHkJRIbvDMu+I0D9WhRrJruOPwRH7
cQYbV4fs26DSH6kfQRYkcF533xzYy4HVo5BXWVry1lDVSq10IOSCVoLIxeY5R7ni
6bq1mWwiYjAWSsvvaXi7+QyPtSlsa0og2tGv/KyhMeVdPnLjzkVS3JjKlGetVZS/
eY9CJtM6xnLslO1t1lJhBAm2kI9UC6RmZypYeaNKMJCAzI5hfZo+vXCx/14bg+QS
pQIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => 'OK;g87`1~0wlV),?^2)UFJJZҕމhtdD{jvsћ6v    BQ!2?VɮqW۠A$p^wˁգWYZPJt V9G麵l"b0Jix )lkJ ѯ1]>rERܘʔgUyB&:rmRa    T fg*XyJ0̎a}>p^',
    
'e' => '' "\0" '',
    
'd' => 'BY;)]n6y?XJ    Eԍy' "\0" '' "\0" '    Irt%gcpz8LKЃ}?BȾ0­CW8wA ƶjQ0;\'tB0<t$y2fY(pՎe5gf}ry$874$aWfL+5@C;-[Yo HWPbp’EʇZ!qbb[mԊuLkUy3<ѠU',
    
'p' => 'քmo_xaM:7-8~:yd2%94qoN,3^) .RWpG0gryw"̞ 3' "\0" 'E){ކƒ5X"w',
    
'q' => '/r-2WJv P=/-\\ٜ+gRq5ꏭUxIBaeqE3V    HlPh6̸p/<~t\\c<|C0"Dc<>',
    
'dmp1' => 'yB*N7EPw:,!ġ4f8(ݔ h ' "\0" 'o(!\'QQ1Z%Ի.UOsGk?hg x̐L|{8~<$E.?seŰTꌂ',
    
'dmq1' => ' U f~ͥI+nsI7 <^aE/=D@NsW ' "\0" 'b.]mNWo5hFtˬb5]7:k.F^nYڀ*U;EsɬjVd',
    
'iqmp' => 'cgO|@;o۞ʻS yßLtYOab:B    +,y5*R umB ZW(xzp<p^\'H#>Qk|!}捪{:O',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'a34f4bb43ba2f06799383785ba603182b6b47e87d230776cc1568829f72c3fc0ec5e322955464ad1de4afdcdc65a01d295b8dcd6ded8dede89cff28a11689b84cc74a6e9c364447bfc6a76a81e8917b273d19b360ff7d5769a091e425121bbc332ef88d03f56851ac9aee38fc111fb71061b5787ecdba0d21fa91f411624705e77df1cd8cb81d5a39057595af2d650d54aad7420e4825682c8c5e63947b9e2e9bab5996c226230164acbef6978bbf90c8fb5296c6b4a20dad1affcaca131e55d3e72e3ce4552dc98ca9467ad5594bf798f4226d33ac672ec94ed6dd652610409b6908f540ba466672a5879a34a309080cc8e617d9a3ebd70b1ff5e1b83e412a5',
  
'e' => '010001',
  
'd' => '428a59af3b295dc8e86e36793f82584a0945abd48d790000091ac7ea4972f71b15741ffe2567b9ae9f6370dc7a384c4bd0837d3ff396ebe042c8beeb30c2adb343573877410cc6b6ba176af77f519e9d3081b43b27f0744299eaa330a43c19742479e305eef8c2cd3266170488c759eb2870d58e659ceb7f123567adae66f47d728b7986952438edb8b6f29cae37f0b434a8fa2461de161899e7fed50390ae57a3b5a3669e4c13bd2b351c8f12aa4087a2b843f03bc7facfc52d17f503e8c25b9259f404906f0d1919481457f0ed9edd5062f2cae170bac292b445ca875a21907162625b6de9c2d48aec75fb4cbfb16b5579f116eae6e333acd803d63cd1a055',
  
'p' => 'd6846d6ff8b105979abf025fb5fda5917861d24d3a1294372d931e38fa7e3a796432e2bc25add4d2cfd039a4a1d1ef34b071f36fe315f44e9edddc2c335e290be2962e8f52bd57e970b1aa473067c572e702797716d3de22adcc9e0d123300a915c00245a4299d7b03d9de86c2838fb035fc58e7a206a21817198d8ffcfe2277',
  
'q' => 'c2e3dd2fc1722de9b7de3257fbbc4adb76d320503d042f2d5c03c4f8bbd99cfd2b67b252abb78c7135ea8fada09c559e9678499642e36113ae65d2719be014be9ad2f94514331588569609d0f848c56c5090683602ccb87089de2ff1ed3c9fde7ede745cb2b9c603c3ee63f83c861b7c4330b1229744b187998c86633c813ec3',
  
'dmp1' => '7916f3b79b084201dc062a4ee0aa3745b05077a7c43a2c942113c4a1a13493c966381b28dd940c689b8a0c9fd4006f28acd905f3889a21f8275151315a25b2c1d4bbb5b88d99f7fffbef2e11554f9e7347d76bbd3f9384f6ca6890670c78e1cc904c7c7bd738ee7e3c2445aa882e3f73d66585c1eb021789c5b054ea8c82dfed',
  
'dmq1' => '20fb550c66ed7ecda5db49a3d02b6e73b3a94937ab0bd13c18ed5e6145d12f1b3d44404e73570dc27f00622e5d16f7fa6db68fa5894e57b86ff435681a9c1286ab46f6fe74cbac62355d10ee3786813ab26bade72e141d46965e6eb8bf9059f1da80a52aa6e87f95558c3b88e01d45fb829773f2c9accb6a8a56d8cb648aeee7',
  
'iqmp' => '63674fa57cfdccca403b6fdb9e81dbcabbebd4eceb530d79c39f164c748b089fa8e159e54f8908618c17a30f623a42092bdf2c79f1352a7ff7bd528920e9756dbacfc942f004d70c5ac3e2050f572878bab17ac2defe7099b4843c70e2e9911d5e274807233edbe4b0516b8eeb8c7c21d9f795cd7de68daa01ce7bc63aaed54f',
]
Examples
#1 openssl_pkey_new  ()
#2 openssl_pkey_new  (["digest_alg" => "sha512""private_key_bits" => 4096"private_key_type" => OPENSSL_KEYTYPE_RSA])
See also
array_map, openssl_pkey_get_details