Exemple #1
0
            public static async Task Save(string type)
            {
                FileSavePicker fs  = new FileSavePicker();
                string         ext = Bifid_Cipher.Decrypt(Encoding.ASCII.GetString(((List <byte>)GetData.Extract[Data.Misc.DataExtension]).ToArray()));

                fs.FileTypeChoices.Add(Validate.IsType(ext), new List <string>()
                {
                    ext
                });
                fs.SuggestedFileName = Bifid_Cipher.Decrypt(Encoding.ASCII.GetString(((List <byte>)GetData.Extract[Data.Misc.DataNameFile]).ToArray()));
                StorageFile sf = await fs.PickSaveFileAsync();

                if (sf != null)
                {
                    switch (type)
                    {
                    case "File":
                        await FileIO.WriteBytesAsync(sf, ((List <byte>)GetData.Extract[Data.Misc.DataSecret]).ToArray());

                        break;

                    case "Message":
                        await FileIO.WriteTextAsync(sf, await Bifid_Cipher.Execute("Extract", Encoding.ASCII.GetString(((List <byte>)GetData.Extract[Data.Misc.DataSecret]).ToArray()), String.Empty));

                        break;
                    }
                    ToastDialog.ShowData(sf, Validate.IsType(ext), "Embedded File", Detail.Extract_FileMessage);
                    await PopupDialog.Show(Status.Success, Detail.Extract_FileMessage, Complete.Saved_SecretFile, Icon.Smile);
                }
                else
                {
                    await PopupDialog.Show(Status.Err, Detail.Extract_FileMessage, Err.NotSaved_SecretFile, Icon.Sad);
                }
            }
Exemple #2
0
        private async Task <string> Decrypt(List <byte> list_value)
        {
            string result = String.Empty;
            string x      = Encoding.ASCII.GetString(list_value.ToArray());

            result = await Bifid_Cipher.Execute("Decrypt", x, String.Empty);

            return(result);
        }
Exemple #3
0
        private async Task <string> Decrypt()
        {
            string result = String.Empty;
            string x      = Encoding.ASCII.GetString(((List <byte>)GetData.Extract[Data.Misc.DataSecret]).ToArray());

            result = await Bifid_Cipher.Execute("Decrypt", x, "Message");

            return(result);
        }
Exemple #4
0
            public static bool Password(string passwd)
            {
                string x = Encoding.ASCII.GetString(((List <byte>)GetData.Extract[Data.Misc.DataPassword]).ToArray());

                if (Bifid_Cipher.Decrypt(x) == passwd)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
Exemple #5
0
            public static async void Starting(string type)
            {
                bool a = GetData.Embed.ContainsKey(Data.Misc.DataPixel);
                bool b = GetData.Embed.ContainsKey(Data.Misc.DataSecret);
                bool c = GetData.Embed.ContainsKey(Data.Misc.DataPassword);
                bool d = GetData.Embed.ContainsKey(Data.Misc.DataType);
                bool e = GetData.Embed.ContainsKey(Data.Misc.DataNameFile);
                bool f = GetData.Embed.ContainsKey(Data.Misc.DataExtension);

                switch (type)
                {
                case "File":
                    if ((a == true) && (b == true) && (c == true) && (d == true) && (e == true) && (f == true))
                    {
                        Execute(type);
                        break;
                    }
                    else
                    {
                        break;
                    }

                case "Message":
                    if ((d == false) && (e == false) && (f == false))
                    {
                        GetData.Embed.Add(Data.Misc.DataNameFile, Conversion.ToBinary("0", "String"));
                        GetData.Embed.Add(Data.Misc.DataExtension, Conversion.ToBinary(await Bifid_Cipher.Execute("Embed", ".txt", String.Empty), "String"));
                        GetData.Embed.Add(Data.Misc.DataType, Conversion.ToBinary("1", "String"));
                        Execute(type);
                        break;
                    }
                    else
                    {
                        Execute(type);
                        break;
                    }
                }
            }
Exemple #6
0
            public static async Task <bool> GetPicker(StorageFile file, string type)
            {
                IDictionary <string, object> prop = await file.Properties.RetrievePropertiesAsync(Data.Prop_File_Picker.All);

                StorageItemThumbnail thumbnail = await file.GetThumbnailAsync(ThumbnailMode.PicturesView);

                BitmapImage bitmap = new BitmapImage();

                switch (type)
                {
                case "Image":
                    if (prop[Data.Prop_File_Picker.BitDepth].ToString() == "32")
                    {
                        bitmap.SetSource(thumbnail);

                        Reset_Picker("Image");

                        GetData.Picker.Add(Data.Misc.Icon, bitmap);
                        GetData.Picker.Add(Data.Misc.Name, file.Name);
                        GetData.Picker.Add(Data.Misc.Path, file.Path.Replace("\\" + file.Name, String.Empty));
                        GetData.Picker.Add(Data.Misc.Size, prop[Data.Prop_File_Picker.Size]);
                        GetData.Picker.Add(Data.Misc.Dimensions, prop[Data.Prop_File_Picker.Dimensions]);
                        GetData.Picker.Add(Data.Misc.BitDepth, prop[Data.Prop_File_Picker.BitDepth]);
                        return(true);
                    }
                    else
                    {
                        await PopupDialog.Show(Status.Err, Detail.Image_Cover, Err.Invalid_32bitDepth, Icon.Sad);

                        return(false);
                    }

                case "Stego":
                    bitmap.SetSource(thumbnail);

                    Reset_Picker("Image");

                    GetData.Picker.Add(Data.Misc.Icon, bitmap);
                    GetData.Picker.Add(Data.Misc.Name, file.Name);
                    GetData.Picker.Add(Data.Misc.Path, file.Path.Replace("\\" + file.Name, String.Empty));
                    GetData.Picker.Add(Data.Misc.Size, prop[Data.Prop_File_Picker.Size]);
                    GetData.Picker.Add(Data.Misc.Dimensions, prop[Data.Prop_File_Picker.Dimensions]);
                    return(true);

                default:
                    if (GetData.Embed.ContainsKey(Data.Misc.DataPixel) == false)
                    {
                        switch (type)
                        {
                        case "File":
                            await PopupDialog.Show(Status.Err, Detail.Insert_File, Err.Null_Size, Icon.Sad);

                            return(false);

                        case "Message":
                            await PopupDialog.Show(Status.Err, Detail.Insert_Message, Err.Null_Size, Icon.Sad);

                            return(false);

                        default:
                            return(false);
                        }
                    }
                    else
                    {
                        byte[] cover = (byte[])GetData.Embed[Data.Misc.DataPixel];

                        if (int.Parse(prop[Data.Prop_File_Picker.Size].ToString()) < cover.Length / 8)
                        {
                            if (int.Parse(prop[Data.Prop_File_Picker.Size].ToString()) < 150000)
                            {
                                switch (type)
                                {
                                case "File":
                                    if (await PopupDialog.ShowConfirm(Status.Confirm, Detail.Insert_File, Confirm.isLargeFile, Icon.Flat) == false)
                                    {
                                        return(false);
                                    }
                                    break;

                                case "Message":
                                    if (await PopupDialog.ShowConfirm(Status.Confirm, Detail.Insert_Message, Confirm.isLargeFile, Icon.Flat) == false)
                                    {
                                        return(false);
                                    }
                                    break;
                                }

                                bitmap.SetSource(thumbnail);

                                Reset_Picker("File");

                                GetData.Picker.Add(Data.Misc.Icon, bitmap);
                                GetData.Picker.Add(Data.Misc.Name, file.Name);
                                GetData.Picker.Add(Data.Misc.Path, file.Path.Replace("\\" + file.Name, String.Empty));
                                GetData.Picker.Add(Data.Misc.Size, prop[Data.Prop_File_Picker.Size]);
                                GetData.Picker.Add(Data.Misc.Type, file.DisplayType);

                                //Encrypt NameFile & Extension
                                GetData.Embed.Add(Data.Misc.DataNameFile, Conversion.ToBinary(await Bifid_Cipher.Execute("Embed", file.Name.Replace(file.FileType, String.Empty), String.Empty), "String"));
                                GetData.Embed.Add(Data.Misc.DataExtension, Conversion.ToBinary(await Bifid_Cipher.Execute("Embed", file.FileType.ToLower(), String.Empty), "String"));
                                switch (type)
                                {
                                case "File":
                                    GetData.Embed.Add(Data.Misc.DataType, Conversion.ToBinary("0", "String"));
                                    break;

                                case "Message":
                                    GetData.Embed.Add(Data.Misc.DataType, Conversion.ToBinary("1", "String"));
                                    break;
                                }
                                return(true);
                            }
                            else
                            {
                                switch (type)
                                {
                                case "File":
                                    await PopupDialog.Show(Status.Err, Detail.Insert_File, Err.More150Kb, Icon.Sad);

                                    return(false);

                                case "Message":
                                    await PopupDialog.Show(Status.Err, Detail.Insert_Message, Err.More150Kb, Icon.Sad);

                                    return(false);

                                default:
                                    return(false);
                                }
                            }
                        }
                        else
                        {
                            switch (type)
                            {
                            case "File":
                                await PopupDialog.Show(Status.Err, Detail.Insert_File, Err.Overload_Size, Icon.Sad);

                                return(false);

                            case "Message":
                                await PopupDialog.Show(Status.Err, Detail.Insert_Message, Err.Overload_Size, Icon.Sad);

                                return(false);

                            default:
                                return(false);
                            }
                        }
                    }
                }
            }