Skip to content

Commit

Permalink
7.1.4 release
Browse files Browse the repository at this point in the history
  • Loading branch information
kjur committed May 6, 2017
1 parent 0cc41f6 commit 9fac9df
Show file tree
Hide file tree
Showing 120 changed files with 734 additions and 633 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kjur-jsrsasign",
"version": "7.1.3",
"version": "7.1.4",
"main": "jsrsasign-all-min.js",
"description": "The 'jsrsasign' (RSA-Sign JavaScript Library) is an opensource free cryptography library supporting RSA/RSAPSS/ECDSA/DSA signing/validation, ASN.1, PKCS#1/5/8 private/public key, X.509 certificate, CRL, OCSP, CMS SignedData, TimeStamp, CAdES, JWS and JWT in pure JavaScript.",
"license": "MIT",
Expand Down
132 changes: 132 additions & 0 deletions jsrsasign-jwths-min.js

Large diffs are not rendered by default.

120 changes: 120 additions & 0 deletions jsrsasign-rsa-min.js

Large diffs are not rendered by default.

83 changes: 9 additions & 74 deletions npm/lib/jsrsasign.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion npm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jsrsasign",
"version": "7.1.3",
"version": "7.1.4",
"description": "opensource free pure JavaScript cryptographic library supports RSA/RSAPSS/ECDSA/DSA signing/validation, ASN.1, PKCS#1/5/8 private/public key, X.509 certificate, CRL, OCSP, CMS SignedData, TimeStamp and CAdES and JSON Web Signature(JWS)/Token(JWT)/Key(JWK).",
"main": "lib/jsrsasign.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion sample-ecdsa.html → sample/sample-ecdsa.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<link rel="stylesheet" type="text/css" media="screen" href="stylesheets/stylesheet.css">
<title>ECDSA sample</title>
<script language="JavaScript" type="text/javascript" src="jsrsasign-latest-all-min.js"></script>
<script language="JavaScript" type="text/javascript" src="../jsrsasign-all-min.js"></script>
<script language="JavaScript" type="text/javascript">
function doGenerate() {
var f1 = document.form1;
Expand Down
2 changes: 1 addition & 1 deletion sample-rsasign.html → sample/sample-rsasign.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<head>
<title>Sample Application for RSA signing in JavaScript</title>
<script language="JavaScript" type="text/javascript" src="jsrsasign-latest-all-min.js"></script>
<script language="JavaScript" type="text/javascript" src="../jsrsasign-all-min.js"></script>
<script language="JavaScript" type="text/javascript">
function doSign() {
var rsa = new RSAKey();
Expand Down
26 changes: 10 additions & 16 deletions sample_jwsgenerate.html → sample/sample_jwsgenerate.html
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
<html>
<head>
<title>Sample JWS Signing Application</title>
<script language="JavaScript" type="text/javascript" src="http://kjur.github.io/jsrsasign/jsrsasign-latest-all-min.js"></script>
<script language="JavaScript" type="text/javascript" src="ext/json-sans-eval-min.js"></script>
<script language="JavaScript" type="text/javascript" src="jws-3.2.js"></script>
<script language="JavaScript" type="text/javascript" src="../jsrsasign-all-min.js"></script>

<style type="text/css">
TD {vertical-align: top; border: solid 1px #000000; }
</style>
<script language="JavaScript" type="text/javascript">
function _genJWS() {
var sHead = newline_toDos(document.form1.jwshead1.value);
var head = KJUR.jws.JWS.readSafeJSONString(sHead);
var sPayload = newline_toDos(document.form1.jwspayload1.value);
var hN = document.form1.pubkey1_n.value;
var hE = document.form1.pubkey1_e.value;
var hD = document.form1.pubkey1_d.value;

var jws = new KJUR.jws.JWS();
var sResult = null;
var prv;
try {
sResult = jws.generateJWSByNED(sHead, sPayload, hN, hE, hD);
if (hN.match(/^[8-9,a-f]/)) hN = "00" + hN;
prv = KEYUTIL.getKey({n: hN, e: hE, d: hD});
sResult = KJUR.jws.JWS.sign(head.alg, sHead, sPayload, prv);
document.form1.jwsgenerated1.value = sResult;
} catch (ex) {
alert("Error: " + ex);
}
}

function _checkIfSame() {
var jws = new new KJUR.jws.JWS();
var jws1 = new KJUR.jws.JWS();
var sJWS = document.form1.jwsgenerated1.value;
var sExpectedEncodedSignatureValue = document.form1.jwsexpectedencsig1.value;
var sEncodedSignatureValueOfJWS = null;

try {
sEncodedSignatureValueOfJWS = jws.getEncodedSignatureValueFromJWS(sJWS);
var a = sJWS.split(/\./);
sEncodedSignatureValueOfJWS = a[2];
} catch (ex) {
alert("Error: " + ex);
return;
Expand Down Expand Up @@ -106,20 +108,12 @@ <h3>USAGE</h3>
</ol>

<center>
Copyright &copy; 2012-2015 Kenji Urushima, All Rights Reserved.
Copyright &copy; 2012-2016 Kenji Urushima, All Rights Reserved.
</center>

<div align="right">
<a href="index.html">Go back to index</a>
</div>

<div align="right">
<a href="http://twitter.com/kjur/" target="_blank" alt="kjur on twitter">
<img src="http://www9.atwiki.jp/kurushima/pub/icon/icon_twitter.gif" border="0" width="20"/>
</a>
<a href="http://x5.choumusubi.com/bin/gg?069823300">
<img src="http://x5.choumusubi.com/bin/ll?069823300" border="0" width="20"/>
</a>
</div>
</body>
</html>
21 changes: 7 additions & 14 deletions sample_jwsgenerate2.html → sample/sample_jwsgenerate2.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
<html>
<head>
<title>Sample JWS Signing With PKCS#1 private key</title>
<script language="JavaScript" type="text/javascript" src="http://kjur.github.io/jsrsasign/jsrsasign-latest-all-min.js"></script>
<script language="JavaScript" type="text/javascript" src="ext/json-sans-eval-min.js"></script>
<script language="JavaScript" type="text/javascript" src="jws-3.2.js"></script>
<script language="JavaScript" type="text/javascript" src="../jsrsasign-all-min.js"></script>

<style type="text/css">
TD {vertical-align: top; border: solid 1px #000000; }
</style>
<script language="JavaScript" type="text/javascript">
function _genJWS() {
var sHead = newline_toDos(document.form1.jwshead1.value);
var head = KJUR.jws.JWS.readSafeJSONString(sHead);
var sPayload = newline_toDos(document.form1.jwspayload1.value);
var sPemPrvKey = document.form1.pemprvkey1.value;

var jws = new KJUR.jws.JWS();
var sResult = null;
try {
sResult = jws.generateJWSByP1PrvKey(sHead, sPayload, sPemPrvKey);
prv = KEYUTIL.getKey(sPemPrvKey);

sResult = KJUR.jws.JWS.sign(head.alg, sHead, sPayload, prv);
document.form1.jwsgenerated1.value = sResult;
} catch (ex) {
alert("Error: " + ex);
Expand Down Expand Up @@ -45,7 +46,7 @@ <h1>Sample JWS Signing Application</h1>
"http://example.com/is_root":true}</textarea>
</td></tr>
<tr><td>Signing PKCS#1 RSA Private Key</td><td colspan="2">
<textarea name="pemprvkey1" rows="10" cols="65">-----BEGIN RSA PRIVATE KEY-----
<textarea name="pemprvkey1" rows="10" cols="80">-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEA4qiw8PWs7PpnnC2BUEoDRcwXF8pq8XT1/3Hc3cuUJwX/otNe
fr/Bomr3dtM0ERLN3DrepCXvuzEU5FcJVDUB3sI+pFtjjLBXD/zJmuL3Afg91J9p
79+Dm+43cR6wuKywVJx5DJIdswF6oQDDzhwu89d2V5x02aXB9LqdXkPwiO0eR5s/
Expand Down Expand Up @@ -93,20 +94,12 @@ <h3>USAGE</h3>
</ol>

<center>
Copyright &copy; 2012-2015 Kenji Urushima, All Rights Reserved.
Copyright &copy; 2012-2016 Kenji Urushima, All Rights Reserved.
</center>

<div align="right">
<a href="index.html">Go back to index</a>
</div>

<div align="right">
<a href="http://twitter.com/kjur/" target="_blank" alt="kjur on twitter">
<img src="http://www9.atwiki.jp/kurushima/pub/icon/icon_twitter.gif" border="0" width="20"/>
</a>
<a href="http://x5.choumusubi.com/bin/gg?069823300">
<img src="http://x5.choumusubi.com/bin/ll?069823300" border="0" width="20"/>
</a>
</div>
</body>
</html>
34 changes: 6 additions & 28 deletions sample_jwsgenerate3.html → sample/sample_jwsgenerate3.html
Original file line number Diff line number Diff line change
@@ -1,38 +1,24 @@
<html>
<head>
<title>Sample JWS Signing With PKCS#1 private key</title>
<script language="JavaScript" type="text/javascript" src="http://kjur.github.io/jsrsasign/jsrsasign-latest-all-min.js"></script>
<script language="JavaScript" type="text/javascript" src="ext/json-sans-eval-min.js"></script>
<script language="JavaScript" type="text/javascript" src="jws-3.2.js"></script>
<script language="JavaScript" type="text/javascript" src="../jsrsasign-all-min.js"></script>

<style type="text/css">
TD {vertical-align: top; border: solid 1px #000000; }
</style>
<script language="JavaScript" type="text/javascript">

function SecureRandom() { }

SecureRandom.prototype.nextBytes = function(ba) {
var ua = new Uint8Array(ba.length), i;

window.crypto.getRandomValues(ua);

for (i = 0; i < ba.length; i += 1) {
ba[i] = ua[i];
}
};

function _genJWS() {
var sHead = newline_toDos(document.form1.jwshead1.value);
var head = KJUR.jws.JWS.readSafeJSONString(sHead);
var sPayload = newline_toDos(document.form1.jwspayload1.value);
var sPemPrvKey = document.form1.pemprvkey1.value;

var jws = new KJUR.jws.JWS();
var sResult = null;
try {
var key = new RSAKey();
key.readPrivateKeyFromPEMString(sPemPrvKey);
sResult = jws.generateJWSByKey(sHead, sPayload, key);
var prv = KEYUTIL.getKey(sPemPrvKey);
sResult = KJUR.jws.JWS.sign(head.alg, sHead, sPayload, prv);
document.form1.jwsgenerated1.value = sResult;
} catch (ex) {
alert("Error: " + ex);
Expand Down Expand Up @@ -60,7 +46,7 @@ <h1>Sample JWS Signing Application</h1>
"http://example.com/is_root":true}</textarea>
</td></tr>
<tr><td>Signing PKCS#1 RSA Private Key</td><td colspan="2">
<textarea name="pemprvkey1" rows="10" cols="65">-----BEGIN RSA PRIVATE KEY-----
<textarea name="pemprvkey1" rows="10" cols="80">-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEA4qiw8PWs7PpnnC2BUEoDRcwXF8pq8XT1/3Hc3cuUJwX/otNe
fr/Bomr3dtM0ERLN3DrepCXvuzEU5FcJVDUB3sI+pFtjjLBXD/zJmuL3Afg91J9p
79+Dm+43cR6wuKywVJx5DJIdswF6oQDDzhwu89d2V5x02aXB9LqdXkPwiO0eR5s/
Expand Down Expand Up @@ -108,20 +94,12 @@ <h3>USAGE</h3>
</ol>

<center>
Copyright &copy; 2013-2015 Kenji Urushima, Dave All Rights Reserved.
Copyright &copy; 2013-2016 Kenji Urushima, Dave All Rights Reserved.
</center>

<div align="right">
<a href="index.html">Go back to index</a>
</div>

<div align="right">
<a href="http://twitter.com/kjur/" target="_blank" alt="kjur on twitter">
<img src="http://www9.atwiki.jp/kurushima/pub/icon/icon_twitter.gif" border="0" width="20"/>
</a>
<a href="http://x5.choumusubi.com/bin/gg?069823300">
<img src="http://x5.choumusubi.com/bin/ll?069823300" border="0" width="20"/>
</a>
</div>
</body>
</html>
23 changes: 7 additions & 16 deletions sample_jwsjsgen1.html → sample/sample_jwsjsgen1.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<html>
<head>
<title>Sample JWS-JS Generator</title>
<script language="JavaScript" type="text/javascript" src="http://kjur.github.io/jsrsasign/jsrsasign-latest-all-min.js"></script>
<script language="JavaScript" type="text/javascript" src="ext/json-sans-eval-min.js"></script>
<script language="JavaScript" type="text/javascript" src="jws-3.2.js"></script>
<script language="JavaScript" type="text/javascript" src="jwsjs-2.0.js"></script>
<script language="JavaScript" type="text/javascript" src="../jsrsasign-all-min.js"></script>

<style type="text/css">
TD {vertical-align: top; border: solid 1px #000000; }
</style>
Expand All @@ -21,9 +19,10 @@
var sPrvKey = document.form1.pemprvkey1.value;

if (jwsjs.isEmpty()) {
jwsjs.addSignatureByHeaderPayloadKey(sHeader, sPayload, sPrvKey);
var jws1 = KJUR.jws.JWS.sign(null, sHeader, sPayload, sPrvKey);
jwsjs.initWithJWS(jws1);
} else {
jwsjs.addSignatureByHeaderKey(sHeader, sPrvKey);
jwsjs.addSignature(null, sHeader, sPrvKey);
}
document.form1.jwsjs1.value = newline_toDos(JSON.stringify(jwsjs.getJSON(), null, 2));
}
Expand Down Expand Up @@ -57,7 +56,7 @@ <h3>(STEP1) specify fields for each one of JWS-JS parallel signature</h3>
</p>

<b><i>signing private key</i></b><br/>
<textarea name="pemprvkey1" rows="10" cols="65">-----BEGIN RSA PRIVATE KEY-----
<textarea name="pemprvkey1" rows="10" cols="80">-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEA4qiw8PWs7PpnnC2BUEoDRcwXF8pq8XT1/3Hc3cuUJwX/otNe
fr/Bomr3dtM0ERLN3DrepCXvuzEU5FcJVDUB3sI+pFtjjLBXD/zJmuL3Afg91J9p
79+Dm+43cR6wuKywVJx5DJIdswF6oQDDzhwu89d2V5x02aXB9LqdXkPwiO0eR5s/
Expand Down Expand Up @@ -104,20 +103,12 @@ <h2>Result of JWS-JS parallsl signature</h2>
</form>

<center>
Copyright &copy; 2012-2015 Kenji Urushima, All Rights Reserved.
Copyright &copy; 2012-2016 Kenji Urushima, All Rights Reserved.
</center>

<div align="right">
<a href="index.html">Go back to index</a>
</div>

<div align="right">
<a href="http://twitter.com/kjur/" target="_blank" alt="kjur on twitter">
<img src="http://www9.atwiki.jp/kurushima/pub/icon/icon_twitter.gif" border="0" width="20"/>
</a>
<a href="http://x5.choumusubi.com/bin/gg?069823300">
<img src="http://x5.choumusubi.com/bin/ll?069823300" border="0" width="20"/>
</a>
</div>
</body>
</html>
21 changes: 5 additions & 16 deletions sample_jwsjsgen2.html → sample/sample_jwsjsgen2.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<html>
<head>
<title>Sample JWS-JS generator with existing JWS</title>
<script language="JavaScript" type="text/javascript" src="http://kjur.github.io/jsrsasign/jsrsasign-latest-all-min.js"></script>
<script language="JavaScript" type="text/javascript" src="ext/json-sans-eval-min.js"></script>
<script language="JavaScript" type="text/javascript" src="jws-3.2.js"></script>
<script language="JavaScript" type="text/javascript" src="jwsjs-2.0.js"></script>
<script language="JavaScript" type="text/javascript" src="../jsrsasign-all-min.js"></script>

<style type="text/css">
TD {vertical-align: top; border: solid 1px #000000; }
Expand All @@ -17,18 +14,18 @@

jwsjs = new KJUR.jws.JWSJS();
jwsjs.initWithJWS(sJWS);
alert(JSON.stringify(jwsjs.getJSON(), null, 2));
document.form1.jwsjs1.value = newline_toDos(JSON.stringify(jwsjs.getJSON(), null, 2));
}

function addSignature() {
if (jwsjs == null) {
if (jwsjs == null || jwsjs.isEmpty()) {
alert("Please read first signature");
return;
}
var sHeader = newline_toDos(document.form1.jwshead1.value);
var sPrvKey = document.form1.pemprvkey1.value;

jwsjs.addSignatureByHeaderKey(sHeader, sPrvKey);
jwsjs.addSignature(null, sHeader, sPrvKey);
document.form1.jwsjs1.value = newline_toDos(JSON.stringify(jwsjs.getJSON(), null, 2));
}
</script>
Expand Down Expand Up @@ -94,20 +91,12 @@ <h2>Result of JWS-JS</h2>
</form>

<center>
Copyright &copy; 2012-2015 Kenji Urushima, All Rights Reserved.
Copyright &copy; 2012-2016 Kenji Urushima, All Rights Reserved.
</center>

<div align="right">
<a href="index.html">Go back to index</a>
</div>

<div align="right">
<a href="http://twitter.com/kjur/" target="_blank" alt="kjur on twitter">
<img src="http://www9.atwiki.jp/kurushima/pub/icon/icon_twitter.gif" border="0" width="20"/>
</a>
<a href="http://x5.choumusubi.com/bin/gg?069823300">
<img src="http://x5.choumusubi.com/bin/ll?069823300" border="0" width="20"/>
</a>
</div>
</body>
</html>
Loading

0 comments on commit 9fac9df

Please sign in to comment.