// Default authentication provider (empty class).
// Copyright (C) 2008-2010 Malcolm Crowe, Lex Li, and other contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
namespace GSF.Net.Snmp.Security
{
///
/// Default authentication provider.
///
public sealed class DefaultAuthenticationProvider : IAuthenticationProvider
{
private DefaultAuthenticationProvider()
{
}
private static IAuthenticationProvider _instance;
///
/// Gets the instance.
///
/// The instance.
public static IAuthenticationProvider Instance
{
get { return _instance ?? (_instance = new DefaultAuthenticationProvider()); }
}
#region IAuthenticationProvider Members
///
/// Computes the hash.
///
/// The version.
/// The header.
/// The parameters.
/// The scope data.
/// The privacy provider.
/// The length bytes.
///
public OctetString ComputeHash(VersionCode version, ISegment header, SecurityParameters parameters, ISnmpData data, IPrivacyProvider privacy, byte[] length)
{
if (header == null)
{
throw new ArgumentNullException(nameof(header));
}
if (parameters == null)
{
throw new ArgumentNullException(nameof(parameters));
}
if (data == null)
{
throw new ArgumentNullException(nameof(data));
}
if (privacy == null)
{
throw new ArgumentNullException(nameof(privacy));
}
return OctetString.Empty;
}
///
/// Computes the hash.
///
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
public OctetString ComputeHash(byte[] buffer, OctetString engineId)
{
if (buffer == null)
{
throw new ArgumentNullException(nameof(buffer));
}
if (engineId == null)
{
throw new ArgumentNullException(nameof(engineId));
}
return OctetString.Empty;
}
///
/// Gets the clean digest.
///
/// The clean digest.
public OctetString CleanDigest
{
get { return OctetString.Empty; }
}
///
/// Converts password to key.
///
///
///
///
public byte[] PasswordToKey(byte[] password, byte[] engineId)
{
if (password == null)
{
throw new ArgumentNullException(nameof(password));
}
if (engineId == null)
{
throw new ArgumentNullException(nameof(engineId));
}
// IMPORTANT: this function is not used.
return new byte[0];
}
///
/// Gets the length of the digest.
///
/// The length of the digest.
public int DigestLength => 0;
#endregion
///
/// Returns a that represents this instance.
///
///
/// A that represents this instance.
///
public override string ToString()
{
return "Default authentication provider";
}
}
}