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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwOHp9SpmuaLNvINYeuYs
Yr77fd7FYLAqfmmf/DlYQ6DGTIh2mhZUUSMkTknefhgDWk/o8QcHQl8Y4r9WweUh
Y5NtP1Eu5aacbheUFNWpDWSEBNLiqy2NqhBoNl3ZG18yNF+bZEBNDUp1W5hXbZvu
C1YoQpRrebZ0Hfc9EBnbcH9eoDlNxvC48CcbYoa+qt1Mplsk70zXMI77EDqWi5ww
ltKjVvtKfF/VWSacxv6iYlaywG6QECKQaeTjKvhEOxH4OV3bdbYvpPTMizjOTfsm
Fc/l4JK1EWxUhziUphkP6ZqJiQXdLUv0vBH1eDhq9AYmEsZoIIhE1tuYHXKS3U6M
SQIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => '*fͼXz,b}`*~i9XCLvTQ#$NI~ZOB_V!cm?Q.妜nթ d-h6]_24_d@M Ju[Wm V(Bkyt=p^9M\'bL[$L0:0ңVJ|_Y&bVn"i*D;9]u/̋8M&lT8隉-Kx8j&h DۘrNI',
    
'e' => '' "\0" '',
    
'd' => '?qjo6 :X퉩H^Ϊ̺p >-yqt޿Rg-6ƚ$ߠ֑    uYt"G=c~X#@,k3 c*@M    a;VZ>/0H|p͆9O>kQ~\\r3/]4Ei~C!`    l9&7Q69Єj}' "\0" 'o;?9=xi =tL>%',
    
'p' => 'N:czoLSWFmU$PoX9E* o\\SK759MW{1@qmY 8@ّ_ r)_bdb(WȻGnZә+84\'$\\Ft?',
    
'q' => 'Wx"e]:"k7b^*1d;+Z}M{qS_@Y5>W*")UPXbhgasY"K*-ܚ5>̱',
    
'dmp1' => 'C[g1;RhF;U&|Mv    u7 ٞ[84mj1~eõ"e؉uXK-_P#B!olI@3BC<YU!',
    
'dmq1' => '9weD~h8]VTlwljk~^@DLY^\'Һ).izћ곜D/h" !e?uq"S,!f5b\'%nⓥSJq',
    
'iqmp' => '*
ZMJg;DÈe#! HKt)/>^RvsY!]a-Q*U}~ 2@Tsaf!]{م
EWދKa(8I6?'
,
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'c0e1e9f52a66b9a2cdbc83587ae62c62befb7ddec560b02a7e699ffc395843a0c64c88769a16545123244e49de7e18035a4fe8f10707425f18e2bf56c1e52163936d3f512ee5a69c6e179414d5a90d648404d2e2ab2d8daa1068365dd91b5f32345f9b64404d0d4a755b98576d9bee0b562842946b79b6741df73d1019db707f5ea0394dc6f0b8f0271b6286beaadd4ca65b24ef4cd7308efb103a968b9c3096d2a356fb4a7c5fd559269cc6fea26256b2c06e9010229069e4e32af8443b11f8395ddb75b62fa4f4cc8b38ce4dfb2615cfe5e092b5116c54873894a6190fe99a898905dd2d4bf4bc11f578386af4062612c668208844d6db981d7292dd4e8c49',
  
'e' => '010001',
  
'd' => '3f71d01811936a9a6f9c03843620c216d5053a58ed89a948c0fe135eceaa06ccba8d7011bb0b7f3e95159b1ed72d98ce79857174debff787fa529367812dd236c3c69a9e2493eba2e6dfa098ddd2d691ea8effa309755974c822cf473d63b0837e10b8b75823402ceebf6b33cedd0c86f417181763e6cc2a13b54083ac4daf09d3613b97bcb28b565a1d3ebf2f30487c70cd86fa399ea99df44ff4803e6b511f7e5c72332fe7dccc5d9be4ec34f9d945de697e074385211b9495a184be1ae660a1e108da096c11dcff16b11f83de158916392637c15136f239baa9d0846a9f7d1a85001dac8c1ca46f3b3f393dba786920eff4813d74b9f1054ca6d53e259a81',
  
'p' => 'f6f181fe154e803ab46399177a6f4c5357466da555c1f6e7b0249b8f981da650ee6f979cd2c758d439452af620b26f5c53ca4b373539e405a84d07577b8a311440bf71f8ffa8a1aa6d590c05388d40aed9915f0ee22072f9295f8ffdee62646228929d83efab57c8bb479419cc6eec5ad7d399848d2b383427245c461e743f19',
  
'q' => 'c7f4d757017822655dc63aa68622d86b8c376215d012c0965ef496e3dc2a07163195649ef03b1df808f22bbcc65a16de7db3ed4dfb86b47b71edbe535f40af59fc9ce835aeb33ee490572a22819b9fb3f1295550c3cff1f711edd458626867f9611173d2fe0659228e9ad04b2a2ddc9aaddad035cdf93e0fd2f31fc101bfccb1',
  
'dmp1' => 'ab435bb067fe8598313b5215a268463b16b055a2f11310b626c77ccbdde7d24d16d07609e17537fa17ae0cd99e5ba2381a34966db7906ac031b51a7e65c3b5be2219a465d8898f75af58aea9804b16ad2d5f50d9f5a2239b0242b08ea021c514fea6906fcc6cbcf90e49da40fa3383e08d06c7d5d242433c88590355ee111921',
  
'dmq1' => 'b739771d65de447e68385dc3fbc3f056546ce7771f6c1f876ac96b7eae5ee09188abe140f6d6e4f644944c59b5d4158298e307bf5e8d27d2ba29e52e16697a84d5c29dd19b1ceab39c4412fafd92b1fbbc2f68db1222f910b22021653fff75cf011071f6d408d322a453de2c1221663562bbcff08da627256ee293a5534a0271',
  
'iqmp' => '2a0abaa55a4d4a15f567cfd43b0f4499c38865c723febc2199890c488f4b7429e52f3e5ee1f9c81c19d952e376c37359fa215d9361add72dfea6a351b7a7cd2a557dcf147e1e0cf132a6aa40bbe254b7a373041ebd61b066215d06a57b02cf1fd9850a455706de8b8688178c4ba361a5c3d9f4e62885d438f7493685dd3f1d16',
]
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