Private Sub Frame_ViewOpened(ByVal sender As Variant, ByVal view As Attachmate_Reflection_Objects.view)
Dim terminal As Attachmate_Reflection_Objects_Emulation_IbmHosts.ibmTerminal
Dim HostAddress As String
'Apply security only to IbmTerminal (IBM3270 or IBM5250) sessions
If TypeName(view.control) = "IbmTerminal" Then
Set terminal = view.control
HostAddress = terminal.HostAddress
With terminal
'If security is not enabled and the host name starts with XYZ, change to a secure session
If .EnableTelnetEncryption = False And Left(UCase(Trim(HostAddress)), 3) = "XYZ" Then
'Make sure the terminal is disconnected before changing settings
If .IsConnected = True Then
.Disconnect
End If
.EnableTelnetEncryption = True
.TLS_SSLVersion = TLSSSLVersionOption_TLS_V1_2
'Specify that the host name in the certificate must match the name of the host you are connecting to
.TelnetEncryptionVerifyHostName = True
'You may need to set additional properties to connect, depending on your host configuration.
'For example, you may need to select a set of custom ciphers in the Security Properties dialog box
'and then specify to use them as shown below
'.TelnetEncryptionStrength = TelnetEncryptionStrengthOption_Custom
.HostAddress = "xyz.exampleDomain.com"
.Port = 723
'Connect after changing the settings
.Connect
End If
End With
End If
End Sub