static void Main(string[] args)
        {
            EncryptionAlgorithms encryption = new EncryptionAlgorithms(encryptionToBase64);

            encryption += encryptionCeaser;
            Console.WriteLine("Şifrelenecek Cümleyi giriniz: ");
            encryption(Console.ReadLine());
        }
Exemplo n.º 2
0
        public string TestConnection()
        {
            string macAlgos         = string.Join(",", MacAlgorithms.Where(t => t.IsEnabled).Select(t => t.Name));
            string encryptionAlgos  = string.Join(",", EncryptionAlgorithms.Where(t => t.IsEnabled).Select(t => t.Name));
            string compressionAlgos = string.Join(",", CompressionAlgorithms.Where(t => t.IsEnabled).Select(t => t.Name));
            string keyExchangeAlgos = string.Join(",", KeyExchangeAlgorithms.Where(t => t.IsEnabled).Select(t => t.Name));

            return(_sftpClient.TryConnection(ServerAddress, ServerPort, macAlgos, encryptionAlgos, compressionAlgos, keyExchangeAlgos));
        }
Exemplo n.º 3
0
 public static string EncryptPassword(EncryptionAlgorithms algorithm, string rawPassword)
 {
     byte[] buffer = ASCIIEncoding.ASCII.GetBytes(rawPassword);
     byte[] hash   = System.Security.Cryptography.HashAlgorithm.Create(algorithm.ToString()).ComputeHash(buffer);
     return(Convert.ToBase64String(hash));
 }
 public static string EncryptPassword(EncryptionAlgorithms algorithm,string rawPassword)
 {
     byte[] buffer = ASCIIEncoding.ASCII.GetBytes(rawPassword);
     byte[] hash = System.Security.Cryptography.HashAlgorithm.Create(algorithm.ToString()).ComputeHash(buffer);
     return Convert.ToBase64String(hash);
 }
Exemplo n.º 5
0
        public static string Decrypt(this string input, string key = "", string iv = "", EncryptionAlgorithms algorithm = EncryptionAlgorithms.AES)
        {
            switch (algorithm)
            {
            case EncryptionAlgorithms.AES:
                return(input.DecryptAes(key, iv));

            case EncryptionAlgorithms.DES:
                return(input.DecryptDes(key, iv));
            }

            throw new Exception("Algorithm error.");
        }