synta 0.2.4

ASN.1 parser, decoder, and encoder library with DER/BER support and C FFI
Documentation
# Encoding Rules: DER, BER, CER


## Constants and enumerations

| Name | Type | Description |
|---|---|---|
| `Encoding.DER` | `Encoding` | Distinguished Encoding Rules |
| `Encoding.BER` | `Encoding` | Basic Encoding Rules |
| `Encoding.CER` | `Encoding` | Canonical Encoding Rules |
| `SyntaError` | exception class | Raised on ASN.1 parse or encode failures |
| `__version__` | `str` | Package version string (from `Cargo.toml`) |

## Encoding

Pass an `Encoding` value when constructing a `Decoder` or `Encoder`:

```python
import synta

# DER — deterministic, used for X.509 certificates and PKCS structures
decoder = synta.Decoder(data, synta.Encoding.DER)

# BER — accepts indefinite-length forms (PKCS#7, LDAP, SNMP)
decoder = synta.Decoder(data, synta.Encoding.BER)

# CER — canonical streaming subset of BER
decoder = synta.Decoder(data, synta.Encoding.CER)
```

The `Decoder` and `Encoder` classes accept any `Encoding` value.  Most PKI
standards mandate DER.  Use BER when reading PKCS#7 files from older tools
that emit indefinite-length encodings.

## API types

```python
import synta

# DER encoder example
encoder = synta.Encoder(synta.Encoding.DER)
encoder.encode_integer(42)
out = encoder.finish()   # b'\x02\x01\x2a'
```

See [Decoder](decoder.md) and [Encoder](encoder.md) for full API reference.