add detached header and keyfile support