Encryption and .Net #19

Encryption and .Net

Dot net provides rich support for data encryption. the namespace System.Security.Cryptography includes the encryption features.There are three primary concepts related to encryption such as Hashing, Symmetric Encryption, and Asymmetric encryption. A hash is a data fingerprint, a small data that represents the uniqueness of a large block of data. In Symmetric Encryption, a single key is used for both encryption and decryption. In Asymmetric encryption, two different keys are used, one for encryption and another one for decryption. In real world applications, a combination of all three methods are used to provide better security.

A digital transmission of a check can be as follows: create the hash of the check, encrypt the hash with the public key using asymmetric encryption, apply the encrypted hash on the document, encrypt the symmetric encryption key with asymmetric encryption method, encrypt the check with symmetric encryption, transmit the encrypted key and encrypted document to the receiver

Hash Example

   hash = New Encryption.Hash(Encryption.Hash.Provider.CRC32)   data = New  Encryption.Data("Hash Browns")   hash.Calculate(data)

Symmetric example:

 sym = New Encryption.Symmetric(Encryption.Symmetric.Provider.Rijndael)  key = New Encryption.Data("Pass")   Encryption.Data encryptedData;  encryptedData = sym.Encrypt(New Encryption.Data("Secret"), key) string base64EncryptedString = encryptedData.ToBase64

Asymmetric Example

  asym = New Encryption.Asymmetric    pubkey = New Encryption.Asymmetric.PublicKey    privkey = New Encryption.Asymmetric.PrivateKey  asym.GenerateNewKeyset(pubkey, privkey) secret = "ancient chinese"  Encryption.Data encryptedData   encryptedData = asym.Encrypt(New Encryption.Data(secret), pubkey)   Encryption.Data decryptedData   asym2 = New Encryption.Asymmetric   decryptedData = asym2.Decrypt(encryptedData, privkey)

From: http://sitestree.com/?p=5334
Categories:19
Tags:
Post Data:2010-04-30 02:01:13

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

#Sensor: #Canada: #Job/Contract/Project: #Sensor, #Tracking, #Fusion, #Estimation, #Surveillance, #sensor network, #target #tracking, #security 2021-08-21

Date Posted:2021-08-21 .Apply yourself, or submit others as candidates; Build a recruitment team to submit others as candidates; submit RFP to be considered for projects in future; Try to become a vendor so that you are asked to submit consultants/resources in future. If these work for you. This list is posted in this blog everyday provided there are new projects under the criteria

  1. communications-detection-and-fibre-optics-10031
  2. VERMILION – Provincial Building – Security Card Access System
  3. edp-hardware-and-software-10034
  4. Request for Expressions of Interest and Qualifications for Endpoint Security Solutions
  5. Ivanti Security Controls Maintenance Renewal
  6. Ivanti Security Controls Maintenance Renewal
  7. fire-fighting-security-and-safety-equipment-10010
  8. ITQ2021-08-27 for Purchase of Security Safes and Parts
  9. miscellaneous-goods-10019
  10. Design, Fabrication and Installation of Interactive Donor Recognition Wall
  11. information-processing-and-related-telecommunications-services-10049
  12. TBIPS – IT Security TRA and C&A Analyst (20210445) (20210445-01)
  13. Digitization of Old Age Security (OAS) files (100018791)
  14. maintenance-repair-modification-rebuilding-and-installation-of-goods-equipment-10054
  15. Renewal of Cisco Subscription, Maintenance and Support for Various Security Related Appliances
  16. WRIC Site Security 2
  17. operation-of-government-owned-facilities-10039
  18. Security Guard Services for Off-Street Operations
  19. professional-administrative-and-management-support-services-10040
  20. Project: tender_15159 – Payment Card Industry Qualified Security Assessor
  21. special-studies-and-analysis-not-r-d-10047
  22. Electronic Supply Chain Tracking and Socio-Economic Impact Reporting Service
  23. Keywords Used:sensor,fusion,sensor network,tracking,target tracking,surveillance,self driving car,self-driving,estimation,security,signal processing,image processing,autonomouse vehicle,facial recognition,signal,recognition,sensor fusion

    #Engineering: #Canada: #Job/Contract/Project: Any #Engineering: #Computer, #Electrical, #Electronics, #Civil, #Chemical, #Mechanical, #Naval, #Biomedical, and misc Engineering

    Date Posted:2021-08-21 .Apply yourself, or submit others as candidates; Build a recruitment team to submit others as candidates; submit RFP to be considered for projects in future; Try to become a vendor so that you are asked to submit consultants/resources in future. If these work for you. This list is posted in this blog everyday provided there are new projects under the criteria

    1. construction-services-10004
    2. BringIt Electrical Installation Project (RE-TENDER)
    3. VSF Weather Protection Upgrades TP03 Civil Works
  24. aerospace-10005
  25. HYDRO MECHANICAL UNIT (T8493-210008/A)
  26. air-conditioning-and-refrigeration-equipment-10016
  27. MECHANICAL COOLING ADDITION
  28. Supply And Installation Of Heating, Ventilation And Air Conditioning (Hvac) System Replacement, Electrical Upgrades
  29. communications-detection-and-fibre-optics-10031
  30. Electrical Upgrade
  31. electrical-and-electronics-10006
  32. BringIt Electrical Installation Project (RE-TENDER)
  33. PEAK SHAVERS ELECTRICAL SWITCHGEAR EQUIPMENT SUPPLIER
  34. Electrical Services
  35. Modernization of Antiquated Electrical Panels
  36. fabricated-materials-10009
  37. Mechanical Lock (21401-220001/A)
  38. food-preparation-and-serving-equipment-10012
  39. Electrical Upgrade
  40. architect-and-engineering-services-10048
  41. Engineering & Architectural Services Civil Engineering
  42. Engineering Services, Old Nipawin Bridge Inspection
  43. Electrical Eng-Design of the fire panel protection system replacement
  44. Engineering Roster – Transmission Watermain Infrastructure Projects
  45. Engineering Services for Roof Replacement, Peterborough Co-operative Homes Inc.
  46. Engineering Services
  47. custodial-operations-and-related-services-10037
  48. Multi Electrical 2
  49. educational-and-training-services-10043
  50. One Pilot Instructor and one Combination Instructor Flight Engineer and Instructor Load Master (W0107-21XC39/A)
  51. professional-administrative-and-management-support-services-10040
  52. Facilities Mechanical Systems Review + Transformer Vault Design
  53. quality-control-testing-inspection-and-technical-representative-services-10053
  54. IPD Mechanical Contractor Services – RCMP Main Detachment Modern
  55. MECHANICAL SYSTEMS CONDITION ASSESSMENT
  56. Keywords Used:engineer,civil,mechanical,electrical,electronics,mechatronics,naval,biomedical,computer engineer,software engineer,civil engineer,biomedical,electrical engineer,electronics engineer,mechanical engineer,metallurgical,chemical engineer,industrial engineer,communications engineer,quality assurance engineer,Aerospace engineer,aeronautical engineer,Engineering manager,Agricultural Engineer,Automotive Engineer,Environmental Engineer,Geological Engineer,Marine Engineer,Petroleum Engineer,Acoustic Engineer,Acoustic Engineer,Aerospace Engineer,Agricultural Engineer,Applied Engineer,Architectural Engineer,Audio Engineer,Automotive Engineer,Biomedical Engineer,Chemical Engineer,Civil Engineer,Computer Engineer,Electrical Engineer,Environmental Engineer,Industrial Engineer,Marine Engineer,Materials Science Engineer,Mechanical Engineer,Mechatronic Engineer,Mining and Geological Engineer,Molecular Engineer,Nanoengineering,Nuclear Engineer,Petroleum Engineer,Software Engineer,Structural Engineer,Telecommunications Engineer,Thermal Engineer,Transport Engineer,Vehicle Engineer,engineering

    A Simple ASP.Net Form in C#. Payment Information Collection Form. #19

    A Simple ASP.Net Form in C#. Payment Information Collection Form.

    Such form can be used in test operation while implementing online payment processing . The input fileds are to send data to the payment gateway. The response fields are to display response from payment gateway. Here, the output fields represent the response fields as sent by Paymentech gateway.

    The FormThe CSSFront end form code From: http://sitestree.com/?p=5329
    Categories:19
    Tags:
    Post Data:2011-10-02 13:31:36

        Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
        (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
        In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
        <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
        8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
        Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
        Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>
    

    Allow Page Access only to the Logged in Users #19

    Allow Page Access only to the Logged in Users

    From: http://sitestree.com/?p=5328
    Categories:19
    Tags:
    Post Data:2006-11-15 05:45:24

        Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
        (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
        In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
        <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
        8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
        Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
        Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>
    

    Creating your own Class in C# in ASP.net #19

    Creating your own Class in C# in ASP.net

    • It is kind of simple. You need to create a class library. The class library will create a dll file. From your project, you need to add reference to the dll file. Then you will be able to use the classes and methods of the class library.
    • Check the following codes. One is a sample class library and another one is how to use the class. The class library implements two methods such as add and subtract to add or subtract two numbers. The project uses the namespace [class library] and calls these methods
    • You can get the dll file in the bin/debug or bin/release folder under your class library project
    • You can right click on your project/website [in solution explorer], and click Add Reference, then click browse and select the dll file created
    • Check the class library below
    • Check the Form in picture. This form uses the class library.
    • Check the Form Code to use the Library
    • Check the Backend Form Code to use the Library

    From: http://sitestree.com/?p=5327
    Categories:19
    Tags:
    Post Data:2009-03-26 09:27:06

        Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
        (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
        In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
        <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
        8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
        Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
        Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>
    

    Simple Ajax Applications in C# (ASP.Net) #19

    Simple Ajax Applications in C# (ASP.Net)

    • If you are coming from PHP or Java Platform where you use JavaScript or JQuery to provide Ajax functionality, you still can use those strategies in ASP.net to provide Ajax functionality
    • Check our short note on Ajax using JavaScript. In .Net, you just have to call the JavaScript function (that implements Ajax functionality) on the event you want the Ajax functionality. However, you do not use runat=”server”.
    • Another approach is Using Ajax Server Controls such as ScriptManager, ScriptManagerProxy, UpdatePanel, ContentPanel, UpdateProxy
    • You can find these Ajax controls at the Toolbox under Ajax Extensions
    • You can grab them and place on your form, you can grab and place on the code, or you can write them in your code [whatever you are used to]
    • And yes, you could use JQuery as well. JQuery uses an wrapper on JavaScript functionality and makes the life of the developer little easier
    • In this short note, I will show a simple example of using Ajax Server Controls, also show you the code to invoke Ajax functionality using JavaScript
    • Now take a look at the simple application interface below. The application will calculate sum, difference, and multiplication of two numbers without refreshing the page. We will calculate immediately, also will show the situation when the calculation may take a little more time
    • The idea is simple, you need to add a ScriptManager control. If you use master pages, and the situation becomes that you need to place two ScriptManagers, just place one ScriptManager in the Master and use ScriptManagerProxy in the content page
    • use UpdatePanel around the controls that will be refreshed without the page being refreshed
    • Use UpdateProgress control, when you know that the operation will take some time. Use this control to inform the user that the operation is under progress
    • Now the sample application interface
    • Now the Form code
    • Now the backend code
    • Now an example on how to implement Ajax functionality in C# in ASP.net using JavaScript. It just displays current date time but using Ajax and without refreshing the page. Just go through the code

    From: http://sitestree.com/?p=5326
    Categories:19
    Tags:
    Post Data:2010-04-01 05:09:58

        Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
        (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
        In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
        <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
        8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
        Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
        Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>
    

    ASP.Net Validation Control Examples in C#. #19

    ASP.Net Validation Control Examples. Just check the code below

    Some note

    • RequiredFieldValidator: is used to check that a field is filled up
    • CompareValidator: Compare the value of a field with another field or data
    • RangeValidator: Compares the data is within a given range
    • RegularExpressionValidator: Domain name syntax, email addtress syntax
    • ValidationSummary: Display all validation errors in a summary box
    • CompareValidator: Write your own custom validation rules and display the outcome
    • Remember
      • You can display error on the side of the control
      • You can display error under the control
      • The example used both just for example
      • The Text property is the output that comes just where the validation control is placed. ErrorMessage propert is for the ValidationSummary
      • If you just want the Validation Summary output, use Display=”none” for the validation control (not the summarycontrol) itself
    • the code can be seen at http://salearningschool.com/samples/validate.txt as well
        Validation Control           







    From: http://sitestree.com/?p=5304
    Categories:19
    Tags:
    Post Data:2009-06-06 19:26:04

        Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
        (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
        In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
        <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
        8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
        Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
        Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>
    

    Manipulating Configuration Parameters: For example Variables in web.config #19

    To access a variable value, you can use the following type of code

    string statusr = WebConfigurationManager.AppSettings["userLoginStatus"].ToString();
    You will need to use: using System.Web.Configuration;or you can write as follows:string statusr = System.Web.Configuration.WebConfigurationManager.AppSettings["userLoginStatus"].ToString();

    What about if you want to change the values of the variables in the web.config file. Check the code below:

    //CompiledConfiguration myConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");//change values for the variables in the AppSettings sectionmyConfig.AppSettings.Settings["userLoginStatus"].Value = "1";//change values for the connection strings section        myConfig.ConnectionStrings.ConnectionStrings["myDatabaseName"].ConnectionString = "Data Source=....";myConfig.Save();//will return you the new valuestring statusr = WebConfigurationManager.AppSettings["userLoginStatus"].ToString();

    The above code used:
    System.Web.Configuration;
    using System.Configuration;

    A sample web.config file

    From: http://sitestree.com/?p=5303
    Categories:19
    Tags:
    Post Data:2007-10-10 15:52:36

        Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
        (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
        In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
        <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
        8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
        Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
        Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>
    

    Random C# and MS SQl Server #19

    Foreign Key in Table Declaration

    CREATE TABLE ORDERS (   ID integer primary key,    Order_Date datetime,    Customer_ID integer references CUSTOMER(ID),    Amount double); ALTER TABLE ORDERS ADD FOREIGN KEY (customer_id) REFERENCES CUSTOMER(ID);

    Stored Procedure Example

    CREATE PROCEDURE [dbo].[procedure_name]      @param1 VARCHAR(100)     ,@param2 VARCHAR(200) OUTPUT    AS    
    BEGIN       
    DECLARE @param3 VARCHAR(100)       
    SET @param3 = ' '       
    IF @param1 IS NOT NULL AND LEN(@param1) > 1            
    SELECT @param2 = 'The ' + @param1  + @param3        
    ELSE             
    SELECT  @param2 = '...is cool!'        
    RETURN        
    END    
    GO

    C# and Prepared Statements

    int  id = 20;     
    string  desc = "...." ;     
    SqlConnection rConn = new SqlConnection("Persist Security Info=False;Integrated Security=SSPI;        database=northwind;server=mySQLServer");     
    rConn.Open();     
    SqlCommand command = new SqlCommand(null, rConn);     
    
    // Create and prepare an SQL statement.     
    command.CommandText = "insert into Region (ID, Description) values (@id, @desc)" ;     
    command.Parameters.Add ( "@id", id) ;     
    command.Parameters.Add ( "@desc", desc) ;     
    command.Prepare() ;  
    
    // Calling Prepare after having set the Commandtext and parameters.     command.ExecuteNonQuery(); 
        
    // Change parameter values and call ExecuteNonQuery.     command.Parameters[0].Value = 21;     
    command.Parameters[1].Value = "mySecondRegion";     command.ExecuteNonQuery();
    conn = new SqlConnection(strConnectionString);   
    SqlCommand cmd = new SqlCommand();   
    cmd.CommandText ="insert into Profile values(@Name,@Age)";   
    cmd.Connection = conn;   
    cmd.CommandType = CommandType.Text;   
    SqlParameter nameP = new SqlParameter();   
    nameP.SqlDbType =SqlDbType.NVarChar;   
    nameP.ParameterName = "@Name";   
    nameP.Size = 50;   
    nameP.Value = model.Name;   
    SqlParameter ageP = new SqlParameter();   
    ageP.SqlDbType =SqlDbType.Int;   
    ageP.ParameterName = "@Age";   
    ageP.Value = model.Age;   
    cmd.Parameters.Add(nameP);   
    cmd.Parameters.Add(ageP);   
    conn.Open();   
    cmd.Prepare();    
    cmd.ExecuteNonQuery();

    C# and Stored Procedure

    conn = new SqlConnection("Server=(local);
    DataBase=Northwind;Integrated Security=SSPI");       
    conn.Open();  
         
    SqlCommand cmd  = new SqlCommand("sp_name", conn);       
    cmd.CommandType = CommandType.StoredProcedure;       
    cmd.Parameters.Add(new SqlParameter("@CustomerID", custId));     
      
    // execute the command       
    rdr = cmd.ExecuteReader();     
      
    // iterate through results, printing each to console       
    while (rdr.Read())       
    {          
    Console.WriteLine("" + rdr["Total"] );       
    }

    From: http://sitestree.com/?p=5300
    Categories:19
    Tags:
    Post Data:2007-02-11 12:57:35

        Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
        (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
        In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
        <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
        8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
        Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
        Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>