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