예제 #1
0
파일: Ask.cs 프로젝트: zforks/Rubeus
 public static bool GetPKInitRequest(AS_REQ asReq, out PA_PK_AS_REQ pkAsReq)
 {
     if (asReq.padata != null)
     {
         foreach (PA_DATA paData in asReq.padata)
         {
             if (paData.type == Interop.PADATA_TYPE.PK_AS_REQ)
             {
                 pkAsReq = (PA_PK_AS_REQ)paData.value;
                 return(true);
             }
         }
     }
     pkAsReq = null;
     return(false);
 }
예제 #2
0
        public PA_DATA(X509Certificate2 pkInitCert, KDCKeyAgreement agreement, KDCReqBody kdcRequestBody, bool verifyCerts = false)
        {
            DateTime           now           = DateTime.UtcNow;
            KrbPkAuthenticator authenticator = new KrbPkAuthenticator((uint)now.Millisecond, now, now.Millisecond, kdcRequestBody);
            KrbAuthPack        authPack      = new KrbAuthPack(authenticator, pkInitCert);

            byte[] pubKeyInfo = AsnElt.Make(AsnElt.SEQUENCE, new AsnElt[] {
                AsnElt.MakeInteger(agreement.P),
                AsnElt.MakeInteger(agreement.G),
            }).Encode();

            authPack.ClientPublicValue = new KrbSubjectPublicKeyInfo(new KrbAlgorithmIdentifier(DiffieHellman, pubKeyInfo),
                                                                     AsnElt.MakeInteger(agreement.Y).Encode());

            type  = Interop.PADATA_TYPE.PK_AS_REQ;
            value = new PA_PK_AS_REQ(authPack, pkInitCert, agreement, verifyCerts);
        }