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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1C85YAMw1j7GJzgupo8F
SJvpv3ZmEKFXgqNUO9Icnv5oJpZJGD/JTfAnf5nWLTpFGji6jkfjQu6YRe/IXjI9
sSrOM/fAfvxob9BH+t2llYkSFEymOYiy5QlV2ld45aHjv/IZCkOSG1k7QTFHTeV8
dbed67pP2b+Hz1chNsApFuDL2XOMutaskg6st9eSXK7ZMnIFoeS2OF79Rj3ORtHX
ggHCh8YqO5NruWNjQKrLOOyFGljAgAA0+fADTOfnb1I17B6v+SjttMDY/0bKO5vk
+hAh9pUVn59bKmR9nxsFvWGkn+syL9lIUq+CA6h/r1Si+kPWNNKznZxF5ka82+Yo
7QIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => '/9`0>\'8.HvfWT;h&I?M\'-:E8GBE^2=*3~hoGݥL9    UWx
CY;A1GM|uOٿW!6)s֬ג\\2r8^F=Fׂ‡*;kcc@8X' 
"\0" '4LoR5(F;![*d}a2/HRTC4ҳEF(',
    
'e' => '' "\0" '',
    
'd' => 'YfOT"S-/,hͪf9<    3>miTte Π dx!l oiT[pV!`zhwdu-0{YCݖm_/}2Hב)5!=0 4CҷUSUp.(B;.czX8<"^κx3%Ƚ"Z*Ψ|XqCu@',
    
'p' => '$$\\V
ܕ>' 
"\0" '_xP    *;܇A
]-*UX/|
;ƙ(便|T" T9R\\a\'cfI3ٞh[EvÍNM '
,
    
'q' => '2@Z9P"i>ŤafܚO%Oa=1OD\\\'i-](0loɑE<*=kr46    pvds«5l',
    
'dmp1' => ').z%G\\&KӴB,fkS{gI,\'    qQi}*nQ1~8<7)ҹN rE]p{WaX-&A㟩c    c=',
    
'dmq1' => 'ʯe-@,wi<h28S}0%$MIA v-\'emib`\\oև ۡ0T]UV\\euWC}xhak' "\0" '~ֽ3    e bek',
    
'iqmp' => '̗S$.UK@ϯ~1aaB60 \\*ivr{`(XHu7v͒T4*l.9' "\0" '>>eORmX' "\0" '8OTڄ@R
ezO!NxRD;!'
,
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'd42f39600330d63ec627382ea68f05489be9bf766610a15782a3543bd21c9efe68269649183fc94df0277f99d62d3a451a38ba8e47e342ee9845efc85e323db12ace33f7c07efc686fd047fadda5958912144ca63988b2e50955da5778e5a1e3bff2190a43921b593b4131474de57c75b79debba4fd9bf87cf572136c02916e0cbd9738cbad6ac920eacb7d7925caed9327205a1e4b6385efd463dce46d1d78201c287c62a3b936bb9636340aacb38ec851a58c0800034f9f0034ce7e76f5235ec1eaff928edb4c0d8ff46ca3b9be4fa1021f695159f9f5b2a647d9f1b05bd61a49feb322fd94852af8203a87faf54a2fa43d634d2b39d9c45e646bcdbe628ed',
  
'e' => '010001',
  
'd' => '591da0664fd0c21ac9548d8722532d2feab3c8c32c68cdaa98668aa9393ce616099e333e6dddd4695474f265a50b87cea00db564ae92a778d8217f6cd30b1cd7fd176fc21d69f80ed0ef545beb9d70e989db56b9f5ae111c9ac82114dde4ec12607a88c3c3cf68871898efde77bbeb82f164752de1fd9d30a8077b1ea8a45943badd96976da4f4b3979882e7975fbd1a9095a9899b2f937df23248f9a9af1b85d7912935213d0e8f300c34c714e543d2b7fd55c2035355d119702e28a942863be82edd63de7a58929c383c96dee3225e1018ceba78047ff5c53325c8bd1488225ae42afecea87c815871c84387bdc0b28975cac8078cd516f6b8ef829040fced',
  
'p' => 'f02482d316e1e6d424f25c56810adc95863eda00b4ee5fe278a950092aff3bd1d2f694dc87419a03fa0a5dec2d2a0355582f177c080dd50a3bafc6998fbf28a2efa5a58df2fa7c549f93aa1d2297f2b31e1799bb880bba5439b4a952cf5c07d6156127638a6649fe33fc160fd99e68d45b9019b2a34576c38d8d9cb78f4e4d0b',
  
'q' => 'e2321840b15ad339010ff25022693ec5a483f461a0f095ded1c0156683dc9abb104f254f61a5a5b28014c63dbc311ee5aa4f445c8027ef8fe0a8e880ecbf692d5d14a4f128e3d630998ffd13856c6fc9918e90453cf82a3d6bfc72b51fd134fbc7e1953614f609b4cce4aac711707664a804ad73d4d0c2abdb07839135fa6ce7',
  
'dmp1' => '29be2eff827ac2251e4702c606a85cafa1264bbed3b49bf642032c666b92f25306d8d6077f7b67ca492c842709b2c3e191f29da271c3f5c4519bbc69f512c57d8d2abe1c6ea01bfc99c091517f31ea7e383ce1fc3729d2b9d14e1620ceeab07206455d13707b576158a7f92dc8264112a8d7e39fa9c1e96314b80905df633d01',
  
'dmq1' => '86caaf652dcb1fffe2402c77d069c33c68133238537dcaf1a330c20ffb182524c04d49c08a41fa01eb0d762d27ce65c91aba6dd4699262d1ec60fb5c88b86fe6d6870cdba130545d55c5565ca1afc2d5ed657557ad437d7868b7616bc9f01390cec600f2df7ed6bde533870965bd0cf062a796ed65ae99b36bac889ca9fbf795',
  
'iqmp' => '01cc975324df022e5511fc4bba054015cfafd47ee83161e41f90a696618a423612300d5cb3be2a69761df8727bf160c081df285848dd1d75803776f1cd92548fde348f2aab6cdd2e1a073996d6ee02d5d6e3003e3e654f526dffac588dd700e09338fefc1b4f1054bfda848240bb520a657a4f1ab1214edc781152440e3b9121',
]
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