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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtem/+hqN8C14li/FVUvw
YWQI19q9j2mZos0rqaDXYzTml8uYcyomQdqInOb75WR0Zm2d+8GuG+fSliV+C5Pk
EACbYUWHJFfAdHGB/g+GTsOfU43USuB2X6ERqOqOzgx4pAiArcPVZr87IeSnPk0w
TyMBCQ/mLvdgyZ2WPp8zCVLT2VY+R/mKKG5APd0A63jKlAsdevdBp3SmAJ5PjbLp
T2iHaPZOQ33kXjO8MR2hRAwG+65OJ+DgBfiKS2RY5w1Ydpe4tmcOQ73aC4CxxfVt
d012JCWrFnFjv/LXvvB2edGaOZcR3d42FcnWqkmpYpY+0QKtTrFmBDpMJ/z8OgBy
zwIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => '-x/UKadڽi+c4˘s*&AڈdtfmҖ%~ ' "\0" 'aE$WtqNßSJv_ xf;!>M0O#    .`ɝ>3    RV>G(n@=' "\0" 'xʔ zAt' "\0" 'OOhhNC}^31D N\'KdX XvgC mwMv$%qc׾vyњ96֪Ib>Nf:L\':' "\0" 'r',
    
'e' => '' "\0" '',
    
'd' => '!l< ՜—$ᴿ=0QoHCfHL/_ cI#"+H&y8͇6Xr`
Y%2Ǖ2AöBU KSAՊpW[btc    54AezKt\\#Q„VprR\\qs<۬Xpco
NC9#60 cф 4z2FK'
,
    
'p' => 'SwCƃ/+r4!)1E MXY|{Pu ql?
 pRstV(6tJW!Q:QaFN/ٳ)/3g^' 
"\0" 'd!rJ]',
    
'q' => 'ɝ{&Y|_J`V> 0{@TMm»=]\\YsTI' "\0" '{ڥ!c Q8R:O`o,k]تZ    0SvLꢲe+. [Ug*%EA-E_!W',
    
'dmp1' => '4m >PAof9e ʨi|B݇AG\\~ t)Ѿ1,NE=j\'s/y,.51v"w4"sYy5jq)j;^  1',
    
'dmq1' => '&/:>m.<9@ ww' "\0" 'XҘ' "\0" 'YEF&F`Si_[\\r2~-l
楔@&/Jyo<dR' 
"\0" 'P!cg#Z2H%',
    
'iqmp' => 'ۆr]8/αZ3+ e lNP D]Pa[suxZسf*jΛ`YZt9 fҥ3\'iDm ',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'b5e9bffa1a8df02d78962fc5554bf0616408d7dabd8f6999a2cd2ba9a0d76334e697cb98732a2641da889ce6fbe56474666d9dfbc1ae1be7d296257e0b93e410009b6145872457c0747181fe0f864ec39f538dd44ae0765fa111a8ea8ece0c78a40880adc3d566bf3b21e4a73e4d304f2301090fe62ef760c99d963e9f330952d3d9563e47f98a286e403ddd00eb78ca940b1d7af741a774a6009e4f8db2e94f688768f64e437de45e33bc311da1440c06fbae4e27e0e005f88a4b6458e70d587697b8b6670e43bdda0b80b1c5f56d774d762425ab167163bff2d7bef07679d19a399711ddde3615c9d6aa49a962963ed102ad4eb166043a4c27fcfc3a0072cf',
  
'e' => '010001',
  
'd' => '21ab6c0efc8f3cdf0dacae96d59cc297240ec6f50394e1b4bfff3d8f9de77fc330d2f3a9f9d6d951e302da179e93ecade6af6f4843a6d81f6648c813b64cdf2f5f0d63499d23cae2222b48261ff579ea9738bdcd8736587286bb600a59f82532c71993c795b18fdce132fac141b4c3b64202550d0e4baf19c8f753f1af41a0fdd58a70c757e4195b6274f1e263091e05c535c5341619994165807a4b800174c9d7e95cb123ee8e51c28456b284b29c7072e896525c711ab873ff3caddbace758d8c91970636f0a90a71f1eb4851c1084881eb5ad4e8c9f43c33923a5b9b0827f36dc10dd30080c63e8e0bf0fcfd184b90f0badd134847ab81ab8c6e032464bb1',
  
'p' => 'e6fb53fc867707f9def58baee3bd4389c683e52ff318e1032b7234ee21be29ce1699bdfc1531b44584e90b4dbcd958597cf2b6f7fd7b50750d1feb71e0d0e06c3f0ad82089705204737456849928191d36059e749bc14a955721513aedf71e8551816146939f4e2f07d9b3b0db29a92f8e1d33c5675eac00642172960f824a5d',
  
'q' => 'c99dd802831807b37b26a4597c5f874a1ae8609056ba3e0b307b40bbbe541fe24d6dc2bb10833dbb5d5ce6597354490001d87bdaa5118a216320bf5138c1a693523a4f9b606f992ce46be75dd8aa995a093053764cb4e2eceaa2b2652b2eb0c720825b5581c467c12a25a786e3e3d2088e0e45e541a2bbc92d45c75f0221571b',
  
'dmp1' => '9034d116938cb4fa176d0dac3e9ae7139950b741dc6fe7eb66b082c33965d40bcaa869a87c42efdd874147c15cea04f2b9c37ee00ced7429dfebd1bee331052c0f9fe1974eb7453d6a2773ec8d022fcbc0f2791f2c2edd35a7943176ad22df77348fa5ffbe2273598179356a7129ed6ab73b1c1b5e9208a8a5db0c030be3b831',
  
'dmq1' => '861e262fa59d3aa23e6dfa2e3cfa1f3940a50c7777f9f483e50058938b8cd298ec00f3e5149af959c645a24626de0ea19e98afeb469b6053cd695f5b5c7215a932adef7ee0abdc2d6cd60ad6f6e6a594ab4026852f89b4dafd4ab5796f3c640452afe4aa00e4f25021056367ebf9052303bca2ea5abb32482581a19aa6041fb9',
  
'iqmp' => 'b3c1db86725d38b08debf8a42f9ab695ceb15a33a5efddddf4db2b0c98cadb650dfe99906ccc4e500d1204445dbfdf151512ed178a5061ad19d25b7375785a831bead8b3669a2aafe4861f6af0ce9b85026082a3ddd7f88459f6aea05adc74a714399a0b6612fd95d2a533dbc2da27d069f897c2c5d8446ddc0cf5c8c2d219c4',
]
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