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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoZSYvNDQahXcPu46yxvM
whpdX8Ts3SeWxLZ2menz8surPCvXEh8H07KsWr75pR4qew92YohgfkAf9/J2bp+L
3VOT0UWZlDjiaqnDH4mOj95zShDFC7Tbn0BUwGBlnh+wQLxL6lJ4uOu3GrugwUHA
wGf/AkuCUeatmoTLtzHOQRU7vZfQFZ7W8YUoKlg2mxzQjLzOKdtZKLLpdYpwkcos
1ViGcPmXTJyFbnDb8MQWgl2eq80OFrDen8kUVcHKd9c35arCWaWh6uU6nPiYemmV
k27HmE+0+wPRWFzsjxjfbl9y/AWJEtgbaeOq6pmn7DCCd8tJogNfJnjDu5yiBcp3
pwIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => 'j>:]_\'Ķv˫<+ӲZ*{vb`~@vnSE8jsJ ۟@T`e@KRxAgKQ歚˷1A;(*X6Ќ)Y(up,XpLnp]ޟUw7Y:zinǘOX\\n_riꙧ0wI_&xûw',
    
'e' => '' "\0" '',
    
'd' => '"\\rknyZqo8q2^Gq~fY/ʑ[Zy\'>/^4׆zkB!fp7' "\0" 'دm&2Lj' "\0" 'c{X\'x TdpJ:wxyYSvv9=D^    |VlIF[k:' "\0" 'Ҋ#Yd\'B_a\\e]b̭)b0&I*
:ymshܞ@qݺ/n4q]0k?75ʠ:Hw/A'
,
    
'p' => '>ji2xDsOr[إ*xo|_QͿAZ' "\0" '8>ִ9zmB{-xĄ}Rr3WW,^[)j>k[JpAq*ga_I`VŌO-',
    
'q' => 'ɊWЪŰ/T>
<:@MCqBXtR1;?y?q@ _W[13-w;ϖ>PA}& ՈLbw'
,
    
'dmp1' => '_0ۺDxt2])ZЗa    jY_o d-m-P0ubV]~W5~Q ' "\0" 'f)`)ώkIJw[9E    M(^@

'
,
    
'dmq1' => 'e&V ov;L^xTsn#S;idž;@t(Xԙ zT;#ܘ9u =$@DAy9tX ǟrψ9G"',
    
'iqmp' => 'AyhbHLb3}K:' "\0" 'Kˉ+`#1@U^"(>;' "\0" 'nXSn    (e XI    EL-hD-HBg,+숅 .%S|⹳j',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'a19498bcd0d06a15dc3eee3acb1bccc21a5d5fc4ecdd2796c4b67699e9f3f2cbab3c2bd7121f07d3b2ac5abef9a51e2a7b0f766288607e401ff7f2766e9f8bdd5393d145999438e26aa9c31f898e8fde734a10c50bb4db9f4054c060659e1fb040bc4bea5278b8ebb71abba0c141c0c067ff024b8251e6ad9a84cbb731ce41153bbd97d0159ed6f185282a58369b1cd08cbcce29db5928b2e9758a7091ca2cd5588670f9974c9c856e70dbf0c416825d9eabcd0e16b0de9fc91455c1ca77d737e5aac259a5a1eae53a9cf8987a6995936ec7984fb4fb03d1585cec8f18df6e5f72fc058912d81b69e3aaea99a7ec308277cb49a2035f2678c3bb9ca205ca77a7',
  
'e' => '010001',
  
'd' => '225c8872b6f16b6e04ad795a15716f04e43871325eb0d54771c3dfcaf17ec866599eed2fca91c0c75b5adddd79178d27b98ddb3e2f045e34e2d786bf7add01106b42a72166fca7703700ad171ad8af6dbe14c526324c1edc6a00dbfc63ffd17b58f8f227fdabe09f780bfe54bc64704a3a937778795953761dc319d3768b0739d73db4441b9d5eb3b8cf097c566c49465bce1de1fbdf6b3aac0800d28ab123596427cb1442d1135f61c05c655d629fccad29cfcf04bcb5a662e3f43026492ab50a073a040479c0806de7d773f468a67fdc9e4071f508fdddbafc8e2f6edd34715d14306ba2ef3fb3ae0237c1e2dd35caa0817f1a96f83a9748facfe7c5772f41',
  
'p' => 'cd3e016a697fcbea32d97844734fcccb720fccd0e19a5bd8a5c72a786fa27c5fce51cdbf41b95a83da00388b083eabd6b407efd8397a6dacc9427b2d78c4848102f27dde527233b4b4f15757feeee69c2c5e5b29f56a3ef76b5b4abf70c019fa41f6b394c671f0f22a8612fe67611a5fa7e8074960bed556c58ca84fb2b82de1',
  
'q' => 'c98a578ffa1612d0aa8db197bdc5b02f54e5123e9f170a3cef3ab640fdc5ee9ba51ca4eab0e0d2f14d9dc44371abfd42a90e58980874f1111d0e52313b3f9ef079af3f71bef9ea40129b20e5bec05fef8ae3fe57975baaf4fc3117c1332d77b9bff8bf3b1ecf96b2079d903e50ab417d0380268da520aee4d5884cdd62770687',
  
'dmp1' => '5fa930dbba447874b632aa5dad295a98d09710ada3196109bf6aef1ea759a282bd155fc26f0dc764812d6d2d503075c362b1f8565da3f48e7e57e035b77e510c18a591891800669d2960fb86e629cf8ea7176b824902b64a77dd5b1f939bd5ffd0d2fdacb039d745e81009b64dd4f287f728ac8cc4eced5ebe40eb0a0a90d1c1',
  
'dmq1' => '9e6526ea561fd10bc46f763b0efff6b74c5e789754cb73d56e2353a8028af43bc96998c786da3b8f40741512f89cb6801483dce72806588c1daceab61c9da4d9d4990220f07a543ba523dc9813f1f7b43911750cfc3d2440449084dde7cdfd41b479d839abbe74ee5883e220c79fc0e972bdde0f06cf8804fb3993478f2282b3',
  
'iqmp' => '807f10417906d91a686248d74c62c0337d4bc83a004bcb89b3e62b931518b4c51683f9be136092ed233140e48f55c2dfe05e22ed283e3b006e58c0536e0928650b891658ea87f6f4db498609bf1dfc074589adbcc71c8ca5e84c2d9f68f5442df51648429b672c2bec8885f5f220c82ee32553ec7ce31cbcd3e2b9b36a9ce5f8',
]
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