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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwLuMFbbHTIxBmg7k/Auw
VelT2qyWwaIF7M8A4R4dD0O9NlYFd2RY0INbeVtcJOJnZHfB3k4GnaEEfsT49LmJ
wmTft5oe9Tt1Pti1KKiLg2LCPO1YHX+QXxWEfps0Kj7Nx3KTCvndEdP7b+gL6MpU
R81wY6TIveiVnc5FyiYXvQ2k7YklkfzrEGkzGIQZIRRCFQ6m5ec8UlS+HzdrsoCc
NnikeZ3+brxlClzN3qJbDBxrild/66PE7qGNoafUW1nrmCdA2jo9O4TufRiWcSTj
PDmg2SuvAlVaiIx/kimNfqjnnpgQEUZhsZh0ZCgKwTDT3MMncDPlxib1GnLagUWz
ywIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => 'LA USڬ' "\0" 'C6VwdXЃ[y[\\$gdwN~d߷;u>ص(b<X_~4*>r
o TGpcȽ蕝E& %i3!B<RT7k6xyne
\\ޢ[ kW[Y\'@:=;}q$<9+UZ)~瞘Fatd(
0\'p3&rځE'
,
    
'e' => '' "\0" '',
    
'd' => '1XAesi6fa_fE߸C*[šG̯\\[W;+z|we)EY$%d rEadwO-BN' "\0" ',ӑ̯?t;Lw-]X1}"EԯIY+wyf[=L=7T9Yql??:ś8E C[' "\0" 'SxZ~*6ELS݊tN&O8{' "\0" '!FH\' ޜ4*Κt a',
    
'p' => '3k*)?Y9Tt6Os4P#畞gR    ʃ' "\0" '"KqÈ}b{xoLLe7Q    ~$AxA߂0+S6F 62A',
    
'q' => 'ІzAO:u"wUnHe.P9lޒ([Eg/Xoʈ;L&[ !MoayV/>I}W/9`7:nXnxK$q',
    
'dmp1' => 'A;[$*˜\'9DI8"
#(T
8+TKx *(6ruӞ¨ۛ<H|EB|qYYXȦ%;lB^Aj\'uV{^u%'
,
    
'dmq1' => 'Э;@ğX,B%cٶyD!OHu(}p ]&,*0`y"e=1NW#;"aWb؈tF?fLѸ?`2od' "\0" '#' "\0" '0̙6[',
    
'iqmp' => '¤:H#R8>!\'rג:p*H|}    -o7nj+ӻKnk5\\[ȫf932;տ|x)u dFm^GԈ|kDe)jȊME~#H',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'c0bb8c15b6c74c8c419a0ee4fc0bb055e953daac96c1a205eccf00e11e1d0f43bd365605776458d0835b795b5c24e2676477c1de4e069da1047ec4f8f4b989c264dfb79a1ef53b753ed8b528a88b8362c23ced581d7f905f15847e9b342a3ecdc772930af9dd11d3fb6fe80be8ca5447cd7063a4c8bde8959dce45ca2617bd0da4ed892591fceb106933188419211442150ea6e5e73c5254be1f376bb2809c3678a4799dfe6ebc650a5ccddea25b0c1c6b8a577feba3c4eea18da1a7d45b59eb982740da3a3d3b84ee7d18967124e33c39a0d92baf02555a888c7f92298d7ea8e79e9810114661b1987464280ac130d3dcc3277033e5c626f51a72da8145b3cb',
  
'e' => '010001',
  
'd' => '31cf06580241a565c5fa7388f81e6936fab3021b82668e61eb9e5fc2ce0e82886618e9c845dfb818432a5bc5a19da2a947ccaf5cad5b86573b9b2b7a8f7c77beb6651ec504e529b59645592425d2d064b08020729a450261a064fa774fd6ef1e2d424e00132cefd391f28cccaf1fc3023f74a13bcfe94c77862dedd95d58db317d9e2245d4af01f049592bcf7779a3665b06893d134c849d3d94b23754b80539f8e4cedd59716cbc3f14ee3f3ac59bdbf1a90f38f045970e920c10435ba39600a25378a7045a7e2a1a36454c1aa153dd8a74f4974e9f12ecc213267f0584ab4f387bd9060500de2146cb48270dde9ca234ab152ac7d2ce9af0fffedf74970c61',
  
'p' => 'e6c2336b2a9dfe29c73fc4590f39eb54b580088dfa9e837436b11716a44f89ef73cc34b7a450fd1523a6e7959ede67a5bf9da6528709ca8385eceae400224bfa0371fac2c388167dff627b0f7893fce2116feddd4c4c1abc081b6537b751097ee124a01141d978bf4195fed8df82a907ec30be2b5336460b93dd36328c41c1fb',
  
'q' => 'd5d086ce7a19bc41c54ff33a1e7522ab775599f36ec6c548652e508497b37f870f05396cde9228ba5b97459cb0672f586f1e16d31ac5ca883b8e4ca326f65bad0b95af21e491d41bbdcf104dbb6f61fa79a70e56a294d5012fbebd3e497dc1a1bce957a101d5ca2f8e39d76037d708143abc6ed5586e784bdfcbf401e224fc71',
  
'dmp1' => '9441cd3b5b242af9b89415988a99d1c298e1eb9d1c99df27394449eb38220a231828e8eddbda54dfd20a17dc1f38112b8292cd1b54bb4bab78ce2093e02a28da36807275d39e89a4e601e5c2a8db9babbb3c487cd7da458aed427ca37159d559f958c8a68dc2253bebed6cd0f5b942d45e416accf727759556a8d77b5e759925',
  
'dmq1' => 'd0adebd43b91408ec49fca58cfff2cee42d3162563d9b614794421abb74fa648cfdd1e75e628aa7d70050d18e7865dcc26ef2c01afa099922ae630601017e3d3d979a6eb22653daa31af954ef87fb615bb83d357b4e823983bdc22615762d8881d9374461d3f664cd1b81c3fb960326f640023003085e8fccc9907368b5be3d1',
  
'iqmp' => 'b60fc2a43a48239552388f3ee921b9b82772d792bd3a70ca172ab5b7487c7d092d6fc01337c6c78c2b1ba1d3bbeb194b6e92879b6b86355c5b04fcc8ab66391133dae532a4f97ffc3bd5bfa6a67cabae7829750cf46492e0049bb24614c86d5ec1478fecd1d488d87cf8bdce6b82d344bae2c065296abcc88a114d457e2348b7',
]
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