/// <summary> /// Format the Authentication Token. /// </summary> /// <returns>The Formatted Token.</returns> public override string Format() { StringBuilder builder = new StringBuilder(); builder.AppendLine($"<KerberosV{ProtocolVersion} {MessageType}>"); if (!string.IsNullOrEmpty(ClientTime)) { builder.AppendLine($"Client Time : {KerberosUtils.ParseKerberosTime(ClientTime, ClientUSec)}"); } if (!string.IsNullOrEmpty(ClientRealm)) { builder.AppendLine($"Client Realm : {ClientRealm}"); builder.AppendLine($"Client Name : {ClientName}"); } builder.AppendLine($"Server Time : {KerberosUtils.ParseKerberosTime(ServerTime, ServerUSec)}"); builder.AppendLine($"Server Realm : {ServerRealm}"); builder.AppendLine($"Server Name : {ServerName}"); builder.AppendLine($"Error Code : {ErrorCode}"); if (!string.IsNullOrEmpty(ErrorText)) { builder.AppendLine($"Error Text : {ErrorText}"); } if (ErrorData.Length > 0) { builder.AppendLine($"Error Data :"); HexDumpBuilder hex = new HexDumpBuilder(); hex.Append(ErrorData); hex.Complete(); builder.Append(hex); } return(builder.ToString()); }
internal override string Format() { StringBuilder builder = new StringBuilder(); builder.AppendLine($"Client Name : {ClientName}"); builder.AppendLine($"Client Realm : {ClientRealm}"); if (!string.IsNullOrEmpty(ClientTime)) { builder.AppendLine($"Client Time : {KerberosUtils.ParseKerberosTime(ClientTime, ClientUSec)}"); } if (Checksum != null) { Checksum.Format(builder); } if (SubKey != null) { builder.AppendLine("<Sub Session Key>"); builder.AppendLine($"Encryption Type : {SubKey.KeyEncryption}"); builder.AppendLine($"Encryption Key : {NtObjectUtils.ToHexString(SubKey.Key)}"); } if (SequenceNumber.HasValue) { builder.AppendLine($"Sequence Number : 0x{SequenceNumber:X}"); } if (AuthorizationData.Count > 0) { foreach (var ad in AuthorizationData) { ad.Format(builder); } builder.AppendLine(); } return(builder.ToString()); }
private protected override void FormatTicketData(StringBuilder builder) { builder.AppendLine($"Flags : {Flags}"); builder.AppendLine($"Client Name : {ClientName}"); builder.AppendLine($"Client Realm : {ClientRealm}"); if (!string.IsNullOrEmpty(AuthTime)) { builder.AppendLine($"Auth Time : {KerberosUtils.ParseKerberosTime(AuthTime, 0)}"); } if (!string.IsNullOrEmpty(StartTime)) { builder.AppendLine($"Start Time : {KerberosUtils.ParseKerberosTime(StartTime, 0)}"); } if (!string.IsNullOrEmpty(EndTime)) { builder.AppendLine($"End Time : {KerberosUtils.ParseKerberosTime(EndTime, 0)}"); } if (!string.IsNullOrEmpty(RenewTill)) { builder.AppendLine($"Renew Till Time : {KerberosUtils.ParseKerberosTime(RenewTill, 0)}"); } builder.AppendLine(); if (Key != null) { builder.AppendLine("<Session Key>"); builder.AppendLine($"Encryption Type : {Key.KeyEncryption}"); builder.AppendLine($"Encryption Key : {NtObjectUtils.ToHexString(Key.Key)}"); builder.AppendLine(); } if (TransitedType != null && TransitedType.Data.Length > 0) { builder.AppendLine($"<Transited Type - {TransitedType.TransitedType}>"); builder.AppendLine($"{NtObjectUtils.ToHexString(TransitedType.Data)}"); builder.AppendLine(); } if (HostAddresses.Count > 0) { builder.AppendLine("<Host Addresses>"); foreach (var addr in HostAddresses) { builder.AppendLine(addr.ToString()); } builder.AppendLine(); } if (AuthorizationData.Count > 0) { foreach (var ad in AuthorizationData) { ad.Format(builder); } builder.AppendLine(); } }
internal override string Format() { StringBuilder builder = new StringBuilder(); if (!string.IsNullOrEmpty(ClientTime)) { builder.AppendLine($"Client Time : {KerberosUtils.ParseKerberosTime(ClientTime, ClientUSec)}"); } if (SubKey != null) { builder.AppendLine("<Sub Session Key>"); builder.AppendLine($"Encryption Type : {SubKey.KeyEncryption}"); builder.AppendLine($"Encryption Key : {NtObjectUtils.ToHexString(SubKey.Key)}"); } if (SequenceNumber.HasValue) { builder.AppendLine($"Sequence Number : 0x{SequenceNumber:X}"); } return(builder.ToString()); }