104 lines
3.9 KiB
C#
104 lines
3.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text;
|
|
using System.Security.Cryptography.X509Certificates;
|
|
using System.Security;
|
|
|
|
namespace Intel.Management.Wsman
|
|
{
|
|
/// <summary>
|
|
/// Verifies the remote server certificate used for authentication.
|
|
/// </summary>
|
|
/// <param name="certificate">The certificate used to authenticate</param>
|
|
/// <param name="errors">One or more errors associated with the remote certificate.</param>
|
|
/// <returns>bool, determines whether the specified certificate is accepted for authentication.</returns>
|
|
public delegate bool ServerCertificateValidationCallback(X509Certificate certificate,
|
|
System.Net.Security.SslPolicyErrors errors);
|
|
|
|
/// <summary>
|
|
/// Represents various options for a Wsman connection
|
|
/// </summary>
|
|
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
|
|
[Guid("58A73241-12B8-4d6d-BA33-F8492A085E24")]
|
|
[ComVisible(true)]
|
|
public interface IWsmanConnectionOptions: IDisposable
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the amount of time in milliseconds connection will
|
|
/// wait for responses from the server
|
|
/// </summary>
|
|
int Timeout { get; set; }
|
|
/// <summary>
|
|
/// Gets or sets max number of items the connection can recieve when pulling data
|
|
/// </summary>
|
|
int MaxElements { get; set; }
|
|
/// <summary>
|
|
/// Gets or sets the proxy Address
|
|
/// </summary>
|
|
string ProxyAddress { get; set; }
|
|
/// <summary>
|
|
/// Gets or sets the proxy user name
|
|
/// </summary>
|
|
string ProxyUser { get; set; }
|
|
/// <summary>
|
|
/// Gets or sets the proxy password
|
|
/// </summary>
|
|
SecureString ProxyPassword { get; set; }
|
|
/// <summary>
|
|
/// Gets or sets the client certificate for mutual authentication
|
|
/// </summary>
|
|
X509Certificate ClientCertificate { get; set; }
|
|
/// <summary>
|
|
/// Gets or sets the connection Service Principle Name
|
|
/// </summary>
|
|
string ServiceName { get; set; }
|
|
/// <summary>
|
|
/// Gets or sets a value that indicates whether to verify certificates during TLS operations
|
|
/// </summary>
|
|
bool VerifyCertificates { get; set; }
|
|
/// <summary>
|
|
/// Gets or sets a value that indicates whether to accept self-signed certificate and skip any certificate check
|
|
/// </summary>
|
|
bool AcceptSelfSignedCertificate { get; set; }
|
|
/// <summary>
|
|
/// Gets or sets a value that indicates whether to treat the Password as a master password
|
|
/// </summary>
|
|
bool UseDigestMasterPassword { get; set; }
|
|
/// <summary>
|
|
/// Gets or sets a value that indicates whether to hide the password
|
|
/// </summary>
|
|
bool HidePassword { get; set; }
|
|
/// <summary>
|
|
/// Gets or sets a value that indicates the Internet Protocol to use
|
|
/// </summary>
|
|
InternetProtocolType InternetProtocol { get; set; }
|
|
/// <summary>
|
|
/// Gets or sets the callback for custom validation by the client of the server certificate.
|
|
/// </summary>
|
|
ServerCertificateValidationCallback ServerCertificateValidationCallback { get; set; }
|
|
///<summary>
|
|
/// Sets the client certificate to be used in the connection by giving the certificate name.
|
|
///</summary>
|
|
///<param name="clientCert">The certificate name.</param>
|
|
void SetClientCertificateByCertificateName(string clientCert);
|
|
|
|
} // interface
|
|
|
|
/// <summary>
|
|
/// The Type of Internet protocol to use
|
|
/// </summary>
|
|
public enum InternetProtocolType
|
|
{
|
|
/// <summary>
|
|
/// Use IPv4 Protocol
|
|
/// </summary>
|
|
IPv4 = 4,
|
|
/// <summary>
|
|
/// Use IPv6 Protocol
|
|
/// </summary>
|
|
Ipv6 = 6,
|
|
}
|
|
|
|
}// end namespace
|