summaryrefslogtreecommitdiffstats
path: root/lib/cryptopp/dsa.h
diff options
context:
space:
mode:
authorAlexander Harkness <bearbin@gmail.com>2013-11-24 15:21:13 +0100
committerAlexander Harkness <bearbin@gmail.com>2013-11-24 15:21:13 +0100
commit3438e5d3ddf8444f0e31009ffbe8237ef3752c22 (patch)
tree7c2f76d5e9281c130e60fb932c4dda89a49863b6 /lib/cryptopp/dsa.h
parentMoved source to src (diff)
downloadcuberite-3438e5d3ddf8444f0e31009ffbe8237ef3752c22.tar
cuberite-3438e5d3ddf8444f0e31009ffbe8237ef3752c22.tar.gz
cuberite-3438e5d3ddf8444f0e31009ffbe8237ef3752c22.tar.bz2
cuberite-3438e5d3ddf8444f0e31009ffbe8237ef3752c22.tar.lz
cuberite-3438e5d3ddf8444f0e31009ffbe8237ef3752c22.tar.xz
cuberite-3438e5d3ddf8444f0e31009ffbe8237ef3752c22.tar.zst
cuberite-3438e5d3ddf8444f0e31009ffbe8237ef3752c22.zip
Diffstat (limited to 'lib/cryptopp/dsa.h')
-rw-r--r--lib/cryptopp/dsa.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/cryptopp/dsa.h b/lib/cryptopp/dsa.h
new file mode 100644
index 000000000..6ae03877c
--- /dev/null
+++ b/lib/cryptopp/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