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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAukbPlfAm7/HFjk1xoOAT
gV7HcN1FXz71BXfDe7z9va2uupwfNUZfDXnpLBDY9/4BUuY19j/RmGwSmR14tapD
2QyuUeZoMXJyFmG4ClUdFkmlMRyaa50zBxLgEX7zU6EuLnZw8KpTHxM+i9kxTupk
dVA87CIpOyu2DdSoUoPcZkrTBPqxoMERtmoC2behB7g9s8IV6HmKi13yuOT30J+8
hsCI3s1vJ/v9q7EbiQXDCADKSNYp0kTweaP/rylWOHH2IvLR4z+azjjQsVwnWyLm
NfemQMEMhv2J2oFFX4ohRRpI9yMmRwarypUVr6SFxeNEHx3uZE4Yj0pj0Vp8ru4N
VQIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => 'Fϕ&ŎMq^pE_>w{5F_ y,R5?јlxC Qh1rra
UI1k3~S..vpS>1NduP<"];+ ԨRfJjٷ=y]Пo\'' 
"\0" 'H)Dy)V8q"?8б\\\'["5@ ځE_!EH#&GʕDdNJcZ| U',
    
'e' => '' "\0" '',
    
'd' => '\'Ys`#p2N"HL;5Vx' "\0" ' bO̹ş^!d |(WD|*-O :@Qnl3{\\ ZlenRQܪ~+w7ί+Ȥ9)#׎Txe_qj5S~P Fb 6D[zu!РOd_ S䘹 b$WmdSݛFauD=iDU_)5?~ ',
    
'p' => ' anOϿ>E~{' "\0" 'xzD6r&t{|ַ/>FZgoq;r~y1,I|^P@_[o #_?i1 tWrCb}~H',
    
'q' => 'H?*s*' "\0" ')`I{4`?MUJV6a7\'#=v,T ε7rE6,:jQ۸~td׍![L?{qWcWK;l=⚲V;x    ,^',
    
'dmp1' => 'F:Ch8\'Vu ;q:^zTʧ+X<r2 6P~!Ϋ Ywsm u&RF D9}0rTq4| Gcm(/Y,y',
    
'dmq1' => ':FIn͉zfSf/VfM_A5R}f5`@դ5k-\\etSP0[+ɍCE1Pq}{4Wy⦆g֮AOV.q@',
    
'iqmp' => '=t+cbNڪwɋ}aƊ~SRO' "\0" '˞Ty\\y?&$e`^fGMo?=Ytr
_bP~p.L9R`[YȢ{ D.' 
"\0" ';|^Eߞj',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'ba46cf95f026eff1c58e4d71a0e013815ec770dd455f3ef50577c37bbcfdbdadaeba9c1f35465f0d79e92c10d8f7fe0152e635f63fd1986c12991d78b5aa43d90cae51e6683172721661b80a551d1649a5311c9a6b9d330712e0117ef353a12e2e7670f0aa531f133e8bd9314eea6475503cec22293b2bb60dd4a85283dc664ad304fab1a0c111b66a02d9b7a107b83db3c215e8798a8b5df2b8e4f7d09fbc86c088decd6f27fbfdabb11b8905c30800ca48d629d244f079a3ffaf29563871f622f2d1e33f9ace38d0b15c275b22e635f7a640c10c86fd89da81455f8a21451a48f723264706abca9515afa485c5e3441f1dee644e188f4a63d15a7caeee0d55',
  
'e' => '010001',
  
'd' => '2798a3c9c089d6597360237032fd4ec822488ce24c3bc9db35b5569578000c10de62868b4fbcccb9c59f5e219aad648e0d7c281e57448b7cf59b1c9bab2a2d4ff7151b0dba3a4094a5d351d6c86eed6cec337b5c0be21795ba5a6cfdaa65ad8e6e8bf8c7ffbcb98f52ad5196dcaa907e2b7737ceaf2b07c8a439ff29c323d78e54f0e5d9781e655fd471f46ab035bca99bbc9d901284987f84c553167e50b0e0908a0b9ca7fa92b79146620df6368e445b7a7521a1f808058cd0a04f8764b0f5b0c25f0d53e498b90be362d9d4142404ed07576dd6e964118853dd9be1cf03ad466175b1b344dbff98ffc1fa3d69f30544550e5fd30629353f7e1f0bf3ce10c5',
  
'p' => 'f0f4cdd920c2616e4f03cfbf3efbf745077eaf7b00787f7a1807ec441c36722607747bdec57cd6b7b4d8c3ed2ff13e1bdfe5a4465a67f9eab46feae8f4711d3b9aa6729e1b89b57e809b97fa79e931e32c497cf3c907a90101135ea9115040ee5fa5f55b6f20235f3f6913a0c531800cd174f457729843a99d9c627d7e48b3f7',
  
'q' => 'c5e810483f2a73ac2aea0029f360497b81341b0460a2d9ec3f4de855011c4a561cb9171e01f1a936619cb9379b27233dc503762c540dceb537724536a12c3a8911916a51dbb882f7b7137e10db74b0c1d764d78d90b1215ba79f4c3f12d47b017157ddd0da63b057b0c24b3b89146ceee03de29ab256ab3b78a6f71d092c5e13',
  
'dmp1' => '463a4368be3889271a56750d3b713a8f5ef0d87a5417caa7ae2b58fc3cf0cd7232080c36507ee321e5ceabc40c8e16590f77a1da736d0c951083f2067580265201eff3460ba6a644397d9fdcfbfd307212ad5482c51bbb71347c0dc1deeef20dc7c8d9eb0d4763a7d6166d07159228cd139b2fbff10159ef2ca5b0bafcbc79df',
  
'dmq1' => '83ccff3afe46496ef9cd897a66c95366db2f5666ddecd6f14d5f974135521ff7a57d66f5e7198835dd6040c1d5a48505d8356bf82daa5c65b79d7496e353cf5005d1305b7fd72bf1c98d43c1fa45868a31e6c8df50e38671c1fa870ee27d7bc604341e57bf79f0b115d8efbda09767ccd6aea041a24fb20e13562ef0b97140dd',
  
'iqmp' => '3d74de2b0e6362c3d34eabdaaa771ec98bbf7d82e0d6c961e4c68a7e53f2e3ce524fe9d700cb9e5479c2daff81e75c793f0e2681b424cffbe1a4ef9bb965f395605e7f66474d6f3f3d597472a793880b81fc0ab8b5c3105ff962507ea4ba70ff8a2e4c39a052605b5988c8a27bab0d86442ecaf7f7e1003b7c5edb45eddf9e6a',
]
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