3898b4fc38b2c8307b9d05b19f34a78fcd492f98
[platform/framework/native/installer.git] / src / Manager / SignatureManager.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 /**
18  * @file SignatureManager.h
19  * @brief       This is the header file for the %SignatureManager class.
20  *
21  * This header file contains the declarations of the %SignatureManager class.
22  */
23 #ifndef _SIGNATURE_MANAGER_H_
24 #define _SIGNATURE_MANAGER_H_
25
26 #include <FSecCertX509CertificatePath.h>
27
28 #include "InstallationContext.h"
29 #include "SignatureHandler.h"
30
31 /**
32  * @class               SignatureManager
33  * @brief               This class represents the class of SignatureManager.
34  * @since               1.0
35  *
36  * This class represents the class of SignatureManager.
37  *
38  */
39
40 class SignatureManager
41 {
42 public:
43         SignatureManager(void);
44         virtual ~SignatureManager(void);
45
46         bool Construct(InstallationContext *pConext);
47         bool ValidateSignatures();
48         bool RegisterCertInfo() const;
49         bool UnregisterCertInfo() const;
50         int GetApiVisibility(RootCertificateType certType);
51
52         bool SetSignature();
53         bool AddCert();
54         bool VerifyChain();
55
56 private:
57         SignatureManager(const SignatureManager& value);
58         SignatureManager& operator =(const SignatureManager& source);
59
60         bool SetAuthorCertValue(void* pHandle, Tizen::Base::Collection::IListT<Tizen::Base::String *>* pCertList) const;
61         bool SetDistributorCertValue(void* pHandle, Tizen::Base::Collection::IListT<Tizen::Base::String *>* pCertList) const;
62
63         bool SetCertificatePath(SignatureFileType type, Tizen::Security::Cert::X509CertificatePath* pCertPath);
64         bool GetCertValue(Tizen::Security::Cert::ICertificate* pCert, Tizen::Base::String& value) const;
65
66         bool Validate(Tizen::Security::Cert::X509CertificatePath* pCertPath);
67         bool AddCertificate(Tizen::Security::Cert::X509CertificatePath* pCertPath, Tizen::Base::Collection::IList* pCertChain);
68         bool AddDistributorRootCert(Tizen::Security::Cert::X509CertificatePath* pCertPath);
69         bool AddAuthorRootCert(Tizen::Security::Cert::X509CertificatePath* pCertPath);
70
71 private:
72         InstallationContext* __pContext;
73         SignatureHandler* __pAuthorSignature;
74         SignatureHandler* __pDistributorSignature;
75         Tizen::Security::Cert::X509CertificatePath* __pAuthorCertPath;
76         Tizen::Security::Cert::X509CertificatePath* __pDistributorCertPath;
77
78
79 }; // SignatureManager
80
81 #endif // _SIGNATURE_MANAGER_H_