@@ -253,13 +253,14 @@ public bool Validate(IPAddress clientAddress, EDnsCookieOptionData cookie)
253253 if ( cookie . ClientCookie . Length != ClientCookieLen )
254254 return false ;
255255
256- ReadOnlySpan < byte > currentSecret = _secretManager . GetCurrentSecret ( ) ;
257- if ( ! currentSecret . IsEmpty &&
256+ byte [ ] currentSecret = _secretManager . GetCurrentSecret ( ) ;
257+
258+ if ( currentSecret != null && currentSecret . Length > 0 &&
258259 ValidateServerCookieWithSecret ( clientAddress , cookie . ClientCookie , cookie . ServerCookie , currentSecret ) )
259260 return true ;
260261
261- ReadOnlySpan < byte > previousSecret = _secretManager . GetPreviousSecret ( ) ;
262- if ( ! previousSecret . IsEmpty &&
262+ byte [ ] previousSecret = _secretManager . GetPreviousSecret ( ) ;
263+ if ( previousSecret != null && previousSecret . Length > 0 &&
263264 ValidateServerCookieWithSecret ( clientAddress , cookie . ClientCookie , cookie . ServerCookie , previousSecret ) )
264265 return true ;
265266
@@ -277,7 +278,7 @@ public EDnsCookieOptionData CreateResponseCookie(IPAddress clientAddress, EDnsCo
277278 if ( requestCookie . ClientCookie . Length != ClientCookieLen )
278279 throw new ArgumentException ( $ "Client cookie must be { ClientCookieLen } bytes.", nameof ( requestCookie ) ) ;
279280
280- ReadOnlySpan < byte > currentSecret = _secretManager . GetCurrentSecret ( ) ;
281+ byte [ ] currentSecret = _secretManager . GetCurrentSecret ( ) ;
281282 ValidateSecret ( currentSecret ) ;
282283
283284 byte [ ] serverCookie = ComputeServerCookie ( clientAddress , requestCookie . ClientCookie , currentSecret ) ;
0 commit comments