How to specify a 16-byte serial number when OpenSSL issues a certificate

Source: Internet
Author: User
How do I specify a 16-byte serial number when OpenSSL issues a certificate?
There was a point in signing the certificate using the OpenSSL function, the project explicitly requires specifying a 16-byte certificate sequence number, such as 0x4c530000000000000100020004000009, where the last 3 bytes are dynamically changing, using OPENSSL_CSR The _sign function is having trouble.

Resource Openssl_csr_sign (mixed $CSR, mixed $cacert, mixed $priv _key, int $days [, array $configargs [, int $serial =0 ]] )

The last parameter can specify the serial number, but the normal int cannot support such a large integer, tried to use sprintf ('%s ', $n), attempted to pass the text directly, either write it in one byte or 0

Which direction should I start to find a solution?

Can have sample code better

Thank you!

------Solution--------------------
Description:
------------
The Certificat defintion OpenSSL allows for numerical serial numbers
Positions or more.
In PHP there are build in integer rerstriction only allowing half the serial
Numbers. Higher numbers has a cleared part ....

The serial needs to being numerical no problem but it need not being an integer
or limited by (allow higher numbers)
------Solution--------------------
The Certificat defintion OpenSSL allows for numerical serial numbers
Positions or more.
In PHP there are build in integer rerstriction only allowing half the serial
Numbers. Higher numbers has a cleared part ....


It seems to mean that the default OpenSSL supports 20-bit-length integers, but PHP's built-in int type is only half the length and the high half is zeroed.
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.