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/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/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/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/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.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 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbEncTicketPart.generated.cs b/Kerberos.NET/Entities/Krb/KrbEncTicketPart.generated.cs
deleted file mode 100644
index 9695ed89..00000000
--- a/Kerberos.NET/Entities/Krb/KrbEncTicketPart.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 KrbEncTicketPart
- {
- /*
- EncTicketPart ::= [APPLICATION 3] SEQUENCE {
- flags [0] TicketFlags,
- key [1] EncryptionKey,
- crealm [2] Realm,
- cname [3] PrincipalName,
- transited [4] TransitedEncoding,
- authtime [5] KerberosTime,
- starttime [6] KerberosTime OPTIONAL,
- endtime [7] KerberosTime,
- renew-till [8] KerberosTime OPTIONAL,
- caddr [9] HostAddresses OPTIONAL,
- authorization-data [10] AuthorizationData OPTIONAL
- }
- */
-
- public TicketFlags Flags { get; set; }
- public KrbEncryptionKey Key { get; set; }
-
- public string CRealm { get; set; }
-
- public KrbPrincipalName CName { get; set; }
-
- public KrbTransitedEncoding Transited { get; set; }
-
- public DateTimeOffset AuthTime { get; set; }
-
- public DateTimeOffset? StartTime { get; set; }
-
- public DateTimeOffset EndTime { get; set; }
-
- public DateTimeOffset? RenewTill { get; set; }
-
- public KrbHostAddress[] CAddr { 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.WriteBitString(Flags.AsReadOnlySpan());
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- Key?.Encode(writer);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- writer.WriteCharacterString(UniversalTagNumber.GeneralString, CRealm);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
- CName?.Encode(writer);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 4));
- Transited?.Encode(writer);
- 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));
- }
-
- if (Asn1Extension.HasValue(CAddr))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 9));
- writer.PushSequence();
-
- for (int i = 0; i < CAddr.Length; i++)
- {
- CAddr[i]?.Encode(writer);
- }
-
- writer.PopSequence();
-
- 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);
- }
-
- private static readonly Asn1Tag ApplicationTag = new Asn1Tag(TagClass.Application, 3);
-
- public virtual ReadOnlyMemory EncodeApplication()
- {
- return EncodeApplication(ApplicationTag);
- }
-
- public static KrbEncTicketPart DecodeApplication(ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- var sequence = reader.ReadSequence(ApplicationTag);
-
- KrbEncTicketPart decoded;
- Decode(sequence, Asn1Tag.Sequence, out decoded);
- sequence.ThrowIfNotEmpty();
-
- reader.ThrowIfNotEmpty();
-
- return decoded;
- }
-
- internal static KrbEncTicketPart DecodeApplication(AsnReader reader, out T decoded)
- where T: KrbEncTicketPart, 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 KrbEncTicketPart Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- Decode(reader, expectedTag, out KrbEncTicketPart decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static KrbEncTicketPart Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- AsnReader reader = new AsnReader(encoded, ruleSet);
-
- Decode(reader, expectedTag, out KrbEncTicketPart decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static void Decode(AsnReader reader, out T decoded)
- where T: KrbEncTicketPart, 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: KrbEncTicketPart, 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.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, 1));
- KrbEncryptionKey.Decode(explicitReader, out KrbEncryptionKey tmpKey);
- decoded.Key = tmpKey;
-
- explicitReader.ThrowIfNotEmpty();
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
- decoded.CRealm = explicitReader.ReadCharacterString(UniversalTagNumber.GeneralString);
-
- explicitReader.ThrowIfNotEmpty();
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
- KrbPrincipalName.Decode(explicitReader, out KrbPrincipalName tmpCName);
- decoded.CName = tmpCName;
-
- explicitReader.ThrowIfNotEmpty();
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 4));
- KrbTransitedEncoding.Decode(explicitReader, out KrbTransitedEncoding tmpTransited);
- decoded.Transited = tmpTransited;
-
- 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();
- }
-
- if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 9)))
- {
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 9));
-
- // 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, 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/KrbEncTicketPart.xml b/Kerberos.NET/Entities/Krb/KrbEncTicketPart.xml
deleted file mode 100644
index e3da31d0..00000000
--- a/Kerberos.NET/Entities/Krb/KrbEncTicketPart.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbEncryptedData.generated.cs b/Kerberos.NET/Entities/Krb/KrbEncryptedData.generated.cs
deleted file mode 100644
index e953a098..00000000
--- a/Kerberos.NET/Entities/Krb/KrbEncryptedData.generated.cs
+++ /dev/null
@@ -1,184 +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 KrbEncryptedData
- {
- /*
- EncryptedData ::= SEQUENCE {
- etype [0] Int32,
- kvno [1] UInt32 OPTIONAL,
- cipher [2] OCTET STRING
- }
- */
-
- public EncryptionType EType { get; set; }
-
- public int? KeyVersionNumber { get; set; }
-
- public ReadOnlyMemory Cipher { 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(KeyVersionNumber))
- {
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- writer.WriteInteger(KeyVersionNumber.Value);
- writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
- }
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 2 ));
- writer.WriteOctetString(Cipher.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 KrbEncryptedData Decode(ReadOnlyMemory data)
- {
- return Decode(data, AsnEncodingRules.DER);
- }
-
- internal static KrbEncryptedData Decode(ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- return Decode(Asn1Tag.Sequence, encoded, ruleSet);
- }
-
- internal static KrbEncryptedData Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded)
- {
- AsnReader reader = new AsnReader(encoded, AsnEncodingRules.DER);
-
- Decode(reader, expectedTag, out KrbEncryptedData decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static KrbEncryptedData Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded, AsnEncodingRules ruleSet)
- {
- AsnReader reader = new AsnReader(encoded, ruleSet);
-
- Decode(reader, expectedTag, out KrbEncryptedData decoded);
- reader.ThrowIfNotEmpty();
- return decoded;
- }
-
- internal static void Decode(AsnReader reader, out T decoded)
- where T: KrbEncryptedData, 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: KrbEncryptedData, 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));
-
- if (explicitReader.TryReadInt32(out int tmpKeyVersionNumber))
- {
- decoded.KeyVersionNumber = tmpKeyVersionNumber;
- }
- else
- {
- explicitReader.ThrowIfNotEmpty();
- }
-
- explicitReader.ThrowIfNotEmpty();
- }
-
- explicitReader = sequenceReader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 2 ));
-
- if (explicitReader.TryReadPrimitiveOctetStringBytes(out ReadOnlyMemory tmpCipher))
- {
- decoded.Cipher = tmpCipher;
- }
- else
- {
- decoded.Cipher = explicitReader.ReadOctetString();
- }
-
- explicitReader.ThrowIfNotEmpty();
-
- sequenceReader.ThrowIfNotEmpty();
- }
- }
-}
diff --git a/Kerberos.NET/Entities/Krb/KrbEncryptedData.xml b/Kerberos.NET/Entities/Krb/KrbEncryptedData.xml
deleted file mode 100644
index f1f34e31..00000000
--- a/Kerberos.NET/Entities/Krb/KrbEncryptedData.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kerberos.NET/Entities/Krb/KrbEncryptionKey.generated.cs b/Kerberos.NET/Entities/Krb/KrbEncryptionKey.generated.cs
deleted file mode 100644
index c9bc99d7..00000000
--- a/Kerberos.NET/Entities/Krb/KrbEncryptionKey.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 KrbEncryptionKey
- {
- /*
- EncryptionKey ::= SEQUENCE {
- keytype [0] Int32,
- keyvalue [1] OCTET STRING
- }
- */
-
- public EncryptionType EType { get; set; }
-
- public ReadOnlyMemory KeyValue { 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));
- writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 1 ));
- writer.WriteOctetString(KeyValue.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