> For the complete documentation index, see [llms.txt](https://help.security.gallagher.com/knowledge-hub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.security.gallagher.com/knowledge-hub/products/cc-hardware/credentials/credential-information/credentials-using-card-csn-as-the-card.md).

# Use a card CSN as the card number

Configure a Universal Card Format to use a MIFARE Card Serial Number as cardholder data.

All MIFARE cards have a unique Card Serial Number (CSN), also known as a Unique ID (UID). A MIFARE CSN is usually either 4 bytes (32 bits) or 7 bytes (56 bits). Classic is typically 4 byte and DESFire is typically 7 byte.

Gallagher HBUS readers can be set to read the CSN from a MIFARE card and use it to identify a cardholder in Command Centre. When CSN mode is enabled on a reader, the reader sends the card's CSN to the controller as cardholder identification, if it does not detect any other form of cardholder identification on the card.

To interpret the CSN as a card number, the controller hosting the reader needs a Universal Card Format assigned that matches the length of the CSN of the MIFARE cards in use.

### Configure a UCF for CSN mode

Use this procedure to create a UCF for either a 4 byte (32 bit) or a 7 byte (56 bit) CSN.

1. Click **Configure** on the menu bar, then **Universal Card Format**. The Universal Card Format Master List window opens in grid view.
2. Open the Universal Card Format you want to configure for CSN mode, or create a new one.
3. Click the **Format** tab.
4. Click the **Wiegand** radio button to indicate the required format.
5. Complete the parameters as shown in the table below.
6. Select the card type's facility code from the **Facility Code** dropdown list.
7. Assign the UCF to the controller's **Card Formats** property page.

| Wiegand Format field             | 32 bits (4 byte) | 56 bits (7 byte) |
| -------------------------------- | ---------------- | ---------------- |
| Number of Bits                   | 32               | 56               |
| Bits in Facility Code            | 0                | 0                |
| First Bit of Facility Code       | n/a              | n/a              |
| Bits in Card Number              | 32               | 56               |
| First Bit of Card Number         | 1                | 1                |
| Bits in Issue Number             | 0                | 0                |
| First Bit of Issue Number        | n/a              | n/a              |
| Bits to Sum for Even Parity      | 0                | 0                |
| First Bit to Sum for Even Parity | n/a              | n/a              |
| Bits to Sum for Odd Parity       | 0                | 0                |
| First Bit to Sum for Odd Parity  | n/a              | n/a              |
| Facility Code                    | Select from list | Select from list |

> **Note.** No bits are set for the facility code, because that data is not sent when only the CSN is retrieved. You need to create a card type with the facility code you want to use. On the Card Types Setup property page, also increase the card number range to **72057594037927935** for 56 bit cards, or **4294967295** for 32 bit cards.

### Read the CSN

When a MIFARE card that has no Gallagher data is presented to a reader configured for CSN mode, an **Unauthorised Card** event is generated showing the card's CSN. Copy that CSN when you add the card to a cardholder.

> **Note.** If you get a 72 bit CSN from a card presented to a Gallagher T-series reader, it is actually a 56 bit CSN with 16 extra bits added by the reader. The same applies to a 48 bit result, which is actually 32 bit. Use the underlying length, 56 or 32, for the UCF configuration.

***

🔗 **Related**

* [Credentials - Universal Card Formats (UCF)](/knowledge-hub/products/cc-hardware/credentials/credential-information/credentials-universal-card-formats-ucf.md). Creating a UCF from a raw bitstream when the card format is not recognised.
* [Credentials - Site Specific Key (SSK) vs Default Site Key](/knowledge-hub/products/cc-hardware/credentials/credential-information/credentials-site-specific-key-ssk-vs-d.md). Using the MIFARE serial number as card data when cards are blank.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.security.gallagher.com/knowledge-hub/products/cc-hardware/credentials/credential-information/credentials-using-card-csn-as-the-card.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
