Exemplo n.º 1
0
        public string EncryptMessage(string plainText, PlayfairKey cipherKey)
        {
            if (!_keyManagement.IsValidCipherKey(cipherKey))
            {
                throw new ArgumentException("Invalid cipher key.");
            }

            var sanitizedMessage = PlayfairUtil.GetSanitisedString(plainText);
            var digraths         = _digrathGenerator.GetMessageDigraths(sanitizedMessage);

            return(Encrypt(digraths, cipherKey));
        }
Exemplo n.º 2
0
 public void IsValidCipherKey_ValidKey_IsTrue(string cipherKey)
 {
     Assert.IsTrue(KeyManagement.IsValidCipherKey(new PlayfairKey {
         Value = cipherKey
     }));
 }