You are on page 1of 5

PHP Functions Used for PAN Verifications

Tempnam : Create file with unique file name


Create a temporary file with a unique name in the specified directory:
Ex. tempnam(sys_get_temp_dir(), 'pan');

sys_get_temp_dir: Returns the path of the temporary directory


Returns the path of the directory PHP stores temporary files in by default.

file_put_contents() : file_put_contents(filename, data, mode, context)
The file_put_contents() writes data to a file

file_get_contents() : The file_get_contents() reads a file into a string


file_get_contents(path, include_path, context, start, max_length)

openssl_pkcs12_read():Parse a PKCS#12 Certificate Store into an array


Description
openssl_pkcs12_read ( string $pkcs12 , array &$certs , string $pass ) : bool
openssl_pkcs12_read() parses the PKCS#12 certificate store supplied by pkcs12
into a array named certs.
Parameters
pkcs12
The certificate store contents, not its file name.
certs
On success, this will hold the Certificate Store Data.
pass
Encryption password for unlocking the PKCS#12 file.
Return Values
Returns true on success or false on failure.
In cryptography, PKCS #12 defines an archive file format for storing many
cryptography objects as a single file. It is commonly used to bundle a private
key with its X.509 certificate or to bundle all the members of a chain of trust
An X. 509 certificate is a digital certificate that uses the widely accepted
international X. 509 public key infrastructure (PKI) standard to verify that a
public key belongs to the user, computer or service identity contained within
the certificate.
openssl_x509_read() : Parse an X.509 certificate and return a resource identifier
for it
openssl_x509_read() parses the certificate supplied by x509certdata and returns a
resource identifier for it.
openssl_pkey_get_private() : Get a private key
openssl_pkey_get_private() parses key and prepares it for use by other functions.

openssl_pkcs7_sign() : Sign an S/MIME message


openssl_pkcs7_sign ( string $infilename , string $outfilename , mixed $signcert , mixed $pri
vkey , array $headers [, int $flags = PKCS7_DETACHED [, string $extracerts ]] ) : bool
openssl_pkcs7_sign() takes the contents of the file named infilename and signs
them using the certificate and its matching private key specified
by signcert and privkey parameters.
Parameters ¶
infilename
The input file you are intending to digitally sign.

outfilename
The file which the digital signature will be written to.

signcert
The X.509 certificate used to digitally sign infilename. See
Key/Certificate parameters for a list of valid values.

privkey
privkey is the private key corresponding to signcert. See
Public/Private Key parameters for a list of valid values.

headers
headers is an array of headers that will be prepended to the data after
it has been signed (see openssl_pkcs7_encrypt() for more information
about the format of this parameter).

flags
flags can be used to alter the output - see PKCS7 constants.

extracerts
extracerts specifies the name of a file containing a bunch of extra
certificates to include in the signature which can for example be used
to help the recipient to verify the certificate that you used.

Return Values
Returns true on success or false on failure.

Unlink() : Deletes filename. Similar to the Unix C unlink() function.


An E_WARNING level error will be generated on failure.
unlink ( string $filename [, resource $context ] ) : bool
explode() : The explode() function breaks a string into an array.
explode(separator,string,limit)

separato Required. Specifies where to break the string


r

string Required. The string to split

limit Optional. Specifies the number of array elements to return.

Possible values:
 Greater than 0 - Returns an array with a maximum
of limit element(s)
 Less than 0 - Returns an array except for the last -limit elements()
 0 - Returns an array with one element

cURL :

Requirements ¶

In order to use PHP's cURL functions you need to install the » libcurl package.


PHP requires libcurl version 7.10.5 or later.

curl_init — Initialize a cURL session

Initializes a new session and return a cURL handle for use with
the curl_setopt(), curl_exec(), and curl_close() functions.

This can be useful for testing your own web forms, connecting to APIs that require
POST data and so on.
I would also add a timeout so that it doesn't hang indefinitely if the server is not
responding:
curl_setopt($ch, CURLOPT_TIMEOUT, 5);

http_build_query() : Generate URL-encoded query string


http_build_query ( mixed $query_data [, string $numeric_prefix [, string $arg_separator [, in
t $enc_type = PHP_QUERY_RFC1738 ]]] ) : string
Generates a URL-encoded query string from the associative (or indexed) array
provided.
json_encode()— Returns the JSON representation of a value

Description ¶
json_encode ( mixed $value , int $flags = 0 , int $depth =
512 ) : string|false

Returns a string containing the JSON representation of the supplied value.

You might also like