1 | // dsa.h - 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 | //! Java nad .Net use the DER format, and OpenPGP uses the OpenPGP format. |
---|
17 | enum DSASignatureFormat { |
---|
18 | //! \brief Crypto++ native signature encoding format |
---|
19 | DSA_P1363, |
---|
20 | //! \brief signature encoding format used by Java and .Net |
---|
21 | DSA_DER, |
---|
22 | //! \brief OpenPGP signature encoding format |
---|
23 | DSA_OPENPGP |
---|
24 | }; |
---|
25 | |
---|
26 | //! \brief Converts between signature encoding formats |
---|
27 | //! \param buffer byte buffer for the converted signature encoding |
---|
28 | //! \param bufferSize the length of the converted signature encoding buffer |
---|
29 | //! \param toFormat the source signature format |
---|
30 | //! \param signature byte buffer for the existing signature encoding |
---|
31 | //! \param signatureLen the length of the existing signature encoding buffer |
---|
32 | //! \param fromFormat the source signature format |
---|
33 | //! \details This function converts between these formats, and returns length |
---|
34 | //! of signature in the target format. If <tt>toFormat == DSA_P1363</tt>, then |
---|
35 | //! <tt>bufferSize</tt> must equal <tt>publicKey.SignatureLength()</tt> |
---|
36 | size_t DSAConvertSignatureFormat(byte *buffer, size_t bufferSize, DSASignatureFormat toFormat, |
---|
37 | const byte *signature, size_t signatureLen, DSASignatureFormat fromFormat); |
---|
38 | |
---|
39 | NAMESPACE_END |
---|
40 | |
---|
41 | #endif |
---|