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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0gPJuQ5d7uIaVHyn79Vw
EAgo1/q3e5OQFtIlD88pMn3DBlehyqKYKZtEgWhZzNwW7um+4MVhV81DjNNwUC2V
WMU8Lc/68rNuO4h69yiNmpkFpXzLRIyNqpvey4ojKlX0UBsVIp7z1QsQ2M/xLh0n
7IbPY8xH7I/OiynNrd71NSq4gaQyl34jL56C990L+kKJWiNtCcetWNvGx6g4BWrc
F2cR9R4wM+Qs5ns5vCyi3R3+bb17ZCdbf45pJMJtIZeWinCDXISjOOQTOUh9nX8k
J06J8c/USFvSHHNrKATwTRRZnin24/qPWTXdGXD3mab4irjQL+7ZSETGKd2cqMBy
YwIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => 'ɹ]T|p({%)2}Wʢ)DhYaWCpP-X<-n;z(|Dˊ#*UP" .\'cG΋)ͭ5*2~#/ BZ#m    ǭXǨ8jg03,{9,m{d\'[i$m!p\\89H}$\'NH[sk(MY)Y5p/HD)ݜrc',
    
'e' => '' "\0" '',
    
'd' => ';(9(ŝ`.1#$[͡Kjx
azq.W9S<Zj˜_L8~7!Q=Bv5@]؁OdAMۇt@    }~fA;g/D@{a"o^}d' 
"\0" '(K0xF&3JvD7Q*\\?EpiS?0ᶈࣙ+M} ~@$;Z!W' "\0" '$߸˰5
q'
,
    
'p' => '&ʯw)ӠgY,R`$oP\1b)mwJ;ܻ7#/tRAAr-1񀞂LR;zG_{J.+z ҺڣN2o)j`4y3',
    
'q' => 'ձ>R(ihJk~smOψf6d{8ixʥSp߭oG' "\0" 'odR<zf}6|8ooZG' "\0" 'p)z1I\'!Bغ2_3zEF',
    
'dmp1' => '8%DiBj
Zo&ߥlnKTBtC7.' 
"\0" 'ZIY
͵[S0 ŤUhxĉR6Ly>0Q' 
"\0" 'Q|0M[kܪ#" ',
    
'dmq1' => '
еF<$CZK4xU@>l9Q?     \\~ ܐ1,t/h "X቗7H=PVrl:7n \\Z$ύ&bUG{'
,
    
'iqmp' => '{8/{&=^Ofߦf齛s%r/     P]ox^1; ' "\0" '$3Ṇu*0dif0 n>g' "\0" 'XR<k2BKSYLbA[1v/',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'd203c9b90e5deee21a547ca7efd570100828d7fab77b939016d2250fcf29327dc30657a1caa298299b44816859ccdc16eee9bee0c56157cd438cd370502d9558c53c2dcffaf2b36e3b887af7288d9a9905a57ccb448c8daa9bdecb8a232a55f4501b15229ef3d50b10d8cff12e1d27ec86cf63cc47ec8fce8b29cdaddef5352ab881a432977e232f9e82f7dd0bfa42895a236d09c7ad58dbc6c7a838056adc176711f51e3033e42ce67b39bc2ca2dd1dfe6dbd7b64275b7f8e6924c26d2197968a70835c84a338e41339487d9d7f24274e89f1cfd4485bd21c736b2804f04d14599e29f6e3fa8f5935dd1970f799a6f88ab8d02feed94844c629dd9ca8c07263',
  
'e' => '010001',
  
'd' => '183b8ba928b939f928e49ac59decd8d360bda5be2e31ba23241ef75bcda1894bed96ebc1a56a0178bb8bba0ada61c2fb7a71ca2e9157dc13b939a4a40efc53813cb0e6f05a9a6a8dcb9cc1e386f05fe84c387e1fce371199a006a321bb51053dfd8842760e35405dd881cbec9e4f8aedc5d864418c0305cce54ddb87b67440c0097df9f97e66e1d8f641983b9167eb2feb444086857b9c8561226f5efc7deee76400feee281f4b30abf1808b16d47846fb26334a7606bb829cd7c344371614b0512a5c3f45bdaca07069533f30e1b688e9e0a3992b12f6c7eb4d8e7d0dcf16a77ebc949212f340243b83c15a21f3899157e400057f24dfb8cbb09af035d90a71',
  
'p' => 'fb9826caafee77999129d3a067ac592c9c1ac452f6fd136024cd6f50d9ceefbcbcc00f99318a6280296d77014a9eb27f04a13bdcbbd337232fd574e15202d0d741b341722de0ff971331b3f1809e82f7fc4cbf523b7a0e479f5f7bc04aa12e012be37ae10e0ca5d2badaa307c1b7ee4e08cd32b66f296a60fa347933b2e20ee5',
  
'q' => 'd5b13e522869684a6b827e736dd14f899dde02bcf9eae7cf8886a11fa480a86636647bfe38e8a1f8ded56978e3caa553187f70dfade86f9afc8647008291016f87c06452acfc3c7aaacb667d3681febc11eebe1bdf7cc9e385386fb06f5a47009470297a318f49e3cad6272142f5d8bab5325f33849df67a88459a8c46df1fa7',
  
'dmp1' => '389cfd25a0befd449e08966942cae26a0a5a6f90e7a8fce22685dfa586cd6cdec06e4b5442748c43a08ed437832e00a65a4959aa0acdb55b8298faaaf50453300cc5a4556803781feb9ec489f45236d04c828c8e9979969b013ec01efdec14e90892308551df00b5517c7f30f0a34dc95b6ba91caa18dcaa23c308fedc22c80d',
  
'dmq1' => '8599f10ad0b5463cf1067f248fce435a18d74b02f7858434de78bd97d8f38f5588403ebd6cbb153951a83fef130c095cf07e0d05ebe6dc901bbd9ffa93a7312c97c51374152f0668f30b842258c7e18997f499eb3748ffb83dfc50e8105672f9cbd46c3a376e0c965ca493865a24f6c194b3cf8d98266289ad554710d8e67b15',
  
'iqmp' => '98a87b1538122f7b8c263d185edefe80aa7f93e14f1c66caec8bdfa6669be9bd9bc973f825bd1cfbf6cdccc1722f1f09e3db0dffd8505d0faf6fb6f8c6c0e4785eb105313b0d930096ab8c24334ecca375f52a18da30647f690566300c956e84cc3e0267ac00b7587f06528d3c6b113218e7424bc253594c6241af085b31762f',
]
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