OSDP.Net 5.2.1
A .NET library for implementing the Open Supervised Device Protocol (OSDP)
Loading...
Searching...
No Matches
ACUMessageSecureChannel.cs
1using System;
2using Microsoft.Extensions.Logging;
3
5
11{
17 public ACUMessageSecureChannel(ILoggerFactory loggerFactory) : base(null, loggerFactory) {}
18
29 internal ACUMessageSecureChannel(SecurityContext context = null, ILoggerFactory loggerFactory = null)
30 : base(context, loggerFactory) {}
31
33 public override void EncodePayload(byte[] payload, Span<byte> destination)
34 {
35 EncodePayload(payload, Context.RMac, destination);
36 }
37
39 public override byte[] DecodePayload(byte[] payload) => DecodePayload(payload, Context.CMac);
40
42 public override ReadOnlySpan<byte> GenerateMac(ReadOnlySpan<byte> message, bool isIncoming) =>
43 isIncoming ? GenerateReplyMac(message) : GenerateCommandMac(message);
44}
ACUMessageSecureChannel(ILoggerFactory loggerFactory)
Initializes a new instance of the ACUMessageChannel with logger factory.
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 c...
override void EncodePayload(byte[] payload, Span< byte > destination)
Encrypts the payload using the secure channel context.This function can only be called once IsSecurit...
override byte[] DecodePayload(byte[] payload)
Decodes the payload using the secure channel context.This function can only be called once IsSecurity...
byte[] GenerateCommandMac(ReadOnlySpan< byte > message)
Generates a MAC for a command message.
byte[] GenerateReplyMac(ReadOnlySpan< byte > message)
Generates a MAC for a reply message.
MessageSecureChannel(SecurityContext context=null, ILoggerFactory loggerFactory=null)
Initializes a new instance of MessageSecureChannel class.
SecurityContext Context
Security state used by the channel.
Security context used within MessageSecureChannel.