PageRenderTime 181ms CodeModel.GetById 33ms RepoModel.GetById 1ms app.codeStats 0ms

/wrt-security/vcore/src/vcore/SignatureValidator.h

https://review.tizen.org/git/
C++ Header | 73 lines | 38 code | 11 blank | 24 comment | 0 complexity | e7f7ac578dde151b55172c12e9900c1d MD5 | raw file
Possible License(s): GPL-3.0, AGPL-3.0, GPL-2.0, MPL-2.0, JSON, WTFPL, CC-BY-SA-4.0, CC-BY-3.0, BSD-3-Clause, LGPL-2.0, MPL-2.0-no-copyleft-exception, AGPL-1.0, 0BSD, Zlib, Unlicense, BSD-2-Clause, Apache-2.0, LGPL-3.0, ISC, MIT, CC-BY-SA-3.0, CC0-1.0, LGPL-2.1
  1. /*
  2. * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef _SIGNATUREVALIDATOR_H_
  17. #define _SIGNATUREVALIDATOR_H_
  18. #include <dpl/singleton.h>
  19. #include "Certificate.h"
  20. #include "OCSPCertMgrUtil.h"
  21. #include "SignatureData.h"
  22. #include "ValidatorCommon.h"
  23. #include "VerificationStatus.h"
  24. namespace ValidationCore {
  25. // Todo nocopyable
  26. class SignatureValidator
  27. {
  28. public:
  29. enum Result
  30. {
  31. SIGNATURE_VALID,
  32. SIGNATURE_INVALID,
  33. SIGNATURE_VERIFIED,
  34. SIGNATURE_DISREGARD, // no ocsp response or ocsp return unknown status
  35. SIGNATURE_REVOKED
  36. };
  37. /**
  38. * Validation of the signature.
  39. * If falidation succeed SignatureData will contains:
  40. * list of validated references
  41. * set selfSigned value
  42. * root ca certificate
  43. * end entity certificate
  44. */
  45. Result check(SignatureData &data,
  46. const std::string &widgetContentPath);
  47. static std::string FingerprintToColonHex(
  48. const Certificate::Fingerprint &fingerprint);
  49. explicit SignatureValidator(bool ocspEnable,
  50. bool crlEnable,
  51. bool complianceMode);
  52. virtual ~SignatureValidator();
  53. private:
  54. bool checkRoleURI(const SignatureData &data);
  55. bool checkProfileURI(const SignatureData &data);
  56. bool checkObjectReferences(const SignatureData &data);
  57. bool m_ocspEnable;
  58. bool m_crlEnable;
  59. bool m_complianceModeEnabled;
  60. };
  61. } // namespace ValidationCore
  62. #endif // _SIGNATUREVALIDATOR_H_