CryptoSys PQC
1.0.0
|
Digital Signature Algorithm (DSA) methods. More...
Classes | |
struct | KeyPair |
Structure to receive a key pair (pk, sk) More... | |
Public Types | |
enum class | Alg |
DSA signature (DSA) algorithm. More... | |
enum | SigOpts : unsigned int |
Signature options. More... | |
enum class | PreHashAlg |
Hash function identifiers for pre-hash signing. More... | |
Static Public Member Functions | |
static KeyPair | KeyGen (Alg alg, const std::string ¶ms="") |
Generate a DSA signing key pair (pk, sk). More... | |
static bvec_t | Sign (Alg alg, const bvec_t &msg, const bvec_t &privatekey, SigOpts opts=SigOpts::Default, const bvec_t &context=bvec_t(), const std::string ¶ms="") |
Generate a DSA signature over a message. More... | |
static bvec_t | SignPreHash (Alg alg, const bvec_t &msg, PreHashAlg hashAlg, const bvec_t &privatekey, SigOpts opts=SigOpts::Default, const bvec_t &context=bvec_t(), const std::string ¶ms="") |
Generate a DSA signature over a pre-hashed message. More... | |
static bool | Verify (Alg alg, const bvec_t &signature, const bvec_t &msg, const bvec_t &publickey, const bvec_t &context=bvec_t(), SigOpts opts=SigOpts::Default) |
Verify a DSA signature over a message. More... | |
static bool | VerifyPreHash (Alg alg, const bvec_t &signature, const bvec_t &msg, PreHashAlg hashAlg, const bvec_t &publickey, const bvec_t &context=bvec_t()) |
Verify a DSA signature over a pre-hashed message. More... | |
static bvec_t | PublicKeyFromPrivate (Alg alg, const bvec_t &privatekey) |
Extract the public key from a private key. More... | |
static int | PublicKeySize (Alg alg) |
Return length of public key pk in bytes. | |
static int | PrivateKeySize (Alg alg) |
Return length of (expanded) private key sk in bytes. | |
static int | SignatureSize (Alg alg) |
Return length of signature in bytes. | |
static std::string | AlgName (Alg alg) |
Get algorithm name from its alg code. | |
Digital Signature Algorithm (DSA) methods.
|
strong |
DSA signature (DSA) algorithm.
enum crsyspqc::Dsa::SigOpts : unsigned int |
Signature options.
|
strong |
Hash function identifiers for pre-hash signing.
Generate a DSA signing key pair (pk, sk).
alg | DSA algorithm. |
params | Optional parameters string. Use to pass a known test random value encoded in hex (default = add fresh randomness). For SLH-DSA pass a 3*n value SK.seed||SK.prf||PK.seed (48/72/96 bytes). For ML-DSA pass a 32-byte value seed (denoted ξ in FIPS.204). |
|
static |
Generate a DSA signature over a message.
alg | DSA algorithm. |
msg | Message to be signed. |
privatekey | Private key sk . |
opts | Signature options. |
context | Optional context string (maximum 255 bytes). |
params | Optional parameters string. Use to pass a known test random value encoded in hexadecimal [default = add fresh randomness if in hedged mode]. |
ExternalMu-ML-DSA.Sign
option (ML-DSA only), pass the value of mu
instead of the message in the parameter msg
. This must be exactly 64 bytes long. Caller is responsible for computing the value of mu
independently prior to input. sk
may be passed in expanded form (2560|4032|4896 bytes) or as a 32-byte seed. The key form is detected automatically by its length.
|
static |
Generate a DSA signature over a pre-hashed message.
alg | DSA algorithm. |
msg | Hash digest of message to be signed PH_M = PH(M) . |
hashAlg | Pre-hash function used to create digest. |
privatekey | Private key sk . |
opts | Signature options. |
context | Optional context string (maximum 255 bytes). |
params | Optional parameters string. Use to pass a known test random value encoded in hexadecimal [default = add fresh randomness if in hedged mode]. |
hashAlg
parameter.
|
static |
Verify a DSA signature over a message.
alg | DSA algorithm. |
signature | Signature value. |
msg | Message to be verified. |
publickey | Public key pk . |
context | Same context string as used when signing (maximum 255 bytes). |
opts | Verify options. |
true
if signature verifies.
|
static |
Verify a DSA signature over a pre-hashed message.
alg | DSA algorithm. |
signature | Signature value. |
msg | Hash digest of message to be verified PH_M = PH(M) . |
hashAlg | Pre-hash function used to create digest. |
publickey | Public key pk . |
context | Same context string as used when signing (maximum 255 bytes). |
true
if signature verifies.