|
OSDP.Net 5.2.1
A .NET library for implementing the Open Supervised Device Protocol (OSDP)
|
Represents the secure channel context within which a message is packed/unpacked. More...
Public Member Functions | |
| void | EncodePayload (byte[] payload, Span< byte > destination) |
| Encrypts the payload using the secure channel context. | |
| byte[] | DecodePayload (byte[] payload) |
| Decodes the payload using the secure channel context. | |
| ReadOnlySpan< byte > | GenerateMac (ReadOnlySpan< byte > message, bool isIncoming) |
| Generates a new Message Authentication Code. | |
| void | InitializeACU (byte[] clientRandomNumber, byte[] clientCryptogram) |
| Initializes the Access Control Unit (ACU) in the secure channel context. | |
| void | ResetSecureChannelSession () |
| Resets the secure channel session by creating a new random number. | |
| void | Establish (byte[] rmac) |
| Establishes the secure channel with the provided RMAC. | |
| ReadOnlySpan< byte > | PadTheData (ReadOnlySpan< byte > payload) |
| Pads the given data with padding bytes to make it a multiple of a specified length. | |
Properties | |
| bool | IsSecurityEstablished [get] |
| Indicates whether or not a secure channel has been established on the current message channel. | |
| bool | IsInitialized [get] |
| Gets a value indicating whether the secure channel is initialized. | |
| byte[] | ServerRandomNumber [get] |
| Represents the server random number used in the secure channel context. | |
| byte[] | ServerCryptogram [get] |
| Represents the secure channel cryptogram used by the server. | |
| bool | IsUsingDefaultKey [get] |
| Gets a value indicating whether the secure channel is using the default key. | |
Represents the secure channel context within which a message is packed/unpacked.
Definition at line 8 of file IMessageSecureChannel.cs.
| byte[] OSDP.Net.Messages.SecureChannel.IMessageSecureChannel.DecodePayload | ( | byte[] | payload | ) |
Decodes the payload using the secure channel context.
This function can only be called once IsSecurityEstablished is true
| payload | Payload to be decrypted |
Implemented in OSDP.Net.Messages.SecureChannel.ACUMessageSecureChannel, and OSDP.Net.Messages.SecureChannel.MessageSecureChannel.
Referenced by OSDP.Net.Messages.IncomingMessage.IncomingMessage().
| void OSDP.Net.Messages.SecureChannel.IMessageSecureChannel.EncodePayload | ( | byte[] | payload, |
| Span< byte > | destination ) |
Encrypts the payload using the secure channel context.
This function can only be called once IsSecurityEstablished is true.
| payload | Payload to be encrypted. NOTE: This data MUST already be padded in according to OSDP specification: a) there must be at least one byte of padding; b) payloaded is padded with 0x00, except for the very first byte of padding which must be 0x80; c) total length must be divisible by AES block size of 16 bytes. |
| destination | Identifies where encoded data is to written to |
Implemented in OSDP.Net.Messages.SecureChannel.ACUMessageSecureChannel, and OSDP.Net.Messages.SecureChannel.MessageSecureChannel.
| void OSDP.Net.Messages.SecureChannel.IMessageSecureChannel.Establish | ( | byte[] | rmac | ) |
Establishes the secure channel with the provided RMAC.
| rmac | The RMAC. |
Implemented in OSDP.Net.Messages.SecureChannel.MessageSecureChannel.
| ReadOnlySpan< byte > OSDP.Net.Messages.SecureChannel.IMessageSecureChannel.GenerateMac | ( | ReadOnlySpan< byte > | message, |
| bool | isIncoming ) |
Generates a new Message Authentication Code.
Note this command IS NOT idempotent as every time it is called it will calculate a new rolling MAC value based on the results of the previous call
| message | Message to be signed with a MAC |
| isIncoming | If true, indicates that the message was received from the wire. If false, indicates that the message is being sent out on the wire |
Implemented in OSDP.Net.Messages.SecureChannel.ACUMessageSecureChannel, and OSDP.Net.Messages.SecureChannel.MessageSecureChannel.
Referenced by OSDP.Net.Messages.IncomingMessage.IncomingMessage().
| void OSDP.Net.Messages.SecureChannel.IMessageSecureChannel.InitializeACU | ( | byte[] | clientRandomNumber, |
| byte[] | clientCryptogram ) |
Initializes the Access Control Unit (ACU) in the secure channel context.
| clientRandomNumber | The client random number. |
| clientCryptogram | The client cryptogram. |
Implemented in OSDP.Net.Messages.SecureChannel.MessageSecureChannel.
| ReadOnlySpan< byte > OSDP.Net.Messages.SecureChannel.IMessageSecureChannel.PadTheData | ( | ReadOnlySpan< byte > | payload | ) |
Pads the given data with padding bytes to make it a multiple of a specified length.
| payload | The payload data to pad. |
Implemented in OSDP.Net.Messages.SecureChannel.MessageSecureChannel.
| void OSDP.Net.Messages.SecureChannel.IMessageSecureChannel.ResetSecureChannelSession | ( | ) |
Resets the secure channel session by creating a new random number.
Implemented in OSDP.Net.Messages.SecureChannel.MessageSecureChannel.
|
get |
Gets a value indicating whether the secure channel is initialized.
true if the secure channel is initialized; otherwise, false.
Implemented in OSDP.Net.Messages.SecureChannel.MessageSecureChannel.
Definition at line 22 of file IMessageSecureChannel.cs.
|
get |
Indicates whether or not a secure channel has been established on the current message channel.
Implemented in OSDP.Net.Messages.SecureChannel.MessageSecureChannel.
Definition at line 14 of file IMessageSecureChannel.cs.
Referenced by OSDP.Net.Messages.IncomingMessage.IncomingMessage().
|
get |
Gets a value indicating whether the secure channel is using the default key.
Implemented in OSDP.Net.Messages.SecureChannel.MessageSecureChannel.
Definition at line 40 of file IMessageSecureChannel.cs.
Referenced by OSDP.Net.Messages.IncomingMessage.IncomingMessage().
|
get |
Represents the secure channel cryptogram used by the server.
This property is used to retrieve the server cryptogram for the secure channel context within which a message is packed/unpacked.
Implemented in OSDP.Net.Messages.SecureChannel.MessageSecureChannel.
Definition at line 35 of file IMessageSecureChannel.cs.
|
get |
Represents the server random number used in the secure channel context.
Implemented in OSDP.Net.Messages.SecureChannel.MessageSecureChannel.
Definition at line 27 of file IMessageSecureChannel.cs.