---
title: Strip a leading header from a byte payload
summary: Strip a leading transport header so a payload starts at its own signature.
status: draft
owner: saif-docgen
last_reviewed: 2026-09-15
library: SAIF.Framework.Common
reference_type: package
operation_id: OP-024
trigger: Caller has a document payload prefixed with transport bytes and needs it to start at its own signature (e.g. "%PDF-")
---

# Strip a leading header from a byte payload

Strip a leading transport header so a payload starts at its own signature, triggered when caller has a document payload prefixed with transport bytes and needs it to start at its own signature (e.g. "%PDF-").

| Field | Value |
| --- | --- |
| **Operation ID** | OP-024 |
| **Trigger** | Caller has a document payload prefixed with transport bytes and needs it to start at its own signature (e.g. "%PDF-") |
| **Inputs** | `input`, `searchFor`, `maxBytesToSearch` |
| **Outputs** | Trimmed `Byte[]`, `out bool found` |
| **Primary components** | ``ByteExtensions.StripHeader(this Byte[] input, string searchFor, out bool found, int maxBytesToSearch = 100)`` |
| **Entry point** | `Common/SAIF.Common/Extensions/ByteExtensions.cs` |

## Steps

1. Call OP-023 to find the signature, capping the scan at `maxBytesToSearch` (default 100 bytes). ([BR-053](../business-rules.md#br-053-a-string-search-pattern-over-a-binary-payload-is-encoded-as-ascii%2C-not-unicode), [BR-055](../business-rules.md#br-055-a-byte-search-may-be-capped))
2. Initialise `found = false`.
3. If the signature was found at a position greater than zero, set `found = true` and return the payload skipped forward to that position. ([BR-056](../business-rules.md#br-056-a-header-is-stripped-only-when-the-signature-is-found-at-a-position-greater-than-zero))
4. Otherwise — not found, or found at index 0 — return the original array unchanged with `found = false`. ([BR-056](../business-rules.md#br-056-a-header-is-stripped-only-when-the-signature-is-found-at-a-position-greater-than-zero))

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start(["Payload prefixed with<br>transport bytes"]) --> S1["Find signature via OP-023<br>(cap scan at maxBytesToSearch,<br>default 100 bytes)"]
	S1 --> S2["Initialise found = false"]
	S2 --> D1{"Signature found at position<br>greater than zero?"}
	D1 -->|Yes| S3["Set found = true; return<br>payload skipped forward<br>to that position"]
	D1 -->|No| S4["Return original array<br>unchanged with found = false"]
	S3 --> End(["Trimmed payload returned"])
	S4 --> End
```

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

## Sources
- `Common/SAIF.Common/Extensions/ByteExtensions.cs`
