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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApnHvTxH+4CmENUoPc4uH
5gTFrnGJ2VHkQj3eSmyyUm15RWHhUkCU4OxwSSbi6NLSV6cqjq1TBmMv+mvhniKj
mvge2FO9iy9zrdPijdLkquyusa3DQ2nMF9bipOApoWp/5cYZICqXWXYdGTIGwrGy
ukLLL9/tD5NgOElBWu7KkabHLGZHtmROZ0iBydmXwUPu2tI9B0cvqOqvtA1Bxoa7
3OmF01XynWUTOQ8wcUkl5IZeEBJTiOMA1Zr+iDp8i/2BOEGePgBdmaTBm50oQJ1s
IkX4627PNyghDXe3+y5MjY0G+ZMPq4VbGpUOAzm9lmXMu055iSUDUNR87CcpWuiz
QwIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => 'qO)5JsŮqQB=JlRmyEaR@pI&W*Sc/k"S/s쮱Ci)j *Yv2±B/`8IAZʑ,fGdNgHٗC=G/꯴ AƆUe90qI%^S' "\0" '՚:|8A>' "\0" '](@l"En7(! w.L[9e̻Ny%P|\')ZC',
    
'e' => '' "\0" '',
    
'd' => 'PSl :/@U<ᗠ0NX 9ܩ*_2aj/KD4
h q;UѐaKyI:>D/ߖC{qVUvGϬ #d[>~Cd0UIXlfѤzީ2"7j+EDE,kp #sΙCtΜ㛏e#SBq խ@o٬y3 %+
3>$0ch?D!'
,
    
'p' => 'Z#s{tF@ hT*z@JN~&Tn-ԓ9A#WL.yIe(p7y' "\0" '3b7Hq)@s3ʻHOCz猣
u}a en~L.'
,
    
'q' => '-DeMB%j=e?n ~Z]y:Rl~DK"ud>QVhq)LMLUGOq&T_a5_} nc}θDfǛ',
    
'dmp1' => '    FRӬ&ذ&<_G+;y&bfwDtXBoED%gLD}FD>*    ~\\ ܾ_Nibi߇#8',
    
'dmq1' => '#Y
p:f+3?\\W1Q#\'> (S5v~;¡P\\' 
"\0" 'bB$(v^ڕu&{ M$GBDvֺnƨ7^Єdu',
    
'iqmp' => 'f4&ĤR-ΊH<]!gnii==s{ߧl>
F#3q{ِ4ӓ56g >
ֵ+r FenA)[<$h08 '
,
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'a671ef4f11fee02984354a0f738b87e604c5ae7189d951e4423dde4a6cb2526d794561e1524094e0ec704926e2e8d2d257a72a8ead5306632ffa6be19e22a39af81ed853bd8b2f73add3e28dd2e4aaecaeb1adc34369cc17d6e2a4e029a16a7fe5c619202a9759761d193206c2b1b2ba42cb2fdfed0f93603849415aeeca91a6c72c6647b6644e674881c9d997c143eedad23d07472fa8eaafb40d41c686bbdce985d355f29d6513390f30714925e4865e10125388e300d59afe883a7c8bfd8138419e3e005d99a4c19b9d28409d6c2245f8eb6ecf3728210d77b7fb2e4c8d8d06f9930fab855b1a950e0339bd9665ccbb4e7989250350d47cec27295ae8b343',
  
'e' => '010001',
  
'd' => '50b453e5d202f46c0cf7cdc63a2f40a0ae55afa4cbc33ceae197a00e14304eb95820e539dca905c71dbdc02a83c1825f8d32b7f6e061ae6a2f9c4bece4c144f4e2340a8e680c71e0b43b55d1909d61a74b794998b13a3e449ce3de2ff6df968517437b715655768247cfacab0c821ef82364e3fcbeb45bb03efa7e1efa43ec64da30b6bc5549586cea66d1a47adea9e63222fe0fac19376a2bd0031945c1d0441db989452c6ba982700cc423e9f20f739fce99f0e543b1c1f9e0d0d674ce9c8ee39b8fedf6f965239953db421c719aad160cddd5adb81540c06fd9ac79332025e12b95a3fcdf0a333e909224f703aeb9d8db1ff8306368a2973f9a448985ac21',
  
'p' => 'd819a0b25a10cb23731c95d17b8774854640e9a9206880542a867ab5c9e4d7404afe4e7e261ffe8f548590818202926e2dd493f23904412357854c2ef9ad7915499a65852870379c06a079d5c7e0f9cf0033629d37a4488a71c229408df17333cabbf2484f437a9ce78ca3c60a759cfc8e7d61b3d80b65ec6ebc7e4c882eef93',
  
'q' => 'c52d44e0ce654d93a5ac4210256aae3d0583651e3fb66e0b7e5a5d84ddcaf479933aba526c7e83444b04a3f79fb61fe212bebf1122b7ffa3fdb37564fa3e9ba4b7f8f8911651b69556a98a68a70fac71dd29bac74cc84d4c55470f011c4f9680712654c9e2c95f6183efe9dc35f45f7db10ced6e637d13ceb8440fc966c79b91',
  
'dmp1' => 'd20946a952e4d3ac26ebf7a9ddd8b026013c825f01c2d047fdf52b3b9979b4c5269eba07de62667744fd74908b9e9858426f4544beaa25ed85d9674c991c447dae4644ba01ade03ee42a0181097edf0e94f15cbdd620f4e8aadcbe5fa216b593f74e69946286019c93699c9c95f9ee9582a0d6df87f2bc23eb1585e438d0f5c5',
  
'dmq1' => 'ba13f6a49123590ab596d2e199ee0b70dafb1d3a66b62b33fd921a1f81903f175cb25793e17fa33197fa5123273e20e8a0f8122881b35335d7febc1307767e3bfcc2a1118b16a2505cf0b3060062f242a28cf70f8e8e992428765eda9575267b204d24474216f84476d6bac46ec6a8375e16ed1af818d9d08464f6e10275ed81',
  
'iqmp' => 'be90663426c4a49ef7a1f4522dce8ab948ae3c5d21efc667f68afa026e69f2e1698cde3d1304049f103d737baca1afadf8d9dfa78a6c9dd4ee3e0a461208140f981b92233371c67b0e04d990ef34d393351c36e1670cc03e850a94d6b52b9d72a289bdfad70b469ee21e65ea6e4129bcace2d9cc5b15f33c24a3bb6830aa380d',
]
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