- context.registerParametricMethod(this, "", (int)(InternalEncryption::mount)(std::string));
- context.registerNonparametricMethod(this, "", (int)(InternalEncryption::umount));
- context.registerParametricMethod(this, "", (int)(InternalEncryption::encrypt)(std::string, unsigned int));
- context.registerParametricMethod(this, "", (int)(InternalEncryption::decrypt)(std::string));
- context.registerNonparametricMethod(this, "", (int)(InternalEncryption::isPasswordInitialized));
- context.registerParametricMethod(this, "", (int)(InternalEncryption::initPassword)(std::string));
- context.registerParametricMethod(this, "", (int)(InternalEncryption::cleanPassword)(std::string));
- context.registerParametricMethod(this, "", (int)(InternalEncryption::changePassword)(std::string, std::string));
- context.registerParametricMethod(this, "", (int)(InternalEncryption::verifyPassword)(std::string));
- context.registerNonparametricMethod(this, "", (int)(InternalEncryption::getState));
- context.registerNonparametricMethod(this, "", (unsigned int)(InternalEncryption::getSupportedOptions));
+ context.expose(this, PRIVILEGE_PLATFORM, (int)(InternalEncryption::setMountPassword)(std::string));
+ context.expose(this, PRIVILEGE_PLATFORM, (int)(InternalEncryption::mount)());
+ context.expose(this, PRIVILEGE_PLATFORM, (int)(InternalEncryption::umount)());
+ context.expose(this, PRIVILEGE_PLATFORM, (int)(InternalEncryption::encrypt)(std::string, unsigned int));
+ context.expose(this, PRIVILEGE_PLATFORM, (int)(InternalEncryption::decrypt)(std::string));
+ context.expose(this, "", (int)(InternalEncryption::isPasswordInitialized)());
+ context.expose(this, PRIVILEGE_PLATFORM, (int)(InternalEncryption::initPassword)(std::string));
+ context.expose(this, PRIVILEGE_PLATFORM, (int)(InternalEncryption::cleanPassword)(std::string));
+ context.expose(this, PRIVILEGE_PLATFORM, (int)(InternalEncryption::changePassword)(std::string, std::string));
+ context.expose(this, PRIVILEGE_PLATFORM, (int)(InternalEncryption::verifyPassword)(std::string));
+ context.expose(this, "", (int)(InternalEncryption::getState)());
+ context.expose(this, "", (unsigned int)(InternalEncryption::getSupportedOptions)());
+
+ context.createNotification("InternalEncryption::mount");
+
+ std::string source = INTERNAL_DEV_PATH "/" INTERNAL_DEV_NAME;
+ try {
+ runtime::DirectoryIterator iter(INTERNAL_DEV_PATH), end;
+
+ while (iter != end) {
+ const std::string& path = (*iter).getPath();
+ std::string name = path.substr(path.rfind('/') + 1);
+ std::string upper;
+ upper.reserve(name.size());
+ for (char c : name) {
+ upper += std::toupper(c);
+ }
+ if (upper == INTERNAL_DEV_NAME) {
+ source = path;
+ break;
+ }
+ ++iter;
+ }
+ } catch (runtime::Exception &e) {}
+
+ engine.reset(new INTERNAL_ENGINE(
+ source, INTERNAL_PATH,
+ ProgressBar([](int v) {
+ ::vconf_set_str(VCONFKEY_ODE_ENCRYPT_PROGRESS,
+ std::to_string(v).c_str());
+ })
+ ));