Refactor cert-svc/APIs in vcore
[platform/core/security/cert-svc.git] / vcore / src / vcore / WrtSignatureValidator.h
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 /*
17  * @file        WrtSignatureValidator.h
18  * @author      Bartlomiej Grzelewski (b.grzelewski@samsung.com)
19  * @version     1.0
20  * @brief       Implementatin of tizen signature validation protocol.
21  */
22 #ifndef _VALIDATION_CORE_TIZENSIGNATUREVALIDATOR_H_
23 #define _VALIDATION_CORE_TIZENSIGNATUREVALIDATOR_H_
24
25 #include <string>
26
27 #include <vcore/SignatureData.h>
28
29 namespace ValidationCore {
30
31 class WrtSignatureValidator {
32 public:
33
34     class Impl;
35
36     enum AppType
37     {
38         TIZEN,
39         WAC20
40     };
41
42     enum Result
43     {
44         SIGNATURE_VALID,
45         SIGNATURE_INVALID,
46         SIGNATURE_VERIFIED,
47         SIGNATURE_DISREGARD,    // no ocsp response or ocsp return unknown status
48         SIGNATURE_REVOKED,
49                 SIGNATURE_INVALID_CERT_CHAIN, //5, from here, new error enum            
50                 SIGNATURE_INVALID_DISTRIBUTOR_CERT,
51                 SIGNATURE_INVALID_SDK_DEFAULT_AUTHOR_CERT,
52                 SIGNATURE_IN_DISTRIBUTOR_CASE_AUTHOR_CERT,
53                 SIGNATURE_INVALID_CERT_TIME,    
54                 SIGNATURE_NO_DEVICE_PROFILE,
55                 SIGNATURE_INVALID_DEVICE_UNIQUE_ID,
56                 SIGNATURE_INVALID_NO_HASH_FILE,
57                 SIGNATURE_INVALID_HASH_SIGNATURE
58     };
59
60     WrtSignatureValidator() = delete;
61     WrtSignatureValidator(const WrtSignatureValidator &) = delete;
62     const WrtSignatureValidator &operator=(const WrtSignatureValidator &) = delete;
63
64     explicit WrtSignatureValidator(
65         AppType appType,
66         bool ocspEnable,
67         bool crlEnable,
68         bool complianceMode);
69
70     virtual ~WrtSignatureValidator();
71
72     Result check(
73         SignatureData &data,
74         const std::string &widgetContentPath);
75
76 private:
77     Impl *m_impl;
78
79 };
80
81 } // namespace ValidationCore
82
83 #endif // _VALIDATION_CORE_TIZENSIGNATUREVALIDATOR_H_
84