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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4+YCefg8d/YQftyhImsF
rTYUhttk3njBOHGRR1o/UOTHMRcI2qu3vQYmq9hQZlMpNG9Bo6p8kwLWEtd8M3eW
2pT6M64KoWxz5+j1EUE/XFibNrGPYWA4MrQvwnhLJn36FFAdhgy1pA3pTBgGnhy2
1lpVKBc4YfNMTHSVRTGDDmveRarhHTlH0jQMv3vh0v+yOSPOwzvXp55MgoYJJT84
JLj01kzRzw76XCovwOzV9W1mGkWunvdhZmofo/Ro50K6qztRSE9GBMuhdqFjNfkG
z+GQgUVy6B+aoyANjxC+FKKgpe0gc+JMyzdruNNDoRscR8/o5yCXOKSpzTpfGzqg
zwIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => 'y<w~ܡ"k6dx8qGZ?P1ګ&PfS)4oA||3wڔ3
lsA?\\X6a`82/xK&}P LZU(8aLLtE1kE9G4 {9#;קL    %?8$L\\*/mfEafjhB;QHOFˡvc5ᐁEr   sL7kCG 8:_:'
,
    
'e' => '' "\0" '',
    
'd' => '    vUe.}.-Q    ܾwG^Y+>,*5 9Ѿc5,5SiަGBSjքx k2$-F(qUSoZJV5[t>5sLOAf :HpWiy//' "\0" 'XSԖ0IKrj6ɂ=-x%
G?JR:ג2;|y%^G+8ii).xvc>dJ'
,
    
'p' => '$Vf>=R0Awy@tB=G*%C^7rGu]|L\';Iy5JYTA6nAkl%x:NACӞHc?+x݇',
    
'q' => '9x֊&Ybr)U̘VwMκ$NӠ+pŭ|W~ WVt@,m#8d1 H|լ6KO<]3FGШ(ӓ@Zؗp#y',
    
'dmp1' => '`*bآ5 Rfιi7Xg10ku*%f1U^~
Mؖ#p58; }b0p<Q8A *qJؽ(5"ڣ|CLZZ'
,
    
'dmq1' => '?!$:@krO:픭kmCiV#y#]]?<1%ѩ[<r+8ΠOZl%}#EZ$A|2-k]l~    @GE)',
    
'iqmp' => 'YR,4t@ J_=SyiUkk=BhhQwP2f[Md [LwF蚛nu.|cPLze`WkE@\\ ԃ&)',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'e3e60279f83c77f6107edca1226b05ad361486db64de78c1387191475a3f50e4c7311708daabb7bd0626abd850665329346f41a3aa7c9302d612d77c337796da94fa33ae0aa16c73e7e8f511413f5c589b36b18f61603832b42fc2784b267dfa14501d860cb5a40de94c18069e1cb6d65a5528173861f34c4c74954531830e6bde45aae11d3947d2340cbf7be1d2ffb23923cec33bd7a79e4c828609253f3824b8f4d64cd1cf0efa5c2a2fc0ecd5f56d661a45ae9ef761666a1fa3f468e742baab3b51484f4604cba176a16335f906cfe190814572e81f9aa3200d8f10be14a2a0a5ed2073e24ccb376bb8d343a11b1c47cfe8e7209738a4a9cd3a5f1b3aa0cf',
  
'e' => '010001',
  
'd' => 'c09c1c09b3b87f76b2d85565c62e077d2e10c92d51a20912dcbe771783f9b147b9e60e5ec8598b0fb1cc2b3ec62cc52a350bb6c1398cd1befae8afc063cb35ef052c355369dea6478b8042e7536ad68478a2100d6b32242d0e46b32871f355536fa98a5a4a119656bf8f355b1a74903eb7d7f2eb3516ebc6d7734cd94f1041b5660c3a487057e469792f2fbc00075853c3fc14bad496d530dc1e49f54b0619726a9ebe1a018836029ec982b098c2e61aa53d2d78bec9250afd98f9473f4a52f7be3ad792f4323b7c79a780e9fab4ace3a8c3e30107f5258f5e47ac9681992bb0839882ce38f7696929168e0ec82e1bc3c778c37663128a3ea801644ad7efe191',
  
'p' => 'fff5a68aaed424c856c089663e8dab3dd27f52ac081f1430b9417779d940a9f274fe85c7423d472ad925435ef237c57247e8755d7c4c9c1d27f23b49b0e30f928b1f79831235ff7fd04a5917aea654b641c8366e9f4119f36b1a6ca72585ffe09b78933a4ee7fb90418143ebd39ea6c01cf391ac48633fbde7c82b0f78eadd87',
  
'q' => 'e3ef3978d68addc026fea9591f627229d955a7d9cc9856e6d0771e4dc11fceba9c244ed3a02b8f9f9b70c5adc67c579a01ac867e0ca7578edc56ed74d6d640b52ca06d23fba738b864a0f7c098ecb6318a0b14487cd5ac36994b1ada4fac073c5d334647cbcbd0a828add3939c1dd0f0e240e2895a81e1a5ded897700123b479',
  
'dmp1' => '602abc62d8a2ce1b13350daa839018a9869fddc0d2e05266a803e7ceb9086991b5d13714115812980fb3c76731dc306bea86752a259c66ff3155fa5e8a7e1508bb0a9d4dd896bf231770079f35383b15ab0b7d1ffce7a9c762133085703cb35181384120a42ad6c2714a0ee9d8bd7feb28357f22daa3a77c434c5a995a95eb9b',
  
'dmq1' => '3fb2dc21dbfb24eb8d3a40036b14ed08aaf7181872e7e3e94f3aeada19ed94ad6bf36da010b3fbc843fd69111e562379239c9e5d5d95ea8f3f1e7fefd6163c31258e93d1a9835b039503b3193ce3722b3803cea04f5abb6ceabc257dfb23fd45ae5a24faed864102ad939e7c32f5d62d6b5d6cb1abfc7e1e07c009da40474529',
  
'iqmp' => '0859dd52a6192ce6963474804008e80b4a5f983d16537f8079b169556b049d89906b3ddeeefc80c0b4f903c2426818d868a0a0bc92d2511577f7b2015032b1c0667fde5b874da764dc0b5b1ec1b74c148477d9469bdee89a9bf5b46e752e167cba63504c7a65cfd8df608c571b6bcd4590ca4018d75caa0d0dd483b12699a629',
]
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