diff --git a/FneSystemBase.cs b/FneSystemBase.cs
index e1d0688..2699275 100644
--- a/FneSystemBase.cs
+++ b/FneSystemBase.cs
@@ -7,7 +7,7 @@
* @package DVM / Fixed Network Equipment Core Library
* @license AGPLv3 License (https://opensource.org/licenses/AGPL-3.0)
*
-* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
+* Copyright (C) 2024-2025 Bryan Biedenkapp, N2PLL
*
*/
@@ -118,6 +118,27 @@ namespace fnecore
}
} // public class RemoteCallData
+ ///
+ /// Data structure representing encryption parameters.
+ ///
+ public class CryptoParams
+ {
+ ///
+ /// Algorithm ID
+ ///
+ public byte AlgoId = P25Defines.P25_ALGO_UNENCRYPT;
+
+ ///
+ /// Encryption Key ID
+ ///
+ public ushort KeyId = 0;
+
+ ///
+ /// Message Indicator
+ ///
+ public byte[] MI = new byte[P25Defines.P25_MI_LENGTH];
+ } // public class CryptoParams
+
///
/// Implements a FNE system.
///
@@ -434,7 +455,9 @@ namespace fnecore
///
///
///
- protected void CreateP25MessageHdr(byte duid, RemoteCallData callData, ref byte[] data)
+ ///
+ ///
+ public void CreateP25MessageHdr(byte duid, RemoteCallData callData, ref byte[] data, CryptoParams cryptoParams = null)
{
FneUtils.StringToBytes(Constants.TAG_P25_DATA, data, 0, Constants.TAG_P25_DATA.Length);
@@ -459,7 +482,19 @@ namespace fnecore
data[22U] = duid; // DUID
- data[180U] = 0; // Frame Type
+ data[180U] = P25Defines.P25_FT_DATA_UNIT; // Frame Type
+ if (cryptoParams != null)
+ {
+ data[180U] = P25Defines.P25_FT_HDU_VALID; // Frame Type
+
+ data[14U] |= 0x08; // Control bit
+
+ data[181U] = cryptoParams.AlgoId; // Algorithm ID
+ FneUtils.WriteBytes(cryptoParams.KeyId, ref data, 182); // Key ID
+
+ if (cryptoParams.MI != null)
+ Array.Copy(cryptoParams.MI, 0, data, 184, P25Defines.P25_MI_LENGTH); // Message Indicator
+ }
}
///