• 技术文章 >后端开发 >php教程

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

    2016-06-13 10:28:38原创505
    在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核实处理。
    上一篇:json_encode()函数为何不能解析带中文的JSON字符串呢 下一篇:请问windows下用Navicat能连,用PHP无法连接远程mysql的有关问题!
    千万级数据并发解决方案

    相关文章推荐

    • 用PHP实现自己的sha-256哈希算法!• PHP下传文件最大限制• 用过WordPress,对WordPress插件熟习的前辈请进• php中字符串中某一个字符的轮换• 让php5.1.6支持json_encode()解决方案
    1/1

    PHP中文网