Beispiel #1
0
 public bool UpdateReader(ACLEntry entry)
 {
     if (entry.keyVersion < latest_keyversion)
     {
         return(false);
     }
     readers[entry.GetPrincipal().ToString()] = entry;
     return(true);
 }
        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;
            }
        }
 public bool UpdateReader(ACLEntry entry)
 {
     if (entry.keyVersion < latest_keyversion)
         return false;
     readers[entry.GetPrincipal().ToString()] = entry;
     return true;
 }