Skip to content

Commit 913f9fe

Browse files
committed
docs: add Mechanics section to configuration.md
1 parent 9a14685 commit 913f9fe

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

docsource/configuration.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,54 @@ To retrieve the full list of product codes available to your account, call the `
189189
> Note: SSL/TLS products (codes 838–846) are supported on standard accounts. Private PKI (100, 104), S/MIME (894), and document-signing products (819–827) require special provisioning by eMudhra and are not available on standard SSL/TLS accounts — ordering them returns EMS-1162.
190190
191191

192+
## Mechanics
193+
194+
### Authentication
195+
196+
Every CERTInext API call is an HTTP POST with a JSON body. There is no Authorization header. Instead, the body carries a `meta` block with an `authKey` field computed as:
197+
198+
```
199+
authKey = SHA256(accessKey + requestTs + requestTxnId)
200+
```
201+
202+
Where `requestTs` is the ISO 8601 timestamp and `requestTxnId` is a unique transaction UUID generated per request. The raw access key is never transmitted — only the derived hash is sent. This computation happens automatically on every outbound call. When `AuthMode` is `OAuth`, the gateway obtains a bearer token via the configured client credentials flow and injects it into the `meta` block instead.
203+
204+
### Enrollment Decision Logic
205+
206+
When the gateway calls `Enroll`, the plugin selects between three paths based on the enrollment type and the age of the prior certificate:
207+
208+
1. **New enrollment** — no prior certificate exists. A new `GenerateOrderSSL` request is submitted.
209+
2. **Renewal** — a prior certificate exists and its expiry is within the `RenewalWindowDays` threshold (default: 90 days). The plugin calls the CERTInext renew API, which reuses the existing subscription term.
210+
3. **Reissue** — a prior certificate exists but is outside the renewal window. A new order is placed with the updated CSR/subject, replacing the prior certificate under a new subscription.
211+
212+
The `RenewalWindowDays` template parameter controls the renewal/reissue boundary per certificate template.
213+
214+
### Order Lifecycle and Pending Approval
215+
216+
CERTInext orders pass through several internal status stages before a certificate is issued. The plugin maps these to Keyfactor enrollment statuses as follows:
217+
218+
- **Issued** (status 9, 20) → certificate returned immediately.
219+
- **Pending approval** (status 2, 8, 15, 24) → enrollment returns a pending status to Command. If `AutoApprove` is enabled on the template, the plugin attempts automatic approval before returning.
220+
- **Rejected / cancelled** (status 4, 5, 13, 14) → enrollment fails with an error.
221+
222+
The gateway polls the `TrackOrder` endpoint during sync to pick up certificates that were approved after the initial enrollment call.
223+
224+
### Synchronization
225+
226+
Synchronization uses the `GetOrderReport` endpoint with paginated results (controlled by `PageSize`, default 100, max 500). Each page is fetched sequentially until all orders are retrieved. The plugin maps each order's status to a Keyfactor certificate status and returns the result set to the gateway framework, which reconciles it against the Command inventory.
227+
228+
Expired certificates are included by default. Set `IgnoreExpired: true` on the connector to skip them during sync.
229+
230+
### Product Code Resolution
231+
232+
When an enrollment request arrives, the numeric CERTInext product code is resolved in this order:
233+
234+
1. `ProductCode` template parameter (explicit override — use for sandbox or non-standard codes).
235+
2. `ProfileId` template parameter (deprecated alias, accepted for backward compatibility).
236+
3. Default production code looked up from the selected product name (e.g. **DV SSL**`838`).
237+
238+
If none of these yield a code, enrollment fails with a validation error.
239+
192240
## Architecture
193241

194242
{% include 'architecture.md' %}

0 commit comments

Comments
 (0)