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)); }
public void IsValidCipherKey_ValidKey_IsTrue(string cipherKey) { Assert.IsTrue(KeyManagement.IsValidCipherKey(new PlayfairKey { Value = cipherKey })); }