internal static Sequence PackMessage(VersionCode version, ISegment header, SecurityParameters parameters, ISegment scope, IPrivacyProvider privacy) { if (scope == null) { throw new ArgumentNullException("scope"); } if (parameters == null) { throw new ArgumentNullException("parameters"); } if (header == null) { throw new ArgumentNullException("header"); } if (privacy == null) { throw new ArgumentNullException("privacy"); } ISnmpData[] collection = new ISnmpData[4] { new Integer32((int)version), header.GetData(version), parameters.GetData(version), privacy.Encrypt(scope.GetData(version), parameters) }; return(new Sequence(collection)); }
/// <summary> /// Gets the scope data. /// </summary> /// <param name="privacy">The privacy provider.</param> /// <param name="header">The header.</param> /// <param name="parameters">The parameters.</param> /// <param name="rawScopeData">The raw scope data.</param> /// <returns>ISnmpData.</returns> /// <exception cref="System.ArgumentNullException"> /// privacy /// or /// header /// </exception> public static ISnmpData GetScopeData(this IPrivacyProvider privacy, Header header, SecurityParameters parameters, ISnmpData rawScopeData) { if (privacy == null) { throw new ArgumentNullException("privacy"); } if (header == null) { throw new ArgumentNullException("header"); } return(Levels.Privacy == (header.SecurityLevel & Levels.Privacy) ? privacy.Encrypt(rawScopeData, parameters) : rawScopeData); }
/// <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)); }
/// <summary> /// Computes the hash. /// </summary> /// <param name="authen">The authentication provider.</param> /// <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> public static void ComputeHash(this IAuthenticationProvider authen, VersionCode version, Header header, SecurityParameters parameters, Scope scope, IPrivacyProvider privacy) { if (authen == null) { throw new ArgumentNullException("authen"); } 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"); } if (authen is DefaultAuthenticationProvider) { return; } // replace the hash. parameters.AuthenticationParameters = authen.ComputeHash(version, header, parameters, privacy.Encrypt(scope.GetData(version), parameters), privacy); }
internal static Sequence PackMessage(VersionCode version, ISegment header, SecurityParameters parameters, ISegment scope, IPrivacyProvider privacy) { if (scope == null) { throw new ArgumentNullException("scope"); } if (parameters == null) { throw new ArgumentNullException("parameters"); } if (header == null) { throw new ArgumentNullException("header"); } if (privacy == null) { throw new ArgumentNullException("privacy"); } ISnmpData[] collection = new ISnmpData[4] { new Integer32((int)version), header.GetData(version), parameters.GetData(version), privacy.Encrypt(scope.GetData(version), parameters) }; return new Sequence(collection); }
/// <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); }