首頁  >  文章  >  後端開發  >  在openssl签发证书时怎么指定16字节序列号

在openssl签发证书时怎么指定16字节序列号

WBOY
WBOY原創
2016-06-13 13:26:541449瀏覽

在openssl签发证书时如何指定16字节序列号?
在使用openssl函数签发证书时遇到了点问题,项目明确要求需要指定16字节证书序列号,形如 0x4C530000000000000100020004000009,其中最后3个字节是动态变化的,在使用 openssl_csr_sign 函数时遇到了麻烦.

resource openssl_csr_sign ( mixed $csr , mixed $cacert , mixed $priv_key , int $days [, array $configargs [, int $serial=0 ]] )

最后一个参数可以指定序列号,但普通的int不能支持这么大的整数,曾经尝试过使用 sprintf('%s', $n),尝试过直接传入文本,要么只写进一个字节,要么为0

请问应该从哪个方向入手找解决办法 ?

能有示例代码更好

谢谢 !

------解决方案--------------------
Description:
------------
The Certificat defintion OpenSSL allows for numerical serial numbers up to 
20 positions or more..
In PHP there is build in integer rerstriction only allowing half the serial
numbers ..... higher numbers have a cleared part......

The serial needs to be numerical no problem but it need not be an integer
or limited by that (allow higher numbers)
------解决方案--------------------
The Certificat defintion OpenSSL allows for numerical serial numbers up to
20 positions or more..
In PHP there is build in integer rerstriction only allowing half the serial
numbers ..... higher numbers have a cleared part......


貌似意思是默认openssl支持20位长度的整数,但php的内置int类型只有一半长度,高半部分被清零。

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn