|
OSDP.Net 5.2.1
A .NET library for implementing the Open Supervised Device Protocol (OSDP)
|
Message channel which represents the Access Control Unit (ACU) side of the OSDP communications (i.e. More...
Public Member Functions | |||||
| ACUMessageSecureChannel (ILoggerFactory loggerFactory) | |||||
| Initializes a new instance of the ACUMessageChannel with logger factory. | |||||
| override void | EncodePayload (byte[] payload, Span< byte > destination) | ||||
Encrypts the payload using the secure channel context.This function can only be called once IsSecurityEstablished is true.
| |||||
| override byte[] | DecodePayload (byte[] payload) | ||||
Decodes the payload using the secure channel context.This function can only be called once IsSecurityEstablished is true
| |||||
| override ReadOnlySpan< byte > | 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
| |||||
| Public Member Functions inherited from OSDP.Net.Messages.SecureChannel.MessageSecureChannel | |||||
| byte[] | DecodePayload (byte[] payload) | ||||
Decodes the payload using the secure channel context.This function can only be called once IsSecurityEstablished is true
| |||||
| void | EncodePayload (byte[] payload, Span< byte > destination) | ||||
Encrypts the payload using the secure channel context.This function can only be called once IsSecurityEstablished is true.
| |||||
| ReadOnlySpan< byte > | 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
| |||||
| 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 > data) | ||||
Pads the given data with padding bytes to make it a multiple of a specified length.
| |||||
Additional Inherited Members | |
| Protected Member Functions inherited from OSDP.Net.Messages.SecureChannel.MessageSecureChannel | |
| MessageSecureChannel (SecurityContext context=null, ILoggerFactory loggerFactory=null) | |
| Initializes a new instance of MessageSecureChannel class. | |
| byte[] | GenerateCommandMac (ReadOnlySpan< byte > message) |
| Generates a MAC for a command message. | |
| byte[] | GenerateReplyMac (ReadOnlySpan< byte > message) |
| Generates a MAC for a reply message. | |
| byte[] | DecodePayload (byte[] payload, byte[] iv) |
| Decodes the payload. | |
| void | EncodePayload (byte[] payload, byte[] iv, Span< byte > destination) |
| Encodes the payload. | |
| Properties inherited from OSDP.Net.Messages.SecureChannel.MessageSecureChannel | |
| ILogger | Logger [get] |
| Optional logger instance. | |
| SecurityContext | Context [get] |
| Security state used by the channel. | |
| 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.true if the secure channel is initialized; otherwise, false. | |
| 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.This property is used to retrieve the server cryptogram for the secure channel context within which a message is packed/unpacked. | |
| bool | IsUsingDefaultKey [get] |
| Gets a value indicating whether the secure channel is using the default key. | |
Message channel which represents the Access Control Unit (ACU) side of the OSDP communications (i.e.
OSDP commands are sent out and replies are received)
Definition at line 10 of file ACUMessageSecureChannel.cs.
|
inline |
Initializes a new instance of the ACUMessageChannel with logger factory.
| loggerFactory | Optional logger factory from which a logger object for the message channel will be acquired |
Definition at line 17 of file ACUMessageSecureChannel.cs.
| override byte[] OSDP.Net.Messages.SecureChannel.ACUMessageSecureChannel.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 |
Implements OSDP.Net.Messages.SecureChannel.IMessageSecureChannel.
References OSDP.Net.Messages.SecureChannel.MessageSecureChannel.Context.
|
inline |
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 |
Implements OSDP.Net.Messages.SecureChannel.IMessageSecureChannel.
Definition at line 33 of file ACUMessageSecureChannel.cs.
References OSDP.Net.Messages.SecureChannel.MessageSecureChannel.Context, and EncodePayload().
Referenced by EncodePayload().
| override ReadOnlySpan< byte > OSDP.Net.Messages.SecureChannel.ACUMessageSecureChannel.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 |
Implements OSDP.Net.Messages.SecureChannel.IMessageSecureChannel.
References OSDP.Net.Messages.SecureChannel.MessageSecureChannel.GenerateCommandMac().