NAME
Dipki::Sig - Signature creation and verification
SignData function
Compute a signature value over binary data.
Synopsis
$s = Dipki::Sig::SignData($data, $prikeyfile, $password, $sigalg [, $sigopts, $sigenc]);
Parameters
- $data
-
Data to be signed.
- $prikeyfile
-
Private key file (or string containing key in PEM format).
- $password
-
Password for private key (use
""
if no password). - $sigalg
-
Signature algorithm.
- $sigopts
-
Options for signature (optional).
- $sigenc
-
Encoding for signature output (optional). Default is base64.
Example
use Dipki;
$s = Dipki::Sig::SignData($data, 'AlicePrivRSASign.p8e', "password", Dipki::Sig::RSA_SHA256);
SignDigest function
Compute a signature value over a message digest value.
Example
use Dipki;
$s = Dipki::Sig::SignDigest(Dipki::Cnv::FromBase64("ZZ8hkDeug1S+bd4IZiPVQLCTtLg13mJ7/E7i8muYFd4="), 'AlicePrivRSASign.p8e', "password", Dipki::Sig::RSA_SHA256);
SignFile function
Compute a signature value over binary data in a file.
Example
use Dipki;
$s = Dipki::Sig::SignFile($fname, 'AlicePrivRSASign.p8e', "password", Dipki::Sig::RSA_SHA256);
VerifyData function
Verify a signature value over data in a byte array.
Syntax
$f = Dipki::Sig::VerifyData($sigval, $data, $certorkeyfile, $sigalg [, $verifyopts]);
Returns
True (1) if the signature is valid, False (0) if invalid.
VerifyDigest function
Verify a signature value over a message digest value of data.
Syntax
$f = Dipki::Sig::VerifyDigest($sigval, $digest, $certorkeyfile, $sigalg [, $verifyopts]);
Returns
True (1) if the signature is valid, False (0) if invalid.
VerifyFile function
Verify a signature value over data in a file.
Syntax
$f = Dipki::Sig::VerifyFile($sigval, $datafile, $certorkeyfile, $sigalg [, $verifyopts]);
Returns
True (1) if the signature is valid, False (0) if invalid.
AUTHOR
David Ireland, https://www.cryptosys.net/contact/
COPYRIGHT AND LICENSE
Copyright (C) 2022 David Ireland, DI Management Services Pty Limited, https://www.di-mgt.com.au https://www.cryptosys.net. The code in this module is licensed under the terms of the MIT license. For a copy, see http://opensource.org/licenses/MIT