Exemple #1
0
        public void can_encode_and_decode()
        {
            var encDec    = new EncoderDecoder(PrivateKey);
            var phrase    = Guid.NewGuid().ToString();
            var encrypted = encDec.EncryptData(phrase);
            var decrypted = encDec.DecryptEncryptedData(encrypted);

            decrypted.Should().Be(phrase);
        }
Exemple #2
0
 public async void SwapSides()
 {
     if (EncoderDecoder.IsBase64Formatted(txtConversion.Text))
     {
         DefaultConversion  = true;
         txtConversion.Text = await EncoderDecoder.Base64DecodeAsync(txtConversion.Text);
     }
     else
     {
         DefaultConversion  = false;
         txtConversion.Text = await EncoderDecoder.Base64EncodeAsync(txtConversion.Text);
     }
 }
Exemple #3
0
        public async void EncodeDecode()
        {
            txtConversion.Text = string.Empty;

            if (EncoderDecoder.IsBase64Formatted(Selection))
            {
                DefaultConversion  = true;
                txtConversion.Text = await EncoderDecoder.Base64DecodeAsync(Selection);
            }
            else
            {
                DefaultConversion  = false;
                txtConversion.Text = await EncoderDecoder.Base64EncodeAsync(Selection);
            }
        }
        private void sendData()
        {
            CodinggainClipboardService.ClipboardInterfaceClient remoteClipboard = new CodinggainClipboardService.ClipboardInterfaceClient();

            if (!string.IsNullOrEmpty(ScratchPadTextBox.Text) && ScratchPadTextBox.Text != currentContent)
            {
                EncoderDecoder       encoder = new EncoderDecoder();
                Random               rand    = new Random();
                int                  r       = rand.Next();
                UserCredentialsStore store   = UserCredentialsStore.GetInstance();
                CodinggainClipboardService.EncryptionData enData = remoteClipboard.getAccessRights(store.Username, store.getPassword(r), true, r);
                string str = encoder.Encode(ScratchPadTextBox.Text, (byte)enData.encrypt_key);
                currentContent = ScratchPadTextBox.Text;
                int id = remoteClipboard.putScratchPad(store.Username, store.getPassword(r), TitleTextBox.Text, str, ImportantCheckBox.Checked, false, enData.access_key_id, r, 0);
                if (ImportantCheckBox.Checked)
                {
                    ImportantCheckBox.Checked = false;
                }
                LoadScratchDates();
            }
        }
Exemple #5
0
 static Program()
 {
     objProgram        = new Program();
     objStrOperations  = new StringOperations();
     objEncoderDecoder = new EncoderDecoder();
 }
Exemple #6
0
 public void SetAvatar(IFormFile file)
 {
     Avatar         = EncoderDecoder.EncodeFile(file);
     AvatarFileName = file.FileName;
 }
Exemple #7
0
 public string GetAvatar()
 {
     return(EncoderDecoder.DecodeFile(Avatar, AvatarFileName));
 }