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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyChHLl/KM9Jcp5f9asv8
C43DUpDroosmVlqM/NImZuMSz/v3S8y9mCY60vPvMAx5mUOlXLneBsUKBHMnSvaK
14IRDq3vnbVGpvxgG8LtzLB0orbhIBUNlzVtrO6ZlOvFLXuuTK3BOOJ+86Sz1YXh
ZqoVplPqzOOv+a+QaYmAHPslmseFZo+PLHd7F9d3Wy0ncVhKKPYHk/cMcDnzyusA
/guBzI6b5tQNSaY78NJ2Cz4Yzds76Y3ZYVloVAWwrO2m+F7nVfPXHcvZ7Mu47moA
RIfaJswCsfAcbmodFHNQo9VxbF56eZH9n3oaFcfgUGBu9kPPOg1YvpaVrp3M+gif
zwIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => '(G._3\\j R뢋&VZ&fK̽&:0 yC\\
s\'JׂF`̰t  5m-{L8~ՅfSi%Džf,w{w[-\'qXJ( p9' 
"\0" ' ̎ I;v >;aYhT^U˸j' "\0" 'D&njsPql^zyzP`nC: X',
    
'e' => '' "\0" '',
    
'd' => '̓LsS
_i6,1|]wŀ[RTp-߻_ğ>3) ~Lȹ3Y_"{ck>BV*0p#)k^k9Ȝ1}>R;ܣj9]=}ao<ӜoEMh#*:' 
"\0" '@TyV 6c֬/ҙC+
,9 @"GRx dKfDJi]/:qX\\ͨoTn0Q0ϋZB'
,
    
'p' => '<*odú9J.`db76TPfhySb_sDrW|8h%:{4CP6FCҮT;C*Q> x1QA.!C`3JoTx',
    
'q' => 'kNK l]f?ěJ8^?D]{30C/5g\'eX(*    fo#nr \\xׄZ9#|8 E }`dGJCI
Dؑe2½ϱ'
,
    
'dmp1' => 'MU)b̞լ) 2sjcNm*n:0QZ){ߝ:<k7?G!%    E %(2to' "\0" '27U1MA    6;[6ޗ[',
    
'dmq1' => 'qP"T([៉ts1(O:8.tkg{=0[$H.L\\X9ȴ&3MHzꨱro4)Hdlق\\,)>|0&^ul,o',
    
'iqmp' => 'r5+V!ӠWk.w<{FpE^OxkHn T;v0|{^=x!:X$oկ}.A=:s{#>,W@0! <',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'c828472e5fca33d25ca797fd6acbfc0b8dc35290eba28b26565a8cfcd22666e312cffbf74bccbd98263ad2f3ef300c799943a55cb9de06c50a0473274af68ad782110eadef9db546a6fc601bc2edccb074a2b6e120150d97356dacee9994ebc52d7bae4cadc138e27ef3a4b3d585e166aa15a653eacce3aff9af906989801cfb259ac785668f8f2c777b17d7775b2d2771584a28f60793f70c7039f3caeb00fe0b81cc8e9be6d40d49a63bf0d2760b3e18cddb3be98dd96159685405b0aceda6f85ee755f3d71dcbd9eccbb8ee6a004487da26cc02b1f01c6e6a1d147350a3d5716c5e7a7991fd9f7a1a15c7e050606ef643cf3a0d58be9695ae9dccfa089fcf',
  
'e' => '010001',
  
'd' => 'c3cc93054c73530a5fd51a9bae9369362c317c5d840477b6c316c580b45b189edd52541b702d12f2f9c2e585f6dfbbf45ff78a9610c49f3eb533f129e8ed10990d057ea4ac184cb296bb9f90c8b93359125ff2227beddc63a4c26b3ee54286f9562afd30c970912310296b5ef86b853996fca2bec89c31c77dab3ecbded45283a93bb21fdca36a395dd53dc77d616f9c3cfd0ed39c6fc7454d68239c2a3a8fca00d0fdff9f1b4054d7cbd879e25620ee3663d6ac1b2fd299d043d7ff2babd30ab07ff12c39b8aa0ca9402204f38c47de52bf78a40b644b6603d944f34a1f695d2f983ae2715881af5ccda86fbc54bb106e30ac513006cf8b825ab58bd042bb91',
  
'p' => 'e43c2ac86f64c3ba3986c77f4a2e6064d262cdd237e3edd91836fb83d554f90250666879855362e9fc5f739d4472d312b6b257877c38b0ff93be8468d91a253a7bc4fea434e64383b150ca36b4b64643c3fed2aeda075497fc8a3b432a51ef3e0b80b49278f9315141e3102e218405804385609f33b7aab84a6f8154b778b98d',
  
'q' => 'e081b2d26bebe01a874e4bf70cfe9e876c9dc3e4a75d66183fc49bb94a38c05e3f4492a9f2aa8a5dbca67b1fc8d2cd333043d32f3567b1d9e1d9270eed65589d282af4fc09e1666f88a4238ab76edaf3b2728f205c78d7845a1c39231fca7c38ce0c450d8b7d876064f7474a4349e6df0a44def6ddd8916532cec2bdeccfb1cb',
  
'dmp1' => 'a28fb44d55022962bfcc9ed5ac298220edb4d03295fa7393b86a99149a634e84f66d2aa6bb6edc3a1ab685eb933051e4b75a297be7df9d3a3caa6b371ec33f96fb4721b425b5888b0945a8f1f41f0bc70297c2ca25a328fea43274e96f0032ee375531c84dfff7bf8fb541f6098b363bd85beca918360e93faf896de975b9695',
  
'dmq1' => '9871d95022b20f01548128f9ff5be19f897473310f284f8c05b8e618e23a38fd862e74fc6b67bbfebc7bbb3d30eb5b24f81006159748eb2e4cba5c583980c8b426334d18db48af7aeaa8b1ed9e72eabff19af26f01fb983429cfe248646ce4fed982e15cba2c29c19dad7f3e0104ec7ce50730f3265ec91393756c2cf4e16f13',
  
'iqmp' => '7299b2d5352bb356d8e321aff4d3a0576b2e77b33cd47bc34670fb455e1d1f924ff1786bd4198f486e20ff54853bc57611307cb19aece27b9986dcfcce14045e3dcbfdf71178213a068fbe58246f85bddcc4d5af027de0b02e4110133dea881f893a7311fb7b96233e84112cc257991af040a68e8ef49c307ff9e921d70c3cf6',
]
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