gortsplib icon indicating copy to clipboard operation
gortsplib copied to clipboard

fix: prioritize MD5 digest over SHA256 for better camera compatibility

Open ljhljh127 opened this issue 4 months ago • 2 comments

  • Change algorithm selection to prefer MD5 digest over SHA256
  • Improves compatibility with cameras that don't support QOP
  • Aligns with FFmpeg behavior and VDK library approach
  • Fixes 401 authentication errors with multi-algorithm cameras

ljhljh127 avatar Aug 13 '25 02:08 ljhljh127

Problem

gortsplib prioritizes SHA256 digest authentication over MD5, but doesn't support QOP (Quality of Protection) parameters required by SHA256. This causes 401 authentication failures with cameras offering multiple digest algorithms.

Root Cause

Current algorithm selection logic always chooses SHA256 when available, regardless of QOP support:

(auth.Algorithm != nil && *auth.Algorithm == headers.AuthAlgorithmSHA256)

ljhljh127 avatar Aug 13 '25 02:08 ljhljh127

Hello, prioritizing MD5 over SHA256 would create a security issue.

Can you write the manufacturer and model of the camera you're having trouble with?

Can you post a network dump or example of RTSP communications between the camera and a server?

aler9 avatar Sep 03 '25 09:09 aler9