Example #1
0
        public void CreateOTRSession(string my_buddy_unique_id, DSAKeyParams dsa_key_hex_string)
        {
            if (string.IsNullOrEmpty(my_buddy_unique_id))
            {
                throw new ArgumentException("CreateOTRSession:My buddy uique ID cannot be null/empty");
            }

            if (dsa_key_hex_string == null)
            {
                throw new ArgumentException("CreateOTRSession:The DSA key parameter object cannot be null");
            }


            if (IsSessionRegistered(my_buddy_unique_id) == true)
            {
                throw new InvalidDataException("CreateOTRSession: A session with this unique ID already exists");
            }

            OTRSession _session_object = new OTRSession(_my_unique_id, my_buddy_unique_id, dsa_key_hex_string);

            _session_object.OnOTREvent += new OTREventHandler(OTRSessionEventHandler);

            _otr_session_register.Add(my_buddy_unique_id, _session_object);
        }
Example #2
0
        public void CreateOTRSession(string my_buddy_unique_id, DSAKeyParams dsa_key_hex_string, bool debug_mode)
        {
            if (string.IsNullOrEmpty(my_buddy_unique_id))
            throw new ArgumentException("CreateOTRSession:My buddy uique ID cannot be null/empty");

            if (dsa_key_hex_string == null)
            throw new ArgumentException("CreateOTRSession:The DSA key parameter Hex string object cannot be null");

            if (IsSessionRegistered(my_buddy_unique_id) == true)
            throw new InvalidDataException("CreateOTRSession: A session with this unique ID already exists");

            OTRSession _session_object = new OTRSession(_my_unique_id, my_buddy_unique_id, dsa_key_hex_string, debug_mode);

            _session_object.OnOTREvent += new OTREventHandler(OTRSessionEventHandler);

            _otr_session_register.Add(my_buddy_unique_id, _session_object);
        }
Example #3
0
 public OTRSession(string my_unique_id, string my_buddy_unique_id, DSAKeyParams dsa_key_hex_strings)
     : this(my_unique_id, my_buddy_unique_id, dsa_key_hex_strings, false)
 {
 }
Example #4
0
        public OTRSession(string my_unique_id, string my_buddy_unique_id, DSAKeyParams dsa_key_hex_strings, bool debug_mode)
        {
            if (dsa_key_hex_strings == null)
                throw new ArgumentException("OTRSession: The DSA key hex string object cannot be null");

            if (string.IsNullOrEmpty(my_unique_id))
                throw new ArgumentException("OTRSession:My uique ID cannot be null/empty");

            if (string.IsNullOrEmpty(my_buddy_unique_id))
                throw new ArgumentException("OTRSession:My buddy's unique ID cannot be null/empty");

            if (my_buddy_unique_id.Equals(my_unique_id))
                throw new ArgumentException("OTRSession:My uique ID and My buddy's unique ID cannot be the same value");

            _my_unique_id = my_unique_id;
            _my_buddy_unique_id = my_buddy_unique_id;

            _ake_keys_manager = new AKEKeysManager();
            _otr_session_object = new OTRSessionObjects();

            _dsa_signer = new DSASigner(dsa_key_hex_strings);
            _signature_manager = new SignatureManager(_dsa_signer);

            _debug_mode = debug_mode;
        }