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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsjly1B7yJrkfqy/3RWoy
0qYLs+JxpzINE9yd1NFbsUvrHPXfwZcLjK+/KpuUVSIoML4u6DyhAgRWxl8GCdp9
vHhdCfWry9tb+QkN/9jyGNusvoX6bomIqTsICwLjdDz0hzjt5BydTubOvByGHfMT
eFo4nn17UI+3Mtd9F2rqQM9w6miy1gpHtXGfBEDpk/iz5ksLF/xC3PVdTAH7+G3s
qY07lTN8KxrV0JEkkTOYeZ+cYyBmN38F3YXYon6X7qRQjrvhCTJBI4MdpWUU+k6k
jXTN4Kz8WpclkTUg12ZJxxFjjkWFgCEAwsMPm1GKLSJRgQUbtBAC8lHYrAS4HUeX
hwIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => '9r&/Ej2Ҧ q2 ܝ[K *U"(0.<V_    }x]    [     ۬n; t<8NμxZ8}{P2}j@ph
Gq@K B]Lm쩍;3|+Б$3yc f7݅آ~P    2A#eNtZ%5 fIcE!' 
"\0" 'Q-"QQجG',
    
'e' => '' "\0" '',
    
'd' => 'G}ɡZ-XO}>8ķ ɵqL I77ՕȎC$zfG8~*ٵLءr=]h:JDrI^H0.Дb
~!IozV :j*ңTRskp\'Y:yJ_?Gz5x:TS3A
ɞ{;Epy е7ɼ\'9dҽ8>- n}n\'g;oV%#ش)'
,
    
'p' => '~KQ^nbjX_T]\\bG C+!MU`YIOgJ)j8 Z#370enQ~2M "n ECfNU)qƬc3?s',
    
'q' => 'Q&73LwD^5*pХM̦A5F$J7*    @d2' "\0" '̔*7{|kRv6]Cix^ }rQkݲx~-P#0heJ–%~1',
    
'dmp1' => '&N{
n%l<\'hhiYӉx&)dؼp,4]-/Rbj^eKjS: Ž3
2!Nėx' 
"\0" 'no-CD*+7',
    
'dmq1' => 'B1+
yew樠]gW`R0,`!4(    "NoV7ۖ\'YQޛ*(v^-4?e×-|gْ()C<š ˊ)'
,
    
'iqmp' => 'ɧ19i Xe' "\0" 'Jz`DksL^P{EE4Ο (zRPo GωqjW' "\0" '"kؐ>cX򌖸kTpr_7o -;Uϛ',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'b23972d41ef226b91fab2ff7456a32d2a60bb3e271a7320d13dc9dd4d15bb14beb1cf5dfc1970b8cafbf2a9b9455222830be2ee83ca1020456c65f0609da7dbc785d09f5abcbdb5bf9090dffd8f218dbacbe85fa6e8988a93b080b02e3743cf48738ede41c9d4ee6cebc1c861df313785a389e7d7b508fb732d77d176aea40cf70ea68b2d60a47b5719f0440e993f8b3e64b0b17fc42dcf55d4c01fbf86deca98d3b95337c2b1ad5d09124913398799f9c632066377f05dd85d8a27e97eea4508ebbe109324123831da56514fa4ea48d74cde0acfc5a9725913520d76649c711638e4585802100c2c30f9b518a2d225181051bb41002f251d8ac04b81d479787',
  
'e' => '010001',
  
'd' => '47bc7deec9a1f85a2d580f4f7d3e38c4b71720c9b5ab71a6f7e6a614c24c20fa08e1b849df3737ebe1d59585d7d7c88edac7c243b21bb09f247a66471cf23808037e9782ae2ab8d9b54ca2b8e78ed2d8a11872ff113d04a7f15dd468ce3abc4a449f72898dc6f7ba495e4830e79f2ea813d09462b79efea9e3a9feeccd190b0a877e21bae91e818294496f7ab2ee5689e4e60f0c3abfb5cf6a0fd6fc2a0fd2a3545273e76b70279d593a79924aeaf55f3f96b747b67a35ba17af78fe3aa554d9533341c60a10c99e96197b3bab4511ad7079180b8dd0b5ee37c9bc2739931f10fe640ed2bd38fabb3e012dcc206e7d6e2767a499193b6ffda35625d023d8b429',
  
'p' => 'ec037ea94bcc515eb8066e626a58be5f545dd95c62ba470b83a7dcd51b438f2bad214dd6c0c513c35560158659d3494ff61de6f8674ac108a1296a8938060dd0dd0894b15a23e333b49e9d37863065b5ca6ec451f5cd7e3287af4d109020a9fb97226e8a0de2bff745cb4366b94e8d5529718c1c98c6ac63a2d833de3ff4f373',
  
'q' => 'c151263733b87f4cdb771b44bb5ef735e12a70ead0a5a54dcccca6ec41c13546244a37bd2a0940129964f3a0ff32e5bd0097a0cc94fa2a37ea7b7c6b139d52be76ae36951514af5df5d74369fb78d45e0b7daa7201f5518eb8f96b9dddb2a1ee787e9dc3ecdfd62d50adf623b8d330a486a568659d4ac29625907e3182ca0e9d',
  
'dmp1' => 'd2264e7b0a6e14aa256c3c8fcf27d3e36868e46959d389fd1baeb578dffce917b7e226c029079290648dd8bcb770e61f98038a2cf7345deb842d2f9a9d52eeac6294086a5edc03ab7f919865df4b6ad5533a0bfefac28e330a1432a7a3de21dd4ef6aebca89e95d5e4c497f078e2140097956e6fec2d4344b8b49082be2a2b37',
  
'dmq1' => '1f42e6312b15fcd00af579dd658777e6a8a0da5dbe9beadd67eef8576052c430b191a6edda2c60c621342809b2fb2217ac4ed8dbfc836fec56e8dd37db962759518bde9bc12af528f6a676ea5e962d917fbe349ff71d1ab13fcc65d0c3972d8488cbc0eb7c14be67d9922829a2abd443e6da3cc5a1e8030b90cb8afcaaafce29',
  
'iqmp' => 'c9a731d1398869dce684e59a0c58fa65009f854ae7bb7a60446b880812734cbc5e507b458b95ea4598d7341e18bcce9f95922028087a52e9506f0d47cf89716a8157978de700226bd890ec1114d70e9d1d3eeb638bfe03f158f28c96b8bdbdbb6be554d701dd700472c0a6b75ff11137c76f0b2dc51b8fe0f23b5511cf9bdaf3',
]
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