@@ -218,19 +218,27 @@ protected override void Dispose (bool disposing)
218
218
219
219
public override void StartHandshake ( )
220
220
{
221
- // TODO: Check if we started a handshake already?
222
- // TODO, Not supported by UnityTls as of writing
221
+ // TODO: Client->Server authentification is not supported by UnityTls as of writing
223
222
if ( IsServer && AskForClientCertificate ) {
224
223
throw new NotImplementedException ( "No support for server-sided client certificate check yet." ) ;
225
224
}
226
225
227
- // TODO: Set ciphers from Settings.EnabledCiphers
226
+ if ( Settings != null && Settings . EnabledCiphers != null ) {
227
+ var ciphers = new UnityTls . unitytls_ciphersuite [ Settings . EnabledCiphers . Length ] ;
228
+ for ( int i = 0 ; i < ciphers . Length ; i ++ )
229
+ ciphers [ i ] = ( UnityTls . unitytls_ciphersuite ) Settings . EnabledCiphers [ i ] ;
230
+
231
+ var errorState = unityTlsNative . unitytls_errorstate_create ( ) ;
232
+ fixed ( UnityTls . unitytls_ciphersuite * ciphersPtr = ciphers )
233
+ unityTlsNative . unitytls_tlsctx_set_supported_ciphersuites ( m_TlsContext , ciphersPtr , ciphers . Length , & errorState ) ;
234
+ Unity . Debug . CheckAndThrow ( errorState , "Failed to set list of supported ciphers" , AlertDescription . HandshakeFailure ) ;
235
+ }
228
236
}
229
237
230
238
public override bool ProcessHandshake ( )
231
239
{
232
- var errorState = UnityTls . GetInterface ( ) . unitytls_errorstate_create ( ) ;
233
- var result = UnityTls . GetInterface ( ) . unitytls_tlsctx_process_handshake ( m_TlsContext , & errorState ) ;
240
+ var errorState = unityTlsNative . unitytls_errorstate_create ( ) ;
241
+ var result = unityTlsNative . unitytls_tlsctx_process_handshake ( m_TlsContext , & errorState ) ;
234
242
if ( errorState . code == UnityTls . unitytls_error_code . UNITYTLS_USER_WOULD_BLOCK )
235
243
return false ;
236
244
0 commit comments