# Asn1 der tree render

`asn1-der-tree-render` · version 1.0.0 · Structured formats · free, no key needed

Render one DER value as an escaped text tree of paths, tags, lengths, and previews.

**Use when you need to: render a der value as text · escaped asn1 der tree · indented der tag and length outline.**

## Decide before calling

Read the [versioned contract](/v1/tools/asn1-der-tree-render/versions/1.0.0) and the supported scope below. Reuse `asn1-der-tree-render@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `asn1-der-tree-render@1.0.0` for render a der value as text. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- render a der value as text
- escaped asn1 der tree
- indented der tag and length outline
- preview primitive der bytes safely
- print a bounded der tree
- show der nesting as escaped lines
- ציור עץ עם בריחת תווים

## Not supported

- return raw content hex for every node
- extract one node by path
- check a signature

## Behavior

- Produce one line per node, in preorder, joined by "\n" with no trailing newline. Indentation is two spaces per depth. A line is path, tag class, tag number, "constructed" or "primitive", then offset, header length, and content length.
- A primitive line appends content="..." . Bytes 0x20 through 0x7E are copied, except backslash and double quote, which are escaped. Every other byte is \xHH. The preview stops after 16 content bytes and then appends three dots. Constructed lines have no content preview.
- The preview cap does not drop nodes. Depth above 12, more than 96 nodes, more than 512 decoded bytes, or a text result above 32768 UTF-8 bytes is limit_exceeded.
- ObjectDescriptor (universal 7) must be primitive and CHARACTER STRING (universal 29) must be constructed. The walker rejects the other inferable DER form and content errors. The rendered text never invents an X.509 name for a tag.
- More than 512 decoded bytes fails as limit_exceeded before a hex-syntax check.
- Disclaimer: format transform only; provides no confidentiality, integrity, or authenticity.

## Input

- `der_hex` (string, required): min length 4; max length 1024; pattern `^([0-9a-f]{2})+$`

## Output

- `der_bytes` (integer, required): min 2; max 512
- `node_count` (integer, required): min 1; max 96
- `line_count` (integer, required): min 1; max 96
- `text` (string, required): min length 1; max length 16384

## Limits

- max der bytes: 512
- max depth: 12
- max nodes: 96
- max output bytes: 32768
- max preview bytes: 16

## Example

Request input:

```json
{
  "der_hex": "0500"
}
```

Response:

```json
{
  "result": {
    "der_bytes": 2,
    "node_count": 1,
    "line_count": 1,
    "text": "0 universal 5 primitive offset=0 header=2 content=0 content=\"\""
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "asn1-der-tree-render",
  "version": "1.0.0",
  "input": {
    "der_hex": "0500"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/asn1-der-tree-render/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"der_hex":"0500"}'
```

The machine-readable contract is at [/v1/tools/asn1-der-tree-render/versions/1.0.0](/v1/tools/asn1-der-tree-render/versions/1.0.0).

### CLI

```sh
node cli.mjs run asn1-der-tree-render 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Asn1 der parse](/tools/asn1-der-parse): Parse one ASN.1 DER value into a flat schema-free TLV node list.
- [Asn1 der encode tree](/tools/asn1-der-encode-tree): Encode a schema-free ASN.1 node list as one canonical DER value.
- [Asn1 der path list](/tools/asn1-der-path-list): List numeric paths, offsets, lengths, and tag class for every node in one DER value.
- [Asn1 der node extract](/tools/asn1-der-node-extract): Extract one DER node by a numeric path, with header, content, and child paths.
- [Asn1 der primitive decode](/tools/asn1-der-primitive-decode): Decode one universal DER primitive from lowercase hex into typed fields.
- [Asn1 der primitive encode](/tools/asn1-der-primitive-encode): Encode one universal DER primitive from typed fields into lowercase hex.
