本文整理汇总了C#中Scope.GetData方法的典型用法代码示例。如果您正苦于以下问题:C# Scope.GetData方法的具体用法?C# Scope.GetData怎么用?C# Scope.GetData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scope
的用法示例。
在下文中一共展示了Scope.GetData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestEncrypt2
public void TestEncrypt2()
{
byte[] expected = ByteTool.Convert("04 30 4B 4F 10 3B 73 E1 E4 BD 91 32 1B CB 41" +
"1B A1 C1 D1 1D 2D B7 84 16 CA 41 BF B3 62 83 C4" +
"29 C5 A4 BC 32 DA 2E C7 65 A5 3D 71 06 3C 5B 56" +
"FB 04 A4");
OctetString engineId = new OctetString(ByteTool.Convert("80 00 1F 88 80 E9 63 00 00 D6 1F F4 49"));
DESPrivacyProvider priv = new DESPrivacyProvider(new OctetString("passtest"), new MD5AuthenticationProvider(new OctetString("testpass")));
Scope scope = new Scope(engineId, OctetString.Empty, new GetRequestPdu(0x3A25, ErrorCode.NoError, 0, new List<Variable> { new Variable(new ObjectIdentifier("1.3.6.1.2.1.1.3.0")) }));
SecurityParameters parameters = new SecurityParameters(engineId, new Integer32(0x14), new Integer32(0x35), new OctetString("lexmark"), new OctetString(new byte[12]), new OctetString(ByteTool.Convert("00 00 00 01 44 2C A3 B5")));
ISnmpData data = priv.Encrypt(scope.GetData(VersionCode.V3), parameters);
Assert.AreEqual(SnmpType.OctetString, data.TypeCode);
Assert.AreEqual(expected, ByteTool.ToBytes(data));
}
示例2: ComputeHash
/// <summary>
/// Computes the hash.
/// </summary>
/// <param name="version">The version.</param>
/// <param name="header">The header.</param>
/// <param name="parameters">The parameters.</param>
/// <param name="scope">The scope.</param>
/// <param name="privacy">The privacy provider.</param>
/// <returns></returns>
public OctetString ComputeHash(VersionCode version, Header header, SecurityParameters parameters, Scope scope, IPrivacyProvider privacy)
{
if (header == null)
{
throw new ArgumentNullException("header");
}
if (parameters == null)
{
throw new ArgumentNullException("parameters");
}
if (scope == null)
{
throw new ArgumentNullException("scope");
}
if (privacy == null)
{
throw new ArgumentNullException("privacy");
}
return ComputeHash(version, header, parameters, privacy.Encrypt(scope.GetData(version), parameters), privacy);
}