public void CreateRegistration(
            RegistrationId i, 
            RegistrationInfo info, 
            IDomainIdentityService ids,
            IUserIndexService uniqueness, 
            PasswordGenerator generator)
        {
            var problems = new List<string>();
            // we do all the checks at registration phase 
            if (uniqueness.IsLoginRegistered(info.ContactEmail))
            {
                problems.Add(string.Format("Email '{0}' is already taken.", info.ContactEmail));
            }

            if (!string.IsNullOrEmpty(info.OptionalUserIdentity))
            {
                if (uniqueness.IsIdentityRegistered(info.OptionalUserIdentity))
                {
                    problems.Add(string.Format("Identity '{0}' is already taken.", info.OptionalUserIdentity));
                }
            }

            var userDisplay = info.OptionalUserDisplay;
            if (string.IsNullOrEmpty(userDisplay))
            {
                userDisplay = string.Format("{0}", info.CustomerName);
            }

            var password = info.OptionalUserPassword;
            if (string.IsNullOrEmpty(password))
            {
                password = generator.CreatePassword(6);
            }
            // TODO: we are checking contact uniqueness, but can use user name
            var login = info.ContactEmail;
            if (string.IsNullOrEmpty(login))
            {
                login = info.ContactEmail;
            }


            
            if (problems.Any())
            {
                Apply(new RegistrationFailed(i, info, problems.ToArray()));
                return;
            }
            var id = ids.GetId();

            var host = info.Headers.FirstOrDefault(h => h.Key == "UserHostAddress");
            

            var security = new SecurityInfo(new SecurityId(id), login, password, userDisplay, info.OptionalUserIdentity);
            var customer = new CustomerInfo(new CustomerId(id), info.CustomerName, userDisplay, info.ContactEmail,
                info.OptionalCompanyPhone, info.OptionalCompanyUrl);

            Apply(new RegistrationCreated(i, info.CreatedUtc, customer, security));
            // if no problems
        }
		public static string Encrypt(string toEncrypt, SecurityInfo sInfo, bool useHashing)
		{
			TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider();
			byte[] toEncryptArray = Encoding.UTF8.GetBytes(toEncrypt);
			if (useHashing)
			{
				tdes.Key = new MD5CryptoServiceProvider().ComputeHash(sInfo.Key);
			}
			tdes.Mode = CipherMode.ECB;
			tdes.Padding = PaddingMode.PKCS7;
			ICryptoTransform cTransform = tdes.CreateEncryptor();
			byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);
			tdes.Clear();
			return Convert.ToBase64String(resultArray, 0, resultArray.Length);
		}
Ejemplo n.º 3
0
        public CommonPostMaster(SecurityInfo self, PostMaster innerPostMaster, EtkDepotPortTypeClient etkDepot, KgssPortTypeClient kgss)
            : base(self, etkDepot, kgss)
        {
            if (self == null) throw new ArgumentNullException("self");
            if (self.IsSendOnly) throw new ArgumentException("The self argument must be able to receive", "self");
            if (self.Token == null) throw new ArgumentException("The self argument must have a ETK", "self");
            if (etkDepot == null) throw new ArgumentNullException("etkDepot");
            if (kgss == null) throw new ArgumentNullException("kgss");

            this.innerPostMaster = innerPostMaster;

            mcnList = new Collection<KnownRecipient>();
            mcnList.Add(new KnownRecipient("CBE", "0820563481", "MYCARENET"));

            ioList = new Collection<UnknownRecipient>();
            ioList.Add(new UnknownRecipient("urn:be:fgov:identification-namespace", "urn:be:fgov:ehealth:1.0:certificateholder:enterprise:cbe-number", "0411702543")); //100
            ioList.Add(new UnknownRecipient("urn:be:fgov:identification-namespace", "urn:be:fgov:ehealth:1.0:certificateholder:enterprise:cbe-number", "0411709768")); //200
            ioList.Add(new UnknownRecipient("urn:be:fgov:identification-namespace", "urn:be:fgov:ehealth:1.0:certificateholder:enterprise:cbe-number", "0411724220")); //300
            ioList.Add(new UnknownRecipient("urn:be:fgov:identification-namespace", "urn:be:fgov:ehealth:1.0:certificateholder:enterprise:cbe-number", "0411729366")); //400
            ioList.Add(new UnknownRecipient("urn:be:fgov:identification-namespace", "urn:be:fgov:ehealth:1.0:certificateholder:enterprise:cbe-number", "0411766483")); //500
            ioList.Add(new UnknownRecipient("urn:be:fgov:identification-namespace", "urn:be:fgov:ehealth:1.0:certificateholder:enterprise:cbe-number", "0206732437")); //600
            ioList.Add(new UnknownRecipient("urn:be:fgov:identification-namespace", "urn:be:fgov:ehealth:1.0:certificateholder:enterprise:cbe-number", "0250871001")); //900
        }
Ejemplo n.º 4
0
 public EBirthPostMaster(SecurityInfo self, TTPPortTypeClient proxy, EtkDepotPortTypeClient etkDepot)
     : base(self, etkDepot)
 {
     this.proxy = proxy;
 }
Ejemplo n.º 5
0
 public NewsPostMaster(SecurityInfo self, ehBoxPublicationPortTypeClient publish, ehBoxConsultationPortTypeClient consult, EtkDepotPortTypeClient etkDepot)
     : base(self, etkDepot)
 {
     this.publish = publish;
     this.consult = consult;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Checks if the binary / uses HeapSetInformation
 /// </summary>
 /// <param name="binInfo"></param>
 /// <returns></returns>
 public bool HeapSetInfo(PEProp binInfo, SecurityInfo SecInfo)
 {
     return DoesImportviaLoadLibrary(binInfo, "HeapSetInformation", SecInfo);
 }
Ejemplo n.º 7
0
        public bool GetManifest(PEProp binInfo, SecurityInfo secInfo)
        {
            IntPtr hMod = LoadLibraryEx(binInfo.Path, IntPtr.Zero, 0x2);
            if (hMod != null)
            {
                IntPtr hRes = FindResource(hMod, 1, 24);
                if (hRes != null)
                {
                    uint intSize = SizeofResource(hMod, hRes);
                    if (intSize > 0)
                    {
                        IntPtr ptrRes = LoadResource(hMod, hRes);
                        if (ptrRes != null)
                        {
                            IntPtr strMani = LockResource(ptrRes);

                            if (strMani != null)
                            {
                                string strManifest = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(strMani);

                                int intIdx = strManifest.IndexOf("¿");
                                if (intIdx != 0)
                                {
                                    secInfo.Manifest = strManifest.Substring(intIdx + 1);
                                }
                                else
                                {
                                    secInfo.Manifest = strManifest;
                                }
                                return true;
                            }

                        }
                    }
                }
            }

            return false;
        }
Ejemplo n.º 8
0
 public bool EncodePointer(PEProp binInfo, SecurityInfo SecInfo)
 {
     return DoesImportviaLoadLibrary(binInfo, "EncodePointer", SecInfo);
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Checks if the the string is in the list of imports
        /// </summary>
        /// <param name="binInfo"></param>
        /// <param name="strTheOne"></param>
        /// <returns></returns>
        public bool DoesImport(PEProp binInfo, string strTheOne, bool bExact, SecurityInfo SecInfo)
        {
            foreach (string strImport in SecInfo.Imports)
            {

                if (bExact == true)
                {
                    if (strImport.ToString().Equals(strTheOne)) return true;
                }
                else
                {
                    if (strImport.ToString().Contains(strTheOne)) return true;
                }
            }

            return false;
        }
Ejemplo n.º 10
0
 public void SetQuery5(SecurityInfo securityInfo)
 {
     this._querySi = securityInfo;
 }
Ejemplo n.º 11
0
 public void ClearQuery5()
 {
     this._querySi = new SecurityInfo(string.Empty, string.Empty, "", 0, 0, 0, "", "");
 }
Ejemplo n.º 12
0
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                SecurityInfo ds = new SecurityInfo();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "SecurityInformationDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }
Ejemplo n.º 13
0
 public SecondPassAskPostMaster(SecurityInfo self, Chap4AgreementAdmissionPortTypeClient proxy, EtkDepotPortTypeClient etkDepot)
     : base(self, etkDepot)
 {
     this.proxy = proxy;
 }
Ejemplo n.º 14
0
 public InvitationService(ISession session, SecurityInfo SecurityInfo, ServiceConfiguration configuration, IPushNotificationService pushNotification, IEMailService emailService)
     : base(session, SecurityInfo, configuration, pushNotification, emailService)
 {
 }
Ejemplo n.º 15
0
 public bool ValidateSecurityInfo()
 {
     //Securityinfo can only be used within the Transaction class
     var info = new SecurityInfo();
 }
Ejemplo n.º 16
0
        /// <summary> Adds the controls for this result viewer to the place holder on the main form </summary>
        /// <param name="placeHolder"> Main place holder ( &quot;mainPlaceHolder&quot; ) in the itemNavForm form into which the the bulk of the result viewer's output is displayed</param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <returns> Sorted tree with the results in hierarchical structure with volumes and issues under the titles and sorted by serial hierarchy </returns>
        public override void Add_HTML(PlaceHolder placeHolder, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("Export_File_ResultsViewer.Add_HTML", "Rendering results in text view");
            }

            //// Sort this by BIbID
            //resultTable.Sort("BibID");

            //// Determine which rows to display
            //int lastRow = base.LastRow;
            //int startRow = base.StartRow(lastRow);

            //// prepare to step through each title to display
            //List<SobekCM_Item_Collection.SobekCM_Item_Row> itemRows = new List<SobekCM_Item_Collection.SobekCM_Item_Row>();

            // Prepare to build an output
            StringBuilder resultsBldr = new StringBuilder(5000);

            int currentPage = RequestSpecificValues.Current_Mode.Page.HasValue ? RequestSpecificValues.Current_Mode.Page.Value : 1;

            if (currentPage < 2)
            {
                resultsBldr.Append("<br />" + Environment.NewLine + "<div class=\"SobekHomeText\">" + Environment.NewLine + "<blockquote>" + Environment.NewLine);
                resultsBldr.Append("This option allows you to export the list of results which match your search or browse to an excel document or CSV file for download.<br /><br />");
                resultsBldr.Append("Select the file type below to create the report:");
                resultsBldr.Append("<blockquote>");

                //currentMode.Page = 2;
                //resultsBldr.Append("<a href=\"" + currentMode.Redirect_URL() + "\">Excel Spreadsheet file (XLSX)</a><br /><br />");

                RequestSpecificValues.Current_Mode.Page = 3;
                resultsBldr.Append("<a href=\"" + UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode) + "\">Excel Spreadsheet file (XLS)</a><br /><br />");

                RequestSpecificValues.Current_Mode.Page = 4;
                resultsBldr.Append("<a href=\"" + UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode) + "\">Comma-seperated value text file (CSV)</a><br /><br />");

                //currentMode.Page = 5;
                //resultsBldr.Append("<a href=\"" + currentMode.Redirect_URL() + "\">HTML Table (HTML)</a><br /><br />");


                resultsBldr.Append("</blockquote>");
                resultsBldr.Append("</blockquote>");
                resultsBldr.Append("<br /><br />");
                resultsBldr.Append("</div>");

                // Add this to the page
                Literal mainLiteral = new Literal {
                    Text = resultsBldr.ToString()
                };
                placeHolder.Controls.Add(mainLiteral);
            }
            else
            {
                string filename = RequestSpecificValues.Current_Mode.Instance_Name;

                // Set the Gembox spreadsheet license key

                string from_db = String.Empty;
                string key     = String.Empty;
                if (UI_ApplicationCache_Gateway.Settings.Contains_Additional_Setting("Spreadsheet Library License"))
                {
                    try
                    {
                        key = UI_ApplicationCache_Gateway.Settings.Get_Additional_Setting("Spreadsheet Library License");

                        SecurityInfo thisDecryptor     = new SecurityInfo();
                        string       encryptedPassword = thisDecryptor.DecryptString(from_db, "*h3kj(83", "unsalted");
                    }
                    catch (Exception)
                    {
                    }
                }


                SpreadsheetInfo.SetLicense(key);

                // Create the excel file and worksheet
                ExcelFile      excelFile  = new ExcelFile();
                ExcelWorksheet excelSheet = excelFile.Worksheets.Add(RequestSpecificValues.Current_Mode.Instance_Name);
                excelFile.Worksheets.ActiveWorksheet = excelSheet;

                // Create the header cell style
                CellStyle headerStyle = new CellStyle
                {
                    HorizontalAlignment = HorizontalAlignmentStyle.Left, Font = { Weight = ExcelFont.BoldWeight }
                };
                headerStyle.FillPattern.SetSolid(Color.Yellow);
                headerStyle.Borders.SetBorders(MultipleBorders.Outside, Color.Black, LineStyle.Thin);

                // Create the title cell style
                CellStyle titleStyle = new CellStyle
                {
                    HorizontalAlignment = HorizontalAlignmentStyle.Left, Font = { Weight = ExcelFont.BoldWeight, Size = 12 * 20 }
                };

                // Set the default style
                CellStyle defaultStyle = new CellStyle();
                defaultStyle.Borders.SetBorders(MultipleBorders.Outside, Color.Black, LineStyle.Thin);

                const int columnSelector = 0;
                int       row            = 0;

                if (RequestSpecificValues.Current_Mode.Page != 4)
                {
                    // Add the title
                    excelSheet.Cells[1, columnSelector].Value = "Search or browse result list";
                    excelSheet.Cells[1, columnSelector].Style = titleStyle;
                    row = 3;
                }

                // Add the column headers
                excelSheet.Cells[row, columnSelector].Value      = "System ID";
                excelSheet.Cells[row, columnSelector].Style      = headerStyle;
                excelSheet.Cells[row, columnSelector + 1].Value  = "Link";
                excelSheet.Cells[row, columnSelector + 1].Style  = headerStyle;
                excelSheet.Cells[row, columnSelector + 2].Value  = "Group Title";
                excelSheet.Cells[row, columnSelector + 2].Style  = headerStyle;
                excelSheet.Cells[row, columnSelector + 3].Value  = "Item Title";
                excelSheet.Cells[row, columnSelector + 3].Style  = headerStyle;
                excelSheet.Cells[row, columnSelector + 4].Value  = "Date";
                excelSheet.Cells[row, columnSelector + 4].Style  = headerStyle;
                excelSheet.Cells[row, columnSelector + 5].Value  = "Author";
                excelSheet.Cells[row, columnSelector + 5].Style  = headerStyle;
                excelSheet.Cells[row, columnSelector + 6].Value  = "Publisher";
                excelSheet.Cells[row, columnSelector + 6].Style  = headerStyle;
                excelSheet.Cells[row, columnSelector + 7].Value  = "Format";
                excelSheet.Cells[row, columnSelector + 7].Style  = headerStyle;
                excelSheet.Cells[row, columnSelector + 8].Value  = "Edition";
                excelSheet.Cells[row, columnSelector + 8].Style  = headerStyle;
                excelSheet.Cells[row, columnSelector + 9].Value  = "Subjects";
                excelSheet.Cells[row, columnSelector + 9].Style  = headerStyle;
                excelSheet.Cells[row, columnSelector + 10].Value = "Measurement";
                excelSheet.Cells[row, columnSelector + 10].Style = headerStyle;
                excelSheet.Cells[row, columnSelector + 11].Value = "Style / Period";
                excelSheet.Cells[row, columnSelector + 11].Style = headerStyle;
                excelSheet.Cells[row, columnSelector + 12].Value = "Technique";
                excelSheet.Cells[row, columnSelector + 12].Style = headerStyle;
                excelSheet.Cells[row, columnSelector + 13].Value = "Institution";
                excelSheet.Cells[row, columnSelector + 13].Style = headerStyle;
                excelSheet.Cells[row, columnSelector + 14].Value = "Donor";
                excelSheet.Cells[row, columnSelector + 14].Style = headerStyle;
                excelSheet.Cells[row, columnSelector + 15].Value = "OCLC";
                excelSheet.Cells[row, columnSelector + 15].Style = headerStyle;
                excelSheet.Cells[row, columnSelector + 16].Value = "ALEPH";
                excelSheet.Cells[row, columnSelector + 16].Style = headerStyle;
                excelSheet.Cells[row, columnSelector + 17].Value = "Serial1";
                excelSheet.Cells[row, columnSelector + 17].Style = headerStyle;
                excelSheet.Cells[row, columnSelector + 18].Value = "Serial2";
                excelSheet.Cells[row, columnSelector + 18].Style = headerStyle;
                excelSheet.Cells[row, columnSelector + 19].Value = "Serial3";
                excelSheet.Cells[row, columnSelector + 19].Style = headerStyle;

                // Set the correct widths
                excelSheet.Columns[columnSelector].Width      = 12 * 256;
                excelSheet.Columns[columnSelector + 1].Width  = 8 * 256;
                excelSheet.Columns[columnSelector + 2].Width  = 40 * 256;
                excelSheet.Columns[columnSelector + 3].Width  = 40 * 256;
                excelSheet.Columns[columnSelector + 4].Width  = 20 * 256;
                excelSheet.Columns[columnSelector + 5].Width  = 14 * 256;
                excelSheet.Columns[columnSelector + 6].Width  = 14 * 256;
                excelSheet.Columns[columnSelector + 7].Width  = 20 * 256;
                excelSheet.Columns[columnSelector + 8].Width  = 20 * 256;
                excelSheet.Columns[columnSelector + 9].Width  = 20 * 256;
                excelSheet.Columns[columnSelector + 10].Width = 20 * 256;
                excelSheet.Columns[columnSelector + 11].Width = 20 * 256;
                excelSheet.Columns[columnSelector + 12].Width = 20 * 256;
                excelSheet.Columns[columnSelector + 13].Width = 20 * 256;
                excelSheet.Columns[columnSelector + 14].Width = 20 * 256;
                excelSheet.Columns[columnSelector + 15].Width = 20 * 256;
                excelSheet.Columns[columnSelector + 16].Width = 20 * 256;
                excelSheet.Columns[columnSelector + 17].Width = 20 * 256;
                excelSheet.Columns[columnSelector + 18].Width = 20 * 256;
                excelSheet.Columns[columnSelector + 19].Width = 20 * 256;
                row++;

                // Add each row
                foreach (iSearch_Title_Result titleResult in PagedResults)
                {
                    for (int item_count = 0; item_count < titleResult.Item_Count; item_count++)
                    {
                        iSearch_Item_Result itemResult = titleResult.Get_Item(item_count);

                        excelSheet.Cells[row, columnSelector].Value     = titleResult.BibID + "_" + itemResult.VID;
                        excelSheet.Cells[row, columnSelector + 1].Value = RequestSpecificValues.Current_Mode.Base_URL + titleResult.BibID + "/" + itemResult.VID;
                        excelSheet.Cells[row, columnSelector + 2].Value = titleResult.GroupTitle.Replace("<i>", "").Replace("</i>", "").Replace("&amp;", "&");
                        excelSheet.Cells[row, columnSelector + 3].Value = itemResult.Title.Replace("<i>", "").Replace("</i>", "").Replace("&amp;", "&");
                        //excelSheet.Cells[row, columnSelector + 4].Value = itemResult.PubDate.Replace("<i>", "").Replace("</i>", "").Replace("&amp;", "&");
                        //excelSheet.Cells[row, columnSelector + 5].Value = titleResult.Author.Replace("<i>", "").Replace("</i>", "").Replace("&amp;", "&");
                        //excelSheet.Cells[row, columnSelector + 6].Value = titleResult.Publisher.Replace("<i>", "").Replace("</i>", "").Replace("&amp;", "&");
                        //excelSheet.Cells[row, columnSelector + 7].Value = titleResult.Format.Replace("<i>", "").Replace("</i>", "").Replace("&amp;", "&");
                        //excelSheet.Cells[row, columnSelector + 8].Value = titleResult.Edition.Replace("<i>", "").Replace("</i>", "").Replace("&amp;", "&");
                        //excelSheet.Cells[row, columnSelector + 9].Value = titleResult.Subjects.Replace("<i>", "").Replace("</i>", "").Replace("&amp;", "&");
                        //excelSheet.Cells[row, columnSelector + 10].Value = titleResult.Measurement.Replace("<i>", "").Replace("</i>", "").Replace("&amp;", "&");
                        //excelSheet.Cells[row, columnSelector + 11].Value = titleResult.Style_Period.Replace("<i>", "").Replace("</i>", "").Replace("&amp;", "&");
                        //excelSheet.Cells[row, columnSelector + 12].Value = titleResult.Technique.Replace("<i>", "").Replace("</i>", "").Replace("&amp;", "&");
                        //excelSheet.Cells[row, columnSelector + 13].Value = titleResult.Institution.Replace("<i>", "").Replace("</i>", "").Replace("&amp;", "&");
                        //excelSheet.Cells[row, columnSelector + 14].Value = titleResult.Donor.Replace("<i>", "").Replace("</i>", "").Replace("&amp;", "&");
                        //if (titleResult.OCLC_Number > 1)
                        //	excelSheet.Cells[row, columnSelector + 15].Value = titleResult.OCLC_Number.ToString();
                        //if (titleResult.ALEPH_Number > 1)
                        //	excelSheet.Cells[row, columnSelector + 16].Value = titleResult.ALEPH_Number.ToString();
                        //excelSheet.Cells[row, columnSelector + 17].Value = itemResult.Level1_Text.Replace("<i>", "").Replace("</i>", "").Replace("&amp;", "&");
                        //excelSheet.Cells[row, columnSelector + 18].Value = itemResult.Level2_Text.Replace("<i>", "").Replace("</i>", "").Replace("&amp;", "&");
                        //excelSheet.Cells[row, columnSelector + 19].Value = itemResult.Level3_Text.Replace("<i>", "").Replace("</i>", "").Replace("&amp;", "&");

                        row++;
                    }
                }

                // Set the border
                excelSheet.Cells.GetSubrange("A4", "T" + row).SetBorders(MultipleBorders.Outside, Color.Black, LineStyle.Medium);
                excelSheet.Cells.GetSubrange("A4", "t4").SetBorders(MultipleBorders.Outside, Color.Black, LineStyle.Medium);

                if (Tracer != null)
                {
                    Tracer.Add_Trace("Export_File_ResultsViewer.Add_HTML", "Clearing response");
                }

                // Clear any response until now
                HttpContext.Current.Response.Clear();


                // Output in proper format to the user
                switch (RequestSpecificValues.Current_Mode.Page)
                {
                //case 2:
                //    System.Web.HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats";
                //    System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + filename + ".xlsx");
                //    // With XLSX it is a bit more complicated as MS Packaging API can't write
                //    // directly to Response.OutputStream. Therefore we use temporary MemoryStream.
                //    System.IO.MemoryStream ms = new System.IO.MemoryStream();
                //    excelFile.SaveXlsx(ms);
                //    ms.WriteTo(System.Web.HttpContext.Current.Response.OutputStream);
                //    break;


                case 3:
                    HttpContext.Current.Response.Clear();
                    HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";
                    HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + filename + ".xls");
                    excelFile.SaveXls(HttpContext.Current.Response.OutputStream);
                    break;

                case 4:
                    HttpContext.Current.Response.ContentType = "text/csv";
                    HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + filename + ".csv");
                    excelFile.SaveCsv(HttpContext.Current.Response.OutputStream, CsvType.CommaDelimited);
                    break;

                    //case 5:
                    //    System.Web.HttpContext.Current.Response.ContentType = "text/html";
                    //    System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + "Report18.html");
                    //    System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(System.Web.HttpContext.Current.Response.OutputStream, new UTF8Encoding(false));
                    //    excelFile.SaveHtml(writer, null, true);
                    //    writer.Close();
                    //    break;
                }

                if (Tracer != null)
                {
                    Tracer.Add_Trace("Export_File_ResultsViewer.Add_HTML", "Ending response");
                }

                HttpContext.Current.Response.End();
            }
        }
Ejemplo n.º 17
0
        //private static readonly TimeSpan MaxRemindBefore = TimeSpan.FromDays(7);

        public ReminderService(ISession session, SecurityInfo securityInfo, ServiceConfiguration configuration)
            : base(session, securityInfo, configuration)
        {
        }
Ejemplo n.º 18
0
 public abstract JObject GetKLine(SecurityInfo si, CandleResolution resolution, string from, string to);
Ejemplo n.º 19
0
        public bool DoesImportviaLoadLibrary(PEProp binInfo, string strTheOne, SecurityInfo SecInfo)
        {
            if (DoesImport(binInfo, strTheOne, true, SecInfo)) return true;

            if (DoesImport(binInfo, "LoadLibrary", false, SecInfo) && DoesImport(binInfo, "GetProcAddress", false, SecInfo))
            {
                System.IO.FileStream fsStream = new System.IO.FileStream(binInfo.Path, System.IO.FileMode.Open, System.IO.FileAccess.Read);
                System.IO.BinaryReader brReader = new System.IO.BinaryReader(fsStream);
                Byte[] strWorkBuff = brReader.ReadBytes((Int32)fsStream.Length);
                long lngSize = brReader.BaseStream.Length;
                long lngCnt = 0;
                long lngInnerCnt = 0;
                brReader.Close();
                fsStream.Close();

                for (lngCnt = 0; lngCnt < lngSize; lngCnt++)
                {
                    for (lngInnerCnt = 0; lngInnerCnt < strTheOne.Length; lngInnerCnt++)
                    {
                        if (strWorkBuff[lngCnt + lngInnerCnt].CompareTo(Convert.ToByte(strTheOne[(int)lngInnerCnt])) == 0) break;
                    }
                    if (lngInnerCnt == strTheOne.Length)
                    {
                        return true;
                    }
                }
            }

            return false;
        }
Ejemplo n.º 20
0
 public ConsultPostMaster(SecurityInfo self, Chap4AgreementConsultationPortTypeClient proxy, EtkDepotPortTypeClient etkDepot, KgssPortTypeClient kgss)
     : base(self, new SecondPassConsultPostMaster(self, proxy, etkDepot), etkDepot, kgss)
 {
 }
Ejemplo n.º 21
0
 public void GetFileSize(SecurityInfo secInfo, PEProp binInfo)
 {
     secInfo.FileSize = binInfo.Length;
 }
Ejemplo n.º 22
0
        public bool LoadLibrary(PEProp binInfo, SecurityInfo SecInfo)
        {
            if (DoesImport(binInfo, "LoadLibrary", false, SecInfo)) return true;

            return false;
        }
Ejemplo n.º 23
0
        public bool GS3Check(PEProp binInfo, SecurityInfo SecInfo)
        {
            foreach (string strImport in SecInfo.Imports)
            {

                if (strImport.ToString() == "_crt_debugger_hook") return true;
            }

            return false;
        }
Ejemplo n.º 24
0
        public int MSBannedAPIs(SecurityInfo secInfo, string [] strImports)
        {
            StringBuilder strAPIBuild = new StringBuilder();
            string strRes = WinBinAudit.Properties.Resources.BannedAPIs;
            int intBannedCount = 0;
            StringReader srBannedAPIs = null;

            srBannedAPIs = new StringReader(strRes);

            string strLine = srBannedAPIs.ReadLine();
            while (strLine != null)
            {
                System.Diagnostics.Debug.WriteLine("[banned API] " + strLine);
                foreach (string strImport in strImports)
                {
                    if(strImport.ToString().Equals(strLine.ToString())){
                        strAPIBuild.AppendLine(strImport);
                        intBannedCount++;
                    }
                }

                strLine = srBannedAPIs.ReadLine();
            }

            if (intBannedCount == 0)
            {
                strAPIBuild.Append("N/A");
            }

            secInfo.MSSDLCBannedList = strAPIBuild.ToString();
            return intBannedCount;
        }
Ejemplo n.º 25
0
        public bool HighEntropy(SecurityInfo secInfo, PEProp binInfo)
        {
            // Compiler version must be 17

            PEFile pE = binInfo.PE;
            ImageOptionalHeader optionalHeader = pE.OptionalHeader;
            ushort num = (ushort)optionalHeader.GetField(ImageOptionalHeader.Fields.DllCharacteristics);
            bool flag = (num & 32) != 0;
            ImageFileHeader fileHeader = pE.FileHeader;
            ushort num2 = (ushort)fileHeader.GetField(ImageFileHeader.Fields.Characteristics);
            bool flag2 = (num2 & 32) != 0;
            if (flag)
            {
                return false;
            }
            if (flag && flag2)
            {
                return true;
            }
            return false;
        }
Ejemplo n.º 26
0
 public bool SetDEPPolicy(PEProp binInfo, SecurityInfo SecInfo)
 {
     return DoesImportviaLoadLibrary(binInfo, "SetProcessDEPPolicy", SecInfo);
 }
Ejemplo n.º 27
0
 public EBirthPostMaster(SecurityInfo self, TTPPortTypeClient proxy)
     : base(self)
 {
     this.proxy = proxy;
 }
Ejemplo n.º 28
0
        public void SigDetails(SecurityInfo secInfo, PEProp binInfo)
        {
            X509Certificate xcert = null;
            X509Certificate2 xcert2 = null;

            try {

                secInfo.SigName = "N/A";
                secInfo.SigAlgo = "N/A";
                secInfo.SigIssuer = "N/A";

                xcert = X509Certificate.CreateFromSignedFile(binInfo.Path);
                xcert2 = new X509Certificate2(xcert);
                secInfo.SigName = xcert.Subject;
                secInfo.SigAlgo = xcert.GetKeyAlgorithm();

                JavaScience.EncryptTo eToo = new JavaScience.EncryptTo();

                // show never happen
                if (xcert2.HasPrivateKey == true)  MessageBox.Show(binInfo.Path + " includes a private key!", "Private key found", MessageBoxButtons.OK, MessageBoxIcon.Hand);

                if(secInfo.SigAlgo.Equals("1.2.840.113549.1.1.1")){
                    secInfo.SigAlgo = xcert2.SignatureAlgorithm.FriendlyName + " / RSA " + eToo.GetCertPublicKeySize(xcert);
                } else if (secInfo.SigAlgo.Equals("2.5.8.1.1")){
                    secInfo.SigAlgo = xcert2.SignatureAlgorithm.FriendlyName + " / RSA " + eToo.GetCertPublicKeySize(xcert);
                } else if (secInfo.SigAlgo.Equals("1.2.840.10040.4.1")){
                    secInfo.SigAlgo = xcert2.SignatureAlgorithm.FriendlyName + " / DSA " + eToo.GetCertPublicKeySize(xcert);
                } else if (secInfo.SigAlgo.Equals("1.2.840.10046.2.1")){
                    secInfo.SigAlgo = xcert2.SignatureAlgorithm.FriendlyName + " / DH " + eToo.GetCertPublicKeySize(xcert);
                } else if (secInfo.SigAlgo.Equals("1.3.6.1.4.1.3029.1.2.1")){
                    secInfo.SigAlgo = xcert2.SignatureAlgorithm.FriendlyName + " / ElGamal " + eToo.GetCertPublicKeySize(xcert);
                } else if (secInfo.SigAlgo.Equals("1.3.6.1.4.1.25258.1.1")){
                    secInfo.SigAlgo = xcert2.SignatureAlgorithm.FriendlyName + " / NR " + eToo.GetCertPublicKeySize(xcert);
                } else if (secInfo.SigAlgo.Equals("1.3.6.1.4.1.25258.1.2")){
                    secInfo.SigAlgo = xcert2.SignatureAlgorithm.FriendlyName + " / ECDSA " + eToo.GetCertPublicKeySize(xcert);
                } else if (secInfo.SigAlgo.Equals("1.2.643.2.2.19")){
                    secInfo.SigAlgo = xcert2.SignatureAlgorithm.FriendlyName + " / GOST-34.10 " + eToo.GetCertPublicKeySize(xcert);
                }

                secInfo.SigIssuer = xcert.Issuer;

            }
            catch (Exception e)
            {
                if(secInfo.SigName.Equals("") == true) secInfo.SigName = "N/A";
                if(secInfo.SigAlgo.Equals("") == true) secInfo.SigAlgo = "N/A";
                if(secInfo.SigIssuer.Equals("") == true) secInfo.SigIssuer = "N/A";
                secInfo.Error = "Signature details error " + e.Message;
            }
        }
Ejemplo n.º 29
0
 public SecondPassAskPostMaster(SecurityInfo self, Chap4AgreementAdmissionPortTypeClient proxy, EtkDepotPortTypeClient etkDepot)
     : base(self, etkDepot)
 {
     this.proxy = proxy;
 }
Ejemplo n.º 30
0
        /// <summary>
        /// SetDllDirectory, SetDefaultDllDirectories, AddDllDirectory
        /// </summary>
        /// <param name="binInfo"></param>
        /// <param name="secInfo"></param>
        /// <returns></returns>
        public bool DLLPlanting(PEProp binInfo, SecurityInfo SecInfo)
        {
            if (DoesImport(binInfo, "SetDLLDirectory", false, SecInfo) || DoesImport(binInfo, "SetDefaultDllDirectories", false, SecInfo) || DoesImport(binInfo, "AddDllDirectory", false, SecInfo))
            {
                if (DoesImport(binInfo, "SetDLLDirectory", false, SecInfo)){
                    SecInfo.DLLPlantReason = SecInfo.DLLPlantReason + "Imports SetDLLDirectory ";
                }

                if (DoesImport(binInfo, "SetDefaultDllDirectories", false, SecInfo)){
                    SecInfo.DLLPlantReason = SecInfo.DLLPlantReason + "Imports SetDefaultDllDirectories ";
                }

                if (DoesImport(binInfo, "AddDllDirectory", false, SecInfo)){
                    SecInfo.DLLPlantReason = SecInfo.DLLPlantReason + "Imports AddDllDirectory ";
                }
                return true;
            }

            if (DoesImportviaLoadLibrary(binInfo, "SetDLLDirectory", SecInfo) || DoesImportviaLoadLibrary(binInfo, "SetDefaultDllDirectories", SecInfo) || DoesImportviaLoadLibrary(binInfo, "AddDllDirectory", SecInfo))
            {

                if (DoesImport(binInfo, "SetDLLDirectory", false, SecInfo))
                {
                    SecInfo.DLLPlantReason = SecInfo.DLLPlantReason + "Imports via LoadLibrary SetDLLDirectory ";
                }

                if (DoesImport(binInfo, "SetDefaultDllDirectories", false, SecInfo))
                {
                    SecInfo.DLLPlantReason = SecInfo.DLLPlantReason + "Imports via LoadLibrary SetDefaultDllDirectories ";
                }

                if (DoesImport(binInfo, "AddDllDirectory", false, SecInfo))
                {
                    SecInfo.DLLPlantReason = SecInfo.DLLPlantReason + "Imports via LoadLibrary AddDllDirectory ";
                }
                return true;
            }

            return false;
        }
Ejemplo n.º 31
0
        public bool VirtualAlloc(PEProp binInfo, SecurityInfo SecInfo)
        {
            foreach (string strImport in SecInfo.Imports)
            {

                if (strImport.ToString() == "VirtualAlloc") return true;
            }

            return false;
        }
Ejemplo n.º 32
0
        public string DLLPlantingReason(PEProp binInfo, SecurityInfo SecInfo)
        {
            string strDLLPlantReason = "";

            if (DoesImport(binInfo, "SetDLLDirectory", false, SecInfo) || DoesImport(binInfo, "SetDefaultDllDirectories", false, SecInfo) || DoesImport(binInfo, "AddDllDirectory", false, SecInfo))
            {
                if (DoesImport(binInfo, "SetDLLDirectory", false, SecInfo))
                {
                    strDLLPlantReason = strDLLPlantReason + "Imports SetDLLDirectory ";
                }

                if (DoesImport(binInfo, "SetDefaultDllDirectories", false, SecInfo))
                {
                    strDLLPlantReason = strDLLPlantReason + "Imports SetDefaultDllDirectories ";
                }

                if (DoesImport(binInfo, "AddDllDirectory", false, SecInfo))
                {
                    strDLLPlantReason = strDLLPlantReason + "Imports AddDllDirectory ";
                }

            }

            if (DoesImportviaLoadLibrary(binInfo, "SetDLLDirectory", SecInfo) || DoesImportviaLoadLibrary(binInfo, "SetDefaultDllDirectories", SecInfo) || DoesImportviaLoadLibrary(binInfo, "AddDllDirectory", SecInfo))
            {

                if (DoesImportviaLoadLibrary(binInfo, "SetDLLDirectory", SecInfo))
                {
                    strDLLPlantReason = strDLLPlantReason + "Imports via LoadLibrary SetDLLDirectory ";
                }

                if (DoesImportviaLoadLibrary(binInfo, "SetDefaultDllDirectories", SecInfo))
                {
                    strDLLPlantReason = strDLLPlantReason + "Imports via LoadLibrary SetDefaultDllDirectories ";
                }

                if (DoesImportviaLoadLibrary(binInfo, "AddDllDirectory", SecInfo))
                {
                    strDLLPlantReason = strDLLPlantReason + "Imports via LoadLibrary AddDllDirectory ";
                }

            }

            return strDLLPlantReason;
        }
Ejemplo n.º 33
0
 public AjaxReturn SecurityPost(SecurityInfo json)
 {
     Security existing = Database.Get(json.header);
     Database.BeginTransaction();
     Database.Update(json.header, true);
     if (existing.idSecurity > 0 && json.header.SecurityName != existing.SecurityName) {
         // Name has changed - change name of subaccounts
         foreach(Account a in Database.Query<Account>("SELECT * FROM Account WHERE AccountName LIKE "
             + Database.Quote("%:" + existing.SecurityName))) {
             if(a.AccountName.EndsWith(":" + existing.SecurityName)) {
                 a.AccountName = a.AccountName.Substring(0, a.AccountName.Length - existing.SecurityName.Length) + json.header.SecurityName;
                 Database.Update(a);
             }
         }
     }
     // Replace old stock prices with new ones
     Database.Execute("DELETE FROM StockPrice WHERE SecurityId = " + json.header.idSecurity);
     foreach (StockPrice p in json.detail) {
         Database.Insert(p);
     }
     Database.Commit();
     return new AjaxReturn() { message = "Security updated" };
 }
Ejemplo n.º 34
0
 public RegistrationCreated(RegistrationID registrationIdentity, DateTime registeredUtc, SecurityInfo security)
     : base(registrationIdentity)
 {
     RegisteredUtc = registeredUtc;
     Security = security;
 }