File: dsa.h

package info (click to toggle)
pycryptopp 0.6.0.20120313-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 7,148 kB
  • ctags: 9,015
  • sloc: cpp: 29,875; asm: 3,519; python: 1,779; ansic: 1,517; makefile: 65
file content (35 lines) | stat: -rw-r--r-- 1,211 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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