Esempio n. 1
0
            private void Consume(DataReader reader)
            {
                byte[] byRemain = new byte[reader.UnconsumedBufferLength];
                reader.ReadBytes(byRemain);
                int nRemainBytes = byRemain.Length;

                if (m_nADATABufferPointer < m_bufferADATA.Length)
                {
                    int nLenToCopy = Math.Min(byRemain.Length, m_bufferADATA.Length - m_nADATABufferPointer);
                    Array.Copy(byRemain, 0, m_bufferADATA, m_nADATABufferPointer, nLenToCopy);
                    m_nADATABufferPointer += (byte)nLenToCopy;
                    nRemainBytes          -= nLenToCopy;

                    if (m_nADATABufferPointer == m_bufferADATA.Length)
                    {
                        //Header Complete -> read

                        byte[] byNonce = new byte[24];
                        Array.Copy(m_bufferADATA, 0, byNonce, 0, 24);
                        Nonce = new ADATANonce(byNonce);


                        UniqueClientID = new UniqueClientID(BitConverter.ToUInt32(m_bufferADATA, 24));

                        Length = BitConverter.ToUInt16(m_bufferADATA, 28);
                    }
                    else
                    {
                    }
                }
                else
                {
                }



                if (nRemainBytes > 0)
                {
                    m_bufferPDATA.AddRange(byRemain.Skip(byRemain.Length - nRemainBytes));
                }
                else
                {
                }

                //m_EncryptedInputBuffer.Write(byRemain, 0, byRemain.Length);
            }
Esempio n. 2
0
 public SendAuthorization­IDConfirmationCommand(UniqueClientID uuid, IConnectionContext context)
     : base(NukiCommandType.AuthorizationIDConfirmation, context, 2)
 {
     AddField(nameof(SmartLockUUID), uuid);
     AddField(nameof(SmartLockNonce), context.SmartLockNonce, FieldFlags.PartOfAuthentication);
 }