private static void DecryptDocument(string name) { bool documentFound = false; foreach (var document in documents) { if (document.Name == name) { documentFound = true; IEncryptable encryptableDocument = document as IEncryptable; if (encryptableDocument != null) { encryptableDocument.Decrypt(); Console.WriteLine("Document decrypted: " + name); } else { Console.WriteLine("Document does not support decryption: " + name); } } } if (!documentFound) { Console.WriteLine("Document not found: " + name); } }
private static void DecryptDocument(string name) { // bool found = false; foreach (var item in documents) { if (item.Name == name) { found = true; IEncryptable obj = item as IEncryptable; if (obj != null) { obj.Decrypt(); Console.WriteLine("Document decrypted: {0}", name); } else { Console.WriteLine("Document does not support decryption: {0}", name); } } } if (found == false) { Console.WriteLine("Document not found: {0}", name); } }
private bool DecryptIncomingPacket(IEncryptable packet, EncryptionBase decrypter) { if (packet.isEncrypted) { if (decrypter.EncryptionTypeByte == packet.EncryptionMethodByte) { return(packet.Decrypt(decrypter)); } else { throw new LoggableException("Failed to decrypt byte[] blob due to decryptor object being of byte: " + decrypter.EncryptionTypeByte.ToString() + " and lidgren packet encryption byte being: " + packet.EncryptionMethodByte, null, LogType.Error); } } else { return(false); } }
public static object Decrypt(object key, object source) { return(_imageEncryptor.Decrypt(key, source)); }