Crypto++
dsa.h
Go to the documentation of this file.
1 #ifndef CRYPTOPP_DSA_H
2 #define CRYPTOPP_DSA_H
3 
4 /** \file
5 */
6 
7 #include "gfpcrypt.h"
8 
9 NAMESPACE_BEGIN(CryptoPP)
10 
11 /*! The DSA signature format used by Crypto++ is as defined by IEEE P1363.
12  Java uses the DER format, and OpenPGP uses the OpenPGP format. */
13 enum DSASignatureFormat {DSA_P1363, DSA_DER, DSA_OPENPGP};
14 /** This function converts between these formats, and returns length of signature in the target format.
15  If toFormat == DSA_P1363, bufferSize must equal publicKey.SignatureLength() */
16 size_t DSAConvertSignatureFormat(byte *buffer, size_t bufferSize, DSASignatureFormat toFormat,
17  const byte *signature, size_t signatureLen, DSASignatureFormat fromFormat);
18 
19 #ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
20 
21 typedef DSA::Signer DSAPrivateKey;
22 typedef DSA::Verifier DSAPublicKey;
23 
24 const int MIN_DSA_PRIME_LENGTH = DSA::MIN_PRIME_LENGTH;
25 const int MAX_DSA_PRIME_LENGTH = DSA::MAX_PRIME_LENGTH;
26 const int DSA_PRIME_LENGTH_MULTIPLE = DSA::PRIME_LENGTH_MULTIPLE;
27 
28 inline bool GenerateDSAPrimes(const byte *seed, size_t seedLength, int &counter, Integer &p, unsigned int primeLength, Integer &q)
29  {return DSA::GeneratePrimes(seed, seedLength, counter, p, primeLength, q);}
30 
31 #endif
32 
33 NAMESPACE_END
34 
35 #endif
size_t DSAConvertSignatureFormat(byte *buffer, size_t bufferSize, DSASignatureFormat toFormat, const byte *signature, size_t signatureLen, DSASignatureFormat fromFormat)
This function converts between these formats, and returns length of signature in the target format...
static bool GeneratePrimes(const byte *seed, unsigned int seedLength, int &counter, Integer &p, unsigned int primeLength, Integer &q, bool useInputCounterValue=false)
Generate DSA primes according to NIST standard.
DSASignatureFormat
Definition: dsa.h:13
multiple precision integer and basic arithmetics
Definition: integer.h:26
Implementation of schemes based on DL over GF(p)
A template implementing constructors for public key algorithm classes.
Definition: pubkey.h:1488