本文整理汇总了C#中Mono.Security.Interface.MonoTlsSettings类的典型用法代码示例。如果您正苦于以下问题:C# MonoTlsSettings类的具体用法?C# MonoTlsSettings怎么用?C# MonoTlsSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MonoTlsSettings类属于Mono.Security.Interface命名空间,在下文中一共展示了MonoTlsSettings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateSslStream
public override IMonoSslStream CreateSslStream (
Stream innerStream, bool leaveInnerStreamOpen,
MonoTlsSettings settings = null)
{
var impl = new MNS.Private.LegacySslStream (innerStream, leaveInnerStreamOpen, this, settings);
return new MNS.Private.MonoSslStreamImpl (impl);
}
示例2: CreateSslStream
public override IMonoSslStream CreateSslStream (
Stream innerStream, bool leaveInnerStreamOpen,
MonoTlsSettings settings = null)
{
return new MonoBtlsStream (
innerStream, leaveInnerStreamOpen, settings, this);
}
示例3: CreateSslStream
internal static MonoSslStream CreateSslStream (
Stream innerStream, bool leaveInnerStreamOpen,
MonoTlsProvider provider, MonoTlsSettings settings = null)
{
var stream = new MonoNewTlsStream (innerStream, leaveInnerStreamOpen, provider, settings);
return new MonoSslStreamImpl (stream);
}
示例4: GetInternalValidator
#pragma warning disable 618
internal static ICertificateValidator GetInternalValidator (MonoTlsProvider provider, MonoTlsSettings settings)
{
if (settings == null)
return new ChainValidationHelper (provider, null, false, null, null);
if (settings.CertificateValidator != null)
return settings.CertificateValidator;
return new ChainValidationHelper (provider, settings, false, null, null);
}
示例5: CreateSslStream
internal static MonoSslStream CreateSslStream (
Stream innerStream, bool leaveInnerStreamOpen,
ICertificateValidator certificateValidator,
MonoTlsSettings settings = null)
{
var stream = new MonoNewTlsStream (innerStream, leaveInnerStreamOpen, certificateValidator, settings);
return new MonoSslStreamImpl (stream);
}
示例6: CreateTlsContext
public override IMonoTlsContext CreateTlsContext (
string hostname, bool serverMode, TlsProtocols protocolFlags,
X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
bool remoteCertRequired, MonoEncryptionPolicy encryptionPolicy,
MonoTlsSettings settings)
{
throw new NotSupportedException ();
}
示例7: GetCertificateValidator
internal static MSI.ICertificateValidator GetCertificateValidator (ICertificateValidator validator)
{
if (validator == null)
return null;
var settings = new MSI.MonoTlsSettings ();
settings.ServerCertificateValidationCallback = (s, c, ch, e) => {
return ((CertificateValidator)validator).ValidationCallback (s, c, ch, (SslPolicyErrors)e);
};
return MSI.CertificateValidationHelper.CreateDefaultValidator (settings);
}
示例8: TlsConfiguration
public TlsConfiguration (TlsProtocols protocols, MonoTlsSettings settings, string targetHost)
{
supportedProtocols = protocols;
requestedProtocol = CheckProtocol (settings, ref supportedProtocols, false);
TlsSettings = settings;
TargetHost = targetHost;
if (settings != null)
UserSettings = (UserSettings)settings.UserSettings;
if (UserSettings == null)
UserSettings = new UserSettings ();
RenegotiationFlags = DefaultRenegotiationFlags;
}
示例9: CreateClient
public static MonoNewTlsStream CreateClient (
Stream innerStream, bool leaveOpen, MonoTlsProvider provider, MonoTlsSettings settings,
string targetHost, PSSCX.X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
{
var stream = new MonoNewTlsStream (innerStream, leaveOpen, provider, settings);
try {
stream.AuthenticateAsClient (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation);
} catch (Exception ex) {
var tlsEx = stream.LastError;
if (tlsEx != null)
throw new AggregateException (ex, tlsEx);
throw;
}
return stream;
}
示例10: SslStream
internal SslStream (Stream innerStream, bool leaveInnerStreamOpen, EncryptionPolicy encryptionPolicy, MonoTlsProvider provider, MonoTlsSettings settings)
: base (innerStream, leaveInnerStreamOpen)
{
if (encryptionPolicy != EncryptionPolicy.RequireEncryption && encryptionPolicy != EncryptionPolicy.AllowNoEncryption && encryptionPolicy != EncryptionPolicy.NoEncryption)
throw new ArgumentException (SR.GetString (SR.net_invalid_enum, "EncryptionPolicy"), "encryptionPolicy");
var validationHelper = MNS.ChainValidationHelper.CloneWithCallbackWrapper (provider, ref settings, myUserCertValidationCallbackWrapper);
LocalCertSelectionCallback selectionCallback = null;
if (validationHelper.HasCertificateSelectionCallback)
selectionCallback = validationHelper.SelectClientCertificate;
var internalProvider = new MNS.Private.MonoTlsProviderWrapper (provider);
_Configuration = new MyConfiguration (internalProvider, settings, this);
_SslState = new SslState (innerStream, null, selectionCallback, encryptionPolicy, _Configuration);
}
示例11: CreateSslStream
public override MonoSslStream CreateSslStream (
Stream innerStream, bool leaveInnerStreamOpen,
MonoTlsSettings settings = null)
{
if (settings != null)
throw new NotSupportedException ("Mono-specific API Extensions not available.");
RemoteCertificateValidationCallback validation_callback = null;
LocalCertificateSelectionCallback selection_callback = null;
if (settings != null) {
validation_callback = ConvertCallback (settings.RemoteCertificateValidationCallback);
selection_callback = ConvertCallback (settings.ClientCertificateSelectionCallback);
}
return new DotNetSslStreamImpl (innerStream, leaveInnerStreamOpen, validation_callback, selection_callback);
}
示例12: SslStream
internal SslStream (Stream innerStream, bool leaveInnerStreamOpen, EncryptionPolicy encryptionPolicy, MonoTlsSettings settings)
: base (innerStream, leaveInnerStreamOpen)
{
#if MARTIN_FIXME
if (encryptionPolicy != EncryptionPolicy.RequireEncryption && encryptionPolicy != EncryptionPolicy.AllowNoEncryption && encryptionPolicy != EncryptionPolicy.NoEncryption)
throw new ArgumentException (SR.GetString (SR.net_invalid_enum, "EncryptionPolicy"), "encryptionPolicy");
var validationHelper = ChainValidationHelper.CloneWithCallbackWrapper (ref settings, myUserCertValidationCallbackWrapper);
LocalCertSelectionCallback selectionCallback = null;
if (validationHelper.HasCertificateSelectionCallback)
selectionCallback = validationHelper.SelectClientCertificate;
_Configuration = new MyConfiguration (settings, this);
_SslState = new SslState (innerStream, null, selectionCallback, encryptionPolicy, _Configuration);
#else
throw new NotImplementedException ();
#endif
}
示例13: CloneWithCallbackWrapper
/*
* This is a hack which is used in SslStream - see ReferenceSources/SslStream.cs for details.
*/
internal static ChainValidationHelper CloneWithCallbackWrapper (MonoTlsProvider provider, ref MonoTlsSettings settings, ServerCertValidationCallbackWrapper wrapper)
{
var helper = (ChainValidationHelper)settings.CertificateValidator;
if (helper == null)
helper = new ChainValidationHelper (provider, settings, true, null, wrapper);
else
helper = new ChainValidationHelper (helper, provider, settings, wrapper);
settings = helper.settings;
return helper;
}
示例14: MonoTlsSettings
MonoTlsSettings (MonoTlsSettings other)
{
RemoteCertificateValidationCallback = other.RemoteCertificateValidationCallback;
ClientCertificateSelectionCallback = other.ClientCertificateSelectionCallback;
checkCertName = other.checkCertName;
checkCertRevocationStatus = other.checkCertRevocationStatus;
UseServicePointManagerCallback = other.useServicePointManagerCallback;
skipSystemValidators = other.skipSystemValidators;
callbackNeedsChain = other.callbackNeedsChain;
UserSettings = other.UserSettings;
EnabledProtocols = other.EnabledProtocols;
TrustAnchors = other.TrustAnchors;
cloned = true;
}
示例15: CloneWithValidator
public MonoTlsSettings CloneWithValidator (ICertificateValidator validator)
{
if (cloned) {
this.certificateValidator = validator;
return this;
}
var copy = new MonoTlsSettings (this);
copy.certificateValidator = validator;
return copy;
}