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); }
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); } }
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(); } }
static Program() { objProgram = new Program(); objStrOperations = new StringOperations(); objEncoderDecoder = new EncoderDecoder(); }
public void SetAvatar(IFormFile file) { Avatar = EncoderDecoder.EncodeFile(file); AvatarFileName = file.FileName; }
public string GetAvatar() { return(EncoderDecoder.DecodeFile(Avatar, AvatarFileName)); }