Tag:sign

  • Is “encrypt first, then sign” safe? After reading this article, you will understand it in seconds!

    Time:2022-11-23

    Abstract: There is a rule mentioned in many security specifications and security articles: first encrypt and then sign is not safe, you should sign first and then encrypt. What is the rationale behind this rule? Is it necessarily insecure to encrypt first and then sign? This article answers them one by one for you. Sign […]

  • php national secret SM3 signature algorithm

    Time:2022-11-16

    php national secret SM3 signature algorithm code address https://github.com/lizhichao/sm Install composer require lizhichao/one-sm use require __DIR__ . ‘/vendor/autoload.php’; // string signature echo \OneSm\Sm3::sign(‘abc’) . PHP_EOL; echo \OneSm\Sm3::sign(str_repeat(“adfas hahaha”, 100)) . PHP_EOL; // file signature echo \OneSm\Sm3::signFile(__FILE__) . PHP_EOL; Performance Testing andopenssl , SM3-PHPPerformance Testing php bench.php result openssl:c4cae8d8730206d130e1eef9de3e00225da0b556cfcb8d0076561352ff19f769 one-sm3:c4cae8d8730206d130e1eef9de3e00225da0b556cfcb8d0076561352ff19f769 SM3-PHP:c4cae8d8730206d130e1eef9de3e00225da0b556cfcb8d0076561352ff19f769 openssl time:4.8391819000244ms one-sm3 time:5.7239532470703ms SM3-PHP […]

  • Alipay applet horizontal screen electronic version signature, canvas implementation

    Time:2022-11-12

    Background description: The business needs to sign in the horizontal screen of the Alipay applet, but currently Alipay does not support the horizontal screen, so the user can only be guided by the styleRealize the effect: Ideas:Use transform and translate to rotate the page, so that it can meet the needs of the style, it […]

  • PHP implements RSA encryption, decryption and signature verification functions

    Time:2022-11-11

    One: Generate RSA private key and public key 1: RSA private key generation $resource = openssl_pkey_new(); openssl_pkey_export($resource, $privateKey); echo($privateKey); 2: RSA public key generation $resource = openssl_pkey_new(); $detail = openssl_pkey_get_details($resource); $publicKey = $detail[‘key’]; echo($publicKey); Notice:If the following prompt appears when generating the private key and public key:You need to add the openssl.cnf file address in […]