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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwAQVugtCkXkiHf6zhqyE
MbXk7fJZp7iboT+Lf0eTaCh1aq2ctHEQBcBqCNXluG4NpNDCFaf3rBn28gJbKWV2
ihekgQX5PpNNckKre5Tli2K2id3nQubd0aZ+qFp7w00kxmP0v7DB00GVZaDLzfRi
Un1ViyqhX+cChI/ERDdlbgWIlVukuY9TraS8Zd+U8RMj410o2ZWdIUAiiuSTFPun
59Wm2NhHebukvcPXCOwlSfQX/9G9ZVGyAunagJseQMRHDftqhcMwVssl5eTMYILX
fkztPh7rWOP9OjHtkxYF8RUoDCY4r7Jfiz1OUDDSzg1lAbrSLKSiT53/PTt9CNjq
lwIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => ' By"1Y?Gh(ujqjn [)ev>MrB{bBѦ~Z{M$cAebR}U*_D7en[Seߔ#](ٕ!@"զGy%IѽeQڀ@G j0V%`~L>X:1( &8_=NP0 e,O=;}',
    
'e' => '' "\0" '',
    
'd' => '<(F_]HY=    +^7.ƨ
 I4 x6yFk-&OyףP$UbvmC9 uagP~$ay!]Ѓq3v}oVE&|q^BaƌOmfCp)s#yEp3RhD Y:ubY} vÊ] *nu]$XmѺ(9I
'
,
    
'p' => 'O̠J&b7چsULsGтĀ2    [ٮE.1ԡF/?7u\'QubC86{l ?h>M',
    
'q' => 'ש>9`/\'R2pW/E#}p*ItHS{~(bW.H
z&]<%BDsv
rn\'T+G|p\'ٚg23gmhP3s'
,
    
'dmp1' => 'O3?v"dfF &UŘUO!gVtUˣ4KRҐKR8tmz2n\\0164FzXﵵ $!ۇ 3<B pQ',
    
'dmq1' => 'Fas4 1HjCwf}/ouԺ>]كP sZኜ^@top+Dۗۑq:,yDqf 7z!/ƪ%
ܽQwL<t
UD01Y'
,
    
'iqmp' => '_/2(.k2Q"P݈#d]\'jŴ+=Z$ݪu>[J薩),    Wu!X]b+|>;iVexd`)0',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'c00415ba0b429179221dfeb386ac8431b5e4edf259a7b89ba13f8b7f47936828756aad9cb4711005c06a08d5e5b86e0da4d0c215a7f7ac19f6f2025b2965768a17a48105f93e934d7242ab7b94e58b62b689dde742e6ddd1a67ea85a7bc34d24c663f4bfb0c1d3419565a0cbcdf462527d558b2aa15fe702848fc44437656e0588955ba4b98f53ada4bc65df94f11323e35d28d9959d2140228ae49314fba7e7d5a6d8d84779bba4bdc3d708ec2549f417ffd1bd6551b202e9da809b1e40c4470dfb6a85c33056cb25e5e4cc6082d77e4ced3e1eeb58e3fd3a31ed931605f115280c2638afb25f8b3d4e5030d2ce0d6501bad22ca4a24f9dff3d3b7d08d8ea97',
  
'e' => '010001',
  
'd' => '3c07cae71c2816a4e146b15f5d064859e63d092b105e80379fa4e72ec6a8ce12800af6f61bef910bcb491b340c1aa9c578368fc707794603e4116b2d26f702a54f98ed817997d7a389ca502455bba1e51d9e6292af76cff8806deea243391ec0158a20756184675084ad7e24d961c2ef7921aa5d8c9017ffd083c5df71d6331bdb1591fbf4db76e6ef7ddd6fb6569645d426fd0ee37cd5717f5e169b05a74261c68cef4f1e6d6683e2c70391b7f943709829027323c879451fb2d4d5160e703352a1684496aeffbb0c593abc7562edce12597dc5110b76c1a316b7c38a1ef25d10f2ff86d60b2a6e75dc5d24b55805c9c96da0d1bae01428883949b68fe60a99',
  
'p' => 'e3ee9c98fb4fcca09b8cf04a9626bc086237da86d7fb73554cc87347cbfcab83dafbccd182b8b6c480acf51ccce28af4e2113209ee085b0ff0d9ae8407e4a0f3f0de4503e9cb2e8531b17f91a0f6d4a1461c2fa1e7b33f0e3775c11aceccd8f627ab51fbd37562fa4338367b19ced004c46c150de3b3c205efe83f683e8e8b4d',
  
'q' => 'd7a93e8bb6c2391e1f9a602f27c4c5c752db1932b5e370571a2f4523197d07b298709fd92aba490474e0ed487fee53f88190fb7bdccbf4e27e2862571f8307ba2edc038f480a07997a8dfe1426b25def943c254244730e76040ae415ff72d013dd6e279d9c542ba3471799871cae7c70279fd99a6732dc33a9676d6885503373',
  
'dmp1' => '4f8233b415ae3f7622eca6018ea1126466468f7f0c26559402c5c598dcea55b618144fdd2199677fe256f2e5c9fe987455cba3c5dcf7a3344b52d3d290a24b16ed05cbd352a1a2a7a9aefe0e01b53874cd6d159c87a37a326e5c303136c43446a18ddc7a58c810efb5b50d2421db87aab20df5c63390c7f4a43c42aa0d7051dd',
  
'dmq1' => '46618973f734f3870d31486a9b43f077d8668096b81d7db02f6f75d4baa0bf3e5dd98391500c737fecd4eb1b5a04e18a9c5e40746fde7010eab32b44db97db91bb713a082cae794471669da0ddf0200fec04a4f4377a8521a6b8172fc6aa25961611b9040adcbd51100677a84c87f53c74f20a0605dfe75544d7e830d0311859',
  
'iqmp' => '1b5f8380b3b42fc832e028a28d2e6b32e6e4512250dd882384641a141a5d27fbc4058b6a96d3efa5c6e0eebd03efadc5b48d0e96b9dfc12b3d0481055a24a004ddaa14753eb25b4ae896a929bb7fd7ca0e2c0e04095775215880a4065d62f1842bf2ed147cc53ef802193bc4e6d569cb569b01d765a1ec1b7864ff6029d430a1',
]
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