예제 #1
0
파일: SSH.cs 프로젝트: zhchlmm/EasyConnect
        public static string SimpleDecrypt(string enc)
        {
            byte[] t   = Granados.Util.Base64.Decode(Encoding.ASCII.GetBytes(enc));
            byte[] key = Encoding.ASCII.GetBytes("- BOBO VIERI 32-");
            Granados.Algorithms.Rijndael rijndael = new Granados.Algorithms.Rijndael();
            rijndael.InitializeKey(key);

            byte[] d = new byte[t.Length];
            rijndael.decryptCBC(t, 0, t.Length, d, 0);

            return(Encoding.ASCII.GetString(d)); //パディングがあってもNULL文字になるので除去されるはず
        }
예제 #2
0
        public static string SimpleDecrypt(string enc)
        {
            byte[] t   = Granados.Util.Base64.Decode(Encoding.ASCII.GetBytes(enc));
            byte[] key = Encoding.ASCII.GetBytes("- BOBO VIERI 32-");
            Granados.Algorithms.Rijndael rijndael = new Granados.Algorithms.Rijndael();
            rijndael.InitializeKey(key);

            byte[] d = new byte[t.Length];
            rijndael.decryptCBC(t, 0, t.Length, d, 0);

            return(Encoding.ASCII.GetString(d));            //ƒpƒfƒBƒ“ƒO‚ª‚ ‚Á‚Ä‚àNULL•¶Žš‚É‚È‚é‚̂ŏœ‹Ž‚³‚ê‚é‚Í‚¸
        }
예제 #3
0
파일: SSH.cs 프로젝트: zhchlmm/EasyConnect
        public static string SimpleEncrypt(string plain)
        {
            byte[] t = Encoding.ASCII.GetBytes(plain);
            if ((t.Length % 16) != 0)
            {
                byte[] t2 = new byte[t.Length + (16 - (t.Length % 16))];
                Array.Copy(t, 0, t2, 0, t.Length);
                for (int i = t.Length + 1; i < t2.Length; i++) //残りはダミー
                {
                    t2[i] = t[i % t.Length];
                }
                t = t2;
            }

            byte[] key = Encoding.ASCII.GetBytes("- BOBO VIERI 32-");
            Granados.Algorithms.Rijndael rijndael = new Granados.Algorithms.Rijndael();
            rijndael.InitializeKey(key);

            byte[] e = new byte[t.Length];
            rijndael.encryptCBC(t, 0, t.Length, e, 0);

            return(Encoding.ASCII.GetString(Granados.Util.Base64.Encode(e)));
        }
예제 #4
0
파일: SSH.cs 프로젝트: Ricordanza/poderosa
        public static string SimpleDecrypt(string enc) {
            byte[] t = Granados.Util.Base64.Decode(Encoding.ASCII.GetBytes(enc));
            byte[] key = Encoding.ASCII.GetBytes("- BOBO VIERI 32-");
            Granados.Algorithms.Rijndael rijndael = new Granados.Algorithms.Rijndael();
            rijndael.InitializeKey(key);

            byte[] d = new byte[t.Length];
            rijndael.decryptCBC(t, 0, t.Length, d, 0);

            return Encoding.ASCII.GetString(d); //パディングがあってもNULL文字になるので除去されるはず
        }
예제 #5
0
파일: SSH.cs 프로젝트: Ricordanza/poderosa
        public static string SimpleEncrypt(string plain) {
            byte[] t = Encoding.ASCII.GetBytes(plain);
            if ((t.Length % 16) != 0) {
                byte[] t2 = new byte[t.Length + (16 - (t.Length % 16))];
                Array.Copy(t, 0, t2, 0, t.Length);
                for (int i = t.Length + 1; i < t2.Length; i++) //残りはダミー
                    t2[i] = t[i % t.Length];
                t = t2;
            }

            byte[] key = Encoding.ASCII.GetBytes("- BOBO VIERI 32-");
            Granados.Algorithms.Rijndael rijndael = new Granados.Algorithms.Rijndael();
            rijndael.InitializeKey(key);

            byte[] e = new byte[t.Length];
            rijndael.encryptCBC(t, 0, t.Length, e, 0);

            return Encoding.ASCII.GetString(Granados.Util.Base64.Encode(e));
        }