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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv9miH1Ks61QcEsR6w/sk
iWF8qRM6zzPrkEndgJ5QAk0MSfzFvT2pfccara9Fsrq2TZRb+yQmnmoiX0BXJedq
CiBiZI2xiIfTpaZa7X4ctETVuYGmkFSQOEshHg4ESpqpvQvQB02OQ2hpPU4aMZY/
0pivR1seJW5Icz2UNtgQps0lmvGu1CPQJPac/HWBAwX/toqunLUJcDRjqXs615Sr
M1Ajze+QmhsGazqps1sS+Glp/XoqwKYnWoyNB5TqUV/EDGxzO796FN38Gh1oA/rF
NzQ4DVwqDMLFE5J1+X8/UriTVdQMQJCQfXPbfkoQ6nO0a4cmPr35LJHrVizFP24e
NwIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => '٢RTz$a|:3I݀PM IŽ=}EM[$&j"_@W%j
 bdӥZ~DչT8K!J MChi=N1?ҘG[%nHs=6%#$u    p4c{:ה3P#k:[iiz*\'ZQ_ ls;zh748 \\* u?RU @}s~Jsk&>,V,?n7'
,
    
'e' => '' "\0" '',
    
'd' => '=Ƨjk,mqlX!K Z٤l NZoy    sMT ,bЙ}7vLT㇬ hzxYQEQo75X-1Q˲!hw<&֘`};!LiHSê!^nYHCYQ߰v}e\'g9Mx!' "\0" 'e8,"FV(%mC{ӁA?@Km ̧8OGXꑐ!',
    
'p' => 'jsэ9^' "\0" 'o.wq"|uʆqأF Yf]Lip[rDEF Yw󀘺J8Fgjƌ/<EQ',
    
'q' => '8gWgŹq`DU1q8^gfUߥ&)U|6)RK.+*eU    h웟tt`Y{6Kͷ"V"m^.!b2%<',
    
'dmp1' => 'W\\P[~r24tCw5]4, ;&iUMGC=e[FZ@=>ϭ;% mBZԼ7S"Cצhn!V󴅨%f!',
    
'dmq1' => 'hʤ4Qb ڵCf\\e -bwifko٠{\'TJ}+_>C@I
D.Vs`4Ԉe˂2vdO
UL6SS7T'
,
    
'iqmp' => '1զ^7)`CaQyWd@q^H\'NBfՓ2ۄ\\Zw*LGe:їG5h4A}kX̷#=]sbAK:',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'bfd9a21f52aceb541c12c47ac3fb2489617ca9133acf33eb9049dd809e50024d0c49fcc5bd3da97dc71aadaf45b2bab64d945bfb24269e6a225f405725e76a0a2062648db18887d3a5a65aed7e1cb444d5b981a6905490384b211e0e044a9aa9bd0bd0074d8e4368693d4e1a31963fd298af475b1e256e48733d9436d810a6cd259af1aed423d024f69cfc75810305ffb68aae9cb509703463a97b3ad794ab335023cdef909a1b066b3aa9b35b12f86969fd7a2ac0a6275a8c8d0794ea515fc40c6c733bbf7a14ddfc1a1d6803fac53734380d5c2a0cc2c5139275f97f3f52b89355d40c4090907d73db7e4a10ea73b46b87263ebdf92c91eb562cc53f6e1e37',
  
'e' => '010001',
  
'd' => '3dc6a784ac8b8fcf6aa6c46bbf95ac032cc8066d71bf6cb98aa1ae588f21b64bf70c0fffe05aedabd9a4068f6cc30b8a4e5ada6f790992731c944d5482990cb52c0e62d0997d1c37939c88a4f6b9e9764cd7ca1ec754e387acf1820b0368be7aafac111578ecb959f2a151f7ef45b1516fe6e8f43735d8582dfb833151cbb2d9c62168773c9426d6986007b07d3b214caf878ba369f7c8c748da53e8c3aa9121195ef16e8259a94843e059fb51d5dfb0767df602f5f565eab0d7029b151b27b6678039144dbbfa1f7821009acf65382c221519ca46561f2825df6d9b97431c7bd381413f40fba69c4b19b70fc96df6e311aa0bcca7bc384ff34758acea919021',
  
'p' => 'fd7fb1a8e2121b0218cc6a73d18de6ac1eef048c9ddf39b7c45eacb5ab9d8c8000de6f932ec41377ecd471eb22028c8a7c85750fc193ca8671d8a346c820c1cd06bed35987669fa35da54c69af70075baf81ef7244ff83450fc346860b59f495821d77b3f38098ba4a1fbd3846f59efe8096676ac68c2f3cfb0fd745cde0e051',
  
'q' => 'c1be38f7a167d51ab95767c5b911e271826044dde29955edf1317198869a9c9038865e676655a6dfa5e703a2921118269e968c291ae5557cfb8b36c094a7a9182952d44b942ee02b95ec2a0665b81490c089dd55fe09689eec9b9f74c097741b60597b364b8c1298c4cdb7db2204a556b8226da394e95e2ef62162321e253c07',
  
'dmp1' => '579c5c505be19a07fd7e188472b63234e6740104804377f5351eeb5dd6341b2cda20063bbdfbf2268e6955fdc7c14dc54707f0cf433dcacef065c8f85b8e46ac8f5a403d3ef88ecfad3bc5cef8dd250de0f86d42f6e9bffa8c5a16f398d4bc1d37dceb53fc2243a68e9bad8fd7a6680ed96e21cbdb56f3b485a891e404256621',
  
'dmq1' => '68f18bd3fe96caa4f61df534f1a1516220b7dab5c1a7431766dd5c65bd0b84a0ce2d627769c41d66e96b6fd9a07b27f4cb544ac97d2b1a1a5ffab186b13efbe5fd844340491cf70a44e42e835697d673ee06ff6034018eacff06f0e181ecc7d488650fcb823276644fbe0ac7e4ee554cdae2b336b7538d53acb8ba82e1375403',
  
'iqmp' => '9c3180d5a68788fe5ebb16a3372960baaf0143618faa51e1f180827957fb649040c47108c4e9b25e95d4f69948eea3274e42ae0866e11ed5931c83a332db845c5aaca8131377d4dd2a4c184716ebaef10faf65adf83a8796d1974796f93568e33441817dcc026b58ccb7e88323063da5bcbe5d73ae62988ed6414b3ad5019e96',
]
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