diff --git a/Kerberos.NET.sln b/Kerberos.NET.sln
index 01e7acff..fd82338b 100644
--- a/Kerberos.NET.sln
+++ b/Kerberos.NET.sln
@@ -31,36 +31,116 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bruce", "Bruce\Bruce.csproj
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kerberos.NET.PortableDns", "Kerberos.NET.PortableDns\Kerberos.NET.PortableDns.csproj", "{3085F7D7-B384-4EB6-B5F4-CAEDC7C1C0E6}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Asn1SourceGenerator", "Tests\Tests.Asn1SourceGenerator\Tests.Asn1SourceGenerator.csproj", "{73BB1E18-BD2F-418B-BA08-9ACFF8501522}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kerberos.NET.Asn1SourceGenerator", "Tools\Asn1SourceGenerator\Kerberos.NET.Asn1SourceGenerator.csproj", "{89B758DA-DFD7-4CE4-A87E-A33701DF5956}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3066D890-0544-4E13-95FD-1DDCC72FEDA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3066D890-0544-4E13-95FD-1DDCC72FEDA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3066D890-0544-4E13-95FD-1DDCC72FEDA1}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {3066D890-0544-4E13-95FD-1DDCC72FEDA1}.Debug|x64.Build.0 = Debug|Any CPU
+ {3066D890-0544-4E13-95FD-1DDCC72FEDA1}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {3066D890-0544-4E13-95FD-1DDCC72FEDA1}.Debug|x86.Build.0 = Debug|Any CPU
{3066D890-0544-4E13-95FD-1DDCC72FEDA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3066D890-0544-4E13-95FD-1DDCC72FEDA1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3066D890-0544-4E13-95FD-1DDCC72FEDA1}.Release|x64.ActiveCfg = Release|Any CPU
+ {3066D890-0544-4E13-95FD-1DDCC72FEDA1}.Release|x64.Build.0 = Release|Any CPU
+ {3066D890-0544-4E13-95FD-1DDCC72FEDA1}.Release|x86.ActiveCfg = Release|Any CPU
+ {3066D890-0544-4E13-95FD-1DDCC72FEDA1}.Release|x86.Build.0 = Release|Any CPU
{0E4F4471-C2E4-4870-A541-11D14A76AC84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0E4F4471-C2E4-4870-A541-11D14A76AC84}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0E4F4471-C2E4-4870-A541-11D14A76AC84}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {0E4F4471-C2E4-4870-A541-11D14A76AC84}.Debug|x64.Build.0 = Debug|Any CPU
+ {0E4F4471-C2E4-4870-A541-11D14A76AC84}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {0E4F4471-C2E4-4870-A541-11D14A76AC84}.Debug|x86.Build.0 = Debug|Any CPU
{0E4F4471-C2E4-4870-A541-11D14A76AC84}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0E4F4471-C2E4-4870-A541-11D14A76AC84}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0E4F4471-C2E4-4870-A541-11D14A76AC84}.Release|x64.ActiveCfg = Release|Any CPU
+ {0E4F4471-C2E4-4870-A541-11D14A76AC84}.Release|x64.Build.0 = Release|Any CPU
+ {0E4F4471-C2E4-4870-A541-11D14A76AC84}.Release|x86.ActiveCfg = Release|Any CPU
+ {0E4F4471-C2E4-4870-A541-11D14A76AC84}.Release|x86.Build.0 = Release|Any CPU
{046122A3-9C6F-42E8-A21E-E4F2CD4DBCF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{046122A3-9C6F-42E8-A21E-E4F2CD4DBCF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {046122A3-9C6F-42E8-A21E-E4F2CD4DBCF8}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {046122A3-9C6F-42E8-A21E-E4F2CD4DBCF8}.Debug|x64.Build.0 = Debug|Any CPU
+ {046122A3-9C6F-42E8-A21E-E4F2CD4DBCF8}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {046122A3-9C6F-42E8-A21E-E4F2CD4DBCF8}.Debug|x86.Build.0 = Debug|Any CPU
{046122A3-9C6F-42E8-A21E-E4F2CD4DBCF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{046122A3-9C6F-42E8-A21E-E4F2CD4DBCF8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {046122A3-9C6F-42E8-A21E-E4F2CD4DBCF8}.Release|x64.ActiveCfg = Release|Any CPU
+ {046122A3-9C6F-42E8-A21E-E4F2CD4DBCF8}.Release|x64.Build.0 = Release|Any CPU
+ {046122A3-9C6F-42E8-A21E-E4F2CD4DBCF8}.Release|x86.ActiveCfg = Release|Any CPU
+ {046122A3-9C6F-42E8-A21E-E4F2CD4DBCF8}.Release|x86.Build.0 = Release|Any CPU
{5115DFE1-AD08-4AF5-B88C-F436744D7A3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5115DFE1-AD08-4AF5-B88C-F436744D7A3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5115DFE1-AD08-4AF5-B88C-F436744D7A3A}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {5115DFE1-AD08-4AF5-B88C-F436744D7A3A}.Debug|x64.Build.0 = Debug|Any CPU
+ {5115DFE1-AD08-4AF5-B88C-F436744D7A3A}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {5115DFE1-AD08-4AF5-B88C-F436744D7A3A}.Debug|x86.Build.0 = Debug|Any CPU
{5115DFE1-AD08-4AF5-B88C-F436744D7A3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5115DFE1-AD08-4AF5-B88C-F436744D7A3A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {5115DFE1-AD08-4AF5-B88C-F436744D7A3A}.Release|x64.ActiveCfg = Release|Any CPU
+ {5115DFE1-AD08-4AF5-B88C-F436744D7A3A}.Release|x64.Build.0 = Release|Any CPU
+ {5115DFE1-AD08-4AF5-B88C-F436744D7A3A}.Release|x86.ActiveCfg = Release|Any CPU
+ {5115DFE1-AD08-4AF5-B88C-F436744D7A3A}.Release|x86.Build.0 = Release|Any CPU
{D12B0644-0D57-45ED-AA0A-AB18D593CCA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D12B0644-0D57-45ED-AA0A-AB18D593CCA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D12B0644-0D57-45ED-AA0A-AB18D593CCA3}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {D12B0644-0D57-45ED-AA0A-AB18D593CCA3}.Debug|x64.Build.0 = Debug|Any CPU
+ {D12B0644-0D57-45ED-AA0A-AB18D593CCA3}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {D12B0644-0D57-45ED-AA0A-AB18D593CCA3}.Debug|x86.Build.0 = Debug|Any CPU
{D12B0644-0D57-45ED-AA0A-AB18D593CCA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D12B0644-0D57-45ED-AA0A-AB18D593CCA3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D12B0644-0D57-45ED-AA0A-AB18D593CCA3}.Release|x64.ActiveCfg = Release|Any CPU
+ {D12B0644-0D57-45ED-AA0A-AB18D593CCA3}.Release|x64.Build.0 = Release|Any CPU
+ {D12B0644-0D57-45ED-AA0A-AB18D593CCA3}.Release|x86.ActiveCfg = Release|Any CPU
+ {D12B0644-0D57-45ED-AA0A-AB18D593CCA3}.Release|x86.Build.0 = Release|Any CPU
{3085F7D7-B384-4EB6-B5F4-CAEDC7C1C0E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3085F7D7-B384-4EB6-B5F4-CAEDC7C1C0E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3085F7D7-B384-4EB6-B5F4-CAEDC7C1C0E6}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {3085F7D7-B384-4EB6-B5F4-CAEDC7C1C0E6}.Debug|x64.Build.0 = Debug|Any CPU
+ {3085F7D7-B384-4EB6-B5F4-CAEDC7C1C0E6}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {3085F7D7-B384-4EB6-B5F4-CAEDC7C1C0E6}.Debug|x86.Build.0 = Debug|Any CPU
{3085F7D7-B384-4EB6-B5F4-CAEDC7C1C0E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3085F7D7-B384-4EB6-B5F4-CAEDC7C1C0E6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3085F7D7-B384-4EB6-B5F4-CAEDC7C1C0E6}.Release|x64.ActiveCfg = Release|Any CPU
+ {3085F7D7-B384-4EB6-B5F4-CAEDC7C1C0E6}.Release|x64.Build.0 = Release|Any CPU
+ {3085F7D7-B384-4EB6-B5F4-CAEDC7C1C0E6}.Release|x86.ActiveCfg = Release|Any CPU
+ {3085F7D7-B384-4EB6-B5F4-CAEDC7C1C0E6}.Release|x86.Build.0 = Release|Any CPU
+ {73BB1E18-BD2F-418B-BA08-9ACFF8501522}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {73BB1E18-BD2F-418B-BA08-9ACFF8501522}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {73BB1E18-BD2F-418B-BA08-9ACFF8501522}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {73BB1E18-BD2F-418B-BA08-9ACFF8501522}.Debug|x64.Build.0 = Debug|Any CPU
+ {73BB1E18-BD2F-418B-BA08-9ACFF8501522}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {73BB1E18-BD2F-418B-BA08-9ACFF8501522}.Debug|x86.Build.0 = Debug|Any CPU
+ {73BB1E18-BD2F-418B-BA08-9ACFF8501522}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {73BB1E18-BD2F-418B-BA08-9ACFF8501522}.Release|Any CPU.Build.0 = Release|Any CPU
+ {73BB1E18-BD2F-418B-BA08-9ACFF8501522}.Release|x64.ActiveCfg = Release|Any CPU
+ {73BB1E18-BD2F-418B-BA08-9ACFF8501522}.Release|x64.Build.0 = Release|Any CPU
+ {73BB1E18-BD2F-418B-BA08-9ACFF8501522}.Release|x86.ActiveCfg = Release|Any CPU
+ {73BB1E18-BD2F-418B-BA08-9ACFF8501522}.Release|x86.Build.0 = Release|Any CPU
+ {89B758DA-DFD7-4CE4-A87E-A33701DF5956}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {89B758DA-DFD7-4CE4-A87E-A33701DF5956}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {89B758DA-DFD7-4CE4-A87E-A33701DF5956}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {89B758DA-DFD7-4CE4-A87E-A33701DF5956}.Debug|x64.Build.0 = Debug|Any CPU
+ {89B758DA-DFD7-4CE4-A87E-A33701DF5956}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {89B758DA-DFD7-4CE4-A87E-A33701DF5956}.Debug|x86.Build.0 = Debug|Any CPU
+ {89B758DA-DFD7-4CE4-A87E-A33701DF5956}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {89B758DA-DFD7-4CE4-A87E-A33701DF5956}.Release|Any CPU.Build.0 = Release|Any CPU
+ {89B758DA-DFD7-4CE4-A87E-A33701DF5956}.Release|x64.ActiveCfg = Release|Any CPU
+ {89B758DA-DFD7-4CE4-A87E-A33701DF5956}.Release|x64.Build.0 = Release|Any CPU
+ {89B758DA-DFD7-4CE4-A87E-A33701DF5956}.Release|x86.ActiveCfg = Release|Any CPU
+ {89B758DA-DFD7-4CE4-A87E-A33701DF5956}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -72,6 +152,8 @@ Global
{5115DFE1-AD08-4AF5-B88C-F436744D7A3A} = {8F0C1D56-CBBB-4B8B-81D1-5D1544AD5C72}
{D12B0644-0D57-45ED-AA0A-AB18D593CCA3} = {8BD43321-3C92-4D6F-B965-783F2CC4CEE1}
{3085F7D7-B384-4EB6-B5F4-CAEDC7C1C0E6} = {E3EE549C-8245-45E7-A964-E38C78DC9FD3}
+ {73BB1E18-BD2F-418B-BA08-9ACFF8501522} = {8F0C1D56-CBBB-4B8B-81D1-5D1544AD5C72}
+ {89B758DA-DFD7-4CE4-A87E-A33701DF5956} = {8F0C1D56-CBBB-4B8B-81D1-5D1544AD5C72}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {17150968-CFF9-4183-989D-C93E19033096}
diff --git a/Kerberos.NET/Asn1/AsnXml.targets b/Kerberos.NET/Asn1/AsnXml.targets
deleted file mode 100644
index ef5f99b2..00000000
--- a/Kerberos.NET/Asn1/AsnXml.targets
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
-
-
- Asn1\asn.xsd
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Kerberos.NET/Asn1/asn.xsd b/Kerberos.NET/Asn1/asn.xsd
deleted file mode 100644
index 82d9cb22..00000000
--- a/Kerberos.NET/Asn1/asn.xsd
+++ /dev/null
@@ -1,244 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Asn1/asn.xslt b/Kerberos.NET/Asn1/asn.xslt
deleted file mode 100644
index 3b95f841..00000000
--- a/Kerberos.NET/Asn1/asn.xslt
+++ /dev/null
@@ -1,1184 +0,0 @@
-
-
-
-
-
-
-
-
- Error, unknown node ""
-
-
-
- Error, unknown FieldDef node []
-
-
-
- Error, unknown CollectionElementType node () []
-
-
-
- Error, unknown EncodeOptional node []
-
-
-
- Error, unknown EncodeSimpleValue node []
-
-
-
- Error, unknown DefaultTag node []
-
-
-
- Error, unknown DecodeSimpleValue node []
-
-
-
-
-
-
- // -----------------------------------------------------------------------
-// Licensed to The .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// -----------------------------------------------------------------------
-
-// This is a generated file.
-// The generation template has been modified from .NET Runtime implementation
-
-using System;
-using System.Security.Cryptography.Asn1;
-
-namespace
-{
- public partial class :
- {
- /*
- */
-
- private static readonly Asn1Tag ApplicationTag = new Asn1Tag(TagClass.Application, );
-
- public override ReadOnlyMemory<byte> EncodeApplication()
- {
- return EncodeApplication(ApplicationTag);
- }
-
- public static DecodeApplication(ReadOnlyMemory<byte> encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- var sequence = reader.ReadSequence(ApplicationTag);
-
- decoded;
- Decode(sequence, out decoded);
- sequence.ThrowIfNotEmpty();
-
- reader.ThrowIfNotEmpty();
-
- return decoded;
- }
- }
-}
-
-
- // -----------------------------------------------------------------------
-// Licensed to The .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// -----------------------------------------------------------------------
-
-// This is a generated file.
-// The generation template has been modified from .NET Runtime implementation
-
-using System;
-using System.Collections.Generic;
-using System.Security.Cryptography;
-using System.Security.Cryptography.Asn1;
-using Kerberos.NET.Crypto;
-using Kerberos.NET.Asn1;
-
-namespace
-{
- public partial class
- {
- /*
- */
-
-
-#if DEBUG
- static ()
- {
- decoded = new ();
-
- AsnReader reader;
- AsnReader collectionReader;
- }
-#endif // Encoding methods
- public ReadOnlyMemory<byte> Encode()
- {
- var writer = new AsnWriter(AsnEncodingRules.DER);
-
- Encode(writer);
-
- return writer.EncodeAsMemory();
- }
-
- internal void Encode(AsnWriter writer)
- {
- EncodeApplication(writer, ApplicationTag);Encode(writer, Asn1Tag.Sequence);
- }
-
- internal void Encode(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- writer.PopSequence(tag);
- }
-
- internal void EncodeApplication(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- this.Encode(writer, Asn1Tag.Sequence);
-
- writer.PopSequence(tag);
- }
-
- public virtual ReadOnlyMemory<byte> EncodeApplication() => new ReadOnlyMemory<byte>();
-
- private static readonly Asn1Tag ApplicationTag = new Asn1Tag(TagClass.Application, );
-
- public virtual ReadOnlyMemory<byte> EncodeApplication()
- {
- return EncodeApplication(ApplicationTag);
- }
-
- public static DecodeApplication(ReadOnlyMemory<byte> encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- var sequence = reader.ReadSequence(ApplicationTag);
-
- decoded;
- Decode(sequence, Asn1Tag.Sequence, out decoded);
- sequence.ThrowIfNotEmpty();
-
- reader.ThrowIfNotEmpty();
-
- return decoded;
- }
-
- internal static DecodeApplication<T>(AsnReader reader, out T decoded)
- where T: , new()
- {
- var sequence = reader.ReadSequence(ApplicationTag);
-
- Decode(sequence, Asn1Tag.Sequence, out decoded);
- sequence.ThrowIfNotEmpty();
-
- reader.ThrowIfNotEmpty();
-
- return decoded;
- }
-
- internal ReadOnlyMemory<byte> EncodeApplication(Asn1Tag tag)
- {
- using (var writer = new AsnWriter(AsnEncodingRules.DER))
- {
- EncodeApplication(writer, tag);
-
- return writer.EncodeAsMemory();
- }
- }
-
- public static Decode(ReadOnlyMemory<byte> data)
- {
- return Decode(data, AsnEncodingRules.DER);
- }
-
- internal static Decode(ReadOnlyMemory<byte> encoded, AsnEncodingRules ruleSet)
- {
- return Decode(Asn1Tag.Sequence, encoded, ruleSet);
- }
-
- internal static Decode(Asn1Tag expectedTag, ReadOnlyMemory<byte> encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- Decode(reader, expectedTag, out decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static Decode(Asn1Tag expectedTag, ReadOnlyMemory<byte> encoded, AsnEncodingRules ruleSet)
- {
- AsnReader reader = new AsnReader(encoded, ruleSet);
-
- Decode(reader, expectedTag, out decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static void Decode<T>(AsnReader reader, out T decoded)
- where T: , new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- DecodeApplication(reader, out decoded);Decode(reader, Asn1Tag.Sequence, out decoded);
- }
-
- internal static void Decode<T>(AsnReader reader, Asn1Tag expectedTag, out T decoded)
- where T: , new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- decoded = new T();
-
- AsnReader sequenceReader = reader.ReadSequence(expectedTag);
- AsnReader explicitReader;
- AsnReader defaultReader;
- AsnReader collectionReader;
-
- sequenceReader.ThrowIfNotEmpty();
- }
- }
-}
-
-
- // -----------------------------------------------------------------------
-// Licensed to The .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// -----------------------------------------------------------------------
-
-// This is a generated file.
-// The generation template has been modified from .NET Runtime implementation
-
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Security.Cryptography;
-using System.Security.Cryptography.Asn1;
-using Kerberos.NET.Crypto;
-using Kerberos.NET.Asn1;
-
-namespace
-{
- public partial class
- {
- /*
- */
-
-#if DEBUG
- static ()
- {
- var usedTags = new System.Collections.Generic.Dictionary<Asn1Tag, string>();
- Action<Asn1Tag, string> ensureUniqueTag = (tag, fieldName) =>
- {
- if (usedTags.TryGetValue(tag, out string existing))
- {
- throw new InvalidOperationException($"Tag '{tag}' is in use by both '{existing}' and '{fieldName}'");
- }
-
- usedTags.Add(tag, fieldName);
- };
-
- }
-#endif
- // Encoding methods
- public ReadOnlyMemory<byte> Encode()
- {
- var writer = new AsnWriter(AsnEncodingRules.DER);
-
- Encode(writer);
-
- return writer.EncodeAsMemory();
- }
-
- internal void Encode(AsnWriter writer)
- {
- bool wroteValue = false;
-
- if (!wroteValue)
- {
- throw new CryptographicException();
- }
- }
-
- private static readonly Asn1Tag ApplicationTag = new Asn1Tag(TagClass.Application, );
-
- public virtual ReadOnlyMemory<byte> EncodeApplication()
- {
- return EncodeApplication(ApplicationTag);
- }
-
- public static DecodeApplication(ReadOnlyMemory<byte> encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- var sequence = reader.ReadSequence(ApplicationTag);
-
- decoded;
- Decode(sequence, out decoded);
- sequence.ThrowIfNotEmpty();
-
- reader.ThrowIfNotEmpty();
-
- return decoded;
- }
-
- internal ReadOnlyMemory<byte> EncodeApplication(Asn1Tag tag)
- {
- using (var writer = new AsnWriter(AsnEncodingRules.DER))
- {
- writer.PushSequence(tag);
-
- this.Encode(writer);
-
- writer.PopSequence(tag);
-
- return writer.EncodeAsMemory();
- }
- }
-
- public static Decode(ReadOnlyMemory<byte> data)
- {
- return Decode(data, AsnEncodingRules.DER);
- }
-
- internal static Decode(ReadOnlyMemory<byte> encoded, AsnEncodingRules ruleSet)
- {
- AsnReader reader = new AsnReader(encoded, ruleSet);
-
- Decode(reader, out decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static void Decode<T>(AsnReader reader, out T decoded)
- where T: , new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- decoded = new T();
-
- Asn1Tag tag = reader.PeekTag();
- AsnReader explicitReader;
- AsnReader collectionReader;
-
- else
- {
- throw new CryptographicException();
- }
- }
- }
-}
-
-
-
- Error: defaultDerInit and optional both specified in []
-
-
-
- Error: implicitTag and explicitTag both specified in []
-
-
-
- Error: implicitTag and universalTagNumber both specified in []
-
-
-
- Error: neiher optional or defaultDerInit may be specified for fields in a Choice type ()
-
-
-
- private static byte[] = { };
-
-
-
-
- reader = new AsnReader(, AsnEncodingRules.DER);
- reader.ThrowIfNotEmpty();
-
-
-
-
- ensureUniqueTag(new Asn1Tag((UniversalTagNumber)), "");
-
- ensureUniqueTag(, "");
-
-
-
-
-
-
-
- // DEFAULT value handler for .
- {
- using (AsnWriter tmp = new AsnWriter(AsnEncodingRules.DER))
- {
-
-
-
- ReadOnlySpan<byte> encoded = tmp.EncodeAsSpan();
-
- if (!encoded.SequenceEqual())
- {
- writer.WriteEncodedValue(encoded.ToArray());
- }
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
- if (Asn1Extension.HasValue())
- {
- }
-
-
-
-
- if (Asn1Extension.HasValue())
- {
- }
-
-
-
-
- if (Asn1Extension.HasValue())
- {
- if (wroteValue)
- {
- throw new CryptographicException();
- }
-
- wroteValue = true;
- }
-
-
-
- if ( != null)
- {
- if (wroteValue)
- {
- throw new CryptographicException();
- }
-
- wroteValue = true;
- }
-
-
-
-
-
-
-
-
- // DEFAULT value handler for .
- {
- using (AsnWriter tmp = new AsnWriter(AsnEncodingRules.DER))
- {
-
-
-
- ReadOnlySpan<byte> encoded = tmp.EncodeAsSpan();
-
- if (!encoded.SequenceEqual())
- {
- writer.PushSequence();
- writer.WriteEncodedValue(encoded.ToArray());
- writer.PopSequence();
- }
- }
- }
-
-
- writer.PushSequence();
- writer.PopSequence();
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- else if (tag.HasSameClassAndValue())
- {
- explicitReader = reader.ReadSequence();
- explicitReader.ThrowIfNotEmpty();
- }
-
- else if (tag.HasSameClassAndValue())
- {
- }
-
-
-
-
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue())
- {
- explicitReader = sequenceReader.ReadSequence();
-
- explicitReader.ThrowIfNotEmpty();
- }
-
-
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue())
- {
- }
-
-
-
- if (sequenceReader.HasData)
- {
- }
-
-
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue())
- {
- }
-
-
-
-
- explicitReader = sequenceReader.ReadSequence();
-
- explicitReader.ThrowIfNotEmpty();
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public { get; set; }
-
-
-
-
-
-
-
-
-
-
- ?.Encode();
-
-
-
-
-
-
-
-
- .Decode<>(, out tmp);
- = tmp;
-
- .Decode<>(, out tmp);
- = tmp;
-
-
-
- Asn1Tag.Sequence
-
-
- public ReadOnlyMemory<byte>? { get; set; }
-
-
- ReadOnlyMemory<byte>
-
-
-
-
-
-
-
- // Validator for tag constraint for
- {
- if (!Asn1Tag.TryDecode(?.Span, out Asn1Tag validateTag, out _) ||
- !validateTag.HasSameClassAndValue())
- {
- throw new CryptographicException();
- }
- }
-
-
- .WriteEncodedValue(.Value.Span);
-
-
-
-
-
-
-
-
- = .ReadEncodedValue();
-
- if (!.PeekTag().HasSameClassAndValue())
- {
- throw new CryptographicException();
- }
-
- = .ReadEncodedValue();
-
- = .ReadEncodedValue();
-
-
-
- new Asn1Tag([0])
-
- new Asn1Tag((UniversalTagNumber))
-
-
- public bool? { get; set; }
-
-
- bool
-
-
-
-
-
-
-
- .WriteBoolean();
-
-
-
-
-
-
-
- = .ReadBoolean();
-
-
- Asn1Tag.Boolean
-
-
- public System.Numerics.BigInteger? { get; set; }
-
-
-
- public ReadOnlyMemory<byte>? { get; set; }
-
-
-
- public byte? { get; set; }
-
-
-
- public int? { get; set; }
-
-
-
- public ? { get; set; }
-
-
- System.Numerics.BigInteger
- ReadOnlyMemory<byte>
- byte
- int
-
-
-
-
-
-
-
-
-
- .WriteInteger(.Value);
-
-
-
-
-
-
-
-
- .WriteInteger((long).Value);
-
-
-
-
-
-
-
-
- .WriteInteger(.Value.Span);
-
-
-
-
-
-
-
- = .ReadInteger();
-
-
-
-
-
-
-
- = .ReadIntegerBytes();
-
-
-
-
-
-
-
-
-
- if (.TryReadUInt8(out byte tmp))
- {
- = tmp;
- }
- else
- {
- .ThrowIfNotEmpty();
- }
-
-
-
- if (!.TryReadUInt8(out ))
- {
- .ThrowIfNotEmpty();
- }
-
-
-
-
-
-
-
-
-
-
- if (.TryReadInt32(out int tmp))
- {
- = tmp;
- }
- else
- {
- .ThrowIfNotEmpty();
- }
-
-
-
- if (!.TryReadInt32(out int tmp))
- {
- .ThrowIfNotEmpty();
- }
-
- = tmp;
-
-
-
-
-
-
-
-
-
-
-
- if (.TryReadInt32(out int tmp))
- {
- = ()tmp;
- }
- else
- {
- .ThrowIfNotEmpty();
- }
-
-
-
- if (!.TryReadInt32(out tmp))
- {
- .ThrowIfNotEmpty();
- }
-
- = tmp;
-
-
-
- Asn1Tag.Integer
-
-
- public ? { get; set; } public ReadOnlyMemory<byte>? { get; set; }
-
-
- ReadOnlyMemory<byte>
-
-
-
-
-
-
-
- .WriteBitString(.Value.Span.AsReadOnlySpan());
-
-
-
-
-
-
-
-
- if (.TryReadPrimitiveBitStringValue(out _, out ReadOnlyMemory<byte> tmp))
- {
- = ()tmp.AsLong();
- }
- else
- {
- = ().ReadBitString(out _).AsLong();
- }
-
-
-
- Asn1Tag.PrimitiveBitString
-
-
- public { get; set; }
-
-
-
-
-
-
-
-
-
-
- .WriteNamedBitList();
-
-
-
-
-
-
-
- = .ReadNamedBitListValue<>();
-
-
- Asn1Tag.PrimitiveBitString
-
-
- public ReadOnlyMemory<byte>? { get; set; }
-
-
- ReadOnlyMemory<byte>
-
-
-
-
-
-
-
- .WriteOctetString(.Value.Span);
-
-
-
-
-
-
-
-
- if (.TryReadPrimitiveOctetStringBytes(out ReadOnlyMemory<byte> tmp))
- {
- = tmp;
- }
- else
- {
- = .ReadOctetString();
- }
-
-
- Asn1Tag.PrimitiveOctetString
-
-
- public Oid { get; set; }
-
-
-
- public string { get; set; }
-
-
- Oid
- string
-
-
-
-
-
-
-
-
-
- .WriteObjectIdentifier();
-
-
-
-
-
-
-
-
-
-
-
- = .ReadObjectIdentifier();
-
-
-
-
-
-
-
-
-
-
-
- = .ReadObjectIdentifierAsString();
-
-
-
- Asn1Tag.ObjectIdentifier
-
-
- public { get; set; }
-
-
-
-
-
-
-
-
-
-
- .WriteEnumeratedValue();
-
-
-
-
-
-
-
- = .ReadEnumeratedValue<>();
-
-
- Asn1Tag.Enumerated
-
-
-
- public string { get; set; }
-
-
- string
-
-
-
-
-
-
- .WriteCharacterString(UniversalTagNumber., );
-
-
-
-
-
-
-
- = .ReadCharacterString(UniversalTagNumber.);
-
-
- new Asn1Tag(UniversalTagNumber.)
-
-
- public [] { get; set; }
-
-
-
-
-
-
-
- SetOf
- Sequence
-
-
-
- .Push();
-
- for (int i = 0; i < .Length; i++)
- {
- }
-
- .Pop();
-
-
-
-
-
-
-
-
- SetOf
- Sequence
-
-
-
- // Decode SEQUENCE OF for
- {
- collectionReader = .Read();
- var tmpList = new List<>();
- tmpItem;
-
- while (collectionReader.HasData)
- {
- tmpList.Add(tmpItem);
- }
-
- decoded. = tmpList.ToArray();
- }
-
-
- Asn1Tag.Sequence
-
- Asn1Tag.SetOf
-
-
- public DateTimeOffset? { get; set; }
-
-
- DateTimeOffset
-
-
-
-
-
-
-
- .WriteUtcTime();
-
-
-
-
-
-
-
-
- = .ReadUtcTime();
-
- = .ReadUtcTime();
-
-
-
- Asn1Tag.UtcTime
-
-
-
-
-
-
-
-
- .WriteGeneralizedTime(.Value, );
-
- .WriteGeneralizedTime(.Value);
-
-
-
-
-
-
-
-
-
- = .ReadGeneralizedTime();
-
- = .ReadGeneralizedTime();
-
-
-
- Asn1Tag.GeneralizedTime
-
-
-
-
-
- ,
-
-
- ,
-
-
- new Asn1Tag(TagClass.TagClass.ContextSpecific, )
-
- s_default
-
-
- else
- {
- defaultReader = new AsnReader(, AsnEncodingRules.DER);
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Cache/Krb5CredentialCache.cs b/Kerberos.NET/Cache/Krb5CredentialCache.cs
index df5ae8a8..07107afe 100644
--- a/Kerberos.NET/Cache/Krb5CredentialCache.cs
+++ b/Kerberos.NET/Cache/Krb5CredentialCache.cs
@@ -240,7 +240,7 @@ private static object CredToCacheEntry(Krb5Credential cred)
Ticket = KrbTicket.DecodeApplication(cred.Ticket),
CName = KrbPrincipalName.FromString(cred.Client.FullyQualifiedName, cred.Client.Type),
CRealm = cred.Client.Realm,
- EncPart = new KrbEncryptedData { }
+ EncryptedPart = new KrbEncryptedData { }
},
SessionKey = new KrbEncryptionKey
{
diff --git a/Kerberos.NET/Cache/TicketCacheEntry.cs b/Kerberos.NET/Cache/TicketCacheEntry.cs
index fec92038..238d9ca9 100644
--- a/Kerberos.NET/Cache/TicketCacheEntry.cs
+++ b/Kerberos.NET/Cache/TicketCacheEntry.cs
@@ -42,7 +42,7 @@ public static TicketCacheEntry ConvertKrbCredToCacheEntry(KrbEncKrbCredPart cred
{
AuthTime = ticketInfo.AuthTime ?? DateTimeOffset.UtcNow,
EndTime = ticketInfo.EndTime ?? DateTimeOffset.MaxValue,
- Flags = ticketInfo.Flags,
+ Flags = ticketInfo.Flags ?? default,
Key = sessionKey,
Nonce = credPart.Nonce ?? 0,
Realm = ticketInfo.Realm,
@@ -71,7 +71,7 @@ public static TicketCacheEntry ConvertKrbCredToCacheEntry(KrbEncKrbCredPart cred
Ticket = ticket,
CName = ticketInfo.PName,
CRealm = ticketInfo.Realm,
- EncPart = KrbEncryptedData.Encrypt(kdcRepData.EncodeApplication(), sessionKey.AsKey(), usage)
+ EncryptedPart = KrbEncryptedData.Encrypt(kdcRepData.EncodeApplication(), sessionKey.AsKey(), usage)
}
}
};
diff --git a/Kerberos.NET/Client/IAKerb/IAKerbContextResult.cs b/Kerberos.NET/Client/IAKerb/IAKerbContextResult.cs
new file mode 100644
index 00000000..157bd4d2
--- /dev/null
+++ b/Kerberos.NET/Client/IAKerb/IAKerbContextResult.cs
@@ -0,0 +1,40 @@
+// -----------------------------------------------------------------------
+// Licensed to The .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// -----------------------------------------------------------------------
+
+using System;
+
+namespace Kerberos.NET.Client
+{
+ ///
+ /// The result of a single step of IAKerb context establishment.
+ ///
+ public class IAKerbContextResult
+ {
+ ///
+ /// The GSS token to send to the peer. Always present.
+ ///
+ public ReadOnlyMemory Token { get; }
+
+ ///
+ /// Whether the context establishment is still in progress.
+ /// When true, send to the peer and feed their response
+ /// into the next call. When false, authentication is complete.
+ ///
+ public bool ContinueNeeded { get; }
+
+ ///
+ /// The session context for the authenticated connection.
+ /// Only available when is false.
+ ///
+ public ApplicationSessionContext SessionContext { get; }
+
+ internal IAKerbContextResult(ReadOnlyMemory token, bool continueNeeded, ApplicationSessionContext sessionContext = null)
+ {
+ this.Token = token;
+ this.ContinueNeeded = continueNeeded;
+ this.SessionContext = sessionContext;
+ }
+ }
+}
diff --git a/Kerberos.NET/Client/IAKerb/IAKerbInitiator.cs b/Kerberos.NET/Client/IAKerb/IAKerbInitiator.cs
new file mode 100644
index 00000000..29b70497
--- /dev/null
+++ b/Kerberos.NET/Client/IAKerb/IAKerbInitiator.cs
@@ -0,0 +1,305 @@
+// -----------------------------------------------------------------------
+// Licensed to The .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// -----------------------------------------------------------------------
+
+using System;
+using System.IO;
+using System.Security.Cryptography;
+using System.Threading;
+using System.Threading.Tasks;
+using Kerberos.NET.Configuration;
+using Kerberos.NET.Credentials;
+using Kerberos.NET.Crypto;
+using Kerberos.NET.Entities;
+
+namespace Kerberos.NET.Client
+{
+ ///
+ /// The current state of the IAKerb initiator context.
+ ///
+ public enum IAKerbInitiatorState
+ {
+ ///
+ /// Context has not started.
+ ///
+ NotStarted,
+
+ ///
+ /// The client is exchanging KDC messages through the proxy.
+ ///
+ InProgress,
+
+ ///
+ /// Context establishment is complete.
+ ///
+ Complete,
+
+ ///
+ /// Context establishment failed.
+ ///
+ Failed
+ }
+
+ ///
+ /// IAKerb client-side initiator. Wraps a KerberosClient with an IAKerb transport
+ /// to produce IAKERB_PROXY GSS tokens instead of communicating directly with the KDC.
+ ///
+ /// Usage:
+ ///
+ /// var initiator = new IAKerbInitiator(credential, spn);
+ /// var result = await initiator.InitSecurityContext();
+ /// while (result.ContinueNeeded)
+ /// {
+ /// var serverToken = SendToServer(result.Token); // application-specific
+ /// result = await initiator.InitSecurityContext(serverToken);
+ /// }
+ /// // result.Token is the final AP-REQ; result.SessionContext has the session keys
+ ///
+ ///
+ public class IAKerbInitiator : IDisposable
+ {
+ private static readonly Oid IAKerbOid = new(MechType.IAKerb);
+
+ private readonly KerberosClient client;
+ private readonly IAKerbTransport transport;
+ private readonly KerberosCredential credential;
+ private readonly string servicePrincipalName;
+ private readonly MemoryStream transcript = new();
+
+ private Task authenticateTask;
+ private Task serviceTicketTask;
+ private ReadOnlyMemory? cookie;
+ private bool disposed;
+
+ ///
+ /// The current state of the initiator.
+ ///
+ public IAKerbInitiatorState State { get; private set; } = IAKerbInitiatorState.NotStarted;
+
+ ///
+ /// The AP options to use when creating the final AP-REQ.
+ ///
+ public ApOptions ApOptions { get; set; } = ApOptions.MutualRequired;
+
+ ///
+ /// The GSS context flags to use for the security context.
+ ///
+ public GssContextEstablishmentFlag GssContextFlags { get; set; } =
+ GssContextEstablishmentFlag.GSS_C_REPLAY_FLAG |
+ GssContextEstablishmentFlag.GSS_C_SEQUENCE_FLAG |
+ GssContextEstablishmentFlag.GSS_C_CONF_FLAG |
+ GssContextEstablishmentFlag.GSS_C_INTEG_FLAG |
+ GssContextEstablishmentFlag.GSS_C_EXTENDED_ERROR_FLAG;
+
+ ///
+ /// The session context after successful authentication.
+ /// Only available when is .
+ ///
+ public ApplicationSessionContext SessionContext { get; private set; }
+
+ ///
+ /// Creates a new IAKerb initiator that will authenticate using the given credential
+ /// and request a service ticket for the specified SPN.
+ ///
+ /// The credential to authenticate with.
+ /// The SPN of the target service.
+ /// Optional Kerberos configuration.
+ public IAKerbInitiator(
+ KerberosCredential credential,
+ string servicePrincipalName,
+ Krb5Config config = null
+ )
+ {
+ this.credential = credential ?? throw new ArgumentNullException(nameof(credential));
+ this.servicePrincipalName = servicePrincipalName ?? throw new ArgumentNullException(nameof(servicePrincipalName));
+
+ this.transport = new IAKerbTransport();
+ this.client = new KerberosClient(config, transports: this.transport);
+ }
+
+ ///
+ /// Performs one step of the IAKerb GSS-API context establishment.
+ /// Call with null inputToken for the first call, then with the server's response token for subsequent calls.
+ ///
+ /// The GSS token received from the server, or null for the first call.
+ /// Cancellation token.
+ ///
+ /// A tuple of (outputToken, continueNeeded).
+ /// Send outputToken to the server. If continueNeeded is false, authentication is complete.
+ ///
+ public async Task InitSecurityContext(
+ ReadOnlyMemory? inputToken = null,
+ CancellationToken cancellation = default
+ )
+ {
+ try
+ {
+ return await InitSecurityContextCore(inputToken, cancellation).ConfigureAwait(false);
+ }
+ catch
+ {
+ this.State = IAKerbInitiatorState.Failed;
+ throw;
+ }
+ }
+
+ private IAKerbExchange currentExchange;
+ private Task pendingExchangeTask;
+
+ private async Task InitSecurityContextCore(
+ ReadOnlyMemory? inputToken,
+ CancellationToken cancellation
+ )
+ {
+ // Phase 1: Feed the server's response back to the transport
+ if (inputToken.HasValue)
+ {
+ var gssToken = GssApiToken.Decode(inputToken.Value);
+ var iakerb = new IAKerbContextToken(gssToken);
+
+ this.cookie = iakerb.Header.Cookie;
+
+ // Record in transcript (exact wire bytes)
+ var inputBytes = inputToken.Value.ToArray();
+ this.transcript.Write(inputBytes, 0, inputBytes.Length);
+
+ // Provide the KDC response to the transport (unblocks KerberosClient)
+ if (iakerb.Body.Length > 0)
+ {
+ this.currentExchange.ResponseSource.SetResult(iakerb.Body);
+ }
+ }
+
+ // Phase 2: Start or advance the Kerberos flow
+ if (this.State == IAKerbInitiatorState.NotStarted)
+ {
+ this.authenticateTask = this.client.Authenticate(this.credential);
+ this.State = IAKerbInitiatorState.InProgress;
+ }
+
+ // Phase 3: Wait for either the active task to complete or a new exchange
+ return await WaitForNextAction(cancellation).ConfigureAwait(false);
+ }
+
+ private async Task WaitForNextAction(
+ CancellationToken cancellation
+ )
+ {
+ // Only create a new exchange task when the previous one was consumed (set to null).
+ // A completed but unconsumed task holds a valid exchange result that must not be discarded.
+ if (this.pendingExchangeTask == null)
+ {
+ this.pendingExchangeTask = this.transport.GetNextExchangeAsync(cancellation);
+ }
+
+ // Determine which task is currently active
+ Task activeTask = (Task)this.authenticateTask ?? this.serviceTicketTask;
+
+ if (activeTask != null)
+ {
+ var winner = await Task.WhenAny(activeTask, this.pendingExchangeTask).ConfigureAwait(false);
+
+ if (winner == activeTask)
+ {
+ if (activeTask == this.authenticateTask)
+ {
+ await this.authenticateTask.ConfigureAwait(false); // propagate exceptions
+ this.authenticateTask = null;
+
+ // Start service ticket request
+ // IAKerb requires a subkey (for GSS_EXTS_FINISHED), which is generated
+ // when MutualRequired is set. Enforce this regardless of caller's ApOptions.
+ var apOptions = this.ApOptions | ApOptions.MutualRequired;
+
+ this.serviceTicketTask = this.client.GetServiceTicket(
+ new RequestServiceTicket
+ {
+ ServicePrincipalName = this.servicePrincipalName,
+ ApOptions = apOptions,
+ GssContextFlags = this.GssContextFlags,
+ DelegationInfoModifier = this.InjectFinishedExtension
+ },
+ cancellation
+ );
+
+ // Recurse - GetServiceTicket may produce a new exchange
+ // The existing pendingExchangeTask will capture it
+ return await WaitForNextAction(cancellation).ConfigureAwait(false);
+ }
+
+ if (activeTask == this.serviceTicketTask)
+ {
+ this.SessionContext = await this.serviceTicketTask.ConfigureAwait(false);
+ this.State = IAKerbInitiatorState.Complete;
+
+ var apReqBytes = GssApiToken.Encode(IAKerbOid, this.SessionContext.ApReq);
+ return new IAKerbContextResult(apReqBytes, continueNeeded: false, this.SessionContext);
+ }
+ }
+ }
+
+ // An exchange is ready - wrap it in an IAKERB_PROXY token
+ this.currentExchange = await this.pendingExchangeTask.ConfigureAwait(false);
+ this.pendingExchangeTask = null;
+
+ var header = new IAKerbHeader
+ {
+ TargetRealm = this.currentExchange.Domain,
+ Cookie = this.cookie
+ };
+
+ var outputToken = GssApiToken.EncodeIAKerbProxy(header, this.currentExchange.Request);
+
+ // Record in transcript (exact wire bytes)
+ var outputBytes = outputToken.ToArray();
+ this.transcript.Write(outputBytes, 0, outputBytes.Length);
+
+ return new IAKerbContextResult(outputToken, continueNeeded: true);
+ }
+
+ private void InjectFinishedExtension(DelegationInfo delegationInfo, KrbEncryptionKey subkey)
+ {
+ if (delegationInfo == null)
+ {
+ return;
+ }
+
+ if (subkey == null)
+ {
+ throw new InvalidOperationException(
+ "IAKerb requires an authenticator subkey for GSS_EXTS_FINISHED, but none was generated.");
+ }
+
+ // Compute the FINISHED checksum over the transcript of all preceding GSS tokens
+ var transcriptBytes = this.transcript.ToArray();
+ var finished = KrbFinished.Create(transcriptBytes, subkey.AsKey());
+
+ // Encode as a GSS-API CFX extension
+ var finishedEncoded = finished.Encode();
+ var extensionEncoded = GssApiCfxExtensions.Encode(KrbFinished.GssExtsFinishedType, finishedEncoded);
+
+ delegationInfo.Extensions = extensionEncoded;
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!this.disposed)
+ {
+ if (disposing)
+ {
+ this.client?.Dispose();
+ this.transcript?.Dispose();
+ }
+
+ this.disposed = true;
+ }
+ }
+
+ public void Dispose()
+ {
+ this.Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+ }
+}
diff --git a/Kerberos.NET/Client/IAKerb/IAKerbTransport.cs b/Kerberos.NET/Client/IAKerb/IAKerbTransport.cs
new file mode 100644
index 00000000..ae8e7c73
--- /dev/null
+++ b/Kerberos.NET/Client/IAKerb/IAKerbTransport.cs
@@ -0,0 +1,89 @@
+// -----------------------------------------------------------------------
+// Licensed to The .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// -----------------------------------------------------------------------
+
+using System;
+using System.Collections.Concurrent;
+using System.Threading;
+using System.Threading.Tasks;
+using Kerberos.NET.Transport;
+
+namespace Kerberos.NET.Client
+{
+ ///
+ /// Represents a single KDC message exchange captured by the IAKerb transport.
+ /// Contains the domain/realm, the outgoing request bytes, and a completion source
+ /// for the response that will be provided by the IAKerb initiator.
+ ///
+ internal class IAKerbExchange
+ {
+ public string Domain { get; }
+
+ public ReadOnlyMemory Request { get; }
+
+ public TaskCompletionSource> ResponseSource { get; }
+
+ public IAKerbExchange(string domain, ReadOnlyMemory request)
+ {
+ this.Domain = domain;
+ this.Request = request;
+ this.ResponseSource = new TaskCompletionSource>(
+ TaskCreationOptions.RunContinuationsAsynchronously
+ );
+ }
+ }
+
+ ///
+ /// A custom Kerberos transport that bridges between the KerberosClient's
+ /// async message flow and the step-by-step IAKerb token exchange.
+ ///
+ /// When the KerberosClient calls SendMessage, this transport captures the
+ /// request and waits for the IAKerb initiator to provide a response.
+ /// Supports multiple sequential exchanges (pre-auth retries, referrals).
+ ///
+ internal class IAKerbTransport : KerberosTransportBase
+ {
+ private readonly ConcurrentQueue exchanges = new ConcurrentQueue();
+ private readonly SemaphoreSlim exchangeReady = new SemaphoreSlim(0);
+
+ public IAKerbTransport()
+ : base(null)
+ {
+ this.Enabled = true;
+ }
+
+ public override async Task> SendMessage(
+ string domain,
+ ReadOnlyMemory req,
+ CancellationToken cancellation = default
+ )
+ {
+ var exchange = new IAKerbExchange(domain, req);
+
+ // Enqueue the exchange and signal the initiator
+ this.exchanges.Enqueue(exchange);
+ this.exchangeReady.Release();
+
+ // Wait for the IAKerb initiator to provide the KDC response
+ using var registration = cancellation.Register(
+ () => exchange.ResponseSource.TrySetCanceled(cancellation)
+ );
+
+ return await exchange.ResponseSource.Task.ConfigureAwait(false);
+ }
+
+ ///
+ /// Gets the next pending exchange from the KerberosClient.
+ /// Called by the IAKerb initiator to retrieve outgoing KDC requests.
+ ///
+ internal async Task GetNextExchangeAsync(CancellationToken cancellation = default)
+ {
+ await this.exchangeReady.WaitAsync(cancellation).ConfigureAwait(false);
+
+ this.exchanges.TryDequeue(out var exchange);
+
+ return exchange;
+ }
+ }
+}
diff --git a/Kerberos.NET/Client/KerberosClient.cs b/Kerberos.NET/Client/KerberosClient.cs
index ee1519d2..766e4019 100644
--- a/Kerberos.NET/Client/KerberosClient.cs
+++ b/Kerberos.NET/Client/KerberosClient.cs
@@ -583,7 +583,7 @@ out authenticator
var krbPrivEncPartDecrypted = new KrbEncKrbPrivPart
{
UserData = changeUserPassword.Encode(),
- SeqNumber = authenticator.SequenceNumber,
+ SequenceNumber = authenticator.SequenceNumber,
Usec = authenticator.CuSec,
SAddress = new KrbHostAddress()
};
@@ -937,7 +937,7 @@ CancellationToken cancellation
{
var serviceTicketCacheEntry = await this.RequestTgs(rst, tgtEntry, cancellation).ConfigureAwait(false);
- var encKdcRepPart = serviceTicketCacheEntry.KdcResponse.EncPart.Decrypt(
+ var encKdcRepPart = serviceTicketCacheEntry.KdcResponse.EncryptedPart.Decrypt(
serviceTicketCacheEntry.SessionKey.AsKey(),
serviceTicketCacheEntry.SessionKey.Usage,
d => KrbEncTgsRepPart.DecodeApplication(d)
@@ -1301,7 +1301,7 @@ out KrbEncryptionKey subkey
tgs
).ConfigureAwait(false);
- var encKdcRepPart = tgsRep.EncPart.Decrypt(
+ var encKdcRepPart = tgsRep.EncryptedPart.Decrypt(
subkey.AsKey(),
KeyUsage.EncTgsRepPartSubSessionKey,
d => KrbEncTgsRepPart.DecodeApplication(d)
diff --git a/Kerberos.NET/Credentials/KerberosAsymmetricCredential.cs b/Kerberos.NET/Credentials/KerberosAsymmetricCredential.cs
index 0abf94ba..a45231e9 100644
--- a/Kerberos.NET/Credentials/KerberosAsymmetricCredential.cs
+++ b/Kerberos.NET/Credentials/KerberosAsymmetricCredential.cs
@@ -364,9 +364,9 @@ private ReadOnlyMemory DeriveDHKeyAgreement(KrbKdcRep kdcRep, KrbPaPkAsRep
serverDHNonce = pkRep.DHInfo.ServerDHNonce.Value.Span;
}
- var transform = CryptoService.CreateTransform(kdcRep.EncPart.EType);
+ var transform = CryptoService.CreateTransform(kdcRep.EncryptedPart.EType);
- etype = kdcRep.EncPart.EType;
+ etype = kdcRep.EncryptedPart.EType;
return PKInitString2Key.String2Key(derivedKey.Span, transform.KeySize, this.clientDHNonce.Span, serverDHNonce);
}
diff --git a/Kerberos.NET/Credentials/KerberosCredential.cs b/Kerberos.NET/Credentials/KerberosCredential.cs
index 6071df9c..40047d6b 100644
--- a/Kerberos.NET/Credentials/KerberosCredential.cs
+++ b/Kerberos.NET/Credentials/KerberosCredential.cs
@@ -128,7 +128,7 @@ public virtual T DecryptKdcRep(KrbKdcRep kdcRep, KeyUsage keyUsage, Func NewPasswd { get; set; }
-
- public KrbPrincipalName TargName { get; set; }
-
- public string TargRealm { get; set; }
-
- // Encoding methods
- public ReadOnlyMemory Encode()
- {
- var writer = new AsnWriter(AsnEncodingRules.DER);
-
- Encode(writer);
-
- return writer.EncodeAsMemory();
- }
-
- internal void Encode(AsnWriter writer)
- {
- Encode(writer, Asn1Tag.Sequence);
- }
-
- internal void Encode(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- writer.WriteOctetString(NewPasswd.Span);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
-
- if (Asn1Extension.HasValue(TargName))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- TargName?.Encode(writer);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- }
-
- if (Asn1Extension.HasValue(TargRealm))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- writer.WriteCharacterString(UniversalTagNumber.GeneralString, TargRealm);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- }
-
- writer.PopSequence(tag);
- }
-
- internal void EncodeApplication(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- this.Encode(writer, Asn1Tag.Sequence);
-
- writer.PopSequence(tag);
- }
-
- public virtual ReadOnlyMemory EncodeApplication() => new ReadOnlyMemory();
-
- internal ReadOnlyMemory EncodeApplication(Asn1Tag tag)
- {
- using (var writer = new AsnWriter(AsnEncodingRules.DER))
- {
- EncodeApplication(writer, tag);
-
- return writer.EncodeAsMemory();
- }
- }
-
- public static KrbChangePasswdData Decode(ReadOnlyMemory data)
- {
- return Decode(data, AsnEncodingRules.DER);
- }
-
- internal static KrbChangePasswdData Decode(ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- return Decode(Asn1Tag.Sequence, encoded, ruleSet);
- }
-
- internal static KrbChangePasswdData Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- Decode(reader, expectedTag, out KrbChangePasswdData decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static KrbChangePasswdData Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- AsnReader reader = new AsnReader(encoded, ruleSet);
-
- Decode(reader, expectedTag, out KrbChangePasswdData decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static void Decode(AsnReader reader, out T decoded)
- where T: KrbChangePasswdData, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- Decode(reader, Asn1Tag.Sequence, out decoded);
- }
-
- internal static void Decode(AsnReader reader, Asn1Tag expectedTag, out T decoded)
- where T: KrbChangePasswdData, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- decoded = new T();
-
- AsnReader sequenceReader = reader.ReadSequence(expectedTag);
- AsnReader explicitReader;
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
-
- if (explicitReader.TryReadPrimitiveOctetStringBytes(out ReadOnlyMemory tmpNewPasswd))
- {
- decoded.NewPasswd = tmpNewPasswd;
- }
- else
- {
- decoded.NewPasswd = explicitReader.ReadOctetString();
- }
-
- explicitReader.ThrowIfNotEmpty();
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 1)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
-
- KrbPrincipalName.Decode(explicitReader, out KrbPrincipalName tmpTargName);
- decoded.TargName = tmpTargName;
- explicitReader.ThrowIfNotEmpty();
- }
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 2)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
-
- decoded.TargRealm = explicitReader.ReadCharacterString(UniversalTagNumber.GeneralString);
- explicitReader.ThrowIfNotEmpty();
- }
-
- sequenceReader.ThrowIfNotEmpty();
- }
- }
-}
diff --git a/Kerberos.NET/Entities/ChangePassword/KrbChangePasswdData.xml b/Kerberos.NET/Entities/ChangePassword/KrbChangePasswdData.xml
deleted file mode 100644
index f2e3f64b..00000000
--- a/Kerberos.NET/Entities/ChangePassword/KrbChangePasswdData.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/ChangePassword/KrbChangePasswordRep.cs b/Kerberos.NET/Entities/ChangePassword/KrbChangePasswordRep.cs
index 623b92af..be82b643 100644
--- a/Kerberos.NET/Entities/ChangePassword/KrbChangePasswordRep.cs
+++ b/Kerberos.NET/Entities/ChangePassword/KrbChangePasswordRep.cs
@@ -89,7 +89,7 @@ private void Decode(ReadOnlyMemory data)
public void Decrypt(KerberosKey key)
{
- encKrbPriv = KrbPriv.EncPart.Decrypt(
+ encKrbPriv = KrbPriv.EncryptedPart.Decrypt(
key,
KeyUsage.EncKrbPrivPart,
d => KrbEncKrbPrivPart.DecodeApplication(d)
diff --git a/Kerberos.NET/Entities/GssApi/GssApiCfxExtensions.cs b/Kerberos.NET/Entities/GssApi/GssApiCfxExtensions.cs
new file mode 100644
index 00000000..e90e462e
--- /dev/null
+++ b/Kerberos.NET/Entities/GssApi/GssApiCfxExtensions.cs
@@ -0,0 +1,66 @@
+// -----------------------------------------------------------------------
+// Licensed to The .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// -----------------------------------------------------------------------
+
+using System;
+using System.Buffers.Binary;
+
+namespace Kerberos.NET.Entities
+{
+ ///
+ /// Encodes and decodes GSS-API CFX extensions per RFC 6542.
+ /// Extensions are binary TLV: 4-byte big-endian type, 4-byte big-endian length, then data.
+ /// Multiple extensions are concatenated.
+ ///
+ public static class GssApiCfxExtensions
+ {
+ public static ReadOnlyMemory Encode(int extType, ReadOnlyMemory extData)
+ {
+ var result = new byte[4 + 4 + extData.Length];
+
+ BinaryPrimitives.WriteInt32BigEndian(result.AsSpan(0, 4), extType);
+ BinaryPrimitives.WriteInt32BigEndian(result.AsSpan(4, 4), extData.Length);
+
+ extData.Span.CopyTo(result.AsSpan(8));
+
+ return result;
+ }
+
+ public static (int type, ReadOnlyMemory data) Decode(ReadOnlyMemory encoded)
+ {
+ return FindExtension(encoded, extTypeFilter: null);
+ }
+
+ ///
+ /// Searches the extensions blob for a specific extension type.
+ ///
+ public static (int type, ReadOnlyMemory data) FindExtension(
+ ReadOnlyMemory encoded,
+ int? extTypeFilter)
+ {
+ var span = encoded.Span;
+ int offset = 0;
+
+ while (offset + 8 <= span.Length)
+ {
+ int extType = BinaryPrimitives.ReadInt32BigEndian(span.Slice(offset, 4));
+ int extLen = BinaryPrimitives.ReadInt32BigEndian(span.Slice(offset + 4, 4));
+
+ if (offset + 8 + extLen > span.Length)
+ {
+ throw new InvalidOperationException("GSS-API CFX extension length exceeds available data.");
+ }
+
+ if (!extTypeFilter.HasValue || extType == extTypeFilter.Value)
+ {
+ return (extType, encoded.Slice(offset + 8, extLen));
+ }
+
+ offset += 8 + extLen;
+ }
+
+ throw new InvalidOperationException($"GSS-API CFX extension type {extTypeFilter} not found.");
+ }
+ }
+}
diff --git a/Kerberos.NET/Entities/GssApi/GssApiToken.cs b/Kerberos.NET/Entities/GssApi/GssApiToken.cs
index 5ac97f5e..0e39085b 100644
--- a/Kerberos.NET/Entities/GssApi/GssApiToken.cs
+++ b/Kerberos.NET/Entities/GssApi/GssApiToken.cs
@@ -51,6 +51,87 @@ private static readonly ReadOnlyDictionary MessageTokenTypes
private static readonly ReadOnlyDictionary TokenMessageTypes
= new(MessageTokenTypes.ToDictionary(t => t.Value, t => t.Key));
+ private static readonly Oid IAKerbOid = new(MechType.IAKerb);
+
+ public static ReadOnlyMemory EncodeIAKerbProxy(IAKerbHeader header, ReadOnlyMemory kerbMessage)
+ {
+ if (header == null)
+ {
+ throw new ArgumentNullException(nameof(header));
+ }
+
+ // Encode the OID using an AsnWriter
+ byte[] oidEncoded;
+
+ using (var oidWriter = new AsnWriter(AsnEncodingRules.DER))
+ {
+ oidWriter.WriteObjectIdentifier(IAKerbOid);
+ oidEncoded = oidWriter.Encode();
+ }
+
+ // TOK_ID for IAKERB_PROXY: 05 01
+ var tokenTypeBytes = new byte[] { 0x05, 0x01 };
+ var headerEncoded = header.Encode();
+
+ // Calculate total inner content length
+ int innerLength = oidEncoded.Length + tokenTypeBytes.Length + headerEncoded.Length + kerbMessage.Length;
+
+ // Build the APPLICATION 0 IMPLICIT SEQUENCE manually
+ // Tag = 0x60, then DER length, then content
+ using (var stream = new System.IO.MemoryStream())
+ {
+ stream.WriteByte(0x60); // APPLICATION 0 CONSTRUCTED
+ WriteDerLength(stream, innerLength);
+ stream.Write(oidEncoded, 0, oidEncoded.Length);
+ stream.Write(tokenTypeBytes, 0, tokenTypeBytes.Length);
+
+ var headerBytes = headerEncoded.ToArray();
+ stream.Write(headerBytes, 0, headerBytes.Length);
+
+ if (kerbMessage.Length > 0)
+ {
+ var msgBytes = kerbMessage.ToArray();
+ stream.Write(msgBytes, 0, msgBytes.Length);
+ }
+
+ return stream.ToArray();
+ }
+ }
+
+ private static void WriteDerLength(System.IO.MemoryStream stream, int length)
+ {
+ if (length < 0x80)
+ {
+ stream.WriteByte((byte)length);
+ }
+ else if (length <= 0xFF)
+ {
+ stream.WriteByte(0x81);
+ stream.WriteByte((byte)length);
+ }
+ else if (length <= 0xFFFF)
+ {
+ stream.WriteByte(0x82);
+ stream.WriteByte((byte)(length >> 8));
+ stream.WriteByte((byte)length);
+ }
+ else if (length <= 0xFFFFFF)
+ {
+ stream.WriteByte(0x83);
+ stream.WriteByte((byte)(length >> 16));
+ stream.WriteByte((byte)(length >> 8));
+ stream.WriteByte((byte)length);
+ }
+ else
+ {
+ stream.WriteByte(0x84);
+ stream.WriteByte((byte)(length >> 24));
+ stream.WriteByte((byte)(length >> 16));
+ stream.WriteByte((byte)(length >> 8));
+ stream.WriteByte((byte)length);
+ }
+ }
+
public static ReadOnlyMemory Encode(Oid oid, NegotiationToken token)
{
if (token == null)
diff --git a/Kerberos.NET/Entities/Kkdcp/KdcProxyMessage.generated.cs b/Kerberos.NET/Entities/Kkdcp/KdcProxyMessage.generated.cs
deleted file mode 100644
index 51934eb3..00000000
--- a/Kerberos.NET/Entities/Kkdcp/KdcProxyMessage.generated.cs
+++ /dev/null
@@ -1,187 +0,0 @@
-// -----------------------------------------------------------------------
-// Licensed to The .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// -----------------------------------------------------------------------
-
-// This is a generated file.
-// The generation template has been modified from .NET Runtime implementation
-
-using System;
-using System.Security.Cryptography;
-using System.Security.Cryptography.Asn1;
-using Kerberos.NET.Crypto;
-using Kerberos.NET.Asn1;
-
-namespace Kerberos.NET.Entities
-{
- public partial class KdcProxyMessage
- {
- /*
- KDC-PROXY-MESSAGE::= SEQUENCE {
- kerb-message [0] OCTET STRING,
- target-domain [1] KERB-REALM OPTIONAL,
- dclocator-hint [2] INTEGER OPTIONAL
- }
- */
-
- public ReadOnlyMemory KerbMessage { get; set; }
-
- public string TargetDomain { get; set; }
-
- public DcLocatorHint? DcLocatorHint { get; set; }
-
- // Encoding methods
- public ReadOnlyMemory Encode()
- {
- var writer = new AsnWriter(AsnEncodingRules.DER);
-
- Encode(writer);
-
- return writer.EncodeAsMemory();
- }
-
- internal void Encode(AsnWriter writer)
- {
- Encode(writer, Asn1Tag.Sequence);
- }
-
- internal void Encode(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- writer.WriteOctetString(KerbMessage.Span);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
-
- if (Asn1Extension.HasValue(TargetDomain))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- writer.WriteCharacterString(UniversalTagNumber.GeneralString, TargetDomain);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- }
-
-
- if (Asn1Extension.HasValue(DcLocatorHint))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- writer.WriteInteger((long)DcLocatorHint.Value);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- }
- writer.PopSequence(tag);
- }
-
- internal void EncodeApplication(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- this.Encode(writer, Asn1Tag.Sequence);
-
- writer.PopSequence(tag);
- }
-
- public virtual ReadOnlyMemory EncodeApplication() => new ReadOnlyMemory();
-
- internal ReadOnlyMemory EncodeApplication(Asn1Tag tag)
- {
- using (var writer = new AsnWriter(AsnEncodingRules.DER))
- {
- EncodeApplication(writer, tag);
-
- return writer.EncodeAsMemory();
- }
- }
-
- public static KdcProxyMessage Decode(ReadOnlyMemory data)
- {
- return Decode(data, AsnEncodingRules.DER);
- }
-
- internal static KdcProxyMessage Decode(ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- return Decode(Asn1Tag.Sequence, encoded, ruleSet);
- }
-
- internal static KdcProxyMessage Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- Decode(reader, expectedTag, out KdcProxyMessage decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static KdcProxyMessage Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- AsnReader reader = new AsnReader(encoded, ruleSet);
-
- Decode(reader, expectedTag, out KdcProxyMessage decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static void Decode(AsnReader reader, out T decoded)
- where T: KdcProxyMessage, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- Decode(reader, Asn1Tag.Sequence, out decoded);
- }
-
- internal static void Decode(AsnReader reader, Asn1Tag expectedTag, out T decoded)
- where T: KdcProxyMessage, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- decoded = new T();
-
- AsnReader sequenceReader = reader.ReadSequence(expectedTag);
- AsnReader explicitReader;
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
-
- if (explicitReader.TryReadPrimitiveOctetStringBytes(out ReadOnlyMemory tmpKerbMessage))
- {
- decoded.KerbMessage = tmpKerbMessage;
- }
- else
- {
- decoded.KerbMessage = explicitReader.ReadOctetString();
- }
-
- explicitReader.ThrowIfNotEmpty();
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 1)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
-
- decoded.TargetDomain = explicitReader.ReadCharacterString(UniversalTagNumber.GeneralString);
- explicitReader.ThrowIfNotEmpty();
- }
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 2)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
-
-
- if (explicitReader.TryReadInt32(out int tmpDcLocatorHint))
- {
- decoded.DcLocatorHint = (DcLocatorHint)tmpDcLocatorHint;
- }
- else
- {
- explicitReader.ThrowIfNotEmpty();
- }
-
- explicitReader.ThrowIfNotEmpty();
- }
-
- sequenceReader.ThrowIfNotEmpty();
- }
- }
-}
diff --git a/Kerberos.NET/Entities/Kkdcp/KdcProxyMessage.xml b/Kerberos.NET/Entities/Kkdcp/KdcProxyMessage.xml
deleted file mode 100644
index 5c8f50fd..00000000
--- a/Kerberos.NET/Entities/Kkdcp/KdcProxyMessage.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/DelegationInfo.cs b/Kerberos.NET/Entities/Krb/DelegationInfo.cs
index 7dbc0d11..b9216551 100644
--- a/Kerberos.NET/Entities/Krb/DelegationInfo.cs
+++ b/Kerberos.NET/Entities/Krb/DelegationInfo.cs
@@ -80,6 +80,11 @@ public ReadOnlyMemory Encode()
writer.Write(deleg.ToArray());
}
+ if (this.Extensions.Length > 0)
+ {
+ writer.Write(this.Extensions.ToArray());
+ }
+
return stream.ToArray();
}
}
@@ -94,28 +99,31 @@ public DelegationInfo Decode(ReadOnlyMemory value)
this.Flags = (GssContextEstablishmentFlag)reader.ReadBytes(4).AsLong(littleEndian: true);
- if (reader.BytesAvailable() > 0)
+ if (this.Flags.HasFlag(GssContextEstablishmentFlag.GSS_C_DELEG_FLAG))
{
- this.DelegationOption = reader.ReadInt16();
- }
+ if (reader.BytesAvailable() > 0)
+ {
+ this.DelegationOption = reader.ReadInt16();
+ }
- int delegationLength = 0;
+ int delegationLength = 0;
- if (reader.BytesAvailable() > 0)
- {
- delegationLength = reader.ReadInt16();
- }
+ if (reader.BytesAvailable() > 0)
+ {
+ delegationLength = reader.ReadInt16();
+ }
- byte[] delegationTicket = null;
+ byte[] delegationTicket = null;
- if (reader.BytesAvailable() > 0)
- {
- delegationTicket = reader.ReadBytes(delegationLength);
- }
+ if (reader.BytesAvailable() > 0)
+ {
+ delegationTicket = reader.ReadBytes(delegationLength);
+ }
- if (delegationTicket != null && delegationTicket.Length > 0)
- {
- this.DelegationTicket = KrbCred.DecodeApplication(delegationTicket);
+ if (delegationTicket != null && delegationTicket.Length > 0)
+ {
+ this.DelegationTicket = KrbCred.DecodeApplication(delegationTicket);
+ }
}
if (reader.BytesAvailable() > 0)
diff --git a/Kerberos.NET/Entities/Krb/IAKerbHeader.generated.cs b/Kerberos.NET/Entities/Krb/IAKerbHeader.generated.cs
deleted file mode 100644
index fe41d9c1..00000000
--- a/Kerberos.NET/Entities/Krb/IAKerbHeader.generated.cs
+++ /dev/null
@@ -1,195 +0,0 @@
-// -----------------------------------------------------------------------
-// Licensed to The .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// -----------------------------------------------------------------------
-
-// This is a generated file.
-// The generation template has been modified from .NET Runtime implementation
-
-using System;
-using System.Security.Cryptography;
-using System.Security.Cryptography.Asn1;
-using Kerberos.NET.Crypto;
-using Kerberos.NET.Asn1;
-
-namespace Kerberos.NET.Entities
-{
- public partial class IAKerbHeader
- {
- /*
- IAKERB-HEADER ::= SEQUENCE {
- - - Note that the tag numbers start at 1, not 0, which would
- - - be more conventional for Kerberos.
-
- target-realm [1] UTF8String,
- - - The name of the target realm.
-
- cookie [2] OCTET STRING OPTIONAL,
- - - Opaque data, if sent by the server,
- - - MUST be copied by the client verbatim into
- - - the next IAKRB_PROXY message.
-
- header-flags [3] BIT STRING OPTIONAL,
- ...
- }
- */
-
- public string TargetRealm { get; set; }
-
- public ReadOnlyMemory? Cookie { get; set; }
-
- public int? HeaderFlags { get; set; }
- // Encoding methods
- public ReadOnlyMemory Encode()
- {
- var writer = new AsnWriter(AsnEncodingRules.DER);
-
- Encode(writer);
-
- return writer.EncodeAsMemory();
- }
-
- internal void Encode(AsnWriter writer)
- {
- Encode(writer, Asn1Tag.Sequence);
- }
-
- internal void Encode(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- writer.WriteCharacterString(UniversalTagNumber.UTF8String, TargetRealm);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
-
- if (Asn1Extension.HasValue(Cookie))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- writer.WriteOctetString(Cookie.Value.Span);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- }
-
- if (Asn1Extension.HasValue(HeaderFlags))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
- writer.WriteBitString(HeaderFlags.Value.AsReadOnlySpan());
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
- }
- writer.PopSequence(tag);
- }
-
- internal void EncodeApplication(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- this.Encode(writer, Asn1Tag.Sequence);
-
- writer.PopSequence(tag);
- }
-
- public virtual ReadOnlyMemory EncodeApplication() => new ReadOnlyMemory();
-
- internal ReadOnlyMemory EncodeApplication(Asn1Tag tag)
- {
- using (var writer = new AsnWriter(AsnEncodingRules.DER))
- {
- EncodeApplication(writer, tag);
-
- return writer.EncodeAsMemory();
- }
- }
-
- public static IAKerbHeader Decode(ReadOnlyMemory data)
- {
- return Decode(data, AsnEncodingRules.DER);
- }
-
- internal static IAKerbHeader Decode(ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- return Decode(Asn1Tag.Sequence, encoded, ruleSet);
- }
-
- internal static IAKerbHeader Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- Decode(reader, expectedTag, out IAKerbHeader decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static IAKerbHeader Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- AsnReader reader = new AsnReader(encoded, ruleSet);
-
- Decode(reader, expectedTag, out IAKerbHeader decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static void Decode(AsnReader reader, out T decoded)
- where T: IAKerbHeader, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- Decode(reader, Asn1Tag.Sequence, out decoded);
- }
-
- internal static void Decode(AsnReader reader, Asn1Tag expectedTag, out T decoded)
- where T: IAKerbHeader, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- decoded = new T();
-
- AsnReader sequenceReader = reader.ReadSequence(expectedTag);
- AsnReader explicitReader;
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- decoded.TargetRealm = explicitReader.ReadCharacterString(UniversalTagNumber.UTF8String);
-
- explicitReader.ThrowIfNotEmpty();
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 2)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
-
-
- if (explicitReader.TryReadPrimitiveOctetStringBytes(out ReadOnlyMemory tmpCookie))
- {
- decoded.Cookie = tmpCookie;
- }
- else
- {
- decoded.Cookie = explicitReader.ReadOctetString();
- }
- explicitReader.ThrowIfNotEmpty();
- }
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 3)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
-
-
- if (explicitReader.TryReadPrimitiveBitStringValue(out _, out ReadOnlyMemory tmpHeaderFlags))
- {
- decoded.HeaderFlags = (int)tmpHeaderFlags.AsLong();
- }
- else
- {
- decoded.HeaderFlags = (int)explicitReader.ReadBitString(out _).AsLong();
- }
-
- explicitReader.ThrowIfNotEmpty();
- }
-
- sequenceReader.ThrowIfNotEmpty();
- }
- }
-}
diff --git a/Kerberos.NET/Entities/Krb/IAKerbHeader.xml b/Kerberos.NET/Entities/Krb/IAKerbHeader.xml
deleted file mode 100644
index 7fc0d8db..00000000
--- a/Kerberos.NET/Entities/Krb/IAKerbHeader.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KerberosErrorCode.cs b/Kerberos.NET/Entities/Krb/KerberosErrorCode.cs
index 234f2cee..209e836c 100644
--- a/Kerberos.NET/Entities/Krb/KerberosErrorCode.cs
+++ b/Kerberos.NET/Entities/Krb/KerberosErrorCode.cs
@@ -387,6 +387,16 @@ public enum KerberosErrorCode
///
KRB_AP_ERR_PRINCIPAL_RESERVED = 84,
+ ///
+ /// The IAKERB proxy could not find a KDC.
+ ///
+ KRB_AP_ERR_IAKERB_KDC_NOT_FOUND = 85,
+
+ ///
+ /// The KDC did not respond to the IAKERB proxy.
+ ///
+ KRB_AP_ERR_IAKERB_KDC_NO_RESPONSE = 86,
+
///
/// The provided pre-auth data has expired.
///
diff --git a/Kerberos.NET/Entities/Krb/KrbApRep.generated.cs b/Kerberos.NET/Entities/Krb/KrbApRep.generated.cs
deleted file mode 100644
index 9642cd97..00000000
--- a/Kerberos.NET/Entities/Krb/KrbApRep.generated.cs
+++ /dev/null
@@ -1,189 +0,0 @@
-// -----------------------------------------------------------------------
-// Licensed to The .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// -----------------------------------------------------------------------
-
-// This is a generated file.
-// The generation template has been modified from .NET Runtime implementation
-
-using System;
-using System.Security.Cryptography;
-using System.Security.Cryptography.Asn1;
-using Kerberos.NET.Crypto;
-using Kerberos.NET.Asn1;
-
-namespace Kerberos.NET.Entities
-{
- public partial class KrbApRep
- {
- /*
- AP-REP ::= [APPLICATION 15] SEQUENCE {
- pvno [0] INTEGER (5),
- msg-type [1] INTEGER (15),
- enc-part [2] EncryptedData
- }
-
- EncAPRepPart ::= [APPLICATION 27] SEQUENCE {
- ctime [0] KerberosTime,
- cusec [1] Microseconds,
- subkey [2] EncryptionKey OPTIONAL,
- seq-number [3] UInt32 OPTIONAL
- }
- */
-
- public int ProtocolVersionNumber { get; set; }
-
- public MessageType MessageType { get; set; }
-
- public KrbEncryptedData EncryptedPart { get; set; }
-
- // Encoding methods
- internal void Encode(AsnWriter writer)
- {
- EncodeApplication(writer, ApplicationTag);
- }
-
- internal void Encode(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- writer.WriteInteger(ProtocolVersionNumber);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- writer.WriteInteger((long)MessageType);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- EncryptedPart?.Encode(writer);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- writer.PopSequence(tag);
- }
-
- internal void EncodeApplication(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- this.Encode(writer, Asn1Tag.Sequence);
-
- writer.PopSequence(tag);
- }
-
- private static readonly Asn1Tag ApplicationTag = new Asn1Tag(TagClass.Application, 15);
-
- public virtual ReadOnlyMemory EncodeApplication()
- {
- return EncodeApplication(ApplicationTag);
- }
-
- public static KrbApRep DecodeApplication(ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- var sequence = reader.ReadSequence(ApplicationTag);
-
- KrbApRep decoded;
- Decode(sequence, Asn1Tag.Sequence, out decoded);
- sequence.ThrowIfNotEmpty();
-
- reader.ThrowIfNotEmpty();
-
- return decoded;
- }
-
- internal static KrbApRep DecodeApplication(AsnReader reader, out T decoded)
- where T: KrbApRep, new()
- {
- var sequence = reader.ReadSequence(ApplicationTag);
-
- Decode(sequence, Asn1Tag.Sequence, out decoded);
- sequence.ThrowIfNotEmpty();
-
- reader.ThrowIfNotEmpty();
-
- return decoded;
- }
-
- internal ReadOnlyMemory EncodeApplication(Asn1Tag tag)
- {
- using (var writer = new AsnWriter(AsnEncodingRules.DER))
- {
- EncodeApplication(writer, tag);
-
- return writer.EncodeAsMemory();
- }
- }
-
- internal static KrbApRep Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- Decode(reader, expectedTag, out KrbApRep decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static KrbApRep Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- AsnReader reader = new AsnReader(encoded, ruleSet);
-
- Decode(reader, expectedTag, out KrbApRep decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static void Decode(AsnReader reader, out T decoded)
- where T: KrbApRep, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- DecodeApplication(reader, out decoded);
- }
-
- internal static void Decode(AsnReader reader, Asn1Tag expectedTag, out T decoded)
- where T: KrbApRep, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- decoded = new T();
-
- AsnReader sequenceReader = reader.ReadSequence(expectedTag);
- AsnReader explicitReader;
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
-
- if (!explicitReader.TryReadInt32(out int tmpProtocolVersionNumber))
- {
- explicitReader.ThrowIfNotEmpty();
- }
-
- decoded.ProtocolVersionNumber = tmpProtocolVersionNumber;
-
- explicitReader.ThrowIfNotEmpty();
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
-
- if (!explicitReader.TryReadInt32(out MessageType tmpMessageType))
- {
- explicitReader.ThrowIfNotEmpty();
- }
-
- decoded.MessageType = tmpMessageType;
-
- explicitReader.ThrowIfNotEmpty();
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- KrbEncryptedData.Decode(explicitReader, out KrbEncryptedData tmpEncryptedPart);
- decoded.EncryptedPart = tmpEncryptedPart;
-
- explicitReader.ThrowIfNotEmpty();
-
- sequenceReader.ThrowIfNotEmpty();
- }
- }
-}
diff --git a/Kerberos.NET/Entities/Krb/KrbApRep.xml b/Kerberos.NET/Entities/Krb/KrbApRep.xml
deleted file mode 100644
index b5932d54..00000000
--- a/Kerberos.NET/Entities/Krb/KrbApRep.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbApReq.cs b/Kerberos.NET/Entities/Krb/KrbApReq.cs
index 75b07f5d..8285cf8d 100644
--- a/Kerberos.NET/Entities/Krb/KrbApReq.cs
+++ b/Kerberos.NET/Entities/Krb/KrbApReq.cs
@@ -59,6 +59,16 @@ out KrbAuthenticator authenticator
CRealm = tgsRep.CRealm
};
+ if (rst.IncludeSequenceNumber ?? true)
+ {
+ authenticator.SequenceNumber = GetNonce();
+ }
+
+ if (rst.ApOptions.HasFlag(ApOptions.MutualRequired))
+ {
+ authenticator.Subkey = KrbEncryptionKey.Generate(authenticatorKey.EncryptionType);
+ }
+
if (rst.AuthenticatorChecksum != null)
{
authenticator.Checksum = rst.AuthenticatorChecksum;
@@ -73,17 +83,11 @@ out KrbAuthenticator authenticator
}
else if (rst.GssContextFlags != GssContextEstablishmentFlag.GSS_C_NONE)
{
- authenticator.Checksum = KrbChecksum.EncodeDelegationChecksum(new DelegationInfo(rst));
- }
+ var delegationInfo = new DelegationInfo(rst);
- if (rst.IncludeSequenceNumber ?? true)
- {
- authenticator.SequenceNumber = GetNonce();
- }
+ rst.DelegationInfoModifier?.Invoke(delegationInfo, authenticator.Subkey);
- if (rst.ApOptions.HasFlag(ApOptions.MutualRequired))
- {
- authenticator.Subkey = KrbEncryptionKey.Generate(authenticatorKey.EncryptionType);
+ authenticator.Checksum = KrbChecksum.EncodeDelegationChecksum(delegationInfo);
}
Now(out DateTimeOffset ctime, out int usec);
diff --git a/Kerberos.NET/Entities/Krb/KrbApReq.generated.cs b/Kerberos.NET/Entities/Krb/KrbApReq.generated.cs
deleted file mode 100644
index 2e4619cf..00000000
--- a/Kerberos.NET/Entities/Krb/KrbApReq.generated.cs
+++ /dev/null
@@ -1,213 +0,0 @@
-// -----------------------------------------------------------------------
-// Licensed to The .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// -----------------------------------------------------------------------
-
-// This is a generated file.
-// The generation template has been modified from .NET Runtime implementation
-
-using System;
-using System.Security.Cryptography;
-using System.Security.Cryptography.Asn1;
-using Kerberos.NET.Crypto;
-using Kerberos.NET.Asn1;
-
-namespace Kerberos.NET.Entities
-{
- public partial class KrbApReq
- {
- /*
- AP-REQ ::= [APPLICATION 14] SEQUENCE {
- pvno [0] INTEGER (5),
- msg-type [1] INTEGER (14),
- ap-options [2] APOptions,
- ticket [3] Ticket,
- authenticator [4] EncryptedData
- }
- */
-
- public int ProtocolVersionNumber { get; set; }
-
- public MessageType MessageType { get; set; }
-
- public ApOptions ApOptions { get; set; }
- public KrbTicket Ticket { get; set; }
-
- public KrbEncryptedData Authenticator { get; set; }
-
- // Encoding methods
- internal void Encode(AsnWriter writer)
- {
- EncodeApplication(writer, ApplicationTag);
- }
-
- internal void Encode(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- writer.WriteInteger(ProtocolVersionNumber);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- writer.WriteInteger((long)MessageType);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- writer.WriteBitString(ApOptions.AsReadOnlySpan());
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
- Ticket?.Encode(writer);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 4));
- Authenticator?.Encode(writer);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 4));
- writer.PopSequence(tag);
- }
-
- internal void EncodeApplication(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- this.Encode(writer, Asn1Tag.Sequence);
-
- writer.PopSequence(tag);
- }
-
- private static readonly Asn1Tag ApplicationTag = new Asn1Tag(TagClass.Application, 14);
-
- public virtual ReadOnlyMemory EncodeApplication()
- {
- return EncodeApplication(ApplicationTag);
- }
-
- public static KrbApReq DecodeApplication(ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- var sequence = reader.ReadSequence(ApplicationTag);
-
- KrbApReq decoded;
- Decode(sequence, Asn1Tag.Sequence, out decoded);
- sequence.ThrowIfNotEmpty();
-
- reader.ThrowIfNotEmpty();
-
- return decoded;
- }
-
- internal static KrbApReq DecodeApplication(AsnReader reader, out T decoded)
- where T: KrbApReq, new()
- {
- var sequence = reader.ReadSequence(ApplicationTag);
-
- Decode(sequence, Asn1Tag.Sequence, out decoded);
- sequence.ThrowIfNotEmpty();
-
- reader.ThrowIfNotEmpty();
-
- return decoded;
- }
-
- internal ReadOnlyMemory EncodeApplication(Asn1Tag tag)
- {
- using (var writer = new AsnWriter(AsnEncodingRules.DER))
- {
- EncodeApplication(writer, tag);
-
- return writer.EncodeAsMemory();
- }
- }
-
- internal static KrbApReq Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- Decode(reader, expectedTag, out KrbApReq decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static KrbApReq Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- AsnReader reader = new AsnReader(encoded, ruleSet);
-
- Decode(reader, expectedTag, out KrbApReq decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static void Decode(AsnReader reader, out T decoded)
- where T: KrbApReq, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- DecodeApplication(reader, out decoded);
- }
-
- internal static void Decode(AsnReader reader, Asn1Tag expectedTag, out T decoded)
- where T: KrbApReq, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- decoded = new T();
-
- AsnReader sequenceReader = reader.ReadSequence(expectedTag);
- AsnReader explicitReader;
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
-
- if (!explicitReader.TryReadInt32(out int tmpProtocolVersionNumber))
- {
- explicitReader.ThrowIfNotEmpty();
- }
-
- decoded.ProtocolVersionNumber = tmpProtocolVersionNumber;
-
- explicitReader.ThrowIfNotEmpty();
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
-
- if (!explicitReader.TryReadInt32(out MessageType tmpMessageType))
- {
- explicitReader.ThrowIfNotEmpty();
- }
-
- decoded.MessageType = tmpMessageType;
-
- explicitReader.ThrowIfNotEmpty();
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
-
- if (explicitReader.TryReadPrimitiveBitStringValue(out _, out ReadOnlyMemory tmpApOptions))
- {
- decoded.ApOptions = (ApOptions)tmpApOptions.AsLong();
- }
- else
- {
- decoded.ApOptions = (ApOptions)explicitReader.ReadBitString(out _).AsLong();
- }
-
-
- explicitReader.ThrowIfNotEmpty();
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
- KrbTicket.Decode(explicitReader, out KrbTicket tmpTicket);
- decoded.Ticket = tmpTicket;
-
- explicitReader.ThrowIfNotEmpty();
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 4));
- KrbEncryptedData.Decode(explicitReader, out KrbEncryptedData tmpAuthenticator);
- decoded.Authenticator = tmpAuthenticator;
-
- explicitReader.ThrowIfNotEmpty();
-
- sequenceReader.ThrowIfNotEmpty();
- }
- }
-}
diff --git a/Kerberos.NET/Entities/Krb/KrbApReq.xml b/Kerberos.NET/Entities/Krb/KrbApReq.xml
deleted file mode 100644
index 922b4a84..00000000
--- a/Kerberos.NET/Entities/Krb/KrbApReq.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbAsRep.generated.cs b/Kerberos.NET/Entities/Krb/KrbAsRep.generated.cs
deleted file mode 100644
index 6544ba9c..00000000
--- a/Kerberos.NET/Entities/Krb/KrbAsRep.generated.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-// -----------------------------------------------------------------------
-// Licensed to The .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// -----------------------------------------------------------------------
-
-// This is a generated file.
-// The generation template has been modified from .NET Runtime implementation
-
-using System;
-using System.Security.Cryptography.Asn1;
-
-namespace Kerberos.NET.Entities
-{
- public partial class KrbAsRep : KrbKdcRep
- {
- /*
- AS-REP ::= [APPLICATION 11] KDC-REP
- */
-
- private static readonly Asn1Tag ApplicationTag = new Asn1Tag(TagClass.Application, 11);
-
- public override ReadOnlyMemory EncodeApplication()
- {
- return EncodeApplication(ApplicationTag);
- }
-
- public static KrbAsRep DecodeApplication(ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- var sequence = reader.ReadSequence(ApplicationTag);
-
- KrbAsRep decoded;
- Decode(sequence, out decoded);
- sequence.ThrowIfNotEmpty();
-
- reader.ThrowIfNotEmpty();
-
- return decoded;
- }
- }
-}
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbAsRep.xml b/Kerberos.NET/Entities/Krb/KrbAsRep.xml
deleted file mode 100644
index bc2bf32a..00000000
--- a/Kerberos.NET/Entities/Krb/KrbAsRep.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbAsReq.generated.cs b/Kerberos.NET/Entities/Krb/KrbAsReq.generated.cs
deleted file mode 100644
index 50ea6009..00000000
--- a/Kerberos.NET/Entities/Krb/KrbAsReq.generated.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-// -----------------------------------------------------------------------
-// Licensed to The .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// -----------------------------------------------------------------------
-
-// This is a generated file.
-// The generation template has been modified from .NET Runtime implementation
-
-using System;
-using System.Security.Cryptography.Asn1;
-
-namespace Kerberos.NET.Entities
-{
- public partial class KrbAsReq : KrbKdcReq
- {
- /*
- AS-REQ ::= [APPLICATION 10] KDC-REQ
- */
-
- private static readonly Asn1Tag ApplicationTag = new Asn1Tag(TagClass.Application, 10);
-
- public override ReadOnlyMemory EncodeApplication()
- {
- return EncodeApplication(ApplicationTag);
- }
-
- public static KrbAsReq DecodeApplication(ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- var sequence = reader.ReadSequence(ApplicationTag);
-
- KrbAsReq decoded;
- Decode(sequence, out decoded);
- sequence.ThrowIfNotEmpty();
-
- reader.ThrowIfNotEmpty();
-
- return decoded;
- }
- }
-}
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbAsReq.xml b/Kerberos.NET/Entities/Krb/KrbAsReq.xml
deleted file mode 100644
index 66d712a9..00000000
--- a/Kerberos.NET/Entities/Krb/KrbAsReq.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbAuthenticator.generated.cs b/Kerberos.NET/Entities/Krb/KrbAuthenticator.generated.cs
deleted file mode 100644
index 2a502ee7..00000000
--- a/Kerberos.NET/Entities/Krb/KrbAuthenticator.generated.cs
+++ /dev/null
@@ -1,311 +0,0 @@
-// -----------------------------------------------------------------------
-// Licensed to The .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// -----------------------------------------------------------------------
-
-// This is a generated file.
-// The generation template has been modified from .NET Runtime implementation
-
-using System;
-using System.Collections.Generic;
-using System.Security.Cryptography;
-using System.Security.Cryptography.Asn1;
-using Kerberos.NET.Crypto;
-using Kerberos.NET.Asn1;
-
-namespace Kerberos.NET.Entities
-{
- public partial class KrbAuthenticator
- {
- /*
- Authenticator ::= [APPLICATION 2] SEQUENCE {
- authenticator-vno [0] INTEGER (5),
- crealm [1] Realm,
- cname [2] PrincipalName,
- cksum [3] Checksum OPTIONAL,
- cusec [4] Microseconds,
- ctime [5] KerberosTime,
- subkey [6] EncryptionKey OPTIONAL,
- seq-number [7] UInt32 OPTIONAL,
- authorization-data [8] AuthorizationData OPTIONAL
- }
- */
-
- public int AuthenticatorVersionNumber { get; set; }
-
- public string CRealm { get; set; }
-
- public KrbPrincipalName CName { get; set; }
-
- public KrbChecksum Checksum { get; set; }
-
- public int CuSec { get; set; }
-
- public DateTimeOffset CTime { get; set; }
-
- public KrbEncryptionKey Subkey { get; set; }
-
- public int? SequenceNumber { get; set; }
-
- public KrbAuthorizationData[] AuthorizationData { get; set; }
-
- // Encoding methods
- internal void Encode(AsnWriter writer)
- {
- EncodeApplication(writer, ApplicationTag);
- }
-
- internal void Encode(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- writer.WriteInteger(AuthenticatorVersionNumber);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- writer.WriteCharacterString(UniversalTagNumber.GeneralString, CRealm);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- CName?.Encode(writer);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
-
- if (Asn1Extension.HasValue(Checksum))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
- Checksum?.Encode(writer);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
- }
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 4));
- writer.WriteInteger(CuSec);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 4));
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 5));
- writer.WriteGeneralizedTime(CTime);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 5));
-
- if (Asn1Extension.HasValue(Subkey))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 6));
- Subkey?.Encode(writer);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 6));
- }
-
- if (Asn1Extension.HasValue(SequenceNumber))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 7));
- writer.WriteInteger(SequenceNumber.Value);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 7));
- }
-
- if (Asn1Extension.HasValue(AuthorizationData))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 8));
- writer.PushSequence();
-
- for (int i = 0; i < AuthorizationData.Length; i++)
- {
- AuthorizationData[i]?.Encode(writer);
- }
-
- writer.PopSequence();
-
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 8));
- }
-
- writer.PopSequence(tag);
- }
-
- internal void EncodeApplication(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- this.Encode(writer, Asn1Tag.Sequence);
-
- writer.PopSequence(tag);
- }
-
- private static readonly Asn1Tag ApplicationTag = new Asn1Tag(TagClass.Application, 2);
-
- public virtual ReadOnlyMemory EncodeApplication()
- {
- return EncodeApplication(ApplicationTag);
- }
-
- public static KrbAuthenticator DecodeApplication(ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- var sequence = reader.ReadSequence(ApplicationTag);
-
- KrbAuthenticator decoded;
- Decode(sequence, Asn1Tag.Sequence, out decoded);
- sequence.ThrowIfNotEmpty();
-
- reader.ThrowIfNotEmpty();
-
- return decoded;
- }
-
- internal static KrbAuthenticator DecodeApplication(AsnReader reader, out T decoded)
- where T: KrbAuthenticator, new()
- {
- var sequence = reader.ReadSequence(ApplicationTag);
-
- Decode(sequence, Asn1Tag.Sequence, out decoded);
- sequence.ThrowIfNotEmpty();
-
- reader.ThrowIfNotEmpty();
-
- return decoded;
- }
-
- internal ReadOnlyMemory EncodeApplication(Asn1Tag tag)
- {
- using (var writer = new AsnWriter(AsnEncodingRules.DER))
- {
- EncodeApplication(writer, tag);
-
- return writer.EncodeAsMemory();
- }
- }
-
- internal static KrbAuthenticator Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- Decode(reader, expectedTag, out KrbAuthenticator decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static KrbAuthenticator Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- AsnReader reader = new AsnReader(encoded, ruleSet);
-
- Decode(reader, expectedTag, out KrbAuthenticator decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static void Decode(AsnReader reader, out T decoded)
- where T: KrbAuthenticator, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- DecodeApplication(reader, out decoded);
- }
-
- internal static void Decode(AsnReader reader, Asn1Tag expectedTag, out T decoded)
- where T: KrbAuthenticator, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- decoded = new T();
-
- AsnReader sequenceReader = reader.ReadSequence(expectedTag);
- AsnReader explicitReader;
- AsnReader collectionReader;
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
-
- if (!explicitReader.TryReadInt32(out int tmpAuthenticatorVersionNumber))
- {
- explicitReader.ThrowIfNotEmpty();
- }
-
- decoded.AuthenticatorVersionNumber = tmpAuthenticatorVersionNumber;
-
- explicitReader.ThrowIfNotEmpty();
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- decoded.CRealm = explicitReader.ReadCharacterString(UniversalTagNumber.GeneralString);
-
- explicitReader.ThrowIfNotEmpty();
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- KrbPrincipalName.Decode(explicitReader, out KrbPrincipalName tmpCName);
- decoded.CName = tmpCName;
-
- explicitReader.ThrowIfNotEmpty();
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 3)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
-
- KrbChecksum.Decode(explicitReader, out KrbChecksum tmpChecksum);
- decoded.Checksum = tmpChecksum;
- explicitReader.ThrowIfNotEmpty();
- }
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 4));
-
- if (!explicitReader.TryReadInt32(out int tmpCuSec))
- {
- explicitReader.ThrowIfNotEmpty();
- }
-
- decoded.CuSec = tmpCuSec;
-
- explicitReader.ThrowIfNotEmpty();
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 5));
- decoded.CTime = explicitReader.ReadGeneralizedTime();
-
- explicitReader.ThrowIfNotEmpty();
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 6)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 6));
-
- KrbEncryptionKey.Decode(explicitReader, out KrbEncryptionKey tmpSubkey);
- decoded.Subkey = tmpSubkey;
- explicitReader.ThrowIfNotEmpty();
- }
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 7)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 7));
-
- if (explicitReader.TryReadInt32(out int tmpSequenceNumber))
- {
- decoded.SequenceNumber = tmpSequenceNumber;
- }
- else
- {
- explicitReader.ThrowIfNotEmpty();
- }
-
- explicitReader.ThrowIfNotEmpty();
- }
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 8)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 8));
-
- // Decode SEQUENCE OF for AuthorizationData
- {
- collectionReader = explicitReader.ReadSequence();
- var tmpList = new List();
- KrbAuthorizationData tmpItem;
-
- while (collectionReader.HasData)
- {
- KrbAuthorizationData.Decode(collectionReader, out KrbAuthorizationData tmp);
- tmpItem = tmp;
- tmpList.Add(tmpItem);
- }
-
- decoded.AuthorizationData = tmpList.ToArray();
- }
- explicitReader.ThrowIfNotEmpty();
- }
-
- sequenceReader.ThrowIfNotEmpty();
- }
- }
-}
diff --git a/Kerberos.NET/Entities/Krb/KrbAuthenticator.xml b/Kerberos.NET/Entities/Krb/KrbAuthenticator.xml
deleted file mode 100644
index 9f136899..00000000
--- a/Kerberos.NET/Entities/Krb/KrbAuthenticator.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbAuthorizationData.generated.cs b/Kerberos.NET/Entities/Krb/KrbAuthorizationData.generated.cs
deleted file mode 100644
index f9c899c9..00000000
--- a/Kerberos.NET/Entities/Krb/KrbAuthorizationData.generated.cs
+++ /dev/null
@@ -1,158 +0,0 @@
-// -----------------------------------------------------------------------
-// Licensed to The .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// -----------------------------------------------------------------------
-
-// This is a generated file.
-// The generation template has been modified from .NET Runtime implementation
-
-using System;
-using System.Security.Cryptography;
-using System.Security.Cryptography.Asn1;
-using Kerberos.NET.Crypto;
-using Kerberos.NET.Asn1;
-
-namespace Kerberos.NET.Entities
-{
- public partial class KrbAuthorizationData
- {
- /*
- AuthorizationData ::= SEQUENCE OF SEQUENCE {
- ad-type [0] Int32,
- ad-data [1] OCTET STRING
- }
- */
-
- public AuthorizationDataType Type { get; set; }
-
- public ReadOnlyMemory Data { get; set; }
-
- // Encoding methods
- public ReadOnlyMemory Encode()
- {
- var writer = new AsnWriter(AsnEncodingRules.DER);
-
- Encode(writer);
-
- return writer.EncodeAsMemory();
- }
-
- internal void Encode(AsnWriter writer)
- {
- Encode(writer, Asn1Tag.Sequence);
- }
-
- internal void Encode(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- writer.WriteInteger((long)Type);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- writer.WriteOctetString(Data.Span);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- writer.PopSequence(tag);
- }
-
- internal void EncodeApplication(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- this.Encode(writer, Asn1Tag.Sequence);
-
- writer.PopSequence(tag);
- }
-
- public virtual ReadOnlyMemory EncodeApplication() => new ReadOnlyMemory();
-
- internal ReadOnlyMemory EncodeApplication(Asn1Tag tag)
- {
- using (var writer = new AsnWriter(AsnEncodingRules.DER))
- {
- EncodeApplication(writer, tag);
-
- return writer.EncodeAsMemory();
- }
- }
-
- public static KrbAuthorizationData Decode(ReadOnlyMemory data)
- {
- return Decode(data, AsnEncodingRules.DER);
- }
-
- internal static KrbAuthorizationData Decode(ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- return Decode(Asn1Tag.Sequence, encoded, ruleSet);
- }
-
- internal static KrbAuthorizationData Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- Decode(reader, expectedTag, out KrbAuthorizationData decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static KrbAuthorizationData Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- AsnReader reader = new AsnReader(encoded, ruleSet);
-
- Decode(reader, expectedTag, out KrbAuthorizationData decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static void Decode(AsnReader reader, out T decoded)
- where T: KrbAuthorizationData, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- Decode(reader, Asn1Tag.Sequence, out decoded);
- }
-
- internal static void Decode(AsnReader reader, Asn1Tag expectedTag, out T decoded)
- where T: KrbAuthorizationData, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- decoded = new T();
-
- AsnReader sequenceReader = reader.ReadSequence(expectedTag);
- AsnReader explicitReader;
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
-
- if (!explicitReader.TryReadInt32(out AuthorizationDataType tmpType))
- {
- explicitReader.ThrowIfNotEmpty();
- }
-
- decoded.Type = tmpType;
-
- explicitReader.ThrowIfNotEmpty();
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
-
- if (explicitReader.TryReadPrimitiveOctetStringBytes(out ReadOnlyMemory tmpData))
- {
- decoded.Data = tmpData;
- }
- else
- {
- decoded.Data = explicitReader.ReadOctetString();
- }
-
- explicitReader.ThrowIfNotEmpty();
-
- sequenceReader.ThrowIfNotEmpty();
- }
- }
-}
diff --git a/Kerberos.NET/Entities/Krb/KrbAuthorizationData.xml b/Kerberos.NET/Entities/Krb/KrbAuthorizationData.xml
deleted file mode 100644
index 580ffc2d..00000000
--- a/Kerberos.NET/Entities/Krb/KrbAuthorizationData.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbAuthorizationDataSequence.generated.cs b/Kerberos.NET/Entities/Krb/KrbAuthorizationDataSequence.generated.cs
deleted file mode 100644
index f71338d1..00000000
--- a/Kerberos.NET/Entities/Krb/KrbAuthorizationDataSequence.generated.cs
+++ /dev/null
@@ -1,151 +0,0 @@
-// -----------------------------------------------------------------------
-// Licensed to The .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// -----------------------------------------------------------------------
-
-// This is a generated file.
-// The generation template has been modified from .NET Runtime implementation
-
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Security.Cryptography;
-using System.Security.Cryptography.Asn1;
-using Kerberos.NET.Crypto;
-using Kerberos.NET.Asn1;
-
-namespace Kerberos.NET.Entities
-{
- public partial class KrbAuthorizationDataSequence
- {
- /*
- AuthorizationData ::= SEQUENCE OF SEQUENCE {
- ad-type [0] Int32,
- ad-data [1] OCTET STRING
- }
- */
-
- public KrbAuthorizationData[] AuthorizationData { get; set; }
-
-#if DEBUG
- static KrbAuthorizationDataSequence()
- {
- var usedTags = new System.Collections.Generic.Dictionary();
- Action ensureUniqueTag = (tag, fieldName) =>
- {
- if (usedTags.TryGetValue(tag, out string existing))
- {
- throw new InvalidOperationException($"Tag '{tag}' is in use by both '{existing}' and '{fieldName}'");
- }
-
- usedTags.Add(tag, fieldName);
- };
-
- ensureUniqueTag(Asn1Tag.Sequence, "AuthorizationData");
- }
-#endif
- // Encoding methods
- public ReadOnlyMemory Encode()
- {
- var writer = new AsnWriter(AsnEncodingRules.DER);
-
- Encode(writer);
-
- return writer.EncodeAsMemory();
- }
-
- internal void Encode(AsnWriter writer)
- {
- bool wroteValue = false;
-
- if (AuthorizationData != null)
- {
- if (wroteValue)
- {
- throw new CryptographicException();
- }
-
- writer.PushSequence();
-
- for (int i = 0; i < AuthorizationData.Length; i++)
- {
- AuthorizationData[i]?.Encode(writer);
- }
-
- writer.PopSequence();
-
- wroteValue = true;
- }
-
- if (!wroteValue)
- {
- throw new CryptographicException();
- }
- }
-
- internal ReadOnlyMemory EncodeApplication(Asn1Tag tag)
- {
- using (var writer = new AsnWriter(AsnEncodingRules.DER))
- {
- writer.PushSequence(tag);
-
- this.Encode(writer);
-
- writer.PopSequence(tag);
-
- return writer.EncodeAsMemory();
- }
- }
-
- public static KrbAuthorizationDataSequence Decode(ReadOnlyMemory data)
- {
- return Decode(data, AsnEncodingRules.DER);
- }
-
- internal static KrbAuthorizationDataSequence Decode(ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- AsnReader reader = new AsnReader(encoded, ruleSet);
-
- Decode(reader, out KrbAuthorizationDataSequence decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static void Decode(AsnReader reader, out T decoded)
- where T: KrbAuthorizationDataSequence, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- decoded = new T();
-
- Asn1Tag tag = reader.PeekTag();
- AsnReader collectionReader;
-
- if (tag.HasSameClassAndValue(Asn1Tag.Sequence))
- {
- // Decode SEQUENCE OF for AuthorizationData
- {
- collectionReader = reader.ReadSequence();
- var tmpList = new List();
- KrbAuthorizationData tmpItem;
-
- while (collectionReader.HasData)
- {
- KrbAuthorizationData.Decode(collectionReader, out KrbAuthorizationData tmp);
- tmpItem = tmp;
- tmpList.Add(tmpItem);
- }
-
- decoded.AuthorizationData = tmpList.ToArray();
- }
- }
- else
- {
- throw new CryptographicException();
- }
- }
- }
-}
diff --git a/Kerberos.NET/Entities/Krb/KrbAuthorizationDataSequence.xml b/Kerberos.NET/Entities/Krb/KrbAuthorizationDataSequence.xml
deleted file mode 100644
index 0e652efe..00000000
--- a/Kerberos.NET/Entities/Krb/KrbAuthorizationDataSequence.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbChecksum.generated.cs b/Kerberos.NET/Entities/Krb/KrbChecksum.generated.cs
deleted file mode 100644
index ca847002..00000000
--- a/Kerberos.NET/Entities/Krb/KrbChecksum.generated.cs
+++ /dev/null
@@ -1,158 +0,0 @@
-// -----------------------------------------------------------------------
-// Licensed to The .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// -----------------------------------------------------------------------
-
-// This is a generated file.
-// The generation template has been modified from .NET Runtime implementation
-
-using System;
-using System.Security.Cryptography;
-using System.Security.Cryptography.Asn1;
-using Kerberos.NET.Crypto;
-using Kerberos.NET.Asn1;
-
-namespace Kerberos.NET.Entities
-{
- public partial class KrbChecksum
- {
- /*
- Checksum ::= SEQUENCE {
- cksumtype [0] Int32,
- checksum [1] OCTET STRING
- }
- */
-
- public ChecksumType Type { get; set; }
-
- public ReadOnlyMemory Checksum { get; set; }
-
- // Encoding methods
- public ReadOnlyMemory Encode()
- {
- var writer = new AsnWriter(AsnEncodingRules.DER);
-
- Encode(writer);
-
- return writer.EncodeAsMemory();
- }
-
- internal void Encode(AsnWriter writer)
- {
- Encode(writer, Asn1Tag.Sequence);
- }
-
- internal void Encode(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- writer.WriteInteger((long)Type);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 1 ));
- writer.WriteOctetString(Checksum.Span);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 1 ));
- writer.PopSequence(tag);
- }
-
- internal void EncodeApplication(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- this.Encode(writer, Asn1Tag.Sequence);
-
- writer.PopSequence(tag);
- }
-
- public virtual ReadOnlyMemory EncodeApplication() => new ReadOnlyMemory();
-
- internal ReadOnlyMemory EncodeApplication(Asn1Tag tag)
- {
- using (var writer = new AsnWriter(AsnEncodingRules.DER))
- {
- EncodeApplication(writer, tag);
-
- return writer.EncodeAsMemory();
- }
- }
-
- public static KrbChecksum Decode(ReadOnlyMemory data)
- {
- return Decode(data, AsnEncodingRules.DER);
- }
-
- internal static KrbChecksum Decode(ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- return Decode(Asn1Tag.Sequence, encoded, ruleSet);
- }
-
- internal static KrbChecksum Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- Decode(reader, expectedTag, out KrbChecksum decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static KrbChecksum Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- AsnReader reader = new AsnReader(encoded, ruleSet);
-
- Decode(reader, expectedTag, out KrbChecksum decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static void Decode(AsnReader reader, out T decoded)
- where T: KrbChecksum, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- Decode(reader, Asn1Tag.Sequence, out decoded);
- }
-
- internal static void Decode(AsnReader reader, Asn1Tag expectedTag, out T decoded)
- where T: KrbChecksum, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- decoded = new T();
-
- AsnReader sequenceReader = reader.ReadSequence(expectedTag);
- AsnReader explicitReader;
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
-
- if (!explicitReader.TryReadInt32(out ChecksumType tmpType))
- {
- explicitReader.ThrowIfNotEmpty();
- }
-
- decoded.Type = tmpType;
-
- explicitReader.ThrowIfNotEmpty();
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 1 ));
-
- if (explicitReader.TryReadPrimitiveOctetStringBytes(out ReadOnlyMemory tmpChecksum))
- {
- decoded.Checksum = tmpChecksum;
- }
- else
- {
- decoded.Checksum = explicitReader.ReadOctetString();
- }
-
- explicitReader.ThrowIfNotEmpty();
-
- sequenceReader.ThrowIfNotEmpty();
- }
- }
-}
diff --git a/Kerberos.NET/Entities/Krb/KrbChecksum.xml b/Kerberos.NET/Entities/Krb/KrbChecksum.xml
deleted file mode 100644
index 9b163e62..00000000
--- a/Kerberos.NET/Entities/Krb/KrbChecksum.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbCred.generated.cs b/Kerberos.NET/Entities/Krb/KrbCred.generated.cs
deleted file mode 100644
index 9c00d248..00000000
--- a/Kerberos.NET/Entities/Krb/KrbCred.generated.cs
+++ /dev/null
@@ -1,217 +0,0 @@
-// -----------------------------------------------------------------------
-// Licensed to The .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// -----------------------------------------------------------------------
-
-// This is a generated file.
-// The generation template has been modified from .NET Runtime implementation
-
-using System;
-using System.Collections.Generic;
-using System.Security.Cryptography;
-using System.Security.Cryptography.Asn1;
-using Kerberos.NET.Crypto;
-using Kerberos.NET.Asn1;
-
-namespace Kerberos.NET.Entities
-{
- public partial class KrbCred
- {
- /*
- KRB-CRED ::= [APPLICATION 22] SEQUENCE {
- pvno [0] INTEGER (5),
- msg-type [1] INTEGER (22),
- tickets [2] SEQUENCE OF Ticket,
- enc-part [3] EncryptedData
- }
- */
-
- public int ProtocolVersionNumber { get; set; }
-
- public MessageType MessageType { get; set; }
-
- public KrbTicket[] Tickets { get; set; }
-
- public KrbEncryptedData EncryptedPart { get; set; }
-
- // Encoding methods
- internal void Encode(AsnWriter writer)
- {
- EncodeApplication(writer, ApplicationTag);
- }
-
- internal void Encode(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- writer.WriteInteger(ProtocolVersionNumber);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- writer.WriteInteger((long)MessageType);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- writer.PushSequence();
-
- for (int i = 0; i < Tickets.Length; i++)
- {
- Tickets[i]?.Encode(writer);
- }
-
- writer.PopSequence();
-
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
- EncryptedPart?.Encode(writer);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
- writer.PopSequence(tag);
- }
-
- internal void EncodeApplication(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- this.Encode(writer, Asn1Tag.Sequence);
-
- writer.PopSequence(tag);
- }
-
- private static readonly Asn1Tag ApplicationTag = new Asn1Tag(TagClass.Application, 22);
-
- public virtual ReadOnlyMemory EncodeApplication()
- {
- return EncodeApplication(ApplicationTag);
- }
-
- public static KrbCred DecodeApplication(ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- var sequence = reader.ReadSequence(ApplicationTag);
-
- KrbCred decoded;
- Decode(sequence, Asn1Tag.Sequence, out decoded);
- sequence.ThrowIfNotEmpty();
-
- reader.ThrowIfNotEmpty();
-
- return decoded;
- }
-
- internal static KrbCred DecodeApplication(AsnReader reader, out T decoded)
- where T: KrbCred, new()
- {
- var sequence = reader.ReadSequence(ApplicationTag);
-
- Decode(sequence, Asn1Tag.Sequence, out decoded);
- sequence.ThrowIfNotEmpty();
-
- reader.ThrowIfNotEmpty();
-
- return decoded;
- }
-
- internal ReadOnlyMemory EncodeApplication(Asn1Tag tag)
- {
- using (var writer = new AsnWriter(AsnEncodingRules.DER))
- {
- EncodeApplication(writer, tag);
-
- return writer.EncodeAsMemory();
- }
- }
-
- internal static KrbCred Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- Decode(reader, expectedTag, out KrbCred decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static KrbCred Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- AsnReader reader = new AsnReader(encoded, ruleSet);
-
- Decode(reader, expectedTag, out KrbCred decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static void Decode(AsnReader reader, out T decoded)
- where T: KrbCred, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- DecodeApplication(reader, out decoded);
- }
-
- internal static void Decode(AsnReader reader, Asn1Tag expectedTag, out T decoded)
- where T: KrbCred, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- decoded = new T();
-
- AsnReader sequenceReader = reader.ReadSequence(expectedTag);
- AsnReader explicitReader;
- AsnReader collectionReader;
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
-
- if (!explicitReader.TryReadInt32(out int tmpProtocolVersionNumber))
- {
- explicitReader.ThrowIfNotEmpty();
- }
-
- decoded.ProtocolVersionNumber = tmpProtocolVersionNumber;
-
- explicitReader.ThrowIfNotEmpty();
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
-
- if (!explicitReader.TryReadInt32(out MessageType tmpMessageType))
- {
- explicitReader.ThrowIfNotEmpty();
- }
-
- decoded.MessageType = tmpMessageType;
-
- explicitReader.ThrowIfNotEmpty();
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- // Decode SEQUENCE OF for Tickets
- {
- collectionReader = explicitReader.ReadSequence();
- var tmpList = new List();
- KrbTicket tmpItem;
-
- while (collectionReader.HasData)
- {
- KrbTicket.Decode(collectionReader, out KrbTicket tmp);
- tmpItem = tmp;
- tmpList.Add(tmpItem);
- }
-
- decoded.Tickets = tmpList.ToArray();
- }
-
- explicitReader.ThrowIfNotEmpty();
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
- KrbEncryptedData.Decode(explicitReader, out KrbEncryptedData tmpEncryptedPart);
- decoded.EncryptedPart = tmpEncryptedPart;
-
- explicitReader.ThrowIfNotEmpty();
-
- sequenceReader.ThrowIfNotEmpty();
- }
- }
-}
diff --git a/Kerberos.NET/Entities/Krb/KrbCred.xml b/Kerberos.NET/Entities/Krb/KrbCred.xml
deleted file mode 100644
index e623ff57..00000000
--- a/Kerberos.NET/Entities/Krb/KrbCred.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbCredInfo.generated.cs b/Kerberos.NET/Entities/Krb/KrbCredInfo.generated.cs
deleted file mode 100644
index a2823532..00000000
--- a/Kerberos.NET/Entities/Krb/KrbCredInfo.generated.cs
+++ /dev/null
@@ -1,344 +0,0 @@
-// -----------------------------------------------------------------------
-// Licensed to The .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// -----------------------------------------------------------------------
-
-// This is a generated file.
-// The generation template has been modified from .NET Runtime implementation
-
-using System;
-using System.Collections.Generic;
-using System.Security.Cryptography;
-using System.Security.Cryptography.Asn1;
-using Kerberos.NET.Crypto;
-using Kerberos.NET.Asn1;
-
-namespace Kerberos.NET.Entities
-{
- public partial class KrbCredInfo
- {
- /*
- KrbCredInfo ::= SEQUENCE {
- key [0] EncryptionKey,
- prealm [1] Realm OPTIONAL,
- pname [2] PrincipalName OPTIONAL,
- flags [3] TicketFlags OPTIONAL,
- authtime [4] KerberosTime OPTIONAL,
- starttime [5] KerberosTime OPTIONAL,
- endtime [6] KerberosTime OPTIONAL,
- renew-till [7] KerberosTime OPTIONAL,
- srealm [8] Realm OPTIONAL,
- sname [9] PrincipalName OPTIONAL,
- caddr [10] HostAddresses OPTIONAL
- }
- */
-
- public KrbEncryptionKey Key { get; set; }
-
- public string Realm { get; set; }
-
- public KrbPrincipalName PName { get; set; }
-
- public TicketFlags Flags { get; set; }
- public DateTimeOffset? AuthTime { get; set; }
-
- public DateTimeOffset? StartTime { get; set; }
-
- public DateTimeOffset? EndTime { get; set; }
-
- public DateTimeOffset? RenewTill { get; set; }
-
- public string SRealm { get; set; }
-
- public KrbPrincipalName SName { get; set; }
-
- public KrbAuthorizationData[] AuthorizationData { get; set; }
-
- // Encoding methods
- public ReadOnlyMemory Encode()
- {
- var writer = new AsnWriter(AsnEncodingRules.DER);
-
- Encode(writer);
-
- return writer.EncodeAsMemory();
- }
-
- internal void Encode(AsnWriter writer)
- {
- Encode(writer, Asn1Tag.Sequence);
- }
-
- internal void Encode(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- Key?.Encode(writer);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
-
- if (Asn1Extension.HasValue(Realm))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- writer.WriteCharacterString(UniversalTagNumber.GeneralString, Realm);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- }
-
-
- if (Asn1Extension.HasValue(PName))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- PName?.Encode(writer);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- }
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
- writer.WriteBitString(Flags.AsReadOnlySpan());
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
-
- if (Asn1Extension.HasValue(AuthTime))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 4));
- writer.WriteGeneralizedTime(AuthTime.Value);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 4));
- }
-
- if (Asn1Extension.HasValue(StartTime))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 5));
- writer.WriteGeneralizedTime(StartTime.Value);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 5));
- }
-
- if (Asn1Extension.HasValue(EndTime))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 6));
- writer.WriteGeneralizedTime(EndTime.Value);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 6));
- }
-
- if (Asn1Extension.HasValue(RenewTill))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 7));
- writer.WriteGeneralizedTime(RenewTill.Value);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 7));
- }
-
- if (Asn1Extension.HasValue(SRealm))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 8));
- writer.WriteCharacterString(UniversalTagNumber.GeneralString, SRealm);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 8));
- }
-
-
- if (Asn1Extension.HasValue(SName))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 9));
- SName?.Encode(writer);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 9));
- }
-
- if (Asn1Extension.HasValue(AuthorizationData))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 10));
- writer.PushSequence();
-
- for (int i = 0; i < AuthorizationData.Length; i++)
- {
- AuthorizationData[i]?.Encode(writer);
- }
-
- writer.PopSequence();
-
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 10));
- }
-
- writer.PopSequence(tag);
- }
-
- internal void EncodeApplication(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- this.Encode(writer, Asn1Tag.Sequence);
-
- writer.PopSequence(tag);
- }
-
- public virtual ReadOnlyMemory EncodeApplication() => new ReadOnlyMemory();
-
- internal ReadOnlyMemory EncodeApplication(Asn1Tag tag)
- {
- using (var writer = new AsnWriter(AsnEncodingRules.DER))
- {
- EncodeApplication(writer, tag);
-
- return writer.EncodeAsMemory();
- }
- }
-
- public static KrbCredInfo Decode(ReadOnlyMemory data)
- {
- return Decode(data, AsnEncodingRules.DER);
- }
-
- internal static KrbCredInfo Decode(ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- return Decode(Asn1Tag.Sequence, encoded, ruleSet);
- }
-
- internal static KrbCredInfo Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- Decode(reader, expectedTag, out KrbCredInfo decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static KrbCredInfo Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- AsnReader reader = new AsnReader(encoded, ruleSet);
-
- Decode(reader, expectedTag, out KrbCredInfo decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static void Decode(AsnReader reader, out T decoded)
- where T: KrbCredInfo, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- Decode(reader, Asn1Tag.Sequence, out decoded);
- }
-
- internal static void Decode(AsnReader reader, Asn1Tag expectedTag, out T decoded)
- where T: KrbCredInfo, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- decoded = new T();
-
- AsnReader sequenceReader = reader.ReadSequence(expectedTag);
- AsnReader explicitReader;
- AsnReader collectionReader;
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- KrbEncryptionKey.Decode(explicitReader, out KrbEncryptionKey tmpKey);
- decoded.Key = tmpKey;
-
- explicitReader.ThrowIfNotEmpty();
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 1)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
-
- decoded.Realm = explicitReader.ReadCharacterString(UniversalTagNumber.GeneralString);
- explicitReader.ThrowIfNotEmpty();
- }
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 2)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
-
- KrbPrincipalName.Decode(explicitReader, out KrbPrincipalName tmpPName);
- decoded.PName = tmpPName;
- explicitReader.ThrowIfNotEmpty();
- }
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
-
- if (explicitReader.TryReadPrimitiveBitStringValue(out _, out ReadOnlyMemory tmpFlags))
- {
- decoded.Flags = (TicketFlags)tmpFlags.AsLong();
- }
- else
- {
- decoded.Flags = (TicketFlags)explicitReader.ReadBitString(out _).AsLong();
- }
-
-
- explicitReader.ThrowIfNotEmpty();
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 4)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 4));
-
- decoded.AuthTime = explicitReader.ReadGeneralizedTime();
- explicitReader.ThrowIfNotEmpty();
- }
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 5)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 5));
-
- decoded.StartTime = explicitReader.ReadGeneralizedTime();
- explicitReader.ThrowIfNotEmpty();
- }
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 6)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 6));
-
- decoded.EndTime = explicitReader.ReadGeneralizedTime();
- explicitReader.ThrowIfNotEmpty();
- }
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 7)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 7));
-
- decoded.RenewTill = explicitReader.ReadGeneralizedTime();
- explicitReader.ThrowIfNotEmpty();
- }
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 8)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 8));
-
- decoded.SRealm = explicitReader.ReadCharacterString(UniversalTagNumber.GeneralString);
- explicitReader.ThrowIfNotEmpty();
- }
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 9)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 9));
-
- KrbPrincipalName.Decode(explicitReader, out KrbPrincipalName tmpSName);
- decoded.SName = tmpSName;
- explicitReader.ThrowIfNotEmpty();
- }
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 10)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 10));
-
- // Decode SEQUENCE OF for AuthorizationData
- {
- collectionReader = explicitReader.ReadSequence();
- var tmpList = new List();
- KrbAuthorizationData tmpItem;
-
- while (collectionReader.HasData)
- {
- KrbAuthorizationData.Decode(collectionReader, out KrbAuthorizationData tmp);
- tmpItem = tmp;
- tmpList.Add(tmpItem);
- }
-
- decoded.AuthorizationData = tmpList.ToArray();
- }
- explicitReader.ThrowIfNotEmpty();
- }
-
- sequenceReader.ThrowIfNotEmpty();
- }
- }
-}
diff --git a/Kerberos.NET/Entities/Krb/KrbCredInfo.xml b/Kerberos.NET/Entities/Krb/KrbCredInfo.xml
deleted file mode 100644
index edcc75e3..00000000
--- a/Kerberos.NET/Entities/Krb/KrbCredInfo.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbETypeInfo2.generated.cs b/Kerberos.NET/Entities/Krb/KrbETypeInfo2.generated.cs
deleted file mode 100644
index 7beb2dad..00000000
--- a/Kerberos.NET/Entities/Krb/KrbETypeInfo2.generated.cs
+++ /dev/null
@@ -1,148 +0,0 @@
-// -----------------------------------------------------------------------
-// Licensed to The .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// -----------------------------------------------------------------------
-
-// This is a generated file.
-// The generation template has been modified from .NET Runtime implementation
-
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Security.Cryptography;
-using System.Security.Cryptography.Asn1;
-using Kerberos.NET.Crypto;
-using Kerberos.NET.Asn1;
-
-namespace Kerberos.NET.Entities
-{
- public partial class KrbETypeInfo2
- {
- /*
- ETYPE-INFO2 ::= SEQUENCE SIZE (1..MAX) OF ETYPE-INFO2-ENTRY
- */
-
- public KrbETypeInfo2Entry[] ETypeInfo { get; set; }
-
-#if DEBUG
- static KrbETypeInfo2()
- {
- var usedTags = new System.Collections.Generic.Dictionary();
- Action ensureUniqueTag = (tag, fieldName) =>
- {
- if (usedTags.TryGetValue(tag, out string existing))
- {
- throw new InvalidOperationException($"Tag '{tag}' is in use by both '{existing}' and '{fieldName}'");
- }
-
- usedTags.Add(tag, fieldName);
- };
-
- ensureUniqueTag(Asn1Tag.Sequence, "ETypeInfo");
- }
-#endif
- // Encoding methods
- public ReadOnlyMemory Encode()
- {
- var writer = new AsnWriter(AsnEncodingRules.DER);
-
- Encode(writer);
-
- return writer.EncodeAsMemory();
- }
-
- internal void Encode(AsnWriter writer)
- {
- bool wroteValue = false;
-
- if (ETypeInfo != null)
- {
- if (wroteValue)
- {
- throw new CryptographicException();
- }
-
- writer.PushSequence();
-
- for (int i = 0; i < ETypeInfo.Length; i++)
- {
- ETypeInfo[i]?.Encode(writer);
- }
-
- writer.PopSequence();
-
- wroteValue = true;
- }
-
- if (!wroteValue)
- {
- throw new CryptographicException();
- }
- }
-
- internal ReadOnlyMemory EncodeApplication(Asn1Tag tag)
- {
- using (var writer = new AsnWriter(AsnEncodingRules.DER))
- {
- writer.PushSequence(tag);
-
- this.Encode(writer);
-
- writer.PopSequence(tag);
-
- return writer.EncodeAsMemory();
- }
- }
-
- public static KrbETypeInfo2 Decode(ReadOnlyMemory data)
- {
- return Decode(data, AsnEncodingRules.DER);
- }
-
- internal static KrbETypeInfo2 Decode(ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- AsnReader reader = new AsnReader(encoded, ruleSet);
-
- Decode(reader, out KrbETypeInfo2 decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static void Decode(AsnReader reader, out T decoded)
- where T: KrbETypeInfo2, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- decoded = new T();
-
- Asn1Tag tag = reader.PeekTag();
- AsnReader collectionReader;
-
- if (tag.HasSameClassAndValue(Asn1Tag.Sequence))
- {
- // Decode SEQUENCE OF for ETypeInfo
- {
- collectionReader = reader.ReadSequence();
- var tmpList = new List();
- KrbETypeInfo2Entry tmpItem;
-
- while (collectionReader.HasData)
- {
- KrbETypeInfo2Entry.Decode(collectionReader, out KrbETypeInfo2Entry tmp);
- tmpItem = tmp;
- tmpList.Add(tmpItem);
- }
-
- decoded.ETypeInfo = tmpList.ToArray();
- }
- }
- else
- {
- throw new CryptographicException();
- }
- }
- }
-}
diff --git a/Kerberos.NET/Entities/Krb/KrbETypeInfo2.xml b/Kerberos.NET/Entities/Krb/KrbETypeInfo2.xml
deleted file mode 100644
index 203b44b1..00000000
--- a/Kerberos.NET/Entities/Krb/KrbETypeInfo2.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbETypeInfo2Entry.generated.cs b/Kerberos.NET/Entities/Krb/KrbETypeInfo2Entry.generated.cs
deleted file mode 100644
index 8e8810c3..00000000
--- a/Kerberos.NET/Entities/Krb/KrbETypeInfo2Entry.generated.cs
+++ /dev/null
@@ -1,186 +0,0 @@
-// -----------------------------------------------------------------------
-// Licensed to The .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// -----------------------------------------------------------------------
-
-// This is a generated file.
-// The generation template has been modified from .NET Runtime implementation
-
-using System;
-using System.Security.Cryptography;
-using System.Security.Cryptography.Asn1;
-using Kerberos.NET.Crypto;
-using Kerberos.NET.Asn1;
-
-namespace Kerberos.NET.Entities
-{
- public partial class KrbETypeInfo2Entry
- {
- /*
- ETYPE-INFO2-ENTRY ::= SEQUENCE {
- etype [0] Int32,
- salt [1] KerberosString OPTIONAL,
- s2kparams [2] OCTET STRING OPTIONAL
- }
-
- ETYPE-INFO2 ::= SEQUENCE SIZE (1..MAX) OF ETYPE-INFO2-ENTRY
- */
-
- public EncryptionType EType { get; set; }
-
- public string Salt { get; set; }
-
- public ReadOnlyMemory? S2kParams { get; set; }
-
- // Encoding methods
- public ReadOnlyMemory Encode()
- {
- var writer = new AsnWriter(AsnEncodingRules.DER);
-
- Encode(writer);
-
- return writer.EncodeAsMemory();
- }
-
- internal void Encode(AsnWriter writer)
- {
- Encode(writer, Asn1Tag.Sequence);
- }
-
- internal void Encode(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- writer.WriteInteger((long)EType);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
-
- if (Asn1Extension.HasValue(Salt))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- writer.WriteCharacterString(UniversalTagNumber.GeneralString, Salt);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- }
-
-
- if (Asn1Extension.HasValue(S2kParams))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- writer.WriteOctetString(S2kParams.Value.Span);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- }
- writer.PopSequence(tag);
- }
-
- internal void EncodeApplication(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- this.Encode(writer, Asn1Tag.Sequence);
-
- writer.PopSequence(tag);
- }
-
- public virtual ReadOnlyMemory EncodeApplication() => new ReadOnlyMemory();
-
- internal ReadOnlyMemory EncodeApplication(Asn1Tag tag)
- {
- using (var writer = new AsnWriter(AsnEncodingRules.DER))
- {
- EncodeApplication(writer, tag);
-
- return writer.EncodeAsMemory();
- }
- }
-
- public static KrbETypeInfo2Entry Decode(ReadOnlyMemory data)
- {
- return Decode(data, AsnEncodingRules.DER);
- }
-
- internal static KrbETypeInfo2Entry Decode(ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- return Decode(Asn1Tag.Sequence, encoded, ruleSet);
- }
-
- internal static KrbETypeInfo2Entry Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- Decode(reader, expectedTag, out KrbETypeInfo2Entry decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static KrbETypeInfo2Entry Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- AsnReader reader = new AsnReader(encoded, ruleSet);
-
- Decode(reader, expectedTag, out KrbETypeInfo2Entry decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static void Decode(AsnReader reader, out T decoded)
- where T: KrbETypeInfo2Entry, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- Decode(reader, Asn1Tag.Sequence, out decoded);
- }
-
- internal static void Decode(AsnReader reader, Asn1Tag expectedTag, out T decoded)
- where T: KrbETypeInfo2Entry, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- decoded = new T();
-
- AsnReader sequenceReader = reader.ReadSequence(expectedTag);
- AsnReader explicitReader;
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
-
- if (!explicitReader.TryReadInt32(out EncryptionType tmpEType))
- {
- explicitReader.ThrowIfNotEmpty();
- }
-
- decoded.EType = tmpEType;
-
- explicitReader.ThrowIfNotEmpty();
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 1)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
-
- decoded.Salt = explicitReader.ReadCharacterString(UniversalTagNumber.GeneralString);
- explicitReader.ThrowIfNotEmpty();
- }
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 2)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
-
-
- if (explicitReader.TryReadPrimitiveOctetStringBytes(out ReadOnlyMemory tmpS2kParams))
- {
- decoded.S2kParams = tmpS2kParams;
- }
- else
- {
- decoded.S2kParams = explicitReader.ReadOctetString();
- }
- explicitReader.ThrowIfNotEmpty();
- }
-
- sequenceReader.ThrowIfNotEmpty();
- }
- }
-}
diff --git a/Kerberos.NET/Entities/Krb/KrbETypeInfo2Entry.xml b/Kerberos.NET/Entities/Krb/KrbETypeInfo2Entry.xml
deleted file mode 100644
index f593b96a..00000000
--- a/Kerberos.NET/Entities/Krb/KrbETypeInfo2Entry.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbETypeList.generated.cs b/Kerberos.NET/Entities/Krb/KrbETypeList.generated.cs
deleted file mode 100644
index 7b40e323..00000000
--- a/Kerberos.NET/Entities/Krb/KrbETypeList.generated.cs
+++ /dev/null
@@ -1,157 +0,0 @@
-// -----------------------------------------------------------------------
-// Licensed to The .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// -----------------------------------------------------------------------
-
-// This is a generated file.
-// The generation template has been modified from .NET Runtime implementation
-
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Security.Cryptography;
-using System.Security.Cryptography.Asn1;
-using Kerberos.NET.Crypto;
-using Kerberos.NET.Asn1;
-
-namespace Kerberos.NET.Entities
-{
- public partial class KrbETypeList
- {
- /*
- EtypeList ::= SEQUENCE OF Int32
- - - Specifies the enctypes supported by the client.
- - - This enctype list is in decreasing preference order
- - - (favorite choice first).
- - - Int32 is defined in [RFC4120].
- */
-
- public EncryptionType[] List { get; set; }
-
-#if DEBUG
- static KrbETypeList()
- {
- var usedTags = new System.Collections.Generic.Dictionary();
- Action ensureUniqueTag = (tag, fieldName) =>
- {
- if (usedTags.TryGetValue(tag, out string existing))
- {
- throw new InvalidOperationException($"Tag '{tag}' is in use by both '{existing}' and '{fieldName}'");
- }
-
- usedTags.Add(tag, fieldName);
- };
-
- ensureUniqueTag(Asn1Tag.Sequence, "List");
- }
-#endif
- // Encoding methods
- public ReadOnlyMemory Encode()
- {
- var writer = new AsnWriter(AsnEncodingRules.DER);
-
- Encode(writer);
-
- return writer.EncodeAsMemory();
- }
-
- internal void Encode(AsnWriter writer)
- {
- bool wroteValue = false;
-
- if (List != null)
- {
- if (wroteValue)
- {
- throw new CryptographicException();
- }
-
- writer.PushSequence();
-
- for (int i = 0; i < List.Length; i++)
- {
- writer.WriteInteger((long)List[i]);
- }
-
- writer.PopSequence();
-
- wroteValue = true;
- }
-
- if (!wroteValue)
- {
- throw new CryptographicException();
- }
- }
-
- internal ReadOnlyMemory EncodeApplication(Asn1Tag tag)
- {
- using (var writer = new AsnWriter(AsnEncodingRules.DER))
- {
- writer.PushSequence(tag);
-
- this.Encode(writer);
-
- writer.PopSequence(tag);
-
- return writer.EncodeAsMemory();
- }
- }
-
- public static KrbETypeList Decode(ReadOnlyMemory data)
- {
- return Decode(data, AsnEncodingRules.DER);
- }
-
- internal static KrbETypeList Decode(ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- AsnReader reader = new AsnReader(encoded, ruleSet);
-
- Decode(reader, out KrbETypeList decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static void Decode(AsnReader reader, out T decoded)
- where T: KrbETypeList, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- decoded = new T();
-
- Asn1Tag tag = reader.PeekTag();
- AsnReader collectionReader;
-
- if (tag.HasSameClassAndValue(Asn1Tag.Sequence))
- {
- // Decode SEQUENCE OF for List
- {
- collectionReader = reader.ReadSequence();
- var tmpList = new List();
- EncryptionType tmpItem;
-
- while (collectionReader.HasData)
- {
-
- if (!collectionReader.TryReadInt32(out EncryptionType tmp))
- {
- collectionReader.ThrowIfNotEmpty();
- }
-
- tmpItem = tmp;
- tmpList.Add(tmpItem);
- }
-
- decoded.List = tmpList.ToArray();
- }
- }
- else
- {
- throw new CryptographicException();
- }
- }
- }
-}
diff --git a/Kerberos.NET/Entities/Krb/KrbETypeList.xml b/Kerberos.NET/Entities/Krb/KrbETypeList.xml
deleted file mode 100644
index b44aa705..00000000
--- a/Kerberos.NET/Entities/Krb/KrbETypeList.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbEncApRepPart.generated.cs b/Kerberos.NET/Entities/Krb/KrbEncApRepPart.generated.cs
deleted file mode 100644
index 0f209092..00000000
--- a/Kerberos.NET/Entities/Krb/KrbEncApRepPart.generated.cs
+++ /dev/null
@@ -1,209 +0,0 @@
-// -----------------------------------------------------------------------
-// Licensed to The .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// -----------------------------------------------------------------------
-
-// This is a generated file.
-// The generation template has been modified from .NET Runtime implementation
-
-using System;
-using System.Security.Cryptography;
-using System.Security.Cryptography.Asn1;
-using Kerberos.NET.Crypto;
-using Kerberos.NET.Asn1;
-
-namespace Kerberos.NET.Entities
-{
- public partial class KrbEncApRepPart
- {
- /*
- EncAPRepPart ::= [APPLICATION 27] SEQUENCE {
- ctime [0] KerberosTime,
- cusec [1] Microseconds,
- subkey [2] EncryptionKey OPTIONAL,
- seq-number [3] UInt32 OPTIONAL
- }
- */
-
- public DateTimeOffset CTime { get; set; }
-
- public int CuSec { get; set; }
-
- public KrbEncryptionKey SubSessionKey { get; set; }
-
- public int? SequenceNumber { get; set; }
-
- // Encoding methods
- internal void Encode(AsnWriter writer)
- {
- EncodeApplication(writer, ApplicationTag);
- }
-
- internal void Encode(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- writer.WriteGeneralizedTime(CTime);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- writer.WriteInteger(CuSec);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
-
- if (Asn1Extension.HasValue(SubSessionKey))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- SubSessionKey?.Encode(writer);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- }
-
- if (Asn1Extension.HasValue(SequenceNumber))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
- writer.WriteInteger(SequenceNumber.Value);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
- }
- writer.PopSequence(tag);
- }
-
- internal void EncodeApplication(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- this.Encode(writer, Asn1Tag.Sequence);
-
- writer.PopSequence(tag);
- }
-
- private static readonly Asn1Tag ApplicationTag = new Asn1Tag(TagClass.Application, 27);
-
- public virtual ReadOnlyMemory EncodeApplication()
- {
- return EncodeApplication(ApplicationTag);
- }
-
- public static KrbEncApRepPart DecodeApplication(ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- var sequence = reader.ReadSequence(ApplicationTag);
-
- KrbEncApRepPart decoded;
- Decode(sequence, Asn1Tag.Sequence, out decoded);
- sequence.ThrowIfNotEmpty();
-
- reader.ThrowIfNotEmpty();
-
- return decoded;
- }
-
- internal static KrbEncApRepPart DecodeApplication(AsnReader reader, out T decoded)
- where T: KrbEncApRepPart, new()
- {
- var sequence = reader.ReadSequence(ApplicationTag);
-
- Decode(sequence, Asn1Tag.Sequence, out decoded);
- sequence.ThrowIfNotEmpty();
-
- reader.ThrowIfNotEmpty();
-
- return decoded;
- }
-
- internal ReadOnlyMemory EncodeApplication(Asn1Tag tag)
- {
- using (var writer = new AsnWriter(AsnEncodingRules.DER))
- {
- EncodeApplication(writer, tag);
-
- return writer.EncodeAsMemory();
- }
- }
-
- internal static KrbEncApRepPart Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- Decode(reader, expectedTag, out KrbEncApRepPart decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static KrbEncApRepPart Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- AsnReader reader = new AsnReader(encoded, ruleSet);
-
- Decode(reader, expectedTag, out KrbEncApRepPart decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static void Decode(AsnReader reader, out T decoded)
- where T: KrbEncApRepPart, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- DecodeApplication(reader, out decoded);
- }
-
- internal static void Decode(AsnReader reader, Asn1Tag expectedTag, out T decoded)
- where T: KrbEncApRepPart, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- decoded = new T();
-
- AsnReader sequenceReader = reader.ReadSequence(expectedTag);
- AsnReader explicitReader;
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- decoded.CTime = explicitReader.ReadGeneralizedTime();
-
- explicitReader.ThrowIfNotEmpty();
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
-
- if (!explicitReader.TryReadInt32(out int tmpCuSec))
- {
- explicitReader.ThrowIfNotEmpty();
- }
-
- decoded.CuSec = tmpCuSec;
-
- explicitReader.ThrowIfNotEmpty();
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 2)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
-
- KrbEncryptionKey.Decode(explicitReader, out KrbEncryptionKey tmpSubSessionKey);
- decoded.SubSessionKey = tmpSubSessionKey;
- explicitReader.ThrowIfNotEmpty();
- }
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 3)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
-
- if (explicitReader.TryReadInt32(out int tmpSequenceNumber))
- {
- decoded.SequenceNumber = tmpSequenceNumber;
- }
- else
- {
- explicitReader.ThrowIfNotEmpty();
- }
-
- explicitReader.ThrowIfNotEmpty();
- }
-
- sequenceReader.ThrowIfNotEmpty();
- }
- }
-}
diff --git a/Kerberos.NET/Entities/Krb/KrbEncApRepPart.xml b/Kerberos.NET/Entities/Krb/KrbEncApRepPart.xml
deleted file mode 100644
index b95598f5..00000000
--- a/Kerberos.NET/Entities/Krb/KrbEncApRepPart.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbEncAsRepPart.generated.cs b/Kerberos.NET/Entities/Krb/KrbEncAsRepPart.generated.cs
deleted file mode 100644
index 1180926b..00000000
--- a/Kerberos.NET/Entities/Krb/KrbEncAsRepPart.generated.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-// -----------------------------------------------------------------------
-// Licensed to The .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// -----------------------------------------------------------------------
-
-// This is a generated file.
-// The generation template has been modified from .NET Runtime implementation
-
-using System;
-using System.Security.Cryptography.Asn1;
-
-namespace Kerberos.NET.Entities
-{
- public partial class KrbEncAsRepPart : KrbEncKdcRepPart
- {
- /*
- EncASRepPart ::= [APPLICATION 25] EncKDCRepPart
- */
-
- private static readonly Asn1Tag ApplicationTag = new Asn1Tag(TagClass.Application, 25);
-
- public override ReadOnlyMemory EncodeApplication()
- {
- return EncodeApplication(ApplicationTag);
- }
-
- public static KrbEncAsRepPart DecodeApplication(ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- var sequence = reader.ReadSequence(ApplicationTag);
-
- KrbEncAsRepPart decoded;
- Decode(sequence, out decoded);
- sequence.ThrowIfNotEmpty();
-
- reader.ThrowIfNotEmpty();
-
- return decoded;
- }
- }
-}
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbEncAsRepPart.xml b/Kerberos.NET/Entities/Krb/KrbEncAsRepPart.xml
deleted file mode 100644
index 2f8677b4..00000000
--- a/Kerberos.NET/Entities/Krb/KrbEncAsRepPart.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbEncKdcRepPart.generated.cs b/Kerberos.NET/Entities/Krb/KrbEncKdcRepPart.generated.cs
deleted file mode 100644
index f356f85d..00000000
--- a/Kerberos.NET/Entities/Krb/KrbEncKdcRepPart.generated.cs
+++ /dev/null
@@ -1,363 +0,0 @@
-// -----------------------------------------------------------------------
-// Licensed to The .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// -----------------------------------------------------------------------
-
-// This is a generated file.
-// The generation template has been modified from .NET Runtime implementation
-
-using System;
-using System.Collections.Generic;
-using System.Security.Cryptography;
-using System.Security.Cryptography.Asn1;
-using Kerberos.NET.Crypto;
-using Kerberos.NET.Asn1;
-
-namespace Kerberos.NET.Entities
-{
- public partial class KrbEncKdcRepPart
- {
- /*
- EncKDCRepPart ::= SEQUENCE {
- key [0] EncryptionKey,
- last-req [1] LastReq,
- nonce [2] UInt32,
- key-expiration [3] KerberosTime OPTIONAL,
- flags [4] TicketFlags,
- authtime [5] KerberosTime,
- starttime [6] KerberosTime OPTIONAL,
- endtime [7] KerberosTime,
- renew-till [8] KerberosTime OPTIONAL,
- srealm [9] Realm,
- sname [10] PrincipalName,
- caddr [11] HostAddresses OPTIONAL
- }
- */
-
- public KrbEncryptionKey Key { get; set; }
-
- public KrbLastReq[] LastReq { get; set; }
-
- public int Nonce { get; set; }
-
- public DateTimeOffset? KeyExpiration { get; set; }
-
- public TicketFlags Flags { get; set; }
- public DateTimeOffset AuthTime { get; set; }
-
- public DateTimeOffset? StartTime { get; set; }
-
- public DateTimeOffset EndTime { get; set; }
-
- public DateTimeOffset? RenewTill { get; set; }
-
- public string Realm { get; set; }
-
- public KrbPrincipalName SName { get; set; }
-
- public KrbHostAddress[] CAddr { get; set; }
-
- public KrbMethodData EncryptedPaData { get; set; }
-
- // Encoding methods
- public ReadOnlyMemory Encode()
- {
- var writer = new AsnWriter(AsnEncodingRules.DER);
-
- Encode(writer);
-
- return writer.EncodeAsMemory();
- }
-
- internal void Encode(AsnWriter writer)
- {
- Encode(writer, Asn1Tag.Sequence);
- }
-
- internal void Encode(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- Key?.Encode(writer);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- writer.PushSequence();
-
- for (int i = 0; i < LastReq.Length; i++)
- {
- LastReq[i]?.Encode(writer);
- }
-
- writer.PopSequence();
-
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- writer.WriteInteger(Nonce);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
-
- if (Asn1Extension.HasValue(KeyExpiration))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
- writer.WriteGeneralizedTime(KeyExpiration.Value);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
- }
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 4));
- writer.WriteBitString(Flags.AsReadOnlySpan());
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 4));
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 5));
- writer.WriteGeneralizedTime(AuthTime);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 5));
-
- if (Asn1Extension.HasValue(StartTime))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 6));
- writer.WriteGeneralizedTime(StartTime.Value);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 6));
- }
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 7));
- writer.WriteGeneralizedTime(EndTime);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 7));
-
- if (Asn1Extension.HasValue(RenewTill))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 8));
- writer.WriteGeneralizedTime(RenewTill.Value);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 8));
- }
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 9));
- writer.WriteCharacterString(UniversalTagNumber.GeneralString, Realm);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 9));
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 10));
- SName?.Encode(writer);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 10));
-
- if (Asn1Extension.HasValue(CAddr))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 11));
- writer.PushSequence();
-
- for (int i = 0; i < CAddr.Length; i++)
- {
- CAddr[i]?.Encode(writer);
- }
-
- writer.PopSequence();
-
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 11));
- }
-
-
- if (Asn1Extension.HasValue(EncryptedPaData))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 12));
- EncryptedPaData?.Encode(writer);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 12));
- }
- writer.PopSequence(tag);
- }
-
- internal void EncodeApplication(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- this.Encode(writer, Asn1Tag.Sequence);
-
- writer.PopSequence(tag);
- }
-
- public virtual ReadOnlyMemory EncodeApplication() => new ReadOnlyMemory();
-
- internal ReadOnlyMemory EncodeApplication(Asn1Tag tag)
- {
- using (var writer = new AsnWriter(AsnEncodingRules.DER))
- {
- EncodeApplication(writer, tag);
-
- return writer.EncodeAsMemory();
- }
- }
-
- public static KrbEncKdcRepPart Decode(ReadOnlyMemory data)
- {
- return Decode(data, AsnEncodingRules.DER);
- }
-
- internal static KrbEncKdcRepPart Decode(ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- return Decode(Asn1Tag.Sequence, encoded, ruleSet);
- }
-
- internal static KrbEncKdcRepPart Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- Decode(reader, expectedTag, out KrbEncKdcRepPart decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static KrbEncKdcRepPart Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- AsnReader reader = new AsnReader(encoded, ruleSet);
-
- Decode(reader, expectedTag, out KrbEncKdcRepPart decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static void Decode(AsnReader reader, out T decoded)
- where T: KrbEncKdcRepPart, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- Decode(reader, Asn1Tag.Sequence, out decoded);
- }
-
- internal static void Decode(AsnReader reader, Asn1Tag expectedTag, out T decoded)
- where T: KrbEncKdcRepPart, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- decoded = new T();
-
- AsnReader sequenceReader = reader.ReadSequence(expectedTag);
- AsnReader explicitReader;
- AsnReader collectionReader;
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- KrbEncryptionKey.Decode(explicitReader, out KrbEncryptionKey tmpKey);
- decoded.Key = tmpKey;
-
- explicitReader.ThrowIfNotEmpty();
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- // Decode SEQUENCE OF for LastReq
- {
- collectionReader = explicitReader.ReadSequence();
- var tmpList = new List();
- KrbLastReq tmpItem;
-
- while (collectionReader.HasData)
- {
- KrbLastReq.Decode(collectionReader, out KrbLastReq tmp);
- tmpItem = tmp;
- tmpList.Add(tmpItem);
- }
-
- decoded.LastReq = tmpList.ToArray();
- }
-
- explicitReader.ThrowIfNotEmpty();
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
-
- if (!explicitReader.TryReadInt32(out int tmpNonce))
- {
- explicitReader.ThrowIfNotEmpty();
- }
-
- decoded.Nonce = tmpNonce;
-
- explicitReader.ThrowIfNotEmpty();
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 3)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
-
- decoded.KeyExpiration = explicitReader.ReadGeneralizedTime();
- explicitReader.ThrowIfNotEmpty();
- }
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 4));
-
- if (explicitReader.TryReadPrimitiveBitStringValue(out _, out ReadOnlyMemory tmpFlags))
- {
- decoded.Flags = (TicketFlags)tmpFlags.AsLong();
- }
- else
- {
- decoded.Flags = (TicketFlags)explicitReader.ReadBitString(out _).AsLong();
- }
-
-
- explicitReader.ThrowIfNotEmpty();
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 5));
- decoded.AuthTime = explicitReader.ReadGeneralizedTime();
-
- explicitReader.ThrowIfNotEmpty();
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 6)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 6));
-
- decoded.StartTime = explicitReader.ReadGeneralizedTime();
- explicitReader.ThrowIfNotEmpty();
- }
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 7));
- decoded.EndTime = explicitReader.ReadGeneralizedTime();
-
- explicitReader.ThrowIfNotEmpty();
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 8)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 8));
-
- decoded.RenewTill = explicitReader.ReadGeneralizedTime();
- explicitReader.ThrowIfNotEmpty();
- }
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 9));
- decoded.Realm = explicitReader.ReadCharacterString(UniversalTagNumber.GeneralString);
-
- explicitReader.ThrowIfNotEmpty();
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 10));
- KrbPrincipalName.Decode(explicitReader, out KrbPrincipalName tmpSName);
- decoded.SName = tmpSName;
-
- explicitReader.ThrowIfNotEmpty();
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 11)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 11));
-
- // Decode SEQUENCE OF for CAddr
- {
- collectionReader = explicitReader.ReadSequence();
- var tmpList = new List();
- KrbHostAddress tmpItem;
-
- while (collectionReader.HasData)
- {
- KrbHostAddress.Decode(collectionReader, out KrbHostAddress tmp);
- tmpItem = tmp;
- tmpList.Add(tmpItem);
- }
-
- decoded.CAddr = tmpList.ToArray();
- }
- explicitReader.ThrowIfNotEmpty();
- }
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 12)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 12));
-
- KrbMethodData.Decode(explicitReader, out KrbMethodData tmpEncryptedPaData);
- decoded.EncryptedPaData = tmpEncryptedPaData;
- explicitReader.ThrowIfNotEmpty();
- }
-
- sequenceReader.ThrowIfNotEmpty();
- }
- }
-}
diff --git a/Kerberos.NET/Entities/Krb/KrbEncKdcRepPart.xml b/Kerberos.NET/Entities/Krb/KrbEncKdcRepPart.xml
deleted file mode 100644
index 8ae00a98..00000000
--- a/Kerberos.NET/Entities/Krb/KrbEncKdcRepPart.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbEncKrbCredPart.generated.cs b/Kerberos.NET/Entities/Krb/KrbEncKrbCredPart.generated.cs
deleted file mode 100644
index f3bc9be0..00000000
--- a/Kerberos.NET/Entities/Krb/KrbEncKrbCredPart.generated.cs
+++ /dev/null
@@ -1,279 +0,0 @@
-// -----------------------------------------------------------------------
-// Licensed to The .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// -----------------------------------------------------------------------
-
-// This is a generated file.
-// The generation template has been modified from .NET Runtime implementation
-
-using System;
-using System.Collections.Generic;
-using System.Security.Cryptography;
-using System.Security.Cryptography.Asn1;
-using Kerberos.NET.Crypto;
-using Kerberos.NET.Asn1;
-
-namespace Kerberos.NET.Entities
-{
- public partial class KrbEncKrbCredPart
- {
- /*
- EncKrbCredPart ::= [APPLICATION 29] SEQUENCE {
- ticket-info [0] SEQUENCE OF KrbCredInfo,
- nonce [1] UInt32 OPTIONAL,
- timestamp [2] KerberosTime OPTIONAL,
- usec [3] Microseconds OPTIONAL,
- s-address [4] HostAddress OPTIONAL,
- r-address [5] HostAddress OPTIONAL
- }
- */
-
- public KrbCredInfo[] TicketInfo { get; set; }
-
- public int? Nonce { get; set; }
-
- public DateTimeOffset? Timestamp { get; set; }
-
- public int? USec { get; set; }
-
- public KrbHostAddress SAddress { get; set; }
-
- public KrbHostAddress RAddress { get; set; }
-
- // Encoding methods
- internal void Encode(AsnWriter writer)
- {
- EncodeApplication(writer, ApplicationTag);
- }
-
- internal void Encode(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- writer.PushSequence();
-
- for (int i = 0; i < TicketInfo.Length; i++)
- {
- TicketInfo[i]?.Encode(writer);
- }
-
- writer.PopSequence();
-
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
-
- if (Asn1Extension.HasValue(Nonce))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- writer.WriteInteger(Nonce.Value);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- }
-
- if (Asn1Extension.HasValue(Timestamp))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- writer.WriteGeneralizedTime(Timestamp.Value);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- }
-
- if (Asn1Extension.HasValue(USec))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
- writer.WriteInteger(USec.Value);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
- }
-
- if (Asn1Extension.HasValue(SAddress))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 4));
- SAddress?.Encode(writer);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 4));
- }
-
- if (Asn1Extension.HasValue(RAddress))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 5));
- RAddress?.Encode(writer);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 5));
- }
- writer.PopSequence(tag);
- }
-
- internal void EncodeApplication(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- this.Encode(writer, Asn1Tag.Sequence);
-
- writer.PopSequence(tag);
- }
-
- private static readonly Asn1Tag ApplicationTag = new Asn1Tag(TagClass.Application, 29);
-
- public virtual ReadOnlyMemory EncodeApplication()
- {
- return EncodeApplication(ApplicationTag);
- }
-
- public static KrbEncKrbCredPart DecodeApplication(ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- var sequence = reader.ReadSequence(ApplicationTag);
-
- KrbEncKrbCredPart decoded;
- Decode(sequence, Asn1Tag.Sequence, out decoded);
- sequence.ThrowIfNotEmpty();
-
- reader.ThrowIfNotEmpty();
-
- return decoded;
- }
-
- internal static KrbEncKrbCredPart DecodeApplication(AsnReader reader, out T decoded)
- where T: KrbEncKrbCredPart, new()
- {
- var sequence = reader.ReadSequence(ApplicationTag);
-
- Decode(sequence, Asn1Tag.Sequence, out decoded);
- sequence.ThrowIfNotEmpty();
-
- reader.ThrowIfNotEmpty();
-
- return decoded;
- }
-
- internal ReadOnlyMemory EncodeApplication(Asn1Tag tag)
- {
- using (var writer = new AsnWriter(AsnEncodingRules.DER))
- {
- EncodeApplication(writer, tag);
-
- return writer.EncodeAsMemory();
- }
- }
-
- internal static KrbEncKrbCredPart Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- Decode(reader, expectedTag, out KrbEncKrbCredPart decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static KrbEncKrbCredPart Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- AsnReader reader = new AsnReader(encoded, ruleSet);
-
- Decode(reader, expectedTag, out KrbEncKrbCredPart decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static void Decode(AsnReader reader, out T decoded)
- where T: KrbEncKrbCredPart, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- DecodeApplication(reader, out decoded);
- }
-
- internal static void Decode(AsnReader reader, Asn1Tag expectedTag, out T decoded)
- where T: KrbEncKrbCredPart, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- decoded = new T();
-
- AsnReader sequenceReader = reader.ReadSequence(expectedTag);
- AsnReader explicitReader;
- AsnReader collectionReader;
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- // Decode SEQUENCE OF for TicketInfo
- {
- collectionReader = explicitReader.ReadSequence();
- var tmpList = new List();
- KrbCredInfo tmpItem;
-
- while (collectionReader.HasData)
- {
- KrbCredInfo.Decode(collectionReader, out KrbCredInfo tmp);
- tmpItem = tmp;
- tmpList.Add(tmpItem);
- }
-
- decoded.TicketInfo = tmpList.ToArray();
- }
-
- explicitReader.ThrowIfNotEmpty();
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 1)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
-
- if (explicitReader.TryReadInt32(out int tmpNonce))
- {
- decoded.Nonce = tmpNonce;
- }
- else
- {
- explicitReader.ThrowIfNotEmpty();
- }
-
- explicitReader.ThrowIfNotEmpty();
- }
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 2)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
-
- decoded.Timestamp = explicitReader.ReadGeneralizedTime();
- explicitReader.ThrowIfNotEmpty();
- }
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 3)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
-
- if (explicitReader.TryReadInt32(out int tmpUSec))
- {
- decoded.USec = tmpUSec;
- }
- else
- {
- explicitReader.ThrowIfNotEmpty();
- }
-
- explicitReader.ThrowIfNotEmpty();
- }
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 4)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 4));
-
- KrbHostAddress.Decode(explicitReader, out KrbHostAddress tmpSAddress);
- decoded.SAddress = tmpSAddress;
- explicitReader.ThrowIfNotEmpty();
- }
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 5)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 5));
-
- KrbHostAddress.Decode(explicitReader, out KrbHostAddress tmpRAddress);
- decoded.RAddress = tmpRAddress;
- explicitReader.ThrowIfNotEmpty();
- }
-
- sequenceReader.ThrowIfNotEmpty();
- }
- }
-}
diff --git a/Kerberos.NET/Entities/Krb/KrbEncKrbCredPart.xml b/Kerberos.NET/Entities/Krb/KrbEncKrbCredPart.xml
deleted file mode 100644
index 1734c6a9..00000000
--- a/Kerberos.NET/Entities/Krb/KrbEncKrbCredPart.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbEncKrbPrivPart.generated.cs b/Kerberos.NET/Entities/Krb/KrbEncKrbPrivPart.generated.cs
deleted file mode 100644
index a8dd83ea..00000000
--- a/Kerberos.NET/Entities/Krb/KrbEncKrbPrivPart.generated.cs
+++ /dev/null
@@ -1,256 +0,0 @@
-// -----------------------------------------------------------------------
-// Licensed to The .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// -----------------------------------------------------------------------
-
-// This is a generated file.
-// The generation template has been modified from .NET Runtime implementation
-
-using System;
-using System.Security.Cryptography;
-using System.Security.Cryptography.Asn1;
-using Kerberos.NET.Crypto;
-using Kerberos.NET.Asn1;
-
-namespace Kerberos.NET.Entities
-{
- public partial class KrbEncKrbPrivPart
- {
- /*
- EncKrbPrivPart ::= [APPLICATION 28] SEQUENCE {
- user-data [0] OCTET STRING,
- timestamp [1] KerberosTime OPTIONAL,
- usec [2] Microseconds OPTIONAL,
- seq-number [3] UInt32 OPTIONAL,
- s-address [4] HostAddress ( sender's addr ),
- r-address [5] HostAddress OPTIONAL ( recip's addr )
- }
- */
-
- public ReadOnlyMemory UserData { get; set; }
-
- public DateTimeOffset? Timestamp { get; set; }
-
- public int? Usec { get; set; }
-
- public int? SeqNumber { get; set; }
-
- public KrbHostAddress SAddress { get; set; }
-
- public KrbHostAddress RAddress { get; set; }
-
- // Encoding methods
- internal void Encode(AsnWriter writer)
- {
- EncodeApplication(writer, ApplicationTag);
- }
-
- internal void Encode(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- writer.WriteOctetString(UserData.Span);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
-
- if (Asn1Extension.HasValue(Timestamp))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- writer.WriteGeneralizedTime(Timestamp.Value);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- }
-
- if (Asn1Extension.HasValue(Usec))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- writer.WriteInteger(Usec.Value);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- }
-
- if (Asn1Extension.HasValue(SeqNumber))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
- writer.WriteInteger(SeqNumber.Value);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
- }
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 4));
- SAddress?.Encode(writer);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 4));
-
- if (Asn1Extension.HasValue(RAddress))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 5));
- RAddress?.Encode(writer);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 5));
- }
- writer.PopSequence(tag);
- }
-
- internal void EncodeApplication(AsnWriter writer, Asn1Tag tag)
- {
- writer.PushSequence(tag);
-
- this.Encode(writer, Asn1Tag.Sequence);
-
- writer.PopSequence(tag);
- }
-
- private static readonly Asn1Tag ApplicationTag = new Asn1Tag(TagClass.Application, 28);
-
- public virtual ReadOnlyMemory EncodeApplication()
- {
- return EncodeApplication(ApplicationTag);
- }
-
- public static KrbEncKrbPrivPart DecodeApplication(ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- var sequence = reader.ReadSequence(ApplicationTag);
-
- KrbEncKrbPrivPart decoded;
- Decode(sequence, Asn1Tag.Sequence, out decoded);
- sequence.ThrowIfNotEmpty();
-
- reader.ThrowIfNotEmpty();
-
- return decoded;
- }
-
- internal static KrbEncKrbPrivPart DecodeApplication(AsnReader reader, out T decoded)
- where T: KrbEncKrbPrivPart, new()
- {
- var sequence = reader.ReadSequence(ApplicationTag);
-
- Decode(sequence, Asn1Tag.Sequence, out decoded);
- sequence.ThrowIfNotEmpty();
-
- reader.ThrowIfNotEmpty();
-
- return decoded;
- }
-
- internal ReadOnlyMemory EncodeApplication(Asn1Tag tag)
- {
- using (var writer = new AsnWriter(AsnEncodingRules.DER))
- {
- EncodeApplication(writer, tag);
-
- return writer.EncodeAsMemory();
- }
- }
-
- internal static KrbEncKrbPrivPart Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- Decode(reader, expectedTag, out KrbEncKrbPrivPart decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static KrbEncKrbPrivPart Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- AsnReader reader = new AsnReader(encoded, ruleSet);
-
- Decode(reader, expectedTag, out KrbEncKrbPrivPart decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static void Decode(AsnReader reader, out T decoded)
- where T: KrbEncKrbPrivPart, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- DecodeApplication(reader, out decoded);
- }
-
- internal static void Decode(AsnReader reader, Asn1Tag expectedTag, out T decoded)
- where T: KrbEncKrbPrivPart, new()
- {
- if (reader == null)
- {
- throw new ArgumentNullException(nameof(reader));
- }
-
- decoded = new T();
-
- AsnReader sequenceReader = reader.ReadSequence(expectedTag);
- AsnReader explicitReader;
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
-
- if (explicitReader.TryReadPrimitiveOctetStringBytes(out ReadOnlyMemory tmpUserData))
- {
- decoded.UserData = tmpUserData;
- }
- else
- {
- decoded.UserData = explicitReader.ReadOctetString();
- }
-
- explicitReader.ThrowIfNotEmpty();
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 1)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
-
- decoded.Timestamp = explicitReader.ReadGeneralizedTime();
- explicitReader.ThrowIfNotEmpty();
- }
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 2)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
-
- if (explicitReader.TryReadInt32(out int tmpUsec))
- {
- decoded.Usec = tmpUsec;
- }
- else
- {
- explicitReader.ThrowIfNotEmpty();
- }
-
- explicitReader.ThrowIfNotEmpty();
- }
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 3)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
-
- if (explicitReader.TryReadInt32(out int tmpSeqNumber))
- {
- decoded.SeqNumber = tmpSeqNumber;
- }
- else
- {
- explicitReader.ThrowIfNotEmpty();
- }
-
- explicitReader.ThrowIfNotEmpty();
- }
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 4));
- KrbHostAddress.Decode(explicitReader, out KrbHostAddress tmpSAddress);
- decoded.SAddress = tmpSAddress;
-
- explicitReader.ThrowIfNotEmpty();
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 5)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 5));
-
- KrbHostAddress.Decode(explicitReader, out KrbHostAddress tmpRAddress);
- decoded.RAddress = tmpRAddress;
- explicitReader.ThrowIfNotEmpty();
- }
-
- sequenceReader.ThrowIfNotEmpty();
- }
- }
-}
diff --git a/Kerberos.NET/Entities/Krb/KrbEncKrbPrivPart.xml b/Kerberos.NET/Entities/Krb/KrbEncKrbPrivPart.xml
deleted file mode 100644
index 4ebc274f..00000000
--- a/Kerberos.NET/Entities/Krb/KrbEncKrbPrivPart.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbEncTgsRepPart.generated.cs b/Kerberos.NET/Entities/Krb/KrbEncTgsRepPart.generated.cs
deleted file mode 100644
index cac9e263..00000000
--- a/Kerberos.NET/Entities/Krb/KrbEncTgsRepPart.generated.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-// -----------------------------------------------------------------------
-// Licensed to The .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// -----------------------------------------------------------------------
-
-// This is a generated file.
-// The generation template has been modified from .NET Runtime implementation
-
-using System;
-using System.Security.Cryptography.Asn1;
-
-namespace Kerberos.NET.Entities
-{
- public partial class KrbEncTgsRepPart : KrbEncKdcRepPart
- {
- /*
- EncTGSRepPart ::= [APPLICATION 26] EncKDCRepPart
- */
-
- private static readonly Asn1Tag ApplicationTag = new Asn1Tag(TagClass.Application, 26);
-
- public override ReadOnlyMemory EncodeApplication()
- {
- return EncodeApplication(ApplicationTag);
- }
-
- public static KrbEncTgsRepPart DecodeApplication(ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- var sequence = reader.ReadSequence(ApplicationTag);
-
- KrbEncTgsRepPart decoded;
- Decode(sequence, out decoded);
- sequence.ThrowIfNotEmpty();
-
- reader.ThrowIfNotEmpty();
-
- return decoded;
- }
- }
-}
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbEncTgsRepPart.xml b/Kerberos.NET/Entities/Krb/KrbEncTgsRepPart.xml
deleted file mode 100644
index a29c456e..00000000
--- a/Kerberos.NET/Entities/Krb/KrbEncTgsRepPart.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-