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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0RKhM3R3Bz+eGrgLKUwP
7+H0vS1dOgdxgQXvYc9yBCFFaqVHiPlb+TlM4YPzJ7HjTM1pncqYvus+NPEXQUHR
qg+14YOTnEnXe2y6M+eAS0t5UOx3+Zh8WDNEP+4tar4XYRX8wwq7RzlokxerwYT5
C/N7j3CdHbAQuRWHyv8l2oP80UfI7AH9Ctd0jDwA7qSnfywVBM4DfHwfuT9Ruzkm
wqcPf4aLuWymvRurzPcg2ReCTjyu+VLLnlsgEbBYAxU/FljKxtTgqOtWE1hVEwKq
faqMlpfuLOPvOlxeGpcdH3vxjKKFVfhQMFkmPQ9xaXy6dMr4mcu8do27hM9rmbPL
VwIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => '3tw? )L-]:qar!EjG[9L\'Liʘ>4AAѪდI{l3KKyPw|X3D?-ja
G9h {p%ڃG
t<' 
"\0" ',||?Q9&§l N<R˞[ X?XVXU},:\\^{񌢅UP0Y&=qi|t˼vkW',
    
'e' => '' "\0" '',
    
'd' => 'ŁZweԔp[BIY:=j#N +/jPtMEGFwz SW(    dx:Ǥb_8NTRENnlSMZZN}+YF4/˻Y~@%ґ<vWXmi>d1TT_8J|A8jrAOڦAvO49g霂xSy^h h<ie):',
    
'p' => '__,i \\[/2-a=bbYVs\'uXv?CEߗf`Z ScTw0@$>pXioh6Mز<gE+q᮹ԦUɘ
\'j'
,
    
'q' => 'ߘt7lL-3HUAqeYh}1 .n/LE D2
t\'AWRyo4N!?K=y' 
"\0" 'F' "\0" '6iINyQx޽`;|\\4k',
    
'dmp1' => ':[
qx E]a*6PTq8Z 4ztɚ' 
"\0" 'pX k*    9a[)Vm    ǻQ yfK&    ϕaO3Sua U',
    
'dmq1' => 'vIg*JMT;+R5sgװр P]hRC1    &<A.    y.LWrUX pwCm =&w8Au9Ԗq' "\0" '',
    
'iqmp' => 'w\\.-SfKpcþ`
0Z{^:_n"f?+ X *ǘ/z;L0lZi`A\\waJlȶ    ."RD[rM-Q
VHvaM]"B'
,
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'd112a1337477073f9e1ab80b294c0fefe1f4bd2d5d3a07718105ef61cf720421456aa54788f95bf9394ce183f327b1e34ccd699dca98beeb3e34f1174141d1aa0fb5e183939c49d77b6cba33e7804b4b7950ec77f9987c5833443fee2d6abe176115fcc30abb4739689317abc184f90bf37b8f709d1db010b91587caff25da83fcd147c8ec01fd0ad7748c3c00eea4a77f2c1504ce037c7c1fb93f51bb3926c2a70f7f868bb96ca6bd1babccf720d917824e3caef952cb9e5b2011b05803153f1658cac6d4e0a8eb561358551302aa7daa8c9697ee2ce3ef3a5c5e1a971d1f7bf18ca28555f8503059263d0f71697cba74caf899cbbc768dbb84cf6b99b3cb57',
  
'e' => '010001',
  
'd' => 'c5815ae577f565d494705b42b7fd91e4a44986590f83dd3a3d8fb4c76aa823fca64e0bdb1b2badd62f6a50744d45478819aac74677f87a0b5315c2579c9f280906946478defe3ac7a4625f38df4e5452f5451c4e6e6cbdb2b8a395dd53ec4dad5a5ae21002d84e7d8e2bbea5d3c7e15987e746e73495b218ea2fcbbb59f3918b7ef2b940f8a6250f8ff7ead291973cb6765758179ea16de0bc69e60fa73e9f066431b6eff89b54545f384a7c41386a0f15f3a772aaf1aff315bea91815f8edcb41a5aef6df1604dbf7aa8f4fe7daa68484417606ca4f348e396782e99c82f68dd1d178a153c479a25e680c1487b3c8d768acebfb3c699383106529eebbb63a99',
  
'p' => 'ef5f5f2c699c02a320e0e85c5b08c7cd2f32ee2dbfc361b8b63d62fc62597f56ab739ee5821e27117558763f43fe9bfc4518efa3df970666605a0420d453c2639454e8cc77d6c2e530ce40d4f498b299243e7058696fd968364dd8b23cf26784da452b710480b9c1e1aeb9ba12d4a6f8d8550418fcc99884b0f20a89276a9fc5',
  
'q' => 'df987437a86c4c2df184c9c6e0bc339f4807e0f155a3f31341cf71658e12b0d759bb946806c6e77d311de0bb0c952e6ef7cfe6d02f1294914cdfde4520448c1f320a7f0374bda22717411a0557b7d952796ff5ba34ac4eb61489213ffb13a74b3d79000e1e46ecf800f9366993f449d94e7951780fb1debd603b7ca05ce3346b',
  
'dmp1' => '83f99c3a9b5b95a4a50afb71780b86455d61822a1d1136fea5138150cf54b2bd713805025ad40f0c341b7ace74c99aece297d6000ed57084df58a1f00bc0c66b2aac09d239bc61a6055ba22907566d19bbfee4e809f1cdf70401b598c7bb8a51981a0cd279fe12ec8f664b26091dcf956188b602a4d4ed4f3353af7561130b55',
  
'dmq1' => '76c349678ec4072a98104a04a2b6144d543b2b15c4c1528935f97367d7b0c1d180ce0ba3bd85c4cb505d6852b1fa433199db09e4263c9e41172e09a779de2ef71ae34c578f98721a855584f6b582e7a1d0f2d0f858a5f520ed8370efc4f2c977436d93c3ebfd0c3d267738999786b7fafe9d9dd241b3de758439d49671001585',
  
'iqmp' => 'e6dd77145c2ee48c2d9d53c7664b7063c3be600a30e55a7b5e3a5f1ab8a76e22db66d13f2b20f817101d580d1a2ac79815c608042f7a821386bd3b4c30826cba5ae869604107189ae15c778c61d54aac8c6c137f16c8b6092eb1bf22eab6520e87445b72d84d9fe62d51ad07aca4940a569aca08074885c476614dea5d228f42',
]
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