Beispiel #1
0
 internal override string RecordDataToString()
 {
     return(TSigAlgorithmHelper.GetDomainName(Algorithm)
            + " " + (int)(TimeSigned - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds
            + " " + (ushort)Fudge.TotalSeconds
            + " " + Mac.Length
            + " " + BaseEncodingHelper.ToBase64String(Mac)
            + " " + OriginalID
            + " " + (ushort)Error
            + " " + OtherData.Length
            + " " + BaseEncodingHelper.ToBase64String(OtherData));
 }
Beispiel #2
0
        internal override void ParseRecordData(byte[] resultData, int startPosition, int length)
        {
            Algorithm  = TSigAlgorithmHelper.GetAlgorithmByName(DnsMessageBase.ParseDomainName(resultData, ref startPosition));
            TimeSigned = ParseDateTime(resultData, ref startPosition);
            Fudge      = TimeSpan.FromSeconds(DnsMessageBase.ParseUShort(resultData, ref startPosition));
            int macSize = DnsMessageBase.ParseUShort(resultData, ref startPosition);

            Mac        = DnsMessageBase.ParseByteData(resultData, ref startPosition, macSize);
            OriginalID = DnsMessageBase.ParseUShort(resultData, ref startPosition);
            Error      = (ReturnCode)DnsMessageBase.ParseUShort(resultData, ref startPosition);
            int otherDataSize = DnsMessageBase.ParseUShort(resultData, ref startPosition);

            OtherData = DnsMessageBase.ParseByteData(resultData, ref startPosition, otherDataSize);
        }
Beispiel #3
0
 private void EncodeRecordData(byte[] messageData, int offset, ref int currentPosition, Dictionary <string, ushort> domainNames, byte[] mac)
 {
     DnsMessageBase.EncodeDomainName(messageData, offset, ref currentPosition, TSigAlgorithmHelper.GetDomainName(Algorithm), false, domainNames);
     EncodeDateTime(messageData, ref currentPosition, TimeSigned);
     DnsMessageBase.EncodeUShort(messageData, ref currentPosition, (ushort)Fudge.TotalSeconds);
     DnsMessageBase.EncodeUShort(messageData, ref currentPosition, (ushort)mac.Length);
     DnsMessageBase.EncodeByteArray(messageData, ref currentPosition, mac);
     DnsMessageBase.EncodeUShort(messageData, ref currentPosition, OriginalID);
     DnsMessageBase.EncodeUShort(messageData, ref currentPosition, (ushort)Error);
     DnsMessageBase.EncodeUShort(messageData, ref currentPosition, (ushort)OtherData.Length);
     DnsMessageBase.EncodeByteArray(messageData, ref currentPosition, OtherData);
 }