1.Cryptography is a Concept of data encryptions and decryptions.
byte[]X=new byte[] 0x23,0x21,0x90……} There 16 Values must be in the range of 0x100 to 0x99 0 work with cryptography, .NET introduced ripple des crypto service provider class, which is the part of system. Security. Crypto graphy name space.
A Program to store encrypted data in a text file and reading that data by decryption Open WFAP Place two buttons as shown Using system. Security. cryptography; Using system.I0;//When ever we need to write in a text file this name space is required. Code in GD[Before button1] Code in GD[Before button1] Triple Descript to service proricler t = new triple descript to service provider (); Byte[]x= new byte[]{0x76,0x16,0x12,0x13,0x15, 0x18,…..0x20};16 different values Code for button1-click[encrypt] { Ale stream +s=new file stream(“c://test.text”, file hode.create); Crypto stream cs=mew crypto stream(fs, f. create encryptor (x,x),crypto stream hode. white); String S =”WELCOME”; Byte[] b = encoding. ASCII. Get bytes(s); Conrer byte: in stream and store into char
Fs. Close(); Message box. show(“Data in encrypted”); } Code for button2 –click File stream fs = new File stream (“c://test.txt”, File hode open); crypto stream cs = new crypto stream (fs, t. create Decryptor (X,X) crypto stream Mode. Read) Byte[]b= new Byte[100]; Int i=cs. Read (b, o, b. Length); Name start String S= Encoding. ASCII. Get String(b, o, i); Cs. close(); Cs. close(); Message box. show(s); } OBS: same Byte array must be used for encryption and decryption. WORKING WITH ROLE BASED SECURITY:- Role based security is the concept of using os level security at.NET Application level Role based security is also called as windows Authentication or principle security. Generally o/s supports 3 types of roles(privilage)
My computersRt clickmanagers or member of Rt click on users àabc Users xyzrajrani Under one line Administrator may be placed with any number of names. To work with ROLEBASED SECURITY,.NET introduced system. Security. Principle name space. Windows identify I,e predefined class, which is used to find the logged in user name Windows Principle is a predefined class, which is used to find the ROLE of logged in user.
Open WFAD with name ROLES (form1) Add a new form with form name(form2) And back color =green Add one more form with name form3 and with back color = red. Place a button in form Using system. Security. Principle; Code for button1-click { Windows Identify w= Windows Identify. Get(current) Message box. show(w name); Windows. Principal = new Windows. Principal(w); If(p.IS IN ROLW (Windows Built in role. Administrator==true) { Message box. show(“Admini”); Form2 f = new form2();
}
You liked the article?
Like : 0
Vote for difficulty
Current difficulty (Avg): Medium
1/15
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.
Stay Updated
Get stories of change makers and innovators from the startup ecosystem in your inbox