예제 #1
0
 public BoundMessage(string PayloadIn, Cryptographic Cryptographic)
 {
     if (Cryptographic == null) {
         Payload = PayloadIn;
         }
     else {
         Cryptography.Authentication Authentication =
             Cryptography.AuthenticationCode(Cryptographic.Authentication);
         Cryptography.Key Key = new Cryptography.Key(Cryptographic.Secret, Authentication,
                    Cryptography.Encryption.Unknown);
         BindMessage(PayloadIn, Cryptographic.Ticket, Authentication, Key);
         }
 }
예제 #2
0
        public Cryptographic GetCryptographic(TicketData TicketData, String Protocol, byte [] Ticket)
        {
            Cryptographic Result = new Cryptographic ();

            // Fill in the Response structures
            Result.Authentication = Cryptography.AuthenticationCode (TicketData.Authentication);
            Result.Encryption = Cryptography.EncryptionCode (TicketData.Encryption);
            Result.Secret = TicketData.MasterKey.KeyData;
            Result.Protocol = Protocol;
            Result.Ticket = Ticket;

            return Result;
        }
예제 #3
0
 public BoundResponse(string PayloadIn, Cryptographic Cryptographic)
     : base(PayloadIn, Cryptographic)
 {
 }
예제 #4
0
 public BoundRequest(string PayloadIn, Cryptographic Cryptographic)
     : base(PayloadIn, Cryptographic)
 {
 }
예제 #5
0
        public static void Deserialize(string _Input, out Cryptographic Out)
        {
            StringReader _Reader = new StringReader (_Input);
            JSONReader JSONReader = new JSONReader (_Reader);

            JSONReader.StartObject ();
            string token = JSONReader.ReadToken ();
            Out = null;

            switch (token) {

                case "Cryptographic" : {
                    Cryptographic Result = new Cryptographic ();
                    Result.Deserialize (JSONReader);
                    Out = Result;
                    break;
                    }

                default : {
                    throw new Exception ("Not supported");
                    }
                }
            JSONReader.EndObject ();

            // should we check for EOF here?
        }
예제 #6
0
 public virtual void DeserializeToken(JSONReader JSONReader, string Tag)
 {
     switch (Tag) {
         case "Name" : {
             Name = JSONReader.ReadString ();
             break;
             }
         case "Port" : {
             Port = JSONReader.ReadInteger32 ();
             break;
             }
         case "Address" : {
             Address = JSONReader.ReadString ();
             break;
             }
         case "Priority" : {
             Priority = JSONReader.ReadInteger32 ();
             break;
             }
         case "Weight" : {
             Weight = JSONReader.ReadInteger32 ();
             break;
             }
         case "Transport" : {
             Transport = JSONReader.ReadString ();
             break;
             }
         case "Expires" : {
             Expires = JSONReader.ReadDateTime ();
             break;
             }
         case "Cryptographic" : {
             Cryptographic = new Cryptographic (JSONReader);
             break;
             }
         default : {
             break;
             }
         }
     // check up that all the required elements are present
 }
예제 #7
0
        public new void DeserializeToken(JSONReader JSONReader, string Tag)
        {
            switch (Tag) {
                case "Cryptographic" : {
                    bool _Going = JSONReader.StartArray ();
                    Cryptographic = new List <Cryptographic> ();
                    while (_Going) {
                        Cryptographic _Item = new Cryptographic (JSONReader);
                        Cryptographic.Add (_Item);
                        _Going = JSONReader.NextArray ();
                        }

                    break;
                    }
                case "Service" : {
                    bool _Going = JSONReader.StartArray ();
                    Service = new List <Connection> ();
                    while (_Going) {
                        Connection _Item = new Connection (JSONReader);
                        Service.Add (_Item);
                        _Going = JSONReader.NextArray ();
                        }

                    break;
                    }
                default : {
                    ((Response)this).DeserializeToken(JSONReader, Tag);
                    break;
                    }
                }
            // check up that all the required elements are present
        }
예제 #8
0
 public void SetCrypto(Cryptographic Crypto)
 {
     Cryptographic = Crypto;
 }