Crypto++ 8.4 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
12 NAMESPACE_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
20 enum DSASignatureFormat {
21 /// \brief Crypto++ native signature encoding format
22 DSA_P1363,
23 /// \brief signature encoding format used by OpenSSL, Java and .Net
24 DSA_DER,
25 /// \brief OpenPGP signature encoding format
26 DSA_OPENPGP
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
48 size_t DSAConvertSignatureFormat(byte *buffer, size_t bufferSize, DSASignatureFormat toFormat,
49 const byte *signature, size_t signatureLen, DSASignatureFormat fromFormat);
50
51 NAMESPACE_END
52
53 #endif // CRYPTOPP_DSA_H
DSA_OPENPGP
@ DSA_OPENPGP
OpenPGP signature encoding format.
Definition: dsa.h:26
gfpcrypt.h
Classes and functions for schemes based on Discrete Logs (DL) over GF(p)
DSASignatureFormat
DSASignatureFormat
DSA Signature Format.
Definition: dsa.h:20
DSA_P1363
@ DSA_P1363
Crypto++ native signature encoding format.
Definition: dsa.h:22
CryptoPP
Crypto++ library namespace.
DSA_DER
@ DSA_DER
signature encoding format used by OpenSSL, Java and .Net
Definition: dsa.h:24
cryptlib.h
Abstract base classes that provide a uniform interface to this library.
DSAConvertSignatureFormat
size_t DSAConvertSignatureFormat(byte *buffer, size_t bufferSize, DSASignatureFormat toFormat, const byte *signature, size_t signatureLen, DSASignatureFormat fromFormat)
Converts between signature encoding formats.