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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5QQK1+4koWa61Pe61KUz
6qic3BcQjXsWOK0cbHlkR3glFgPml71tic31yV4N2L2eSNol7xiY69Ye9W7Rmju1
9QkmvICV3n0VdkFBgE0tqMIwz61w8S1sODcXhvf4FH0pg1+dZg0J2k7FDUCN1fZ3
Su/HBpBKS5PQ9ECozjjMe1+ZuTNqZXzzmkiXvuU2QGAeZR47jxP/ahcMRyaD7t0Z
zs4MXnzR70i8ZB2CM21cm3Qlv5OtZWuL/sbxbhGbn9TaOqyivlvQdYsLZIhMvip6
kSooFitCO6g7Xy/uTL2cWtHa0h/n04QXkpjRn7sT8BHWvl8WLi7dW0dLgzsZrms3
PwIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => '
$fԥ3ꨜ{8lydGx%旽m^ ؽH%nњ;    &}vAAM-0ϭp-l87})_f     N @wJJK@8{_3je|H6@`e;j G& ^|Hd3m\\t%ekn:[u dL*z*(+B;;_/LZӄџ־_..[GK;k7?'
,
    
'e' => '' "\0" '',
    
'd' => 'k?(P1/dpo[L*,     $ݮ \'ȼ
cwT%d' 
"\0" '//і|pihg
V\'(c<\\+,g? bġ/4Zt,WԋV}E[G' 
"\0" 'O{օ~Ǐn(tւRp]=ӗ3%ݿ<\\UEҶ6rvj w
ƔX=$nAH3!)ZT!C۽m_(чiRZb]'
,
    
'p' => 'lE殂E865Y&b (|6Ph is &>z̟>܄ )83لŇ[    :~UwѷtXHZѳ@pIw=TDf    B',
    
'q' => '\\eO2ly:?\\vvL]Ktdebd%>eULΘRx}:5Rzzt \\4d1Zj@.g6_^_a+UyE$L/=8EPR',
    
'dmp1' => '!x[ DW̍#z1~p7Wp wCiTm8kH+W>Ngw V    $mUrڨ:Iּ9@{        M~@k
G
k'
,
    
'dmq1' => '䖗śUaAY5.7{hkxJ]mL
ݥ&R1,~<!i׀Uuo9 ]K"ӑeh#"L@,8y#a'
,
    
'iqmp' => '#NV=Rg*nSiLܞZ;7$S?GG\\5g6aPbC1P2p    \\.Pk2%ӳ6&XF)g"',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'e5040ad7ee24a166bad4f7bad4a533eaa89cdc17108d7b1638ad1c6c79644778251603e697bd6d89cdf5c95e0dd8bd9e48da25ef1898ebd61ef56ed19a3bb5f50926bc8095de7d15764141804d2da8c230cfad70f12d6c38371786f7f8147d29835f9d660d09da4ec50d408dd5f6774aefc706904a4b93d0f440a8ce38cc7b5f99b9336a657cf39a4897bee53640601e651e3b8f13ff6a170c472683eedd19cece0c5e7cd1ef48bc641d82336d5c9b7425bf93ad656b8bfec6f16e119b9fd4da3aaca2be5bd0758b0b64884cbe2a7a912a28162b423ba83b5f2fee4cbd9c5ad1dad21fe7d384179298d19fbb13f011d6be5f162e2edd5b474b833b19ae6b373f',
  
'e' => '010001',
  
'd' => '6bc13f28e25031f1182f64706fe55b4c2a11c42cc6090bc524ddaee60b27f7c8bc0a63c377da155425a8641af100ee172fc814d92f05a4d196b77c70fad4e58469cde41bcc68670a561dd627fc2863a31b3c5c2b2c0f673ffc0c01e162c4a12f8b34cde65a742c57abb7d48be80493949ac5567d45b7d1d11b5be11147004f7b8403d6858c197ed1dbe2c78fd4156e8fcd28f874d9d6828ee50f8b80a297aa528e9770afb55da73dd7d3979f33e9bdffea25ddbf3cce16135c8a554512d2b610367276a66a94da0b77909b0ac694583d24836ec9419f481933dd2129b3d45ae6dde384e75421430783dbbd6d5f2885d187b1f469f49a81fa525a02625da89fe1',
  
'p' => 'f59c6c45e6ae82459e383635fd17598fa0ab2662fbc5c60c28927c368050a09c680d8369e5731c89840c83bf84263ee57a178605cc9f3edc840d2938e68833d98416c5875bb6bdef098a13e1b93a8cd8c67efd17de55ac77d1b774800193f1584895055ad1b3c402fa40e71570cf49f2d2773dfac154ae446609ca429dc7fdeb',
  
'q' => 'eeb3eb5c654f87eae032acb1847fa4a6836c0779b73ae63f5c76764c1e8c5dbfa84b927489bf1d64656264253ec80765fd554cce9852787dcb3aba3552d4f0a4f4987a7af7817420d35c9334f9fc6431a00f9dde5a8ffe6a9f402e076799e811ec365f5e025f97a9fee8612b07557945244c082fe63dabbe16388bde455052fd',
  
'dmp1' => '7fd8211fad788e84b05bb014201e445717999ecc8d231ff87a31ed87ecf88af17ed3f1e070379fd610aef6f0fc57700bc0a677f392d41d436954f46d12ca38baf31f6b480ebc2b573e4eea1467770b9356970924a06d55edb472daa83aaa08491cd6bcc7ce39d5407b84c70409094d03a0fbc27e409dd46bf3f50a9bec470a6b',
  
'dmq1' => 'e49697c59b9f55e1af61d7cf07bbd4c94101ab06fc5903359a2e378b1d95fe1113f18b06df028dfb1ebbe27b686bd5e9ed784a5d6db14c81eaa50abd15dda5b5d22652e47f31112c7e3c211c926908ea1d05d7809fe9551275fed8156f390bec5df093d34b228ff2d39165bbf701fb6823224c94d2402cbf9438027990972361',
  
'iqmp' => '23b7f34eea56d93d52ef1b01a8dd672ab36e53e890e3e50ef7694cfde9dc9e7fef5a3bf3372453b7a1eb90f5133ff247d8f847e71012ffdf0304b7ccca5c35eef6f4c467b88e369861845062bdb6b443f5a59ef70f31a0503270095c2e50f086eb6b9505b6a5dac83225ddebd3b336b6cb1e2658df46296794bcfa01b222b2a4',
]
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