Skip to content

Commit 6e6ced9

Browse files
committed
version number to 1.3.3
updated documentation jCryption.Mvc file moved to Filters folder
1 parent 69d1622 commit 6e6ced9

File tree

6 files changed

+102
-73
lines changed

6 files changed

+102
-73
lines changed

App_Code/jCryption.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
/*
2-
* jCryption.NET v 1.3.2
2+
* jCryption.NET v 1.3.3
33
* is a server side implementation for jCryption v3.0 and ASP.NET
44
* written by Jake.Y.Yoshimura
5+
* https://github.com/JakeJP/jCryption.NET
6+
*
57
* MIT license.
68
* http://www.opensource.org/licenses/mit-license.php
79
*

App_Code/jCryption.Mvc.cs Filters/jCryption.Mvc.cs

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
using System;
1+
/*
2+
* jCryption.NET v 1.3.3
3+
* additional compornent for MVC
4+
* https://github.com/JakeJP/jCryption.NET
5+
* MIT license.
6+
* http://www.opensource.org/licenses/mit-license.php
7+
*
8+
* jCryption client side library is originally created by Daniel Griesser:
9+
* http://www.jcryption.org/
10+
*
11+
*/
12+
using System;
213
using System.Web.Mvc;
314
namespace jCryption
415
{

README.md

+84-47
Original file line numberDiff line numberDiff line change
@@ -15,40 +15,12 @@ What's notable of this ASP.NET server side library:
1515
- Respecting original jCryption protocol (OpenSSL PEM style format and negotiation)
1616
- OpenSSL independent ( using .NET native RSA/AES crypto library )
1717
- RSA keys are automatically generated on server side (no need of PEM file preparation)
18-
- Integration with ASPX and CSHTML (WebPages) Request.Form is automatically replaced with decrypted content.
18+
- Integration with ASPX, WebPages(cshtml) and MVC. Request.Form is automatically replaced with decrypted content.
1919
- Silently deactivates under HTTPS secure connection ( with cshtml helper methods )
2020
- load initial form data through encryption ( with CSHTML helper )
2121
- load encrypted HTML content rendering support (1.2)
2222
- Compatibility with jquery.validate
2323

24-
25-
Version
26-
----
27-
####1.3.2 update
28-
- updated jcryption.3.1.0.mod.js and exsmples
29-
30-
####1.3.2
31-
- fix RenderScriptFor src, script parameter handling
32-
33-
####1.3.1
34-
- fix for Unvalidated Form problem
35-
- add script parameter for RenderScript
36-
37-
####1.3
38-
- Refactor of CSHTML helper functions
39-
40-
####1.2
41-
- Encrypted HTML content rendering support (CSHTML)
42-
43-
####1.1
44-
- jCryption version 3.1.0
45-
- secure form data loading ( on CSHTML )
46-
47-
####1.0.1
48-
- now works with jquery.validate
49-
50-
####1.0
51-
5224
Suggestions for original jCryption
5325
---
5426
- AESKey may be only one per page over multiple forms on the same page, since server-side holds only one key in the session state ( with the implementation of PHP ).
@@ -57,25 +29,33 @@ Suggestions for original jCryption
5729
- Handle form's submit event (not click). 'click' event occurs before form validation for example.
5830
- if AES key is attached to encrypted form post with 'jCryption'? This makes form post 'session' independent and allows form re-post by pressing F5.
5931

32+
jquery.jcryption.x.x.x.mod.js is the modified version which solves the problems above. mod version is also needed to work with MVC properly.
33+
6034
Dependency
6135
---
6236
- jQuery ( on which jCryption depends ) http://jquery.com/
6337
- jCryption 3.0.1 or later http://www.jcryption.org/
6438
- ASP.NET 4.0 or later
65-
- ( ASP.NET WebPages 2.0 or later )
39+
- ASP.NET WebPages 2.0 or later (option)
40+
- ASP.NET MVC 4 or later (option)
6641

6742
Installation
6843
---
69-
70-
- App_Code/jCryption.cs
71-
- Scripts/jquery.jcryption.3.1.0.js
44+
ASP.NET or ASP.NET WebPages
45+
- App_Code/jCryption.cs (ASP.NET and WebPages)
46+
- Scripts/jquery.jcryption.3.1.0.js ( or mod version )
47+
48+
ASP.NET MVC 4 or later
49+
- Filters/jCryption.cs [compile]
50+
- Filters/jCryption.Mvc.cs [compile]
51+
- Scripts/jquery.jcryption.3.1.0.mod.js
7252

7353

7454
Integration Examples
7555
---
7656

7757

78-
###ASPX
58+
##ASPX
7959
Make ASPX page inherit jCryption.SecurePage. SecurePage handles the negotiations with jCryption client javascript library. Javascript initialization should be placed so that 'getKeysURL' and 'handshakeURL' can access the Page.
8060

8161
```aspx
@@ -95,9 +75,37 @@ Make ASPX page inherit jCryption.SecurePage. SecurePage handles the negotiations
9575
</head>
9676
......
9777
78+
```
79+
##ASP.NET MVC
80+
Place both `jCryption.cs` and `jCryption.Mvc.cs` to be compiled in the project. They can be placed in any folder. Handshake and decryption are processed through jCryptionHandlerAttribute.
81+
82+
- Decorate action methods that are potentially responsible to handle jCryption handshake and decryption with `[jCryptionHandler]` . The following example shows 2 Login methods must have `[jCryptionHandler]` attribute.
83+
84+
```cs
85+
// GET: /Account/Login
86+
[AllowAnonymous]
87+
[jCryptionHandler]
88+
public ActionResult Login(string returnUrl)
89+
{ . . . }
90+
91+
// POST: /Account/Login
92+
[HttpPost]
93+
[AllowAnonymous]
94+
[jCryptionHandler]
95+
[ValidateAntiForgeryToken(Order=0)] // to make sure this action comes after jCryptionHandler
96+
public ActionResult Login(LoginModel model, string returnUrl)
97+
{ ... }
98+
```
99+
100+
- Include client side script in the form page.
101+
```cs
102+
@jCryption.RenderScriptFor("form",src:"/Scripts/jquery.jcryption.3.1.0.mod.js")
98103
```
99104

100-
###CSHTML
105+
*mod version (jquery.jcryption.3.1.0.mod.js) is recommended to use with MVC, for some difficulties of SessionSate at simultaneous requests.*
106+
107+
108+
###ASP.NET WebPages (cshtml)
101109
1. declare namespace access to 'jCryption' on the top of page.```@using jCryption```
102110
2. call ```jCryption.HandleRequest(Request)``` on the top of page to handle all background negotiations.
103111
3. include all depending scripts ( jQuery )
@@ -119,19 +127,17 @@ Make ASPX page inherit jCryption.SecurePage. SecurePage handles the negotiations
119127
<html>
120128
<head>
121129
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
122-
@jCryption.RenderScriptFor("#normal", src: "Scripts/jquery.jcryption.3.1.0.js")
130+
@jCryption.RenderScriptFor("#form", src: "/Scripts/jquery.jcryption.3.1.0.js")
123131
</head>
124132
......
125-
<form id="normal">
133+
<form id="form">
126134
.....
127135
</form>
128136
......
129137

130138
```
131139

132-
133-
134-
###CSHTML page with secure initial form data loading
140+
###Secure initial form data loading with cshtml page
135141
jCryption provides a way to encrypt client to server data transfer but it does not protect form values that are initially rendered by server in a HTML form like ```<input name='Name' value='Smith' />```
136142

137143
This library provides some more methods to protect server to client transfered form data.
@@ -140,22 +146,53 @@ This library provides some more methods to protect server to client transfered f
140146

141147
is used to decorate name and value attributes in ```<input>```.
142148

143-
```<input type='text' @jCryption.SecureNameValue("Name", "Smith") />```
149+
```html
150+
<input type='text' @jCryption.SecureNameValue("Name", "Smith") />
151+
```
144152

145153
####@jCryption.SecureNameValueCheck( String name, String value, bool check )
146154
is used for checkbox and radio type input element.
147155

156+
```html
157+
<input type='checkbox' @jCryption.SecureNameValueCheck("Animal", "Dog", true ) />
158+
<input type='checkbox' @jCryption.SecureNameValueCheck("Animal", "Cat", false ) />
148159
```
149-
<input type='checkbox' @jCryption.SecureNameValueCheck("Animal", "Dog", true ) />
150-
<input type='checkbox' @jCryption.SecureNameValueCheck("Animal", "Cat", false ) />
151-
```
152-
153-
####@jCryption.RenderLoadFormData() [deleted]
154160

161+
####[email protected]() [deleted]~~
155162
####@jCryption.LoadSecureContents()
156-
must be placed after all SecureNameValue* funtion calls.
163+
must be placed after all **SecureNameValue** function calls.
157164
This renders a javascript block with encrypted form values, which are to be decrypted through server-client negotiation. Form elements are filled in javascript calls.
158165

166+
Version
167+
----
168+
#####1.3.3
169+
- added MVC support
170+
171+
#####1.3.2 update
172+
- updated jcryption.3.1.0.mod.js and examples
173+
174+
#####1.3.2
175+
- fix RenderScriptFor src, script parameter handling
176+
177+
#####1.3.1
178+
- fix for Unvalidated Form problem
179+
- add script parameter for RenderScript
180+
181+
#####1.3
182+
- Refactor of CSHTML helper functions
183+
184+
#####1.2
185+
- Encrypted HTML content rendering support (CSHTML)
186+
187+
#####1.1
188+
- jCryption version 3.1.0
189+
- secure form data loading ( on CSHTML )
190+
191+
#####1.0.1
192+
- now works with jquery.validate
193+
194+
#####1.0
195+
159196
License
160197
----
161198
Same as original jCryption,

Scripts/jquery.jcryption.3.1.0.mod.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* If you need any further information about this plugin please
1010
* visit my homepage or contact me under [email protected]
1111
*
12-
* .mod. version with some tweaks added by [email protected]
12+
* .mod. version has some tweaks added by [email protected]
1313
* - allows form re-posting by pressing F5 or browser refresh ( posting AES key together with form data )
1414
* - share AES key amoung multiple forms on the same page
1515
* - handles form's submit event ( not click event ) by default

Web.config

+2-16
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,9 @@
44
<add key="webPages:Version" value="2.0"/>
55
</appSettings>
66
<system.web>
7-
<compilation debug="true" targetFramework="4.0">
8-
<assemblies>
9-
<add assembly="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
10-
<add assembly="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
11-
<add assembly="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
12-
<add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
13-
<add assembly="System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
14-
<add assembly="System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
15-
</assemblies>
16-
</compilation>
7+
<compilation debug="true" targetFramework="4.0"/>
178
</system.web>
189
<runtime>
19-
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
20-
<dependentAssembly>
21-
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
22-
<bindingRedirect oldVersion="4.0.0.0-4.0.0.1" newVersion="4.0.0.1"/>
23-
</dependentAssembly>
24-
</assemblyBinding>
10+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"/>
2511
</runtime>
2612
</configuration>

packages.config

-7
This file was deleted.

0 commit comments

Comments
 (0)