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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApYZCdlWzTLAkZ5RjjwQS
KyHCNIaefbdnAekHNTxBfMOj3W+4qi+3c2RnFOMT9Jkvtpzn1rHBCrzbAD2hnZlO
nW8dVw1IEza9RQejpXIbDBwERBkZ7/yuRS04I2aNMZnwj/DLzlpw+0spQ9Gmlhc9
YfD+R7DLm9c1CN859Fl943K/NfLd0HqRdy2JY/kVryK9J/djGdP0Ehe2j/f3Wb+f
JOAGlkibNRislmB+qB+cWxq00of+L5BlJmUjXdA+phNVJ6WY0kWk0bDEQV/PfArR
8v8Rfe3LcjOdlD/pTjEDppsZ18Gmrq6Ry6J1Z/10M9IVK4dlrO9DLE1/p+jtZn7f
HQIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => 'BvUL$gc+!4}g5<A|ão/sdg/ֱ
"\0" '=NoW H6Er DE-8#f1ZpK)CѦ=aG˛59Y}r5zw-c"\'cY$H5`~[҇/e&e#]>U\'EѰA_|
}r3?N1ˢugt3+eC,Mf~'
,
    
'e' => '' "\0" '',
    
'd' => '8-G_99hy=fl=[lWFjt4~
m0e
Cz e ) 9 Lrdltb8O #z8V65QsHRBS    J$uyD^' 
"\0" 'm Q(|Or0g֞%zm]+ ӫw0$b\\ױe!o%Efc6x xI`JIdbD?    g+xxeM]',
    
'p' => '띋,!^A<B&[W7iG\\B.lڐZFu.Ni\'RPT5,A|vA9cE//~"<m' "\0" ']{d+?i6N\\+1g',
    
'q' => '~l{s58/TrQM&<Lq+^ADmWo7l0ӲSo+dI9¢wpH )7mSZ_lE<4ϝà@Y)2~|࿏Xh@',
    
'dmp1' => 'NYZVrw୑Z=}ǹg<gd-iVpK #>zZ eaIt4    @Z[A.+W~Sf+ܡh3u~q[ƪP!JI?` ye',
    
'dmq1' => '^obվ^&ca#0!Dp8; `="n̿V:_K. K Z63E!9' "\0" 'm4gW"Eq״f~:3Gqei rw07,"-^Zm',
    
'iqmp' => '#> T>Ӭ]F,xݦ+\'ogCv׎vWCJ Rº+\'$~wQD4Z#`"7Hk` (4T
 .)%s\\(}RE[Fj*q'
,
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'a586427655b34cb0246794638f04122b21c234869e7db76701e907353c417cc3a3dd6fb8aa2fb773646714e313f4992fb69ce7d6b1c10abcdb003da19d994e9d6f1d570d481336bd4507a3a5721b0c1c04441919effcae452d3823668d3199f08ff0cbce5a70fb4b2943d1a696173d61f0fe47b0cb9bd73508df39f4597de372bf35f2ddd07a91772d8963f915af22bd27f76319d3f41217b68ff7f759bf9f24e00696489b3518ac96607ea81f9c5b1ab4d287fe2f90652665235dd03ea6135527a598d245a4d1b0c4415fcf7c0ad1f2ff117dedcb72339d943fe94e3103a69b19d7c1a6aeae91cba27567fd7433d2152b8765acef432c4d7fa7e8ed667edf1d',
  
'e' => '010001',
  
'd' => '07ae382d4782bf5f39013968793d661e6c3d97b45b6c57f346aa6a7434ec90fe7eff0a6d16308aa1a71a0565180af484bb43829a7abb0b6581fffbdc20f4f929e2fb088c0c3920041e4ce1720ede646c7462388bf48fd4024fbbd820ad128d23157ac5ea38561fc2f812368b3551b4be73b148e0524253f519094aa624f4eb75d7791b445ebe006db9fee9c40c861cdc51c003ef28e37c98dd4fc9723067a2d69e8325a0fe7a6d9d5d2bf7af872012fd8cdad3ab7730f782ff248a625c05d7b165219b6fc525a2458dc666dce46336f40f78b00b781149fff417604ae3496462449f3fb2e409d2c46796b7ba2b998db8e60e0778eaa9f00178f165c0a17f4d5d',
  
'p' => 'd9deeb9d8b2c211df25e413ce642265bfe573769b9c212e5475ccd4285f794ea2e6cc905e986da905a461875d32e4e69d227985250d8d51dae54352c8f41f7edce7c76a3eb41ccd005b039e5d1e3dfff8d069aa363bfd2f7452f2fcb1e08b37e223c01911e6d00fb5dd21a7b6404892b3f99069969a236c14e5cfc2bd8318567',
  
'q' => 'c27e1c6ccd7ba1733538cb1a9d2fc0a85472514d8a0516263c4c712b5e87891241a844f4e66d7f89b0c0ac1c57be6f376c30d3b2b3539413f0836f1bdd2b644939c2a29cc07770b348201efc29eec4376df053a95a95aa5f966cb4453c34cf9dd9c3a04059bace29e493327eab1ab7937c0ee7e0bf8f0e58d86813e611f840db',
  
'dmp1' => 'b40412de1b4e1d16e759a5c1b1e75a568c7277e0ad9183975a3d7d83c7b9679b8f3c6764b12db18db0695670944b20932307803e137af5ac0e8c995af60b65d561d54919eb9a74a634ed0509b540f9a5e75a5b8f412e101c2b57efbf7e53662b8411dca1916833757e71c95bc6aa50c4214a493f9d1e60eb9bda0caa1579e565',
  
'dmq1' => '5e6ff9c162ed1af1e3efd5bef080155e26d2f3636117233021ab447038903b20603d226e7fccbf56ce3a5fd7cb4b2e998cb110b9fe95209ba5f74be60db85a13ac3633db452139d9f3b59516000e6dbc3467b357d22245fdeffe8c71e9d002d7b4bb667e98933a33e1471007ad71659df9690b7277d130b8372c222d5ea05a6d',
  
'iqmp' => '92b71023153e0cc50b543e97d3acca5d462cf678dda6c72b27fc6f98674315eadb76d78eaeb77657e0a6c40f43044a0de452faa8c0c2ba95112b8d2724a97e77514434155a231fbcba60b104da2237b4c1b10ecc48136b600dd928c6348054a9a8c70ad0150da4882e2917250ef9735ce8288d077df352b6455b46bc6a2a71b7',
]
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