2015-11-18 20:32:28 +00:00
|
|
|
// dsa.h - written and placed in the public domain by Wei Dai
|
|
|
|
|
2015-11-23 00:17:15 +00:00
|
|
|
//! \file dsa.h
|
2015-11-19 18:09:33 +00:00
|
|
|
//! \brief Classes for the DSA signature algorithm
|
2015-11-18 20:32:28 +00:00
|
|
|
|
2015-11-05 06:59:46 +00:00
|
|
|
#ifndef CRYPTOPP_DSA_H
|
|
|
|
#define CRYPTOPP_DSA_H
|
|
|
|
|
|
|
|
#include "cryptlib.h"
|
2015-11-19 18:09:33 +00:00
|
|
|
#include "gfpcrypt.h"
|
2015-11-05 06:59:46 +00:00
|
|
|
|
|
|
|
NAMESPACE_BEGIN(CryptoPP)
|
|
|
|
|
2015-11-19 18:09:33 +00:00
|
|
|
//! \brief DSA Signature Format
|
|
|
|
//! \details The DSA signature format used by Crypto++ is as defined by IEEE P1363.
|
|
|
|
//! Java nad .Net use the DER format, and OpenPGP uses the OpenPGP format.
|
|
|
|
enum DSASignatureFormat {
|
|
|
|
//! \brief Crypto++ native signature encoding format
|
|
|
|
DSA_P1363,
|
|
|
|
//! \brief signature encoding format used by Java and .Net
|
|
|
|
DSA_DER,
|
|
|
|
//! \brief OpenPGP signature encoding format
|
|
|
|
DSA_OPENPGP
|
|
|
|
};
|
|
|
|
|
|
|
|
//! \brief Converts between signature encoding formats
|
|
|
|
//! \param buffer byte buffer for the converted signature encoding
|
|
|
|
//! \param bufferSize the length of the converted signature encoding buffer
|
|
|
|
//! \param toFormat the source signature format
|
|
|
|
//! \param signature byte buffer for the existing signature encoding
|
|
|
|
//! \param signatureLen the length of the existing signature encoding buffer
|
|
|
|
//! \param fromFormat the source signature format
|
|
|
|
//! \details This function converts between these formats, and returns length
|
|
|
|
//! of signature in the target format. If <tt>toFormat == DSA_P1363</tt>, then
|
|
|
|
//! <tt>bufferSize</tt> must equal <tt>publicKey.SignatureLength()</tt>
|
2016-09-10 08:57:48 +00:00
|
|
|
size_t DSAConvertSignatureFormat(byte *buffer, size_t bufferSize, DSASignatureFormat toFormat,
|
2015-11-05 06:59:46 +00:00
|
|
|
const byte *signature, size_t signatureLen, DSASignatureFormat fromFormat);
|
|
|
|
|
|
|
|
NAMESPACE_END
|
|
|
|
|
|
|
|
#endif
|