public static FastArmorApRequest Parse(KrbFastArmor armor)
 {
     if (armor.armor_type.Value != (long)KrbFastArmorType.FX_FAST_ARMOR_AP_REQUEST)
         throw new Exception();
     var apReq = new AP_REQ();
     apReq.BerDecode(new Asn1DecodingBuffer(armor.armor_value.ByteArrayValue));
     return new FastArmorApRequest(apReq);
 }
        /// <summary>
        /// Parse raw PA_DATA type to PaTgsReq object.
        /// </summary>
        /// <param name="data">Raw PA_DATA</param>
        /// <returns>Reference to PaTgsReq object</returns>
        public static PaTgsReq Parse(PA_DATA data)
        {
            if (data.padata_type.Value != (long)PaDataType.PA_TGS_REQ)
            {
                throw new Exception();
            }
            AP_REQ apReq = new AP_REQ();

            apReq.BerDecode(new Asn1DecodingBuffer(data.padata_value.ByteArrayValue));
            return(new PaTgsReq(apReq));
        }
        public static FastArmorApRequest Parse(KrbFastArmor armor)
        {
            if (armor.armor_type.Value != (long)KrbFastArmorType.FX_FAST_ARMOR_AP_REQUEST)
            {
                throw new Exception();
            }
            var apReq = new AP_REQ();

            apReq.BerDecode(new Asn1DecodingBuffer(armor.armor_value.ByteArrayValue));
            return(new FastArmorApRequest(apReq));
        }
        /// <summary>
        /// Create an instance.
        /// </summary>
        public KerberosApRequest(long pvno, APOptions ap_options, KerberosTicket ticket, Authenticator authenticator, KeyUsageNumber keyUsageNumber)
        {
            Asn1BerEncodingBuffer asnBuffPlainAuthenticator = new Asn1BerEncodingBuffer();
            authenticator.BerEncode(asnBuffPlainAuthenticator, true);
            KerberosUtility.OnDumpMessage("KRB5:Authenticator",
                "Authenticator in AP-REQ structure",
                 KerberosUtility.DumpLevel.PartialMessage,
                 asnBuffPlainAuthenticator.Data);
            byte[] encAsnEncodedAuth = KerberosUtility.Encrypt((EncryptionType)ticket.SessionKey.keytype.Value,
                                    ticket.SessionKey.keyvalue.ByteArrayValue,
                                    asnBuffPlainAuthenticator.Data,
                                    (int)keyUsageNumber);
            var encrypted = new EncryptedData();
            encrypted.etype = new KerbInt32(ticket.SessionKey.keytype.Value);
            encrypted.cipher = new Asn1OctetString(encAsnEncodedAuth);

            long msg_type = (long)MsgType.KRB_AP_REQ;
            Request = new AP_REQ(new Asn1Integer(pvno), new Asn1Integer(msg_type), ap_options, ticket.Ticket, encrypted);
            Authenticator = authenticator;
        }
Exemple #5
0
        /// <summary>
        /// Create an instance.
        /// </summary>
        public KerberosApRequest(long pvno, APOptions ap_options, KerberosTicket ticket, Authenticator authenticator, KeyUsageNumber keyUsageNumber)
        {
            Asn1BerEncodingBuffer asnBuffPlainAuthenticator = new Asn1BerEncodingBuffer();

            authenticator.BerEncode(asnBuffPlainAuthenticator, true);
            KerberosUtility.OnDumpMessage("KRB5:Authenticator",
                                          "Authenticator in AP-REQ structure",
                                          KerberosUtility.DumpLevel.PartialMessage,
                                          asnBuffPlainAuthenticator.Data);
            byte[] encAsnEncodedAuth = KerberosUtility.Encrypt((EncryptionType)ticket.SessionKey.keytype.Value,
                                                               ticket.SessionKey.keyvalue.ByteArrayValue,
                                                               asnBuffPlainAuthenticator.Data,
                                                               (int)keyUsageNumber);
            var encrypted = new EncryptedData();

            encrypted.etype  = new KerbInt32(ticket.SessionKey.keytype.Value);
            encrypted.cipher = new Asn1OctetString(encAsnEncodedAuth);

            long msg_type = (long)MsgType.KRB_AP_REQ;

            Request       = new AP_REQ(new Asn1Integer(pvno), new Asn1Integer(msg_type), ap_options, ticket.Ticket, encrypted);
            Authenticator = authenticator;
        }
 public PaTgsReq(AP_REQ apReq)
 {
     ApReq = apReq;
 }
 /// <summary>
 /// Parse raw PA_DATA type to PaTgsReq object.
 /// </summary>
 /// <param name="data">Raw PA_DATA</param>
 /// <returns>Reference to PaTgsReq object</returns>
 public static PaTgsReq Parse(PA_DATA data)
 {
     if (data.padata_type.Value != (long)PaDataType.PA_TGS_REQ)
         throw new Exception();
     AP_REQ apReq = new AP_REQ();
     apReq.BerDecode(new Asn1DecodingBuffer(data.padata_value.ByteArrayValue));
     return new PaTgsReq(apReq);
 }
 public PaTgsReq(AP_REQ apReq)
 {
     ApReq = apReq;
 }
 public FastArmorApRequest(AP_REQ apReq)
 {
     ApReq = apReq;
     armorType = KrbFastArmorType.FX_FAST_ARMOR_AP_REQUEST;
 }
 public FastArmorApRequest(AP_REQ apReq)
 {
     ApReq     = apReq;
     armorType = KrbFastArmorType.FX_FAST_ARMOR_AP_REQUEST;
 }