Produced by Araxis Merge on 5/23/2019 1:16:28 PM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | PATS_R_SourceCode.zip\MVI Search\FlagsSerialization | Program.cs | Wed Apr 17 16:59:08 2019 UTC |
2 | PATS_R_SourceCode.zip\MVI Search\FlagsSerialization | Program.cs | Thu May 23 00:48:08 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 132 |
Changed | 1 | 2 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | using Syst em; | |
2 | using Syst em.Collect ions.Gener ic; | |
3 | using Syst em.Linq; | |
4 | using Syst em.Text; | |
5 | using Syst em.Threadi ng.Tasks; | |
6 | using VEIS .Plugins; | |
7 | using CRMW ebParts.Co mmon.Secur ity; | |
8 | using CRMW ebParts.Co mmon.Secur ity.Author ization; | |
9 | using Syst em.Securit y.Cryptogr aphy; | |
10 | using Newt onsoft.Jso n; | |
11 | ||
12 | namespace FlagsSeria lization | |
13 | { | |
14 | class Program | |
15 | { | |
16 | st atic void Main(strin g[] args) | |
17 | { | |
18 | ||
19 | string r eq = "{\"N ationalId\ " : \"1008 702098\"}" ; | |
20 | Security TokenGener ator secur ityTokenGe nerator = new Securi tyTokenGen erator(); | |
21 | string c lientName = "FTPCRM" ; // Serv iceTicketC lientName | |
22 | string c lientIdent ityKey = " 88a8b9358a abb0fe38f" ; // Ser viceTicket ClientIden tityKey | |
23 | string use rName = " PII "; // domain nam e of user | |
24 | int minu tesToLive = 10; // ServiceTi cketClient MinutesToL ive | |
25 | string e ncryptionS alt = "D8C BB17EF5A90 F44"; // ServiceTic ketClientE ncryptionS alt | |
26 | string c lientEncry ptionKey = "3ED6B4F0 546D233DF0 A2F3EDFAF6 3DDE04C9B0 2FF4DC578A 649559847F 7D15F3"; //Servic eTicketCli entEncrypt ionKey | |
27 | string t okenHelper = securit yTokenGene rator.Gene rateToken( clientName , clientId entityKey, userName, minutesTo Live, | |
28 | encr yptionSalt , clientEn cryptionKe y, req); | |
29 | Console. WriteLine( "tokenHelp er: {0}", tokenHelpe r); | |
30 | ||
31 | string t okenNewton soft = Gen erateToken (clientNam e, clientI dentityKey , userName , minutesT oLive, | |
32 | encr yptionSalt , clientEn cryptionKe y, req); | |
33 | Console. WriteLine( "tokenNewt onsoft: {0 }", tokenN ewtonsoft) ; | |
34 | if(token Newtonsoft != tokenH elper) | |
35 | { | |
36 | Cons ole.WriteL ine("token mismatch" ); | |
37 | } | |
38 | Console. WriteLine( "done...") ; | |
39 | Console. ReadKey(); | |
40 | } | |
41 | ||
42 | pr ivate stat ic string GenerateTo ken(string clientNam e, string clientIden tityKey, s tring user Id, int mi nutesToLiv e, string encryption Salt, stri ng clientK ey, string data) | |
43 | { | |
44 | Token to ken = new Token() | |
45 | { | |
46 | Appl icationNam e = client Name, | |
47 | Clie ntAppKey = clientIde ntityKey, | |
48 | Requ estDateTim e = DateTi me.Now.Add Minutes((d ouble)minu tesToLive) , | |
49 | User Id = userI d, | |
50 | Data = data | |
51 | }; | |
52 | byte[] b ytes = Enc oding.ASCI I.GetBytes (encryptio nSalt); | |
53 | byte[] n umArray = Encoding.A SCII.GetBy tes(client Key); | |
54 | byte[] b ytes1 = (n ew Rfc2898 DeriveByte s(numArray , bytes, 2 )).GetByte s(32); | |
55 | string s erializedT oken = Jso nConvert.S erializeOb ject(token ); | |
56 | SimpleAE S simpleAE = new Sim pleAES(); | |
57 | simpleAE .InitEncry ptionKey(b ytes1); | |
58 | string e ncryptedTo ken = simp leAE.Encry pt(seriali zedToken); | |
59 | string e ncodedToke nInTransit = JsonCon vert.Seria lizeObject (new Webpa rtsTokenIn Transit() | |
60 | { | |
61 | Appl icationNam e = client Name, | |
62 | Toke n = encryp tedToken | |
63 | }); | |
64 | return C onvert.ToB ase64Strin g(Encoding .UTF8.GetB ytes(encod edTokenInT ransit)); | |
65 | } | |
66 | } | |
67 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.