The php Function Openssl_Sign
The php function openssl_sign allows you to sign data with a private key using the public key from a certificate. The signed data can then be verified with the openssl_verify() function to ensure that the signature is valid for the given data.
A function is a block of code that can be called repeatedly within a program to perform a specific task. Functions execute the same each time they are called and cannot be changed after the call is made. A function can accept several arguments, which are usually passed by value. The argument values are placed after the function name in the parentheses, separated by commas. The information contained in the arguments is passed to the function by value and can only be modified inside the function.
pkey_new() creates a new private/public key pair based on the configuration parameters. The return is a resource identifier for the newly created key.
crypt() returns a hashed string using the DES, Blowfish, or MD5 algorithms. The salt parameter is optional, but it helps prevent the same string from being rehashed over and over again, which can compromise security. The crypt() function will throw an error if you use a salt that is not strong enough.