CryptoSys PKI
23.0.0
|
Create and verify digital signatures. More...
Public Types | |
enum class | Alg |
Signature algorithm. More... | |
enum class | Encoding |
Encoding for signature output. More... | |
enum | SigOptions : unsigned int |
Specialist options for signatures [BitFlags]. More... | |
enum class | VerifyOpts |
Specialist options for verifying a signature. More... | |
Static Public Member Functions | |
static std::string | AlgName (Sig::Alg alg) |
Get the algorithm name. More... | |
static std::string | GetHashNameFromSigAlg (Sig::Alg sigAlg) |
Get the hash algorithm used in the signature algorithm. More... | |
static std::string | SignData (const bvec_t &data, const std::string &keyFileOrString, const std::string &password="", Alg alg=Alg::Default, Encoding encoding=Encoding::Base64, SigOptions opts=SigOptions::None) |
Compute a signature value over data in a byte array. More... | |
static std::string | SignDigest (const bvec_t &digest, const std::string &keyFileOrString, const std::string &password="", Alg alg=Alg::Default, Encoding encoding=Encoding::Base64, SigOptions opts=SigOptions::None) |
Compute a signature value over a message digest value. More... | |
static std::string | SignFile (const std::string &dataFile, const std::string &keyFileOrString, const std::string &password="", Alg alg=Alg::Default, Encoding encoding=Encoding::Base64, SigOptions opts=SigOptions::None) |
Compute a signature value over binary data in a file. More... | |
static bool | VerifyData (const std::string &sigStr, const bvec_t &data, const std::string &certOrKey, Alg alg=Alg::Default, VerifyOpts opts=VerifyOpts::Default) |
Verify a signature value over data in a byte array. More... | |
static bool | VerifyDigest (const std::string &sigStr, const bvec_t &digest, const std::string &certOrKey, Alg alg=Alg::Default, VerifyOpts opts=VerifyOpts::Default) |
Verify a signature value over a message digest value of data. More... | |
static bool | VerifyFile (const std::string &sigStr, const std::string &dataFile, const std::string &certOrKey, Alg alg=Alg::Default, VerifyOpts opts=VerifyOpts::Default) |
Verify a signature value over data in a file. More... | |
Create and verify digital signatures.
|
strong |
Signature algorithm.
|
strong |
enum dipki::Sig::SigOptions : unsigned int |
Specialist options for signatures [BitFlags].
|
strong |
|
static |
Get the algorithm name.
alg | Signature algorithm |
"rsa-256"
.
|
static |
Get the hash algorithm used in the signature algorithm.
sigAlg | Signature algorithm |
sigAlg
as a string e.g. "sha256"
.
|
static |
Compute a signature value over data in a byte array.
data | Input data to be signed. |
keyFileOrString | Name of private key file (or a string containing the key in PEM format, or an internal private key). |
password | Password for the private key (if encrypted). |
alg | Signature algorithm to be used. |
encoding | Encoding for output [default=base64]. |
opts | Specialist options for RSA-PSS and ECDSA signatures. |
<SignatureValue>
of an XML-DSIG document.
|
static |
Compute a signature value over a message digest value.
digest | Digest value. |
keyFileOrString | Name of private key file (or a string containing the key in PEM format, or an internal private key). |
password | Password for the private key (if encrypted). |
alg | Signature algorithm to be used. |
encoding | Encoding for output [default=base64]. |
opts | Specialist options for RSA-PSS and ECDSA signatures. |
Ed25519
.
|
static |
Compute a signature value over binary data in a file.
dataFile | Name of input file containing data to be signed. |
keyFileOrString | Name of private key file (or a string containing the key in PEM format, or an internal private key). |
password | Password for the private key (if encrypted). |
alg | Signature algorithm to be used. |
encoding | Encoding for output [default=base64]. |
opts | Specialist options for RSA-PSS and ECDSA signatures. |
Ed25519
.
|
static |
Verify a signature value over data in a byte array.
sigStr | Encoded signature value. |
data | Input data to be verified. |
certOrKey | The X.509 certificate or public key file name (or a string containing the certificate or key in PEM format or base64 representation, or an internal key string). |
alg | Signature algorithm used to create signature. |
opts | Specialist options for RSA-PSS only |
true
if the signature is valid, false
if invalid. certOrKey
and the digest value of the data matches the original digest of the data in the signature. Any supported encodings of the signature value are detected automatically. std::runtime_error | Exception with error code if parameters or formats are bad, or if file is missing. |
|
static |
Verify a signature value over a message digest value of data.
sigStr | Encoded signature value. |
digest | Digest value of the data to be verified. |
certOrKey | The X.509 certificate or public key file name (or a string containing the certificate or key in PEM format or base64 representation, or an internal key string). |
alg | Signature algorithm used to create signature. |
opts | Specialist options for RSA-PSS only |
true
if the signature is valid, false
if invalid. std::runtime_error | Exception with error code if parameters or formats are bad, or if file is missing. |
|
static |
Verify a signature value over data in a file.
sigStr | Encoded signature value. |
dataFile | Name of file containing data to be verified. |
certOrKey | The X.509 certificate or public key file name (or a string containing the certificate or key in PEM format or base64 representation, or an internal key string). |
alg | Signature algorithm used to create signature. |
opts | Specialist options for RSA-PSS only |
true
if the signature is valid, false
if invalid. std::runtime_error | Exception with error code if parameters or formats are bad, or if file is missing. |