Crypto++ 8.7
Free C++ class library of cryptographic schemes
dsa.h
Go to the documentation of this file.
1// dsa.h - originally written and placed in the public domain by Wei Dai
2
3/// \file dsa.h
4/// \brief Classes for the DSA signature algorithm
5
6#ifndef CRYPTOPP_DSA_H
7#define CRYPTOPP_DSA_H
8
9#include "cryptlib.h"
10#include "gfpcrypt.h"
11
12NAMESPACE_BEGIN(CryptoPP)
13
14/// \brief DSA Signature Format
15/// \details The DSA signature format used by Crypto++ is as defined by IEEE P1363.
16/// OpenSSL, Java and .Net use the DER format, and OpenPGP uses the OpenPGP format.
17/// \sa <A HREF="http://www.cryptopp.com/wiki/DSAConvertSignatureFormat">DSAConvertSignatureFormat</A>
18/// on the Crypto++ wiki.
19/// \since Crypto++ 1.0
21 /// \brief Crypto++ native signature encoding format
23 /// \brief signature encoding format used by OpenSSL, Java and .Net
25 /// \brief OpenPGP signature encoding format
27};
28
29/// \brief Converts between signature encoding formats
30/// \param buffer byte buffer for the converted signature encoding
31/// \param bufferSize the length of the converted signature encoding buffer
32/// \param toFormat the source signature format
33/// \param signature byte buffer for the existing signature encoding
34/// \param signatureLen the length of the existing signature encoding buffer
35/// \param fromFormat the source signature format
36/// \return the number of bytes written during encoding
37/// \details This function converts between these formats, and returns length
38/// of signature in the target format. If <tt>toFormat == DSA_P1363</tt>, then
39/// <tt>bufferSize</tt> must equal <tt>publicKey.SignatureLength()</tt> or
40/// <tt>verifier.SignatureLength()</tt>.
41/// \details If the destination buffer is too small then the output of the
42/// encoded <tt>r</tt> and <tt>s</tt> will be truncated. Be sure to provide
43/// an adequately sized buffer and check the return value for the number of
44/// bytes written.
45/// \sa <A HREF="http://www.cryptopp.com/wiki/DSAConvertSignatureFormat">DSAConvertSignatureFormat</A>
46/// on the Crypto++ wiki.
47/// \since Crypto++ 1.0
48size_t DSAConvertSignatureFormat(byte *buffer, size_t bufferSize, DSASignatureFormat toFormat,
49 const byte *signature, size_t signatureLen, DSASignatureFormat fromFormat);
50
51NAMESPACE_END
52
53#endif // CRYPTOPP_DSA_H
Abstract base classes that provide a uniform interface to this library.
size_t DSAConvertSignatureFormat(byte *buffer, size_t bufferSize, DSASignatureFormat toFormat, const byte *signature, size_t signatureLen, DSASignatureFormat fromFormat)
Converts between signature encoding formats.
DSASignatureFormat
DSA Signature Format.
Definition: dsa.h:20
@ DSA_OPENPGP
OpenPGP signature encoding format.
Definition: dsa.h:26
@ DSA_P1363
Crypto++ native signature encoding format.
Definition: dsa.h:22
@ DSA_DER
signature encoding format used by OpenSSL, Java and .Net
Definition: dsa.h:24
Classes and functions for schemes based on Discrete Logs (DL) over GF(p)
Crypto++ library namespace.