Implemented client-server model and changed code for thread safety
[platform/framework/native/appfw.git] / src / security / cert / FSecCert_CertPrivateKeyInfo.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 /**
19  * @file        FSecCert_CertPrivateKeyInfo.h
20  * @brief       This header file contains the declarations of Certificate Private Key operations.
21  *
22  * This header file contains the declarations of Certificate Private Key operations.
23  */
24
25 #ifndef _FSEC_CERT_INTERNAL_CERT_PRIVATE_KEY_INFO_H_
26 #define _FSEC_CERT_INTERNAL_CERT_PRIVATE_KEY_INFO_H_
27
28 #include "unique_ptr.h"
29 #include "FSecCert_CertTypes.h"
30
31 namespace Tizen { namespace Security { namespace Cert
32 {
33
34
35 class _CertPrivateKeyInfo
36 {
37 public:
38         _CertPrivateKeyInfo(void);
39
40         _CertPrivateKeyInfo(char* pFileName);
41
42         _CertPrivateKeyInfo(byte* pBuf, int bufSize);
43
44         virtual ~_CertPrivateKeyInfo(void);
45
46         void GetPrivateKeyN(int& keyLen, byte** ppPrivKey);
47
48         result GetEncDecPrivateKeyN(int& keyLen, byte** ppPrivKey, int encDecBit);
49
50         result GetPkcs8EncDecKeyN(int& keyLen, byte** ppPrivKey, int encDecBit);
51
52         result SetPrivateKey(int keyLen, byte* pPrivKey);
53
54         result SetPrivateKey(char* pFileName);
55
56 private:
57         _CertPrivateKeyInfo(const _CertPrivateKeyInfo& rhs);
58
59         _CertPrivateKeyInfo& operator =(const _CertPrivateKeyInfo& rhs);
60
61 private:
62         int __privateKeyLen;
63         std::unique_ptr< byte[] > __pPrivateKey;
64
65 }; //_CertPrivateKeyInfo
66
67 } } } //Tizen::Security::Cert
68
69 #endif // _FSEC_CERT_INTERNAL_CERT_PRIVATE_KEY_INFO_H_