HID Reader Key Management NEW!

The OMNIKEY Reader Core (OKRC) module stores its cryptographic keys in internal key references (also called key slots). The endpoints below inject those keys, inspect what a slot holds, and read or change the module's own configuration parameters (OIDs).

Available only on version V7.

These operations follow the key hierarchy defined by the OMNIKEY SE Reader Core User Guide (PLT-06682, section 10.32). All key, key-reference and OID value fields are hexadecimal strings.

Key hierarchy

Keys are injected in a chain, each one wrapped by the key above it:

Level Endpoint Purpose
Default KEK hid_inject_default_kek Replaces the reader's factory Key Encryption Key. Must be done first — the factory KEK is obtained from HID Global.
Custom KEK hid_inject_custom_kek Injects an intermediate KEK into a key reference, wrapped by an existing KEK.
Media key hid_inject_media_key Injects a final card key (for example a MIFARE sector key), wrapped by an existing KEK.

Plain mode and wrapped mode

Every injection endpoint accepts the key in one of two modes, selected by the presence of the kek field in the request body — there is no separate mode parameter:

Mode How to select Meaning
Plain Send kek Both key and kek are sent in plain text. The device wraps the key internally before injecting it.
Wrapped Omit kek key is already wrapped by the caller, using NIST SP 800-38F KWP.

Plain mode is simpler to use; wrapped mode avoids ever transmitting the KEK to the device.

Change the default KEK

Replaces the reader's factory Key Encryption Key. This is the entry point of the whole key hierarchy: until it succeeds, no other key can be injected.

POST /hid_inject_default_kek.fcgi

Parameters

  • key (string): Required. The new KEK, as a hexadecimal string. In plain mode this is the key itself; in wrapped mode it is the KWP-wrapped key.
  • kek (string): Optional. The current KEK, in plain text. Sending it selects plain mode; omitting it selects wrapped mode.
  • key_id (string): Optional. An 8-byte identifier, freely chosen by the caller, stored alongside the key so it can be recognised later — hid_get_key_info returns this same value. Accepted only on this endpoint (see the note below).

Response

  • success (bool): true when the key was injected.

If the module rejects the injection, the call returns the error reported by the reader, or "Key injection failed" when the reader gives no reason.

Request example

Plain mode, replacing the factory KEK and tagging it with an identifier:

$.ajax({
    url: "/hid_inject_default_kek.fcgi?session=" + session,
    type: 'POST',
    contentType: 'application/json',
    data: JSON.stringify({
        key: "1111111111111111111111111111111111111111111111111111111111111111",
        kek: "65547522234A0B72CE20D458D91C1C2514362085C3C79A13641575F07CD4E627",
        key_id: "4445464B45593031"
    })
});

Response example

{
    "success": true
}

Inject an intermediate KEK

Injects a KEK into a target key reference, wrapped by a KEK already present in another reference.

POST /hid_inject_custom_kek.fcgi

Parameters

  • target_ref (string): Required. Key reference that will receive the key, as a hexadecimal string. Example: "03F001".
  • kek_ref (string): Required. Key reference holding the KEK used to wrap the new key. Example: "03F000".
  • key (string): Required. The key to inject, as a hexadecimal string.
  • kek (string): Optional. Selects plain mode, as described above.

Response

  • success (bool): true when the key was injected.

Request example

$.ajax({
    url: "/hid_inject_custom_kek.fcgi?session=" + session,
    type: 'POST',
    contentType: 'application/json',
    data: JSON.stringify({
        target_ref: "03F001",
        kek_ref: "03F000",
        key: "3333333333333333333333333333333333333333333333333333333333333333",
        kek: "1111111111111111111111111111111111111111111111111111111111111111"
    })
});

Inject a media key

Injects a final card key — the key actually used to read a smartcard, such as a MIFARE Classic sector key. Takes the same parameters as hid_inject_custom_kek.

POST /hid_inject_media_key.fcgi

Parameters

  • target_ref (string): Required. Key reference that will receive the key. Example: "030101".
  • kek_ref (string): Required. Key reference holding the KEK used to wrap the key.
  • key (string): Required. The card key, as a hexadecimal string. A MIFARE Classic key is 6 bytes, for example "FFFFFFFFFFFF".
  • kek (string): Optional. Selects plain mode, as described above.

Response

  • success (bool): true when the key was injected.

Request example

$.ajax({
    url: "/hid_inject_media_key.fcgi?session=" + session,
    type: 'POST',
    contentType: 'application/json',
    data: JSON.stringify({
        target_ref: "030101",
        kek_ref: "03F001",
        key: "FFFFFFFFFFFF",
        kek: "3333333333333333333333333333333333333333333333333333333333333333"
    })
});

Get key information

Reports what a key reference currently holds. Useful to confirm an injection succeeded, since the keys themselves can never be read back.

POST /hid_get_key_info.fcgi

Parameters

  • target_ref (string): Required. Key reference to inspect, as a hexadecimal string.

Response

  • key_type (string): Kind of key stored in the reference. Values: "KEK" (a key encryption key) or "MEDIA" (a card key).
  • key_id (string): The identifier stored with the key, or an empty string when the key has none.

If the reference holds no key, the call returns the error reported by the reader, or "Key not found".

Note on key_id: only hid_inject_default_kek accepts a key_id, because only the underlying default-KEK operation exposes that parameter. Keys injected through hid_inject_custom_kek or hid_inject_media_key therefore always report an empty key_id here, even immediately after a successful injection.

Request example

$.ajax({
    url: "/hid_get_key_info.fcgi?session=" + session,
    type: 'POST',
    contentType: 'application/json',
    data: JSON.stringify({ target_ref: "03F000" })
});

Response example

{
    "key_type": "KEK",
    "key_id": "4445464B45593031"
}

Reader configuration parameters (OIDs)

The two endpoints below read and change any OMNIKEY configuration parameter directly, addressed by its OID in dot notation — always six parts, for example "1.1.1.2.3.5".

These are the module's own internal parameters, and are distinct from the device-level hid_reader settings described in Configuration Parameters.

POST /hid_set_oid.fcgi

The value's type is inferred from the JSON type of the value field — there is no separate type parameter.

Parameters

  • oid (string): Required. Parameter OID, in dot notation.
  • value (bool, int or string): Required. The value to write. A JSON boolean is written as a boolean, a JSON number as an integer, and a JSON string is treated as a hexadecimal byte sequence. Any other JSON type returns the error "Invalid value: must be a bool, an int or a hex string".

Response

  • success (bool): true when the parameter was written.

Request example

Writes a byte sequence (a CPE slot definition):

$.ajax({
    url: "/hid_set_oid.fcgi?session=" + session,
    type: 'POST',
    contentType: 'application/json',
    data: JSON.stringify({
        oid: "1.1.1.2.3.1",
        value: "A261300161318244A1613002581CA361300161314E"
    })
});

POST /hid_get_oid.fcgi

Parameters

  • oid (string): Required. Parameter OID, in dot notation.

Response

  • value (bool, int or string): Current value of the parameter. Since the reader returns raw bytes with no type information, the type is inferred from the byte count: 1 byte is returned as a boolean, 4 bytes as an integer, and any other length as a hexadecimal string.

Request example

$.ajax({
    url: "/hid_get_oid.fcgi?session=" + session,
    type: 'POST',
    contentType: 'application/json',
    data: JSON.stringify({ oid: "1.1.1.2.3.1" })
});

Response example

{
    "value": "A261300161318244A1613002581CA361300161314E"
}

Reset the reader configuration

Starts — or checks the progress of — a reset of the OMNIKEY module settings, optionally restoring a configuration file (config.orco) sent in the request body itself.

POST /hid_reset_config.fcgi

Parameters

  • start (bool): Starts the reset of the reader settings to factory values.

To restore a custom .orco file instead of performing a factory reset, send the binary content of the file as the request body, with Content-Type: application/octet-stream (no JSON envelope and no start parameter).

Response

  • resetting (bool): Indicates whether the reset is still in progress.
  • status (string): Current reset status. Values: "running" or "done".

If a reset is already in progress, a new call returns the error "HID reader config reset already in progress".

Request example

Starts the reset with the factory configuration:

$.ajax({
    url: "/hid_reset_config.fcgi?session=" + session,
    type: 'POST',
    contentType: 'application/json',
    data: JSON.stringify({ start: true })
});

Response example

While the reset is in progress:

{
    "resetting": true,
    "status": "running"
}

After completion (on a following call, without start):

{
    "resetting": false,
    "status": "done"
}