Exemplo n.º 1
0
 internal static void WritePrincipalName(this DERBuilder builder, KerberosPrincipalName name)
 {
     using (var seq = builder.CreateSequence())
     {
         seq.WriteContextSpecific(0, b => b.WriteInt32((int)name.NameType));
         seq.WriteContextSpecific(1, b => b.WriteSequence(name.Names,
                                                          (s, v) => s.WriteGeneralString(v)));
     }
 }
Exemplo n.º 2
0
        private static DERBuilder CreateBuilder(KerberosTicket ticket)
        {
            if (ticket is null)
            {
                throw new ArgumentNullException(nameof(ticket));
            }

            DERBuilder builder = new DERBuilder();

            using (var seq = builder.CreateSequence())
            {
                seq.WriteKerberosHeader(KerberosMessageType.KRB_TGT_REP);
                seq.WriteContextSpecific(2, ticket.TicketData);
            }
            return(builder);
        }
        private static DERBuilder CreateBuilder(string realm, KerberosPrincipalName server_name)
        {
            DERBuilder builder = new DERBuilder();

            using (var seq = builder.CreateSequence())
            {
                seq.WriteKerberosHeader(KerberosMessageType.KRB_TGT_REQ);
                if (server_name != null)
                {
                    seq.WriteContextSpecific(2, b => b.WritePrincipalName(server_name));
                }
                if (realm != null)
                {
                    seq.WriteContextSpecific(3, b => b.WriteGeneralString(realm));
                }
            }
            return(builder);
        }