Table of Contents

Class UserPermit

Namespace
EncDotNet.S100.ExchangeSets.Protection
Assembly
EncDotNet.S100.ExchangeSets.dll

A parsed or constructed S-100 Part 15 user permit: the 46-character token an OEM issues to a Data Client that conveys the system's hardware id in an encrypted form, together with a checksum and the manufacturer identifier.

public sealed class UserPermit
Inheritance
UserPermit
Inherited Members

Remarks

S-100 Edition 5.2.1 Part 15 §15-7.3. The user permit is the concatenation of the 32-character hexadecimal encrypted hardware id, an 8-character CRC-32 checksum over that hexadecimal text, and the 6-character manufacturer id (M_ID). Only a Data Server (or the issuing OEM) holds the manufacturer key (M_KEY) needed to recover the hardware id with DecryptHardwareId(ReadOnlySpan<byte>).

Fields

Length

The total length, in characters, of a user permit (§15-7.3.1).

public const int Length = 46

Field Value

int

Properties

Checksum

The CRC-32 checksum carried by the permit (§15-7.3.1.2).

public uint Checksum { get; }

Property Value

uint

EncryptedHardwareId

The 16-byte encrypted hardware id (the wrapped HW_ID).

public ReadOnlySpan<byte> EncryptedHardwareId { get; }

Property Value

ReadOnlySpan<byte>

ManufacturerId

The 6-character manufacturer identifier (M_ID, §15-7.3.1.3).

public string ManufacturerId { get; }

Property Value

string

Methods

Create(HardwareId, ReadOnlySpan<byte>, string)

Creates a user permit by encrypting hardwareId with the manufacturer key and appending the checksum and manufacturer id.

public static UserPermit Create(HardwareId hardwareId, ReadOnlySpan<byte> manufacturerKey, string manufacturerId)

Parameters

hardwareId HardwareId

The system hardware id to wrap.

manufacturerKey ReadOnlySpan<byte>

The 16-byte manufacturer key (M_KEY).

manufacturerId string

The 6-character manufacturer id (M_ID).

Returns

UserPermit

The constructed user permit.

DecryptHardwareId(ReadOnlySpan<byte>)

Recovers the hardware id by decrypting the encrypted hardware id with the manufacturer key.

public HardwareId DecryptHardwareId(ReadOnlySpan<byte> manufacturerKey)

Parameters

manufacturerKey ReadOnlySpan<byte>

The 16-byte manufacturer key (M_KEY).

Returns

HardwareId

The recovered hardware id.

Parse(string)

Parses a user permit from its 46-character textual form and validates its CRC-32 checksum.

public static UserPermit Parse(string permit)

Parameters

permit string

The 46-character user permit.

Returns

UserPermit

The parsed user permit.

Exceptions

FormatException

The permit is malformed or its checksum does not match the encrypted hardware id.

ToString()

Returns the 46-character textual form of the user permit (upper-case).

public override string ToString()

Returns

string