コード例 #1
0
        public void DecryptBlockDecryptsBlockBackToOriginalPlainText()
        {
            const string originalMessage = "This is my message to encrypt.";

            string encrypted = BlockEncrypter.EncryptBlock(originalMessage, Encoding.ASCII.GetBytes("Pa55w0rd"));
            string decrypted = BlockEncrypter.DecryptBlock(encrypted, Encoding.ASCII.GetBytes("Pa55w0rd"));

            Assert.AreEqual(originalMessage, decrypted);
        }
コード例 #2
0
        private void EncryptText()
        {
            SetPasswordAndStatusBar(false);

            try
            {
                encryptedText.Text = BlockEncrypter.EncryptBlock(textToEncrypt.Text, _passwordEntry.Password.CombinedPasswords);
            }
            catch (Exception)
            {
                encryptedText.Text = "";
                MessageBox.Show(Resources.TextShredderMainForm_EncryptText_There_was_an_error_encrypting_the_message_, Resources.TextShredderMainForm_EncryptText_Encryption_Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
コード例 #3
0
 public void EncryptBlockThrowsArgumentNullExceptionIfPasswordIsNull()
 {
     BlockEncrypter.EncryptBlock("blah blah blah blah blah blah", null);
 }
コード例 #4
0
        public void EncryptBlockEncryptsTextWithAPasswordAndResultIsNotNull()
        {
            string encrypted = BlockEncrypter.EncryptBlock("This is my message to encrypt.", Encoding.ASCII.GetBytes("Pa55w0rd"));

            Assert.IsNotNull(encrypted);
        }
コード例 #5
0
 public void EncryptBlockThrowsArgumentNullExceptionIfTextToEncryptIsNull()
 {
     BlockEncrypter.EncryptBlock(null, null);
 }