Typedef password type
authorZofia Abramowska <z.abramowska@samsung.com>
Wed, 23 Jul 2014 15:24:04 +0000 (17:24 +0200)
committerBartlomiej Grzelewski <b.grzelewski@samsung.com>
Fri, 12 Sep 2014 12:59:25 +0000 (14:59 +0200)
Change-Id: Ie5430448be3703646b7d04aaed27a8175a95e34f

16 files changed:
src/include/ckm/ckm-control.h
src/include/ckm/ckm-key.h
src/include/ckm/ckm-manager.h
src/include/ckm/ckm-type.h
src/manager/client-capi/ckmc-control.cpp
src/manager/client/client-control.cpp
src/manager/client/client-manager-impl.cpp
src/manager/client/client-manager-impl.h
src/manager/common/generic-key.cpp
src/manager/common/generic-key.h
src/manager/service/ckm-logic.cpp
src/manager/service/ckm-logic.h
src/manager/service/ckm-service.cpp
src/manager/service/crypto-logic.cpp
src/manager/service/crypto-logic.h
src/manager/service/key-provider.h

index dfd9b40..f812e24 100644 (file)
@@ -26,6 +26,7 @@
 #include <memory>
 
 #include <ckm/ckm-error.h>
+#include <ckm/ckm-type.h>
 
 // Central Key Manager namespace
 namespace CKM {
@@ -38,7 +39,7 @@ class Control
 {
 public:
     // decrypt user key with password
-    virtual int unlockUserKey(uid_t user, const std::string &password) const = 0;
+    virtual int unlockUserKey(uid_t user, const Password &password) const = 0;
 
     // remove user key from memory
     virtual int lockUserKey(uid_t user) const = 0;
@@ -47,13 +48,13 @@ public:
     virtual int removeUserData(uid_t user) const = 0;
 
     // change password for user
-    virtual int changeUserPassword(uid_t user, const std::string &oldPassword, const std::string &newPassword) const = 0;
+    virtual int changeUserPassword(uid_t user, const Password &oldPassword, const Password &newPassword) const = 0;
 
     // This is work around for security-server api - resetPassword that may be called without passing oldPassword.
     // This api should not be supported on tizen 3.0
     // User must be already logged in and his DKEK is already loaded into memory in plain text form.
     // The service will use DKEK in plain text and encrypt it in encrypted form (using new password).
-    virtual int resetUserPassword(uid_t user, const std::string &newPassword) const = 0;
+    virtual int resetUserPassword(uid_t user, const Password &newPassword) const = 0;
 
     virtual ~Control(){}
 
index a5bb114..6cadb66 100644 (file)
@@ -39,7 +39,7 @@ public:
 
     static KeyShPtr create(
         const RawBuffer &rawBuffer,
-        const std::string &password = std::string());
+        const Password &password = Password());
 };
 
 } // namespace CKM
index 5c4d6e9..c78d3ea 100644 (file)
@@ -79,12 +79,12 @@ public:
     virtual int removeCertificate(const Alias &alias) = 0;
     virtual int removeData(const Alias &alias) = 0;
 
-    virtual int getKey(const Alias &alias, const std::string &password, KeyShPtr &key) = 0;
+    virtual int getKey(const Alias &alias, const Password &password, KeyShPtr &key) = 0;
     virtual int getCertificate(
         const Alias &alias,
-        const std::string &password,
+        const Password &password,
         CertificateShPtr &certificate) = 0;
-    virtual int getData(const Alias &alias, const std::string &password, RawBuffer &data) = 0;
+    virtual int getData(const Alias &alias, const Password &password, RawBuffer &data) = 0;
 
     // send request for list of all keys/certificates/data that application/user may use
     virtual int getKeyAliasVector(AliasVector &aliasVector) = 0;
@@ -117,7 +117,7 @@ public:
 
     virtual int createSignature(
         const Alias &privateKeyAlias,
-        const std::string &password,           // password for private_key
+        const Password &password,           // password for private_key
         const RawBuffer &message,
         const HashAlgorithm hash,
         const RSAPaddingAlgorithm padding,
@@ -125,7 +125,7 @@ public:
 
     virtual int verifySignature(
         const Alias &publicKeyOrCertAlias,
-        const std::string &password,           // password for public_key (optional)
+        const Password &password,           // password for public_key (optional)
         const RawBuffer &message,
         const RawBuffer &signature,
         const HashAlgorithm hash,
index f034f61..cc241d5 100644 (file)
@@ -32,6 +32,7 @@ namespace CKM {
 typedef std::vector<RawBuffer> RawBufferVector;
 typedef std::string Alias;
 typedef std::vector<Alias> AliasVector;
+typedef std::string Password;
 
 enum class KeyType : int {
     KEY_NONE,
@@ -60,13 +61,13 @@ enum class CertificateFieldId : int {
 };
 
 struct Policy {
-    Policy(const std::string &pass = std::string(), bool extract = true, bool rest = false)
+    Policy(const Password &pass = Password(), bool extract = true, bool rest = false)
       : password(pass)
       , extractable(extract)
       , restricted(rest)
     {}
     virtual ~Policy(){}
-    std::string password;  // byte array used to encrypt data inside CKM
+    Password password;  // byte array used to encrypt data inside CKM
     bool extractable;  // if true key may be extracted from storage
     bool restricted;   // if true only key owner may see data
 };
index 9e5af13..7efbdff 100644 (file)
 #include <ckmc/ckmc-control.h>
 #include <ckmc/ckmc-error.h>
 #include <ckmc-type-converter.h>
+#include <ckm/ckm-type.h>
 
 KEY_MANAGER_CAPI
 int ckmc_unlock_user_key(uid_t user, const char *password)
 {
        auto control = CKM::Control::create();
-       int ret = control->unlockUserKey(user, std::string(password));
+       int ret = control->unlockUserKey(user, CKM::Password(password));
        return to_ckmc_error(ret);
 }
 
@@ -53,7 +54,7 @@ KEY_MANAGER_CAPI
 int ckmc_change_user_password(uid_t user, const char *oldPassword, const char *newPassword)
 {
        auto control = CKM::Control::create();
-       int ret =  control->changeUserPassword(user, std::string(oldPassword), std::string(newPassword));
+       int ret =  control->changeUserPassword(user, CKM::Password(oldPassword), CKM::Password(newPassword));
        return to_ckmc_error(ret);
 }
 
@@ -61,9 +62,7 @@ KEY_MANAGER_CAPI
 int ckmc_reset_user_password(uid_t user, const char *newPassword)
 {
        auto control = CKM::Control::create();
-       int ret =  control->resetUserPassword(user, std::string(newPassword));
+       int ret =  control->resetUserPassword(user, CKM::Password(newPassword));
        return to_ckmc_error(ret);
 }
 
-
-
index e87658e..982a4c1 100644 (file)
@@ -36,7 +36,7 @@ public:
     ControlImpl& operator=(const ControlImpl &) = delete;
     ControlImpl& operator=(ControlImpl &&) = delete;
 
-    virtual int unlockUserKey(uid_t user, const std::string &password) const {
+    virtual int unlockUserKey(uid_t user, const Password &password) const {
         return try_catch([&] {
             MessageBuffer send, recv;
             Serialization::Serialize(send, static_cast<int>(ControlCommand::UNLOCK_USER_KEY));
@@ -118,7 +118,7 @@ public:
         });
     }
 
-    virtual int changeUserPassword(uid_t user, const std::string &oldPassword, const std::string &newPassword) const {
+    virtual int changeUserPassword(uid_t user, const Password &oldPassword, const Password &newPassword) const {
         return try_catch([&] {
             MessageBuffer send, recv;
             Serialization::Serialize(send, static_cast<int>(ControlCommand::CHANGE_USER_PASSWORD));
@@ -147,7 +147,7 @@ public:
         });
     }
 
-    virtual int resetUserPassword(uid_t user, const std::string &newPassword) const {
+    virtual int resetUserPassword(uid_t user, const Password &newPassword) const {
         return try_catch([&] {
             MessageBuffer send, recv;
             Serialization::Serialize(send, static_cast<int>(ControlCommand::RESET_USER_PASSWORD));
@@ -176,7 +176,6 @@ public:
     }
 
     virtual ~ControlImpl(){}
-
 };
 
 ControlShPtr Control::create() {
index ffd08ab..7f74ef9 100644 (file)
@@ -175,7 +175,7 @@ int ManagerImpl::removeData(const Alias &alias) {
 int ManagerImpl::getBinaryData(
     const Alias &alias,
     DBDataType sendDataType,
-    const std::string &password,
+    const Password &password,
     DBDataType &recvDataType,
     RawBuffer &rawData)
 {
@@ -217,7 +217,7 @@ int ManagerImpl::getBinaryData(
     });
 }
 
-int ManagerImpl::getKey(const Alias &alias, const std::string &password, KeyShPtr &key) {
+int ManagerImpl::getKey(const Alias &alias, const Password &password, KeyShPtr &key) {
     DBDataType recvDataType;
     RawBuffer rawData;
 
@@ -243,7 +243,7 @@ int ManagerImpl::getKey(const Alias &alias, const std::string &password, KeyShPt
     return CKM_API_SUCCESS;
 }
 
-int ManagerImpl::getCertificate(const Alias &alias, const std::string &password, CertificateShPtr &cert)
+int ManagerImpl::getCertificate(const Alias &alias, const Password &password, CertificateShPtr &cert)
 {
     DBDataType recvDataType;
     RawBuffer rawData;
@@ -271,7 +271,7 @@ int ManagerImpl::getCertificate(const Alias &alias, const std::string &password,
     return CKM_API_SUCCESS;
 }
 
-int ManagerImpl::getData(const Alias &alias, const std::string &password, RawBuffer &rawData)
+int ManagerImpl::getData(const Alias &alias, const Password &password, RawBuffer &rawData)
 {
     DBDataType recvDataType;
 
@@ -512,7 +512,7 @@ int ManagerImpl::getCertificateChain(
 
 int ManagerImpl::createSignature(
     const Alias &privateKeyAlias,
-    const std::string &password,           // password for private_key
+    const Password &password,           // password for private_key
     const RawBuffer &message,
     const HashAlgorithm hash,
     const RSAPaddingAlgorithm padding,
@@ -560,7 +560,7 @@ int ManagerImpl::createSignature(
 
 int ManagerImpl::verifySignature(
     const Alias &publicKeyOrCertAlias,
-    const std::string &password,           // password for public_key (optional)
+    const Password &password,           // password for public_key (optional)
     const RawBuffer &message,
     const RawBuffer &signature,
     const HashAlgorithm hash,
index 9e8d638..a54ec31 100644 (file)
@@ -35,17 +35,17 @@ public:
 
     int saveKey(const Alias &alias, const KeyShPtr &key, const Policy &policy);
     int removeKey(const Alias &alias);
-    int getKey(const Alias &alias, const std::string &password, KeyShPtr &key);
+    int getKey(const Alias &alias, const Password &password, KeyShPtr &key);
     int getKeyAliasVector(AliasVector &aliasVector);
 
     int saveCertificate(const Alias &alias, const CertificateShPtr &cert, const Policy &policy);
     int removeCertificate(const Alias &alias);
-    int getCertificate(const Alias &alias, const std::string &password, CertificateShPtr &cert);
+    int getCertificate(const Alias &alias, const Password &password, CertificateShPtr &cert);
     int getCertificateAliasVector(AliasVector &aliasVector);
 
     int saveData(const Alias &alias, const RawBuffer &rawData, const Policy &policy);
     int removeData(const Alias &alias);
-    int getData(const Alias &alias, const std::string &password, RawBuffer &cert);
+    int getData(const Alias &alias, const Password &password, RawBuffer &cert);
     int getDataAliasVector(AliasVector &aliasVector);
 
     int createKeyPairRSA(
@@ -74,7 +74,7 @@ public:
 
     int createSignature(
         const Alias &privateKeyAlias,
-        const std::string &password,           // password for private_key
+        const Password &password,           // password for private_key
         const RawBuffer &message,
         const HashAlgorithm hash,
         const RSAPaddingAlgorithm padding,
@@ -82,7 +82,7 @@ public:
 
     int verifySignature(
         const Alias &publicKeyOrCertAlias,
-        const std::string &password,           // password for public_key (optional)
+        const Password &password,           // password for public_key (optional)
         const RawBuffer &message,
         const RawBuffer &signature,
         const HashAlgorithm hash,
@@ -104,7 +104,7 @@ protected:
     int getBinaryData(
         const Alias &alias,
         DBDataType sendDataType,
-        const std::string &password,
+        const Password &password,
         DBDataType &recvDataType,
         RawBuffer &rawData);
 
index b4931c4..b5112fc 100644 (file)
@@ -42,7 +42,7 @@ typedef std::unique_ptr<BIO, std::function<void(BIO*)>> BioUniquePtr;
 
 int passcb(char *buff, int size, int rwflag, void *userdata) {
     (void) rwflag;
-    std::string *ptr = static_cast<std::string*>(userdata);
+    Password *ptr = static_cast<Password*>(userdata);
     if (ptr == NULL)
         return 0;
     if (ptr->empty())
@@ -98,7 +98,7 @@ GenericKey::GenericKey(const GenericKey &second) {
     m_type = second.m_type;
 }
 
-GenericKey::GenericKey(const RawBuffer &buf, const std::string &pass)
+GenericKey::GenericKey(const RawBuffer &buf, const Password &password)
   : m_pkey(NULL, EVP_PKEY_free)
   , m_type(KeyType::KEY_NONE)
 {
@@ -127,7 +127,7 @@ GenericKey::GenericKey(const RawBuffer &buf, const std::string &pass)
     if (!pkey && buf[0] == '-') {
         BIO_reset(bio.get());
         BIO_write(bio.get(), buf.data(), buf.size());
-        pkey = PEM_read_bio_PUBKEY(bio.get(), NULL, passcb, const_cast<std::string*>(&pass));
+        pkey = PEM_read_bio_PUBKEY(bio.get(), NULL, passcb, const_cast<Password*>(&password));
         isPrivate = false;
         LogDebug("PEM_read_bio_PUBKEY Status: " << (void*)pkey);
     }
@@ -135,7 +135,7 @@ GenericKey::GenericKey(const RawBuffer &buf, const std::string &pass)
     if (!pkey && buf[0] == '-') {
         BIO_reset(bio.get());
         BIO_write(bio.get(), buf.data(), buf.size());
-        pkey = PEM_read_bio_PrivateKey(bio.get(), NULL, passcb, const_cast<std::string*>(&pass));
+        pkey = PEM_read_bio_PrivateKey(bio.get(), NULL, passcb, const_cast<Password*>(&password));
         isPrivate = true;
         LogDebug("PEM_read_bio_PrivateKey Status: " << (void*)pkey);
     }
@@ -204,7 +204,7 @@ RawBuffer GenericKey::getDER() const {
     return RawBuffer();
 }
 
-KeyShPtr Key::create(const RawBuffer &raw, const std::string &password) {
+KeyShPtr Key::create(const RawBuffer &raw, const Password &password) {
     KeyShPtr output(new GenericKey(raw, password));
     if (output->empty())
         output.reset();
index 69526c0..ac1918c 100644 (file)
@@ -34,7 +34,7 @@ public:
 
     GenericKey();
     GenericKey(const GenericKey &second);
-    GenericKey(const RawBuffer& buffer, const std::string &pass = std::string());
+    GenericKey(const RawBuffer& buffer, const Password &password = Password());
     GenericKey(EvpShPtr pkey, KeyType type);
 
     virtual KeyType getType() const;
index 0ed8a43..6612e74 100755 (executable)
@@ -50,7 +50,7 @@ CKMLogic::CKMLogic()
 
 CKMLogic::~CKMLogic(){}
 
-RawBuffer CKMLogic::unlockUserKey(uid_t user, const std::string &password) {
+RawBuffer CKMLogic::unlockUserKey(uid_t user, const Password &password) {
     // TODO try catch for all errors that should be supported by error code
     int retCode = CKM_API_SUCCESS;
 
@@ -116,8 +116,8 @@ RawBuffer CKMLogic::removeUserData(uid_t user) {
 
 RawBuffer CKMLogic::changeUserPassword(
     uid_t user,
-    const std::string &oldPassword,
-    const std::string &newPassword)
+    const Password &oldPassword,
+    const Password &newPassword)
 {
     int retCode = CKM_API_SUCCESS;
     try {
@@ -147,7 +147,7 @@ RawBuffer CKMLogic::changeUserPassword(
 
 RawBuffer CKMLogic::resetUserPassword(
     uid_t user,
-    const std::string &newPassword)
+    const Password &newPassword)
 {
     int retCode = CKM_API_SUCCESS;
     // TODO try-catch
@@ -277,7 +277,7 @@ int CKMLogic::getDataHelper(
     Credentials &cred,
     DBDataType dataType,
     const Alias &alias,
-    const std::string &password,
+    const Password &password,
     DBRow &row)
 {
 
@@ -325,7 +325,7 @@ RawBuffer CKMLogic::getData(
     int commandId,
     DBDataType dataType,
     const Alias &alias,
-    const std::string &password)
+    const Password &password)
 {
     int retCode = CKM_API_SUCCESS;
     DBRow row;
@@ -619,7 +619,7 @@ RawBuffer CKMLogic::getCertificateChain(
         }
 
         for (auto &i: aliasVector) {
-            retCode = getDataHelper(cred, DBDataType::CERTIFICATE, i, std::string(), row);
+            retCode = getDataHelper(cred, DBDataType::CERTIFICATE, i, Password(), row);
 
             if (retCode != CKM_API_SUCCESS)
                 goto senderror;
@@ -658,7 +658,7 @@ RawBuffer CKMLogic::createSignature(
         Credentials &cred,
         int commandId,
         const Alias &privateKeyAlias,
-        const std::string &password,           // password for private_key
+        const Password &password,           // password for private_key
         const RawBuffer &message,
         const HashAlgorithm hash,
         const RSAPaddingAlgorithm padding)
@@ -677,7 +677,7 @@ RawBuffer CKMLogic::createSignature(
                 break;
             }
 
-            GenericKey keyParsed(row.data, std::string());
+            GenericKey keyParsed(row.data, Password());
             if (keyParsed.empty())
                 retCode = CKM_API_ERROR_SERVER_ERROR;
             else
@@ -709,7 +709,7 @@ RawBuffer CKMLogic::verifySignature(
         Credentials &cred,
         int commandId,
         const Alias &publicKeyOrCertAlias,
-        const std::string &password,           // password for public_key (optional)
+        const Password &password,           // password for public_key (optional)
         const RawBuffer &message,
         const RawBuffer &signature,
         const HashAlgorithm hash,
index 661a6a7..56a8348 100644 (file)
@@ -50,7 +50,7 @@ public:
     CKMLogic& operator=(CKMLogic &&) = delete;
     virtual ~CKMLogic();
 
-    RawBuffer unlockUserKey(uid_t user, const std::string &password);
+    RawBuffer unlockUserKey(uid_t user, const Password &password);
 
     RawBuffer lockUserKey(uid_t user);
 
@@ -58,12 +58,12 @@ public:
 
     RawBuffer changeUserPassword(
         uid_t user,
-        const std::string &oldPassword,
-        const std::string &newPassword);
+        const Password &oldPassword,
+        const Password &newPassword);
 
     RawBuffer resetUserPassword(
         uid_t user,
-        const std::string &newPassword);
+        const Password &newPassword);
 
     RawBuffer saveData(
         Credentials &cred,
@@ -84,7 +84,7 @@ public:
         int commandId,
         DBDataType dataType,
         const Alias &alias,
-        const std::string &password);
+        const Password &password);
 
     RawBuffer getDataList(
         Credentials &cred,
@@ -125,7 +125,7 @@ public:
         Credentials &cred,
         int commandId,
         const Alias &privateKeyAlias,
-        const std::string &password,           // password for private_key
+        const Password &password,           // password for private_key
         const RawBuffer &message,
         const HashAlgorithm hash,
         const RSAPaddingAlgorithm padding);
@@ -134,7 +134,7 @@ public:
         Credentials &cred,
         int commandId,
         const Alias &publicKeyOrCertAlias,
-        const std::string &password,           // password for public_key (optional)
+        const Password &password,           // password for public_key (optional)
         const RawBuffer &message,
         const RawBuffer &signature,
         const HashAlgorithm hash,
@@ -153,7 +153,7 @@ private:
         Credentials &cred,
         DBDataType dataType,
         const Alias &alias,
-        const std::string &password,
+        const Password &password,
         DBRow &row);
 
     int createKeyPairRSAHelper(
@@ -175,7 +175,7 @@ private:
     int getKeyHelper(
         Credentials &cred,
         const Alias &publicKeyOrCertAlias,
-        const std::string &password,           // password for public_key (optional)
+        const Password &password,           // password for public_key (optional)
         const GenericKey &genericKey);
 
     std::map<uid_t, UserData> m_userDataMap;
index 39f8339..8297cd2 100644 (file)
@@ -107,7 +107,7 @@ RawBuffer CKMService::processControl(MessageBuffer &buffer) {
     int command;
     uid_t user;
     ControlCommand cc;
-    std::string newPass, oldPass;
+    Password newPass, oldPass;
 
     Deserialization::Deserialize(buffer, command);
     Deserialization::Deserialize(buffer, user);
@@ -178,7 +178,7 @@ RawBuffer CKMService::processStorage(Credentials &cred, MessageBuffer &buffer){
         }
         case LogicCommand::GET:
         {
-            std::string password;
+            Password password;
             Deserialization::Deserialize(buffer, tmpDataType);
             Deserialization::Deserialize(buffer, alias);
             Deserialization::Deserialize(buffer, password);
@@ -266,7 +266,7 @@ RawBuffer CKMService::processStorage(Credentials &cred, MessageBuffer &buffer){
         case LogicCommand::CREATE_SIGNATURE:
         {
             Alias privateKeyAlias;
-            std::string password;        // password for private_key
+            Password password;        // password for private_key
             RawBuffer message;
             int padding, hash;
             Deserialization::Deserialize(buffer, privateKeyAlias);
@@ -287,7 +287,7 @@ RawBuffer CKMService::processStorage(Credentials &cred, MessageBuffer &buffer){
         case LogicCommand::VERIFY_SIGNATURE:
         {
             Alias publicKeyOrCertAlias;
-            std::string password;           // password for public_key (optional)
+            Password password;           // password for public_key (optional)
             RawBuffer message;
             RawBuffer signature;
             //HashAlgorithm hash;
index 4b71210..11e8c82 100644 (file)
@@ -130,7 +130,7 @@ RawBuffer CryptoLogic::decryptData(
 }
 
 RawBuffer CryptoLogic::passwordToKey(
-    const std::string &password,
+    const Password &password,
     const RawBuffer &salt,
     size_t keySize) const
 {
@@ -161,7 +161,7 @@ RawBuffer CryptoLogic::generateRandIV() const {
     return civ;
 }
 
-void CryptoLogic::encryptRow(const std::string &password, DBRow &row)
+void CryptoLogic::encryptRow(const Password &password, DBRow &row)
 {
     try {
         DBRow crow = row;
@@ -213,7 +213,7 @@ void CryptoLogic::encryptRow(const std::string &password, DBRow &row)
     }
 }
 
-void CryptoLogic::decryptRow(const std::string &password, DBRow &row)
+void CryptoLogic::decryptRow(const Password &password, DBRow &row)
 {
     try {
         DBRow crow = row;
index 00eed7f..0a98b30 100644 (file)
@@ -48,8 +48,8 @@ public:
 
     virtual ~CryptoLogic(){}
 
-    void decryptRow(const std::string &password, DBRow &row);
-    void encryptRow(const std::string &password, DBRow &row);
+    void decryptRow(const Password &password, DBRow &row);
+    void encryptRow(const Password &password, DBRow &row);
 
     bool haveKey(const std::string &smackLabel);
     void pushKey(const std::string &smackLabel,
@@ -63,7 +63,7 @@ private:
        std::map<std::string, RawBuffer> m_keyMap;
 
     RawBuffer generateRandIV() const;
-    RawBuffer passwordToKey(const std::string &password,
+    RawBuffer passwordToKey(const Password &password,
                             const RawBuffer &salt,
                             size_t keySize) const;
 
index 3c8285c..4132043 100644 (file)
@@ -52,7 +52,7 @@ public:
        // if (keyInWrapForm.size() != sizeof(WrappedKeyMaterial))
        //       throw exception; // buffer does not have proper size to store WrappedKeyMaterial
        // WrappedKeyMaterial *wkm = static_cast<WrappedKeyMaterial>(keyInWrapForm.data());
-       KeyProvider(const RawBuffer &domainKEKInWrapForm, const std::string &password);
+       KeyProvider(const RawBuffer &domainKEKInWrapForm, const Password &password);
 
        KeyProvider(KeyProvider &&);
        KeyProvider(const KeyProvider &) = delete;
@@ -67,7 +67,7 @@ public:
        // Returns Key in form used to store key in file
        // Requied by Control::resetPassword(const RawBuffer &newPassword);
        // This api should be used only on Tizen 2.2.1
-       RawBuffer getWrappedDomainKEK(const std::string &password);
+       RawBuffer getWrappedDomainKEK(const Password &password);
 
        // EncryptedKey key extracted from database. Used to encrypt application data.
        // This key will be used to decrypt/encrypt data in ROW
@@ -81,12 +81,12 @@ public:
        // used by change user password. On error -> exception
        static RawBuffer reencrypt(
                const RawBuffer &domainKEKInWrapForm,
-               const std::string &oldPass,
-               const std::string &newPass);
+               const Password &oldPass,
+               const Password &newPass);
 
        // First run of application for some user. DomainKEK was not created yet. We must create one.
        // This key will be used to encrypt user database.
-       static RawBuffer generateDomainKEK(const std::string &user, const std::string &userPassword);
+       static RawBuffer generateDomainKEK(const std::string &user, const Password &userPassword);
 
        // This will be called by framework at the begin of the program
        static int initializeLibrary();