Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.5 KiB

  1. // dsa.h - written and placed in the public domain by Wei Dai
  2. //! \file dsa.h
  3. //! \brief Classes for the DSA signature algorithm
  4. #ifndef CRYPTOPP_DSA_H
  5. #define CRYPTOPP_DSA_H
  6. #include "cryptlib.h"
  7. #include "gfpcrypt.h"
  8. NAMESPACE_BEGIN(CryptoPP)
  9. //! \brief DSA Signature Format
  10. //! \details The DSA signature format used by Crypto++ is as defined by IEEE P1363.
  11. //! Java nad .Net use the DER format, and OpenPGP uses the OpenPGP format.
  12. enum DSASignatureFormat {
  13. //! \brief Crypto++ native signature encoding format
  14. DSA_P1363,
  15. //! \brief signature encoding format used by Java and .Net
  16. DSA_DER,
  17. //! \brief OpenPGP signature encoding format
  18. DSA_OPENPGP
  19. };
  20. //! \brief Converts between signature encoding formats
  21. //! \param buffer byte buffer for the converted signature encoding
  22. //! \param bufferSize the length of the converted signature encoding buffer
  23. //! \param toFormat the source signature format
  24. //! \param signature byte buffer for the existing signature encoding
  25. //! \param signatureLen the length of the existing signature encoding buffer
  26. //! \param fromFormat the source signature format
  27. //! \details This function converts between these formats, and returns length
  28. //! of signature in the target format. If <tt>toFormat == DSA_P1363</tt>, then
  29. //! <tt>bufferSize</tt> must equal <tt>publicKey.SignatureLength()</tt>
  30. size_t DSAConvertSignatureFormat(byte *buffer, size_t bufferSize, DSASignatureFormat toFormat,
  31. const byte *signature, size_t signatureLen, DSASignatureFormat fromFormat);
  32. NAMESPACE_END
  33. #endif