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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtg2voT+QZFD7+GKJs3YZ
Pm3r+LcI14hx8dccvCP+15RdEtAmxHVC7Yny+mobQdIuZeo+rzhFg9XjmvHmTXiD
czuMyyyKhw5+52guNWIG1EWbl5pjEUw8z6XL6jiNwqo/jlIrql0XTk1W+aYHTTbj
CPuyjMYN1kGekvY7w7iWzVXtu20Hg/zE+b0uhNVkLvJ07Fvw8WXtKMlGFgxaWFx7
d26XgLifEUUbR/DJtC4pw/Xr0ECsozCC+evpBd61SxDoUZfda+azR5njZshwjNYz
PwWRf39YYx1jMpLt4Q2t93Unovi0OWIovSXmUOdRMl0jS/erMN8qN9GTtUhSSumU
zwIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => ' ?dPbv>m׈q#ה]&uBjA.e>8EMxs;,~h.5bEcL<ϥ8ª?R+]NMVM6 A;øUm.d.t[e(F ZX\\{wnEGɴ.)@0޵KQkGfp3?Xcc2 u\'9b(%PQ2]#K0*7ѓHRJ',
    
'e' => '' "\0" '',
    
'd' => 'y Y[ bOOvri-GhAa0fO@ s*vf0Ŗ!h[/yd' "\0" 'U8b{ -а\'˿    U;:ˍACf7~S_@:;Z[C:A<d~s' "\0" 'ZW2eE4o' "\0" '9"?PIxttP    dv#S/I#0H~EfQtgUt[_9<)`A',
    
'p' => 'Jl3\\
xjyS E 8` ơ21$/2AB0v}ǩy: -Wg:BM@u{t 1u=67HgN:/Xr'
,
    
'q' => 'ZJi^8ୣfM5 y@\\ jv/Y1G\\3V;<5u_ܸ̒nHI*8vC"FKрP5+qtO$90',
    
'dmp1' => 'eHS;/DV9fPOL.ƮZ%zYƋgp۸U~![nIWգ' "\0" 'pڴIS33X.k0rpwYn./.eZlHˣJ_77C2cǴg',
    
'dmq1' => 'GCGSCoS,{Bpνr#t\'&b8ocHFXNl|    dZ
Xx J_tV2    ]C @zE3P()JdWTk@A'
,
    
'iqmp' => 'TX\\F`g9j    #aP+jrz7    lW ԰ޕ>fVŴxCB' "\0" 'v7s9;=rɍEg͢tCNQ?$"^h$M',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'b60dafa13f906450fbf86289b376193e6debf8b708d78871f1d71cbc23fed7945d12d026c47542ed89f2fa6a1b41d22e65ea3eaf384583d5e39af1e64d7883733b8ccb2c8a870e7ee7682e356206d4459b979a63114c3ccfa5cbea388dc2aa3f8e522baa5d174e4d56f9a6074d36e308fbb28cc60dd6419e92f63bc3b896cd55edbb6d0783fcc4f9bd2e84d5642ef274ec5bf0f165ed28c946160c5a585c7b776e9780b89f11451b47f0c9b42e29c3f5ebd040aca33082f9ebe905deb54b10e85197dd6be6b34799e366c8708cd6333f05917f7f58631d633292ede10dadf77527a2f8b4396228bd25e650e751325d234bf7ab30df2a37d193b548524ae994cf',
  
'e' => '010001',
  
'd' => '792059fe5b2062de4f074fe87672d910e469e02d47c0bf93b0688341da6130661216f64f14df400c73802a84766630c59621685b84811bda2f796400eb0287d31f87e9965504ceec3862e47bb820fb12e516d52d9cd0b09527a6a8cbbfe6090808553ba03a17cb8d41951096431585b0f06637ab7e81535f82403a3b5a915b43f39c3a8a41073c647e73d7005a131557eb32fd65e7ad45beb0adcbcc178234a61bb8fb6fcafe90caf20015f03922fc04c53f504912eea4c578f1e074e9e2748d12a5e8e750096411762315e48df253bbbb2fb81e8fcacbce0f49d0233093f4481311ebd77e894519abf8bbf789665174e2d5e46755745b5f393c1d2960e2c841',
  
'p' => 'f24a6c335c0f0a92ef788f986a79e0effa88ee538d06e201b120118845870cba3896e76020c6a18c32c08803aff0913124852f32c841fbe142308aa0c6767de39fe49cf1c7a979da3ace0c2d576781e0a63a424ddf40a88f13e775c20293157b74b10b8731de75d0f8f73d363748db0fe6c867cb1b4e3ac4f82ff7587290ae07',
  
'q' => 'c05aba4a9cbace695ebf1bb438a5e0ada3acf6664d14821fc61c35850cc2e717db79fe40927f5ca6cf0c176a901976ebc12fd759c1ce311ed447118c12ffe35c33569c1ad13b3cb1b835d7ffd575a25fab9ecc92dcb8fde06e481683f9491e2a388ec8764322d446b34bb2d18050ba3517dbd42b71749b4f9aa1dbe0243930f9',
  
'dmp1' => '658148533bfe112ffda3448556163966504f8d88f34c2ee30691a8c6ae5a25bade7a59f4abc68b6770dbb81fd355b57e210eaaf75b6e4957d5a30070dab449895333338d1758a8f4042ece6b3072ecb670ed7759a86e2e2fc2e6f52e92658c5a6c48bfcba3d8cf02fd4a971a5f8ee6378337f243e4eca13263c7b49819670381',
  
'dmq1' => '1d47b243d947b653e3d0436f53902c7b4206fa1ae870cebdf77223d374f5d62793892662bdea15386f1bf014908acfc76348dd0714b14658e3074e6c7c17e78c09648daea75ad50a587819c11fc5204a5fdd745686b2c2327f9709965d43fc0b81407ad345b4ef8b338fba5099afb02894d129a2d34a64b9e157f218546b4041',
  
'iqmp' => '54585c889cd64660679d39f8046aadb90fe7d41c09f5fb230861502b8f6a727a370994f0d66c0fc4570ce3fee4c4d4b01803cbde953e9d66d9e1035690c5b4788e1743fb96a242d90076e2e73716fc73ef39863be53d8d72c98df1c2fae445079e8d8f67cda2b87443c7e1c74e51949bf2da173f8513ece924225e6824bde34d',
]
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