예제 #1
0
        public KRB_TGS_REP TGS(KRB_TGS_REQ req)
        {
            // Invent key K_AB
            Key k_ab = new Key(7);
            k_ab.CreateRandomKey();

            // Decrypt TGT to get SA
            Key sa = req.Tgt.GetKS_A(this.k_kdc);

            // Decrypt authenticator
            DateTime timestamp = req.Authenticator.GetTimestamp(sa);

            // Verifies timestamp
            DateTime now = DateTime.Now;
            int diffTimestamp = now.Second - timestamp.Second;
            if (diffTimestamp > this.maxTimestamp)
            {
                // Fail in the timestamp
                return null;
            }

            // Finds Bob's master key KB
            Key k_b = GetUserKey(req.ReqUser);

            // Ticket to Bob = K_B[Alice, K_AB]
            Ticket ticket = new Ticket(k_b, req.Tgt.GetUser(this.k_kdc), k_ab);

            return new KRB_TGS_REP(sa, req.ReqUser, k_ab, ticket);
        }
예제 #2
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);
        }
예제 #3
0
 public KRB_AP_REQ(Ticket ticket, Authenticator authenticator)
 {
     this.ticket = ticket;
     this.authenticator = authenticator;
 }