1<?php
2// $data is assumed to contain the data to be signed
3
4// fetch private key from file and ready it
5$pkeyid = openssl_pkey_get_private("file://sign/key.pem");
6
7// compute signature
8openssl_sign($data, $signature, $pkeyid);
9
10// free the key from memory
11openssl_free_key($pkeyid);
12