コード例 #1
0
        ////////////////////////////////////////////////////////////////////////////////
        //
        ////////////////////////////////////////////////////////////////////////////////
        public EmpireStager(SessionInfo sessionInfo)
        {
            stagingKeyBytes = Encoding.ASCII.GetBytes(sessionInfo.GetStagingKey());

            Random random     = new Random();
            string characters = "ABCDEFGHKLMNPRSTUVWXYZ123456789";

            char[]        charactersArray = characters.ToCharArray();
            StringBuilder sb = new StringBuilder(8);

            for (int i = 0; i < 8; i++)
            {
                int j = random.Next(charactersArray.Length);
                sb.Append(charactersArray[j]);
            }
            sessionInfo.SetAgentID(sb.ToString());

            CspParameters cspParameters = new CspParameters();

            cspParameters.Flags = cspParameters.Flags | CspProviderFlags.UseMachineKeyStore;
            rsaCrypto           = new RSACryptoServiceProvider(2048, cspParameters);
        }