Ejemplo n.º 1
0
 public List<Principal> GetAllReaders(FQStreamID stream)
 {
     if (mdtable.ContainsKey(stream.ToString()))
     {
         return mdtable[stream.ToString()].GetAllReaders();
     }
     return null;
 }
Ejemplo n.º 2
0
 public List <Principal> GetAllReaders(FQStreamID stream)
 {
     if (mdtable.ContainsKey(stream.ToString()))
     {
         return(mdtable[stream.ToString()].GetAllReaders());
     }
     return(null);
 }
Ejemplo n.º 3
0
 public void RemoveAllInfo(FQStreamID stream)
 {
     logger.Log("Removing all info for stream "
                + stream.ToString());
     if (mdtable.ContainsKey(stream.ToString()))
     {
         mdtable.Remove(stream.ToString());
     }
 }
Ejemplo n.º 4
0
 public AccountInfo GetMdAccount(FQStreamID stream)
 {
     logger.Log("Serving md account info for stream "
         + stream.ToString());
     if (mdtable.ContainsKey(stream.ToString()))
     {
         return mdtable[stream.ToString()].GetMdAccount();
     }
     return null;
 }
Ejemplo n.º 5
0
 public Dictionary<int, AccountInfo> GetAllAccounts(FQStreamID stream)
 {
     logger.Log("Serving account info for stream "
         + stream.ToString());
     if (mdtable.ContainsKey(stream.ToString()))
     {
         return mdtable[stream.ToString()].GetAllAccounts();
     }
     return null;
 }
Ejemplo n.º 6
0
 public bool AddMdAccount(FQStreamID stream, AccountInfo accinfo)
 {
     logger.Log("Adding md account info for stream "
         + stream.ToString());
     if (!mdtable.ContainsKey(stream.ToString()))
     {
         mdtable[stream.ToString()] = new StreamInfo(stream);
     }
     return mdtable[stream.ToString()].AddMdAccount(accinfo);
 }
Ejemplo n.º 7
0
 public bool AddMdAccount(FQStreamID stream, AccountInfo accinfo)
 {
     logger.Log("Adding md account info for stream "
                + stream.ToString());
     if (!mdtable.ContainsKey(stream.ToString()))
     {
         mdtable[stream.ToString()] = new StreamInfo(stream);
     }
     return(mdtable[stream.ToString()].AddMdAccount(accinfo));
 }
Ejemplo n.º 8
0
 public Dictionary <int, AccountInfo> GetAllAccounts(FQStreamID stream)
 {
     logger.Log("Serving account info for stream "
                + stream.ToString());
     if (mdtable.ContainsKey(stream.ToString()))
     {
         return(mdtable[stream.ToString()].GetAllAccounts());
     }
     return(null);
 }
Ejemplo n.º 9
0
 public ACLEntry GetReaderKey(FQStreamID stream, Principal p)
 {
     logger.Log("GetReaderKey from caller " + p.ToString() + " for stream "
                + stream.ToString());
     // TODO(trinabh): Return should be signed
     if (mdtable.ContainsKey(stream.ToString()))
     {
         return(mdtable[stream.ToString()].GetReader(p));
     }
     return(null);
 }
Ejemplo n.º 10
0
        public AccountInfo GetMdAccount(FQStreamID stream)
        {
            AccountInfo retVal = null;

            if (mdtable.ContainsKey(stream.ToString()))
            {
                retVal = mdtable[stream.ToString()].GetMdAccount();
            }

            logger.Log("Serving md account info for stream " + stream.ToString() + " as " + retVal);
            return(retVal);
        }
Ejemplo n.º 11
0
        public bool UpdateReaderKey(Principal caller, FQStreamID stream, ACLEntry entry)
        {
            logger.Log("UpdateReaderKey request from caller " + caller.ToString() + " for stream "
                       + stream.ToString() + " and principal " + entry.readerName.ToString()
                       + " key version " + entry.keyVersion);
            // TODO(trinabh): Authenticate caller
            RSACryptoServiceProvider RSA = new RSACryptoServiceProvider();
            string callerpubkey          = GetPubKey(caller);

            if (callerpubkey == null)
            {
                return(false);
            }
            RSA.FromXmlString(callerpubkey);

            Byte[] data = { };
            data = data.Concat(this.GetBytes(caller.HomeId)).ToArray();
            data = data.Concat(this.GetBytes(caller.AppId)).ToArray();
            data = data.Concat(this.GetBytes(stream.HomeId)).ToArray();
            data = data.Concat(this.GetBytes(stream.AppId)).ToArray();
            data = data.Concat(this.GetBytes(stream.StreamId)).ToArray();
            data = data.Concat(this.GetBytes(entry.readerName.HomeId)).ToArray();
            data = data.Concat(this.GetBytes(entry.readerName.AppId)).ToArray();
            data = data.Concat(entry.encKey).ToArray();
            data = data.Concat(entry.IV).ToArray();
            data = data.Concat(this.GetBytes("" + entry.keyVersion)).ToArray();

            if (RSA.VerifyData(data, new SHA256CryptoServiceProvider(), caller.Auth) == false)
            {
                logger.Log("Verification of request failed");
                return(false);
            }
            //

            if (caller.HomeId == stream.HomeId && caller.AppId == stream.AppId)
            {
                if (!mdtable.ContainsKey(stream.ToString()))
                {
                    mdtable[stream.ToString()] = new StreamInfo(stream);
                }
                mdtable[stream.ToString()].UpdateReader(entry);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 12
0
        public bool UpdateReaderKey(Principal caller, FQStreamID stream, ACLEntry entry)
        {
            if (logger != null) logger.Log("UpdateReaderKey request from caller " + caller.ToString() + " for stream "
                + stream.ToString() + " and principal " + entry.readerName.ToString()
                + " key version " + entry.keyVersion);

            // Authentication is not required for unlisted streams
            /*
            RSACryptoServiceProvider RSA = new RSACryptoServiceProvider();
            string callerpubkey = GetPubKey(caller);
            if (callerpubkey == null)
                return false;
            RSA.FromXmlString(callerpubkey);

            Byte[] data = { };
            data = data.Concat(this.GetBytes(caller.HomeId)).ToArray();
            data = data.Concat(this.GetBytes(caller.AppId)).ToArray();
            data = data.Concat(this.GetBytes(stream.HomeId)).ToArray();
            data = data.Concat(this.GetBytes(stream.AppId)).ToArray();
            data = data.Concat(this.GetBytes(stream.StreamId)).ToArray();
            data = data.Concat(this.GetBytes(entry.readerName.HomeId)).ToArray();
            data = data.Concat(this.GetBytes(entry.readerName.AppId)).ToArray();
            data = data.Concat(entry.encKey).ToArray();
            data = data.Concat(entry.IV).ToArray();
            data = data.Concat(this.GetBytes("" + entry.keyVersion)).ToArray();

            if (RSA.VerifyData(data, new SHA256CryptoServiceProvider(), caller.Auth) == false)
            {
                if (logger != null) logger.Log("Verification of request failed");
                return false;
            }
            //
            */

            if (caller.HomeId == stream.HomeId && caller.AppId == stream.AppId)
            {
                if (!mdtable.ContainsKey(stream.ToString()))
                    mdtable[stream.ToString()] = new StreamInfo(stream);
                mdtable[stream.ToString()].UpdateReader(entry);
                return true;
            }
            else
            {
                return false;
            }
        }
Ejemplo n.º 13
0
 public void RemoveAllInfo(FQStreamID stream)
 {
     if (logger != null) logger.Log("Removing all info for stream "
         + stream.ToString());
     if (mdtable.ContainsKey(stream.ToString()))
     {
         mdtable.Remove(stream.ToString());
     }
 }
Ejemplo n.º 14
0
 public ACLEntry GetReaderKey(FQStreamID stream, Principal p)
 {
     if (logger != null) logger.Log("GetReaderKey from caller " + p.ToString() + " for stream "
         + stream.ToString());
     // TODO(trinabh): Return should be signed
     if (mdtable.ContainsKey(stream.ToString()))
     {
         return mdtable[stream.ToString()].GetReader(p);
     }
     return null;
 }