예제 #1
0
        public Ticket(Key key, User from, Key shareKeys)
        {
            Ticket_NoEncrypted tne = new Ticket_NoEncrypted();
            tne.from = from;
            tne.shareKeys = shareKeys;

            this.encrypted = DesEncryption.EncryptObject(tne, key);
        }
예제 #2
0
        public Tgt(Key k_kdc, User u, Key ks_a)
        {
            TgtNoEncrypted tgtNoEncrypted = new TgtNoEncrypted();
            tgtNoEncrypted.u = u;
            tgtNoEncrypted.ks_a = ks_a;

            this.encrypted = DesEncryption.EncryptObject(tgtNoEncrypted, k_kdc);
        }
예제 #3
0
        public KRB_TGS_REP(Key key, User reqUser, Key k_ab, Ticket ticket)
        {
            KRB_TGS_REP_NoEncrypted noEncrypt = new KRB_TGS_REP_NoEncrypted();
            noEncrypt.reqUser = reqUser;
            noEncrypt.k_ab = k_ab;
            noEncrypt.ticket = ticket;

            this.encrypted = DesEncryption.EncryptObject(noEncrypt, key);
        }
예제 #4
0
        public static void Main(string[] args)
        {
            // I have to check the args
            string userName = args[0];
            string userRemo = args[1];

            Key aliceKey = new Key("ABCDEFGH");

            #region Throw our server

            string confFile = Application.ExecutablePath + "." + userName.ToLower() + ".config";
            Console.WriteLine(confFile);
            RemotingConfiguration.Configure(confFile , false);

            #endregion

            #region Connection with server

            System.Configuration.AppSettingsReader configurationAppSettings =
                new System.Configuration.AppSettingsReader();
            //String url = (string)ConfigurationSettings.AppSettings["RemotingUrl"];
            String url =
            IKdc kdc = (IKdc)Activator.GetObject(typeof(ShareClasses.IKdc), url);

            #endregion

            #region AS_REQ

            User alice = new User(userName);
            KRB_AS_REQ asReq = new KRB_AS_REQ(alice);
            KRB_AS_REP asRep = kdc.AS(asReq);

            #endregion

            #region TGS_REQ

            User bob = new User(userRemo);
            Authenticator auth = new Authenticator(aliceKey);
            KRB_TGS_REQ tgsReq = new KRB_TGS_REQ(asRep.GetTGT(aliceKey), auth, bob);
            KRB_TGS_REP tgsRep = kdc.TGS(tgsReq);

            #endregion

            #region AP_REQ

            Ticket ticket = tgsRep.GetTicket(aliceKey);
            string bobUrl = (string)ConfigurationSettings.AppSettings["RemotingUser"];
            Server bobServer = (Server)Activator.GetObject(typeof(Workstation.Server), bobUrl);
            KRB_AP_REQ apReq = new KRB_AP_REQ(ticket, auth);
            KRB_AP_REP apRep = bobServer.AP(apReq);

            #endregion
        }
예제 #5
0
        private Key GetUserKey(User u)
        {
            MySQLQueries mysql = new MySQLQueries(
                ConfigurationSettings.AppSettings["db_host"], ConfigurationSettings.AppSettings["db_db"],
                ConfigurationSettings.AppSettings["db_user"], ConfigurationSettings.AppSettings["db_pass"]);
            mysql.OpenConnection();
            string sqlq = "SELECT `key` FROM `" + ConfigurationSettings.AppSettings["db_tb_users"] + "` WHERE `user`=\"" + u.Name + "\";";
            IDataReader reader = mysql.Select(sqlq);
            reader.Read();
            Key k_a = new Key((string) reader["key"]);
            mysql.CloseConnection();

            return k_a;

            // Possible exceptions:
            // - User doesn't exists
            // - MySQL connexion problem
        }
예제 #6
0
 public KRB_TGS_REQ(Tgt tgt, Authenticator authenticator, User reqUser)
 {
     this.tgt = tgt;
     this.authenticator = authenticator;
     this.reqUser = reqUser;
 }
예제 #7
0
 public KRB_AS_REQ(User user)
 {
     this.user = user;
 }