diff --git a/ChangeLog.txt b/ChangeLog.txt index d53d4705..df203b07 100755 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,9 +1,20 @@ ChangeLog for jsrsasign -* Changes between 5.0.4 to next release +* Changes between 5.0.4 to 5.0.5 - node sample 'jwssign', 'jwtverify', 'asn1dump' and 'pemtobin' added. + - base64x 1.1.5 to 1.1.6 + - license URL small fix + - asn1 1.0.8 to 1.0.9 + - DERGeneralizedTime withMillis fix + - DERGeneralizedTime and DERUTCTime refactoring + - jws 3.3.2 to 3.3.3 + - JWS.parse method added + - IntDate.getZulu UTCTime(YY) support added + - jsrsasign-x.x.x-all-min.js move to lib directory from this version + - jsrsasign-{1.2,1.2.1,1.3,1.3.1,2.0.0}.tgz are removed + since they can get from github release/tags. * Changes between 5.0.2 to 5.0.4 (2015-Nov-23) - jwtverify, asn1dump and pemtobin sample Node script in diff --git a/api/files.html b/api/files.html index 28406312..06a6f2ab 100644 --- a/api/files.html +++ b/api/files.html @@ -421,7 +421,7 @@
KJUR.jws.IntDate.getZulu("20151012125959Z") => 1478...+
KJUR.jws.IntDate.getZulu("20151012125959Z") => 1478... +KJUR.jws.IntDate.getZulu("151012125959Z") => 1478...diff --git a/api/symbols/KJUR.jws.JWS.html b/api/symbols/KJUR.jws.JWS.html index 3501b4d8..1cd310ef 100644 --- a/api/symbols/KJUR.jws.JWS.html +++ b/api/symbols/KJUR.jws.JWS.html @@ -548,6 +548,16 @@
KJUR.jws.JWS.parse(sJWS) -> +{ + headerObj: {"alg": "RS256", "typ": "JWS"}, + payloadObj: {"product": "orange", "quantity": 100}, + headerPP: + '{ + "alg": "RS256", + "typ": "JWS" + }', + payloadPP: + '{ + "product": "orange", + "quantity": 100 + }', + sigHex: "91f3cd..." +}+ + + + +
1 /*! asn1-1.0.8.js (c) 2013-2015 Kenji Urushima | kjur.github.com/jsrsasign/license +1 /*! asn1-1.0.9.js (c) 2013-2015 Kenji Urushima | kjur.github.com/jsrsasign/license 2 */ 3 /* 4 * asn1.js - ASN.1 DER encoder classes @@ -23,7 +23,7 @@ 16 * @fileOverview 17 * @name asn1-1.0.js 18 * @author Kenji Urushima kenji.urushima@gmail.com - 19 * @version asn1 1.0.8 (2015-Sep-13) + 19 * @version asn1 1.0.9 (2015-Nov-26) 20 * @since jsrsasign 2.1 21 * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a> 22 */ @@ -1327,15 +1327,15 @@ 1320 return this.hV; 1321 }; 1322 -1323 if (typeof params != "undefined") { -1324 if (typeof params['str'] != "undefined") { -1325 this.setString(params['str']); +1323 if (params !== undefined) { +1324 if (params.str !== undefined) { +1325 this.setString(params.str); 1326 } else if (typeof params == "string" && params.match(/^[0-9]{12}Z$/)) { 1327 this.setString(params); -1328 } else if (typeof params['hex'] != "undefined") { -1329 this.setStringHex(params['hex']); -1330 } else if (typeof params['date'] != "undefined") { -1331 this.setByDate(params['date']); +1328 } else if (params.hex !== undefined) { +1329 this.setStringHex(params.hex); +1330 } else if (params.date !== undefined) { +1331 this.setByDate(params.date); 1332 } 1333 } 1334 }; @@ -1388,7 +1388,7 @@ 1381 }; 1382 1383 this.getFreshValueHex = function() { -1384 if (typeof this.date == "undefined" && typeof this.s == "undefined") { +1384 if (this.date === undefined && this.s === undefined) { 1385 this.date = new Date(); 1386 this.s = this.formatDate(this.date, 'gen', this.withMillis); 1387 this.hV = stohex(this.s); @@ -1396,165 +1396,166 @@ 1389 return this.hV; 1390 }; 1391 -1392 if (typeof params != "undefined") { -1393 if (typeof params['str'] != "undefined") { -1394 this.setString(params['str']); +1392 if (params !== undefined) { +1393 if (params.str !== undefined) { +1394 this.setString(params.str); 1395 } else if (typeof params == "string" && params.match(/^[0-9]{14}Z$/)) { 1396 this.setString(params); -1397 } else if (typeof params['hex'] != "undefined") { -1398 this.setStringHex(params['hex']); -1399 } else if (typeof params['date'] != "undefined") { -1400 this.setByDate(params['date']); -1401 } else if (params.millis === true) { -1402 this.withMillis = true; -1403 } -1404 } -1405 }; -1406 YAHOO.lang.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime); -1407 -1408 // ******************************************************************** -1409 /** -1410 * class for ASN.1 DER Sequence -1411 * @name KJUR.asn1.DERSequence -1412 * @class class for ASN.1 DER Sequence -1413 * @extends KJUR.asn1.DERAbstractStructured -1414 * @description -1415 * <br/> -1416 * As for argument 'params' for constructor, you can specify one of -1417 * following properties: -1418 * <ul> -1419 * <li>array - specify array of ASN1Object to set elements of content</li> -1420 * </ul> -1421 * NOTE: 'params' can be omitted. -1422 */ -1423 KJUR.asn1.DERSequence = function(params) { -1424 KJUR.asn1.DERSequence.superclass.constructor.call(this, params); -1425 this.hT = "30"; -1426 this.getFreshValueHex = function() { -1427 var h = ''; -1428 for (var i = 0; i < this.asn1Array.length; i++) { -1429 var asn1Obj = this.asn1Array[i]; -1430 h += asn1Obj.getEncodedHex(); -1431 } -1432 this.hV = h; -1433 return this.hV; -1434 }; -1435 }; -1436 YAHOO.lang.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured); -1437 -1438 // ******************************************************************** -1439 /** -1440 * class for ASN.1 DER Set -1441 * @name KJUR.asn1.DERSet -1442 * @class class for ASN.1 DER Set -1443 * @extends KJUR.asn1.DERAbstractStructured -1444 * @description -1445 * <br/> -1446 * As for argument 'params' for constructor, you can specify one of -1447 * following properties: -1448 * <ul> -1449 * <li>array - specify array of ASN1Object to set elements of content</li> -1450 * <li>sortflag - flag for sort (default: true). ASN.1 BER is not sorted in 'SET OF'.</li> -1451 * </ul> -1452 * NOTE1: 'params' can be omitted.<br/> -1453 * NOTE2: sortflag is supported since 1.0.5. -1454 */ -1455 KJUR.asn1.DERSet = function(params) { -1456 KJUR.asn1.DERSet.superclass.constructor.call(this, params); -1457 this.hT = "31"; -1458 this.sortFlag = true; // item shall be sorted only in ASN.1 DER -1459 this.getFreshValueHex = function() { -1460 var a = new Array(); -1461 for (var i = 0; i < this.asn1Array.length; i++) { -1462 var asn1Obj = this.asn1Array[i]; -1463 a.push(asn1Obj.getEncodedHex()); -1464 } -1465 if (this.sortFlag == true) a.sort(); -1466 this.hV = a.join(''); -1467 return this.hV; -1468 }; -1469 -1470 if (typeof params != "undefined") { -1471 if (typeof params.sortflag != "undefined" && -1472 params.sortflag == false) -1473 this.sortFlag = false; -1474 } -1475 }; -1476 YAHOO.lang.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured); -1477 -1478 // ******************************************************************** -1479 /** -1480 * class for ASN.1 DER TaggedObject -1481 * @name KJUR.asn1.DERTaggedObject -1482 * @class class for ASN.1 DER TaggedObject -1483 * @extends KJUR.asn1.ASN1Object -1484 * @description -1485 * <br/> -1486 * Parameter 'tagNoNex' is ASN.1 tag(T) value for this object. -1487 * For example, if you find '[1]' tag in a ASN.1 dump, -1488 * 'tagNoHex' will be 'a1'. -1489 * <br/> -1490 * As for optional argument 'params' for constructor, you can specify *ANY* of -1491 * following properties: -1492 * <ul> -1493 * <li>explicit - specify true if this is explicit tag otherwise false -1494 * (default is 'true').</li> -1495 * <li>tag - specify tag (default is 'a0' which means [0])</li> -1496 * <li>obj - specify ASN1Object which is tagged</li> -1497 * </ul> -1498 * @example -1499 * d1 = new KJUR.asn1.DERUTF8String({'str':'a'}); -1500 * d2 = new KJUR.asn1.DERTaggedObject({'obj': d1}); -1501 * hex = d2.getEncodedHex(); -1502 */ -1503 KJUR.asn1.DERTaggedObject = function(params) { -1504 KJUR.asn1.DERTaggedObject.superclass.constructor.call(this); -1505 this.hT = "a0"; -1506 this.hV = ''; -1507 this.isExplicit = true; -1508 this.asn1Object = null; -1509 -1510 /** -1511 * set value by an ASN1Object -1512 * @name setString -1513 * @memberOf KJUR.asn1.DERTaggedObject -1514 * @function -1515 * @param {Boolean} isExplicitFlag flag for explicit/implicit tag -1516 * @param {Integer} tagNoHex hexadecimal string of ASN.1 tag -1517 * @param {ASN1Object} asn1Object ASN.1 to encapsulate -1518 */ -1519 this.setASN1Object = function(isExplicitFlag, tagNoHex, asn1Object) { -1520 this.hT = tagNoHex; -1521 this.isExplicit = isExplicitFlag; -1522 this.asn1Object = asn1Object; -1523 if (this.isExplicit) { -1524 this.hV = this.asn1Object.getEncodedHex(); -1525 this.hTLV = null; -1526 this.isModified = true; -1527 } else { -1528 this.hV = null; -1529 this.hTLV = asn1Object.getEncodedHex(); -1530 this.hTLV = this.hTLV.replace(/^../, tagNoHex); -1531 this.isModified = false; -1532 } -1533 }; -1534 -1535 this.getFreshValueHex = function() { -1536 return this.hV; -1537 }; -1538 -1539 if (typeof params != "undefined") { -1540 if (typeof params['tag'] != "undefined") { -1541 this.hT = params['tag']; -1542 } -1543 if (typeof params['explicit'] != "undefined") { -1544 this.isExplicit = params['explicit']; -1545 } -1546 if (typeof params['obj'] != "undefined") { -1547 this.asn1Object = params['obj']; -1548 this.setASN1Object(this.isExplicit, this.hT, this.asn1Object); -1549 } -1550 } -1551 }; -1552 YAHOO.lang.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object); -1553