> ## Documentation Index
> Fetch the complete documentation index at: https://wiki.krkn.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Parse

# parse

Parse and inspect local certificate and key files. Decodes PEM and PFX/PKCS#12 files and pretty-prints their contents.

***

## Usage

```text theme={null}
r4t parse <subcommand> <file> [flags]
```

***

## Subcommands

### `parse pem`

Decode and display a PEM-encoded certificate or certificate chain.

```bash theme={null}
# Parse a PEM certificate
r4t parse pem /tmp/user.crt

# Parse a PEM file with a separate private key
r4t parse pem /tmp/user.crt --key /tmp/user.key

# Parse a PEM that contains the full chain (cert + intermediates + key)
r4t parse pem /tmp/chain.pem
```

| Flag    | Short | Description                             |
| ------- | ----- | --------------------------------------- |
| `--key` | `-k`  | Path to a separate PEM private key file |

Displays:

* Subject and Issuer DNs
* Serial number
* Validity period (Not Before / Not After)
* Subject Alternative Names (DNS, IP, UPN, Email)
* Extended Key Usage (EKU) OIDs
* Key usage flags
* CA flag and path length constraint
* Whether a private key is present

***

### `parse pfx`

Decode and display a PKCS#12 / PFX file.

```bash theme={null}
# Parse a PFX with no password
r4t parse pfx /tmp/user.pfx

# Parse a PFX with a password
r4t parse pfx /tmp/user.pfx --password 'P@ssword1'

# Parse a non-standard PFX (legacy mode)
r4t parse pfx /tmp/legacy.pfx --legacy
```

| Flag         | Short | Description                                               |
| ------------ | ----- | --------------------------------------------------------- |
| `--password` | `-p`  | Password for the PFX file (leave empty for passwordless)  |
| `--legacy`   | —     | Use legacy decode mode for non-standard / older PFX files |

Displays:

* All certificates in the PFX (leaf + chain)
* Private key presence and type
* Subject and Issuer for each certificate
* SANs, EKUs, and validity for each certificate
* Friendly names and bag attributes

***

## Use Cases

```bash theme={null}
# Verify a certificate obtained via adcs req
r4t parse pfx /tmp/admin.pfx

# Check the UPN SAN in a certificate before using it for PKINIT
r4t parse pem /tmp/user.crt

# Inspect a certificate from a stored credential
r4t creds list --auth  # note the pfx_file path
r4t parse pfx /path/from/creds/list
```
