syd 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #------------------------------------------------------------------------------
  2. # $File: syd,v 1.1 2025/09/11 01:49:40 christos Exp $
  3. # syd: file(1) magic for syd(1) encrypted files
  4. #
  5. # From: Ali Polatel <alip@chesswob.org>
  6. # Documentation: https://man.exherbo.org/syd.7.html#Crypt_Sandboxing
  7. # No defined extension yet; files are recognized by magic header only.
  8. #
  9. # Layout:
  10. # 0..3 : "\x7fSYD"
  11. # 4 : version byte (current API: 3)
  12. # 5..36 : HMAC (32 bytes, SHA256)
  13. # 37..52 : IV (16 bytes)
  14. # 53.. : ciphertext (AES-256-CTR)
  15. #------------------------------------------------------------------------------
  16. # Header and version
  17. 0 string \x7fSYD SYD encrypted file
  18. >4 ubyte x \b, version %u
  19. # Version 3: algorithm + HMAC/IV as hex blobs + ciphertext size
  20. >>4 ubyte =3 \b, AES-256-CTR; HMAC-SHA256:
  21. >>>5 belong x \b%08x
  22. >>>9 belong x \b%08x
  23. >>>13 belong x \b%08x
  24. >>>17 belong x \b%08x
  25. >>>21 belong x \b%08x
  26. >>>25 belong x \b%08x
  27. >>>29 belong x \b%08x
  28. >>>33 belong x \b%08x
  29. >>>37 belong x \b, IV:%08x
  30. >>>41 belong x \b%08x
  31. >>>45 belong x \b%08x
  32. >>>49 belong x \b%08x
  33. >>>-0 offset-53 x \b, ciphertext %llu bytes
  34. # End of syd