docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class SecureParameterExtensions

    Extensions for SecureNetworkProtocolParameter.

    Inheritance
    object
    SecureParameterExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.Networking.Transport.TLS
    Assembly: Unity.Networking.Transport.dll
    Syntax
    public static class SecureParameterExtensions

    Methods

    GetSecureParameters(ref NetworkSettings)

    Get the SecureNetworkProtocolParameter from the settings.

    Declaration
    public static SecureNetworkProtocolParameter GetSecureParameters(this ref NetworkSettings settings)
    Parameters
    Type Name Description
    NetworkSettings settings

    NetworkSettings to get parameters from.

    Returns
    Type Description
    SecureNetworkProtocolParameter

    The SecureNetworkProtocolParameter stored in the settings.

    WithSecureClientParameters(ref NetworkSettings, string)

    Set client security parameters (for use with official CA certificates).

    Declaration
    public static ref NetworkSettings WithSecureClientParameters(this ref NetworkSettings settings, string serverName)
    Parameters
    Type Name Description
    NetworkSettings settings

    NetworkSettings to modify.

    string serverName

    Hostname of the server to connect to.

    Returns
    Type Description
    NetworkSettings

    Modified NetworkSettings.

    WithSecureClientParameters(ref NetworkSettings, string, string)

    Set client security parameters (server authentication only).

    Declaration
    public static ref NetworkSettings WithSecureClientParameters(this ref NetworkSettings settings, string caCertificate, string serverName)
    Parameters
    Type Name Description
    NetworkSettings settings

    NetworkSettings to modify.

    string caCertificate

    CA certificate that signed the server's certificate (PEM format).

    string serverName

    Common name (CN) in the server certificate.

    Returns
    Type Description
    NetworkSettings

    Modified NetworkSettings.

    WithSecureClientParameters(ref NetworkSettings, string, string, string, string)

    Set client security parameters (for client authentication).

    Declaration
    public static ref NetworkSettings WithSecureClientParameters(this ref NetworkSettings settings, string certificate, string privateKey, string caCertificate, string serverName)
    Parameters
    Type Name Description
    NetworkSettings settings

    NetworkSettings to modify.

    string certificate

    Client's certificate (PEM format).

    string privateKey

    Client's private key (PEM format).

    string caCertificate

    CA certificate that signed the server's certificate (PEM format).

    string serverName

    Common name (CN) in the server certificate.

    Returns
    Type Description
    NetworkSettings

    Modified NetworkSettings.

    WithSecureClientParameters(ref NetworkSettings, ref FixedString32Bytes, uint, uint, uint)

    Set client security parameters (for use with official CA certificates).

    Declaration
    public static ref NetworkSettings WithSecureClientParameters(this ref NetworkSettings settings, ref FixedString32Bytes serverName, uint readTimeout = 0, uint handshakeTimeoutMax = 60000, uint handshakeTimeoutMin = 1000)
    Parameters
    Type Name Description
    NetworkSettings settings

    NetworkSettings to modify.

    FixedString32Bytes serverName

    Hostname of the server to connect to.

    uint readTimeout

    Secure read timeout (in milliseconds).

    uint handshakeTimeoutMax

    Maximum handshake timeout (in milliseconds).

    uint handshakeTimeoutMin

    Minimum handshake timeout (in milliseconds).

    Returns
    Type Description
    NetworkSettings

    Modified NetworkSettings.

    WithSecureClientParameters(ref NetworkSettings, ref FixedString4096Bytes, ref FixedString32Bytes, uint, uint, uint)

    Set client security parameters (server authentication only).

    Declaration
    public static ref NetworkSettings WithSecureClientParameters(this ref NetworkSettings settings, ref FixedString4096Bytes caCertificate, ref FixedString32Bytes serverName, uint readTimeout = 0, uint handshakeTimeoutMax = 60000, uint handshakeTimeoutMin = 1000)
    Parameters
    Type Name Description
    NetworkSettings settings

    NetworkSettings to modify.

    FixedString4096Bytes caCertificate

    CA certificate that signed the server's certificate (PEM format).

    FixedString32Bytes serverName

    Common name (CN) in the server certificate.

    uint readTimeout

    Secure read timeout (in milliseconds).

    uint handshakeTimeoutMax

    Maximum handshake timeout (in milliseconds).

    uint handshakeTimeoutMin

    Minimum handshake timeout (in milliseconds).

    Returns
    Type Description
    NetworkSettings

    Modified NetworkSettings.

    WithSecureClientParameters(ref NetworkSettings, ref FixedString4096Bytes, ref FixedString4096Bytes, ref FixedString4096Bytes, ref FixedString32Bytes, uint, uint, uint)

    Set client security parameters (for client authentication).

    Declaration
    public static ref NetworkSettings WithSecureClientParameters(this ref NetworkSettings settings, ref FixedString4096Bytes certificate, ref FixedString4096Bytes privateKey, ref FixedString4096Bytes caCertificate, ref FixedString32Bytes serverName, uint readTimeout = 0, uint handshakeTimeoutMax = 60000, uint handshakeTimeoutMin = 1000)
    Parameters
    Type Name Description
    NetworkSettings settings

    NetworkSettings to modify.

    FixedString4096Bytes certificate

    Client's certificate (PEM format).

    FixedString4096Bytes privateKey

    Client's private key (PEM format).

    FixedString4096Bytes caCertificate

    CA certificate that signed the server's certificate (PEM format).

    FixedString32Bytes serverName

    Common name (CN) in the server certificate.

    uint readTimeout

    Secure read timeout (in milliseconds).

    uint handshakeTimeoutMax

    Maximum handshake timeout (in milliseconds).

    uint handshakeTimeoutMin

    Minimum handshake timeout (in milliseconds).

    Returns
    Type Description
    NetworkSettings

    Modified NetworkSettings.

    WithSecureParameters(ref NetworkSettings, ref FixedString4096Bytes, ref FixedString32Bytes, SecureTransportProtocol, SecureClientAuthPolicy, uint, uint, uint)

    Declaration
    [Obsolete("Use WithSecureClientParameters or WithSecureServerParameters instead.")]
    public static ref NetworkSettings WithSecureParameters(this ref NetworkSettings settings, ref FixedString4096Bytes pem, ref FixedString32Bytes hostname, SecureTransportProtocol protocol = SecureTransportProtocol.DTLS, SecureClientAuthPolicy clientAuthenticationPolicy = SecureClientAuthPolicy.Optional, uint sslReadTimeoutMs = 0, uint sslHandshakeTimeoutMax = 60000, uint sslHandshakeTimeoutMin = 1000)
    Parameters
    Type Name Description
    NetworkSettings settings
    FixedString4096Bytes pem
    FixedString32Bytes hostname
    SecureTransportProtocol protocol
    SecureClientAuthPolicy clientAuthenticationPolicy
    uint sslReadTimeoutMs
    uint sslHandshakeTimeoutMax
    uint sslHandshakeTimeoutMin
    Returns
    Type Description
    NetworkSettings

    WithSecureParameters(ref NetworkSettings, ref FixedString4096Bytes, ref FixedString4096Bytes, ref FixedString4096Bytes, ref FixedString32Bytes, SecureTransportProtocol, SecureClientAuthPolicy, uint, uint, uint)

    Declaration
    [Obsolete("Use WithSecureClientParameters or WithSecureServerParameters instead.")]
    public static ref NetworkSettings WithSecureParameters(this ref NetworkSettings settings, ref FixedString4096Bytes pem, ref FixedString4096Bytes rsa, ref FixedString4096Bytes rsaKey, ref FixedString32Bytes hostname, SecureTransportProtocol protocol = SecureTransportProtocol.DTLS, SecureClientAuthPolicy clientAuthenticationPolicy = SecureClientAuthPolicy.Optional, uint sslReadTimeoutMs = 0, uint sslHandshakeTimeoutMax = 60000, uint sslHandshakeTimeoutMin = 1000)
    Parameters
    Type Name Description
    NetworkSettings settings
    FixedString4096Bytes pem
    FixedString4096Bytes rsa
    FixedString4096Bytes rsaKey
    FixedString32Bytes hostname
    SecureTransportProtocol protocol
    SecureClientAuthPolicy clientAuthenticationPolicy
    uint sslReadTimeoutMs
    uint sslHandshakeTimeoutMax
    uint sslHandshakeTimeoutMin
    Returns
    Type Description
    NetworkSettings

    WithSecureServerParameters(ref NetworkSettings, string, string)

    Set server security parameters (server authentication only).

    Declaration
    public static ref NetworkSettings WithSecureServerParameters(this ref NetworkSettings settings, string certificate, string privateKey)
    Parameters
    Type Name Description
    NetworkSettings settings

    NetworkSettings to modify.

    string certificate

    Server's certificate chain (PEM format).

    string privateKey

    Server's private key (PEM format).

    Returns
    Type Description
    NetworkSettings

    Modified NetworkSettings.

    WithSecureServerParameters(ref NetworkSettings, string, string, string, string, SecureClientAuthPolicy)

    Set server security parameters (for client authentication).

    Declaration
    public static ref NetworkSettings WithSecureServerParameters(this ref NetworkSettings settings, string certificate, string privateKey, string caCertificate, string clientName, SecureClientAuthPolicy clientAuthenticationPolicy = SecureClientAuthPolicy.Required)
    Parameters
    Type Name Description
    NetworkSettings settings

    NetworkSettings to modify.

    string certificate

    Server's certificate chain (PEM format).

    string privateKey

    Server's private key (PEM format).

    string caCertificate

    CA certificate that signed the client certificates (PEM format).

    string clientName

    Common name (CN) in the client certificates.

    SecureClientAuthPolicy clientAuthenticationPolicy

    Client authentication policy.

    Returns
    Type Description
    NetworkSettings

    Modified NetworkSettings.

    WithSecureServerParameters(ref NetworkSettings, ref FixedString4096Bytes, ref FixedString4096Bytes, uint, uint, uint)

    Set server security parameters (server authentication only).

    Declaration
    public static ref NetworkSettings WithSecureServerParameters(this ref NetworkSettings settings, ref FixedString4096Bytes certificate, ref FixedString4096Bytes privateKey, uint readTimeout = 0, uint handshakeTimeoutMax = 60000, uint handshakeTimeoutMin = 1000)
    Parameters
    Type Name Description
    NetworkSettings settings

    NetworkSettings to modify.

    FixedString4096Bytes certificate

    Server's certificate chain (PEM format).

    FixedString4096Bytes privateKey

    Server's private key (PEM format).

    uint readTimeout

    Secure read timeout (in milliseconds).

    uint handshakeTimeoutMax

    Maximum handshake timeout (in milliseconds).

    uint handshakeTimeoutMin

    Minimum handshake timeout (in milliseconds).

    Returns
    Type Description
    NetworkSettings

    Modified NetworkSettings.

    WithSecureServerParameters(ref NetworkSettings, ref FixedString4096Bytes, ref FixedString4096Bytes, ref FixedString4096Bytes, ref FixedString32Bytes, SecureClientAuthPolicy, uint, uint, uint)

    Set server security parameters (for client authentication).

    Declaration
    public static ref NetworkSettings WithSecureServerParameters(this ref NetworkSettings settings, ref FixedString4096Bytes certificate, ref FixedString4096Bytes privateKey, ref FixedString4096Bytes caCertificate, ref FixedString32Bytes clientName, SecureClientAuthPolicy clientAuthenticationPolicy = SecureClientAuthPolicy.Required, uint readTimeout = 0, uint handshakeTimeoutMax = 60000, uint handshakeTimeoutMin = 1000)
    Parameters
    Type Name Description
    NetworkSettings settings

    NetworkSettings to modify.

    FixedString4096Bytes certificate

    Server's certificate chain (PEM format).

    FixedString4096Bytes privateKey

    Server's private key (PEM format).

    FixedString4096Bytes caCertificate

    CA certificate that signed the client certificates (PEM format).

    FixedString32Bytes clientName

    Common name (CN) in the client certificates.

    SecureClientAuthPolicy clientAuthenticationPolicy

    Client authentication policy.

    uint readTimeout

    Secure read timeout (in milliseconds).

    uint handshakeTimeoutMax

    Maximum handshake timeout (in milliseconds).

    uint handshakeTimeoutMin

    Minimum handshake timeout (in milliseconds).

    Returns
    Type Description
    NetworkSettings

    Modified NetworkSettings.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)