00001 // dsa.h - written and placed in the public domain by Wei Dai 00002 00003 //! \file dsa.h 00004 //! \brief Classes for the DSA signature algorithm 00005 00006 #ifndef CRYPTOPP_DSA_H 00007 #define CRYPTOPP_DSA_H 00008 00009 #include "cryptlib.h" 00010 #include "gfpcrypt.h" 00011 00012 NAMESPACE_BEGIN(CryptoPP) 00013 00014 //! \brief DSA Signature Format 00015 //! \details The DSA signature format used by Crypto++ is as defined by IEEE P1363. 00016 //! Java nad .Net use the DER format, and OpenPGP uses the OpenPGP format. 00017 enum DSASignatureFormat { 00018 //! \brief Crypto++ native signature encoding format 00019 DSA_P1363, 00020 //! \brief signature encoding format used by Java and .Net 00021 DSA_DER, 00022 //! \brief OpenPGP signature encoding format 00023 DSA_OPENPGP 00024 }; 00025 00026 //! \brief Converts between signature encoding formats 00027 //! \param buffer byte buffer for the converted signature encoding 00028 //! \param bufferSize the length of the converted signature encoding buffer 00029 //! \param toFormat the source signature format 00030 //! \param signature byte buffer for the existing signature encoding 00031 //! \param signatureLen the length of the existing signature encoding buffer 00032 //! \param fromFormat the source signature format 00033 //! \details This function converts between these formats, and returns length 00034 //! of signature in the target format. If <tt>toFormat == DSA_P1363</tt>, then 00035 //! <tt>bufferSize</tt> must equal <tt>publicKey.SignatureLength()</tt> 00036 size_t DSAConvertSignatureFormat(byte *buffer, size_t bufferSize, DSASignatureFormat toFormat, 00037 const byte *signature, size_t signatureLen, DSASignatureFormat fromFormat); 00038 00039 NAMESPACE_END 00040 00041 #endif