Home > Backend Development > PHP Tutorial > 在openssl签发证书时怎么指定16字节序列号

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

WBOY
Release: 2016-06-13 13:26:54
Original
1515 people have browsed it

在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类型只有一半长度,高半部分被清零。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template