summaryrefslogtreecommitdiffstats
path: root/cryptopp562/dsa.h
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2016-04-13 21:05:14 -0400
committerMalf Furious <m@lfurio.us>2016-04-13 21:05:14 -0400
commit490d36e65ac24e34e3021c2a0947384aee138c88 (patch)
tree418a229fa60708d7796bc61f90794626aefed9d5 /cryptopp562/dsa.h
downloadcompass-490d36e65ac24e34e3021c2a0947384aee138c88.tar.gz
compass-490d36e65ac24e34e3021c2a0947384aee138c88.zip
Root commit for new Compass repository
This is the Alpha version of ComPASS, originally developed sometime in 2014.
Diffstat (limited to 'cryptopp562/dsa.h')
-rw-r--r--cryptopp562/dsa.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/cryptopp562/dsa.h b/cryptopp562/dsa.h
new file mode 100644
index 0000000..6ae0387
--- /dev/null
+++ b/cryptopp562/dsa.h
@@ -0,0 +1,35 @@
+#ifndef CRYPTOPP_DSA_H
+#define CRYPTOPP_DSA_H
+
+/** \file
+*/
+
+#include "gfpcrypt.h"
+
+NAMESPACE_BEGIN(CryptoPP)
+
+/*! The DSA signature format used by Crypto++ is as defined by IEEE P1363.
+ Java uses the DER format, and OpenPGP uses the OpenPGP format. */
+enum DSASignatureFormat {DSA_P1363, DSA_DER, DSA_OPENPGP};
+/** This function converts between these formats, and returns length of signature in the target format.
+ If toFormat == DSA_P1363, bufferSize must equal publicKey.SignatureLength() */
+size_t DSAConvertSignatureFormat(byte *buffer, size_t bufferSize, DSASignatureFormat toFormat,
+ const byte *signature, size_t signatureLen, DSASignatureFormat fromFormat);
+
+#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
+
+typedef DSA::Signer DSAPrivateKey;
+typedef DSA::Verifier DSAPublicKey;
+
+const int MIN_DSA_PRIME_LENGTH = DSA::MIN_PRIME_LENGTH;
+const int MAX_DSA_PRIME_LENGTH = DSA::MAX_PRIME_LENGTH;
+const int DSA_PRIME_LENGTH_MULTIPLE = DSA::PRIME_LENGTH_MULTIPLE;
+
+inline bool GenerateDSAPrimes(const byte *seed, size_t seedLength, int &counter, Integer &p, unsigned int primeLength, Integer &q)
+ {return DSA::GeneratePrimes(seed, seedLength, counter, p, primeLength, q);}
+
+#endif
+
+NAMESPACE_END
+
+#endif