ENGAGE_Credential_Sort_and_Encryption

ENGAGE - Credential Sort and Encryption

REVISION CONTROL RECORD   
VERDateDESCRIPTION OF CHANGEAUTHOR
0.0101/28/2015Initial draft0.01
0.021/29/2015Updates for productionR. Rayburn
1.007/21/2015Correct some inconsistencies in the final example, add some explanation to the credential creation, and release to productionJ. Baumgarte
1.109/2/2015Correct a description of the length of the credential in the JSONJ. Baumgarte
1.209/8/2015Correct secondary credential information for NDE and Jaguar. Various fixes from document reviewJ. Baumgarte
1.305/17/2016Note that duplicate records are treated as unsortedT. Anfield
1.3111/7/2017Updated document format to new .docx. No Content ChangedT. Holt
1.326/25/2018Added comment about 0xFFFFFFFF credential not supported Formatting Updates for ENGAGE 6.1 ReleaseT. Holt
1.339/5/2018Converted Document to markdown formatT. Holt

Table of Contents

  1. Introduction 3

  2. How do Alliance Partner’s need to sort? 3

  3. Credentials with Secondary Credential Data 3

  4. What does the 32 Byte Credential look like inside of the Door File 4

  5. How do I turn PrimCred into 16 bytes? 4

  6. “Degraded” or “Optimized” Search Modes 5

6.1 Difference between “Degraded” and “Optimized” search modes 5

  1. What will a sorted user database look like? 5

  2. What type of encryption will be used? 6

8.1 Encryption Type 6

8.2 Encryption Example 6

  1. What should be sent to the lock in the door file? 6

Introduction

Abbreviations Used In This Document 
BLEBluetooth Low Energy
DbDatabase
ENGAGE™Connectivity Platform Technology
JSONJava Script Object Notation
NDESchlage ENGAGE™ Wireless Cylindrical Lock
UIUser Interface (ex. LED blink pattern)
URIUniform Resource Identifier
URLUniform Resource Locator
TBDTo Be Determined

How Do Alliance Partner’s Need to Sort?

  • Sort on the 16 bytes of Primary Credential Data (PrimCred)

  • Sort on the unencrypted values of the PrimCred

  • Sort the PrimCred from smallest to largest

  • Encrypt both the PrimCred and the ScndCred with the Site Key

Credentials with Secondary Credential Data

Sort only on the PrimCred and ignore any ScndCred’s present in the user record. The lock will handle looking backwards and forwards if multiple PrimCreds exist with unique ScndCreds.

Keep in mind that secondary credentials usage is the equivalent to the second credential in a Credential + Credential sequence (example: card + pin). The secondary credential is only used once the primary credential has already been matched. In the case where there are no secondary credentials just use “null” as your secondary credential (scndCr) with a credential type (of “null”).

NOTE: You cannot have a mixture of a primary credential without a secondary credential specified and then the same primary credential again with secondary credentials in the same door file. When the lock matches a primary credential where there is no secondary credential, it will act upon that entry and will not search for any other entry that may contain a secondary credential.

NOTE: Including two identical credentials in the same door file will result in the lock treating the database as unsorted. Please avoid duplicate entries in the door file to ensure optimized operation.

What Does the 32 Byte Credential Look Like Inside the Door File?

NameSize (bytes)Notes
Primary Credential (PrimCred) Data8Left justified – see padding example below
Secondary Credential (ScndCred) Data8Left justified – see padding example below
isActive1Has user been deleted or not?
PrimeCred Type1Card, PIN, etc.
ScndCred Type1Card, PIN, etc.
Attribute1Normal, Freeze, Toggle, etc.
Activation Date2 
Expiration Date2 
Cred Time Schedule2 
User Reference ID2.5 
Unused3.5 
Total:32 

How Do I Turn PrimCred Into 16 Bytes?

Pad the remaining bytes with 0xFF.

NOTE: ENGAGE edge devices do not support primary or secondary credentials unencrypted value of all 0xFF. 0xFF should be used for padding of the unencrypted credential data, not for the entirety of the unencrypted credential info.

Example:

  • Starting with a 26-bit credential [0x23C5981].

  • Left-shift the data until you get to the first byte boundary (32-bits, 40-bits, 48-bits, or 64-bits)

    • For a 26-bit credential, you need to left-shift (32-26=6); 6 times.

    • Left-shifting 6 times results in [0x8F16 6040].

  • Finally, the remaining 12 bytes are padded with 0xFF which gives a 16 byte value of [0x8F16 6040 FFFF FFFF FFFF FFFF FFFF FFFF]. This value is now left justified and padded.

“Degraded” or “Optimized” Search Modes

The lock will record an audit stating the result of a user database presort verification upon downloading a new user database. The result will state if the presort verification succeeded (user database is confirmed to be sorted) or failed (user database was not sorted upon downloading from the OEM).

Difference Between “Degraded” and “Optimized” Search Modes

When the door file is sorted (according to the Section below, "What Will a Sorted User Database Look Like?, the lock performs a binary search on the primary credential. This enables a very rapid search of the entire 5,000 user door file – usually within a hundred milliseconds.

When the door file is not sorted, the lock will remain functional, but must check every credential starting from the first entry to the final entry in the file. As a result, a search of the “last” user in the file may take a few seconds to complete, during which the user has no indication that anything is going on at the lock. So the user will present his/ her card to the lock and the lock will beep, indicating that the card was read, but will give no other UI until a few seconds later when the credential is matched and the door unlocks.

Keep in mind that “degraded” mode is completely detectable and avoidable. The lock will tell the server when the door file is not sorted as an audit.

What Will a Sorted User Database Look Like?

Let’s look at an example of 5 users. We will only list the PrimCred values since this is the only field that needs to be sorted.

Ref ID for Visual PurposesPrimCreds (UNsorted, not encrypted)
1[0x8F16 6045 FFFF FFFF FFFF FFFF FFFF FFFF]
2[0x8F16 6040 FFFF FFFF FFFF FFFF FFFF FFFF]
3[0x7F16 6040 FFFF FFFF FFFF FFFF FFFF FFFF]
4[0x7F18 6040 FFFF FFFF FFFF FFFF FFFF FFFF]
5[0x7F12 6540 FFFF FFFF FFFF FFFF FFFF FFFF]
Ref ID for Visual PurposesPrimCreds (sorted, not encrypted)
5[0x7F12 6540 FFFF FFFF FFFF FFFF FFFF FFFF]
3[0x7F16 6040 FFFF FFFF FFFF FFFF FFFF FFFF]
4[0x7F18 6040 FFFF FFFF FFFF FFFF FFFF FFFF]
2[0x8F16 6040 FFFF FFFF FFFF FFFF FFFF FFFF]
1[0x8F16 6045 FFFF FFFF FFFF FFFF FFFF FFFF]

What Type of Encryption is Used?

Encryption Type

Each set of Credential Data (primeCred = 16 total bytes, scndCr = 16 total bytes) will be encrypted using AES-256 Cipher-Block Chaining (CBC) with an Initialization Vector (IV) of zero, where the key is your secure Site Key. Depending upon the tool used to encrypt the credential data, it may be easier to use “Electronic Codebook” (ECB) for each credential since the IV is zero for each credential and they are not chained together.

Encryption Example

For the table below, the site key was: [0x1234 5678 90AB CDEF 1234 5678 90AB CDEF 1234 5678 90AB CDEF 1234 5678 90AB CDEF]. The online tool at aes.online-domain-tools.com was used to generate the encrypted values – this tool can do both CBC and ECB. Other tools can only use ECB and will work just fine. An example of another tool can be found here: http://www.hanewin.net/encrypt/aes/aes-test.htm

Ref ID for Visual PurposesPrimCreds (sorted & encrypted)
5[0x3411 0EA5 49AA 549A A73F F06D C93B 63B4]
3[0xCD38 8DD0 ACA9 7174 9203 D015 9264 C379]
4[0x3BB9 9478 5B06 A240 1814 0A60 13CE 7477]
2[0x77EB 0B84 7C38 08F5 A8F8 2844 622B F531]
1[0x33DE CE61 76AF 0095 F8A0 EEE4 04D6 1F24]

What Should be Sent to the Lock in the Door File?

Taking the example in section 8, user 5’s primary credential should be 16 bytes. See the example below:

“primeCred”:”34110EA549AA549AA73FF06DC93B63B4”,

“prCrTyp”:”card”,

“scndCr”:”null”,

“scndCrTyp”:”null”