Revert "Implementation of ExtensionEncryption with CryptsetupEngine"
[platform/core/security/ode.git] / rmi / extension-encryption.h
1 /*
2  *  Copyright (c) 2017 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 #ifndef __EXTENSION_ENCRYPTION_H__
18 #define __EXTENSION_ENCRYPTION_H__
19
20 #include <string>
21
22 #include "context.h"
23
24 namespace ode {
25
26 /**
27  * This class provides APIs to manage the encryption of external storage
28  * such as SD card, used as an extension of the internal memory.
29  */
30
31 class ExtensionEncryption final {
32 public:
33         ExtensionEncryption(ODEControlContext& ctxt);
34         ~ExtensionEncryption();
35
36         int mount(const std::string& password);
37         int umount();
38
39         int format(const std::string& password);
40
41         int isPasswordInitialized();
42         int initPassword(const std::string& password);
43         int cleanPassword(const std::string& password);
44         int changePassword(const std::string& oldPW, const std::string& newPW);
45         int verifyPassword(const std::string& password);
46
47         enum State {
48                 Encrypted   = 0x01,
49                 Corrupted   = 0x02,
50         };
51
52         int getState();
53
54 private:
55         ODEControlContext& context;
56 };
57
58 } // namespace ode
59
60 #endif // __EXTENSION_ENCRYPTION_H__