Adding subjectAltName to csr using phpseclib

主宰稳场 提交于 2019-12-12 06:08:11

问题


I am using phpseclib to generate private key, public key and CSR and i just want to be able to include subjectAltName to the Public key and CSR in the process but the documentation is no good. I tried using setDomain but all that does is overides the primary commonName value..

I found this from another post but it doesn't seem to have any effect: $x509->setExtension('id-ce-subjectAltName', array('san1.domain.com', 'san2.domain.com'));

-- UPDATE --

I am step closer, I see the extension for subjectAltName in my certificate but its blank field

Any help will be appreciated!

thanks

Here is some php code..

$altnames = array (
"san1.domain.com",
"san2.domain.com"
);

$x509 = new File_X509();
$x509->loadX509($x509->saveX509($x509->sign($issuer, $subject)));
$x509->setExtension('id-ce-keyUsage', array('digitalSignature', 'keyEncipherment'));
$x509->setExtension('id-ce-extKeyUsage', array('id-kp-serverAuth', 'id-kp-clientAuth'));
$x509->setExtension("id-ce-subjectAltName", $altnames);

回答1:


phpseclib doesn't currently support subjAltDomain's for CSR's very well. More info:

https://stackoverflow.com/a/28610388/569976



来源:https://stackoverflow.com/questions/29650036/adding-subjectaltname-to-csr-using-phpseclib

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!