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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArkC7Y6qjIxIawzFNkCn7
H10RG8tAKc0pVyD+/0XjU+h/KtYFlZ9qEni78KJZIlEkTj+7B2E7NlsqU1KVMy9E
257ohgvLsJwykMXHh9SEoP+Du7E/SYSp730Y4HOKsFWlWAxdBGCY8Kg1w46ctDxV
g4yiB80d6X/VOzAq4Ph328ijMLVefJ/kkAPyO//SEhretax+8b17LNQqbMNw50Ms
UTXb2frewBX2Ci2p0y/dqhj/+g6dE0OJsYq4bWgz3omPewAbdP3ySE4OQ9YkW1aZ
OmcLtB/i1OuYxJDzoNFGcsfuaGKE1+hTCklqdBwXw7ZLzLTKB0mbFgJJ/YQwZvz2
PQIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => '@c#1M)]@))W ES*jxY"Q$N?a;6[*SR3/D۞ ˰2LJԄ?I}sUX ]`5Î<U;0*wȣ0^|;޵~{,*lpC,Q5
-/ݪCmh3މ{' 
"\0" 'tHNC$[V:g ĐFrhbS
IjtöK̴II0f='
,
    
'e' => '' "\0" '',
    
'd' => 'GYc#t\\)0u163yF<<E0-!4Vܴ}ٛ7%4@lo%${Tqa ngbXh:C` 0O X,$A6\')+|\'yDSS*2A
NrS۴' 
"\0" '״Ž  k!m@T@<Ix2z:ІչL-OR&t=x@ڽDxm

>*#
M ԁ3y '
,
    
'p' => '5lE֌~BЖ Enx727.zb9b2 B7Jw9>A݇N?Anΰ[eʮ9Ff&0fQ}+ƺ5D:/9k`,I5',
    
'q' => 'aqEo$
?TK겂qm];{ȖF&NRlҞTp, *2[FŌgy3arqTu&0o^}9c_uu*'
,
    
'dmp1' => '@ ,/MB-}"o /TXjݷ~s$Ryxt2d?{bBTsp' "\0" '|c* Jcsw!Gط$Um&AgƍH+ѪjRU',
    
'dmq1' => '1L%' "\0" 'Oa/T$۴b1ܠ9 Ƥc£-]u}M=B}{,mr~;Zا"woŚo\']7u+b"!',
    
'iqmp' => 'Ew<o8;{0fb[#JX~LӾ2N^YAMLjK)SVo_g;@6&TQRF!Ë6izb|k+h^ 7',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'ae40bb63aaa323121ac3314d9029fb1f5d111bcb4029cd295720feff45e353e87f2ad605959f6a1278bbf0a2592251244e3fbb07613b365b2a535295332f44db9ee8860bcbb09c3290c5c787d484a0ff83bbb13f4984a9ef7d18e0738ab055a5580c5d046098f0a835c38e9cb43c55838ca207cd1de97fd53b302ae0f877dbc8a330b55e7c9fe49003f23bffd2121adeb5ac7ef1bd7b2cd42a6cc370e7432c5135dbd9fadec015f60a2da9d32fddaa18fffa0e9d134389b18ab86d6833de898f7b001b74fdf2484e0e43d6245b56993a670bb41fe2d4eb98c490f3a0d14672c7ee686284d7e8530a496a741c17c3b64bccb4ca07499b160249fd843066fcf63d',
  
'e' => '010001',
  
'd' => '87478bf35963237407c0e802de5c293075313611ba3379aa9190f546bb3c3c45308cd1f12df2c007ad21c33456dcb47fea1bc2187d9cd99b3725cee434038b82b140b5e86c6f2524808e7b547161b2180c6e67b1c962ac0758683ac098b843158560bbca0d304f0d5808052c95248e02fde841043627b3ed97f0d2292bdce98bf5fde27c9a27adf1c503df79445353b219f8052a97fc32410a4e725384dbb4b0d40fe600d7b4c28e98200dc96bab21a86d40a4ab54e4a840013c0449db78327abcf893b8d13ae7d086d5b94c8f2d129e4fa6fbe8a6522674993d78a6cee80540dabd44f1786df30a0a3edb2a238dd5ec1f89fbbb0a4d0cd48133f579b4860ce1',
  
'p' => 'e7e0356caefc45cdd68c7ef61042d096130c451d6e78373237eb2ef87a81f49c62eb396201320cd9febc42ba3791e4e7e0854a7702afd313393e41f2f718b3d4dd874ee93facf8c2e41d416ea5d0d3ceb05b65a6caaecd1a8efa39e5cc466626a4eef230e68dfb8b66517de7cc121d2bc6ba35afbb443a2f398c8f6b602c4935',
  
'q' => 'c061ca71b6456f248a0a3f544b9eeab282bed2716d8dd95d3bd2ca7bf608c8964610264e8552da6cd29e54702ca2e8f40b9f14f72afcd632b75b18ead746b3fcdcfbc58ccf6790b479b405a1a033617271c904c71f5475f526ccfb3085fff3f36fe5065eb17d8b8e9e8b10a7b73918635f90a0fc75b075b4dacae5892a94a1e9',
  
'dmp1' => '8f40f4a0adc70bb52cace62f4d428a2d7d9d220219e2c96f0c1f0f88d1df01e9b02f54e75887bc6addb71f9e7e8073245290e6bd79fa787432f464b81fb2b23f7b9181ce16d9dd62429e5473709c008f7c632afd0dd14ac3f2bb6313b6cd7384c2772147d6d8b7249b55136d26a5b641fa67c68d482bd1aaa56a529ceaf0d155',
  
'dmq1' => '04311d4c2500964f61829fa6a28f2fe5fbdb54928c248f1becf5c6dbb49cb46231dca0390dc6a463c2a3188be92d138e5dc2759e7d1d4d3d85a9427dbb7b1ae8e397c8d22ca2c1106da67288f708a792eacfca7edc3be6e614965ad2cfd8a7e42208077f80b68f97e7f477c46fc59ab66f9aa3275d191f37759cfe2b62f62221',
  
'iqmp' => 'd345773c6f10383b038c7b301af066625b979d1b23b04ad51a865804f47efda71e4cd3be3215a1f7de4ebc5e59d9031fbc414dc7884bfb29e953566f9c5fa2ad673b4036809b26fd91541aee519e5289ba46809f1a8f21a6f7d5deeae085baa7fa89f40601c38b8536697af5e4f39b11f5e71162e77c6b2b68d15e20eda537fb',
]
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