Beispiel #1
0
    /**
     * Data re-Encryption with Master Password
     * The Master Password is used as a parameter to Encrypt/Decrypt data
     * Hence every time a new Master Password is set, all data must first be decrypted using old Password before being encrypted using new one
     */
    private void ReEncryptData(string OldPassword)
    {
        Crytography Crypto = new Crytography();

        for (int i = 0; i < NumberOfPasswords(); i++)
        {
            string PasswordData = PlayerPrefs.GetString(i.ToString());
            PasswordData = Crypto.Decrypt(PasswordData, i.ToString(), OldPassword);
            PlayerPrefs.SetString(i.ToString(), Crypto.Encrypt(PasswordData, i.ToString()));
        }
    }
Beispiel #2
0
    /**
     * Get Password and related Information
     */
    public PasswordInfo GetPasswordInfo(string PwID)
    {
        PasswordInfo PwInfo    = new PasswordInfo();
        Crytography  Decryptor = new Crytography();
        string       EncrytedData;
        string       PlainJson;

        EncrytedData = PlayerPrefs.GetString(PwID);
        PlainJson    = Decryptor.Decrypt(EncrytedData, PwID);

        PwInfo = PwInfo.CreateFromJSON(PlainJson);

        return(PwInfo);
    }
Beispiel #3
0
    /**
     * Save Password and related Information
     */
    public void SavePasswordInfo(string PwID, string Title, string User, string PwValue, string ModDate)
    {
        PasswordInfo PwInfo    = new PasswordInfo();
        Crytography  Encryptor = new Crytography();
        string       PasswordJson;
        string       EncryptedData;

        PwInfo.PasswordTitle = Title;
        PwInfo.UserID        = User;
        PwInfo.PasswordValue = PwValue;
        PwInfo.ModifiedDate  = ModDate;

        PasswordJson  = PwInfo.SaveToJson();
        EncryptedData = Encryptor.Encrypt(PasswordJson, PwID);

        PlayerPrefs.SetString(PwID, EncryptedData);
    }