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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxo0SQQ/v6PnSStrtXKNB
+b7740YLiEPOQcztGzhGiJUWpQRg5J/QtAcp53lKyamD3p5LDSDy63iirPCzvjZ/
sgZtdu3tBTi41+PmraWpo+fsU81TNi+9hoohHh6iKAZ786mVoCuH5B6ozY4T6By6
6WRnvypa3a5ohNnSxN9EiNf4Lb84PfffU9cSnuH2Ueilk0u/snY4e4Nvy1O/FhMS
Zrsd+Fn1aUMdsHGY8MJQYfMfw+R485II76Xp8YmQmTMbL6dGDOTxzms+T9WED6ZH
31QLgvVJEoT6ak+zssIwv/9MillCOYB/xU76WrXcIGTYDA/FUrlnEKDCtX/Umz7d
IwIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => 'ƍAJ\\AF CA8F`д)yJɩޞK  x6mv8步SS6/!({󩕠+͎dg*ZݮhD-8=SQ襓Kv8{oSfYiCqPax񉐙3/F k>OՄGT IjO0LYB9NZ d Rgµԛ>#',
    
'e' => '' "\0" '',
    
'd' => 'l;S/[)npUmvNGy<I55!D&xУw"Q;L?*ҘmgԈ8>bSiCͯ+gV̱yp$(*[In
"$N=    ׄa0\'eam\\S]%06&t
q6-!Ur3m  >*K dbkOW' 
"\0" 'y5c^S1b0ɤ-!Q#h>S[D9',
    
'p' => '+pOvKޱas̿X@*vR+zOMm@vVGۼx @6ĀTxF(It{eMp{ZѻC!|X-4:Iqtnʍ,Е',
    
'q' => 'ǣW)V$[ Ё`(dY(kUe3 DJ\'ޞDm~t' "\0" 'Zl%~gׄB6L^5oGz|:GVoQƞ#u5=b:',
    
'dmp1' => 'nFhlӄruWP]5\\kۈ\\\\K>{kςsu5zJWD!H7 hk9d9~kfNkMajzN',
    
'dmq1' => 'V;ܾ[ .6֓~' "\0" 'a3z+ _    ć{w2 EpgJޯ9 h3Cn%K=  g7eciXT/Ȟoy2:.r:i4',
    
'iqmp' => 'J' "\0" ':nÙЏɈ.bx*' "\0" '%<]Wѻ.,R}B߳TeXK~{j)ױTx' "\0" 'ZY5T=*)iA#̆*^rϛ7m>',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'c68d12410fefe8f9d24adaed5ca341f9befbe3460b8843ce41cced1b3846889516a50460e49fd0b40729e7794ac9a983de9e4b0d20f2eb78a2acf0b3be367fb2066d76eded0538b8d7e3e6ada5a9a3e7ec53cd53362fbd868a211e1ea228067bf3a995a02b87e41ea8cd8e13e81cbae96467bf2a5addae6884d9d2c4df4488d7f82dbf383df7df53d7129ee1f651e8a5934bbfb276387b836fcb53bf16131266bb1df859f569431db07198f0c25061f31fc3e478f39208efa5e9f1899099331b2fa7460ce4f1ce6b3e4fd5840fa647df540b82f5491284fa6a4fb3b2c230bfff4c8a594239807fc54efa5ab5dc2064d80c0fc552b96710a0c2b57fd49b3edd23',
  
'e' => '010001',
  
'd' => '02f5bd6cece0e5b73bb453f92fe55b296ef87055edfc150eb11a6dfa76e74e47f2b379123cb6493535da211244d426cbc978d0a39c77229d84c7513b4cbda13fb52ad2980f6d817ff7eff4d367e1d488b394383e625369dee49643cdaf1b2ba5936756ccb179702428de0f9d2a5bab49a96e86820a22bde3deff244e3d09d78461f0301627a410658561aa196d9c5c535da305ccf604902530830236b5269ee306fd7fbf7412d5f0080a7194362d112155a8ad72dc1502df336d0d20c0dd3eb2f32adb19954b0c6462f5156b82da4f57bd18d2d000c5ea793563fc915e98537fb616f31931d5cc62fb3092c9a42dd7215123683e0253d15b44d0fb14c1b5c939',
  
'p' => 'fe9b2b70fc4f764bfddeb161c273ccbf584085e32af576ed5280e3c82b7a4f4d6d409a765647a8dbbc7815d508cc0ce9b3f88940361ec9d5f9861fc4805478acdc4628169e49747b654de670a9a9aba17b5ad1bbed98e1f3ae1f9ee9f843217c58a72dc4343a14cdfb0eb6c949a27174d0e46eb5a8ca8d9519a719ec2c8ed095',
  
'q' => 'c7a357291056e902245b1b11b40dd081e2608828f464c6d01cb6fd02599c28986b55f7b6136533d70d444a13aa8227dcee8ade9e446d7e7484c200fc5a6c258c7e6712d7841181a6a6934281a3df364cedc45e3502ee6fa2f047acaa9cf07a147c3ae64789569af988f76ffc908816b851c69ed2e4a2e22375a2353d623af0d7',
  
'dmp1' => '6ecd46ad881068d20f6c9fd3849572b07f0ead75bc5750e75d355c6bdb880205171bbb5cee95870601d25ce5f64b1eff81e4128f103e7be6140e6bbacf827375fef2c5357ab34aeefc9a5744068221804837b0f8d120ec8c68e5b7f9e8a2066ba00539649eb9fc1ddc397e10c16be1664e166b9bc1164d616ae58ee17a4eb8b5',
  
'dmq1' => '17563bc11c1cdcbe185be20d2ebc12acac36d693db05d0cbd11f7ef20061a5c9337ae82b0b975ff8fa9f09fdc487d47b1a1377b48e91322012c8ceeeb0ef457067f24a9c90deaf063920abbc95d868f39333ca436e254b3d83d30d1720a367d1ef37bf658b636958542f8092c89e6ff179f5bae9323aec2e72f8d43a69ba341f',
  
'iqmp' => '7f4a003a6ec399cad08ff7c9882ef96278a5e703a4bc992a1b00bc1783253c1e0210b25d119057aed1bb82a2b42e8dbd9d882c527de342dfb3e1549dd765584b827ecfc37ba16abbfbd3d3291790f7eed7b1b5bf547899005a05e359dade1990ec35e8543d2a9d9729a469a2164123c9cc8607122a5e72cf9b37b21a6df5053e',
]
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