/// <summary> /// Constructs a DtmIdentityStruct from a stream /// </summary> /// /// <param name="ParametersStream">Stream containing a serialized DtmParameters</param> /// /// <returns>A populated DtmParameters</returns> public DtmParameters(Stream ParametersStream) { BinaryReader reader = new BinaryReader(ParametersStream); int len; byte[] data; len = reader.ReadInt32(); OId = reader.ReadBytes(len); len = reader.ReadInt32(); AuthPkeId = reader.ReadBytes(len); len = reader.ReadInt32(); PrimaryPkeId = reader.ReadBytes(len); len = reader.ReadInt32(); data = reader.ReadBytes(len); AuthSession = new DtmSessionStruct(data); len = reader.ReadInt32(); data = reader.ReadBytes(len); PrimarySession = new DtmSessionStruct(data); RandomEngine = (Prngs)reader.ReadByte(); MaxAsmKeyAppend = reader.ReadInt32(); MaxAsmKeyPrePend = reader.ReadInt32(); MaxAsmParamsAppend = reader.ReadInt32(); MaxAsmParamsPrePend = reader.ReadInt32(); MaxSymKeyAppend = reader.ReadInt32(); MaxSymKeyPrePend = reader.ReadInt32(); MaxMessageAppend = reader.ReadInt32(); MaxMessagePrePend = reader.ReadInt32(); MaxAsmKeyDelayMS = reader.ReadInt32(); MaxSymKeyDelayMS = reader.ReadInt32(); MaxMessageDelayMS = reader.ReadInt32(); }
/// <summary> /// The DtmParameters primary constructor /// </summary> /// /// <param name="OId">The DtmParameters Identifier field; must be 16 bytes in length</param> /// <param name="AuthPkeId">The <c>Auth-Phase</c> Asymmetric parameters OId; can be the Asymmetric cipher parameters OId, or a serialized Asymmetric Parameters class</param> /// <param name="PrimaryPkeId">The <c>Primary-Phase</c> Asymmetric parameters OId; can be the Asymmetric cipher parameters OId, or a serialized Asymmetric Parameters class</param> /// <param name="AuthSession">The <c>Auth-Phase</c> Symmetric sessions cipher parameters; contains a complete description of the Symmetric cipher</param> /// <param name="PrimarySession">The <c>Primary-Phase</c> Symmetric sessions cipher parameters; contains a complete description of the Symmetric cipher</param> /// <param name="RandomEngine">(Optional) The Prng used to pad messages, defaults to CTRPrng</param> /// <param name="MaxAsmKeyAppend">(Optional) The maximum number of pseudo-random bytes to append to the <c>Primary-Phase</c> Asymmetric Public key before encryption</param> /// <param name="MaxAsmKeyPrePend">(Optional) The maximum number of pseudo-random bytes to prepend to the <c>Primary-Phase</c> Asymmetric Public key before encryption</param> /// <param name="MaxAsmParamsAppend">(Optional) The maximum number of pseudo-random bytes to append to the <c>Primary-Phase</c> Client Identity before encryption</param> /// <param name="MaxAsmParamsPrePend">(Optional) The maximum number of pseudo-random bytes to prepend to the <c>Primary-Phase</c> Asymmetric Client Identity before encryption</param> /// <param name="MaxSymKeyAppend">(Optional) The maximum number of pseudo-random bytes to append to the <c>Primary-Phase</c> Symmetric key before encryption</param> /// <param name="MaxSymKeyPrePend">(Optional) The maximum number of pseudo-random bytes to prepend to the <c>Primary-Phase</c> Symmetric key before encryption</param> /// <param name="MaxMessageAppend">(Optional) The maximum number of pseudo-random bytes to append to a <c>Post-Exchange</c> message before encryption</param> /// <param name="MaxMessagePrePend">(Optional) The maximum number of pseudo-random bytes to prepend to a <c>Post-Exchange</c> message before encryption</param> /// <param name="MaxAsmKeyDelayMS">(Optional) The maximum delay time before sending the <c>Primary-Phase</c> Asymmetric key; the minimum time is 1 half max, a value of <c>0</c> has no delay</param> /// <param name="MaxSymKeyDelayMS">(Optional) The maximum delay time before sending the <c>Primary-Phase</c> Symmetric key; the minimum time is 1 half max, a value of <c>0</c> has no delay</param> /// <param name="MaxMessageDelayMS">(Optional) The maximum delay time before sending message traffic; the minimum time is <c>0</c>, a value of <c>0</c> has no delay</param> public DtmParameters(byte[] OId, byte[] AuthPkeId, byte[] PrimaryPkeId, DtmSessionStruct AuthSession, DtmSessionStruct PrimarySession, Prngs RandomEngine = Prngs.CTRPrng, int MaxAsmKeyAppend = 0, int MaxAsmKeyPrePend = 0, int MaxAsmParamsAppend = 0, int MaxAsmParamsPrePend = 0, int MaxSymKeyAppend = 0, int MaxSymKeyPrePend = 0, int MaxMessageAppend = 0, int MaxMessagePrePend = 0, int MaxAsmKeyDelayMS = 0, int MaxSymKeyDelayMS = 0, int MaxMessageDelayMS = 0) { this.OId = OId; this.AuthPkeId = AuthPkeId; this.PrimaryPkeId = PrimaryPkeId; this.AuthSession = AuthSession; this.PrimarySession = PrimarySession; this.RandomEngine = RandomEngine; this.MaxAsmKeyAppend = MaxAsmKeyAppend; this.MaxAsmKeyPrePend = MaxAsmKeyPrePend; this.MaxAsmParamsAppend = MaxAsmParamsAppend; this.MaxAsmParamsPrePend = MaxAsmParamsPrePend; this.MaxSymKeyAppend = MaxSymKeyAppend; this.MaxSymKeyPrePend = MaxSymKeyPrePend; this.MaxMessageAppend = MaxMessageAppend; this.MaxMessagePrePend = MaxMessagePrePend; this.MaxAsmKeyDelayMS = MaxAsmKeyDelayMS; this.MaxSymKeyDelayMS = MaxSymKeyDelayMS; this.MaxMessageDelayMS = MaxMessageDelayMS; }