Пример #1
0
        public async Task SigningRevokeClikc_should_revoke_key()
        {
            await Fixture.DbActionAsync <OperationalDbContext>(async context =>
            {
                var id = Guid.NewGuid();
                await context.KeyRotationKeys.AddAsync(new KeyRotationKey
                {
                    FriendlyName = $"key-{id}",
                    Xml          = @$ "<key id=" "{id}" " version=" "1" ">
    <creationDate>2020-10-08T07:44:21.391891Z</creationDate>
    <activationDate>2020-10-08T07:44:21.3792973Z</activationDate>
    <expirationDate>2020-10-22T07:44:21.3792973Z</expirationDate>
    <descriptor deserializerType=" "Aguacongas.IdentityServer.KeysRotation.RsaEncryptorDescriptorDeserializer, Aguacongas.IdentityServer.KeysRotation, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null" ">
        <descriptor>
            <encryption algorithm=" "System.Security.Cryptography.RSA, System.Security.Cryptography.Algorithms, Version = 4.3.2.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a" " keyLength=" "2048" "/>
            <keyId>74A71DC1642A06B8A753E8FCA13EC40A</keyId>
            <key p4:requiresEncryption=" "true" " xmlns:p4=" "http://schemas.asp.net/2015/03/dataProtection" ">
                <value>eyJEIjoicFBCU0tPWUdlaTBFcUVmTE5jOG43ZHh4eFluS3Z4dTlEUWE3WTdQVy96bEZQSnBFUEh3MWpKNGVsaEl2KzBJNWNaUDVUMHFpLzdnWm5tZWs4Z2JTbUFUampLNUo1VnA2dWJ5VWFrY25oQ2NBcWxYbERjTkI3U21jMmoyQjUzSWhhYWE5d1U1OUs0NnJhRjhKejIxaHp4dTkwaFNPNUlBcm03enk4TEVoZTdVNlUxWm5zclBWZHpVUWtsNUVqUmt3eDF6dE1yNk5scU13V2RDb2N4Rmt3ZTQ1N1ZjV0JqRDBPODZ5Q0lJdDJVRXdoQkpTUGRjREJOa3lmMzlhZEZHN0V6My9HUkRuS0I4Z2diZHFVRW1zSkl6QmkyYmM5dERVYjArbzVwVThsUStsd0RoSFBsR1dSTUhOdTFPV0JYODYxWGhGY2lINm8xS3ZueGRXNE5JNk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wYkU1SXhMamJzT0FScEpnQ3lJLytOWlRlcGVUYUFXU05TNmd2TWUyTS9yREJFMm05bTNPdjNFNGtTNjdxU2FqZDJIa29TUkpxZWRaRk4xQkY0MDUwU1NRUTkrWkZUUkkzV3llSUcwd2VDeFpnakhyaFl0WUZObDNaVUhRPT0iLCJQIjoiNGtkTGdqei9mVUdMTTB1RThaaDJwTThjLzdJdHBldjBqalMzQ2hoL0dCbVZmN1JGQmhnVWJZSTdFUGlQQzI0ZThDNmxNb01lVG14MlFOQVNSelFaT2x5QWNCTHV2U0RwTkQwczFRa2JmbW1ucE5UbWJncURidVh3NFp0cklJR1dZV2ZqMVUvSmY4dkltaU9LdVQvU3VWMit2Wmg2OVpqaTFrR3ljcUhZWVZjPSIsIlEiOiIvN09EY3ZSVTZxcGJsQW9LejJialdxMGg2V0loVDQ3RmdhbHFDZWZBejFVYWJKOTBXVXVNOCt2eFZZTHV1V2dNR1IvZ0JPTVdna0l2WUtYODFFSmd4aHhnRGlDd0p0VFRrUXVQUWtsYWhHRWp5SERJWGNwaHdDT3VsS2h4cEkrZlpOMEFROWsyQWcyN2IzR3JUeDdHbUptVEVnbXFwMzh0MFVhOU4vU0F5YXM9In0=</value>
            </key>
        </descriptor >
    </descriptor>
</key>"
                });
                await context.SaveChangesAsync();
            });
        public void passwordSecurity_Test2()
        {
            encryption testPart = new encryption();
            string     result   = encryption.DecryptString("MTIzMzIx");

            Assert.AreEqual("123321", result);
        }
Пример #3
0
        private string PopulateBody1(string id, string name, string sponserID, string mob, string pass, string email, string username, string Cust_Password, string otp)
        {
            string body = string.Empty;

            //using (StreamReader reader = new StreamReader("~/Email/email_verify.htm")
            //{
            //	body = reader.ReadToEnd();
            //}
            string Path = System.Web.HttpContext.Current.Request.MapPath("~/Email/email_verify.htm");

            body = File.ReadAllText(Path);

            string _dateti = DateTime.Now.ToString();

            body = body.Replace("{date}", _dateti);
            body = body.Replace("{name}", name);
            body = body.Replace("{email}", email);
            body = body.Replace("{Sponsorid}", sponserID);
            body = body.Replace("{idno}", id);
            body = body.Replace("{password}", Cust_Password);
            body = body.Replace("{username}", username);
            body = body.Replace("{otp}", otp);
            // Creating the query string to pass
            //string technology = HttpUtility.UrlEncode(Encrypt(ddlTechnology.SelectedItem.Value));
            //Response.Redirect(string.Format("~/CS2.aspx?name={0}&technology={1}", name, technology));
            var    encyptionHelper = new encryption();
            string name111         = encyptionHelper.Encrypt(id);

            //string name111 = HttpUtility.UrlEncode(Encrypt(id));
            body = body.Replace("{encoderegno}", name111);
            //lbl_test.Text = name111.ToString();
            return(body);
        }
Пример #4
0
    public String deleteN(note e)
    {
        encryption crypt = new encryption();
        connection conn  = new connection();

        String jsonstring = JsonConvert.SerializeObject(e);

        String output = crypt.EncryptDecrypt(jsonstring);

        String reply = conn.connect(output);

        return(reply);
    }
Пример #5
0
    public String getEvents(customevents e)
    {
        encryption crypt = new encryption();
        connection conn  = new connection();

        String jsonstring = JsonConvert.SerializeObject(e);

        String output = crypt.EncryptDecrypt(jsonstring);

        String reply = conn.connect(output);

        return(reply);
    }
Пример #6
0
    public String dc(String userID)
    {
        calendar   e     = new calendar();
        encryption crypt = new encryption();
        connection conn  = new connection();

        e.overallID = "getCalender";
        e.userName  = userID;


        String jsonstring = JsonConvert.SerializeObject(e);

        String output = crypt.EncryptDecrypt(jsonstring);

        String reply = conn.connect(output);

        return(reply);
    }
Пример #7
0
    public Boolean authenticate(String usr, String pass)
    {
        user       u     = new user();
        encryption crypt = new encryption();
        connection conn  = new connection();

        u.overallID = "logIn";
        u.email     = usr;
        u.password  = pass;
        u.isAdmin   = false;

        String jsonstring = JsonConvert.SerializeObject(u);


        String output = crypt.EncryptDecrypt(jsonstring);

        String reply = conn.connect(output);

        String value = reply.Substring(0, 1);

        HttpContext.Current.Session["userID"] = reply.Substring(1);

        if (value.Equals("0"))
        {
            return(true);
        }
        else if (value.Equals("3"))
        {
            return(false); // "Your password does not match";
        }
        else if (value.Equals("2"))
        {
            return(false); // "The user you have logged in as, is marked as inactive";
        }
        else if (value.Equals("1"))
        {
            return(false); // "The email doesn't exist";
        }
        else
        {
            return(false); // "An error has occured";
        }
    }
Пример #8
0
    private void OnGUI()
    {
        EditorGUILayout.BeginVertical();

        SelectObjs = Selection.objects;

        EditorGUILayout.LabelField("选择的合法物体数量为:" + SelectObjs.Length);



        ABName = EditorGUILayout.TextField("AB包名字:", ABName);

        PackPatch = EditorGUILayout.TextField("转换包地址:", PackPatch);
        PackName  = EditorGUILayout.TextField("转换包名字:", PackName);

        Encryption = (encryption)EditorGUILayout.EnumPopup("加密方式:", Encryption);
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("开始作业"))
        {
            BuildAllAssetBundles();
        }

        if (GUILayout.Button("关闭"))
        {
            this.Close();
        }
        if (GUILayout.Button("清理全部AB相关"))
        {
            Delete();
        }

        EditorGUILayout.EndHorizontal();

        EditorGUILayout.EndVertical();

        EditorGUILayout.LabelField("Power By YuanJI");
    }
Пример #9
0
        protected void UserTracking()
        {
            string s_source = "";
            string s_other = "";
            encryption o_encrypt = new encryption();

            string titleVal = CompanyLabelTextBox.Text;

            string state = "";
            if (StateLabel1RadComboBox.Visible)
                state = StateLabel1RadComboBox.SelectedItem.Text;
            else
                state = StateLabel1TextBox.Text;

            if (SignUpCheckBox.Checked)
            {
                newsLetterSignup(FirstNameTextBox.Text, LastNameTextBox.Text, Address1LabelTextBox.Text,
                    Address2LabelTextBox.Text, CityLabelTextBox.Text, state, ZipLabelTextBox.Text, CountryLabel1RadComboBox.SelectedItem.Value,
                    TitleTextBox.Text, CompanyLabelTextBox.Text, EmailTextBox.Text, PhoneLabelTextBox.Text, null);
            }

            string s_emailQuery = "SELECT * FROM ls_user WHERE EMAIL='" + EmailTextBox.Text + "'";

            DataSet ds = doQuery(s_emailQuery);

            if (ds.Tables[0].Rows.Count > 0)
            {

            }
            else
            {
                string s_insertQuery = "INSERT INTO ls_user (FIRSTNAME, LASTNAME, TITLE, EMAIL, PASSWORD, PHONE, FAX, "+
                    "SCHOOL, STREET1, STREET2, CITY, STATE, ZIP, COUNTRY, DATE, SOURCE, OTHER)" +
                        "VALUES ('" + fixSQL(FirstNameTextBox.Text) + "' , '" +
                                    fixSQL(LastNameTextBox.Text) + "' , '" +
                                    fixSQL(TitleTextBox.Text) + "' , '" +
                                    fixSQL(EmailTextBox.Text) + "' , '" +
                                    o_encrypt.encrypt(PasswordTextBox.Text.Trim()) + "' , '" +
                                    fixSQL(PhoneLabelTextBox.Text) + "' , '"
                                     + "' , '" +
                                    fixSQL(CompanyLabelTextBox.Text) + "' , '" +
                                    fixSQL(Address1LabelTextBox.Text) + "' , '" +
                                    fixSQL(Address2LabelTextBox.Text) + "' , '" +
                                    fixSQL(CityLabelTextBox.Text) + "' , '" +
                                    fixSQL(state) + "' , '" +
                                    fixSQL(ZipLabelTextBox.Text) + "' , '" +
                                    fixSQL(CountryLabel1RadComboBox.SelectedItem.Value) + "' , '" +
                                    DateTime.Now + "' , '" +
                                    s_source + "' , '" +
                                    s_other + "')";

                execSQL(s_insertQuery);

                string SQL = "INSERT INTO activitylog (SOURCE, FIRSTNAME, LASTNAME, TITLE, SCHOOL, STREET1, STREET2, CITY, STATE, ZIP, COUNTRY, EMAIL, PHONE, FAX, DATE)" +
                    "VALUES ('Registration', '" + fixSQL(FirstNameTextBox.Text) + "' , '" +
                    fixSQL(LastNameTextBox.Text) + "' , '" +
                    fixSQL(TitleTextBox.Text) + "' , '" +
                    fixSQL(CompanyLabelTextBox.Text) + "' , '" +
                    fixSQL(Address1LabelTextBox.Text) + "' , '" +
                    fixSQL(Address2LabelTextBox.Text) + "' , '" +
                    fixSQL(CityLabelTextBox.Text) + "' , '" +
                    fixSQL(state) + "' , '" +
                    fixSQL(ZipLabelTextBox.Text) + "' , '" +
                    fixSQL(CountryLabel1RadComboBox.SelectedItem.Value) + "' , '" +
                    fixSQL(EmailTextBox.Text) + "' , '" +
                    fixSQL(PhoneLabelTextBox.Text) + "' , '" +
                    "' , '" +
                    DateTime.Now + "')";
                execSQL(SQL);

                DataSet subds = doQuery("SELECT * FROM activitylog where EMAIL='" + EmailTextBox.Text + "'  ORDER BY DATE DESC");
                TimeSpan ts = new TimeSpan(10, 0, 0, 0);
                DateTime dt = DateTime.Now;

                if (subds.Tables["table"].Rows.Count > 0)
                {
                    HttpCookie userinfo = new System.Web.HttpCookie("userinfo", subds.Tables["table"].Rows[0]["ID"].ToString());
                    userinfo.Expires = dt.Add(ts);
                    Response.Cookies.Add(userinfo);
                }

                if (ConfigurationManager.AppSettings.Get("netsuitetracking") == "true")
                {
                    LightSPEED.NetSuite.ContactLead contactLead = new LightSPEED.NetSuite.ContactLead();
                    contactLead.Address = Address1LabelTextBox.Text;
                    contactLead.CampaignSource = "10833"; // CAM0001 WEBSITE
                    contactLead.City = CityLabelTextBox.Text;
                    contactLead.Comments = "Registration";
                    contactLead.Company = CompanyLabelTextBox.Text;
                    contactLead.ContactPreference = "";
                    contactLead.ContactReason = ContactReason.Other;
                    DataSet dsCountry = doQuery("SELECT * FROM countries where country_id='" + CountryLabel1RadComboBox.SelectedItem.Value + "'");
                    contactLead.Country = dsCountry.Tables["table"].Rows[0]["netsuite_id"].ToString();
                    contactLead.Creation = DateTime.Now;
                    contactLead.Email = EmailTextBox.Text;
                    contactLead.Fax = null;
                    contactLead.FirstName = FirstNameTextBox.Text;
                    contactLead.LastName = LastNameTextBox.Text;
                    contactLead.Phone = PhoneLabelTextBox.Text;
                    contactLead.Product = "";
                    contactLead.Reference = "";
                    contactLead.Job_Role = RoleDropDown.SelectedItem.Value;
                    String strState = state;
                    DataSet dsState = doQuery("SELECT * FROM STATES WHERE state_name='" + strState + "'");
                    if (dsState.Tables["table"].Rows.Count > 0)
                    {
                        strState = dsState.Tables["table"].Rows[0]["STATE_CODE"].ToString().Trim();
                    }
                    contactLead.StateOrProvince = strState;

                    contactLead.Title = TitleTextBox.Text;
                    contactLead.ZipOrPostalCode = ZipLabelTextBox.Text;
                    contactLead.DownloadName = null;

                    int contactID = ContactLeadManager.Insert(contactLead);

                    HttpCookie contactcookie = new System.Web.HttpCookie("contactID", contactID.ToString());
                    contactcookie.Expires = dt.Add(ts);
                    Response.Cookies.Add(contactcookie);
                }
                String strBody = "";

                strBody += "First name: " + FirstNameTextBox.Text.ToUpperInvariant() + "<br>";
                strBody += "Last name: " + LastNameTextBox.Text.ToUpper() + "<br>";
                strBody += "Job Title: " + titleVal.ToUpper() + "<br>";
                strBody += ConfigurationManager.AppSettings.Get("roletext") + ": " + RoleDropDown.SelectedItem.Value + "<br>";
                strBody += "School District: " + CompanyLabelTextBox.Text.ToUpper() + "<br>";
                strBody += "Email: " + EmailTextBox.Text.ToUpper() + "<br>";
                strBody += "Address: " + Address1LabelTextBox.Text.ToUpper() + "<br>";
                strBody += "Address2: " + Address2LabelTextBox.Text.ToUpper() + "<br>";
                strBody += "City: " + CityLabelTextBox.Text.ToUpper() + "<br>";
                strBody += "State: " + state.ToUpper() + "<br>";
                strBody += "Zip: " + ZipLabelTextBox.Text.ToUpper() + "<br>";
                strBody += "Country: " + CountryLabel1RadComboBox.SelectedItem.Text.ToUpper() + "<br>";
                strBody += "Phone: " + PhoneLabelTextBox.Text.ToUpper() + "<br>";
                strBody += "Fax: " + "<br>";

                ds = doQuery("SELECT * FROM extra WHERE TYPE='REGISTER_EMAIL'");
                String strContact = ds.Tables["table"].Rows[0]["INFO"].ToString();
                sendEmail(strContact, EmailTextBox.Text, "Website: US Registration", strBody);

                execSQL("INSERT INTO comments_users (USRNAME, PASSWD, EMAIL, VALIDATED, DISABLED, BIRTH_YEAR, REG_CODE, RECOMMENDED, ABUSE_FLAGS) values ('" +
                    fixSQL(FirstNameTextBox.Text.ToUpper()) + " " + fixSQL(LastNameTextBox.Text.ToUpper()) + "', '" +
                    o_encrypt.encrypt(PasswordTextBox.Text.ToUpper()) + "', '" + fixSQL(EmailTextBox.Text.ToUpper()) + "', 1, 0, 1900, '0', 0, 0)");

                ds = doQuery("SELECT * FROM comments_users");
                System.AppDomain.CurrentDomain.SetData("users", ds);

                HttpCookie c_user = new System.Web.HttpCookie("ls_user", EmailTextBox.Text);
                c_user.Expires = DateTime.Now.AddDays(14);
                Response.Cookies.Add(c_user);

                ds = doQuery("SELECT * FROM comments_users ORDER BY ID DESC");
                HttpCookie cook = new HttpCookie("comments");
                cook.Values.Add("id", ds.Tables["table"].Rows[0]["ID"].ToString());
                cook.Values.Add("name", ds.Tables["table"].Rows[0]["USRNAME"].ToString());
                cook.Expires = DateTime.Now.AddDays(14);
                Response.Cookies.Add(cook);

            }
        }