codesigner.hpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2021 HPCC Systems®.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #ifndef CODESIGN_HPP
  14. #define CODESIGN_HPP
  15. #include "jlib.hpp"
  16. #include "errorlist.h"
  17. #define CODESIGNER_ERR_GPG CODESIGNER_ERROR_START
  18. #define CODESIGNER_ERR_BADUSERID CODESIGNER_ERROR_START+1
  19. #define CODESIGNER_ERR_KEYNOTFOUND CODESIGNER_ERROR_START+2
  20. #define CODESIGNER_ERR_SIGN CODESIGNER_ERROR_START+3
  21. #define CODESIGNER_ERR_VERIFY CODESIGNER_ERROR_START+4
  22. #define CODESIGNER_ERR_LISTKEYS CODESIGNER_ERROR_START+5
  23. interface ICodeSigner
  24. {
  25. virtual void sign(const char * text, const char * userId, const char * passphrase, StringBuffer & signedText) = 0;
  26. virtual bool verifySignature(const char *text, StringBuffer &signer) = 0;
  27. virtual bool hasSignature(const char *text) const = 0;
  28. virtual StringBuffer &stripSignature(const char *text, StringBuffer &unsignedText) const = 0;
  29. virtual StringArray &getUserIds(StringArray &userIds) = 0;
  30. };
  31. extern jlib_decl ICodeSigner &queryCodeSigner();
  32. #endif