本文整理汇总了C#中Principal.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Principal.ToString方法的具体用法?C# Principal.ToString怎么用?C# Principal.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Principal
的用法示例。
在下文中一共展示了Principal.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetReaderKey
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;
}
示例2: GetPubKey
public string GetPubKey(Principal prin)
{
logger.Log("GetPubKey request for " + prin.ToString());
// TODO(trinabh): return should be signed
if (keytable.ContainsKey(prin.ToString()))
{
return keytable[prin.ToString()];
}
else
{
return null;
}
}
示例3: UpdateReaderKey
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;
}
}
示例4: RegisterPubKey
public bool RegisterPubKey(Principal prin, string key)
{
logger.Log("RegisterPubKey request for " + prin.ToString());
if (keytable.ContainsKey(prin.ToString()))
{
return false;
}
else
{
keytable[prin.ToString()] = key;
}
return true;
}