").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cd=a.document.documentElement;function dd(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dd(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cd;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cd})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dd(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=Lb(k.pixelPosition,function(a,c){return c?(c=Jb(a,b),Hb.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ed=a.jQuery,fd=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fd),b&&a.jQuery===m&&(a.jQuery=ed),m},typeof b===K&&(a.jQuery=a.$=m),m});
\ No newline at end of file
diff --git a/CustomFileInputs/CustomFileInputs/js/jquery.custom-file-input.js b/CustomFileInputs/CustomFileInputs/js/jquery.custom-file-input.js
deleted file mode 100755
index 546016c..0000000
--- a/CustomFileInputs/CustomFileInputs/js/jquery.custom-file-input.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- By Osvaldas Valutis, www.osvaldas.info
- Available for use under the MIT License
-*/
-
-'use strict';
-
-;( function( $, window, document, undefined )
-{
- $( '.inputfile' ).each( function()
- {
- var $input = $( this ),
- $label = $input.next( 'label' ),
- labelVal = $label.html();
-
- $input.on( 'change', function( e )
- {
- var fileName = '';
-
- if( this.files && this.files.length > 1 )
- fileName = ( this.getAttribute( 'data-multiple-caption' ) || '' ).replace( '{count}', this.files.length );
- else if( e.target.value )
- fileName = e.target.value.split( '\\' ).pop();
-
- if( fileName )
- $label.find( 'span' ).html( fileName );
- else
- $label.html( labelVal );
- });
-
- // Firefox bug fix
- $input
- .on( 'focus', function(){ $input.addClass( 'has-focus' ); })
- .on( 'blur', function(){ $input.removeClass( 'has-focus' ); });
- });
-})( jQuery, window, document );
\ No newline at end of file
diff --git a/CustomFileInputs/__MACOSX/._CustomFileInputs b/CustomFileInputs/__MACOSX/._CustomFileInputs
deleted file mode 100644
index 7a696be..0000000
Binary files a/CustomFileInputs/__MACOSX/._CustomFileInputs and /dev/null differ
diff --git a/CustomFileInputs/__MACOSX/CustomFileInputs/._.DS_Store b/CustomFileInputs/__MACOSX/CustomFileInputs/._.DS_Store
deleted file mode 100644
index 0f685ec..0000000
Binary files a/CustomFileInputs/__MACOSX/CustomFileInputs/._.DS_Store and /dev/null differ
diff --git a/CustomFileInputs/__MACOSX/CustomFileInputs/._README.md b/CustomFileInputs/__MACOSX/CustomFileInputs/._README.md
deleted file mode 100644
index 7a696be..0000000
Binary files a/CustomFileInputs/__MACOSX/CustomFileInputs/._README.md and /dev/null differ
diff --git a/CustomFileInputs/__MACOSX/CustomFileInputs/._css b/CustomFileInputs/__MACOSX/CustomFileInputs/._css
deleted file mode 100644
index 7a696be..0000000
Binary files a/CustomFileInputs/__MACOSX/CustomFileInputs/._css and /dev/null differ
diff --git a/CustomFileInputs/__MACOSX/CustomFileInputs/._favicon.ico b/CustomFileInputs/__MACOSX/CustomFileInputs/._favicon.ico
deleted file mode 100644
index 7a696be..0000000
Binary files a/CustomFileInputs/__MACOSX/CustomFileInputs/._favicon.ico and /dev/null differ
diff --git a/CustomFileInputs/__MACOSX/CustomFileInputs/._fonts b/CustomFileInputs/__MACOSX/CustomFileInputs/._fonts
deleted file mode 100644
index 7a696be..0000000
Binary files a/CustomFileInputs/__MACOSX/CustomFileInputs/._fonts and /dev/null differ
diff --git a/CustomFileInputs/__MACOSX/CustomFileInputs/._index.html b/CustomFileInputs/__MACOSX/CustomFileInputs/._index.html
deleted file mode 100644
index 98cbae1..0000000
Binary files a/CustomFileInputs/__MACOSX/CustomFileInputs/._index.html and /dev/null differ
diff --git a/CustomFileInputs/__MACOSX/CustomFileInputs/._js b/CustomFileInputs/__MACOSX/CustomFileInputs/._js
deleted file mode 100644
index 7a696be..0000000
Binary files a/CustomFileInputs/__MACOSX/CustomFileInputs/._js and /dev/null differ
diff --git a/CustomFileInputs/__MACOSX/CustomFileInputs/css/._component.css b/CustomFileInputs/__MACOSX/CustomFileInputs/css/._component.css
deleted file mode 100644
index 3e8b1c3..0000000
Binary files a/CustomFileInputs/__MACOSX/CustomFileInputs/css/._component.css and /dev/null differ
diff --git a/CustomFileInputs/__MACOSX/CustomFileInputs/css/._demo.css b/CustomFileInputs/__MACOSX/CustomFileInputs/css/._demo.css
deleted file mode 100644
index 7a696be..0000000
Binary files a/CustomFileInputs/__MACOSX/CustomFileInputs/css/._demo.css and /dev/null differ
diff --git a/CustomFileInputs/__MACOSX/CustomFileInputs/css/._normalize.css b/CustomFileInputs/__MACOSX/CustomFileInputs/css/._normalize.css
deleted file mode 100644
index 7a696be..0000000
Binary files a/CustomFileInputs/__MACOSX/CustomFileInputs/css/._normalize.css and /dev/null differ
diff --git a/CustomFileInputs/__MACOSX/CustomFileInputs/fonts/._.DS_Store b/CustomFileInputs/__MACOSX/CustomFileInputs/fonts/._.DS_Store
deleted file mode 100644
index 09fa6bd..0000000
Binary files a/CustomFileInputs/__MACOSX/CustomFileInputs/fonts/._.DS_Store and /dev/null differ
diff --git a/CustomFileInputs/__MACOSX/CustomFileInputs/fonts/._codropsicons b/CustomFileInputs/__MACOSX/CustomFileInputs/fonts/._codropsicons
deleted file mode 100644
index 7a696be..0000000
Binary files a/CustomFileInputs/__MACOSX/CustomFileInputs/fonts/._codropsicons and /dev/null differ
diff --git a/CustomFileInputs/__MACOSX/CustomFileInputs/fonts/codropsicons/._codropsicons.eot b/CustomFileInputs/__MACOSX/CustomFileInputs/fonts/codropsicons/._codropsicons.eot
deleted file mode 100644
index 7a696be..0000000
Binary files a/CustomFileInputs/__MACOSX/CustomFileInputs/fonts/codropsicons/._codropsicons.eot and /dev/null differ
diff --git a/CustomFileInputs/__MACOSX/CustomFileInputs/fonts/codropsicons/._codropsicons.svg b/CustomFileInputs/__MACOSX/CustomFileInputs/fonts/codropsicons/._codropsicons.svg
deleted file mode 100644
index 7a696be..0000000
Binary files a/CustomFileInputs/__MACOSX/CustomFileInputs/fonts/codropsicons/._codropsicons.svg and /dev/null differ
diff --git a/CustomFileInputs/__MACOSX/CustomFileInputs/fonts/codropsicons/._codropsicons.ttf b/CustomFileInputs/__MACOSX/CustomFileInputs/fonts/codropsicons/._codropsicons.ttf
deleted file mode 100644
index 7a696be..0000000
Binary files a/CustomFileInputs/__MACOSX/CustomFileInputs/fonts/codropsicons/._codropsicons.ttf and /dev/null differ
diff --git a/CustomFileInputs/__MACOSX/CustomFileInputs/fonts/codropsicons/._codropsicons.woff b/CustomFileInputs/__MACOSX/CustomFileInputs/fonts/codropsicons/._codropsicons.woff
deleted file mode 100644
index 7a696be..0000000
Binary files a/CustomFileInputs/__MACOSX/CustomFileInputs/fonts/codropsicons/._codropsicons.woff and /dev/null differ
diff --git a/CustomFileInputs/__MACOSX/CustomFileInputs/fonts/codropsicons/._license.txt b/CustomFileInputs/__MACOSX/CustomFileInputs/fonts/codropsicons/._license.txt
deleted file mode 100644
index 7a696be..0000000
Binary files a/CustomFileInputs/__MACOSX/CustomFileInputs/fonts/codropsicons/._license.txt and /dev/null differ
diff --git a/CustomFileInputs/__MACOSX/CustomFileInputs/img/._.DS_Store b/CustomFileInputs/__MACOSX/CustomFileInputs/img/._.DS_Store
deleted file mode 100644
index 09fa6bd..0000000
Binary files a/CustomFileInputs/__MACOSX/CustomFileInputs/img/._.DS_Store and /dev/null differ
diff --git a/CustomFileInputs/__MACOSX/CustomFileInputs/js/._.DS_Store b/CustomFileInputs/__MACOSX/CustomFileInputs/js/._.DS_Store
deleted file mode 100644
index 0f685ec..0000000
Binary files a/CustomFileInputs/__MACOSX/CustomFileInputs/js/._.DS_Store and /dev/null differ
diff --git a/CustomFileInputs/__MACOSX/CustomFileInputs/js/._custom-file-input.js b/CustomFileInputs/__MACOSX/CustomFileInputs/js/._custom-file-input.js
deleted file mode 100644
index c3aab2d..0000000
Binary files a/CustomFileInputs/__MACOSX/CustomFileInputs/js/._custom-file-input.js and /dev/null differ
diff --git a/CustomFileInputs/__MACOSX/CustomFileInputs/js/._jquery-v1.min.js b/CustomFileInputs/__MACOSX/CustomFileInputs/js/._jquery-v1.min.js
deleted file mode 100644
index 61d0032..0000000
Binary files a/CustomFileInputs/__MACOSX/CustomFileInputs/js/._jquery-v1.min.js and /dev/null differ
diff --git a/CustomFileInputs/__MACOSX/CustomFileInputs/js/._jquery.custom-file-input.js b/CustomFileInputs/__MACOSX/CustomFileInputs/js/._jquery.custom-file-input.js
deleted file mode 100644
index 844037f..0000000
Binary files a/CustomFileInputs/__MACOSX/CustomFileInputs/js/._jquery.custom-file-input.js and /dev/null differ
diff --git a/web/css/bootstrap-theme.min.css b/css/bootstrap-theme.min.css
similarity index 100%
rename from web/css/bootstrap-theme.min.css
rename to css/bootstrap-theme.min.css
diff --git a/web/css/bootstrap-theme.min.css.map b/css/bootstrap-theme.min.css.map
similarity index 100%
rename from web/css/bootstrap-theme.min.css.map
rename to css/bootstrap-theme.min.css.map
diff --git a/web/css/bootstrap.min.css b/css/bootstrap.min.css
similarity index 100%
rename from web/css/bootstrap.min.css
rename to css/bootstrap.min.css
diff --git a/web/css/bootstrap.min.css.map b/css/bootstrap.min.css.map
similarity index 100%
rename from web/css/bootstrap.min.css.map
rename to css/bootstrap.min.css.map
diff --git a/web/css/materialize.css b/css/materialize.css
similarity index 100%
rename from web/css/materialize.css
rename to css/materialize.css
diff --git a/web/css/materialize.min.css b/css/materialize.min.css
similarity index 100%
rename from web/css/materialize.min.css
rename to css/materialize.min.css
diff --git a/web/css/stdb.css b/css/stdb.css
similarity index 100%
rename from web/css/stdb.css
rename to css/stdb.css
diff --git a/web/css/style.css b/css/style.css
similarity index 100%
rename from web/css/style.css
rename to css/style.css
diff --git a/web/font/material-design-icons/LICENSE.txt b/font/material-design-icons/LICENSE.txt
similarity index 100%
rename from web/font/material-design-icons/LICENSE.txt
rename to font/material-design-icons/LICENSE.txt
diff --git a/web/font/material-design-icons/Material-Design-Icons.eot b/font/material-design-icons/Material-Design-Icons.eot
similarity index 100%
rename from web/font/material-design-icons/Material-Design-Icons.eot
rename to font/material-design-icons/Material-Design-Icons.eot
diff --git a/web/font/material-design-icons/Material-Design-Icons.svg b/font/material-design-icons/Material-Design-Icons.svg
similarity index 100%
rename from web/font/material-design-icons/Material-Design-Icons.svg
rename to font/material-design-icons/Material-Design-Icons.svg
diff --git a/web/font/material-design-icons/Material-Design-Icons.ttf b/font/material-design-icons/Material-Design-Icons.ttf
similarity index 100%
rename from web/font/material-design-icons/Material-Design-Icons.ttf
rename to font/material-design-icons/Material-Design-Icons.ttf
diff --git a/web/font/material-design-icons/Material-Design-Icons.woff b/font/material-design-icons/Material-Design-Icons.woff
similarity index 100%
rename from web/font/material-design-icons/Material-Design-Icons.woff
rename to font/material-design-icons/Material-Design-Icons.woff
diff --git a/web/font/material-design-icons/Material-Design-Icons.woff2 b/font/material-design-icons/Material-Design-Icons.woff2
similarity index 100%
rename from web/font/material-design-icons/Material-Design-Icons.woff2
rename to font/material-design-icons/Material-Design-Icons.woff2
diff --git a/web/font/roboto/Roboto-Bold.eot b/font/roboto/Roboto-Bold.eot
similarity index 100%
rename from web/font/roboto/Roboto-Bold.eot
rename to font/roboto/Roboto-Bold.eot
diff --git a/web/font/roboto/Roboto-Bold.ttf b/font/roboto/Roboto-Bold.ttf
similarity index 100%
rename from web/font/roboto/Roboto-Bold.ttf
rename to font/roboto/Roboto-Bold.ttf
diff --git a/web/font/roboto/Roboto-Bold.woff b/font/roboto/Roboto-Bold.woff
similarity index 100%
rename from web/font/roboto/Roboto-Bold.woff
rename to font/roboto/Roboto-Bold.woff
diff --git a/web/font/roboto/Roboto-Bold.woff2 b/font/roboto/Roboto-Bold.woff2
similarity index 100%
rename from web/font/roboto/Roboto-Bold.woff2
rename to font/roboto/Roboto-Bold.woff2
diff --git a/web/font/roboto/Roboto-Light.eot b/font/roboto/Roboto-Light.eot
similarity index 100%
rename from web/font/roboto/Roboto-Light.eot
rename to font/roboto/Roboto-Light.eot
diff --git a/web/font/roboto/Roboto-Light.ttf b/font/roboto/Roboto-Light.ttf
similarity index 100%
rename from web/font/roboto/Roboto-Light.ttf
rename to font/roboto/Roboto-Light.ttf
diff --git a/web/font/roboto/Roboto-Light.woff b/font/roboto/Roboto-Light.woff
similarity index 100%
rename from web/font/roboto/Roboto-Light.woff
rename to font/roboto/Roboto-Light.woff
diff --git a/web/font/roboto/Roboto-Light.woff2 b/font/roboto/Roboto-Light.woff2
similarity index 100%
rename from web/font/roboto/Roboto-Light.woff2
rename to font/roboto/Roboto-Light.woff2
diff --git a/web/font/roboto/Roboto-Medium.eot b/font/roboto/Roboto-Medium.eot
similarity index 100%
rename from web/font/roboto/Roboto-Medium.eot
rename to font/roboto/Roboto-Medium.eot
diff --git a/web/font/roboto/Roboto-Medium.ttf b/font/roboto/Roboto-Medium.ttf
similarity index 100%
rename from web/font/roboto/Roboto-Medium.ttf
rename to font/roboto/Roboto-Medium.ttf
diff --git a/web/font/roboto/Roboto-Medium.woff b/font/roboto/Roboto-Medium.woff
similarity index 100%
rename from web/font/roboto/Roboto-Medium.woff
rename to font/roboto/Roboto-Medium.woff
diff --git a/web/font/roboto/Roboto-Medium.woff2 b/font/roboto/Roboto-Medium.woff2
similarity index 100%
rename from web/font/roboto/Roboto-Medium.woff2
rename to font/roboto/Roboto-Medium.woff2
diff --git a/web/font/roboto/Roboto-Regular.eot b/font/roboto/Roboto-Regular.eot
similarity index 100%
rename from web/font/roboto/Roboto-Regular.eot
rename to font/roboto/Roboto-Regular.eot
diff --git a/web/font/roboto/Roboto-Regular.ttf b/font/roboto/Roboto-Regular.ttf
similarity index 100%
rename from web/font/roboto/Roboto-Regular.ttf
rename to font/roboto/Roboto-Regular.ttf
diff --git a/web/font/roboto/Roboto-Regular.woff b/font/roboto/Roboto-Regular.woff
similarity index 100%
rename from web/font/roboto/Roboto-Regular.woff
rename to font/roboto/Roboto-Regular.woff
diff --git a/web/font/roboto/Roboto-Regular.woff2 b/font/roboto/Roboto-Regular.woff2
similarity index 100%
rename from web/font/roboto/Roboto-Regular.woff2
rename to font/roboto/Roboto-Regular.woff2
diff --git a/web/font/roboto/Roboto-Thin.eot b/font/roboto/Roboto-Thin.eot
similarity index 100%
rename from web/font/roboto/Roboto-Thin.eot
rename to font/roboto/Roboto-Thin.eot
diff --git a/web/font/roboto/Roboto-Thin.ttf b/font/roboto/Roboto-Thin.ttf
similarity index 100%
rename from web/font/roboto/Roboto-Thin.ttf
rename to font/roboto/Roboto-Thin.ttf
diff --git a/web/font/roboto/Roboto-Thin.woff b/font/roboto/Roboto-Thin.woff
similarity index 100%
rename from web/font/roboto/Roboto-Thin.woff
rename to font/roboto/Roboto-Thin.woff
diff --git a/web/font/roboto/Roboto-Thin.woff2 b/font/roboto/Roboto-Thin.woff2
similarity index 100%
rename from web/font/roboto/Roboto-Thin.woff2
rename to font/roboto/Roboto-Thin.woff2
diff --git a/web/fonts/roboto/Roboto-Bold.eot b/fonts/roboto/Roboto-Bold.eot
similarity index 100%
rename from web/fonts/roboto/Roboto-Bold.eot
rename to fonts/roboto/Roboto-Bold.eot
diff --git a/web/fonts/roboto/Roboto-Bold.ttf b/fonts/roboto/Roboto-Bold.ttf
similarity index 100%
rename from web/fonts/roboto/Roboto-Bold.ttf
rename to fonts/roboto/Roboto-Bold.ttf
diff --git a/web/fonts/roboto/Roboto-Bold.woff b/fonts/roboto/Roboto-Bold.woff
similarity index 100%
rename from web/fonts/roboto/Roboto-Bold.woff
rename to fonts/roboto/Roboto-Bold.woff
diff --git a/web/fonts/roboto/Roboto-Bold.woff2 b/fonts/roboto/Roboto-Bold.woff2
similarity index 100%
rename from web/fonts/roboto/Roboto-Bold.woff2
rename to fonts/roboto/Roboto-Bold.woff2
diff --git a/web/fonts/roboto/Roboto-Light.eot b/fonts/roboto/Roboto-Light.eot
similarity index 100%
rename from web/fonts/roboto/Roboto-Light.eot
rename to fonts/roboto/Roboto-Light.eot
diff --git a/web/fonts/roboto/Roboto-Light.ttf b/fonts/roboto/Roboto-Light.ttf
similarity index 100%
rename from web/fonts/roboto/Roboto-Light.ttf
rename to fonts/roboto/Roboto-Light.ttf
diff --git a/web/fonts/roboto/Roboto-Light.woff b/fonts/roboto/Roboto-Light.woff
similarity index 100%
rename from web/fonts/roboto/Roboto-Light.woff
rename to fonts/roboto/Roboto-Light.woff
diff --git a/web/fonts/roboto/Roboto-Light.woff2 b/fonts/roboto/Roboto-Light.woff2
similarity index 100%
rename from web/fonts/roboto/Roboto-Light.woff2
rename to fonts/roboto/Roboto-Light.woff2
diff --git a/web/fonts/roboto/Roboto-Medium.eot b/fonts/roboto/Roboto-Medium.eot
similarity index 100%
rename from web/fonts/roboto/Roboto-Medium.eot
rename to fonts/roboto/Roboto-Medium.eot
diff --git a/web/fonts/roboto/Roboto-Medium.ttf b/fonts/roboto/Roboto-Medium.ttf
similarity index 100%
rename from web/fonts/roboto/Roboto-Medium.ttf
rename to fonts/roboto/Roboto-Medium.ttf
diff --git a/web/fonts/roboto/Roboto-Medium.woff b/fonts/roboto/Roboto-Medium.woff
similarity index 100%
rename from web/fonts/roboto/Roboto-Medium.woff
rename to fonts/roboto/Roboto-Medium.woff
diff --git a/web/fonts/roboto/Roboto-Medium.woff2 b/fonts/roboto/Roboto-Medium.woff2
similarity index 100%
rename from web/fonts/roboto/Roboto-Medium.woff2
rename to fonts/roboto/Roboto-Medium.woff2
diff --git a/web/fonts/roboto/Roboto-Regular.eot b/fonts/roboto/Roboto-Regular.eot
similarity index 100%
rename from web/fonts/roboto/Roboto-Regular.eot
rename to fonts/roboto/Roboto-Regular.eot
diff --git a/web/fonts/roboto/Roboto-Regular.ttf b/fonts/roboto/Roboto-Regular.ttf
similarity index 100%
rename from web/fonts/roboto/Roboto-Regular.ttf
rename to fonts/roboto/Roboto-Regular.ttf
diff --git a/web/fonts/roboto/Roboto-Regular.woff b/fonts/roboto/Roboto-Regular.woff
similarity index 100%
rename from web/fonts/roboto/Roboto-Regular.woff
rename to fonts/roboto/Roboto-Regular.woff
diff --git a/web/fonts/roboto/Roboto-Regular.woff2 b/fonts/roboto/Roboto-Regular.woff2
similarity index 100%
rename from web/fonts/roboto/Roboto-Regular.woff2
rename to fonts/roboto/Roboto-Regular.woff2
diff --git a/web/fonts/roboto/Roboto-Thin.eot b/fonts/roboto/Roboto-Thin.eot
similarity index 100%
rename from web/fonts/roboto/Roboto-Thin.eot
rename to fonts/roboto/Roboto-Thin.eot
diff --git a/web/fonts/roboto/Roboto-Thin.ttf b/fonts/roboto/Roboto-Thin.ttf
similarity index 100%
rename from web/fonts/roboto/Roboto-Thin.ttf
rename to fonts/roboto/Roboto-Thin.ttf
diff --git a/web/fonts/roboto/Roboto-Thin.woff b/fonts/roboto/Roboto-Thin.woff
similarity index 100%
rename from web/fonts/roboto/Roboto-Thin.woff
rename to fonts/roboto/Roboto-Thin.woff
diff --git a/web/fonts/roboto/Roboto-Thin.woff2 b/fonts/roboto/Roboto-Thin.woff2
similarity index 100%
rename from web/fonts/roboto/Roboto-Thin.woff2
rename to fonts/roboto/Roboto-Thin.woff2
diff --git a/web/index.html b/index.html
similarity index 100%
rename from web/index.html
rename to index.html
diff --git a/web/js/bootstrap.js b/js/bootstrap.js
similarity index 100%
rename from web/js/bootstrap.js
rename to js/bootstrap.js
diff --git a/web/js/bootstrap.min.js b/js/bootstrap.min.js
similarity index 100%
rename from web/js/bootstrap.min.js
rename to js/bootstrap.min.js
diff --git a/web/js/jquery-3.0.0.min.js b/js/jquery-3.0.0.min.js
similarity index 100%
rename from web/js/jquery-3.0.0.min.js
rename to js/jquery-3.0.0.min.js
diff --git a/web/js/jwtDecode.min.js b/js/jwtDecode.min.js
similarity index 100%
rename from web/js/jwtDecode.min.js
rename to js/jwtDecode.min.js
diff --git a/web/js/materialize.js b/js/materialize.js
similarity index 100%
rename from web/js/materialize.js
rename to js/materialize.js
diff --git a/web/js/materialize.min.js b/js/materialize.min.js
similarity index 100%
rename from web/js/materialize.min.js
rename to js/materialize.min.js
diff --git a/web/js/npm.js b/js/npm.js
similarity index 100%
rename from web/js/npm.js
rename to js/npm.js
diff --git a/web/js/stdb.js b/js/stdb.js
similarity index 100%
rename from web/js/stdb.js
rename to js/stdb.js
diff --git a/jwt/.bower.json b/jwt/.bower.json
deleted file mode 100644
index caa4179..0000000
--- a/jwt/.bower.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "name": "kjur-jsrsasign",
- "version": "5.0.12",
- "main": "jsrsasign-latest-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 CMS SignedData, TimeStamp, CAdES, JWS and JWT in pure JavaScript.",
- "license": "MIT",
- "ignore": [
- ".jshintrc"
- ],
- "dependencies": {},
- "devDependencies": {},
- "homepage": "https://github.com/kjur/jsrsasign",
- "_release": "5.0.12",
- "_resolution": {
- "type": "version",
- "tag": "5.0.12",
- "commit": "a364c12f0e398b42eac2e7747a5d881c9155d8f8"
- },
- "_source": "https://github.com/kjur/jsrsasign.git",
- "_target": "^5.0.12",
- "_originalSource": "jsrsasign",
- "_direct": true
-}
\ No newline at end of file
diff --git a/jwt/ChangeLog.txt b/jwt/ChangeLog.txt
deleted file mode 100755
index f61f8c0..0000000
--- a/jwt/ChangeLog.txt
+++ /dev/null
@@ -1,618 +0,0 @@
-
-ChangeLog for jsrsasign
-
-* Changes between 5.0.11 to 5.0.12
- - jws between 3.3.3 to 3.3.4
- - support grace period for verifyJWT method.
- This is to allow time difference between
- JWT generator and verifier.
- - asn1hex
- - API document update
-
-* Changes between 5.0.10 to 5.0.11
- - X509v1 certificate support in KEYUTIL.getKey and
- X509.getPublicKeyInfoPropOfCertPEM
- - sample_node/showcert added
- - x509.js 1.1.8 to 1.1.9
- - X509.DN_ATTRHEX added to show EV cert DN
- - X509v1 certificate support in X509.getPublicKeyInfoPropOfCertPEM.
- This makes KEYUTIL.getKey support X509v1 certificate.
- - test/qunit-do-x509-getinfo.html
- - test case added for EV cert DN
- - tool_{jwt,jwtveri}.html
- - fix typo. Thanks @ParkinT.
- - ext/{rsa,rsa2}.js
- - allow hash func to be passed to OAEP. Thanks @davedoesdev.
- - asn1x509.js 1.0.13 to 1.0.14
- - add 'SN' (i.e. SurName) support in distinguished name.
- Thanks @kurtsson.
-
-* Changes between 5.0.9 to 5.0.10
- - sample_node/jwtverify bugfix
- - x509 1.1.7 to 1.1.8
- - following methods are added:
- - getInfo()
- - getExtSubjectKeyIdentifier()
- - getExtAuthorityKeyIdentifier()
- - getExtExtKeyUsageName()
- - getExtSubjectAltName()
- - getExtCRLDistributionPointsURI()
-
-* Changes between 5.0.8 to 5.0.9 (2016-Apr-19)
- - ext/rng.js
- - use window.crypto.getRandomValues for SecureRandom
- if available. (ToDo also for Node.js)
-
-* Changes between 5.0.7 to 5.0.8 (2016-Apr-14)
- - LICENSE.txt small update for years of copyright.
- - ext/x64-core*.js was missed and added
- - x509 1.1.6 to 1.1.7
- - X509.{getHexOfTLV_V3ExtValue,getHexOfV_V3ExtValue}
- are chageed to return null instead of '' if there
- is no extension specified by name or oid.
- - X509.getBasicConstraints added
- - X509.getSignatureAlgorithmName added
- - X509.getSignatureValueHex added
- - API document update
- - each *.min.js files are moved to min/ folder.
- - clean up old *-all-min.js
-
-* Changes between 5.0.6 to 5.0.7 (2016-Mar-05)
- - tool_csr.html fix for subject parameter.
- - jsrsasign-latest-all-min wrong order in concatination.
- This raise wrong PKCS#5/8 encrypted PEM private key
- generation in KEYUTIL.getPEM().
- - sample_node/asn1extract added
-
-* Changes between 5.0.5 to 5.0.6 (2016-Feb-28)
- - bower.json name space fix
- - crypto-1.0 1.0.4 to 1.0.5
- - file removed
- - crypto-1.1 1.1.7 to 1.1.8
- - remove unnecessary evals for strict mode.
-
-* 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
- sample_node directory.
- There is a bower release but not in npm.
-
-* Changes between 5.0.1 to 5.0.2 (2015-Nov-11)
- - jws 3.3.1 to 3.3.2
- - RFC 7638 getJWKthumbprint method added
- - base64x 1.1.5 to 1.1.6
- - function intarystrtohex added
- - nodeutil 1.0.0 newly added
- - utils for file I/O in Node.js
- - npm
- - add reference to intarystrtohex and CryptoJS
-
-* Changes between 5.0.0 to 5.0.1 (2015-Oct-17)
- - keyutil 1.0.10 to 1.0.11
- - add support for bare RSA NED hexadecimal key in KEYUTIL.getKey
-
-* Changes between 4.9.2 to 5.0.0 (2015-Oct-14)
- - *NOTICE* release 4.10.0 declined since API semver violation
- - some JWS HS* and Crypto Mac signature issue was fixed.
- - crypto 1.1.6 to 1.1.7
- - add support for various password providing method
- such as base64, base64url, hexadecimal or utf8 string
- for Mac.
- - jws 3.2.4 to 3.3.0
- - add support for various password providing method
- such as base64, base64url, hexadecimal or utf8 string
- for HS* JWS signing and validation
- - remove some old fashoned functions and methods
- which marked as "deprecated". Followings are removed:
- - JWS.generateJWSByP1PrvKey
- - JWS.generateJWSByKey
- - JWS.generateJWSByNED
- - JWS.verifyJWSByPemX509Cert
- - JWS.sign can handle header and payload
- JSON object not JSON string.
- - JWS.verify bugfix in 4.10.0 which only
- accepts hexacedimal string key for HS*.
- - keyutil 1.0.10 to 1.0.11
- - add support for RSA private key without
- P/Q/DP/DQ/COEFF of JWK
-
-* Changes between 4.9.1 to 4.9.2 (2015-Oct-02)
- - latest asn1x509 1.0.13 was missed in the latest-min.js and
- it was fixed.
-
-* Changes between 4.9.0 to 4.9.1
- - asn1x509 1.0.12 t 1.0.13
- - setByObject method added to X500Name class
- - {C: "US", O: "test"} representation now can be used
- in newCertPEM method in X509Util class.
-
-* Changes between 4.8.6 to 4.9.0
- - certificate signing request(CSR/PKCS#10) generation support
- asn1csr-1.0.js added
- - asn1 1.0.7 to 1.0.8
- - small API document update
- - base64x 1.1.4 to 1.1.5
- - function strdiffidx added
- - keyutil 1.0.9 to 1.0.10
- - fix and small program comment update
- - jws: small API document update
-
-* Changes between 4.8.5 to 4.8.6
- - npm package and bower fix
-
-* Changes between 4.8.4 to 4.8.5
- - some of small fix release for npm and jsrsasign-latest-all-min.
- - jwt 3.2.3 to 3.2.4
- - jws.js update for validation of jti confirming to RFC 7519
- as optional in verifyJWT method. Thanks @stephanbacheller.
-
-* Changes between 4.8.3 to 4.8.4
- - some of small fix release for npm.
-
-* Changes between 4.8.2 to 4.8.3
- - crypto 1.1.5 to 1.1.6
- - Signature.sign method fix in automatic detection of private key
- - asn1 1.0.6 to 1.0.7
- - ASN1Util.oidHexToInt() added
- - ASN1Util.oidIntToHex() added
- - asn1hex 1.1.5 to 1.1.6
- - ASN1HEX.dump() simple ASN.1 dump functionality added
- - ASN1HEX.isASN1HEX() added
- - tool_asn1dumper.html - Online ASN.1 dump tool added for demo
- - ** 4.8.3 updated files
- - ChangeLog.txt
- - asn1-1.0*.js
- - asn1hex-1.1*.js
- - crypto-1.1*.js
- - test/qunit-do-asn1-oidhex.html
- - test/qunit-do-asn1hex-dump.html
-
-* Changes between 4.8.1 to 4.8.2
- - keyutil 1.0.8 to 1.0.9
- - getKey EC private/public key bug #69 fix
- - node npm module officially released at npmjs.com
- - ** 4.8.2 updated files
- - ChangeLog.txt
- - keyutil-1.0*.js
-
-* Changes between 4.8.0 to 4.8.1
- - keyutil 1.0.7 to 1.0.8
- - RFC 7517 JSON Web Key(JWK) support
- for RSA/ECC private/public key added in KEYUTIL.getKey method
- - ** 4.8.1 updated files
- - ChangeLog.txt
- - ecdsa-modified-1.0*.js (jsdoc fix)
- - keyutil-1.0*.js
- - base64x-1.1.js (b64utohex zero padding added)
- - test/qunit-do-base64x.html
- - test/qunit-do-keyutil-jwk.html
- - test/qunit-do-keyutil-pairpem.html
-
-* Changes between 4.7.2 to 4.8.0 (2015-Jun-01)
- - Now jsjws JSON Web Signtaure library is merged into
- jsrsasign.
- - RFC 7519 JWT JSON Web Token full validation support.
- - jws 3.2.2 to 3.2.3
- - JWS.verifyJWT added to do full validation for JWT
- - JWS.inArray added
- - JWS.includedArray added
- - ChangeLogs for jws and jwsjs before jws 3.2.2
- please see ChangeLog_jws322.txt
- - asn1x509 1.0.11 to 1.0.12
- - subjectKeyIdentifier OID duplicate definition fix
- - JSON Web Token(JWT) full validation demo is available.
- - tool_jwt.html update to add 'aud' claim
- - ** 4.8.0 updated files
- - ChangeLog*.txt
- - jws-3.2.*
- - jwsjs-2.0.*
- - index_jws*.*
- - sample_jws*
- - tool_b64u*
- - tool_{jws,jwt}*.html
- - ext/json-sans-eval*.js
- - test/qunit-do-jws*.html
-
-* Changes between 4.7.1 to 4.7.2 (2015-May-18)
- - x509 1.1.4 to 1.1.6
- - add some X.509v3 extension parsing methods.
- following methods are added:
- - getV3ExtInfoListOfCertHex
- - getV3ExtItemInfo_AtObj
- - getHexOfTLV_V3ExtValue
- - getHexOfV_V3ExtValue
- - getPosOfTLV_V3ExtValue
- - getExtKeyUsageBin
- - getExtKeyUsageString
- - getExtAIAInfo
- - asn1x509 1.0.10 to 1.0.11
- - OID.name2oidList updated for X.509v3 extension OIDs
- - OID.name2oid method added
- - OID.oid2name method added
- - ** 4.7.2 updated files **
- - ChangeLog.txt
- - asn1x509-1.0.js
- - test/qunit-do-x509-ext.html
- - test/qunit-do-asn1x509.html
- - x509-1.1
- - test/index.html
- - tool_httpscfg.html
- - ext/yahoo-min.js
- - ext/yahoo.js
-
-* Changes between 4.7.0 to 4.7.1 (2015-May-14)
- - asn1x509 1.0.9 to 1.0.10
- - certissuer and certsubj supported in GeneralName class
- - x509 1.1.3 to 1.1.4
- - getPublicKeyInfoPosOfCertHEX added
- - tool_httpscfg.html added
-
-* Changes between 4.6.0 to 4.7.0 (2014-Jul-07)
- - RFC 5126 CAdES format supported
- - CAdES-BES/EPES/T support in this version.
- - asn1cades (NEW)
- - asn1tsp 1.0.0 to 1.0.1
- - AbstractTSAAdapter, Fixed/SimpleTSAAdapter class added
- - asn1cms 1.0.1 to 1.0.2
- - SigningCertificate and SigningCertificateV2
- attributes are added.
- - IssuerAndSerialNumber class constructor now
- supports PEM string of certificate.
- - properties dDigestAlgs and dCerts of SignedData object
- are added for object preservation.
- - CMSUtil.newSignedData now supports
- SigningCertificate/V2 attributes.
- - asn1
- - add DEREnumerate class
- - x509
- - fix for strict mode
- - crypto
- - fix for Signature.signHex/Str
-
-* Changes between 4.5.0 to 4.6.0 (2014-May-25)
- - RFC 3161 Time Stamp Protocol generator is now supported.
- - asn1tsp 1.0.0 (NEW)
- - asn1 1.0.5 to 1.0.6
- - AbstractTime/GeneralizedTime: millisecond support
- - asn1cms 1.0.0 to 1.0.1
- - IssuerAndSerialNumber: setByCertPEM method added
- - SigningCertificate attribute added
- - SigningCertificate attributeV2 added
- - asn1x509 1.0.8 to 1.0.9
- - OID.oid2name added
- - X500Name
- - add certissuer, certsubject parameter support
- - base64x 1.1.2 to 1.1.3
- - function hextob64, hextob64nl, b64nltohex added
- - tool_tsreq.html for TimeStamp Request demo (NEW)
- - tool_tsres.html for making TimeStampToken demo (NEW)
- - tool_ca.html
- - fix signing key bug
- - support ExtKeyUsage
-
-* Changes between 4.2.3 to 4.5.0 (2014-May-17)
- - RFC 5652 CMS SignedData generator is now supported.
- - asn1cms 1.0.0 (NEW)
- - asn1 1.0.4 to 1.0.5
- - unsorted DERSet is now supported for ASN.1 BER
- - DERUTCTime/GeneralizedTime provides current time
- if arguments is not specified.
- - asn1x509 1.0.8 to 1.0.9
- - x509.Time: automatic detection for UTC/Gen by length
- - OID: some oids are added.
- - keyutil 1.0.6 to 1.0.7
- - KEYUTIL.getHexFromPEM can omit sHead now.
-
-* Changes between 4.2.2 to 4.2.3 (2014-May-14) minor update
- - keyutil 1.0.6
- - isPublic and isPrivate flag fix for generateKey method.
- - tool_ca.html
- - fix keyutil.js reference
-
-* Changes between 4.2.1 to 4.2.2 (2014-Apr-19)
- - asn1x509 1.0.7 to 1.0.8
- - add setSignatureHex method for Certificate class
- - modify newCertPEM method to support to specify signature
- by value.
- - add AuthorityKeyIdentifier X.509v3 extension class
- - keyutil 1.0.4 to 1.0.5
- - PKCS#10 CSR support. Following methods are added:
- - KEYUTIL.getKeyFromCSRPEM
- - KEYUTIL.getKeyFromCSRHex
- - KEYUTIL.parseCSRHex
- - Tool:
- - tool_forfact.html:
- CSR to fake certificate converter for factorable.net
- key weakness check.
- - Test codes:
- - add test/qunit-do-keyutil-csr.html
-
-* Changes between 4.2.0 to 4.2.1 (2013-Oct-11)
- - keyutil 1.0.3 to 1.0.4
- - new getPEM method for exporting keys
- - exporting PKCS#8 encrypted private key also supported.
- - DES-CBC support for PKCS#5 encrypted private key
- - additional DSA support
- - make old methods are marked as deprecated.
-
-* Changes between 4.1.6 to 4.2.0 (2013-Oct-06)
- - DSA support added to most of classes.
- - now RSAKey/KJUR.crypto.{ECDSA,DSA} class has new properties
- isPrivate and isPublic
- - asn1x509 1.0.5 to 1.0.6
- - new X509Util.newCertPEM method is added to provate
- easy certificate issuance by JSON object.
- - DSA/ECDSA support added to Signature, TBSCertificate,
- AlgorithmIdentifier and SubjectPublicKeyInfo classes
- - keyutil 1.0.2 to 1.0.3
- - provide support for DSA
- - getKey
- - getKeyFromPublicPKCS8Hex,parsePublicPKCS8Hex
- - x509 1.1.1 to 1.1.2
- - ECDSA,DSA support added in X509.getPublicKeyFromCertPEM
- - dsa-modified 1.0.0 to 1.0.1
- - method setPrivateKey, setPublicKey are changed to
- setPrivate and setPublic respectively to align RSA/ECDSA class.
-
-* Changes between 4.1.5 to 4.1.6 (2013-Oct-02)
- - newly dsa-modified 1.0.0 added
- - This is a DSA algorithm ported from github.com/openpgpjs
- - However Signature and KEYUTIL doesn't support DSA yet.
- - asn1 1.0.3 to 1.0.4
- - ASN1Util.jsonToASN1HEX method added.
- - asn1hex 1.1.3 to 1.1.4
- - ASN1HEX.getVbyList with tag checking method added.
- - keyutil 1.0.1 to 1.0.2
- - fix typo in newEncryptedPKCS5PEM method.
-
-* Changes between 4.1.4 to 4.1.5 (2013-Sep-29)
- - keyutil 1.0.0 to 1.0.1
- - new generateKeypair method added
- - fix getKey method
- - add LICENSE file for YUI.
- - name jsrsasign-4.1.4-all-min.js is the same but updated.
-
-* Changes between 4.1.3 to 4.1.4 (2013-Sep-24)
- - ext/cryptojs-312-core-fix*.js added to fix HmacSHA224/384 issue.
- Please use
- 'http://kjur.github.io/jsrsasign/ext/cryptojs-312-core-fix.js' or
- 'http://kjur.github.io/jsrsasign/ext/cryptojs-312-core-fix-min.js' or
- 'http://kjur.github.io/jsrsasign/jsrsasign-4.1.4-all-min.js'
- instead of orignal 'core.js' of CryptoJS.
-
-* Changes between 4.1.2 to 4.1.3 (2013-Sep-23)
- - keyutil 1.0.0
- - PKCS5PKEY class is moved to KEYUTIL class.
- PKCS5PKEY is now deprecated and backward compatibility purpose only.
- - KEYUTIL.getKey() method added to private more generic access to
- private and public keys.
- - asn1 1.0.3 to 1.0.4
- - ASN1Util.newObject method now supports more simple
- representation of tagged object like:
- newObject({tag: ['a1', true, {seq: [{int: 3}, {int: 4}]}]});
- - ext/base64.js
- fix for "var v;" for strict
-
-* Changes between 4.1.1 to 4.1.2 (2013-Sep-12)
- - asn1 1.0.2 to 1.0.3
- - new method ASN1Util.newObject added.
- - all in one script 'jsrsasign-4.1.2-all-min.js' added.
-
-* Changes between 4.1.0 to 4.1.1 (2013-Aug-27)
- - crypto 1.1.3 to 1.1.4
- - add hmacmd5, hmacripemd160 support and test code
- - ecdsa-modified 1.0.2 to 1.0.3
- - new static method added
- - parseSigHex
- - parseSigHexInHexRS
- - asn1SigToConcatSig
- - concatSigToASN1Sig
- - hexRSSigToASN1Sig
- - biRSSigToASN1Sig
- - all QUnit test code is moved for latest QUnit 1.12
-
-* Changes between 4.0.5 to 4.1.0 (2013-Aug-25)
- - crypto 1.1.2 to 1.1.3
- - RSAPSS(*withRSAandMGF1) support in Signature class
- - powerful init method to specify any type of key and
- certificate and automatic initialization.
- - KJUR.crypto.OID class added for OID and hex conversion
- - pkcs5pkey 1.0.4 to 1.0.5
- - to support for KJUR.crypto.ECDSA:
- - getKeyFromEncryptedPKCS8PEM, parsePlainPrivetePKCS8Hex,
- getKeyFromPublicPKCS8PEM, getKeyFromPublicPKCS8Hex,
- parsePublicRawRSAKeyHex, parsePrivateRawRSAKeyHexAtObj,
- parsePrivateRawECKeyHexAtObj and parsePublicPKCS8Hex
- method added.
- - rsasign 1.2.5 to 1.2.7
- - RSAPSS saltlen default was changed from -2 to -1
- - add API document description about PSS salt length.
- - signWithMessageHashPSS, verifyWithMessageHashPSS
- method added.
- - ecdsa-modified 1.0.1 to 1.0.2
- - method setNamedCurve, setPrivateKeyHex, setPublicKeyHex added
- - sign/verifyWithMessageHash method added to align RSAKey class
- - x509 1.1.0 to 1.1.1
- - encapsulated as class
- - getPublicKeyInfoPropOfCertPEM method added.
- - asn1hex 1.1.1 to 1.1.2
- - encapsulated as class
-
-* Changes between 4.0.4 to 4.0.5 (2013-Aug-16)
- - crypto 1.1.1 to 1.1.2
- - KJUR.crypto.Mac (message authentication code) class added
-
-* Changes between 4.0.3 to 4.0.4 (2013-Jul-30)
- - rsasign 1.2.4 to 1.2.5
- - verifyStringPSS argument change from BigInteger object biSig
- to hexadecimal string hSig
-
-* Changes between 4.0.2 to 4.0.3 (2013-Jul-29)
- - crypto.js 1.1.0 to 1.1.1
- - Signature and MessageDigest class supports default provider.
- So no need to specify provider.
- - DEFAULTPROVIDER property
- - add Util.hashString, Util.hashHex functions
- - pkcs5pkey 1.0.3 to 1.0.4
- - add getRSAKeyFromPublicPKCS8PEM
- - add getRSAKeyFromPublicPKCS8Hex
- - rsasign 1.2.3 to 1.2.4
- - delete _RSASIGN_HASHHEXFUNC property
- - now rsasign supports any hash algorithm
- which is supported by KJUR.crypto.Util.hashString
- - add some QUnit test code
- - test/qunit-do-{pkcs5-pub, rsasign-pss}.html
-
-* Changes between 4.0.1 to 4.0.2 (2013-Jul-23)
- - RSAPSS signing and validation fix by Dave(github.com/davedoesdev)
- (base64x,crypto,rsasign)
-
-* Changes between 4.0.0 to 4.0.1
- - rsasign-1.2.js
- - small fix for PSS by Dave's contribution (github.com/davedoesdev)
- - However still having issue in PSS
- - NEW base64x-1.1.js
- - moved from github.com/kjur/jsjws
-
-* Changes between 3.1.5 and 4.0.0 (2013-Jul-18)
- - newly added ECC key and ECDSA support
- - MODIFY crypto-1.1.js - Signature class now supports ECDSA
- - NEW ecdsa-modified-1.0.js - modifed version of Bitcoin ecdsa.js
- - NEW ecparam-1.0.js - ECC curve parameters definition
- - NEW ext/ec.js - Tom Wu's EC library
- - NEW ext/ec-patch.js - patch to Tom Wu's EC library by Bitcoin
- - supported curves are secp{256r1,256k1,384r1}
-
-* Changes between 3.1.4 and 3.1.5 (2013-Jun-11)
- - move third party library to ext directory.
- - fix script URLs in sample-rsasign.html
-
-* Changes between 3.1.3 and 3.1.4 (2013-May-31)
- - asn1-1.0.js update 1.0.1 to 1.0.2
- - method ASN1Util.getPEMStringFromHex added
- - asn1x509-1.0.js update 1.0.3 to 1.0.4
- - mehtod X509Util.getPKCS8PubKeyPEMfromRSAKey added
-
-* Changes between 3.1.2 and 3.1.3 (2013-May-28)
- - crypto-1.0.js update 1.0.3 to 1.0.4
- - support "sjcl" (i.e. Stanford JavaScript Crypto Library)
- provider with sha256 in MessageDigest class
-
-* Changes between 3.1.1 and 3.1.2 (2013-May-27)
- - pkcs5pkey-1.0.js update 1.0.2 to 1.0.3
- - following method added to support loading encrypted PKCS#8 priavte key
- - getRSAKeyFromEncryptedPKCS8PEM
- - getPlainPKCS8HexFromEncryptedPKCS8PEM
- - getPBKDF2KeyHexFromParam
- - parseHexOfEncryptedPKCS8
- - getRSAKeyFromPlainPKCS8Hex
-
-* Changes between 3.1.0 and 3.1.1
- - pkcs5pkey-1.0.js update 1.0.1 to 1.0.2
- - method 'getRSAKeyFromEncryptedPKCS5PEM', 'getEryptedPKCS5PEMFromPrvKeyHex'
- 'getEryptedPKCS5PEMFromRSAKey' and 'newEncryptedPKCS5PEM'
- added to PKCS5PKEY to get encrypted PEM key.
-
-* Changes between 3.0.5 and 3.1.0
- - asn1x509-1.0.js update 1.0.2 to 1.0.3
- CRL, TBSCertList and CRLEntry class added to KJUR.asn1.x509
- to issue CRL.
-
-* Changes between 3.0.4 and 3.0.5
- - pkcs5peky-1.0 update 1.0.0 to 1.0.1
- method getRSAKeyFromPlainPKCS8PEM added to PKCS5PKEY class to load
- unencrypted PEM formatted PKCS#8 private key.
-
-* Changes between 3.0.3 and 3.0.4
- - rsasign-1.2.js update 1.2.1 to 1.2.2
- - hash algs used were changed from to MessageDigest(CryptoJS base).
- So now jsrsasign doesn't use Paul Johnston's
- hash library(http://pajhome.org.uk/crypt/md5/md5.html).
- Paul's scripts will be concluded approx. one year for know then
- their scripts and LICENSE notice will be removed then.
- - crypto-1.0.js update 1.0.2 to 1.0.3
- - add static hash functions {md5,sha1,sha256,sha512,ripemd160} to KJUR.crypto.Util
-
-* Changes between 3.0.2 and 3.0.3
- - asn1x509-1.0.js update to 1.0.1
- - ExtKeyUsage extension class added.
-
-* Changes between 3.0.1 and 3.0.2
- - crypto-1.0.js update to 1.0.2
- - Signature now supports signature verification:
- - initVerifyByPublicKey and initVerifyByCertificatePEM method
- added.
-
-* Changes between 3.0.0 and 3.0.1
- - crypto-1.0.js update to 1.0.1
- - MessageDigest class now support md5, sha224, sha256, sha384,
- sha512 and ripemd160 of 'cryptojs' provider.
- - Signature class now support {MD5,SHA224,SHA256,SHA384,
- SHA512,RIPEMD160}withRSA of 'cryptojs/jsrsa' provider.
- - Signature class constructor now supports
- 'prvkeypem' parameter to specify signing private key.
- - asn1x509-1.0.js update to 1.0.1
- - Certificate.setRsaPrvKeyByPEMandPass(pem,pass) method added and
- supports new constructor property 'rsaprvpem' and 'rsaprvpas'.
-
-* Changes between 2.0.0 and 3.0.0
- - New features:
- - crypto-1.0.js: MessageDigest and Signature class like Java JCE
- - asn1-1.0.js : ASN.1 Primitive Encoder class
- - asn1x509-1.0.js: ASN.1 class for X.509 certificate
- - merge David Halls's contribution.
- (https://github.com/davedoesdev, Thanks! Dave.)
- - rsa.js: update for PKCS#1 OAEP support
- - rsa2.js: update for PKCS#1 OAEP support
- - rsasign-1.2.js: add PSS support (1.2.1)
- - jsbn.js: small fix
- - jsbn2.js: update for probable prime fix, bnSquare
- - base64.js: small fix
- - gradually moving to CryptoJS library from other hash library
-
-* Changes between 1.3.1 and 2.0.0 [Apr 14, 2013]0
- - newly added pkcs5pkey.js and PKCS5PKEY class to support
- passcode encrypted PKCS#5 private key.
-
-* Changes between 1.3 and 1.3.1 [Apr 14, 2013]
- - rsapem.js updated to 1.1 to 1.1.1
- - method RSAKey.readPrivateKeyFromASN1HexString added.
-
-* Changes between 1.2.1 and 1.3 [May 10, 2012]
- - ASN1HEX class defined in asn1hex.js
- - update x509.js and rsapem.js for ASN1HEX class.
- - enhance ASN1HEX and X509class.
- - JavaScript API document is available.
-
-* Changes between 1.2 and 1.2.1 [May 03, 2012]
- - now minified files also provided
-
-* Changes between 1.1 and 1.2 [Apr 30, 2012]
- - fixed critial signature generation and verification bug related to
- zero padding of big integer.
- - add MD5, SHA512 and RIPEMD-160 support
- - default hash libraries were changed which was developed by
- Paul Johnston (See http://pajhome.org.uk/crypt/md5/md5.html).
- - now download site is hosted on github.
-
-* Changes between 1.0 and 1.1 [Sep 25, 2010]
- - some web contents update
-
-* 1.0 Initial Relasse [Jun 03, 2010]
-
-
-
diff --git a/jwt/ChangeLog_jws322.txt b/jwt/ChangeLog_jws322.txt
deleted file mode 100755
index 8f997a6..0000000
--- a/jwt/ChangeLog_jws322.txt
+++ /dev/null
@@ -1,104 +0,0 @@
-
-ChangeLog for jsjws
-
-* 3.2.2 Release (2015-Apr-26)
- - isSafeJSONString undefined bugfix
- - readSafeJSONString undefined bugfix
- - sample codes bugfix
-
-* 3.2.0 Release (2015-Apr-19)
- - JWS.verify method updated to mitigate signature replacement
- attacks:
- - add optional acceptAlgs argument to specify accepted
- signature algorithms to verify.
- - strict key type checking
-
-remove alg=none signature validation support.
- - jsjws will be merged into jsrsasign near in the future.
-
-* 3.1.0 Release (2015-Apr-03)
- - remove alg=none signature validation support.
- - jsjws will be merged into jsrsasign near in the future.
-
-* 3.0.2 Release (2013-Sep-24)
- - add HS384 support with jsrsasign 4.1.4 or later.
- Please use
- 'http://kjur.github.io/jsrsasign/ext/cryptojs-312-core-fix.js' or
- 'http://kjur.github.io/jsrsasign/ext/cryptojs-312-core-fix-min.js' or
- 'http://kjur.github.io/jsrsasign/jsrsasign-4.1.4-all-min.js'
- instead of orignal 'core.js' of CryptoJS.
-
-* 3.0.1 Release (2013-Aug-28)
- - jws 3.0.0 to 3.0.1
- - new KJUR.jws.IntDate class for time format of JWT
- - new online tool "tool_jwt.html" to generate and verify signed JWT
-
-* 3.0.0 Release (2013-Aug-27)
- - easy and powerful sign and verify methods available
- - now supports HS{256,512},RS{256,384,512},ES{256,384},PS{256,384,512},none
- (i.e. supports all algorithms except HS384 and ES512.)
- - other existing signing and verfying methods are deprecated.
- - now supports signing by following keys:
- - PEM plain RSA PKCS#5 private key (NEW)
- - PEM encrypted RSA PKCS#5 private key (NEW)
- - PEM plain RSA/ECC PKCS#8 private key (NEW)
- - PEM encrypted RSA/ECC PKCS#8 private key (NEW)
- - RSAKey object of private key
- - KJUR.crypto.ECDSA object of private key (NEW)
- - now supports verifying by following keys:
- - PEM RSA/ECC PKCS#8 public key (NEW)
- - PEM RSA/ECC X.509 certificate
- - RSAKey object of public key
- - KJUR.crypto.ECDSA object of public key (NEW)
-- now supports following asymmetoric key algorithms
- - RSA
- - ECDSA (NEW)
- - RSAPSS
- - QUnit unit tests added.
-
-* 2.0.2 Release (2013-Jul-30)
- - jws-2.0.js 2.0.2 to 2.0.3
- - support for rsasign 1.2.5 (verifyStringPSS arg bi to hex change)
-
-* 2.0.2 Release [Jul 29, 2013]
- - small fix for jws-2.0.js (2.0.1 -> 2.0.2)
-
-* 2.0.1 Release [Jul 23, 2013]
- - fix RSAPSS by David (github.com/davedoesdev)
- (jws-2.0.js, sample_{generate,verify}3.html)
-
-* 2.0.0 Release [Jul 21, 2013]
- - merge David Halls's contribution. (https://github.com/davedoesdev, Thanks! Dave.)
- - class implementation was chagned
- - supports PS{256,512} signature algorithm
- NOTE: however still having issue on PS{256,512} support
- - jsrsasign codes are not included from this release
-
-* 1.2.1 Release [May 7, 2013]
- - merge David Halls's contribution. (https://github.com/davedoesdev, Thanks! Dave.)
- - rsa.js: update for PKCS#1 OAEP support
- - rsa2.js: update for PKCS#1 OAEP support
- - rsasign-1.2.js: add PSS support
- - jsbn.js: small fix
- - jsbn2.js: update for probable prime fix, bnSquare
- - base64.js: small fix
- - base64x-1.1.js: small update on utf8tob64u, b64utoutf8
-
-* 1.2 Release [Mar 19, 2012]
- - 'JWSJS' class is now available for JSON Web Signature JSON Serialization
- (JWS-JS) which is a kind of parallel signature.
- - 'readSafeJSONString' method added to 'JWS' class.
- - utf8/Base64, utf8/Hex converting functions are added to 'base64x.js'.
- - New online tools for converting Base64URL added.
-
-* 1.1 Relasse [Mar 07, 2012]
- - following features are added.
- - UTF-8 string support in JWS Header and Payload
- - sign JWS with PEM formatted PKCS# RSA private key without passcode
- - verify JWS with PEM formatted X.509 certificate
-
-* 1.0.1 Relasse [Mar 06, 2012]
- - API document is added.
-
-* 1.0 Initial Relasse [Mar 04, 2012]
-
diff --git a/jwt/LICENSE.txt b/jwt/LICENSE.txt
deleted file mode 100644
index c3c3779..0000000
--- a/jwt/LICENSE.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-
-The 'jsrsasign'(RSA-Sign JavaScript Library) License
-
-Copyright (c) 2010-2016 Kenji Urushima
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/jwt/Makefile b/jwt/Makefile
deleted file mode 100644
index 9633342..0000000
--- a/jwt/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-all: join-main
-
-join-minify: *min.js ext/*min.js npm/lib/header.js npm/lib/footer.js
- cat *min.js $(shell find ext/ -name "*min.js") | sed "s/\/*! /\n\/*! /g" > jsrsasign-4.9.0-mdcone-all-min.js
- cp jsrsasign-4.9.0-mdcone-all-min.js jsrsasign-latest-all-min.js
-
-#min-js: *.js
-# for i in `ls *.js | grep -v "min.js"` ; do java -jar ~/src/yuicompressor/build/yuicompressor-2.4.8.jar $i -o `echo $i | sed 's/.js/-min.js/g'` ; done
-
-join-main: join-minify
- cat \
- npm/lib/header.js \
- jsrsasign-latest-all-min.js \
- npm/lib/footer.js \
- > npm/lib/jsrsasign.js
diff --git a/jwt/README.md b/jwt/README.md
deleted file mode 100755
index 507f930..0000000
--- a/jwt/README.md
+++ /dev/null
@@ -1,8 +0,0 @@
-jsrsasign
-=========
-
-The 'jsrsasign' is an 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, CMS SignedData, TimeStamp and CAdES and JSON Web Signature(JWS)/Token(JWT)/Key(JWK).
-
-Public page is http://kjur.github.com/jsrsasign .
-
-Your bugfix and pull request contribution are always welcomed :)
diff --git a/jwt/api/files.html b/jwt/api/files.html
deleted file mode 100644
index 14865e3..0000000
--- a/jwt/api/files.html
+++ /dev/null
@@ -1,800 +0,0 @@
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - File Index
-
-
-
-
-
-
-
-
-
-
-
-
-
File Index
-
-
-
-
-
-
-
-
- Author:
- Kenji Urushima kenji.urushima@gmail.com
-
-
- Version:
- asn1 1.0.9 (2015-Nov-26)
-
-
-
-
-
-
-
-
-
-
-
-
-
- Author:
- Kenji Urushima kenji.urushima@gmail.com
-
-
- Version:
- 1.0.0 (2014-May-28)
-
-
-
-
-
-
-
-
-
-
-
-
-
- Author:
- Kenji Urushima kenji.urushima@gmail.com
-
-
- Version:
- 1.0.2 (2014-Jun-07)
-
-
-
-
-
-
-
-
-
-
-
-
-
- Author:
- Kenji Urushima kenji.urushima@gmail.com
-
-
- Version:
- 1.0.0 (2015-Sep-12)
-
-
-
-
-
-
-
-
-
-
-
-
-
- Author:
- Kenji Urushima kenji.urushima@gmail.com
-
-
- Version:
- asn1hex 1.1.6 (2015-Jun-11)
-
-
-
-
-
-
-
-
-
-
-
-
-
- Author:
- Kenji Urushima kenji.urushima@gmail.com
-
-
- Version:
- 1.0.1 (2014-Jun-07)
-
-
-
-
-
-
-
-
-
-
-
-
-
- Author:
- Kenji Urushima kenji.urushima@gmail.com
-
-
- Version:
- 1.0.14 (2016-May-10)
-
-
-
-
-
-
-
-
-
-
-
-
-
- Author:
- Kenji Urushima kenji.urushima@gmail.com
-
-
- Version:
- asn1 1.1.6 (2015-Nov-11)
-
-
-
-
-
-
-
-
-
-
-
-
-
- Author:
- Kenji Urushima kenji.urushima@gmail.com
-
-
- Version:
- 1.1.8 (2016-Feb-28)
-
-
-
-
-
-
-
-
-
-
-
-
-
- Author:
- Recurity Labs GmbH (github.com/openpgpjs) and Kenji Urushima (kenji.urushima@gmail.com)
-
-
- Version:
- 1.0.1 (2013-Oct-06)
-
-
-
-
-
-
-
-
-
-
-
-
-
- Author:
- Stefan Thomas (github.com/justmoon) and Kenji Urushima (kenji.urushima@gmail.com)
-
-
- Version:
- 1.0.4 (2013-Oct-06)
-
-
-
-
-
-
-
-
-
-
-
-
-
- Author:
- Kenji Urushima kenji.urushima@gmail.com
-
-
- Version:
- 1.0.0 (2013-Jul-17)
-
-
-
-
-
-
-
-
-
-
-
-
-
- Author:
- Kenji Urushima kenji.urushima@gmail.com
-
-
- Version:
- 3.3.4 (2016-May-17)
-
-
-
-
-
-
-
-
-
-
-
-
-
- Author:
- Kenji Urushima kenji.urushima@gmail.com
-
-
- Version:
- 2.0.2 (2015 May 29)
-
-
-
-
-
-
-
-
-
-
-
-
-
- Author:
- Kenji Urushima kenji.urushima@gmail.com
-
-
- Version:
- keyutil 1.0.12 (2015-Oct-14)
-
-
-
-
-
-
-
-
-
-
-
-
-
- Author:
- Kenji Urushima kenji.urushima@gmail.com
-
-
- Version:
- 1.0.0 (2015-Nov-11)
-
-
-
-
-
-
-
-
-
-
-
-
-
- Author:
- Kenji Urushima kenji.urushima@gmail.com
-
-
- Version:
- pkcs5pkey 1.0.6 (2014-Apr-16)
-
-
-
-
-
-
-
-
-
-
-
-
-
- Author:
- Kenji Urushima kenji.urushima@gmail.com
-
-
- Version:
- 1.1
-
-
-
-
-
-
-
-
-
-
-
-
-
- Author:
- Kenji Urushima kenji.urushima@gmail.com
-
-
- Version:
- rsasign 1.2.7
-
-
-
-
-
-
-
-
-
-
-
-
-
- Author:
- Kenji Urushima kenji.urushima@gmail.com
-
-
- Version:
- x509 1.1.9 (2016-May-10)
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/jwt/api/index.html b/jwt/api/index.html
deleted file mode 100644
index 5ebb18e..0000000
--- a/jwt/api/index.html
+++ /dev/null
@@ -1,1068 +0,0 @@
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - Index
-
-
-
-
-
-
-
-
-
-
-
-
-
Class Index
-
-
-
-
-
-
-
- ASN.1 DER encoded hexadecimal string utility class
-
-
-
-
-
- Base64URL and supplementary functions for Tom Wu's base64.js library
-
-
-
-
-
- class for RSA/ECC/DSA key utility
-
-
-
-
-
- kjur's class library name space
-
-
-
-
-
-
-
-
- base class for ASN.1 DER encoder object
-
-
-
-
-
- ASN1 utilities class
-
-
-
-
-
-
-
-
- CAdES utilities class
-
-
-
-
-
- class for RFC 5126 CAdES CompleteCertificateRefs attribute
-
-
-
-
-
- class for OtherCertID ASN.1 object
-
-
-
-
-
- class for OtherHash ASN.1 object
-
-
-
-
-
- class for OtherHashAlgAndValue ASN.1 object
-
-
-
-
-
- class for RFC 5126 CAdES SignaturePolicyIdentifier attribute
-
-
-
-
-
- class for RFC 5126 CAdES SignatureTimeStamp attribute
-
-
-
-
-
-
-
-
- Attribute class for base of CMS attribute
-
-
-
-
-
- class for Attributes ASN.1 structure for CMS
-
-
-
-
-
- CMS utilities class
-
-
-
-
-
- class for ContentInfo ASN.1 structure for CMS
-
-
-
-
-
- class for CMS ContentType attribute
-
-
-
-
-
- class for EncapsulatedContentInfo ASN.1 structure for CMS
-
-
-
-
-
- class for CMS IssuerAndSerialNumber ASN.1 structure for CMS
-
-
-
-
-
- class for CMS MessageDigest attribute
-
-
-
-
-
- class for Attributes ASN.1 structure of CMS SigndData
-
-
-
-
-
- class for Attributes ASN.1 structure of CMS SigndData
-
-
-
-
-
- class for CMS SigningCertificate attribute
-
-
-
-
-
- class for CMS SigningCertificateV2 attribute
-
-
-
-
-
- class for CMS SigningTime attribute
-
-
-
-
-
-
-
-
- ASN.1 CertificationRequest structure class
-
-
-
-
-
- ASN.1 CertificationRequestInfo structure class
-
-
-
-
-
- Certification Request (CSR/PKCS#10) utilities class
-
-
-
-
-
- base class for ASN.1 DER string classes
-
-
-
-
-
- base class for ASN.1 DER structured class
-
-
-
-
-
- base class for ASN.1 DER Generalized/UTCTime class
-
-
-
-
-
- class for ASN.1 DER encoded BitString primitive
-
-
-
-
-
- class for ASN.1 DER Boolean
-
-
-
-
-
- class for ASN.1 DER Enumerated
-
-
-
-
-
- class for ASN.1 DER GeneralizedTime
-
-
-
-
-
- class for ASN.1 DER IA5String
-
-
-
-
-
- class for ASN.1 DER Integer
-
-
-
-
-
- class for ASN.1 DER Null
-
-
-
-
-
- class for ASN.1 DER NumericString
-
-
-
-
-
- class for ASN.1 DER ObjectIdentifier
-
-
-
-
-
- class for ASN.1 DER OctetString
-
-
-
-
-
- class for ASN.1 DER PrintableString
-
-
-
-
-
- class for ASN.1 DER Sequence
-
-
-
-
-
- class for ASN.1 DER Set
-
-
-
-
-
- class for ASN.1 DER TaggedObject
-
-
-
-
-
- class for ASN.1 DER TeletexString
-
-
-
-
-
- class for ASN.1 DER UTCTime
-
-
-
-
-
- class for ASN.1 DER UTF8String
-
-
-
-
-
-
-
-
- abstract class for TimeStampToken generator
-
-
-
-
-
- class for TSP Accuracy ASN.1 object
-
-
-
-
-
- class for fixed TimeStampToken generator
-
-
-
-
-
- class for TSP MessageImprint ASN.1 object
-
-
-
-
-
- class for TSP PKIFailureInfo ASN.1 object
-
-
-
-
-
- class for TSP PKIFreeText ASN.1 object
-
-
-
-
-
- class for TSP PKIStatus ASN.1 object
-
-
-
-
-
- class for TSP PKIStatusInfo ASN.1 object
-
-
-
-
-
- class for simple TimeStampToken generator
-
-
-
-
-
- class for TSP TimeStampReq ASN.1 object
-
-
-
-
-
- class for TSP TimeStampResp ASN.1 object
-
-
-
-
-
- TSP utilities class
-
-
-
-
-
- class for TSP TSTInfo ASN.1 object
-
-
-
-
-
-
-
-
- AlgorithmIdentifier ASN.1 structure class
-
-
-
-
-
- AttributeTypeAndValue ASN.1 structure class
-
-
-
-
-
- AuthorityKeyIdentifier ASN.1 structure class
-
-
-
-
-
- BasicConstraints ASN.1 structure class
-
-
-
-
-
- X.509 Certificate class to sign and generate hex encoded certificate
-
-
-
-
-
- X.509 CRL class to sign and generate hex encoded certificate
-
-
-
-
-
- CRLDistributionPoints ASN.1 structure class
-
-
-
-
-
- ASN.1 CRLEntry structure class for CRL
-
-
-
-
-
- DistributionPoint ASN.1 structure class
-
-
-
-
-
- DistributionPointName ASN.1 structure class
-
-
-
-
-
- base Extension ASN.1 structure class
-
-
-
-
-
- ExtKeyUsage ASN.1 structure class
-
-
-
-
-
- GeneralName ASN.1 structure class
-
-
-
-
-
- GeneralNames ASN.1 structure class
-
-
-
-
-
- KeyUsage ASN.1 structure class
-
-
-
-
-
- static object for OID
-
-
-
-
-
- RDN (Relative Distinguish Name) ASN.1 structure class
-
-
-
-
-
- SubjectPublicKeyInfo ASN.1 structure class
-
-
-
-
-
- ASN.1 TBSCertificate structure class
-
-
-
-
-
- ASN.1 TBSCertList structure class for CRL
-
-
-
-
-
- Time ASN.1 structure class
-
-
-
-
-
- X500Name ASN.1 structure class
-
-
-
-
-
- X.509 certificate and CRL utilities class
-
-
-
-
-
-
-
-
- class for DSA signing and verifcation
-
-
-
-
-
- class for EC key generation, ECDSA signing and verifcation
-
-
-
-
-
- static object for elliptic curve names and parameters
-
-
-
-
-
- Mac class which is very similar to java.security.Mac class
-
-
-
-
-
- MessageDigest class which is very similar to java.security.MessageDigest class
-
-
-
-
-
- static object for cryptography related OIDs
-
-
-
-
-
- Signature class which is very similar to java.security.Signature class
-
-
-
-
-
- static object for cryptographic function utilities
-
-
-
-
-
-
-
-
- KJUR.jws.IntDate class
-
-
-
-
-
- JSON Web Signature(JWS) class
-
-
-
-
-
- JSON Web Signature JSON Serialization (JWSJS) class
-
-
-
-
-
- class for PKCS#5 and PKCS#8 private key
-
-
-
-
-
- key of RSA public key algorithm
-
-
-
-
-
- hexadecimal X.509 certificate ASN.1 parser class
-
-
-
-
-
-
-
-
diff --git a/jwt/api/symbols/ASN1HEX.html b/jwt/api/symbols/ASN1HEX.html
deleted file mode 100644
index 99fc515..0000000
--- a/jwt/api/symbols/ASN1HEX.html
+++ /dev/null
@@ -1,1597 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - ASN1HEX
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class ASN1HEX
-
-
-
-
-
-
-
- ASN.1 DER encoded hexadecimal string utility class
-
-
- Defined in: asn1hex-1.1.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- ASN.1 DER encoded hexadecimal string utility class
-This class provides a parser for hexadecimal string of
-DER encoded ASN.1 binary data.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
- ASN1HEX.
dump (hex, associative, idx, indent)
-
- get string of simple ASN.1 dump from hexadecimal ASN.1 data
-This method will get an ASN.1 dump from
-hexadecmal string of ASN.1 DER encoded data.
-
-
-
-
- <static>
-
-
- get byte length for ASN.1 L(length) bytes
-
-
-
-
- <static>
-
-
- get hexadecimal string of ASN.1 TLV refered by current index and nth index list.
-
-
-
-
- <static>
-
-
- get hexadecimal string of ASN.1 V refered by current index and nth index list.
-
-
-
-
- <static>
-
-
- get string index of nth child object of ASN.1 object refered by h, idx
-
-
-
-
- <static>
-
-
- get hexadecimal string for ASN.1 L(length) bytes
-
-
-
-
- <static>
-
-
- get hexadecimal string of ASN.1 TLV at
-
-
-
-
- <static>
-
-
- get hexadecimal string of ASN.1 V(value)
-
-
-
-
- <static>
-
-
- get integer value of ASN.1 length for ASN.1 data
-
-
-
-
- <static>
-
-
- get string index of nth child object of ASN.1 object refered by h, idx
-
-
-
-
- <static>
-
-
- get array of indexes of child ASN.1 objects
-
-
-
-
- <static>
-
-
- get next sibling starting index for ASN.1 object string
-
-
-
-
- <static>
-
-
- get ASN.1 value starting string position for ASN.1 object refered by index 'idx'.
-
-
-
-
- <static>
-
-
- get OID string from hexadecimal encoded value
-
-
-
-
- <static>
-
-
- check wheather the string is ASN.1 hexadecimal string or not
-This method checks wheather the argument 'hex' is a hexadecimal string of
-ASN.1 data or not.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- ASN1HEX ()
-
-
-
- ASN.1 DER encoded hexadecimal string utility class
-This class provides a parser for hexadecimal string of
-DER encoded ASN.1 binary data.
-Here are major methods of this class.
-
-ACCESS BY POSITION
-
-
-ACCESS FOR CHILD ITEM
-
-
-ACCESS NESTED ASN.1 STRUCTURE
-
-
-UTILITIES
-
-
-
-
-
-
-
-
-
-
-
-
-
- Since:
- jsrsasign 1.1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
- {String}
- ASN1HEX. dump (hex, associative, idx, indent)
-
-
-
- get string of simple ASN.1 dump from hexadecimal ASN.1 data
-This method will get an ASN.1 dump from
-hexadecmal string of ASN.1 DER encoded data.
-Here are features:
-
-ommit long hexadecimal string
-dump encapsulated OCTET STRING (good for X.509v3 extensions)
-structured/primitive context specific tag support (i.e. [0], [3] ...)
-automatic decode for implicit primitive context specific tag
-(good for X.509v3 extension value)
-
- if hex starts '68747470'(i.e. http) it is decoded as utf8 encoded string.
- if it is in 'subjectAltName' extension value and is '[2]'(dNSName) tag
- value will be encoded as utf8 string
- otherwise it shows as hexadecimal string
-
-
-
-
-
-
-
-
-
-
// ASN.1 INTEGER
-ASN1HEX.dump('0203012345')
-↓
-INTEGER 012345
-
-// ASN.1 Object Identifier
-ASN1HEX.dump('06052b0e03021a')
-↓
-ObjectIdentifier sha1 (1 3 14 3 2 26)
-
-// ASN.1 SEQUENCE
-ASN1HEX.dump('3006020101020102')
-↓
-SEQUENCE
- INTEGER 01
- INTEGER 02
-
-// ASN.1 DUMP FOR X.509 CERTIFICATE
-ASN1HEX.dump(X509.pemToHex(certPEM))
-↓
-SEQUENCE
- SEQUENCE
- [0]
- INTEGER 02
- INTEGER 0c009310d206dbe337553580118ddc87
- SEQUENCE
- ObjectIdentifier SHA256withRSA (1 2 840 113549 1 1 11)
- NULL
- SEQUENCE
- SET
- SEQUENCE
- ObjectIdentifier countryName (2 5 4 6)
- PrintableString 'US'
- :
-
-
-
-
-
- Parameters:
-
-
- {String} hex
-
-
- hexadecmal string of ASN.1 data
-
-
- {Array} associative
-
-
- array of flags for dump (OPTION)
-
-
- {Number} idx
-
-
- string index for starting dump (OPTION)
-
-
- {String} indent
-
-
- string (OPTION)
-
-
-
-
-
-
- Since:
- jsrsasign 4.8.3 asn1hex 1.1.6
-
-
-
-
-
-
- Returns:
-
- {String} string of simple ASN.1 dump
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- ASN1HEX. getByteLengthOfL_AtObj (s, pos)
-
-
-
- get byte length for ASN.1 L(length) bytes
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- hexadecimal string of ASN.1 DER encoded data
-
-
- {Number} pos
-
-
- string index
-
-
-
-
-
-
-
-
- Returns:
-
- byte length for ASN.1 L(length) bytes
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Number}
- ASN1HEX. getDecendantHexTLVByNthList (h, currentIndex, nthList)
-
-
-
- get hexadecimal string of ASN.1 TLV refered by current index and nth index list.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} h
-
-
- hexadecimal string of ASN.1 DER encoded data
-
-
- {Number} currentIndex
-
-
- start string index of ASN.1 object
-
-
- {Array of Number} nthList
-
-
- array list of nth
-
-
-
-
-
-
- Since:
- 1.1
-
-
-
-
-
-
- Returns:
-
- {Number} hexadecimal string of ASN.1 TLV refered by nthList
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Number}
- ASN1HEX. getDecendantHexVByNthList (h, currentIndex, nthList)
-
-
-
- get hexadecimal string of ASN.1 V refered by current index and nth index list.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} h
-
-
- hexadecimal string of ASN.1 DER encoded data
-
-
- {Number} currentIndex
-
-
- start string index of ASN.1 object
-
-
- {Array of Number} nthList
-
-
- array list of nth
-
-
-
-
-
-
- Since:
- 1.1
-
-
-
-
-
-
- Returns:
-
- {Number} hexadecimal string of ASN.1 V refered by nthList
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Number}
- ASN1HEX. getDecendantIndexByNthList (h, currentIndex, nthList)
-
-
-
- get string index of nth child object of ASN.1 object refered by h, idx
-
-
-
-
-
-
-
The "nthList" is a index list of structured ASN.1 object
-reference. Here is a sample structure and "nthList"s which
-refers each objects.
-
-SQUENCE -
- SEQUENCE - [0]
- IA5STRING 000 - [0, 0]
- UTF8STRING 001 - [0, 1]
- SET - [1]
- IA5STRING 010 - [1, 0]
- UTF8STRING 011 - [1, 1]
-
-
-
-
-
- Parameters:
-
-
- {String} h
-
-
- hexadecimal string of ASN.1 DER encoded data
-
-
- {Number} currentIndex
-
-
- start string index of ASN.1 object
-
-
- {Array of Number} nthList
-
-
- array list of nth
-
-
-
-
-
-
- Since:
- 1.1
-
-
-
-
-
-
- Returns:
-
- {Number} string index refered by nthList
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- ASN1HEX. getHexOfL_AtObj (s, pos)
-
-
-
- get hexadecimal string for ASN.1 L(length) bytes
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- hexadecimal string of ASN.1 DER encoded data
-
-
- {Number} pos
-
-
- string index
-
-
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string for ASN.1 L(length) bytes
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- ASN1HEX. getHexOfTLV_AtObj (s, pos)
-
-
-
- get hexadecimal string of ASN.1 TLV at
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- hexadecimal string of ASN.1 DER encoded data
-
-
- {Number} pos
-
-
- string index
-
-
-
-
-
-
- Since:
- 1.1
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of ASN.1 TLV.
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- ASN1HEX. getHexOfV_AtObj (s, pos)
-
-
-
- get hexadecimal string of ASN.1 V(value)
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- hexadecimal string of ASN.1 DER encoded data
-
-
- {Number} pos
-
-
- string index
-
-
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of ASN.1 value.
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- ASN1HEX. getIntOfL_AtObj (s, pos)
-
-
-
- get integer value of ASN.1 length for ASN.1 data
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- hexadecimal string of ASN.1 DER encoded data
-
-
- {Number} pos
-
-
- string index
-
-
-
-
-
-
-
-
- Returns:
-
- ASN.1 L(length) integer value
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Number}
- ASN1HEX. getNthChildIndex_AtObj (h, idx, nth)
-
-
-
- get string index of nth child object of ASN.1 object refered by h, idx
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} h
-
-
- hexadecimal string of ASN.1 DER encoded data
-
-
- {Number} idx
-
-
- start string index of ASN.1 object
-
-
- {Number} nth
-
-
- for child
-
-
-
-
-
-
- Since:
- 1.1
-
-
-
-
-
-
- Returns:
-
- {Number} string index of nth child.
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Array of Number}
- ASN1HEX. getPosArrayOfChildren_AtObj (s, start)
-
-
-
- get array of indexes of child ASN.1 objects
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- hexadecimal string of ASN.1 DER encoded data
-
-
- {Number} start
-
-
- string index of ASN.1 object
-
-
-
-
-
-
-
-
- Returns:
-
- {Array of Number} array of indexes for childen of ASN.1 objects
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- ASN1HEX. getPosOfNextSibling_AtObj (s, pos)
-
-
-
- get next sibling starting index for ASN.1 object string
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- hexadecimal string of ASN.1 DER encoded data
-
-
- {Number} pos
-
-
- string index
-
-
-
-
-
-
-
-
- Returns:
-
- next sibling starting index for ASN.1 object string
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- ASN1HEX. getStartPosOfV_AtObj (s, pos)
-
-
-
- get ASN.1 value starting string position for ASN.1 object refered by index 'idx'.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- hexadecimal string of ASN.1 DER encoded data
-
-
- {Number} pos
-
-
- string index
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- ASN1HEX. hextooidstr (hex)
-
-
-
- get OID string from hexadecimal encoded value
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} hex
-
-
- hexadecmal string of ASN.1 DER encoded OID value
-
-
-
-
-
-
- Since:
- asn1hex 1.1.5
-
-
-
-
-
-
- Returns:
-
- {String} OID string (ex. '1.2.3.4.567')
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Boolean}
- ASN1HEX. isASN1HEX (hex)
-
-
-
- check wheather the string is ASN.1 hexadecimal string or not
-This method checks wheather the argument 'hex' is a hexadecimal string of
-ASN.1 data or not.
-
-
-
-
-
-
-
ASN1HEX.isASN1HEX('0203012345') → true // PROPER ASN.1 INTEGER
-ASN1HEX.isASN1HEX('0203012345ff') → false // TOO LONG VALUE
-ASN1HEX.isASN1HEX('02030123') → false // TOO SHORT VALUE
-ASN1HEX.isASN1HEX('fa3bcd') → false // WRONG FOR ASN.1
-
-
-
-
-
- Parameters:
-
-
- {String} hex
-
-
- string to check whether it is hexadecmal string for ASN.1 DER or not
-
-
-
-
-
-
- Since:
- jsrsasign 4.8.3 asn1hex 1.1.6
-
-
-
-
-
-
- Returns:
-
- {Boolean} true if it is hexadecimal string of ASN.1 data otherwise false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/Base64x.html b/jwt/api/symbols/Base64x.html
deleted file mode 100644
index f72e6ec..0000000
--- a/jwt/api/symbols/Base64x.html
+++ /dev/null
@@ -1,548 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - Base64x
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Base64x
-
-
-
-
- Version
- 1.1 (07 May 2012).
-
-
-
- Base64URL and supplementary functions for Tom Wu's base64.js library
-
-
- Defined in: base64x-1.1.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- Base64URL and supplementary functions for Tom Wu's base64.js library.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- Base64x ()
-
-
-
- Base64URL and supplementary functions for Tom Wu's base64.js library.
-This class is just provide information about global functions
-defined in 'base64x.js'. The 'base64x.js' script file provides
-global functions for converting following data each other.
-
-(ASCII) String
-UTF8 String including CJK, Latin and other characters
-byte array
-hexadecimal encoded String
-Full URIComponent encoded String (such like "%69%94")
-Base64 encoded String
-Base64URL encoded String
-
-All functions in 'base64x.js' are defined in
global__ and not
-in this class.
-
Author: Kenji Urushima.
-
-
-
-
-
-
-
-
-
-
-
-
- Requires:
-
- base64.js
-
-
-
-
-
- See:
-
- 'jwjws'(JWS JavaScript Library) home page http://kjur.github.com/jsjws/
-
- 'jwrsasign'(RSA Sign JavaScript Library) home page http://kjur.github.com/jsrsasign/
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KEYUTIL.html b/jwt/api/symbols/KEYUTIL.html
deleted file mode 100644
index 67e0793..0000000
--- a/jwt/api/symbols/KEYUTIL.html
+++ /dev/null
@@ -1,2957 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KEYUTIL
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KEYUTIL
-
-
-
-
-
-
-
- class for RSA/ECC/DSA key utility
-
-
- Defined in: keyutil-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Field Summary
-
-
- Field Attributes
- Field Name and Description
-
-
-
-
-
- <static>
-
-
- decrypt private key by shared key
-version string of KEYUTIL class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- This method generates a key pair of public key algorithm.
-
-
-
-
- <static>
-
-
- decrypt PEM formatted protected PKCS#5 private key with passcode
-
-
-
-
- <static>
-
-
- decrypt private key by shared key
-
-
-
-
- <static>
-
-
- (DEPRECATED) get PEM formatted encrypted PKCS#5 private key from RSAKey object of private key
-
-generate PEM formatted encrypted PKCS#5 private key by
-
RSAKey object of RSA private key and passcode.
-
-
-
-
- <static>
-
-
- get hexacedimal string of PEM format
-
-
-
-
- <static>
-
- KEYUTIL.
getKey (param, passcode, hextype)
-
-
-
-
-
-
- <static>
-
-
- the same function as OpenSSL EVP_BytsToKey to generate shared key and IV
-
-
-
-
- <static>
-
-
- get RSAKey/DSA/ECDSA public key object from hexadecimal string of PKCS#10 CSR
-
-
-
-
- <static>
-
-
- get RSAKey/DSA/ECDSA public key object from PEM formatted PKCS#10 CSR string
-
-
-
-
- <static>
-
-
- get RSAKey/ECDSA private key object from encrypted PEM PKCS#8 private key
-
-
-
-
- <static>
-
-
- get RSAKey/ECDSA private key object from HEX plain PEM PKCS#8 private key
-
-
-
-
- <static>
-
-
- get RSAKey/ECDSA private key object from PEM plain PEM PKCS#8 private key
-
-
-
-
- <static>
-
-
- (DEPRECATED) get RSAKey/DSA/ECDSA public key object from hexadecimal string of PKCS#8 public key
-
-
-
-
- <static>
-
-
- (DEPRECATED) get RSAKey/ECDSA public key object from PEM PKCS#8 public key
-
-
-
-
- <static>
-
-
- generate PBKDF2 key hexstring with specified passcode and information
-As for info, this uses following properties:
-
-info.pbkdf2Salt - hexadecimal string of PBKDF2 salt
-info.pkbdf2Iter - iteration count
-
-Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
-
-
-
-
- <static>
-
- KEYUTIL.
getPEM (keyObjOrHex, formatType, passwd, encAlg)
-
- get PEM formatted private or public key file from a RSA/ECDSA/DSA key object
-
-NOTE1:
-
-PKCS#5 encrypted private key protection algorithm supports DES-CBC,
-DES-EDE3-CBC and AES-{128,192,256}-CBC
- NOTE2:
-
-OpenSSL supports
-
-
-
-
-
- <static>
-
-
- read PEM formatted encrypted PKCS#8 private key and returns hexadecimal string of plain PKCS#8 private key
-Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
-
-
-
-
- <static>
-
-
- (DEPRECATED) read PEM formatted encrypted PKCS#5 private key and returns RSAKey object
-
-
-
-
- <static>
-
-
- (DEPRECATED) read PEM formatted encrypted PKCS#8 private key and returns RSAKey object
-Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
-
-
-
-
- <static>
-
-
- (DEPRECATED) provide hexadecimal string of unencrypted PKCS#8 private key and returns RSAKey object
-
-
-
-
- <static>
-
-
- (DEPRECATED) read PEM formatted unencrypted PKCS#8 private key and returns RSAKey object
-
-
-
-
- <static>
-
-
- (DEPRECATED) provide hexadecimal string of unencrypted PKCS#8 private key and returns RSAKey object
-
-
-
-
- <static>
-
-
- (DEPRECATED) read PEM formatted PKCS#8 public key and returns RSAKey object
-
-
-
-
- <static>
-
-
- generate RSAKey and PEM formatted encrypted PKCS#5 private key
-
-
-
-
- <static>
-
-
- parse hexadecimal string of PKCS#10 CSR (certificate signing request)
-Resulted associative array has following properties:
-
-p8pubkeyhex - hexadecimal string of subject public key in PKCS#8
-
-
-
-
-
- <static>
-
-
- generate PBKDF2 key hexstring with specified passcode and information
-The associative array which is returned by this method has following properties:
-
-info.pbkdf2Salt - hexadecimal string of PBKDF2 salt
-info.pkbdf2Iter - iteration count
-info.ciphertext - hexadecimal string of encrypted private key
-info.encryptionSchemeAlg - encryption algorithm name (currently TripleDES only)
-info.encryptionSchemeIV - initial vector for encryption algorithm
-
-Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
-
-
-
-
- <static>
-
-
- parse PEM formatted passcode protected PKCS#5 private key
-Resulted hash has following attributes.
-
-
-
-
- <static>
-
-
- parse hexadecimal string of plain PKCS#8 private key
-Resulted associative array has following properties:
-
-algoid - hexadecimal string of OID of asymmetric key algorithm
-algparam - hexadecimal string of OID of ECC curve name or null
-keyidx - string starting index of key in pkcs8PrvHex
-
-
-
-
-
- <static>
-
-
- parse hexadecimal string of ECC private key
-Following properties are added to associative array 'info'
-
-key - hexadecimal string of ECC private key
-
-
-
-
-
- <static>
-
-
- parse hexadecimal string of RSA private key
-Following properties are added to associative array 'info'
-
-n - hexadecimal string of public key
- e - hexadecimal string of public exponent
- d - hexadecimal string of private key
- p - hexadecimal string
- q - hexadecimal string
- dp - hexadecimal string
- dq - hexadecimal string
- co - hexadecimal string
-
-
-
-
-
- <static>
-
-
- parse hexadecimal string of PKCS#8 RSA/EC/DSA public key
-Resulted hash has following attributes.
-
-
-
-
- <static>
-
-
- parse hexadecimal string of plain PKCS#8 private key
-Resulted associative array has following properties:
-
-n - hexadecimal string of public key
- e - hexadecimal string of public exponent
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KEYUTIL ()
-
-
-
-
-
KEYUTIL class is an update of former
PKCS5PKEY class.
-So for now,
PKCS5PKEY is deprecated class.
-
KEYUTIL class has following features:
-
-key loading - KEYUTIL.getKey
-
-
-supports RSAKey and KJUR.crypto.{ECDSA,DSA} key object
-supports private key and public key
-supports encrypted and plain private key
-supports PKCS#1, PKCS#5 and PKCS#8 key
-supports public key in X.509 certificate
-key represented by JSON object
-
-NOTE1: Encrypted PKCS#8 only supports PBKDF2/HmacSHA1/3DES
-NOTE2: Encrypted PKCS#5 supports DES-CBC, DES-EDE3-CBC, AES-{128,192.256}-CBC
-
- exporting key - KEYUTIL.getPEM
-
-KEYUTIL.getPEM method supports following formats:
-
-supports RSA/EC/DSA keys
-PKCS#1 plain RSA/EC/DSA private key
-PKCS#5 encrypted RSA/EC/DSA private key with DES-CBC, DES-EDE3-CBC, AES-{128,192.256}-CBC
-PKCS#8 plain RSA/EC/DSA private key
-PKCS#8 encrypted RSA/EC/DSA private key with PBKDF2_HmacSHA1_3DES
-
-
- keypair generation - KEYUTIL.generateKeypair
-
-generate key pair of RSAKey or KJUR.crypto.ECDSA .
-generate private key and convert it to PKCS#5 encrypted private key.
-
-NOTE: KJUR.crypto.DSA is not yet supported.
-
-
-
-
-
-
-
// 1. loading PEM private key
-var key = KEYUTIL.getKey(pemPKCS1PrivateKey);
-var key = KEYUTIL.getKey(pemPKCS5EncryptedPrivateKey, "passcode");
-var key = KEYUTIL.getKey(pemPKC85PlainPrivateKey);
-var key = KEYUTIL.getKey(pemPKC85EncryptedPrivateKey, "passcode");
-// 2. loading PEM public key
-var key = KEYUTIL.getKey(pemPKCS8PublicKey);
-var key = KEYUTIL.getKey(pemX509Certificate);
-// 3. exporting private key
-var pem = KEYUTIL.getPEM(privateKeyObj, "PKCS1PRV");
-var pem = KEYUTIL.getPEM(privateKeyObj, "PKCS5PRV", "passcode"); // DES-EDE3-CBC by default
-var pem = KEYUTIL.getPEM(privateKeyObj, "PKCS5PRV", "passcode", "DES-CBC");
-var pem = KEYUTIL.getPEM(privateKeyObj, "PKCS8PRV");
-var pem = KEYUTIL.getPEM(privateKeyObj, "PKCS8PRV", "passcode");
-// 4. exporting public key
-var pem = KEYUTIL.getPEM(publicKeyObj);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Field Detail
-
-
-
-
<static>
-
-
- KEYUTIL. version
-
-
-
- decrypt private key by shared key
-version string of KEYUTIL class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
- {Array}
- KEYUTIL. generateKeypair (alg, keylenOrCurve)
-
-
-
- This method generates a key pair of public key algorithm.
-The result will be an associative array which has following
-parameters:
-
-prvKeyObj - RSAKey or ECDSA object of private key
-pubKeyObj - RSAKey or ECDSA object of public key
-
-NOTE1: As for RSA algoirthm, public exponent has fixed
-value '0x10001'.
-NOTE2: As for EC algorithm, supported names of curve are
-secp256r1, secp256k1 and secp384r1.
-NOTE3: DSA is not supported yet.
-
-
-
-
-
-
-
var rsaKeypair = KEYUTIL.generateKeypair("RSA", 1024);
-var ecKeypair = KEYUTIL.generateKeypair("EC", "secp256r1");
-
-
-
-
-
- Parameters:
-
-
- {String} alg
-
-
- 'RSA' or 'EC'
-
-
- {Object} keylenOrCurve
-
-
- key length for RSA or curve name for EC
-
-
-
-
-
-
- Since:
- keyutil 1.0.1
-
-
-
-
-
-
- Returns:
-
- {Array} associative array of keypair which has prvKeyObj and pubKeyObj parameters
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KEYUTIL. getDecryptedKeyHex (sEncryptedPEM, passcode)
-
-
-
- decrypt PEM formatted protected PKCS#5 private key with passcode
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} sEncryptedPEM
-
-
- PEM formatted protected passcode protected PKCS#5 private key
-
-
- {String} passcode
-
-
- passcode to decrypt private key (ex. 'password')
-
-
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of decrypted RSA priavte key
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KEYUTIL. getDecryptedKeyHexByKeyIV (encryptedKeyHex, algName, sharedKeyHex, ivHex)
-
-
-
- decrypt private key by shared key
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} encryptedKeyHex
-
-
- hexadecimal string of encrypted private key
-
-
- {String} algName
-
-
- name of symmetric key algorithm (ex. 'DES-EBE3-CBC')
-
-
- {String} sharedKeyHex
-
-
- hexadecimal string of symmetric key
-
-
- {String} ivHex
-
-
- hexadecimal string of initial vector(IV).
-
-
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of decrypted privated key
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KEYUTIL. getEncryptedPKCS5PEMFromRSAKey (pKey, passcode, alg, ivsaltHex)
-
-
-
- (DEPRECATED) get PEM formatted encrypted PKCS#5 private key from RSAKey object of private key
-
-generate PEM formatted encrypted PKCS#5 private key by
-
RSAKey object of RSA private key and passcode.
-Following argument can be omitted.
-
-alg - AES-256-CBC will be used if omitted.
-ivsaltHex - automatically generate IV and salt which length depends on algorithm
-
-
-
-
-
-
-
-
var pkey = new RSAKey();
-pkey.generate(1024, '10001'); // generate 1024bit RSA private key with public exponent 'x010001'
-var pem = KEYUTIL.getEncryptedPKCS5PEMFromRSAKey(pkey, "password");
-
-
-
-
-
- Parameters:
-
-
- {RSAKey } pKey
-
-
- RSAKey object of private key
-
-
- {String} passcode
-
-
- pass code to protect private key (ex. password)
-
-
- {String} alg
-
-
- algorithm name to protect private key (default AES-256-CBC)
-
-
- {String} ivsaltHex
-
-
- hexadecimal string of IV and salt (default generated random IV)
-
-
-
-
-
- Deprecated:
-
- From jsrsasign 4.2.1 please use KEYUTIL.getPEM#.
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.2
-
-
-
-
-
-
- Returns:
-
- {String} string of PEM formatted encrypted PKCS#5 private key
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KEYUTIL. getHexFromPEM (sPEM, sHead)
-
-
-
- get hexacedimal string of PEM format
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} sPEM
-
-
- PEM formatted string
-
-
- {String} sHead
-
-
- PEM header string without BEGIN/END
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.5
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string data of PEM contents
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Object}
- KEYUTIL. getKey (param, passcode, hextype)
-
-
-
- get private or public key object from any arguments
-This method gets private or public key object(
RSAKey ,
KJUR.crypto.DSA or
KJUR.crypto.ECDSA )
-for RSA, DSA and ECC.
-Arguments for this methods depends on a key format you specify.
-Following key representations are supported.
-
-ECC private/public key object(as is): param=KJUR.crypto.ECDSA
-DSA private/public key object(as is): param=KJUR.crypto.DSA
-RSA private/public key object(as is): param=RSAKey
-ECC private key parameters: param={d: d, curve: curveName}
-RSA private key parameters: param={n: n, e: e, d: d, p: p, q: q, dp: dp, dq: dq, co: co}
-NOTE: Each value shall be hexadecimal string of key spec.
-DSA private key parameters: param={p: p, q: q, g: g, y: y, x: x}
-NOTE: Each value shall be hexadecimal string of key spec.
-ECC public key parameters: param={xy: xy, curve: curveName}
-NOTE: ECC public key 'xy' shall be concatination of "04", x-bytes-hex and y-bytes-hex.
-DSA public key parameters: param={p: p, q: q, g: g, y: y}
-NOTE: Each value shall be hexadecimal string of key spec.
-RSA public key parameters: param={n: n, e: e}
-X.509v1/v3 PEM certificate (RSA/DSA/ECC): param=pemString
-PKCS#8 hexadecimal RSA/ECC public key: param=pemString, null, "pkcs8pub"
-PKCS#8 PEM RSA/DSA/ECC public key: param=pemString
-PKCS#5 plain hexadecimal RSA private key: param=hexString, null, "pkcs5prv"
-PKCS#5 plain PEM DSA/RSA private key: param=pemString
-PKCS#8 plain PEM RSA/ECDSA private key: param=pemString
-PKCS#5 encrypted PEM RSA/DSA private key: param=pemString, passcode
-PKCS#8 encrypted PEM RSA/ECDSA private key: param=pemString, passcode
-
-Please note following limitation on encrypted keys:
-
-Encrypted PKCS#8 only supports PBKDF2/HmacSHA1/3DES
-Encrypted PKCS#5 supports DES-CBC, DES-EDE3-CBC, AES-{128,192.256}-CBC
-JWT plain ECC private/public key
-JWT plain RSA public key
-JWT plain RSA private key with P/Q/DP/DQ/COEFF
-JWT plain RSA private key without P/Q/DP/DQ/COEFF (since jsrsasign 5.0.0)
-
-NOTE1:
RFC 7517 JSON Web Key(JWK) support for RSA/ECC private/public key from jsrsasign 4.8.1.
-NOTE2: X509v1 support is added since jsrsasign 5.0.11.
-
-
EXAMPLE
-
-
-
-
-
-
-
// 1. loading private key from PEM string
-keyObj = KEYUTIL.getKey("-----BEGIN RSA PRIVATE KEY...");
-keyObj = KEYUTIL.getKey("-----BEGIN RSA PRIVATE KEY..., "passcode");
-keyObj = KEYUTIL.getKey("-----BEGIN PRIVATE KEY...");
-keyObj = KEYUTIL.getKey("-----BEGIN PRIVATE KEY...", "passcode");
-// 2. loading public key from PEM string
-keyObj = KEYUTIL.getKey("-----BEGIN PUBLIC KEY...");
-keyObj = KEYUTIL.getKey("-----BEGIN X509 CERTIFICATE...");
-// 3. loading hexadecimal PKCS#5/PKCS#8 key
-keyObj = KEYUTIL.getKey("308205c1...", null, "pkcs8pub");
-keyObj = KEYUTIL.getKey("3082048b...", null, "pkcs5prv");
-// 4. loading JSON Web Key(JWK)
-keyObj = KEYUTIL.getKey({kty: "RSA", n: "0vx7...", e: "AQAB"});
-keyObj = KEYUTIL.getKey({kty: "EC", crv: "P-256",
- x: "MKBC...", y: "4Etl6...", d: "870Mb..."});
-// 5. bare hexadecimal key
-keyObj = KEYUTIL.getKey({n: "75ab..", e: "010001"});
-
-
-
-
-
- Parameters:
-
-
- {Object} param
-
-
- parameter to get key object. see description in detail.
-
-
- {String} passcode
-
-
- (OPTION) parameter to get key object. see description in detail.
-
-
- {String} hextype
-
-
- (OPTOIN) parameter to get key object. see description in detail.
-
-
-
-
-
-
- Since:
- keyutil 1.0.0
-
-
-
-
-
-
- Returns:
-
- {Object} RSAKey , KJUR.crypto.ECDSA or KJUR.crypto.ECDSA object
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Hash}
- KEYUTIL. getKeyAndUnusedIvByPasscodeAndIvsalt (algName, passcode, hexadecimal)
-
-
-
- the same function as OpenSSL EVP_BytsToKey to generate shared key and IV
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} algName
-
-
- name of symmetric key algorithm (ex. 'DES-EBE3-CBC')
-
-
- {String} passcode
-
-
- passcode to decrypt private key (ex. 'password')
-
-
- {String} hexadecimal
-
-
- string of IV. heading 8 bytes will be used for passcode salt
-
-
-
-
-
-
-
-
- Returns:
-
- {Hash} hash of key and unused IV (ex. {keyhex:2fe3..., ivhex:3fad..})
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Object}
- KEYUTIL. getKeyFromCSRHex (csrHex)
-
-
-
- get RSAKey/DSA/ECDSA public key object from hexadecimal string of PKCS#10 CSR
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} csrHex
-
-
- hexadecimal string of PKCS#10 CSR
-
-
-
-
-
-
- Since:
- keyutil 1.0.5
-
-
-
-
-
-
- Returns:
-
- {Object} RSAKey/DSA/ECDSA public key object
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Object}
- KEYUTIL. getKeyFromCSRPEM (csrPEM)
-
-
-
- get RSAKey/DSA/ECDSA public key object from PEM formatted PKCS#10 CSR string
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} csrPEM
-
-
- PEM formatted PKCS#10 CSR string
-
-
-
-
-
-
- Since:
- keyutil 1.0.5
-
-
-
-
-
-
- Returns:
-
- {Object} RSAKey/DSA/ECDSA public key object
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Object}
- KEYUTIL. getKeyFromEncryptedPKCS8PEM (pkcs8PEM, passcode)
-
-
-
- get RSAKey/ECDSA private key object from encrypted PEM PKCS#8 private key
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} pkcs8PEM
-
-
- string of PEM formatted PKCS#8 private key
-
-
- {String} passcode
-
-
- passcode string to decrypt key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.5
-
-
-
-
-
-
- Returns:
-
- {Object} RSAKey or KJUR.crypto.ECDSA private key object
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Object}
- KEYUTIL. getKeyFromPlainPrivatePKCS8Hex (prvKeyHex)
-
-
-
- get RSAKey/ECDSA private key object from HEX plain PEM PKCS#8 private key
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} prvKeyHex
-
-
- hexadecimal string of plain PKCS#8 private key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.5
-
-
-
-
-
-
- Returns:
-
- {Object} RSAKey or KJUR.crypto.ECDSA private key object
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Object}
- KEYUTIL. getKeyFromPlainPrivatePKCS8PEM (pkcs8PEM)
-
-
-
- get RSAKey/ECDSA private key object from PEM plain PEM PKCS#8 private key
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} pkcs8PEM
-
-
- string of plain PEM formatted PKCS#8 private key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.5
-
-
-
-
-
-
- Returns:
-
- {Object} RSAKey or KJUR.crypto.ECDSA private key object
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Object}
- KEYUTIL. getKeyFromPublicPKCS8Hex (pkcsPub8Hex)
-
-
-
- (DEPRECATED) get RSAKey/DSA/ECDSA public key object from hexadecimal string of PKCS#8 public key
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} pkcsPub8Hex
-
-
- hexadecimal string of PKCS#8 public key
-
-
-
-
-
- Deprecated:
-
- From jsrsasign 4.2.1 please use KEYUTIL.getKey#.
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.5
-
-
-
-
-
-
- Returns:
-
- {Object} RSAKey or KJUR.crypto.{ECDSA,DSA} private key object
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Object}
- KEYUTIL. getKeyFromPublicPKCS8PEM (pkcsPub8PEM)
-
-
-
- (DEPRECATED) get RSAKey/ECDSA public key object from PEM PKCS#8 public key
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} pkcsPub8PEM
-
-
- string of PEM formatted PKCS#8 public key
-
-
-
-
-
- Deprecated:
-
- From jsrsasign 4.2.1 please use KEYUTIL.getKey#.
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.5
-
-
-
-
-
-
- Returns:
-
- {Object} RSAKey or KJUR.crypto.ECDSA private key object
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KEYUTIL. getPBKDF2KeyHexFromParam (info, passcode)
-
-
-
- generate PBKDF2 key hexstring with specified passcode and information
-As for info, this uses following properties:
-
-info.pbkdf2Salt - hexadecimal string of PBKDF2 salt
-info.pkbdf2Iter - iteration count
-
-Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
-
-keyDerivationFunc = pkcs5PBKDF2 with HmacSHA1
-encryptionScheme = des-EDE3-CBC(i.e. TripleDES
-
-
-
-
-
-
-
-
// to convert plain PKCS#5 private key to encrypted PKCS#8 private
-// key with PBKDF2 with TripleDES
-% openssl pkcs8 -in plain_p5.pem -topk8 -v2 -des3 -out encrypted_p8.pem
-
-
-
-
-
- Parameters:
-
-
- {Array} info
-
-
- result of parseHexOfEncryptedPKCS8 which has preference of PKCS#8 file
-
-
- {String} passcode
-
-
- passcode to decrypto private key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.3
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of PBKDF2 key
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KEYUTIL. getPEM (keyObjOrHex, formatType, passwd, encAlg)
-
-
-
- get PEM formatted private or public key file from a RSA/ECDSA/DSA key object
-
-NOTE1:
-
-PKCS#5 encrypted private key protection algorithm supports DES-CBC,
-DES-EDE3-CBC and AES-{128,192,256}-CBC
- NOTE2:
-
-OpenSSL supports
-
-
-
-
-
-
-
-
KEUUTIL.getPEM(publicKey) => generates PEM PKCS#8 public key
-KEUUTIL.getPEM(privateKey, "PKCS1PRV") => generates PEM PKCS#1 plain private key
-KEUUTIL.getPEM(privateKey, "PKCS5PRV", "pass") => generates PEM PKCS#5 encrypted private key
- with DES-EDE3-CBC (DEFAULT)
-KEUUTIL.getPEM(privateKey, "PKCS5PRV", "pass", "DES-CBC") => generates PEM PKCS#5 encrypted
- private key with DES-CBC
-KEUUTIL.getPEM(privateKey, "PKCS8PRV") => generates PEM PKCS#8 plain private key
-KEUUTIL.getPEM(privateKey, "PKCS8PRV", "pass") => generates PEM PKCS#8 encrypted private key
- with PBKDF2_HmacSHA1_3DES
-
-
-
-
-
- Parameters:
-
-
- {Object} keyObjOrHex
-
-
- key object RSAKey , KJUR.crypto.ECDSA or KJUR.crypto.DSA to encode to
-
-
- {String} formatType
-
-
- (OPTION) output format type of "PKCS1PRV", "PKCS5PRV" or "PKCS8PRV" for private key
-
-
- {String} passwd
-
-
- (OPTION) password to protect private key
-
-
- {String} encAlg
-
-
- (OPTION) encryption algorithm for PKCS#5. currently supports DES-CBC, DES-EDE3-CBC and AES-{128,192,256}-CBC
-
-
-
-
-
-
- Since:
- keyutil 1.0.4
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KEYUTIL. getPlainPKCS8HexFromEncryptedPKCS8PEM (pkcs8PEM, passcode)
-
-
-
- read PEM formatted encrypted PKCS#8 private key and returns hexadecimal string of plain PKCS#8 private key
-Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
-
-keyDerivationFunc = pkcs5PBKDF2 with HmacSHA1
-encryptionScheme = des-EDE3-CBC(i.e. TripleDES
-
-
-
-
-
-
-
-
// to convert plain PKCS#5 private key to encrypted PKCS#8 private
-// key with PBKDF2 with TripleDES
-% openssl pkcs8 -in plain_p5.pem -topk8 -v2 -des3 -out encrypted_p8.pem
-
-
-
-
-
- Parameters:
-
-
- {String} pkcs8PEM
-
-
- PEM formatted encrypted PKCS#8 private key
-
-
- {String} passcode
-
-
- passcode to decrypto private key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.3
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of plain PKCS#8 private key
-
-
-
-
-
-
-
-
-
-
<static>
-
-
{RSAKey }
-
KEYUTIL. getRSAKeyFromEncryptedPKCS5PEM (sEncryptedP5PEM, passcode)
-
-
-
- (DEPRECATED) read PEM formatted encrypted PKCS#5 private key and returns RSAKey object
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} sEncryptedP5PEM
-
-
- PEM formatted encrypted PKCS#5 private key
-
-
- {String} passcode
-
-
- passcode to decrypt private key
-
-
-
-
-
- Deprecated:
-
- From jsrsasign 4.2.1 please use KEYUTIL.getKey#.
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.2
-
-
-
-
-
-
- Returns:
-
- {RSAKey } loaded RSAKey object of RSA private key
-
-
-
-
-
-
-
-
-
-
<static>
-
-
{RSAKey }
-
KEYUTIL. getRSAKeyFromEncryptedPKCS8PEM (pkcs8PEM, passcode)
-
-
-
- (DEPRECATED) read PEM formatted encrypted PKCS#8 private key and returns RSAKey object
-Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
-
-keyDerivationFunc = pkcs5PBKDF2 with HmacSHA1
-encryptionScheme = des-EDE3-CBC(i.e. TripleDES
-
-
-
-
-
-
-
-
// to convert plain PKCS#5 private key to encrypted PKCS#8 private
-// key with PBKDF2 with TripleDES
-% openssl pkcs8 -in plain_p5.pem -topk8 -v2 -des3 -out encrypted_p8.pem
-
-
-
-
-
- Parameters:
-
-
- {String} pkcs8PEM
-
-
- PEM formatted encrypted PKCS#8 private key
-
-
- {String} passcode
-
-
- passcode to decrypto private key
-
-
-
-
-
- Deprecated:
-
- From jsrsasign 4.2.1 please use KEYUTIL.getKey#.
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.3
-
-
-
-
-
-
- Returns:
-
- {RSAKey } loaded RSAKey object of RSA private key
-
-
-
-
-
-
-
-
-
-
<static>
-
-
{RSAKey }
-
KEYUTIL. getRSAKeyFromPlainPKCS8Hex (prvKeyHex)
-
-
-
- (DEPRECATED) provide hexadecimal string of unencrypted PKCS#8 private key and returns RSAKey object
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} prvKeyHex
-
-
- hexadecimal string of unencrypted PKCS#8 private key
-
-
-
-
-
- Deprecated:
-
- From jsrsasign 4.2.1 please use KEYUTIL.getKey#.
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.3
-
-
-
-
-
-
- Returns:
-
- {RSAKey } loaded RSAKey object of RSA private key
-
-
-
-
-
-
-
-
-
-
<static>
-
-
{RSAKey }
-
KEYUTIL. getRSAKeyFromPlainPKCS8PEM (pkcs8PEM)
-
-
-
- (DEPRECATED) read PEM formatted unencrypted PKCS#8 private key and returns RSAKey object
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} pkcs8PEM
-
-
- PEM formatted unencrypted PKCS#8 private key
-
-
-
-
-
- Deprecated:
-
- From jsrsasign 4.2.1 please use KEYUTIL.getKey#.
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.1
-
-
-
-
-
-
- Returns:
-
- {RSAKey } loaded RSAKey object of RSA private key
-
-
-
-
-
-
-
-
-
-
<static>
-
-
{RSAKey }
-
KEYUTIL. getRSAKeyFromPublicPKCS8Hex (pkcs8PubHex)
-
-
-
- (DEPRECATED) provide hexadecimal string of unencrypted PKCS#8 private key and returns RSAKey object
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} pkcs8PubHex
-
-
- hexadecimal string of unencrypted PKCS#8 public key
-
-
-
-
-
- Deprecated:
-
- From jsrsasign 4.2.1 please use KEYUTIL.getKey#.
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.4
-
-
-
-
-
-
- Returns:
-
- {RSAKey } loaded RSAKey object of RSA public key
-
-
-
-
-
-
-
-
-
-
<static>
-
-
{RSAKey }
-
KEYUTIL. getRSAKeyFromPublicPKCS8PEM (pkcs8PubPEM)
-
-
-
- (DEPRECATED) read PEM formatted PKCS#8 public key and returns RSAKey object
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} pkcs8PubPEM
-
-
- PEM formatted PKCS#8 public key
-
-
-
-
-
- Deprecated:
-
- From jsrsasign 4.2.1 please use KEYUTIL.getKey#.
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.4
-
-
-
-
-
-
- Returns:
-
- {RSAKey } loaded RSAKey object of RSA public key
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KEYUTIL. newEncryptedPKCS5PEM (passcode, keyLen, hPublicExponent, alg)
-
-
-
- generate RSAKey and PEM formatted encrypted PKCS#5 private key
-
-
-
-
-
-
-
var pem1 = KEYUTIL.newEncryptedPKCS5PEM("password"); // RSA1024bit/10001/AES-256-CBC
-var pem2 = KEYUTIL.newEncryptedPKCS5PEM("password", 512); // RSA 512bit/10001/AES-256-CBC
-var pem3 = KEYUTIL.newEncryptedPKCS5PEM("password", 512, '3'); // RSA 512bit/ 3/AES-256-CBC
-
-
-
-
-
- Parameters:
-
-
- {String} passcode
-
-
- pass code to protect private key (ex. password)
-
-
- {Integer} keyLen
-
-
- key bit length of RSA key to be generated. (default 1024)
-
-
- {String} hPublicExponent
-
-
- hexadecimal string of public exponent (default 10001)
-
-
- {String} alg
-
-
- shared key algorithm to encrypt private key (default AES-258-CBC)
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.2
-
-
-
-
-
-
- Returns:
-
- {String} string of PEM formatted encrypted PKCS#5 private key
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Array}
- KEYUTIL. parseCSRHex (csrHex)
-
-
-
- parse hexadecimal string of PKCS#10 CSR (certificate signing request)
-Resulted associative array has following properties:
-
-p8pubkeyhex - hexadecimal string of subject public key in PKCS#8
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} csrHex
-
-
- hexadecimal string of PKCS#10 CSR
-
-
-
-
-
-
- Since:
- keyutil 1.0.5
-
-
-
-
-
-
- Returns:
-
- {Array} associative array of parsed CSR
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Array}
- KEYUTIL. parseHexOfEncryptedPKCS8 (passcode)
-
-
-
- generate PBKDF2 key hexstring with specified passcode and information
-The associative array which is returned by this method has following properties:
-
-info.pbkdf2Salt - hexadecimal string of PBKDF2 salt
-info.pkbdf2Iter - iteration count
-info.ciphertext - hexadecimal string of encrypted private key
-info.encryptionSchemeAlg - encryption algorithm name (currently TripleDES only)
-info.encryptionSchemeIV - initial vector for encryption algorithm
-
-Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
-
-keyDerivationFunc = pkcs5PBKDF2 with HmacSHA1
-encryptionScheme = des-EDE3-CBC(i.e. TripleDES
-
-
-
-
-
-
-
-
// to convert plain PKCS#5 private key to encrypted PKCS#8 private
-// key with PBKDF2 with TripleDES
-% openssl pkcs8 -in plain_p5.pem -topk8 -v2 -des3 -out encrypted_p8.pem
-
-
-
-
-
- Parameters:
-
-
- {String} passcode
-
-
- passcode to decrypto private key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.3
-
-
-
-
-
-
- Returns:
-
- {Array} info associative array of PKCS#8 parameters
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Hash}
- KEYUTIL. parsePKCS5PEM (sEncryptedPEM)
-
-
-
- parse PEM formatted passcode protected PKCS#5 private key
-Resulted hash has following attributes.
-
-cipher - symmetric key algorithm name (ex. 'DES-EBE3-CBC', 'AES-256-CBC')
-ivsalt - IV used for decrypt. Its heading 8 bytes will be used for passcode salt.
-type - asymmetric key algorithm name of private key described in PEM header.
-data - base64 encoded encrypted private key.
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} sEncryptedPEM
-
-
- PEM formatted protected passcode protected PKCS#5 private key
-
-
-
-
-
-
-
-
- Returns:
-
- {Hash} hash of key information
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Array}
- KEYUTIL. parsePlainPrivatePKCS8Hex (pkcs8PrvHex)
-
-
-
- parse hexadecimal string of plain PKCS#8 private key
-Resulted associative array has following properties:
-
-algoid - hexadecimal string of OID of asymmetric key algorithm
-algparam - hexadecimal string of OID of ECC curve name or null
-keyidx - string starting index of key in pkcs8PrvHex
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} pkcs8PrvHex
-
-
- hexadecimal string of PKCS#8 plain private key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.5
-
-
-
-
-
-
- Returns:
-
- {Array} associative array of parsed key
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Array}
- KEYUTIL. parsePrivateRawECKeyHexAtObj (pkcs8PrvHex)
-
-
-
- parse hexadecimal string of ECC private key
-Following properties are added to associative array 'info'
-
-key - hexadecimal string of ECC private key
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} pkcs8PrvHex
-
-
- hexadecimal string of PKCS#8 private key concluding EC private key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.5
-
-
-
-
-
-
- Returns:
-
- {Array} info associative array to add parsed ECC private key information
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Array}
- KEYUTIL. parsePrivateRawRSAKeyHexAtObj (pkcs8PrvHex)
-
-
-
- parse hexadecimal string of RSA private key
-Following properties are added to associative array 'info'
-
-n - hexadecimal string of public key
- e - hexadecimal string of public exponent
- d - hexadecimal string of private key
- p - hexadecimal string
- q - hexadecimal string
- dp - hexadecimal string
- dq - hexadecimal string
- co - hexadecimal string
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} pkcs8PrvHex
-
-
- hexadecimal string of PKCS#8 private key concluding RSA private key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.5
-
-
-
-
-
-
- Returns:
-
- {Array} info associative array to add parsed RSA private key information
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Hash}
- KEYUTIL. parsePublicPKCS8Hex (pkcs8PubHex)
-
-
-
- parse hexadecimal string of PKCS#8 RSA/EC/DSA public key
-Resulted hash has following attributes.
-
-algoid - hexadecimal string of OID of asymmetric key algorithm
-algparam - hexadecimal string of OID of ECC curve name, parameter SEQUENCE of DSA or null
-key - hexadecimal string of public key
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} pkcs8PubHex
-
-
- hexadecimal string of PKCS#8 public key
-
-
-
-
-
-
-
-
- Returns:
-
- {Hash} hash of key information
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Array}
- KEYUTIL. parsePublicRawRSAKeyHex (pubRawRSAHex)
-
-
-
- parse hexadecimal string of plain PKCS#8 private key
-Resulted associative array has following properties:
-
-n - hexadecimal string of public key
- e - hexadecimal string of public exponent
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} pubRawRSAHex
-
-
- hexadecimal string of ASN.1 encoded PKCS#8 public key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.5
-
-
-
-
-
-
- Returns:
-
- {Array} associative array of parsed key
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.ASN1Object.html b/jwt/api/symbols/KJUR.asn1.ASN1Object.html
deleted file mode 100644
index c44c4b4..0000000
--- a/jwt/api/symbols/KJUR.asn1.ASN1Object.html
+++ /dev/null
@@ -1,847 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.ASN1Object
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.ASN1Object
-
-
-
-
-
-
-
- base class for ASN.1 DER encoder object
-
-
- Defined in: asn1-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- base class for ASN.1 DER encoder object
-
-
-
-
-
-
-
-
-
-
-
-
- Field Summary
-
-
- Field Attributes
- Field Name and Description
-
-
-
-
-
-
-
-
- hexadecimal string of ASN.1 TLV length(L)
-
-
-
-
-
-
-
- hexadecimal string of ASN.1 TLV tag(T)
-
-
-
-
-
-
-
- hexadecimal string of ASN.1 TLV
-
-
-
-
-
-
-
- hexadecimal string of ASN.1 TLV value(V)
-
-
-
-
-
-
-
- flag whether internal data was changed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- get hexadecimal string of ASN.1 TLV bytes
-
-
-
-
- <static>
-
-
- get hexadecimal ASN.1 TLV length(L) bytes from TLV value(V)
-
-
-
-
- <static>
-
-
- get hexadecimal string of ASN.1 TLV value(V) bytes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.ASN1Object ()
-
-
-
- base class for ASN.1 DER encoder object
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Field Detail
-
-
-
-
-
- {String}
- hL
-
-
-
- hexadecimal string of ASN.1 TLV length(L)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {String}
- hT
-
-
-
- hexadecimal string of ASN.1 TLV tag(T)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {String}
- hTLV
-
-
-
- hexadecimal string of ASN.1 TLV
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {String}
- hV
-
-
-
- hexadecimal string of ASN.1 TLV value(V)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {Boolean}
- isModified
-
-
-
- flag whether internal data was changed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
- {String}
- KJUR.asn1.ASN1Object. getEncodedHex ()
-
-
-
- get hexadecimal string of ASN.1 TLV bytes
-
-
-
-
-
-
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of ASN.1 TLV
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KJUR.asn1.ASN1Object. getLengthHexFromValue ()
-
-
-
- get hexadecimal ASN.1 TLV length(L) bytes from TLV value(V)
-
-
-
-
-
-
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of ASN.1 TLV length(L)
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KJUR.asn1.ASN1Object. getValueHex ()
-
-
-
- get hexadecimal string of ASN.1 TLV value(V) bytes
-
-
-
-
-
-
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of ASN.1 TLV value(V) bytes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.ASN1Util.html b/jwt/api/symbols/KJUR.asn1.ASN1Util.html
deleted file mode 100644
index 6cb4eaf..0000000
--- a/jwt/api/symbols/KJUR.asn1.ASN1Util.html
+++ /dev/null
@@ -1,911 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.ASN1Util
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.ASN1Util
-
-
-
-
-
-
-
- ASN1 utilities class
-
-
- Defined in: asn1-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- ASN1 utilities class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- get PEM string from hexadecimal data and header string
-
-
-
-
-
- <static>
-
-
- get encoded hexadecimal string of ASN1Object specifed by JSON parameters
-As for ASN.1 object representation of JSON object,
-please see newObject.
-
-
-
-
- <static>
-
-
- generate ASN1Object specifed by JSON parameters
-generate any ASN1Object specified by JSON param
-including ASN.1 primitive or structured.
-
-
-
-
- <static>
-
-
- get dot noted oid number string from hexadecimal value of OID
-This static method converts from hexadecimal string representation of
-ASN.1 value of object identifier to oid number string.
-
-
-
-
- <static>
-
-
- get hexadecimal value of object identifier from dot noted oid value
-This static method converts from object identifier value string.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.ASN1Util ()
-
-
-
- ASN1 utilities class
-
-
-
-
-
-
-
-
-
-
- Since:
- asn1 1.0.2
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
- {String}
- KJUR.asn1.ASN1Util. getPEMStringFromHex (dataHex, pemHeader)
-
-
-
- get PEM string from hexadecimal data and header string
-
-
-
-
-
-
-
-
var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex('616161', 'RSA PRIVATE KEY');
-// value of pem will be:
------BEGIN PRIVATE KEY-----
-YWFh
------END PRIVATE KEY-----
-
-
-
-
-
- Parameters:
-
-
- {String} dataHex
-
-
- hexadecimal string of PEM body
-
-
- {String} pemHeader
-
-
- PEM header string (ex. 'RSA PRIVATE KEY')
-
-
-
-
-
-
-
-
- Returns:
-
- {String} PEM formatted string of input data
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.ASN1Util. jsonToASN1HEX (param)
-
-
-
- get encoded hexadecimal string of ASN1Object specifed by JSON parameters
-As for ASN.1 object representation of JSON object,
-please see newObject.
-
-
-
-
-
-
-
jsonToASN1HEX({'prnstr': 'aaa'});
-
-
-
-
-
- Parameters:
-
-
- {Array} param
-
-
- JSON parameter to generate ASN1Object
-
-
-
-
-
-
- Since:
- asn1 1.0.4
-
-
-
-
-
-
- Returns:
-
- hexadecimal string of ASN1Object
-
-
-
-
-
-
-
-
-
-
-
- generate ASN1Object specifed by JSON parameters
-generate any ASN1Object specified by JSON param
-including ASN.1 primitive or structured.
-Generally 'param' can be described as follows:
-
-{TYPE-OF-ASNOBJ: ASN1OBJ-PARAMETER}
-
-'TYPE-OF-ASN1OBJ' can be one of following symbols:
-
-'bool' - DERBoolean
-'int' - DERInteger
-'bitstr' - DERBitString
-'octstr' - DEROctetString
-'null' - DERNull
-'oid' - DERObjectIdentifier
-'enum' - DEREnumerated
-'utf8str' - DERUTF8String
-'numstr' - DERNumericString
-'prnstr' - DERPrintableString
-'telstr' - DERTeletexString
-'ia5str' - DERIA5String
-'utctime' - DERUTCTime
-'gentime' - DERGeneralizedTime
-'seq' - DERSequence
-'set' - DERSet
-'tag' - DERTaggedObject
-
-
-
-
-
-
-
-
newObject({'prnstr': 'aaa'});
-newObject({'seq': [{'int': 3}, {'prnstr': 'aaa'}]})
-// ASN.1 Tagged Object
-newObject({'tag': {'tag': 'a1',
- 'explicit': true,
- 'obj': {'seq': [{'int': 3}, {'prnstr': 'aaa'}]}}});
-// more simple representation of ASN.1 Tagged Object
-newObject({'tag': ['a1',
- true,
- {'seq': [
- {'int': 3},
- {'prnstr': 'aaa'}]}
- ]});
-
-
-
-
-
- Parameters:
-
-
- {Array} param
-
-
- JSON parameter to generate ASN1Object
-
-
-
-
-
-
- Since:
- asn1 1.0.3
-
-
-
-
-
-
- Returns:
-
- {KJUR.asn1.ASN1Object } generated object
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KJUR.asn1.ASN1Util. oidHexToInt (hex)
-
-
-
- get dot noted oid number string from hexadecimal value of OID
-This static method converts from hexadecimal string representation of
-ASN.1 value of object identifier to oid number string.
-
-
-
-
-
-
-
KJUR.asn1.ASN1Util.oidHexToInt('550406') → "2.5.4.6"
-
-
-
-
-
- Parameters:
-
-
- {String} hex
-
-
- hexadecimal value of object identifier
-
-
-
-
-
-
- Since:
- jsrsasign 4.8.3 asn1 1.0.7
-
-
-
-
-
-
- Returns:
-
- {String} dot noted string of object identifier
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KJUR.asn1.ASN1Util. oidIntToHex (oidString)
-
-
-
- get hexadecimal value of object identifier from dot noted oid value
-This static method converts from object identifier value string.
-to hexadecimal string representation of it.
-
-
-
-
-
-
-
KJUR.asn1.ASN1Util.oidIntToHex("2.5.4.6") → "550406"
-
-
-
-
-
- Parameters:
-
-
- {String} oidString
-
-
- dot noted string of object identifier
-
-
-
-
-
-
- Since:
- jsrsasign 4.8.3 asn1 1.0.7
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal value of object identifier
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.DERAbstractString.html b/jwt/api/symbols/KJUR.asn1.DERAbstractString.html
deleted file mode 100644
index 1d85dae..0000000
--- a/jwt/api/symbols/KJUR.asn1.DERAbstractString.html
+++ /dev/null
@@ -1,762 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.DERAbstractString
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.DERAbstractString
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- base class for ASN.1 DER string classes
-
-
- Defined in: asn1-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- base class for ASN.1 DER string classes
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-str - specify initial ASN.1 value(V) by a string
-hex - specify initial ASN.1 value(V) by a hexadecimal string
-
-NOTE: 'params' can be omitted.
-
-
-
-
-
-
-
-
-
-
-
- Field Summary
-
-
- Field Attributes
- Field Name and Description
-
-
-
-
-
-
-
-
- internal string of value
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- get string value of this string object
-
-
-
-
- <static>
-
- KJUR.asn1.DERAbstractString.
setString (newS)
-
- set value by a string
-
-
-
-
- <static>
-
-
- set value by a hexadecimal string
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.DERAbstractString (params)
-
-
-
- base class for ASN.1 DER string classes
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-str - specify initial ASN.1 value(V) by a string
-hex - specify initial ASN.1 value(V) by a hexadecimal string
-
-NOTE: 'params' can be omitted.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {'str': 'aaa'})
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Field Detail
-
-
-
-
-
- {String}
- s
-
-
-
- internal string of value
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
- {String}
- KJUR.asn1.DERAbstractString. getString ()
-
-
-
- get string value of this string object
-
-
-
-
-
-
-
-
-
-
-
-
- Returns:
-
- {String} string value of this string object
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.DERAbstractString. setString (newS)
-
-
-
- set value by a string
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} newS
-
-
- value by a string to set
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.DERAbstractString. setStringHex (newHexString)
-
-
-
- set value by a hexadecimal string
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} newHexString
-
-
- value by a hexadecimal string to set
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.DERAbstractStructured.html b/jwt/api/symbols/KJUR.asn1.DERAbstractStructured.html
deleted file mode 100644
index d6f0708..0000000
--- a/jwt/api/symbols/KJUR.asn1.DERAbstractStructured.html
+++ /dev/null
@@ -1,703 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.DERAbstractStructured
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.DERAbstractStructured
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- base class for ASN.1 DER structured class
-
-
- Defined in: asn1-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- base class for ASN.1 DER structured class
-
-
-
-
-
-
-
-
-
-
-
-
- Field Summary
-
-
- Field Attributes
- Field Name and Description
-
-
-
-
-
-
-
-
- internal array of ASN1Object
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- append an ASN1Object to internal array
-
-
-
-
- <static>
-
-
- set value by array of ASN1Object
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.DERAbstractStructured ()
-
-
-
- base class for ASN.1 DER structured class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- See:
-
- KJUR.asn1.ASN1Object - superclass
-
-
-
-
-
-
-
-
-
-
- Field Detail
-
-
-
-
-
- {Array}
- asn1Array
-
-
-
- internal array of ASN1Object
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.DERAbstractStructured. appendASN1Object (asn1Object)
-
-
-
- append an ASN1Object to internal array
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {ASN1Object} asn1Object
-
-
- to add
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.DERAbstractStructured. setByASN1ObjectArray (asn1ObjectArray)
-
-
-
- set value by array of ASN1Object
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {array} asn1ObjectArray
-
-
- array of ASN1Object to set
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.DERAbstractTime.html b/jwt/api/symbols/KJUR.asn1.DERAbstractTime.html
deleted file mode 100644
index 58c7bd5..0000000
--- a/jwt/api/symbols/KJUR.asn1.DERAbstractTime.html
+++ /dev/null
@@ -1,735 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.DERAbstractTime
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.DERAbstractTime
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- base class for ASN.1 DER Generalized/UTCTime class
-
-
- Defined in: asn1-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- base class for ASN.1 DER Generalized/UTCTime class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- get string value of this string object
-
-
-
-
- <static>
-
- KJUR.asn1.DERAbstractTime.
setByDateValue (year, month, day, hour, min, sec)
-
- set value by a Date object
-
-
-
-
- <static>
-
-
- set value by a string
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.DERAbstractTime (params)
-
-
-
- base class for ASN.1 DER Generalized/UTCTime class
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {'str': '130430235959Z'})
-
-
-
-
-
-
-
-
-
-
- See:
-
- KJUR.asn1.ASN1Object - superclass
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
- {String}
- KJUR.asn1.DERAbstractTime. getString ()
-
-
-
- get string value of this string object
-
-
-
-
-
-
-
-
-
-
-
-
- Returns:
-
- {String} string value of this time object
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.DERAbstractTime. setByDateValue (year, month, day, hour, min, sec)
-
-
-
- set value by a Date object
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Integer} year
-
-
- year of date (ex. 2013)
-
-
- {Integer} month
-
-
- month of date between 1 and 12 (ex. 12)
-
-
- {Integer} day
-
-
- day of month
-
-
- {Integer} hour
-
-
- hours of date
-
-
- {Integer} min
-
-
- minutes of date
-
-
- {Integer} sec
-
-
- seconds of date
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.DERAbstractTime. setString (newS)
-
-
-
- set value by a string
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} newS
-
-
- value by a string to set such like "130430235959Z"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.DERBitString.html b/jwt/api/symbols/KJUR.asn1.DERBitString.html
deleted file mode 100644
index 046fc7b..0000000
--- a/jwt/api/symbols/KJUR.asn1.DERBitString.html
+++ /dev/null
@@ -1,815 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.DERBitString
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.DERBitString
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for ASN.1 DER encoded BitString primitive
-
-
- Defined in: asn1-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for ASN.1 DER encoded BitString primitive
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-bin - specify binary string (ex.
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- generate an array of false with specified length
-This static method may be useful to initialize boolean array.
-
-
-
-
- <static>
-
-
- set ASN.1 DER BitString by binary string
-Its unused bits will be calculated automatically by length of
-'binaryValue'.
-
-
-
-
- <static>
-
-
- set ASN.1 TLV value(V) by an array of boolean
-NOTE: Trailing falses will be ignored.
-
-
-
-
- <static>
-
-
- set ASN.1 value(V) by a hexadecimal string including unused bits
-
-
-
-
- <static>
-
-
- set ASN.1 value(V) by unused bit and hexadecimal string of value
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.DERBitString ()
-
-
-
- class for ASN.1 DER encoded BitString primitive
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-bin - specify binary string (ex. '10111')
-array - specify array of boolean (ex. [true,false,true,true])
-hex - specify hexadecimal string of ASN.1 value(V) including unused bits
-
-NOTE: 'params' can be omitted.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
- {array}
- KJUR.asn1.DERBitString. newFalseArray (nLength)
-
-
-
- generate an array of false with specified length
-This static method may be useful to initialize boolean array.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Integer} nLength
-
-
- length of array to generate
-
-
-
-
-
-
-
-
- Returns:
-
- {array} array of boolean faluse
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.DERBitString. setByBinaryString (binaryString)
-
-
-
- set ASN.1 DER BitString by binary string
-Its unused bits will be calculated automatically by length of
-'binaryValue'.
-NOTE: Trailing zeros '0' will be ignored.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} binaryString
-
-
- binary value string (i.e. '10111')
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.DERBitString. setByBooleanArray (booleanArray)
-
-
-
- set ASN.1 TLV value(V) by an array of boolean
-NOTE: Trailing falses will be ignored.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {array} booleanArray
-
-
- array of boolean (ex. [true, false, true])
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.DERBitString. setHexValueIncludingUnusedBits (newHexStringIncludingUnusedBits)
-
-
-
- set ASN.1 value(V) by a hexadecimal string including unused bits
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} newHexStringIncludingUnusedBits
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.DERBitString. setUnusedBitsAndHexValue (unusedBits, hValue)
-
-
-
- set ASN.1 value(V) by unused bit and hexadecimal string of value
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Integer} unusedBits
-
-
-
-
-
- {String} hValue
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.DERBoolean.html b/jwt/api/symbols/KJUR.asn1.DERBoolean.html
deleted file mode 100644
index c179974..0000000
--- a/jwt/api/symbols/KJUR.asn1.DERBoolean.html
+++ /dev/null
@@ -1,536 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.DERBoolean
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.DERBoolean
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for ASN.1 DER Boolean
-
-
- Defined in: asn1-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for ASN.1 DER Boolean
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.DERBoolean ()
-
-
-
- class for ASN.1 DER Boolean
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- See:
-
- KJUR.asn1.ASN1Object - superclass
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.DEREnumerated.html b/jwt/api/symbols/KJUR.asn1.DEREnumerated.html
deleted file mode 100644
index bf87715..0000000
--- a/jwt/api/symbols/KJUR.asn1.DEREnumerated.html
+++ /dev/null
@@ -1,717 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.DEREnumerated
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.DEREnumerated
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for ASN.1 DER Enumerated
-
-
- Defined in: asn1-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for ASN.1 DER Enumerated
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-int - specify initial ASN.1 value(V) by integer value
-hex - specify initial ASN.1 value(V) by a hexadecimal string
-
-NOTE: 'params' can be omitted.
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- set value by Tom Wu's BigInteger object
-
-
-
-
- <static>
-
-
- set value by integer value
-
-
-
-
- <static>
-
-
- set value by integer value
-
-NOTE: Value shall be represented by minimum octet length of
-two's complement representation.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.DEREnumerated ()
-
-
-
- class for ASN.1 DER Enumerated
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-int - specify initial ASN.1 value(V) by integer value
-hex - specify initial ASN.1 value(V) by a hexadecimal string
-
-NOTE: 'params' can be omitted.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.DEREnumerated. setByBigInteger (bigIntegerValue)
-
-
-
- set value by Tom Wu's BigInteger object
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {BigInteger} bigIntegerValue
-
-
- to set
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.DEREnumerated. setByInteger (integer)
-
-
-
- set value by integer value
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Integer} integer
-
-
- value to set
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.DEREnumerated. setValueHex (hexadecimal)
-
-
-
- set value by integer value
-
-NOTE: Value shall be represented by minimum octet length of
-two's complement representation.
-
-
-
-
-
-
-
new KJUR.asn1.DEREnumerated(123);
-new KJUR.asn1.DEREnumerated({'int': 123});
-new KJUR.asn1.DEREnumerated({'hex': '1fad'});
-
-
-
-
-
- Parameters:
-
-
- {String} hexadecimal
-
-
- string of integer value
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.DERGeneralizedTime.html b/jwt/api/symbols/KJUR.asn1.DERGeneralizedTime.html
deleted file mode 100644
index 4d89a4b..0000000
--- a/jwt/api/symbols/KJUR.asn1.DERGeneralizedTime.html
+++ /dev/null
@@ -1,683 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.DERGeneralizedTime
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.DERGeneralizedTime
-
-
-
-
-
- Extends
- KJUR.asn1.DERAbstractTime .
-
-
- class for ASN.1 DER GeneralizedTime
-
-
- Defined in: asn1-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for ASN.1 DER GeneralizedTime
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-str - specify initial ASN.1 value(V) by a string (ex.
-
-
-
-
-
-
-
-
-
-
-
- Field Summary
-
-
- Field Attributes
- Field Name and Description
-
-
-
-
-
-
-
-
- flag to show milliseconds or not
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
- KJUR.asn1.DERGeneralizedTime.
setByDate (dateObject)
-
- set value by a Date object
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.DERGeneralizedTime (params)
-
-
-
- class for ASN.1 DER GeneralizedTime
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-str - specify initial ASN.1 value(V) by a string (ex.'20130430235959Z')
-hex - specify initial ASN.1 value(V) by a hexadecimal string
-date - specify Date object.
-millis - specify flag to show milliseconds (from 1.0.6)
-
-NOTE1: 'params' can be omitted.
-NOTE2: 'withMillis' property is supported from asn1 1.0.6.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {'str': '20130430235959Z'})
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Field Detail
-
-
-
-
-
- {Boolean}
- withMillis
-
-
-
- flag to show milliseconds or not
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.DERGeneralizedTime. setByDate (dateObject)
-
-
-
- set value by a Date object
-
-
-
-
-
-
-
When you specify UTC time, use 'Date.UTC' method like this:
-var o = new DERUTCTime();
-var date = new Date(Date.UTC(2015, 0, 31, 23, 59, 59, 0)); #2015JAN31 23:59:59
-o.setByDate(date);
-
-
-
-
-
- Parameters:
-
-
- {Date} dateObject
-
-
- Date object to set ASN.1 value(V)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.DERIA5String.html b/jwt/api/symbols/KJUR.asn1.DERIA5String.html
deleted file mode 100644
index 4035b89..0000000
--- a/jwt/api/symbols/KJUR.asn1.DERIA5String.html
+++ /dev/null
@@ -1,547 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.DERIA5String
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.DERIA5String
-
-
-
-
-
- Extends
- KJUR.asn1.DERAbstractString .
-
-
- class for ASN.1 DER IA5String
-
-
- Defined in: asn1-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for ASN.1 DER IA5String
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.DERAbstractString : s Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.DERIA5String (params)
-
-
-
- class for ASN.1 DER IA5String
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {'str': 'aaa'})
-
-
-
-
-
-
-
-
-
-
- See:
-
- KJUR.asn1.DERAbstractString - superclass
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.DERInteger.html b/jwt/api/symbols/KJUR.asn1.DERInteger.html
deleted file mode 100644
index 80aa314..0000000
--- a/jwt/api/symbols/KJUR.asn1.DERInteger.html
+++ /dev/null
@@ -1,719 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.DERInteger
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.DERInteger
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for ASN.1 DER Integer
-
-
- Defined in: asn1-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for ASN.1 DER Integer
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-int - specify initial ASN.1 value(V) by integer value
-bigint - specify initial ASN.1 value(V) by BigInteger object
-hex - specify initial ASN.1 value(V) by a hexadecimal string
-
-NOTE: 'params' can be omitted.
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- set value by Tom Wu's BigInteger object
-
-
-
-
- <static>
-
-
- set value by integer value
-
-
-
-
- <static>
-
-
- set value by integer value
-
-NOTE: Value shall be represented by minimum octet length of
-two's complement representation.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.DERInteger ()
-
-
-
- class for ASN.1 DER Integer
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-int - specify initial ASN.1 value(V) by integer value
-bigint - specify initial ASN.1 value(V) by BigInteger object
-hex - specify initial ASN.1 value(V) by a hexadecimal string
-
-NOTE: 'params' can be omitted.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.DERInteger. setByBigInteger (bigIntegerValue)
-
-
-
- set value by Tom Wu's BigInteger object
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {BigInteger} bigIntegerValue
-
-
- to set
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.DERInteger. setByInteger (integer)
-
-
-
- set value by integer value
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Integer} integer
-
-
- value to set
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.DERInteger. setValueHex (hexadecimal)
-
-
-
- set value by integer value
-
-NOTE: Value shall be represented by minimum octet length of
-two's complement representation.
-
-
-
-
-
-
-
new KJUR.asn1.DERInteger(123);
-new KJUR.asn1.DERInteger({'int': 123});
-new KJUR.asn1.DERInteger({'hex': '1fad'});
-
-
-
-
-
- Parameters:
-
-
- {String} hexadecimal
-
-
- string of integer value
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.DERNull.html b/jwt/api/symbols/KJUR.asn1.DERNull.html
deleted file mode 100644
index f84335e..0000000
--- a/jwt/api/symbols/KJUR.asn1.DERNull.html
+++ /dev/null
@@ -1,536 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.DERNull
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.DERNull
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for ASN.1 DER Null
-
-
- Defined in: asn1-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for ASN.1 DER Null
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.DERNull ()
-
-
-
- class for ASN.1 DER Null
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- See:
-
- KJUR.asn1.ASN1Object - superclass
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.DERNumericString.html b/jwt/api/symbols/KJUR.asn1.DERNumericString.html
deleted file mode 100644
index c93fcff..0000000
--- a/jwt/api/symbols/KJUR.asn1.DERNumericString.html
+++ /dev/null
@@ -1,547 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.DERNumericString
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.DERNumericString
-
-
-
-
-
- Extends
- KJUR.asn1.DERAbstractString .
-
-
- class for ASN.1 DER NumericString
-
-
- Defined in: asn1-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for ASN.1 DER NumericString
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.DERAbstractString : s Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.DERNumericString (params)
-
-
-
- class for ASN.1 DER NumericString
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {'str': 'aaa'})
-
-
-
-
-
-
-
-
-
-
- See:
-
- KJUR.asn1.DERAbstractString - superclass
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.DERObjectIdentifier.html b/jwt/api/symbols/KJUR.asn1.DERObjectIdentifier.html
deleted file mode 100644
index 4dcd428..0000000
--- a/jwt/api/symbols/KJUR.asn1.DERObjectIdentifier.html
+++ /dev/null
@@ -1,722 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.DERObjectIdentifier
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.DERObjectIdentifier
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for ASN.1 DER ObjectIdentifier
-
-
- Defined in: asn1-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for ASN.1 DER ObjectIdentifier
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-oid - specify initial ASN.1 value(V) by a oid string (ex.
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
- KJUR.asn1.DERObjectIdentifier.
setValueHex (newHexString)
-
- set value by a hexadecimal string
-
-
-
-
- <static>
-
-
- set value by a OID name
-OID name shall be defined in 'KJUR.asn1.x509.OID.name2oidList'.
-
-
-
-
- <static>
-
-
- set value by a OID string
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.DERObjectIdentifier (params)
-
-
-
- class for ASN.1 DER ObjectIdentifier
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-oid - specify initial ASN.1 value(V) by a oid string (ex. 2.5.4.13)
-hex - specify initial ASN.1 value(V) by a hexadecimal string
-
-NOTE: 'params' can be omitted.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {'oid': '2.5.4.5'})
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.DERObjectIdentifier. setValueHex (newHexString)
-
-
-
- set value by a hexadecimal string
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} newHexString
-
-
- hexadecimal value of OID bytes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.DERObjectIdentifier. setValueName (oidName)
-
-
-
- set value by a OID name
-OID name shall be defined in 'KJUR.asn1.x509.OID.name2oidList'.
-Otherwise raise error.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} oidName
-
-
- OID name (ex. 'serverAuth')
-
-
-
-
-
-
- Since:
- 1.0.1
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.DERObjectIdentifier. setValueOidString (oidString)
-
-
-
- set value by a OID string
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} oidString
-
-
- OID string (ex. 2.5.4.13)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.DEROctetString.html b/jwt/api/symbols/KJUR.asn1.DEROctetString.html
deleted file mode 100644
index af7f7f6..0000000
--- a/jwt/api/symbols/KJUR.asn1.DEROctetString.html
+++ /dev/null
@@ -1,547 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.DEROctetString
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.DEROctetString
-
-
-
-
-
- Extends
- KJUR.asn1.DERAbstractString .
-
-
- class for ASN.1 DER OctetString
-
-
- Defined in: asn1-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for ASN.1 DER OctetString
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.DERAbstractString : s Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.DEROctetString (params)
-
-
-
- class for ASN.1 DER OctetString
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {'str': 'aaa'})
-
-
-
-
-
-
-
-
-
-
- See:
-
- KJUR.asn1.DERAbstractString - superclass
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.DERPrintableString.html b/jwt/api/symbols/KJUR.asn1.DERPrintableString.html
deleted file mode 100644
index ad54ae0..0000000
--- a/jwt/api/symbols/KJUR.asn1.DERPrintableString.html
+++ /dev/null
@@ -1,547 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.DERPrintableString
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.DERPrintableString
-
-
-
-
-
- Extends
- KJUR.asn1.DERAbstractString .
-
-
- class for ASN.1 DER PrintableString
-
-
- Defined in: asn1-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for ASN.1 DER PrintableString
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.DERAbstractString : s Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.DERPrintableString (params)
-
-
-
- class for ASN.1 DER PrintableString
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {'str': 'aaa'})
-
-
-
-
-
-
-
-
-
-
- See:
-
- KJUR.asn1.DERAbstractString - superclass
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.DERSequence.html b/jwt/api/symbols/KJUR.asn1.DERSequence.html
deleted file mode 100644
index 2a5ad8d..0000000
--- a/jwt/api/symbols/KJUR.asn1.DERSequence.html
+++ /dev/null
@@ -1,541 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.DERSequence
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.DERSequence
-
-
-
-
-
- Extends
- KJUR.asn1.DERAbstractStructured .
-
-
- class for ASN.1 DER Sequence
-
-
- Defined in: asn1-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for ASN.1 DER Sequence
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-array - specify array of ASN1Object to set elements of content
-
-NOTE: 'params' can be omitted.
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.DERAbstractStructured : asn1Array Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.DERSequence ()
-
-
-
- class for ASN.1 DER Sequence
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-array - specify array of ASN1Object to set elements of content
-
-NOTE: 'params' can be omitted.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.DERSet.html b/jwt/api/symbols/KJUR.asn1.DERSet.html
deleted file mode 100644
index 4f5607a..0000000
--- a/jwt/api/symbols/KJUR.asn1.DERSet.html
+++ /dev/null
@@ -1,542 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.DERSet
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.DERSet
-
-
-
-
-
- Extends
- KJUR.asn1.DERAbstractStructured .
-
-
- class for ASN.1 DER Set
-
-
- Defined in: asn1-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for ASN.1 DER Set
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-array - specify array of ASN1Object to set elements of content
-sortflag - flag for sort (default: true).
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.DERAbstractStructured : asn1Array Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.DERSet ()
-
-
-
- class for ASN.1 DER Set
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-array - specify array of ASN1Object to set elements of content
-sortflag - flag for sort (default: true). ASN.1 BER is not sorted in 'SET OF'.
-
-NOTE1: 'params' can be omitted.
-NOTE2: sortflag is supported since 1.0.5.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.DERTaggedObject.html b/jwt/api/symbols/KJUR.asn1.DERTaggedObject.html
deleted file mode 100644
index 73f78e7..0000000
--- a/jwt/api/symbols/KJUR.asn1.DERTaggedObject.html
+++ /dev/null
@@ -1,632 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.DERTaggedObject
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.DERTaggedObject
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for ASN.1 DER TaggedObject
-
-
- Defined in: asn1-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for ASN.1 DER TaggedObject
-
-Parameter 'tagNoNex' is ASN.1 tag(T) value for this object.
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
- KJUR.asn1.DERTaggedObject.
setString (isExplicitFlag, tagNoHex, asn1Object)
-
- set value by an ASN1Object
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.DERTaggedObject ()
-
-
-
- class for ASN.1 DER TaggedObject
-
-Parameter 'tagNoNex' is ASN.1 tag(T) value for this object.
-For example, if you find '[1]' tag in a ASN.1 dump,
-'tagNoHex' will be 'a1'.
-
-As for optional argument 'params' for constructor, you can specify *ANY* of
-following properties:
-
-explicit - specify true if this is explicit tag otherwise false
- (default is 'true').
-tag - specify tag (default is 'a0' which means [0])
-obj - specify ASN1Object which is tagged
-
-
-
-
-
-
-
d1 = new KJUR.asn1.DERUTF8String({'str':'a'});
-d2 = new KJUR.asn1.DERTaggedObject({'obj': d1});
-hex = d2.getEncodedHex();
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.DERTaggedObject. setString (isExplicitFlag, tagNoHex, asn1Object)
-
-
-
- set value by an ASN1Object
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Boolean} isExplicitFlag
-
-
- flag for explicit/implicit tag
-
-
- {Integer} tagNoHex
-
-
- hexadecimal string of ASN.1 tag
-
-
- {ASN1Object} asn1Object
-
-
- ASN.1 to encapsulate
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.DERTeletexString.html b/jwt/api/symbols/KJUR.asn1.DERTeletexString.html
deleted file mode 100644
index fddf7c3..0000000
--- a/jwt/api/symbols/KJUR.asn1.DERTeletexString.html
+++ /dev/null
@@ -1,547 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.DERTeletexString
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.DERTeletexString
-
-
-
-
-
- Extends
- KJUR.asn1.DERAbstractString .
-
-
- class for ASN.1 DER TeletexString
-
-
- Defined in: asn1-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for ASN.1 DER TeletexString
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.DERAbstractString : s Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.DERTeletexString (params)
-
-
-
- class for ASN.1 DER TeletexString
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {'str': 'aaa'})
-
-
-
-
-
-
-
-
-
-
- See:
-
- KJUR.asn1.DERAbstractString - superclass
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.DERUTCTime.html b/jwt/api/symbols/KJUR.asn1.DERUTCTime.html
deleted file mode 100644
index 90c5388..0000000
--- a/jwt/api/symbols/KJUR.asn1.DERUTCTime.html
+++ /dev/null
@@ -1,634 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.DERUTCTime
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.DERUTCTime
-
-
-
-
-
- Extends
- KJUR.asn1.DERAbstractTime .
-
-
- class for ASN.1 DER UTCTime
-
-
- Defined in: asn1-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for ASN.1 DER UTCTime
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-str - specify initial ASN.1 value(V) by a string (ex.
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- set value by a Date object
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.DERUTCTime (params)
-
-
-
- class for ASN.1 DER UTCTime
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-str - specify initial ASN.1 value(V) by a string (ex.'130430235959Z')
-hex - specify initial ASN.1 value(V) by a hexadecimal string
-date - specify Date object.
-
-NOTE: 'params' can be omitted.
-
EXAMPLES
-
-
-
-
-
-
var d1 = new KJUR.asn1.DERUTCTime();
-d1.setString('130430125959Z');
-
-var d2 = new KJUR.asn1.DERUTCTime({'str': '130430125959Z'});
-var d3 = new KJUR.asn1.DERUTCTime({'date': new Date(Date.UTC(2015, 0, 31, 0, 0, 0, 0))});
-var d4 = new KJUR.asn1.DERUTCTime('130430125959Z');
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {'str': '130430235959Z'})
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.DERUTCTime. setByDate (dateObject)
-
-
-
- set value by a Date object
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Date} dateObject
-
-
- Date object to set ASN.1 value(V)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.DERUTF8String.html b/jwt/api/symbols/KJUR.asn1.DERUTF8String.html
deleted file mode 100644
index 0fbdbe7..0000000
--- a/jwt/api/symbols/KJUR.asn1.DERUTF8String.html
+++ /dev/null
@@ -1,547 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.DERUTF8String
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.DERUTF8String
-
-
-
-
-
- Extends
- KJUR.asn1.DERAbstractString .
-
-
- class for ASN.1 DER UTF8String
-
-
- Defined in: asn1-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for ASN.1 DER UTF8String
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.DERAbstractString : s Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.DERUTF8String (params)
-
-
-
- class for ASN.1 DER UTF8String
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {'str': 'aaa'})
-
-
-
-
-
-
-
-
-
-
- See:
-
- KJUR.asn1.DERAbstractString - superclass
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.cades.CAdESUtil.html b/jwt/api/symbols/KJUR.asn1.cades.CAdESUtil.html
deleted file mode 100644
index e9b35a4..0000000
--- a/jwt/api/symbols/KJUR.asn1.cades.CAdESUtil.html
+++ /dev/null
@@ -1,691 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.cades.CAdESUtil
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.cades.CAdESUtil
-
-
-
-
-
-
-
- CAdES utilities class
-
-
- Defined in: asn1cades-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- CAdES utiliteis class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- parse CMS SignedData to add unsigned attributes
-This method will parse a hexadecimal string of
-ContentInfo with CMS SignedData to add a attribute
-to unsigned attributes field in a signerInfo field.
-
-
-
-
- <static>
-
-
- parse SignerInfo to add unsigned attributes
-This method will parse a hexadecimal string of
-SignerInfo to add a attribute
-to unsigned attributes field in a signerInfo field.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.cades.CAdESUtil ()
-
-
-
- CAdES utiliteis class
-
-
-
-
-
-
-
-
-
-
- Since:
- jsrsasign 4.7.0 asn1cades 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
- {Object}
- KJUR.asn1.cades.CAdESUtil. parseSignedDataForAddingUnsigned (hex)
-
-
-
- parse CMS SignedData to add unsigned attributes
-This method will parse a hexadecimal string of
-ContentInfo with CMS SignedData to add a attribute
-to unsigned attributes field in a signerInfo field.
-Parsed result will be an associative array which has
-following properties:
-
-version - hex of CMSVersion ASN.1 TLV
-algs - hex of DigestAlgorithms ASN.1 TLV
-encapcontent - hex of EncapContentInfo ASN.1 TLV
-certs - hex of Certificates ASN.1 TLV
-revs - hex of RevocationInfoChoices ASN.1 TLV
-si[] - array of SignerInfo properties
-obj - parsed KJUR.asn1.cms.SignedData object
-
-
-
-
-
-
-
-
info = KJUR.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned(beshex);
-sd = info.obj;
-
-
-
-
-
- Parameters:
-
-
- {String} hex
-
-
- hexadecimal string of ContentInfo of CMS SignedData
-
-
-
-
-
-
-
-
- Returns:
-
- {Object} associative array of parsed data
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Object}
- KJUR.asn1.cades.CAdESUtil. parseSignerInfoForAddingUnsigned (hex)
-
-
-
- parse SignerInfo to add unsigned attributes
-This method will parse a hexadecimal string of
-SignerInfo to add a attribute
-to unsigned attributes field in a signerInfo field.
-Parsed result will be an associative array which has
-following properties:
-
-version - hex TLV of version
-si - hex TLV of SignerIdentifier
-digalg - hex TLV of DigestAlgorithm
-sattrs - hex TLV of SignedAttributes
-sigalg - hex TLV of SignatureAlgorithm
-sig - hex TLV of signature
-sigval = hex V of signature
-obj - parsed KJUR.asn1.cms.SignerInfo object
-
-NOTE: Parsing of unsigned attributes will be provided in the
-future version. That's way this version provides support
-for CAdES-T and not for CAdES-C.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} hex
-
-
- hexadecimal string of SignerInfo
-
-
-
-
-
-
-
-
- Returns:
-
- {Object} associative array of parsed data
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.cades.CompleteCertificateRefs.html b/jwt/api/symbols/KJUR.asn1.cades.CompleteCertificateRefs.html
deleted file mode 100644
index 2a700a2..0000000
--- a/jwt/api/symbols/KJUR.asn1.cades.CompleteCertificateRefs.html
+++ /dev/null
@@ -1,638 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.cades.CompleteCertificateRefs
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.cades.CompleteCertificateRefs
-
-
-
-
-
- Extends
- KJUR.asn1.cms.Attribute .
-
-
- class for RFC 5126 CAdES CompleteCertificateRefs attribute
-
-
- Defined in: asn1cades-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for RFC 5126 CAdES CompleteCertificateRefs attribute
-
-id-aa-ets-certificateRefs OBJECT IDENTIFIER =
- 1.2.840.113549.1.9.16.2.21
-CompleteCertificateRefs ::= SEQUENCE OF OtherCertID
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
- KJUR.asn1.cades.CompleteCertificateRefs.
setByArray (a)
-
- set value by array
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.cades.CompleteCertificateRefs (params)
-
-
-
- class for RFC 5126 CAdES CompleteCertificateRefs attribute
-
-id-aa-ets-certificateRefs OBJECT IDENTIFIER =
- 1.2.840.113549.1.9.16.2.21
-CompleteCertificateRefs ::= SEQUENCE OF OtherCertID
-
-
-
-
-
-
-
o = new KJUR.asn1.cades.CompleteCertificateRefs([certPEM1,certPEM2]);
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.7.0 asn1cades 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.cades.CompleteCertificateRefs. setByArray (a)
-
-
-
- set value by array
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} a
-
-
- array of KJUR.asn1.cades.OtherCertID argument
-
-
-
-
-
-
-
-
- Returns:
-
- unspecified
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.cades.OtherCertID.html b/jwt/api/symbols/KJUR.asn1.cades.OtherCertID.html
deleted file mode 100644
index a0c3aaa..0000000
--- a/jwt/api/symbols/KJUR.asn1.cades.OtherCertID.html
+++ /dev/null
@@ -1,641 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.cades.OtherCertID
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.cades.OtherCertID
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for OtherCertID ASN.1 object
-
-
- Defined in: asn1cades-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for OtherCertID ASN.1 object
-
-OtherCertID ::= SEQUENCE {
- otherCertHash OtherHash,
- issuerSerial IssuerSerial OPTIONAL }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- set value by PEM string of certificate
-This method will set value by a PEM string of a certificate.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.cades.OtherCertID (params)
-
-
-
- class for OtherCertID ASN.1 object
-
-OtherCertID ::= SEQUENCE {
- otherCertHash OtherHash,
- issuerSerial IssuerSerial OPTIONAL }
-
-
-
-
-
-
-
o = new KJUR.asn1.cades.OtherCertID(certPEM);
-o = new KJUR.asn1.cades.OtherCertID({cert:certPEM, hasis: false});
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.7.0 asn1cades 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.cades.OtherCertID. setByCertPEM (certPEM)
-
-
-
- set value by PEM string of certificate
-This method will set value by a PEM string of a certificate.
-This will add IssuerAndSerialNumber by default
-which depends on hasIssuerSerial flag.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} certPEM
-
-
- PEM string of certificate
-
-
-
-
-
-
-
-
- Returns:
-
- unspecified
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.cades.OtherHash.html b/jwt/api/symbols/KJUR.asn1.cades.OtherHash.html
deleted file mode 100644
index 40fe35b..0000000
--- a/jwt/api/symbols/KJUR.asn1.cades.OtherHash.html
+++ /dev/null
@@ -1,646 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.cades.OtherHash
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.cades.OtherHash
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for OtherHash ASN.1 object
-
-
- Defined in: asn1cades-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for OtherHash ASN.1 object
-
-OtherHash ::= CHOICE {
- sha1Hash OtherHashValue, -- This contains a SHA-1 hash
- otherHash OtherHashAlgAndValue}
-OtherHashValue ::= OCTET STRING
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- set value by PEM string of certificate
-This method will set value by a PEM string of a certificate.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.cades.OtherHash (params)
-
-
-
- class for OtherHash ASN.1 object
-
-OtherHash ::= CHOICE {
- sha1Hash OtherHashValue, -- This contains a SHA-1 hash
- otherHash OtherHashAlgAndValue}
-OtherHashValue ::= OCTET STRING
-
-
-
-
-
-
-
o = new KJUR.asn1.cades.OtherHash("1234");
-o = new KJUR.asn1.cades.OtherHash(certPEMStr); // default alg=sha256
-o = new KJUR.asn1.cades.OtherHash({alg: 'sha256', hash: '1234'});
-o = new KJUR.asn1.cades.OtherHash({alg: 'sha256', cert: certPEM});
-o = new KJUR.asn1.cades.OtherHash({cert: certPEM});
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.7.0 asn1cades 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.cades.OtherHash. setByCertPEM (certPEM)
-
-
-
- set value by PEM string of certificate
-This method will set value by a PEM string of a certificate.
-An algorithm used to hash certificate data will
-be defined by 'alg' property and 'sha256' is default.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} certPEM
-
-
- PEM string of certificate
-
-
-
-
-
-
-
-
- Returns:
-
- unspecified
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.cades.OtherHashAlgAndValue.html b/jwt/api/symbols/KJUR.asn1.cades.OtherHashAlgAndValue.html
deleted file mode 100644
index 2bb31d4..0000000
--- a/jwt/api/symbols/KJUR.asn1.cades.OtherHashAlgAndValue.html
+++ /dev/null
@@ -1,555 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.cades.OtherHashAlgAndValue
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.cades.OtherHashAlgAndValue
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for OtherHashAlgAndValue ASN.1 object
-
-
- Defined in: asn1cades-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for OtherHashAlgAndValue ASN.1 object
-
-OtherHashAlgAndValue ::= SEQUENCE {
- hashAlgorithm AlgorithmIdentifier,
- hashValue OtherHashValue }
-OtherHashValue ::= OCTET STRING
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.cades.OtherHashAlgAndValue (params)
-
-
-
- class for OtherHashAlgAndValue ASN.1 object
-
-OtherHashAlgAndValue ::= SEQUENCE {
- hashAlgorithm AlgorithmIdentifier,
- hashValue OtherHashValue }
-OtherHashValue ::= OCTET STRING
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.7.0 asn1cades 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.cades.SignaturePolicyIdentifier.html b/jwt/api/symbols/KJUR.asn1.cades.SignaturePolicyIdentifier.html
deleted file mode 100644
index 38dcb9d..0000000
--- a/jwt/api/symbols/KJUR.asn1.cades.SignaturePolicyIdentifier.html
+++ /dev/null
@@ -1,574 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.cades.SignaturePolicyIdentifier
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.cades.SignaturePolicyIdentifier
-
-
-
-
-
- Extends
- KJUR.asn1.cms.Attribute .
-
-
- class for RFC 5126 CAdES SignaturePolicyIdentifier attribute
-
-
- Defined in: asn1cades-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for RFC 5126 CAdES SignaturePolicyIdentifier attribute
-
-SignaturePolicyIdentifier ::= CHOICE {
- signaturePolicyId SignaturePolicyId,
- signaturePolicyImplied SignaturePolicyImplied } -- not used
-
-SignaturePolicyImplied ::= NULL
-SignaturePolicyId ::= SEQUENCE {
- sigPolicyId SigPolicyId,
- sigPolicyHash SigPolicyHash,
- sigPolicyQualifiers SEQUENCE SIZE (1.
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.cades.SignaturePolicyIdentifier (params)
-
-
-
- class for RFC 5126 CAdES SignaturePolicyIdentifier attribute
-
-SignaturePolicyIdentifier ::= CHOICE {
- signaturePolicyId SignaturePolicyId,
- signaturePolicyImplied SignaturePolicyImplied } -- not used
-
-SignaturePolicyImplied ::= NULL
-SignaturePolicyId ::= SEQUENCE {
- sigPolicyId SigPolicyId,
- sigPolicyHash SigPolicyHash,
- sigPolicyQualifiers SEQUENCE SIZE (1..MAX) OF
- SigPolicyQualifierInfo OPTIONAL }
-SigPolicyId ::= OBJECT IDENTIFIER
-SigPolicyHash ::= OtherHashAlgAndValue
-
-
-
-
-
-
-
var o = new KJUR.asn1.cades.SignaturePolicyIdentifier({
- oid: '1.2.3.4.5',
- hash: {alg: 'sha1', hash: 'a1a2a3a4...'}
-});
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.7.0 asn1cades 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.cades.SignatureTimeStamp.html b/jwt/api/symbols/KJUR.asn1.cades.SignatureTimeStamp.html
deleted file mode 100644
index d177454..0000000
--- a/jwt/api/symbols/KJUR.asn1.cades.SignatureTimeStamp.html
+++ /dev/null
@@ -1,553 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.cades.SignatureTimeStamp
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.cades.SignatureTimeStamp
-
-
-
-
-
- Extends
- KJUR.asn1.cms.Attribute .
-
-
- class for RFC 5126 CAdES SignatureTimeStamp attribute
-
-
- Defined in: asn1cades-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for RFC 5126 CAdES SignatureTimeStamp attribute
-
-id-aa-signatureTimeStampToken OBJECT IDENTIFIER ::=
- 1.2.840.113549.1.9.16.2.14
-SignatureTimeStampToken ::= TimeStampToken
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.cades.SignatureTimeStamp (params)
-
-
-
- class for RFC 5126 CAdES SignatureTimeStamp attribute
-
-id-aa-signatureTimeStampToken OBJECT IDENTIFIER ::=
- 1.2.840.113549.1.9.16.2.14
-SignatureTimeStampToken ::= TimeStampToken
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.7.0 asn1cades 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.cades.html b/jwt/api/symbols/KJUR.asn1.cades.html
deleted file mode 100644
index 33e8059..0000000
--- a/jwt/api/symbols/KJUR.asn1.cades.html
+++ /dev/null
@@ -1,758 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.cades
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Namespace KJUR.asn1.cades
-
-
-
-
-
-
-
-
-
-
- Defined in: asn1cades-1.0.js .
-
-
-
-
-
-
- Namespace Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
- KJUR.asn1.cades.getEncodedHex ()
-
-
-
-
-
-
- <static>
-
- KJUR.asn1.cades.setByCertPEM (certPEM)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Namespace Detail
-
-
-
- KJUR.asn1.cades
-
-
-
- kjur's ASN.1 class for RFC 5126 CAdES long term signature
-
-This name space provides
-RFC 5126
-CAdES(CMS Advanced Electronic Signature) generator.
-
-
SUPPORTED FORMATS
-Following CAdES formats is supported by this library.
-
-CAdES-BES - CAdES Basic Electronic Signature
-CAdES-EPES - CAdES Explicit Policy-based Electronic Signature
-CAdES-T - Electronic Signature with Time
-
-
-
-
PROVIDED ATTRIBUTE CLASSES
-
-NOTE: Currntly CAdES-C is not supported since parser can't
-handle unsigned attribute.
-
-
OTHER CLASSES
-
-
-
GENERATE CAdES-BES
-To generate CAdES-BES, KJUR.asn.cades namespace
-classes are not required and already KJUR.asn.cms namespace
-provides attributes for CAdES-BES.
-Create
KJUR.asn1.cms.SignedData with following
-mandatory attribute in CAdES-BES:
-
-CMSUtil.newSignedData method is very useful to generate CAdES-BES.
-
-sd = KJUR.asn1.cms.CMSUtil.newSignedData({
- content: {str: "aaa"},
- certs: [certPEM],
- signerInfos: [{
- hashAlg: 'sha256',
- sAttr: {SigningCertificateV2: {array: [certPEM]}},
- signerCert: certPEM,
- sigAlg: 'SHA256withRSA',
- signerPrvKey: pkcs8PrvKeyPEM
- }]
-});
-signedDataHex = sd.getContentInfoEncodedHex();
-
-NOTE: ContentType and MessageDigest signed attributes
-are automatically added by default.
-
-
GENERATE CAdES-BES with multiple signers
-If you need signature by multiple signers, you can
-specify one or more items in 'signerInfos' property as below.
-
-sd = KJUR.asn1.cms.CMSUtil.newSignedData({
- content: {str: "aaa"},
- certs: [certPEM1, certPEM2],
- signerInfos: [{
- hashAlg: 'sha256',
- sAttr: {SigningCertificateV2: {array: [certPEM1]}},
- signerCert: certPEM1,
- sigAlg: 'SHA256withRSA',
- signerPrvKey: pkcs8PrvKeyPEM1
- },{
- hashAlg: 'sha1',
- sAttr: {SigningCertificateV2: {array: [certPEM2]}},
- signerCert: certPEM2,
- sigAlg: 'SHA1withRSA',
- signerPrvKey: pkcs8PrvKeyPEM2
- }]
-});
-signedDataHex = sd.getContentInfoEncodedHex();
-
-
-
GENERATE CAdES-EPES
-When you need a CAdES-EPES signature,
-you just need to add 'SignaturePolicyIdentifier'
-attribute as below.
-
-sd = KJUR.asn1.cms.CMSUtil.newSignedData({
- content: {str: "aaa"},
- certs: [certPEM],
- signerInfos: [{
- hashAlg: 'sha256',
- sAttr: {
- SigningCertificateV2: {array: [certPEM]},
- SignaturePolicyIdentifier: {
- oid: '1.2.3.4.5',
- hash: {alg: 'sha1', hash: 'b1b2b3b4b...'}
- },
- },
- signerCert: certPEM,
- sigAlg: 'SHA256withRSA',
- signerPrvKey: pkcs8PrvKeyPEM
- }]
-});
-signedDataHex = sd.getContentInfoEncodedHex();
-
-
-
GENERATE CAdES-T
-After a signed CAdES-BES or CAdES-EPES signature have been generated,
-you can generate CAdES-T by adding SigningTimeStamp unsigned attribute.
-
-beshex = "30..."; // hex of CAdES-BES or EPES data
-info = KJUR.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned(beshex);
-// You can refer a hexadecimal string of signature value
-// in the first signerInfo in the CAdES-BES/EPES with a variable:
-// 'info.si[0].sigval'. You need to get RFC 3161 TimeStampToken
-// from a trusted time stamp authority. Otherwise you can also
-// get it by 'KJUR.asn1.tsp' module. We suppose that we could
-// get proper time stamp.
-tsthex0 = "30..."; // hex of TimeStampToken for signerInfo[0] sigval
-si0 = info.obj.signerInfoList[0];
-si0.addUnsigned(new KJUR.asn1.cades.SignatureTimeStamp({tst: tsthex0});
-esthex = info.obj.getContentInfoEncodedHex(); // CAdES-T
-
-
-
-
SAMPLE CODES
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.cades. getEncodedHex ()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.cades. setByCertPEM (certPEM)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- certPEM
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.cms.Attribute.html b/jwt/api/symbols/KJUR.asn1.cms.Attribute.html
deleted file mode 100644
index 5ed08d2..0000000
--- a/jwt/api/symbols/KJUR.asn1.cms.Attribute.html
+++ /dev/null
@@ -1,557 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.cms.Attribute
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.cms.Attribute
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- Attribute class for base of CMS attribute
-
-
- Defined in: asn1cms-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- Attribute class for base of CMS attribute
-
-Attributes ::= SET OF Attribute
-Attribute ::= SEQUENCE {
- type OBJECT IDENTIFIER,
- values AttributeSetValue }
-AttributeSetValue ::= SET OF ANY
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.cms.Attribute (params)
-
-
-
- Attribute class for base of CMS attribute
-
-Attributes ::= SET OF Attribute
-Attribute ::= SEQUENCE {
- type OBJECT IDENTIFIER,
- values AttributeSetValue }
-AttributeSetValue ::= SET OF ANY
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.2.4 asn1cms 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.cms.AttributeList.html b/jwt/api/symbols/KJUR.asn1.cms.AttributeList.html
deleted file mode 100644
index 1978975..0000000
--- a/jwt/api/symbols/KJUR.asn1.cms.AttributeList.html
+++ /dev/null
@@ -1,565 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.cms.AttributeList
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.cms.AttributeList
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for Attributes ASN.1 structure for CMS
-
-
- Defined in: asn1cms-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for Attributes ASN.1 structure for CMS
-
-Attributes ::= SET OF Attribute
-Attribute ::= SEQUENCE {
- type OBJECT IDENTIFIER,
- values AttributeSetValue }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.cms.AttributeList (params)
-
-
-
- class for Attributes ASN.1 structure for CMS
-
-Attributes ::= SET OF Attribute
-Attribute ::= SEQUENCE {
- type OBJECT IDENTIFIER,
- values AttributeSetValue }
-
-
-
-
-
-
-
// specify by X500Name and DERInteger
-o = new KJUR.asn1.cms.AttributeList({sorted: false}); // ASN.1 BER unsorted SET OF
-o = new KJUR.asn1.cms.AttributeList(); // ASN.1 DER sorted by default
-o.clear(); // clear list of Attributes
-n = o.length(); // get number of Attribute
-o.add(new KJUR.asn1.cms.SigningTime()); // add SigningTime attribute
-hex = o.getEncodedHex(); // get hex encoded ASN.1 data
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.2.4 asn1cms 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.cms.CMSUtil.html b/jwt/api/symbols/KJUR.asn1.cms.CMSUtil.html
deleted file mode 100644
index c9871be..0000000
--- a/jwt/api/symbols/KJUR.asn1.cms.CMSUtil.html
+++ /dev/null
@@ -1,612 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.cms.CMSUtil
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.cms.CMSUtil
-
-
-
-
-
-
-
- CMS utilities class
-
-
- Defined in: asn1cms-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- CMS utiliteis class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- generate SignedData object specified by JSON parameters
-This method provides more easy way to genereate
-CMS SignedData ASN.1 structure by JSON data.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.cms.CMSUtil ()
-
-
-
- CMS utiliteis class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
-
- generate SignedData object specified by JSON parameters
-This method provides more easy way to genereate
-CMS SignedData ASN.1 structure by JSON data.
-
-
-
-
-
-
-
var sd = KJUR.asn1.cms.CMSUtil.newSignedData({
- content: {str: "jsrsasign"},
- certs: [certPEM],
- signerInfos: [{
- hashAlg: 'sha256',
- sAttr: {
- SigningTime: {}
- SigningCertificateV2: {array: [certPEM]},
- },
- signerCert: certPEM,
- sigAlg: 'SHA256withRSA',
- signerPrvKey: prvPEM
- }]
-});
-
-
-
-
-
- Parameters:
-
-
- {Array} param
-
-
- JSON parameter to generate CMS SignedData
-
-
-
-
-
-
-
-
- Returns:
-
- {KJUR.asn1.cms.SignedData } object just generated
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.cms.ContentInfo.html b/jwt/api/symbols/KJUR.asn1.cms.ContentInfo.html
deleted file mode 100644
index 707e60d..0000000
--- a/jwt/api/symbols/KJUR.asn1.cms.ContentInfo.html
+++ /dev/null
@@ -1,562 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.cms.ContentInfo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.cms.ContentInfo
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for ContentInfo ASN.1 structure for CMS
-
-
- Defined in: asn1cms-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for ContentInfo ASN.1 structure for CMS
-
-ContentInfo ::= SEQUENCE {
- contentType ContentType,
- content [0] EXPLICIT ANY DEFINED BY contentType }
-ContentType ::= OBJECT IDENTIFIER
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.cms.ContentInfo (params)
-
-
-
- class for ContentInfo ASN.1 structure for CMS
-
-ContentInfo ::= SEQUENCE {
- contentType ContentType,
- content [0] EXPLICIT ANY DEFINED BY contentType }
-ContentType ::= OBJECT IDENTIFIER
-
-
-
-
-
-
-
a = [new KJUR.asn1.DERInteger({int: 1}),
- new KJUR.asn1.DERInteger({int: 2})];
-seq = new KJUR.asn1.DERSequence({array: a});
-o = new KJUR.asn1.cms.ContentInfo({type: 'data', obj: seq});
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.2.4 asn1cms 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.cms.ContentType.html b/jwt/api/symbols/KJUR.asn1.cms.ContentType.html
deleted file mode 100644
index 49a390a..0000000
--- a/jwt/api/symbols/KJUR.asn1.cms.ContentType.html
+++ /dev/null
@@ -1,562 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.cms.ContentType
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.cms.ContentType
-
-
-
-
-
- Extends
- KJUR.asn1.cms.Attribute .
-
-
- class for CMS ContentType attribute
-
-
- Defined in: asn1cms-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for CMS ContentType attribute
-
-Attribute ::= SEQUENCE {
- type OBJECT IDENTIFIER,
- values AttributeSetValue }
-AttributeSetValue ::= SET OF ANY
-ContentType ::= OBJECT IDENTIFIER
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.cms.ContentType (params)
-
-
-
- class for CMS ContentType attribute
-
-Attribute ::= SEQUENCE {
- type OBJECT IDENTIFIER,
- values AttributeSetValue }
-AttributeSetValue ::= SET OF ANY
-ContentType ::= OBJECT IDENTIFIER
-
-
-
-
-
-
-
o = new KJUR.asn1.cms.ContentType({name: 'data'});
-o = new KJUR.asn1.cms.ContentType({oid: '1.2.840.113549.1.9.16.1.4'});
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.2.4 asn1cms 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.cms.EncapsulatedContentInfo.html b/jwt/api/symbols/KJUR.asn1.cms.EncapsulatedContentInfo.html
deleted file mode 100644
index 21b45da..0000000
--- a/jwt/api/symbols/KJUR.asn1.cms.EncapsulatedContentInfo.html
+++ /dev/null
@@ -1,565 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.cms.EncapsulatedContentInfo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.cms.EncapsulatedContentInfo
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for EncapsulatedContentInfo ASN.1 structure for CMS
-
-
- Defined in: asn1cms-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for EncapsulatedContentInfo ASN.1 structure for CMS
-
-EncapsulatedContentInfo ::= SEQUENCE {
- eContentType ContentType,
- eContent [0] EXPLICIT OCTET STRING OPTIONAL }
-ContentType ::= OBJECT IDENTIFIER
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.cms.EncapsulatedContentInfo (params)
-
-
-
- class for EncapsulatedContentInfo ASN.1 structure for CMS
-
-EncapsulatedContentInfo ::= SEQUENCE {
- eContentType ContentType,
- eContent [0] EXPLICIT OCTET STRING OPTIONAL }
-ContentType ::= OBJECT IDENTIFIER
-
-
-
-
-
-
-
o = new KJUR.asn1.cms.EncapsulatedContentInfo();
-o.setContentType('1.2.3.4.5'); // specify eContentType by OID
-o.setContentType('data'); // specify eContentType by name
-o.setContentValueHex('a1a2a4...'); // specify eContent data by hex string
-o.setContentValueStr('apple'); // specify eContent data by UTF-8 string
-// for detached contents (i.e. data not concluded in eContent)
-o.isDetached = true; // false as default
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.2.4 asn1cms 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.cms.IssuerAndSerialNumber.html b/jwt/api/symbols/KJUR.asn1.cms.IssuerAndSerialNumber.html
deleted file mode 100644
index 818304b..0000000
--- a/jwt/api/symbols/KJUR.asn1.cms.IssuerAndSerialNumber.html
+++ /dev/null
@@ -1,564 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.cms.IssuerAndSerialNumber
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.cms.IssuerAndSerialNumber
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for CMS IssuerAndSerialNumber ASN.1 structure for CMS
-
-
- Defined in: asn1cms-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for IssuerAndSerialNumber ASN.1 structure for CMS
-
-IssuerAndSerialNumber ::= SEQUENCE {
- issuer Name,
- serialNumber CertificateSerialNumber }
-CertificateSerialNumber ::= INTEGER
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.cms.IssuerAndSerialNumber (params)
-
-
-
- class for IssuerAndSerialNumber ASN.1 structure for CMS
-
-IssuerAndSerialNumber ::= SEQUENCE {
- issuer Name,
- serialNumber CertificateSerialNumber }
-CertificateSerialNumber ::= INTEGER
-
-
-
-
-
-
-
// specify by X500Name and DERInteger
-o = new KJUR.asn1.cms.IssuerAndSerialNumber(
- {issuer: {str: '/C=US/O=T1'}, serial {int: 3}});
-// specify by PEM certificate
-o = new KJUR.asn1.cms.IssuerAndSerialNumber({cert: certPEM});
-o = new KJUR.asn1.cms.IssuerAndSerialNumber(certPEM); // since 1.0.3
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.2.4 asn1cms 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.cms.MessageDigest.html b/jwt/api/symbols/KJUR.asn1.cms.MessageDigest.html
deleted file mode 100644
index 9f205f5..0000000
--- a/jwt/api/symbols/KJUR.asn1.cms.MessageDigest.html
+++ /dev/null
@@ -1,561 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.cms.MessageDigest
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.cms.MessageDigest
-
-
-
-
-
- Extends
- KJUR.asn1.cms.Attribute .
-
-
- class for CMS MessageDigest attribute
-
-
- Defined in: asn1cms-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for CMS MessageDigest attribute
-
-Attribute ::= SEQUENCE {
- type OBJECT IDENTIFIER,
- values AttributeSetValue }
-AttributeSetValue ::= SET OF ANY
-MessageDigest ::= OCTET STRING
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.cms.MessageDigest (params)
-
-
-
- class for CMS MessageDigest attribute
-
-Attribute ::= SEQUENCE {
- type OBJECT IDENTIFIER,
- values AttributeSetValue }
-AttributeSetValue ::= SET OF ANY
-MessageDigest ::= OCTET STRING
-
-
-
-
-
-
-
o = new KJUR.asn1.cms.MessageDigest({hex: 'a1a2a3a4...'});
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.2.4 asn1cms 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.cms.SignedData.html b/jwt/api/symbols/KJUR.asn1.cms.SignedData.html
deleted file mode 100644
index dbd3c4a..0000000
--- a/jwt/api/symbols/KJUR.asn1.cms.SignedData.html
+++ /dev/null
@@ -1,583 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.cms.SignedData
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.cms.SignedData
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for Attributes ASN.1 structure of CMS SigndData
-
-
- Defined in: asn1cms-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for SignerInfo ASN.1 structure of CMS SignedData
-
-SignedData ::= SEQUENCE {
- version CMSVersion,
- digestAlgorithms DigestAlgorithmIdentifiers,
- encapContentInfo EncapsulatedContentInfo,
- certificates [0] IMPLICIT CertificateSet OPTIONAL,
- crls [1] IMPLICIT RevocationInfoChoices OPTIONAL,
- signerInfos SignerInfos }
-SignerInfos ::= SET OF SignerInfo
-CertificateSet ::= SET OF CertificateChoices
-DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier
-CertificateSet ::= SET OF CertificateChoices
-RevocationInfoChoices ::= SET OF RevocationInfoChoice
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.cms.SignedData (params)
-
-
-
- class for SignerInfo ASN.1 structure of CMS SignedData
-
-SignedData ::= SEQUENCE {
- version CMSVersion,
- digestAlgorithms DigestAlgorithmIdentifiers,
- encapContentInfo EncapsulatedContentInfo,
- certificates [0] IMPLICIT CertificateSet OPTIONAL,
- crls [1] IMPLICIT RevocationInfoChoices OPTIONAL,
- signerInfos SignerInfos }
-SignerInfos ::= SET OF SignerInfo
-CertificateSet ::= SET OF CertificateChoices
-DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier
-CertificateSet ::= SET OF CertificateChoices
-RevocationInfoChoices ::= SET OF RevocationInfoChoice
-
-
-
-
-
-
-
sd = new KJUR.asn1.cms.SignedData();
-sd.dEncapContentInfo.setContentValueStr("test string");
-sd.signerInfoList[0].setForContentAndHash({sdObj: sd,
- eciObj: sd.dEncapContentInfo,
- hashAlg: 'sha256'});
-sd.signerInfoList[0].dSignedAttrs.add(new KJUR.asn1.cms.SigningTime());
-sd.signerInfoList[0].setSignerIdentifier(certPEM);
-sd.signerInfoList[0].sign(prvP8PEM, "SHA256withRSA");
-hex = sd.getContentInfoEncodedHex();
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.2.4 asn1cms 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.cms.SignerInfo.html b/jwt/api/symbols/KJUR.asn1.cms.SignerInfo.html
deleted file mode 100644
index 515cfdb..0000000
--- a/jwt/api/symbols/KJUR.asn1.cms.SignerInfo.html
+++ /dev/null
@@ -1,657 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.cms.SignerInfo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.cms.SignerInfo
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for Attributes ASN.1 structure of CMS SigndData
-
-
- Defined in: asn1cms-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for SignerInfo ASN.1 structure of CMS SignedData
-
-SignerInfo ::= SEQUENCE {
- version CMSVersion,
- sid SignerIdentifier,
- digestAlgorithm DigestAlgorithmIdentifier,
- signedAttrs [0] IMPLICIT SignedAttributes OPTIONAL,
- signatureAlgorithm SignatureAlgorithmIdentifier,
- signature SignatureValue,
- unsignedAttrs [1] IMPLICIT UnsignedAttributes OPTIONAL }
-
-
-
-
-
-
-
-
-
-
-
-
- Field Summary
-
-
- Field Attributes
- Field Name and Description
-
-
-
-
-
- <static>
-
-
- set ContentType/MessageDigest/DigestAlgorithms for SignerInfo/SignedData
-This method will specify following fields by a parameters:
-
-add ContentType signed attribute by encapContentInfo
-add MessageDigest signed attribute by encapContentInfo and hashAlg
-add a hash algorithm used in MessageDigest to digestAlgorithms field of SignedData
-set a hash algorithm used in MessageDigest to digestAlgorithm field of SignerInfo
-
-Argument 'params' is an associative array having following elements:
-
-some of elements can be omited.
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.cms.SignerInfo (params)
-
-
-
- class for SignerInfo ASN.1 structure of CMS SignedData
-
-SignerInfo ::= SEQUENCE {
- version CMSVersion,
- sid SignerIdentifier,
- digestAlgorithm DigestAlgorithmIdentifier,
- signedAttrs [0] IMPLICIT SignedAttributes OPTIONAL,
- signatureAlgorithm SignatureAlgorithmIdentifier,
- signature SignatureValue,
- unsignedAttrs [1] IMPLICIT UnsignedAttributes OPTIONAL }
-
-
-
-
-
-
-
o = new KJUR.asn1.cms.SignerInfo();
-o.setSignerIdentifier(certPEMstring);
-o.dSignedAttrs.add(new KJUR.asn1.cms.ContentType({name: 'data'}));
-o.dSignedAttrs.add(new KJUR.asn1.cms.MessageDigest({hex: 'a1b2...'}));
-o.dSignedAttrs.add(new KJUR.asn1.cms.SigningTime());
-o.sign(privteKeyParam, "SHA1withRSA");
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.2.4 asn1cms 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
- Field Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.cms.SignerInfo. setForContentAndHash
-
-
-
- set ContentType/MessageDigest/DigestAlgorithms for SignerInfo/SignedData
-This method will specify following fields by a parameters:
-
-add ContentType signed attribute by encapContentInfo
-add MessageDigest signed attribute by encapContentInfo and hashAlg
-add a hash algorithm used in MessageDigest to digestAlgorithms field of SignedData
-set a hash algorithm used in MessageDigest to digestAlgorithm field of SignerInfo
-
-Argument 'params' is an associative array having following elements:
-
-some of elements can be omited.
-
-
-
-
-
-
-
sd = new KJUR.asn1.cms.SignedData();
-signerInfo.setForContentAndHash({sdObj: sd,
- eciObj: sd.dEncapContentInfo,
- hashAlg: 'sha256'});
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.cms.SigningCertificate.html b/jwt/api/symbols/KJUR.asn1.cms.SigningCertificate.html
deleted file mode 100644
index 3eb4b93..0000000
--- a/jwt/api/symbols/KJUR.asn1.cms.SigningCertificate.html
+++ /dev/null
@@ -1,577 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.cms.SigningCertificate
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.cms.SigningCertificate
-
-
-
-
-
- Extends
- KJUR.asn1.cms.Attribute .
-
-
- class for CMS SigningCertificate attribute
-
-
- Defined in: asn1cms-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for CMS SigningCertificate attribute
-
-Attribute ::= SEQUENCE {
- type OBJECT IDENTIFIER,
- values AttributeSetValue }
-AttributeSetValue ::= SET OF ANY
-SigningCertificate ::= SEQUENCE {
- certs SEQUENCE OF ESSCertID,
- policies SEQUENCE OF PolicyInformation OPTIONAL }
-ESSCertID ::= SEQUENCE {
- certHash Hash,
- issuerSerial IssuerSerial OPTIONAL }
-IssuerSerial ::= SEQUENCE {
- issuer GeneralNames,
- serialNumber CertificateSerialNumber }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.cms.SigningCertificate (params)
-
-
-
- class for CMS SigningCertificate attribute
-
-Attribute ::= SEQUENCE {
- type OBJECT IDENTIFIER,
- values AttributeSetValue }
-AttributeSetValue ::= SET OF ANY
-SigningCertificate ::= SEQUENCE {
- certs SEQUENCE OF ESSCertID,
- policies SEQUENCE OF PolicyInformation OPTIONAL }
-ESSCertID ::= SEQUENCE {
- certHash Hash,
- issuerSerial IssuerSerial OPTIONAL }
-IssuerSerial ::= SEQUENCE {
- issuer GeneralNames,
- serialNumber CertificateSerialNumber }
-
-
-
-
-
-
-
o = new KJUR.asn1.cms.SigningCertificate({array: [certPEM]});
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.5.1 asn1cms 1.0.1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.cms.SigningCertificateV2.html b/jwt/api/symbols/KJUR.asn1.cms.SigningCertificateV2.html
deleted file mode 100644
index 7924d6d..0000000
--- a/jwt/api/symbols/KJUR.asn1.cms.SigningCertificateV2.html
+++ /dev/null
@@ -1,588 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.cms.SigningCertificateV2
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.cms.SigningCertificateV2
-
-
-
-
-
- Extends
- KJUR.asn1.cms.Attribute .
-
-
- class for CMS SigningCertificateV2 attribute
-
-
- Defined in: asn1cms-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for CMS SigningCertificateV2 attribute
-
-oid-signingCertificateV2 = 1.2.840.113549.1.9.16.2.47
-Attribute ::= SEQUENCE {
- type OBJECT IDENTIFIER,
- values AttributeSetValue }
-AttributeSetValue ::= SET OF ANY
-SigningCertificateV2 ::= SEQUENCE {
- certs SEQUENCE OF ESSCertIDv2,
- policies SEQUENCE OF PolicyInformation OPTIONAL }
-ESSCertIDv2 ::= SEQUENCE {
- hashAlgorithm AlgorithmIdentifier
- DEFAULT {algorithm id-sha256},
- certHash Hash,
- issuerSerial IssuerSerial OPTIONAL }
-Hash ::= OCTET STRING
-IssuerSerial ::= SEQUENCE {
- issuer GeneralNames,
- serialNumber CertificateSerialNumber }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.cms.SigningCertificateV2 (params)
-
-
-
- class for CMS SigningCertificateV2 attribute
-
-oid-signingCertificateV2 = 1.2.840.113549.1.9.16.2.47
-Attribute ::= SEQUENCE {
- type OBJECT IDENTIFIER,
- values AttributeSetValue }
-AttributeSetValue ::= SET OF ANY
-SigningCertificateV2 ::= SEQUENCE {
- certs SEQUENCE OF ESSCertIDv2,
- policies SEQUENCE OF PolicyInformation OPTIONAL }
-ESSCertIDv2 ::= SEQUENCE {
- hashAlgorithm AlgorithmIdentifier
- DEFAULT {algorithm id-sha256},
- certHash Hash,
- issuerSerial IssuerSerial OPTIONAL }
-Hash ::= OCTET STRING
-IssuerSerial ::= SEQUENCE {
- issuer GeneralNames,
- serialNumber CertificateSerialNumber }
-
-
-
-
-
-
-
// hash algorithm is sha256 by default:
-o = new KJUR.asn1.cms.SigningCertificateV2({array: [certPEM]});
-o = new KJUR.asn1.cms.SigningCertificateV2({array: [certPEM],
- hashAlg: 'sha512'});
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.5.1 asn1cms 1.0.1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.cms.SigningTime.html b/jwt/api/symbols/KJUR.asn1.cms.SigningTime.html
deleted file mode 100644
index 776d4e5..0000000
--- a/jwt/api/symbols/KJUR.asn1.cms.SigningTime.html
+++ /dev/null
@@ -1,570 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.cms.SigningTime
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.cms.SigningTime
-
-
-
-
-
- Extends
- KJUR.asn1.cms.Attribute .
-
-
- class for CMS SigningTime attribute
-
-
- Defined in: asn1cms-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for CMS SigningTime attribute
-
-Attribute ::= SEQUENCE {
- type OBJECT IDENTIFIER,
- values AttributeSetValue }
-AttributeSetValue ::= SET OF ANY
-SigningTime ::= Time
-Time ::= CHOICE {
- utcTime UTCTime,
- generalTime GeneralizedTime }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.cms.SigningTime (params)
-
-
-
- class for CMS SigningTime attribute
-
-Attribute ::= SEQUENCE {
- type OBJECT IDENTIFIER,
- values AttributeSetValue }
-AttributeSetValue ::= SET OF ANY
-SigningTime ::= Time
-Time ::= CHOICE {
- utcTime UTCTime,
- generalTime GeneralizedTime }
-
-
-
-
-
-
-
o = new KJUR.asn1.cms.SigningTime(); // current time UTCTime by default
-o = new KJUR.asn1.cms.SigningTime({type: 'gen'}); // current time GeneralizedTime
-o = new KJUR.asn1.cms.SigningTime({str: '20140517093800Z'}); // specified GeneralizedTime
-o = new KJUR.asn1.cms.SigningTime({str: '140517093800Z'}); // specified UTCTime
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.2.4 asn1cms 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.cms.html b/jwt/api/symbols/KJUR.asn1.cms.html
deleted file mode 100644
index cc5ea0a..0000000
--- a/jwt/api/symbols/KJUR.asn1.cms.html
+++ /dev/null
@@ -1,697 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.cms
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Namespace KJUR.asn1.cms
-
-
-
-
-
-
-
-
-
-
- Defined in: asn1cms-1.0.js .
-
-
-
-
-
-
- Namespace Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
- KJUR.asn1.cms.getEncodedHex ()
-
-
-
-
-
-
- <static>
-
- KJUR.asn1.cms.setCerts (listPEM)
-
-
-
-
-
-
- <static>
-
- KJUR.asn1.cms.setContentType (nameOrOid)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Namespace Detail
-
-
-
- KJUR.asn1.cms
-
-
-
- kjur's ASN.1 class for Cryptographic Message Syntax(CMS)
-
-This name space provides
-RFC 5652
-Cryptographic Message Syntax (CMS) SignedData generator.
-
-
FEATURES
-
-easily generate CMS SignedData
-APIs are very similar to BouncyCastle library ASN.1 classes. So easy to learn.
-
-
-
PROVIDED CLASSES
-
-NOTE: Please ignore method summary and document of this namespace.
-This caused by a bug of jsdoc2.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.cms. getEncodedHex ()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.cms. setCerts (listPEM)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- listPEM
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.cms. setContentType (nameOrOid)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- nameOrOid
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.csr.CSRUtil.html b/jwt/api/symbols/KJUR.asn1.csr.CSRUtil.html
deleted file mode 100644
index 19a1af8..0000000
--- a/jwt/api/symbols/KJUR.asn1.csr.CSRUtil.html
+++ /dev/null
@@ -1,631 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.csr.CSRUtil
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.csr.CSRUtil
-
-
-
-
-
-
-
- Certification Request (CSR/PKCS#10) utilities class
-
-
- Defined in: asn1csr-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- Certification Request (CSR/PKCS#10) utilities class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- generate a PEM format of CSR/PKCS#10 certificate signing request
-This method can generate a CSR certificate signing
-request by a simple JSON object which has following parameters:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.csr.CSRUtil ()
-
-
-
- Certification Request (CSR/PKCS#10) utilities class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.csr.CSRUtil. newCSRPEM (param)
-
-
-
- generate a PEM format of CSR/PKCS#10 certificate signing request
-This method can generate a CSR certificate signing
-request by a simple JSON object which has following parameters:
-
-
-
-
-
-
-
-
// 1) by key object
-pem = KJUR.asn1.csr.CSRUtil.newCSRPEM({
- subject: {str: '/C=US/O=Test/CN=example.com'},
- sbjpubkey: pubKeyObj,
- sigalg: "SHA256withRSA",
- sbjprvkey: prvKeyObj
-});
-
-// 2) by private/public key PEM
-pem = KJUR.asn1.csr.CSRUtil.newCSRPEM({
- subject: {str: '/C=US/O=Test/CN=example.com'},
- sbjpubkey: pubKeyPEM,
- sigalg: "SHA256withRSA",
- sbjprvkey: prvKeyPEM
-});
-
-// 3) with generateKeypair
-kp = KEYUTIL.generateKeypair("RSA", 2048);
-pem = KJUR.asn1.csr.CSRUtil.newCSRPEM({
- subject: {str: '/C=US/O=Test/CN=example.com'},
- sbjpubkey: kp.pubKeyObj,
- sigalg: "SHA256withRSA",
- sbjprvkey: kp.prvKeyObj
-});
-
-
-
-
-
- Parameters:
-
-
- {Array} param
-
-
- parameter to generate CSR
-
-
-
-
-
-
- Since:
- jsrsasign 4.8.7 asn1csr 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.csr.CertificationRequest.html b/jwt/api/symbols/KJUR.asn1.csr.CertificationRequest.html
deleted file mode 100644
index 07b947b..0000000
--- a/jwt/api/symbols/KJUR.asn1.csr.CertificationRequest.html
+++ /dev/null
@@ -1,685 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.csr.CertificationRequest
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.csr.CertificationRequest
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- ASN.1 CertificationRequest structure class
-
-
- Defined in: asn1csr-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- ASN.1 CertificationRequest structure class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- get PEM formatted certificate signing request (CSR/PKCS#10)
-This method is to a get CSR PEM string after signed.
-
-
-
-
- <static>
-
- KJUR.asn1.csr.CertificationRequest.
sign ()
-
- sign CertificationRequest and set signature value internally
-This method self-signs CertificateRequestInfo with a subject's
-private key and set signature value internally.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.csr.CertificationRequest (params)
-
-
-
- ASN.1 CertificationRequest structure class
-
-
-
-
-
-
-
csri = new KJUR.asn1.csr.CertificationRequestInfo();
-csri.setSubjectByParam({'str': '/C=US/O=Test/CN=example.com'});
-csri.setSubjectPublicKeyByGetKey(pubKeyObj);
-csr = new KJUR.asn1.csr.CertificationRequest({'csrinfo': csri});
-csr.sign("SHA256withRSA", prvKeyObj);
-pem = csr.getPEMString();
-
-// -- DEFINITION OF ASN.1 SYNTAX --
-// CertificationRequest ::= SEQUENCE {
-// certificationRequestInfo CertificationRequestInfo,
-// signatureAlgorithm AlgorithmIdentifier{{ SignatureAlgorithms }},
-// signature BIT STRING }
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {})
-
-
-
-
-
-
- Since:
- jsrsasign 4.8.7 asn1csr 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.csr.CertificationRequest. getPEMString ()
-
-
-
- get PEM formatted certificate signing request (CSR/PKCS#10)
-This method is to a get CSR PEM string after signed.
-
-
-
-
-
-
-
-
csr = new KJUR.asn1.csr.CertificationRequest({'csrinfo': csri});
-csr.sign();
-pem = csr.getPEMString();
-// pem will be following:
-// -----BEGIN CERTIFICATE REQUEST-----
-// MII ...snip...
-// -----END CERTIFICATE REQUEST-----
-
-
-
-
-
-
-
-
-
- Returns:
-
- PEM formatted string of CSR/PKCS#10
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.csr.CertificationRequest. sign ()
-
-
-
- sign CertificationRequest and set signature value internally
-This method self-signs CertificateRequestInfo with a subject's
-private key and set signature value internally.
-
-
-
-
-
-
-
-
csr = new KJUR.asn1.csr.CertificationRequest({'csrinfo': csri});
-csr.sign("SHA256withRSA", prvKeyObj);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.csr.CertificationRequestInfo.html b/jwt/api/symbols/KJUR.asn1.csr.CertificationRequestInfo.html
deleted file mode 100644
index 257cebd..0000000
--- a/jwt/api/symbols/KJUR.asn1.csr.CertificationRequestInfo.html
+++ /dev/null
@@ -1,705 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.csr.CertificationRequestInfo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.csr.CertificationRequestInfo
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- ASN.1 CertificationRequestInfo structure class
-
-
- Defined in: asn1csr-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- ASN.1 CertificationRequestInfo structure class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- set subject name field by parameter
-
-
-
-
-
- <static>
-
-
- set subject public key info by RSA/ECDSA/DSA key parameter
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.csr.CertificationRequestInfo (params)
-
-
-
- ASN.1 CertificationRequestInfo structure class
-
-
-
-
-
-
-
csri = new KJUR.asn1.csr.CertificationRequestInfo();
-csri.setSubjectByParam({'str': '/C=US/O=Test/CN=example.com'});
-csri.setSubjectPublicKeyByGetKey(pubKeyObj);
-
-// -- DEFINITION OF ASN.1 SYNTAX --
-// CertificationRequestInfo ::= SEQUENCE {
-// version INTEGER { v1(0) } (v1,...),
-// subject Name,
-// subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }},
-// attributes [0] Attributes{{ CRIAttributes }} }
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {})
-
-
-
-
-
-
- Since:
- jsrsasign 4.8.7 asn1csr 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.csr.CertificationRequestInfo. setSubjectByParam (x500NameParam)
-
-
-
- set subject name field by parameter
-
-
-
-
-
-
-
-
csri.setSubjectByParam({'str': '/C=US/CN=b'});
-
-
-
-
-
- Parameters:
-
-
- {Array} x500NameParam
-
-
- X500Name parameter
-
-
-
-
-
-
-
-
-
-
- See:
-
- KJUR.asn1.x509.X500Name
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.csr.CertificationRequestInfo. setSubjectPublicKeyByGetKey (keyParam)
-
-
-
- set subject public key info by RSA/ECDSA/DSA key parameter
-
-
-
-
-
-
-
-
csri.setSubjectPublicKeyByGetKeyParam(certPEMString); // or
-csri.setSubjectPublicKeyByGetKeyParam(pkcs8PublicKeyPEMString); // or
-csir.setSubjectPublicKeyByGetKeyParam(kjurCryptoECDSAKeyObject); // et.al.
-
-
-
-
-
- Parameters:
-
-
- {Object} keyParam
-
-
- public key parameter which passed to KEYUTIL.getKey argument
-
-
-
-
-
-
-
-
-
-
- See:
-
- KJUR.asn1.x509.SubjectPublicKeyInfo
-
- KEYUTIL.getKey
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.csr.html b/jwt/api/symbols/KJUR.asn1.csr.html
deleted file mode 100644
index 5726626..0000000
--- a/jwt/api/symbols/KJUR.asn1.csr.html
+++ /dev/null
@@ -1,593 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.csr
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Namespace KJUR.asn1.csr
-
-
-
-
-
-
-
-
-
-
- Defined in: asn1csr-1.0.js .
-
-
-
-
-
-
- Namespace Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- kjur's ASN.1 class for CSR/PKCS#10 name space
-
-This name space is a sub name space for KJUR.asn1 .
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
- KJUR.asn1.csr.getEncodedHex ()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Namespace Detail
-
-
-
- KJUR.asn1.csr
-
-
-
- kjur's ASN.1 class for CSR/PKCS#10 name space
-
-This name space is a sub name space for KJUR.asn1 .
-This name space contains classes for
-RFC 2986
-certificate signing request(CSR/PKCS#10) and its utilities
-to be issued your certificate from certification authorities.
-
PROVIDING ASN.1 STRUCTURES
-
-
PROVIDING UTILITY CLASSES
-
-
KJUR.asn1.csr.CSRUtil.newCSRPEM method is very useful to
-get your certificate signing request (CSR/PKCS#10) file.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.csr. getEncodedHex ()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.html b/jwt/api/symbols/KJUR.asn1.html
deleted file mode 100644
index 196aa25..0000000
--- a/jwt/api/symbols/KJUR.asn1.html
+++ /dev/null
@@ -1,886 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Namespace KJUR.asn1
-
-
-
-
-
-
-
-
-
-
- Defined in: asn1-1.0.js .
-
-
-
-
-
-
- Namespace Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- kjur's ASN.1 class library name space
-
-This is ITU-T X.690 ASN.1 DER encoder class library and
-class structure and methods is very similar to
-org.bouncycastle.asn1 package of
-well known BouncyCaslte Cryptography Library.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
- KJUR.asn1.getFreshValueHex ()
-
-
-
-
-
-
- <static>
-
- KJUR.asn1.getString ()
-
-
-
-
-
-
- <static>
-
- KJUR.asn1.setByBigInteger (bigIntegerValue)
-
-
-
-
-
-
- <static>
-
- KJUR.asn1.setByDate (dateObject)
-
-
-
-
-
-
- <static>
-
- KJUR.asn1.setByInteger (intValue)
-
-
-
-
-
-
- <static>
-
- KJUR.asn1.setString (newS)
-
-
-
-
-
-
- <static>
-
- KJUR.asn1.setValueHex (newHexString)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Namespace Detail
-
-
-
- KJUR.asn1
-
-
-
- kjur's ASN.1 class library name space
-
-This is ITU-T X.690 ASN.1 DER encoder class library and
-class structure and methods is very similar to
-org.bouncycastle.asn1 package of
-well known BouncyCaslte Cryptography Library.
-
PROVIDING ASN.1 PRIMITIVES
-Here are ASN.1 DER primitive classes.
-
-
OTHER ASN.1 CLASSES
-
-
SUB NAME SPACES
-
-
-NOTE: Please ignore method summary and document of this namespace.
-This caused by a bug of jsdoc2.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1. getFreshValueHex ()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1. getString ()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1. setByBigInteger (bigIntegerValue)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- bigIntegerValue
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1. setByDate (dateObject)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- dateObject
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1. setByInteger (intValue)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- intValue
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1. setString (newS)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- newS
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1. setValueHex (newHexString)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- newHexString
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.tsp.AbstractTSAAdapter.html b/jwt/api/symbols/KJUR.asn1.tsp.AbstractTSAAdapter.html
deleted file mode 100644
index 8279d06..0000000
--- a/jwt/api/symbols/KJUR.asn1.tsp.AbstractTSAAdapter.html
+++ /dev/null
@@ -1,534 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.tsp.AbstractTSAAdapter
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.tsp.AbstractTSAAdapter
-
-
-
-
-
-
-
- abstract class for TimeStampToken generator
-
-
- Defined in: asn1tsp-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- abstract class for TimeStampToken generator
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.tsp.AbstractTSAAdapter (params)
-
-
-
- abstract class for TimeStampToken generator
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.7.0 asn1tsp 1.0.1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.tsp.Accuracy.html b/jwt/api/symbols/KJUR.asn1.tsp.Accuracy.html
deleted file mode 100644
index 9e0680d..0000000
--- a/jwt/api/symbols/KJUR.asn1.tsp.Accuracy.html
+++ /dev/null
@@ -1,559 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.tsp.Accuracy
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.tsp.Accuracy
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for TSP Accuracy ASN.1 object
-
-
- Defined in: asn1tsp-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for TSP Accuracy ASN.1 object
-
-Accuracy ::= SEQUENCE {
- seconds INTEGER OPTIONAL,
- millis [0] INTEGER (1.
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.tsp.Accuracy (params)
-
-
-
- class for TSP Accuracy ASN.1 object
-
-Accuracy ::= SEQUENCE {
- seconds INTEGER OPTIONAL,
- millis [0] INTEGER (1..999) OPTIONAL,
- micros [1] INTEGER (1..999) OPTIONAL }
-
-
-
-
-
-
-
o = new KJUR.asn1.tsp.Accuracy({seconds: 1,
- millis: 500,
- micros: 500});
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.6.0 asn1tsp 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.tsp.FixedTSAAdapter.html b/jwt/api/symbols/KJUR.asn1.tsp.FixedTSAAdapter.html
deleted file mode 100644
index 78ebb68..0000000
--- a/jwt/api/symbols/KJUR.asn1.tsp.FixedTSAAdapter.html
+++ /dev/null
@@ -1,544 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.tsp.FixedTSAAdapter
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.tsp.FixedTSAAdapter
-
-
-
-
-
-
-
- class for fixed TimeStampToken generator
-
-
- Defined in: asn1tsp-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for fixed TimeStampToken generator
-This class generates fixed TimeStampToken except messageImprint
-for testing purpose.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.tsp.FixedTSAAdapter (params)
-
-
-
- class for fixed TimeStampToken generator
-This class generates fixed TimeStampToken except messageImprint
-for testing purpose.
-General TSA generates TimeStampToken which varies following
-fields:
-
-genTime
-serialNumber
-nonce
-
-Those values are provided by initial parameters.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.7.0 asn1tsp 1.0.1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.tsp.MessageImprint.html b/jwt/api/symbols/KJUR.asn1.tsp.MessageImprint.html
deleted file mode 100644
index 90553ee..0000000
--- a/jwt/api/symbols/KJUR.asn1.tsp.MessageImprint.html
+++ /dev/null
@@ -1,558 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.tsp.MessageImprint
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.tsp.MessageImprint
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for TSP MessageImprint ASN.1 object
-
-
- Defined in: asn1tsp-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for TSP MessageImprint ASN.1 object
-
-MessageImprint ::= SEQUENCE {
- hashAlgorithm AlgorithmIdentifier,
- hashedMessage OCTET STRING }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.tsp.MessageImprint (params)
-
-
-
- class for TSP MessageImprint ASN.1 object
-
-MessageImprint ::= SEQUENCE {
- hashAlgorithm AlgorithmIdentifier,
- hashedMessage OCTET STRING }
-
-
-
-
-
-
-
o = new KJUR.asn1.tsp.MessageImprint({hashAlg: 'sha1',
- hashValue: '1f3dea...'});
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.6.0 asn1tsp 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.tsp.PKIFailureInfo.html b/jwt/api/symbols/KJUR.asn1.tsp.PKIFailureInfo.html
deleted file mode 100644
index da237c1..0000000
--- a/jwt/api/symbols/KJUR.asn1.tsp.PKIFailureInfo.html
+++ /dev/null
@@ -1,565 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.tsp.PKIFailureInfo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.tsp.PKIFailureInfo
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for TSP PKIFailureInfo ASN.1 object
-
-
- Defined in: asn1tsp-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for TSP PKIFailureInfo ASN.1 object
-
-PKIFailureInfo ::= BIT STRING {
- badAlg (0),
- badRequest (2),
- badDataFormat (5),
- timeNotAvailable (14),
- unacceptedPolicy (15),
- unacceptedExtension (16),
- addInfoNotAvailable (17),
- systemFailure (25) }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.tsp.PKIFailureInfo (params)
-
-
-
- class for TSP PKIFailureInfo ASN.1 object
-
-PKIFailureInfo ::= BIT STRING {
- badAlg (0),
- badRequest (2),
- badDataFormat (5),
- timeNotAvailable (14),
- unacceptedPolicy (15),
- unacceptedExtension (16),
- addInfoNotAvailable (17),
- systemFailure (25) }
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.6.0 asn1tsp 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.tsp.PKIFreeText.html b/jwt/api/symbols/KJUR.asn1.tsp.PKIFreeText.html
deleted file mode 100644
index bfa0560..0000000
--- a/jwt/api/symbols/KJUR.asn1.tsp.PKIFreeText.html
+++ /dev/null
@@ -1,550 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.tsp.PKIFreeText
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.tsp.PKIFreeText
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for TSP PKIFreeText ASN.1 object
-
-
- Defined in: asn1tsp-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for TSP PKIFreeText ASN.1 object
-
-PKIFreeText ::= SEQUENCE {
- SIZE (1.
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.tsp.PKIFreeText (params)
-
-
-
- class for TSP PKIFreeText ASN.1 object
-
-PKIFreeText ::= SEQUENCE {
- SIZE (1..MAX) OF UTF8String }
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.6.0 asn1tsp 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.tsp.PKIStatus.html b/jwt/api/symbols/KJUR.asn1.tsp.PKIStatus.html
deleted file mode 100644
index f1c5385..0000000
--- a/jwt/api/symbols/KJUR.asn1.tsp.PKIStatus.html
+++ /dev/null
@@ -1,561 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.tsp.PKIStatus
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.tsp.PKIStatus
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for TSP PKIStatus ASN.1 object
-
-
- Defined in: asn1tsp-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for TSP PKIStatus ASN.1 object
-
-PKIStatus ::= INTEGER {
- granted (0),
- grantedWithMods (1),
- rejection (2),
- waiting (3),
- revocationWarning (4),
- revocationNotification (5) }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.tsp.PKIStatus (params)
-
-
-
- class for TSP PKIStatus ASN.1 object
-
-PKIStatus ::= INTEGER {
- granted (0),
- grantedWithMods (1),
- rejection (2),
- waiting (3),
- revocationWarning (4),
- revocationNotification (5) }
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.6.0 asn1tsp 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.tsp.PKIStatusInfo.html b/jwt/api/symbols/KJUR.asn1.tsp.PKIStatusInfo.html
deleted file mode 100644
index fa73699..0000000
--- a/jwt/api/symbols/KJUR.asn1.tsp.PKIStatusInfo.html
+++ /dev/null
@@ -1,555 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.tsp.PKIStatusInfo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.tsp.PKIStatusInfo
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for TSP PKIStatusInfo ASN.1 object
-
-
- Defined in: asn1tsp-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for TSP PKIStatusInfo ASN.1 object
-
-PKIStatusInfo ::= SEQUENCE {
- status PKIStatus,
- statusString PKIFreeText OPTIONAL,
- failInfo PKIFailureInfo OPTIONAL }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.tsp.PKIStatusInfo (params)
-
-
-
- class for TSP PKIStatusInfo ASN.1 object
-
-PKIStatusInfo ::= SEQUENCE {
- status PKIStatus,
- statusString PKIFreeText OPTIONAL,
- failInfo PKIFailureInfo OPTIONAL }
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.6.0 asn1tsp 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.tsp.SimpleTSAAdapter.html b/jwt/api/symbols/KJUR.asn1.tsp.SimpleTSAAdapter.html
deleted file mode 100644
index 4d10dcd..0000000
--- a/jwt/api/symbols/KJUR.asn1.tsp.SimpleTSAAdapter.html
+++ /dev/null
@@ -1,534 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.tsp.SimpleTSAAdapter
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.tsp.SimpleTSAAdapter
-
-
-
-
-
-
-
- class for simple TimeStampToken generator
-
-
- Defined in: asn1tsp-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for simple TimeStampToken generator
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.tsp.SimpleTSAAdapter (params)
-
-
-
- class for simple TimeStampToken generator
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.7.0 asn1tsp 1.0.1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.tsp.TSPUtil.html b/jwt/api/symbols/KJUR.asn1.tsp.TSPUtil.html
deleted file mode 100644
index 9d66fe4..0000000
--- a/jwt/api/symbols/KJUR.asn1.tsp.TSPUtil.html
+++ /dev/null
@@ -1,726 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.tsp.TSPUtil
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.tsp.TSPUtil
-
-
-
-
-
-
-
- TSP utilities class
-
-
- Defined in: asn1tsp-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- TSP utiliteis class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- generate TimeStampToken ASN.1 object specified by JSON parameters
-
-
-
-
-
- <static>
-
-
- parse hexadecimal string of MessageImprint
-This method parses a hexadecimal string of MessageImprint
-and returns parsed their fields:
-
-
-
-
- <static>
-
-
- parse hexadecimal string of TimeStampReq
-This method parses a hexadecimal string of TimeStampReq
-and returns parsed their fields:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.tsp.TSPUtil ()
-
-
-
- TSP utiliteis class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
-
- generate TimeStampToken ASN.1 object specified by JSON parameters
-
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} param
-
-
- JSON parameter to generate TimeStampToken
-
-
-
-
-
-
-
-
- Returns:
-
- {KJUR.asn1.cms.SignedData } object just generated
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Array}
- KJUR.asn1.tsp.TSPUtil. parseMessageImprint (hexadecimal)
-
-
-
- parse hexadecimal string of MessageImprint
-This method parses a hexadecimal string of MessageImprint
-and returns parsed their fields:
-
-
-
-
-
-
-
var json = KJUR.asn1.tsp.TSPUtil.parseMessageImprint("302602...");
-// resulted DUMP of above 'json':
-{hashAlg: 'sha256', // MessageImprint hashAlg
- hashValue: 'a1a2a3a4...'} // MessageImprint hashValue
-
-
-
-
-
- Parameters:
-
-
- {String} hexadecimal
-
-
- string of MessageImprint
-
-
-
-
-
-
-
-
- Returns:
-
- {Array} JSON object of parsed parameters
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Array}
- KJUR.asn1.tsp.TSPUtil. parseTimeStampReq (hexadecimal)
-
-
-
- parse hexadecimal string of TimeStampReq
-This method parses a hexadecimal string of TimeStampReq
-and returns parsed their fields:
-
-
-
-
-
-
-
var json = KJUR.asn1.tsp.TSPUtil.parseTimeStampReq("302602...");
-// resulted DUMP of above 'json':
-{mi: {hashAlg: 'sha256', // MessageImprint hashAlg
- hashValue: 'a1a2a3a4...'}, // MessageImprint hashValue
- policy: '1.2.3.4.5', // tsaPolicy (OPTION)
- nonce: '9abcf318...', // nonce (OPTION)
- certreq: true} // certReq (OPTION)
-
-
-
-
-
- Parameters:
-
-
- {String} hexadecimal
-
-
- string of TimeStampReq
-
-
-
-
-
-
-
-
- Returns:
-
- {Array} JSON object of parsed parameters
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.tsp.TSTInfo.html b/jwt/api/symbols/KJUR.asn1.tsp.TSTInfo.html
deleted file mode 100644
index 0d43edc..0000000
--- a/jwt/api/symbols/KJUR.asn1.tsp.TSTInfo.html
+++ /dev/null
@@ -1,581 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.tsp.TSTInfo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.tsp.TSTInfo
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for TSP TSTInfo ASN.1 object
-
-
- Defined in: asn1tsp-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for TSP TSTInfo ASN.1 object
-
-TSTInfo ::= SEQUENCE {
- version INTEGER { v1(1) },
- policy TSAPolicyId,
- messageImprint MessageImprint,
- serialNumber INTEGER, -- up to 160bit
- genTime GeneralizedTime,
- accuracy Accuracy OPTIONAL,
- ordering BOOLEAN DEFAULT FALSE,
- nonce INTEGER OPTIONAL,
- tsa [0] GeneralName OPTIONAL,
- extensions [1] IMPLICIT Extensions OPTIONAL }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.tsp.TSTInfo (params)
-
-
-
- class for TSP TSTInfo ASN.1 object
-
-TSTInfo ::= SEQUENCE {
- version INTEGER { v1(1) },
- policy TSAPolicyId,
- messageImprint MessageImprint,
- serialNumber INTEGER, -- up to 160bit
- genTime GeneralizedTime,
- accuracy Accuracy OPTIONAL,
- ordering BOOLEAN DEFAULT FALSE,
- nonce INTEGER OPTIONAL,
- tsa [0] GeneralName OPTIONAL,
- extensions [1] IMPLICIT Extensions OPTIONAL }
-
-
-
-
-
-
-
o = new KJUR.asn1.tsp.TSTInfo({
- policy: '1.2.3.4.5',
- messageImprint: {hashAlg: 'sha256', hashMsgHex: '1abc...'},
- genTime: {withMillis: true}, // OPTION
- accuracy: {micros: 500}, // OPTION
- ordering: true, // OPITON
- nonce: {hex: '52fab1...'}, // OPTION
- tsa: {str: '/C=US/O=TSA1'} // OPITON
-});
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.6.0 asn1tsp 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.tsp.TimeStampReq.html b/jwt/api/symbols/KJUR.asn1.tsp.TimeStampReq.html
deleted file mode 100644
index 790077e..0000000
--- a/jwt/api/symbols/KJUR.asn1.tsp.TimeStampReq.html
+++ /dev/null
@@ -1,561 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.tsp.TimeStampReq
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.tsp.TimeStampReq
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for TSP TimeStampReq ASN.1 object
-
-
- Defined in: asn1tsp-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for TSP TimeStampReq ASN.1 object
-
-TimeStampReq ::= SEQUENCE {
- version INTEGER { v1(1) },
- messageImprint MessageImprint,
- reqPolicy TSAPolicyId OPTIONAL,
- nonce INTEGER OPTIONAL,
- certReq BOOLEAN DEFAULT FALSE,
- extensions [0] IMPLICIT Extensions OPTIONAL }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.tsp.TimeStampReq (params)
-
-
-
- class for TSP TimeStampReq ASN.1 object
-
-TimeStampReq ::= SEQUENCE {
- version INTEGER { v1(1) },
- messageImprint MessageImprint,
- reqPolicy TSAPolicyId OPTIONAL,
- nonce INTEGER OPTIONAL,
- certReq BOOLEAN DEFAULT FALSE,
- extensions [0] IMPLICIT Extensions OPTIONAL }
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.6.0 asn1tsp 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.tsp.TimeStampResp.html b/jwt/api/symbols/KJUR.asn1.tsp.TimeStampResp.html
deleted file mode 100644
index 003ef09..0000000
--- a/jwt/api/symbols/KJUR.asn1.tsp.TimeStampResp.html
+++ /dev/null
@@ -1,553 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.tsp.TimeStampResp
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.tsp.TimeStampResp
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- class for TSP TimeStampResp ASN.1 object
-
-
- Defined in: asn1tsp-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for TSP TimeStampResp ASN.1 object
-
-TimeStampResp ::= SEQUENCE {
- status PKIStatusInfo,
- timeStampToken TimeStampToken OPTIONAL }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.tsp.TimeStampResp (params)
-
-
-
- class for TSP TimeStampResp ASN.1 object
-
-TimeStampResp ::= SEQUENCE {
- status PKIStatusInfo,
- timeStampToken TimeStampToken OPTIONAL }
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
- Since:
- jsrsasign 4.6.0 asn1tsp 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.tsp.html b/jwt/api/symbols/KJUR.asn1.tsp.html
deleted file mode 100644
index 09e08ed..0000000
--- a/jwt/api/symbols/KJUR.asn1.tsp.html
+++ /dev/null
@@ -1,644 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.tsp
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Namespace KJUR.asn1.tsp
-
-
-
-
-
-
-
-
-
-
- Defined in: asn1tsp-1.0.js .
-
-
-
-
-
-
- Namespace Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
- KJUR.asn1.tsp.getEncodedHex ()
-
-
-
-
-
-
- <static>
-
- KJUR.asn1.tsp.getTSTHex (msgHex, hashAlg)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Namespace Detail
-
-
-
- KJUR.asn1.tsp
-
-
-
- kjur's ASN.1 class for RFC 3161 Time Stamp Protocol
-
-This name space provides
-RFC 3161
-Time-Stamp Protocol(TSP) data generator.
-
-
FEATURES
-
-easily generate CMS SignedData
-APIs are very similar to BouncyCastle library ASN.1 classes. So easy to learn.
-
-
-
PROVIDED CLASSES
-
-NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.tsp. getEncodedHex ()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.tsp. getTSTHex (msgHex, hashAlg)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- msgHex
-
-
-
-
-
- hashAlg
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.x509.AlgorithmIdentifier.html b/jwt/api/symbols/KJUR.asn1.x509.AlgorithmIdentifier.html
deleted file mode 100644
index f5f1f7f..0000000
--- a/jwt/api/symbols/KJUR.asn1.x509.AlgorithmIdentifier.html
+++ /dev/null
@@ -1,544 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.AlgorithmIdentifier
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.x509.AlgorithmIdentifier
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- AlgorithmIdentifier ASN.1 structure class
-
-
- Defined in: asn1x509-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- AlgorithmIdentifier ASN.1 structure class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.x509.AlgorithmIdentifier (params)
-
-
-
- AlgorithmIdentifier ASN.1 structure class
-
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {'name': 'SHA1withRSA'})
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.x509.AttributeTypeAndValue.html b/jwt/api/symbols/KJUR.asn1.x509.AttributeTypeAndValue.html
deleted file mode 100644
index 149958e..0000000
--- a/jwt/api/symbols/KJUR.asn1.x509.AttributeTypeAndValue.html
+++ /dev/null
@@ -1,544 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.AttributeTypeAndValue
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.x509.AttributeTypeAndValue
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- AttributeTypeAndValue ASN.1 structure class
-
-
- Defined in: asn1x509-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- AttributeTypeAndValue ASN.1 structure class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.x509.AttributeTypeAndValue (params)
-
-
-
- AttributeTypeAndValue ASN.1 structure class
-
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {'str': 'C=US'})
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.x509.AuthorityKeyIdentifier.html b/jwt/api/symbols/KJUR.asn1.x509.AuthorityKeyIdentifier.html
deleted file mode 100644
index c809be5..0000000
--- a/jwt/api/symbols/KJUR.asn1.x509.AuthorityKeyIdentifier.html
+++ /dev/null
@@ -1,759 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.AuthorityKeyIdentifier
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.x509.AuthorityKeyIdentifier
-
-
-
-
-
- Extends
- KJUR.asn1.x509.Extension .
-
-
- AuthorityKeyIdentifier ASN.1 structure class
-
-
- Defined in: asn1x509-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- AuthorityKeyIdentifier ASN.1 structure class
-
-d-ce-authorityKeyIdentifier OBJECT IDENTIFIER ::= { id-ce 35 }
-AuthorityKeyIdentifier ::= SEQUENCE {
- keyIdentifier [0] KeyIdentifier OPTIONAL,
- authorityCertIssuer [1] GeneralNames OPTIONAL,
- authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL }
-KeyIdentifier ::= OCTET STRING
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- set authorityCertIssuer value by X500Name parameter
-NOTE: Automatic authorityCertIssuer name setting by an issuer
-certificate will be supported in future version.
-
-
-
-
- <static>
-
-
- set authorityCertSerialNumber value by DERInteger parameter
-NOTE: Automatic authorityCertSerialNumber setting by an issuer
-certificate will be supported in future version.
-
-
-
-
- <static>
-
-
- set keyIdentifier value by DERInteger parameter
-NOTE: Automatic keyIdentifier value calculation by an issuer
-public key will be supported in future version.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.x509.AuthorityKeyIdentifier (params)
-
-
-
- AuthorityKeyIdentifier ASN.1 structure class
-
-d-ce-authorityKeyIdentifier OBJECT IDENTIFIER ::= { id-ce 35 }
-AuthorityKeyIdentifier ::= SEQUENCE {
- keyIdentifier [0] KeyIdentifier OPTIONAL,
- authorityCertIssuer [1] GeneralNames OPTIONAL,
- authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL }
-KeyIdentifier ::= OCTET STRING
-
-
-
-
-
-
-
var param = {'kid': {'hex': '89ab'},
- 'issuer': {'str': '/C=US/CN=a'},
- 'sn': {'hex': '1234'},
- 'critical': true});
-var e1 = new KJUR.asn1.x509.AuthorityKeyIdentifier(param);
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {'uri': 'http://a.com/', 'critical': true})
-
-
-
-
-
-
- Since:
- asn1x509 1.0.8
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.AuthorityKeyIdentifier. setCertIssuerByParam (param)
-
-
-
- set authorityCertIssuer value by X500Name parameter
-NOTE: Automatic authorityCertIssuer name setting by an issuer
-certificate will be supported in future version.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} param
-
-
- array of KJUR.asn1.x509.X500Name parameter
-
-
-
-
-
-
- Since:
- asn1x509 1.0.8
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.AuthorityKeyIdentifier. setCertSerialNumberByParam (param)
-
-
-
- set authorityCertSerialNumber value by DERInteger parameter
-NOTE: Automatic authorityCertSerialNumber setting by an issuer
-certificate will be supported in future version.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} param
-
-
- array of KJUR.asn1.DERInteger parameter
-
-
-
-
-
-
- Since:
- asn1x509 1.0.8
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.AuthorityKeyIdentifier. setKIDByParam (param)
-
-
-
- set keyIdentifier value by DERInteger parameter
-NOTE: Automatic keyIdentifier value calculation by an issuer
-public key will be supported in future version.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} param
-
-
- array of KJUR.asn1.DERInteger parameter
-
-
-
-
-
-
- Since:
- asn1x509 1.0.8
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.x509.BasicConstraints.html b/jwt/api/symbols/KJUR.asn1.x509.BasicConstraints.html
deleted file mode 100644
index 4c8085a..0000000
--- a/jwt/api/symbols/KJUR.asn1.x509.BasicConstraints.html
+++ /dev/null
@@ -1,544 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.BasicConstraints
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.x509.BasicConstraints
-
-
-
-
-
- Extends
- KJUR.asn1.x509.Extension .
-
-
- BasicConstraints ASN.1 structure class
-
-
- Defined in: asn1x509-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- BasicConstraints ASN.1 structure class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.x509.BasicConstraints (params)
-
-
-
- BasicConstraints ASN.1 structure class
-
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {'cA': true, 'critical': true})
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.x509.CRL.html b/jwt/api/symbols/KJUR.asn1.x509.CRL.html
deleted file mode 100644
index f9300e8..0000000
--- a/jwt/api/symbols/KJUR.asn1.x509.CRL.html
+++ /dev/null
@@ -1,749 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.CRL
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.x509.CRL
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- X.509 CRL class to sign and generate hex encoded certificate
-
-
- Defined in: asn1x509-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- X.509 CRL class to sign and generate hex encoded CRL
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-NOTE: 'params' can be omitted.
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- get PEM formatted CRL string after signed
-
-
-
-
-
- <static>
-
-
- set PKCS#5 encrypted RSA PEM private key as CA key
-
-
EXAMPLES
-
-
-
-
- <static>
-
- KJUR.asn1.x509.CRL.
sign ()
-
- sign TBSCertList and set signature value internally
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.x509.CRL (params)
-
-
-
- X.509 CRL class to sign and generate hex encoded CRL
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-NOTE: 'params' can be omitted.
-
EXAMPLE
-
-
-
-
-
-
var prvKey = new RSAKey(); // CA's private key
-prvKey.readPrivateKeyFromASN1HexString("3080...");
-var crl = new KJUR.asn1x509.CRL({'tbsobj': tbs, 'rsaprvkey': prvKey});
-crl.sign(); // issue CRL by CA's private key
-var hCRL = crl.getEncodedHex();
-
-// CertificateList ::= SEQUENCE {
-// tbsCertList TBSCertList,
-// signatureAlgorithm AlgorithmIdentifier,
-// signatureValue BIT STRING }
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {'tbsobj': obj, 'rsaprvkey': key})
-
-
-
-
-
-
- Since:
- 1.0.3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.CRL. getPEMString ()
-
-
-
- get PEM formatted CRL string after signed
-
-
-
-
-
-
-
-
var cert = new KJUR.asn1.x509.CRL({'tbsobj': tbs, 'rsaprvkey': prvKey});
-cert.sign();
-var sPEM = cert.getPEMString();
-
-
-
-
-
-
-
-
-
- Returns:
-
- PEM formatted string of certificate
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.CRL. setRsaPrvKeyByPEMandPass (rsaPEM, passPEM)
-
-
-
- set PKCS#5 encrypted RSA PEM private key as CA key
-
-
EXAMPLES
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} rsaPEM
-
-
- string of PKCS#5 encrypted RSA PEM private key
-
-
- {String} passPEM
-
-
- passcode string to decrypt private key
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.CRL. sign ()
-
-
-
- sign TBSCertList and set signature value internally
-
-
-
-
-
-
-
-
var cert = new KJUR.asn1.x509.CRL({'tbsobj': tbs, 'rsaprvkey': prvKey});
-cert.sign();
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.x509.CRLDistributionPoints.html b/jwt/api/symbols/KJUR.asn1.x509.CRLDistributionPoints.html
deleted file mode 100644
index 53fb225..0000000
--- a/jwt/api/symbols/KJUR.asn1.x509.CRLDistributionPoints.html
+++ /dev/null
@@ -1,544 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.CRLDistributionPoints
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.x509.CRLDistributionPoints
-
-
-
-
-
- Extends
- KJUR.asn1.x509.Extension .
-
-
- CRLDistributionPoints ASN.1 structure class
-
-
- Defined in: asn1x509-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- CRLDistributionPoints ASN.1 structure class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.x509.CRLDistributionPoints (params)
-
-
-
- CRLDistributionPoints ASN.1 structure class
-
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {'uri': 'http://a.com/', 'critical': true})
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.x509.CRLEntry.html b/jwt/api/symbols/KJUR.asn1.x509.CRLEntry.html
deleted file mode 100644
index bf231d6..0000000
--- a/jwt/api/symbols/KJUR.asn1.x509.CRLEntry.html
+++ /dev/null
@@ -1,684 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.CRLEntry
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.x509.CRLEntry
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- ASN.1 CRLEntry structure class for CRL
-
-
- Defined in: asn1x509-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- ASN.1 CRLEntry structure class for CRL
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- set DERInteger parameter for serial number of revoked certificate
-
-
-
-
-
- <static>
-
-
- set Time parameter for revocation date
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.x509.CRLEntry (params)
-
-
-
- ASN.1 CRLEntry structure class for CRL
-
-
-
-
-
-
-
var e = new KJUR.asn1.x509.CRLEntry({'time': {'str': '130514235959Z'}, 'sn': {'int': 234}});
-
-// revokedCertificates SEQUENCE OF SEQUENCE {
-// userCertificate CertificateSerialNumber,
-// revocationDate Time,
-// crlEntryExtensions Extensions OPTIONAL
-// -- if present, version MUST be v2 }
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {})
-
-
-
-
-
-
- Since:
- 1.0.3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.CRLEntry. setCertSerial (intParam)
-
-
-
- set DERInteger parameter for serial number of revoked certificate
-
-
-
-
-
-
-
-
entry.setCertSerial({'int': 3});
-
-
-
-
-
- Parameters:
-
-
- {Array} intParam
-
-
- DERInteger parameter for certificate serial number
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.CRLEntry. setRevocationDate (timeParam)
-
-
-
- set Time parameter for revocation date
-
-
-
-
-
-
-
-
entry.setRevocationDate({'str': '130508235959Z'});
-
-
-
-
-
- Parameters:
-
-
- {Array} timeParam
-
-
- Time parameter for revocation date
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.x509.Certificate.html b/jwt/api/symbols/KJUR.asn1.x509.Certificate.html
deleted file mode 100644
index b265242..0000000
--- a/jwt/api/symbols/KJUR.asn1.x509.Certificate.html
+++ /dev/null
@@ -1,801 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.Certificate
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.x509.Certificate
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- X.509 Certificate class to sign and generate hex encoded certificate
-
-
- Defined in: asn1x509-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- X.509 Certificate class to sign and generate hex encoded certificate
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-NOTE1: 'params' can be omitted.
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- get PEM formatted certificate string after signed
-
-
-
-
-
- <static>
-
-
- set PKCS#5 encrypted RSA PEM private key as CA key
-
-
EXAMPLES
-
-
-
-
- <static>
-
-
- set signature value internally by hex string
-
-
-
-
-
- <static>
-
- KJUR.asn1.x509.Certificate.
sign ()
-
- sign TBSCertificate and set signature value internally
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.x509.Certificate (params)
-
-
-
- X.509 Certificate class to sign and generate hex encoded certificate
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-NOTE1: 'params' can be omitted.
-NOTE2: DSA/ECDSA is also supported for CA signging key from asn1x509 1.0.6.
-
-
-
-
-
-
var caKey = KEYUTIL.getKey(caKeyPEM); // CA's private key
-var cert = new KJUR.asn1x509.Certificate({'tbscertobj': tbs, 'prvkeyobj': caKey});
-cert.sign(); // issue certificate by CA's private key
-var certPEM = cert.getPEMString();
-
-// Certificate ::= SEQUENCE {
-// tbsCertificate TBSCertificate,
-// signatureAlgorithm AlgorithmIdentifier,
-// signature BIT STRING }
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {'tbscertobj': obj, 'prvkeyobj': key})
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.Certificate. getPEMString ()
-
-
-
- get PEM formatted certificate string after signed
-
-
-
-
-
-
-
-
var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs, 'rsaprvkey': prvKey});
-cert.sign();
-var sPEM = cert.getPEMString();
-
-
-
-
-
-
-
-
-
- Returns:
-
- PEM formatted string of certificate
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.Certificate. setRsaPrvKeyByPEMandPass (rsaPEM, passPEM)
-
-
-
- set PKCS#5 encrypted RSA PEM private key as CA key
-
-
EXAMPLES
-
-
-
-
-
-
-
var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs});
-cert.setRsaPrvKeyByPEMandPass("-----BEGIN RSA PRIVATE..(snip)", "password");
-
-
-
-
-
- Parameters:
-
-
- {String} rsaPEM
-
-
- string of PKCS#5 encrypted RSA PEM private key
-
-
- {String} passPEM
-
-
- passcode string to decrypt private key
-
-
-
-
-
-
- Since:
- 1.0.1
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.Certificate. setSignatureHex ()
-
-
-
- set signature value internally by hex string
-
-
-
-
-
-
-
-
var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs});
-cert.setSignatureHex('01020304');
-
-
-
-
-
-
-
- Since:
- asn1x509 1.0.8
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.Certificate. sign ()
-
-
-
- sign TBSCertificate and set signature value internally
-
-
-
-
-
-
-
-
var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs, 'rsaprvkey': prvKey});
-cert.sign();
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.x509.DistributionPoint.html b/jwt/api/symbols/KJUR.asn1.x509.DistributionPoint.html
deleted file mode 100644
index 81dea68..0000000
--- a/jwt/api/symbols/KJUR.asn1.x509.DistributionPoint.html
+++ /dev/null
@@ -1,522 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.DistributionPoint
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.x509.DistributionPoint
-
-
-
-
-
-
-
- DistributionPoint ASN.1 structure class
-
-
- Defined in: asn1x509-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- DistributionPoint ASN.1 structure class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.x509.DistributionPoint ()
-
-
-
- DistributionPoint ASN.1 structure class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.x509.DistributionPointName.html b/jwt/api/symbols/KJUR.asn1.x509.DistributionPointName.html
deleted file mode 100644
index e81068d..0000000
--- a/jwt/api/symbols/KJUR.asn1.x509.DistributionPointName.html
+++ /dev/null
@@ -1,522 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.DistributionPointName
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.x509.DistributionPointName
-
-
-
-
-
-
-
- DistributionPointName ASN.1 structure class
-
-
- Defined in: asn1x509-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- DistributionPointName ASN.1 structure class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.x509.DistributionPointName ()
-
-
-
- DistributionPointName ASN.1 structure class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.x509.ExtKeyUsage.html b/jwt/api/symbols/KJUR.asn1.x509.ExtKeyUsage.html
deleted file mode 100644
index 0f72437..0000000
--- a/jwt/api/symbols/KJUR.asn1.x509.ExtKeyUsage.html
+++ /dev/null
@@ -1,552 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.ExtKeyUsage
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.x509.ExtKeyUsage
-
-
-
-
-
- Extends
- KJUR.asn1.x509.Extension .
-
-
- ExtKeyUsage ASN.1 structure class
-
-
- Defined in: asn1x509-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- KeyUsage ASN.1 structure class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.x509.ExtKeyUsage (params)
-
-
-
- KeyUsage ASN.1 structure class
-
-
-
-
-
-
-
var e1 =
- new KJUR.asn1.x509.ExtKeyUsage({'critical': true,
- 'array':
- [{'oid': '2.5.29.37.0', // anyExtendedKeyUsage
- 'name': 'clientAuth'}]});
-
-// id-ce-extKeyUsage OBJECT IDENTIFIER ::= { id-ce 37 }
-// ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId
-// KeyPurposeId ::= OBJECT IDENTIFIER
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.x509.Extension.html b/jwt/api/symbols/KJUR.asn1.x509.Extension.html
deleted file mode 100644
index 5c4d9ae..0000000
--- a/jwt/api/symbols/KJUR.asn1.x509.Extension.html
+++ /dev/null
@@ -1,547 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.Extension
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.x509.Extension
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- base Extension ASN.1 structure class
-
-
- Defined in: asn1x509-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- base Extension ASN.1 structure class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.x509.Extension (params)
-
-
-
- base Extension ASN.1 structure class
-
-
-
-
-
-
-
// Extension ::= SEQUENCE {
-// extnID OBJECT IDENTIFIER,
-// critical BOOLEAN DEFAULT FALSE,
-// extnValue OCTET STRING }
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {'critical': true})
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.x509.GeneralName.html b/jwt/api/symbols/KJUR.asn1.x509.GeneralName.html
deleted file mode 100644
index d3455a9..0000000
--- a/jwt/api/symbols/KJUR.asn1.x509.GeneralName.html
+++ /dev/null
@@ -1,555 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.GeneralName
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.x509.GeneralName
-
-
-
-
-
-
-
- GeneralName ASN.1 structure class
-
-
- Defined in: asn1x509-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- GeneralName ASN.1 structure class
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-rfc822 - rfc822Name[1] (ex.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.x509.GeneralName ()
-
-
-
- GeneralName ASN.1 structure class
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-rfc822 - rfc822Name[1] (ex. user1@foo.com)
-dns - dNSName[2] (ex. foo.com)
-uri - uniformResourceIdentifier[6] (ex. http://foo.com/)
-certissuer - directoryName[4] (PEM or hex string of cert)
-certsubj - directoryName[4] (PEM or hex string of cert)
-
-NOTE1: certissuer and certsubj is supported since asn1x509 1.0.10.
-
-Here is definition of the ASN.1 syntax:
-
--- NOTE: under the CHOICE, it will always be explicit.
-GeneralName ::= CHOICE {
- otherName [0] OtherName,
- rfc822Name [1] IA5String,
- dNSName [2] IA5String,
- x400Address [3] ORAddress,
- directoryName [4] Name,
- ediPartyName [5] EDIPartyName,
- uniformResourceIdentifier [6] IA5String,
- iPAddress [7] OCTET STRING,
- registeredID [8] OBJECT IDENTIFIER }
-
-
-
-
-
-
-
gn = new KJUR.asn1.x509.GeneralName({rfc822: 'test@aaa.com'});
-gn = new KJUR.asn1.x509.GeneralName({dns: 'aaa.com'});
-gn = new KJUR.asn1.x509.GeneralName({uri: 'http://aaa.com/'});
-gn = new KJUR.asn1.x509.GeneralName({certissuer: certPEM});
-gn = new KJUR.asn1.x509.GeneralName({certsubj: certPEM});
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.x509.GeneralNames.html b/jwt/api/symbols/KJUR.asn1.x509.GeneralNames.html
deleted file mode 100644
index 137e70e..0000000
--- a/jwt/api/symbols/KJUR.asn1.x509.GeneralNames.html
+++ /dev/null
@@ -1,603 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.GeneralNames
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.x509.GeneralNames
-
-
-
-
-
-
-
- GeneralNames ASN.1 structure class
-
-
- Defined in: asn1x509-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- GeneralNames ASN.1 structure class
-
-
EXAMPLE AND ASN.1 SYNTAX
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.x509.GeneralNames ()
-
-
-
- GeneralNames ASN.1 structure class
-
-
EXAMPLE AND ASN.1 SYNTAX
-
-
-
-
-
-
var gns = new KJUR.asn1.x509.GeneralNames([{'uri': 'http://aaa.com/'}, {'uri': 'http://bbb.com/'}]);
-
-GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.GeneralNames. setByParamArray (paramsArray)
-
-
-
-
-
-
-
var gns = new KJUR.asn1.x509.GeneralNames();
-gns.setByParamArray([{'uri': 'http://aaa.com/'}, {'uri': 'http://bbb.com/'}]);
-
-
-
-
-
- Parameters:
-
-
- {Array} paramsArray
-
-
- Array of KJUR.asn1.x509.GeneralNames
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.x509.KeyUsage.html b/jwt/api/symbols/KJUR.asn1.x509.KeyUsage.html
deleted file mode 100644
index 63058e9..0000000
--- a/jwt/api/symbols/KJUR.asn1.x509.KeyUsage.html
+++ /dev/null
@@ -1,544 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.KeyUsage
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.x509.KeyUsage
-
-
-
-
-
- Extends
- KJUR.asn1.x509.Extension .
-
-
- KeyUsage ASN.1 structure class
-
-
- Defined in: asn1x509-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- KeyUsage ASN.1 structure class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.x509.KeyUsage (params)
-
-
-
- KeyUsage ASN.1 structure class
-
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {'bin': '11', 'critical': true})
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.x509.OID.html b/jwt/api/symbols/KJUR.asn1.x509.OID.html
deleted file mode 100644
index 36f4f52..0000000
--- a/jwt/api/symbols/KJUR.asn1.x509.OID.html
+++ /dev/null
@@ -1,773 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.OID
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.x509.OID
-
-
-
-
-
-
-
- static object for OID
-
-
- Defined in: asn1x509-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- static object for OID
-
-atype2oidList
-currently supports 'C', 'O', 'OU', 'ST', 'L' and 'CN' only.
-
-
-
-
-
-
-
-
-
-
-
- Field Summary
-
-
- Field Attributes
- Field Name and Description
-
-
-
-
-
-
-
-
- for short attribyte type name and oid (i.e.
-
-
-
-
-
-
-
- for oid name and oid (i.e.
-
-
-
-
-
-
-
- for caching name and DERObjectIdentifier object
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- get DERObjectIdentifier by registered attribyte type name such like 'C' or 'CN'
-
-
-
-
-
- <static>
-
-
- get DERObjectIdentifier by registered OID name
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.x509.OID ()
-
-
-
- static object for OID
-
-atype2oidList
-currently supports 'C', 'O', 'OU', 'ST', 'L' and 'CN' only.
- name2oidList
-currently supports 'SHA1withRSA', 'rsaEncryption' and some extension OIDs
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Field Detail
-
-
-
-
-
- {Assoc Array}
- atype2oidList
-
-
-
- for short attribyte type name and oid (i.e. 'C' and '2.5.4.6')
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {Assoc Array}
- name2oidList
-
-
-
- for oid name and oid (i.e. 'keyUsage' and '2.5.29.15')
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {Assoc Array}
- objCache
-
-
-
- for caching name and DERObjectIdentifier object
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.OID. atype2obj (atype)
-
-
-
- get DERObjectIdentifier by registered attribyte type name such like 'C' or 'CN'
-
-
-
-
-
-
-
-
var asn1ObjOID = OID.atype2obj('CN');
-
-
-
-
-
- Parameters:
-
-
- {String} atype
-
-
- short attribute type name such like 'C' or 'CN'
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.OID. name2obj (name)
-
-
-
- get DERObjectIdentifier by registered OID name
-
-
-
-
-
-
-
-
var asn1ObjOID = OID.name2obj('SHA1withRSA');
-
-
-
-
-
- Parameters:
-
-
- {String} name
-
-
- OID
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.x509.RDN.html b/jwt/api/symbols/KJUR.asn1.x509.RDN.html
deleted file mode 100644
index c31e26c..0000000
--- a/jwt/api/symbols/KJUR.asn1.x509.RDN.html
+++ /dev/null
@@ -1,544 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.RDN
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.x509.RDN
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- RDN (Relative Distinguish Name) ASN.1 structure class
-
-
- Defined in: asn1x509-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- RDN (Relative Distinguish Name) ASN.1 structure class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.x509.RDN (params)
-
-
-
- RDN (Relative Distinguish Name) ASN.1 structure class
-
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {'str': 'C=US'})
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.x509.SubjectPublicKeyInfo.html b/jwt/api/symbols/KJUR.asn1.x509.SubjectPublicKeyInfo.html
deleted file mode 100644
index a91d6e1..0000000
--- a/jwt/api/symbols/KJUR.asn1.x509.SubjectPublicKeyInfo.html
+++ /dev/null
@@ -1,697 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.SubjectPublicKeyInfo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.x509.SubjectPublicKeyInfo
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- SubjectPublicKeyInfo ASN.1 structure class
-
-
- Defined in: asn1x509-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- SubjectPublicKeyInfo ASN.1 structure class
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-NOTE1: 'params' can be omitted.
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
- KJUR.asn1.x509.SubjectPublicKeyInfo.
setRSAKey (rsaKey)
-
- (DEPRECATED) set RSAKey object as subject public key
-
-
-
-
-
- <static>
-
- KJUR.asn1.x509.SubjectPublicKeyInfo.
setRSAPEM (rsaPubPEM)
-
- (DEPRECATED) set a PEM formatted RSA public key string as RSA public key
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.x509.SubjectPublicKeyInfo (params)
-
-
-
- SubjectPublicKeyInfo ASN.1 structure class
-
-As for argument 'params' for constructor, you can specify one of
-following properties:
-
-NOTE1: 'params' can be omitted.
-NOTE2: DSA/ECDSA key object is also supported since asn1x509 1.0.6.
-
EXAMPLE
-
-
-
-
-
-
var spki = new KJUR.asn1.x509.SubjectPublicKeyInfo(RSAKey_object);
-var spki = new KJUR.asn1.x509.SubjectPublicKeyInfo(KJURcryptoECDSA_object);
-var spki = new KJUR.asn1.x509.SubjectPublicKeyInfo(KJURcryptoDSA_object);
-
-
-
-
-
-
- Parameters:
-
-
- {Object} params
-
-
- parameter for subject public key
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.SubjectPublicKeyInfo. setRSAKey (rsaKey)
-
-
-
- (DEPRECATED) set RSAKey object as subject public key
-
-
-
-
-
-
-
-
spki.setRSAKey(rsaKey);
-
-
-
-
-
- Parameters:
-
-
- {RSAKey } rsaKey
-
-
- RSAKey object for RSA public key
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.SubjectPublicKeyInfo. setRSAPEM (rsaPubPEM)
-
-
-
- (DEPRECATED) set a PEM formatted RSA public key string as RSA public key
-
-
-
-
-
-
-
-
spki.setRSAPEM(rsaPubPEM);
-
-
-
-
-
- Parameters:
-
-
- {String} rsaPubPEM
-
-
- PEM formatted RSA public key string
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.x509.TBSCertList.html b/jwt/api/symbols/KJUR.asn1.x509.TBSCertList.html
deleted file mode 100644
index d28a739..0000000
--- a/jwt/api/symbols/KJUR.asn1.x509.TBSCertList.html
+++ /dev/null
@@ -1,888 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.TBSCertList
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.x509.TBSCertList
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- ASN.1 TBSCertList structure class for CRL
-
-
- Defined in: asn1x509-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- ASN.1 TBSCertList structure class for CRL
-
-
EXAMPLE
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- add revoked certficate by parameter
-
-
-
-
-
- <static>
-
-
- set issuer name field by parameter
-
-
-
-
-
- <static>
-
-
- set nextUpdate field by parameter
-
-
-
-
-
- <static>
-
-
- set signature algorithm field by parameter
-
-
-
-
-
- <static>
-
-
- set thisUpdate field by parameter
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.x509.TBSCertList (params)
-
-
-
- ASN.1 TBSCertList structure class for CRL
-
-
EXAMPLE
-
-
-
-
-
-
var o = new KJUR.asn1.x509.TBSCertList();
- o.setSignatureAlgByParam({'name': 'SHA1withRSA'});
- o.setIssuerByParam({'str': '/C=US/O=a'});
- o.setNotThisUpdateByParam({'str': '130504235959Z'});
- o.setNotNextUpdateByParam({'str': '140504235959Z'});
- o.addRevokedCert({'int': 4}, {'str':'130514235959Z'}));
- o.addRevokedCert({'hex': '0f34dd'}, {'str':'130514235959Z'}));
-
-// TBSCertList ::= SEQUENCE {
-// version Version OPTIONAL,
-// -- if present, MUST be v2
-// signature AlgorithmIdentifier,
-// issuer Name,
-// thisUpdate Time,
-// nextUpdate Time OPTIONAL,
-// revokedCertificates SEQUENCE OF SEQUENCE {
-// userCertificate CertificateSerialNumber,
-// revocationDate Time,
-// crlEntryExtensions Extensions OPTIONAL
-// -- if present, version MUST be v2
-// } OPTIONAL,
-// crlExtensions [0] EXPLICIT Extensions OPTIONAL
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {})
-
-
-
-
-
-
- Since:
- 1.0.3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.TBSCertList. addRevokedCert (snParam, timeParam)
-
-
-
- add revoked certficate by parameter
-
-
-
-
-
-
-
-
tbsc.addRevokedCert({'int': 3}, {'str': '130508235959Z'});
-
-
-
-
-
- Parameters:
-
-
- {Array} snParam
-
-
- DERInteger parameter for certificate serial number
-
-
- {Array} timeParam
-
-
- Time parameter for revocation date
-
-
-
-
-
-
-
-
-
-
- See:
-
- KJUR.asn1.x509.Time
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.TBSCertList. setIssuerByParam (x500NameParam)
-
-
-
- set issuer name field by parameter
-
-
-
-
-
-
-
-
tbsc.setIssuerParam({'str': '/C=US/CN=b'});
-
-
-
-
-
- Parameters:
-
-
- {Array} x500NameParam
-
-
- X500Name parameter
-
-
-
-
-
-
-
-
-
-
- See:
-
- KJUR.asn1.x509.X500Name
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.TBSCertList. setNextUpdateByParam (timeParam)
-
-
-
- set nextUpdate field by parameter
-
-
-
-
-
-
-
-
tbsc.setNextUpdateByParam({'str': '130508235959Z'});
-
-
-
-
-
- Parameters:
-
-
- {Array} timeParam
-
-
- Time parameter
-
-
-
-
-
-
-
-
-
-
- See:
-
- KJUR.asn1.x509.Time
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.TBSCertList. setSignatureAlgByParam (algIdParam)
-
-
-
- set signature algorithm field by parameter
-
-
-
-
-
-
-
-
tbsc.setSignatureAlgByParam({'name': 'SHA1withRSA'});
-
-
-
-
-
- Parameters:
-
-
- {Array} algIdParam
-
-
- AlgorithmIdentifier parameter
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.TBSCertList. setThisUpdateByParam (timeParam)
-
-
-
- set thisUpdate field by parameter
-
-
-
-
-
-
-
-
tbsc.setThisUpdateByParam({'str': '130508235959Z'});
-
-
-
-
-
- Parameters:
-
-
- {Array} timeParam
-
-
- Time parameter
-
-
-
-
-
-
-
-
-
-
- See:
-
- KJUR.asn1.x509.Time
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.x509.TBSCertificate.html b/jwt/api/symbols/KJUR.asn1.x509.TBSCertificate.html
deleted file mode 100644
index d0814a7..0000000
--- a/jwt/api/symbols/KJUR.asn1.x509.TBSCertificate.html
+++ /dev/null
@@ -1,1169 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.TBSCertificate
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.x509.TBSCertificate
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- ASN.1 TBSCertificate structure class
-
-
- Defined in: asn1x509-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- ASN.1 TBSCertificate structure class
-
-
EXAMPLE
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- append X.509v3 extension to this object
-
-
-
-
-
- <static>
-
-
- append X.509v3 extension to this object by name and parameters
-
-
-
-
-
- <static>
-
-
- set issuer name field by parameter
-
-
-
-
-
- <static>
-
-
- set notAfter field by parameter
-
-
-
-
-
- <static>
-
-
- set notBefore field by parameter
-
-
-
-
-
- <static>
-
-
- set serial number field by parameter
-
-
-
-
-
- <static>
-
-
- set signature algorithm field by parameter
-
-
-
-
-
- <static>
-
-
- set subject name field by parameter
-
-
-
-
-
- <static>
-
-
- set subject public key info by RSA/ECDSA/DSA key parameter
-
-
-
-
-
- <static>
-
-
- (DEPRECATED) set subject public key info field by RSA key parameter
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.x509.TBSCertificate (params)
-
-
-
- ASN.1 TBSCertificate structure class
-
-
EXAMPLE
-
-
-
-
-
-
var o = new KJUR.asn1.x509.TBSCertificate();
- o.setSerialNumberByParam({'int': 4});
- o.setSignatureAlgByParam({'name': 'SHA1withRSA'});
- o.setIssuerByParam({'str': '/C=US/O=a'});
- o.setNotBeforeByParam({'str': '130504235959Z'});
- o.setNotAfterByParam({'str': '140504235959Z'});
- o.setSubjectByParam({'str': '/C=US/CN=b'});
- o.setSubjectPublicKeyByParam({'rsakey': rsaKey});
- o.appendExtension(new KJUR.asn1.x509.BasicConstraints({'cA':true}));
- o.appendExtension(new KJUR.asn1.x509.KeyUsage({'bin':'11'}));
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {})
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.TBSCertificate. appendExtension (extObj)
-
-
-
- append X.509v3 extension to this object
-
-
-
-
-
-
-
-
tbsc.appendExtension(new KJUR.asn1.x509.BasicConstraints({'cA':true, 'critical': true}));
-tbsc.appendExtension(new KJUR.asn1.x509.KeyUsage({'bin':'11'}));
-
-
-
-
-
- Parameters:
-
-
- {Extension} extObj
-
-
- X.509v3 Extension object
-
-
-
-
-
-
-
-
-
-
- See:
-
- KJUR.asn1.x509.Extension
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.TBSCertificate. appendExtensionByName (name, extParams)
-
-
-
- append X.509v3 extension to this object by name and parameters
-
-
-
-
-
-
-
-
tbsc.appendExtensionByName('BasicConstraints', {'cA':true, 'critical': true});
-tbsc.appendExtensionByName('KeyUsage', {'bin':'11'});
-tbsc.appendExtensionByName('CRLDistributionPoints', {uri: 'http://aaa.com/a.crl'});
-tbsc.appendExtensionByName('ExtKeyUsage', {array: [{name: 'clientAuth'}]});
-tbsc.appendExtensionByName('AuthorityKeyIdentifier', {kid: '1234ab..'});
-
-
-
-
-
- Parameters:
-
-
- {name} name
-
-
- name of X.509v3 Extension object
-
-
- {Array} extParams
-
-
- parameters as argument of Extension constructor.
-
-
-
-
-
-
-
-
-
-
- See:
-
- KJUR.asn1.x509.Extension
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.TBSCertificate. setIssuerByParam (x500NameParam)
-
-
-
- set issuer name field by parameter
-
-
-
-
-
-
-
-
tbsc.setIssuerParam({'str': '/C=US/CN=b'});
-
-
-
-
-
- Parameters:
-
-
- {Array} x500NameParam
-
-
- X500Name parameter
-
-
-
-
-
-
-
-
-
-
- See:
-
- KJUR.asn1.x509.X500Name
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.TBSCertificate. setNotAfterByParam (timeParam)
-
-
-
- set notAfter field by parameter
-
-
-
-
-
-
-
-
tbsc.setNotAfterByParam({'str': '130508235959Z'});
-
-
-
-
-
- Parameters:
-
-
- {Array} timeParam
-
-
- Time parameter
-
-
-
-
-
-
-
-
-
-
- See:
-
- KJUR.asn1.x509.Time
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.TBSCertificate. setNotBeforeByParam (timeParam)
-
-
-
- set notBefore field by parameter
-
-
-
-
-
-
-
-
tbsc.setNotBeforeByParam({'str': '130508235959Z'});
-
-
-
-
-
- Parameters:
-
-
- {Array} timeParam
-
-
- Time parameter
-
-
-
-
-
-
-
-
-
-
- See:
-
- KJUR.asn1.x509.Time
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.TBSCertificate. setSerialNumberByParam (intParam)
-
-
-
- set serial number field by parameter
-
-
-
-
-
-
-
-
tbsc.setSerialNumberByParam({'int': 3});
-
-
-
-
-
- Parameters:
-
-
- {Array} intParam
-
-
- DERInteger param
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.TBSCertificate. setSignatureAlgByParam (algIdParam)
-
-
-
- set signature algorithm field by parameter
-
-
-
-
-
-
-
-
tbsc.setSignatureAlgByParam({'name': 'SHA1withRSA'});
-
-
-
-
-
- Parameters:
-
-
- {Array} algIdParam
-
-
- AlgorithmIdentifier parameter
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.TBSCertificate. setSubjectByParam (x500NameParam)
-
-
-
- set subject name field by parameter
-
-
-
-
-
-
-
-
tbsc.setSubjectParam({'str': '/C=US/CN=b'});
-
-
-
-
-
- Parameters:
-
-
- {Array} x500NameParam
-
-
- X500Name parameter
-
-
-
-
-
-
-
-
-
-
- See:
-
- KJUR.asn1.x509.X500Name
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.TBSCertificate. setSubjectPublicKeyByGetKey (keyParam)
-
-
-
- set subject public key info by RSA/ECDSA/DSA key parameter
-
-
-
-
-
-
-
-
tbsc.setSubjectPublicKeyByGetKeyParam(certPEMString); // or
-tbsc.setSubjectPublicKeyByGetKeyParam(pkcs8PublicKeyPEMString); // or
-tbsc.setSubjectPublicKeyByGetKeyParam(kjurCryptoECDSAKeyObject); // et.al.
-
-
-
-
-
- Parameters:
-
-
- {Object} keyParam
-
-
- public key parameter which passed to KEYUTIL.getKey argument
-
-
-
-
-
-
- Since:
- asn1x509 1.0.6
-
-
-
-
-
-
-
-
- See:
-
- KJUR.asn1.x509.SubjectPublicKeyInfo
-
- KEYUTIL.getKey
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.TBSCertificate. setSubjectPublicKeyByParam (subjPKeyParam)
-
-
-
- (DEPRECATED) set subject public key info field by RSA key parameter
-
-
-
-
-
-
-
-
tbsc.setSubjectPublicKeyByParam({'rsakey': pubKey});
-
-
-
-
-
- Parameters:
-
-
- {Array} subjPKeyParam
-
-
- SubjectPublicKeyInfo parameter of RSA
-
-
-
-
-
-
-
-
-
-
- See:
-
- KJUR.asn1.x509.SubjectPublicKeyInfo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.x509.Time.html b/jwt/api/symbols/KJUR.asn1.x509.Time.html
deleted file mode 100644
index 6134b54..0000000
--- a/jwt/api/symbols/KJUR.asn1.x509.Time.html
+++ /dev/null
@@ -1,547 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.Time
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.x509.Time
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- Time ASN.1 structure class
-
-
- Defined in: asn1x509-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- Time ASN.1 structure class
-
-
EXAMPLES
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.x509.Time (params)
-
-
-
- Time ASN.1 structure class
-
-
EXAMPLES
-
-
-
-
-
-
var t1 = new KJUR.asn1.x509.Time{'str': '130508235959Z'} // UTCTime by default
-var t2 = new KJUR.asn1.x509.Time{'type': 'gen', 'str': '20130508235959Z'} // GeneralizedTime
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {'str': '130508235959Z'})
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.x509.X500Name.html b/jwt/api/symbols/KJUR.asn1.x509.X500Name.html
deleted file mode 100644
index c2b5c52..0000000
--- a/jwt/api/symbols/KJUR.asn1.x509.X500Name.html
+++ /dev/null
@@ -1,684 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.X500Name
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.x509.X500Name
-
-
-
-
-
- Extends
- KJUR.asn1.ASN1Object .
-
-
- X500Name ASN.1 structure class
-
-
- Defined in: asn1x509-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- X500Name ASN.1 structure class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fields borrowed from class KJUR.asn1.ASN1Object : hL , hT , hTLV , hV , isModified
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- set DN by associative array
-
-
-
-
-
- <static>
-
-
- set DN by string
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.x509.X500Name (params)
-
-
-
- X500Name ASN.1 structure class
-
-
-
-
-
-
-
// 1. construct with string
-o = new KJUR.asn1.x509.X500Name({str: "/C=US/O=aaa/OU=bbb/CN=foo@example.com"});
-// 2. construct by object
-o = new KJUR.asn1.x509.X500Name({C: "US", O: "aaa", CN: "http://example.com/"});
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- associative array of parameters (ex. {'str': '/C=US/O=a'})
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.X500Name. setByObject (dnObj)
-
-
-
- set DN by associative array
-
-
-
-
-
-
-
-
name = new KJUR.asn1.x509.X500Name();
-name.setByObject({C: "US", O: "aaa", CN="http://example.com/"1});
-
-
-
-
-
- Parameters:
-
-
- {Array} dnObj
-
-
- associative array of DN (ex. {C: "US", O: "aaa"})
-
-
-
-
-
-
- Since:
- jsrsasign 4.9. asn1x509 1.0.13
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.X500Name. setByString (dnStr)
-
-
-
- set DN by string
-
-
-
-
-
-
-
-
name = new KJUR.asn1.x509.X500Name();
-name.setByString("/C=US/O=aaa/OU=bbb/CN=foo@example.com");
-
-
-
-
-
- Parameters:
-
-
- {Array} dnStr
-
-
- distinguished name by string (ex. /C=US/O=aaa)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.x509.X509Util.html b/jwt/api/symbols/KJUR.asn1.x509.X509Util.html
deleted file mode 100644
index 2b86767..0000000
--- a/jwt/api/symbols/KJUR.asn1.x509.X509Util.html
+++ /dev/null
@@ -1,693 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509.X509Util
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.asn1.x509.X509Util
-
-
-
-
-
-
-
- X.509 certificate and CRL utilities class
-
-
- Defined in: asn1x509-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- X.509 certificate and CRL utilities class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- get PKCS#8 PEM public key string from RSAKey object
-
-
-
-
-
- <static>
-
-
- issue a certificate in PEM format
-This method can issue a certificate by a simple
-JSON object.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.asn1.x509.X509Util ()
-
-
-
- X.509 certificate and CRL utilities class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.X509Util. getPKCS8PubKeyPEMfromRSAKey (rsaKey)
-
-
-
- get PKCS#8 PEM public key string from RSAKey object
-
-
-
-
-
-
-
-
var pem = KJUR.asn1.x509.X509Util.getPKCS8PubKeyPEMfromRSAKey(pubKey);
-
-
-
-
-
- Parameters:
-
-
- {RSAKey } rsaKey
-
-
- RSA public key of RSAKey object
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509.X509Util. newCertPEM (param)
-
-
-
- issue a certificate in PEM format
-This method can issue a certificate by a simple
-JSON object.
-Signature value will be provided by signing with
-private key using 'cakey' parameter or
-hexa decimal signature value by 'sighex' parameter.
-
-NOTE: When using DSA or ECDSA CA signing key,
-use 'paramempty' in 'sigalg' to ommit parameter field
-of AlgorithmIdentifer. In case of RSA, parameter
-NULL will be specified by default.
-
-
-
-
-
-
-
var certPEM = KJUR.asn1.x509.X509Util.newCertPEM(
-{ serial: {int: 4},
- sigalg: {name: 'SHA1withECDSA', paramempty: true},
- issuer: {str: '/C=US/O=a'},
- notbefore: {'str': '130504235959Z'},
- notafter: {'str': '140504235959Z'},
- subject: {str: '/C=US/O=b'},
- sbjpubkey: pubKeyPEM,
- ext: [
- {basicConstraints: {cA: true, critical: true}},
- {keyUsage: {bin: '11'}},
- ],
- cakey: [prvkey, pass]}
-);
-// -- or --
-var certPEM = KJUR.asn1.x509.X509Util.newCertPEM(
-{ serial: {int: 1},
- sigalg: {name: 'SHA1withRSA', paramempty: true},
- issuer: {str: '/C=US/O=T1'},
- notbefore: {'str': '130504235959Z'},
- notafter: {'str': '140504235959Z'},
- subject: {str: '/C=US/O=T1'},
- sbjpubkey: pubKeyObj,
- sighex: '0102030405..'}
-);
-// for the issuer and subject field, another
-// representation is also available
-var certPEM = KJUR.asn1.x509.X509Util.newCertPEM(
-{ serial: {int: 1},
- sigalg: {name: 'SHA1withRSA', paramempty: true},
- issuer: {C: "US", O: "T1"},
- notbefore: {'str': '130504235959Z'},
- notafter: {'str': '140504235959Z'},
- subject: {C: "US", O: "T1", CN: "http://example.com/"},
- sbjpubkey: pubKeyObj,
- sighex: '0102030405..'}
-);
-
-
-
-
-
- Parameters:
-
-
- {Array} param
-
-
- parameter to issue a certificate
-
-
-
-
-
-
- Since:
- asn1x509 1.0.6
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.asn1.x509.html b/jwt/api/symbols/KJUR.asn1.x509.html
deleted file mode 100644
index 6c4f5c3..0000000
--- a/jwt/api/symbols/KJUR.asn1.x509.html
+++ /dev/null
@@ -1,901 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.asn1.x509
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Namespace KJUR.asn1.x509
-
-
-
-
-
-
-
-
-
-
- Defined in: asn1x509-1.0.js .
-
-
-
-
-
-
- Namespace Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- kjur's ASN.1 class for X.509 certificate library name space
-
-
FEATURES
-
-easily issue any kind of certificate
-APIs are very similar to BouncyCastle library ASN.1 classes.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
- KJUR.asn1.x509.getEncodedHex ()
-
-
-
-
-
-
- <static>
-
- KJUR.asn1.x509.getExtnValueHex ()
-
-
-
-
-
-
- <static>
-
- KJUR.asn1.x509.getPEMString ()
-
-
-
-
-
-
- <static>
-
- KJUR.asn1.x509.setByString (dnStr)
-
-
-
-
-
-
- <static>
-
- KJUR.asn1.x509.setIssuerByParam (x500NameParam)
-
-
-
-
-
-
- <static>
-
- KJUR.asn1.x509.setRsaPrvKeyByPEMandPass (rsaPEM, passPEM)
-
-
-
-
-
-
- <static>
-
- KJUR.asn1.x509.setSignatureAlgByParam (algIdParam)
-
-
-
-
-
-
- <static>
-
- KJUR.asn1.x509.sign ()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Namespace Detail
-
-
-
- KJUR.asn1.x509
-
-
-
- kjur's ASN.1 class for X.509 certificate library name space
-
-
FEATURES
-
-easily issue any kind of certificate
-APIs are very similar to BouncyCastle library ASN.1 classes. So easy to learn.
-
-
-
PROVIDED CLASSES
-
-
SUPPORTED EXTENSIONS
-
-NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.asn1.x509. getEncodedHex ()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509. getExtnValueHex ()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509. getPEMString ()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509. setByString (dnStr)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- dnStr
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509. setIssuerByParam (x500NameParam)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- x500NameParam
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509. setRsaPrvKeyByPEMandPass (rsaPEM, passPEM)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- rsaPEM
-
-
-
-
-
- passPEM
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509. setSignatureAlgByParam (algIdParam)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- algIdParam
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.asn1.x509. sign ()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.crypto.DSA.html b/jwt/api/symbols/KJUR.crypto.DSA.html
deleted file mode 100644
index 2d8916d..0000000
--- a/jwt/api/symbols/KJUR.crypto.DSA.html
+++ /dev/null
@@ -1,865 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.crypto.DSA
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.crypto.DSA
-
-
-
-
-
-
-
- class for DSA signing and verifcation
-
-
- Defined in: dsa-modified-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for DSA signing and verification
-
CAUTION: Most of the case, you don't need to use this class.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- parse hexadecimal ASN.1 DSA signature value
-
-
-
-
- <static>
-
-
- set DSA private key by key specs
-
-
-
-
- <static>
-
-
- set DSA public key by key specs
-
-
-
-
- <static>
-
-
- sign to hashed message by this DSA private key object
-
-
-
-
- <static>
-
-
- verify signature by this DSA public key object
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.crypto.DSA ()
-
-
-
- class for DSA signing and verification
-
CAUTION: Most of the case, you don't need to use this class.
Please use KJUR.crypto.Signature class instead.
This class was originally developped by Recurity Labs GmbH for OpenPGP JavaScript library.
(See https://github.com/openpgpjs/openpgpjs/blob/master/src/ciphers/asymmetric/dsa.js)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
- {Array}
- KJUR.crypto.DSA. parseASN1Signature (hSigVal)
-
-
-
- parse hexadecimal ASN.1 DSA signature value
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} hSigVal
-
-
- hexadecimal string of ASN.1 encoded DSA signature value
-
-
-
-
-
-
- Since:
- dsa-modified 1.0.0
-
-
-
-
-
-
- Returns:
-
- {Array} array [s1, s2] of DSA signature value. Both s1 and s2 are BigInteger.
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto.DSA. setPrivate (p, q, g, y, x)
-
-
-
- set DSA private key by key specs
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {BigInteger} p
-
-
- prime P
-
-
- {BigInteger} q
-
-
- sub prime Q
-
-
- {BigInteger} g
-
-
- base G
-
-
- {BigInteger} y
-
-
- public key Y
-
-
- {BigInteger} x
-
-
- private key X
-
-
-
-
-
-
- Since:
- dsa-modified 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto.DSA. setPublic (p, q, g, y)
-
-
-
- set DSA public key by key specs
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {BigInteger} p
-
-
- prime P
-
-
- {BigInteger} q
-
-
- sub prime Q
-
-
- {BigInteger} g
-
-
- base G
-
-
- {BigInteger} y
-
-
- public key Y
-
-
-
-
-
-
- Since:
- dsa-modified 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KJUR.crypto.DSA. signWithMessageHash (sHashHex)
-
-
-
- sign to hashed message by this DSA private key object
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} sHashHex
-
-
- hexadecimal string of hashed message
-
-
-
-
-
-
- Since:
- dsa-modified 1.0.0
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of ASN.1 encoded DSA signature value
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Boolean}
- KJUR.crypto.DSA. verifyWithMessageHash (sHashHex, hSigVal)
-
-
-
- verify signature by this DSA public key object
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} sHashHex
-
-
- hexadecimal string of hashed message
-
-
- {String} hSigVal
-
-
- hexadecimal string of ASN.1 encoded DSA signature value
-
-
-
-
-
-
- Since:
- dsa-modified 1.0.0
-
-
-
-
-
-
- Returns:
-
- {Boolean} true if the signature is valid otherwise false.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.crypto.ECDSA.html b/jwt/api/symbols/KJUR.crypto.ECDSA.html
deleted file mode 100644
index 0a165db..0000000
--- a/jwt/api/symbols/KJUR.crypto.ECDSA.html
+++ /dev/null
@@ -1,1128 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.crypto.ECDSA
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.crypto.ECDSA
-
-
-
-
-
-
-
- class for EC key generation, ECDSA signing and verifcation
-
-
- Defined in: ecdsa-modified-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- class for EC key generation, ECDSA signing and verifcation
-
-CAUTION: Most of the case, you don't need to use this class except
-for generating an EC key pair.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- convert hexadecimal ASN.1 encoded signature to concatinated signature
-
-
-
-
- <static>
-
-
- convert R and S BigInteger object of signature to ASN.1 encoded signature
-
-
-
-
- <static>
-
-
- convert hexadecimal concatinated signature to ASN.1 encoded signature
-
-
-
-
- <static>
-
-
- generate a EC key pair
-
-
-
-
- <static>
-
-
- convert hexadecimal R and S value of signature to ASN.1 encoded signature
-
-
-
-
- <static>
-
-
- parse ASN.1 DER encoded ECDSA signature
-
-
-
-
- <static>
-
-
- parse ASN.1 DER encoded ECDSA signature
-
-
-
-
- <static>
-
- KJUR.crypto.ECDSA.
signHex (hashHex, privHex)
-
- signing to message hash
-
-
-
-
- <static>
-
- KJUR.crypto.ECDSA.
verifyHex (hashHex, sigHex, pubkeyHex)
-
- verifying signature with message hash and public key
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.crypto.ECDSA ()
-
-
-
- class for EC key generation, ECDSA signing and verifcation
-
-CAUTION: Most of the case, you don't need to use this class except
-for generating an EC key pair. Please use KJUR.crypto.Signature class instead.
-
-
-This class was originally developped by Stefan Thomas for Bitcoin JavaScript library.
-(See https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/src/ecdsa.js)
-Currently this class supports following named curves and their aliases.
-
-secp256r1, NIST P-256, P-256, prime256v1 (*)
-secp256k1 (*)
-secp384r1, NIST P-384, P-384 (*)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
- {String}
- KJUR.crypto.ECDSA. asn1SigToConcatSig (asn1Hex)
-
-
-
- convert hexadecimal ASN.1 encoded signature to concatinated signature
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} asn1Hex
-
-
- hexadecimal string of ASN.1 encoded ECDSA signature value
-
-
-
-
-
-
- Since:
- ecdsa-modified 1.0.3
-
-
-
-
-
-
- Returns:
-
- {String} r-s concatinated format of ECDSA signature value
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KJUR.crypto.ECDSA. biRSSigToASN1Sig (biR, biS)
-
-
-
- convert R and S BigInteger object of signature to ASN.1 encoded signature
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {BigInteger} biR
-
-
- BigInteger object of R field of ECDSA signature value
-
-
- {BigInteger} biS
-
-
- BIgInteger object of S field of ECDSA signature value
-
-
-
-
-
-
- Since:
- ecdsa-modified 1.0.3
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of ASN.1 encoded ECDSA signature value
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KJUR.crypto.ECDSA. concatSigToASN1Sig (concatSig)
-
-
-
- convert hexadecimal concatinated signature to ASN.1 encoded signature
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} concatSig
-
-
- r-s concatinated format of ECDSA signature value
-
-
-
-
-
-
- Since:
- ecdsa-modified 1.0.3
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of ASN.1 encoded ECDSA signature value
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Array}
- KJUR.crypto.ECDSA. generateKeyPairHex ()
-
-
-
- generate a EC key pair
-
-
-
-
-
-
-
var ec = new KJUR.crypto.ECDSA({'curve': 'secp256r1'});
-var keypair = ec.generateKeyPairHex();
-var pubhex = keypair.ecpubhex; // hexadecimal string of EC private key (=d)
-var prvhex = keypair.ecprvhex; // hexadecimal string of EC public key
-
-
-
-
-
-
-
- Since:
- ecdsa-modified 1.0.1
-
-
-
-
-
-
- Returns:
-
- {Array} associative array of hexadecimal string of private and public key
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KJUR.crypto.ECDSA. hexRSSigToASN1Sig (hR, hS)
-
-
-
- convert hexadecimal R and S value of signature to ASN.1 encoded signature
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} hR
-
-
- hexadecimal string of R field of ECDSA signature value
-
-
- {String} hS
-
-
- hexadecimal string of S field of ECDSA signature value
-
-
-
-
-
-
- Since:
- ecdsa-modified 1.0.3
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of ASN.1 encoded ECDSA signature value
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Array}
- KJUR.crypto.ECDSA. parseSigHex (sigHex)
-
-
-
- parse ASN.1 DER encoded ECDSA signature
-
-
-
-
-
-
-
var ec = new KJUR.crypto.ECDSA({'curve': 'secp256r1'});
-var sig = ec.parseSigHex('30...');
-var biR = sig.r; // BigInteger object for 'r' field of signature.
-var biS = sig.s; // BigInteger object for 's' field of signature.
-
-
-
-
-
- Parameters:
-
-
- {String} sigHex
-
-
- hexadecimal string of ECDSA signature value
-
-
-
-
-
-
- Since:
- ecdsa-modified 1.0.1
-
-
-
-
-
-
- Returns:
-
- {Array} associative array of signature field r and s of BigInteger
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Array}
- KJUR.crypto.ECDSA. parseSigHexInHexRS (sigHex)
-
-
-
- parse ASN.1 DER encoded ECDSA signature
-
-
-
-
-
-
-
var ec = new KJUR.crypto.ECDSA({'curve': 'secp256r1'});
-var sig = ec.parseSigHexInHexRS('30...');
-var hR = sig.r; // hexadecimal string for 'r' field of signature.
-var hS = sig.s; // hexadecimal string for 's' field of signature.
-
-
-
-
-
- Parameters:
-
-
- {String} sigHex
-
-
- hexadecimal string of ECDSA signature value
-
-
-
-
-
-
- Since:
- ecdsa-modified 1.0.3
-
-
-
-
-
-
- Returns:
-
- {Array} associative array of signature field r and s in hexadecimal
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KJUR.crypto.ECDSA. signHex (hashHex, privHex)
-
-
-
- signing to message hash
-
-
-
-
-
-
-
var ec = new KJUR.crypto.ECDSA({'curve': 'secp256r1'});
-var sigValue = ec.signHex(hash, prvKey);
-
-
-
-
-
- Parameters:
-
-
- {String} hashHex
-
-
- hexadecimal string of hash value of signing message
-
-
- {String} privHex
-
-
- hexadecimal string of EC private key
-
-
-
-
-
-
- Since:
- ecdsa-modified 1.0.1
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of ECDSA signature
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Boolean}
- KJUR.crypto.ECDSA. verifyHex (hashHex, sigHex, pubkeyHex)
-
-
-
- verifying signature with message hash and public key
-
-
-
-
-
-
-
var ec = new KJUR.crypto.ECDSA({'curve': 'secp256r1'});
-var result = ec.verifyHex(msgHashHex, sigHex, pubkeyHex);
-
-
-
-
-
- Parameters:
-
-
- {String} hashHex
-
-
- hexadecimal string of hash value of signing message
-
-
- {String} sigHex
-
-
- hexadecimal string of signature value
-
-
- {String} pubkeyHex
-
-
- hexadecimal string of public key
-
-
-
-
-
-
- Since:
- ecdsa-modified 1.0.1
-
-
-
-
-
-
- Returns:
-
- {Boolean} true if the signature is valid, otherwise false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.crypto.ECParameterDB.html b/jwt/api/symbols/KJUR.crypto.ECParameterDB.html
deleted file mode 100644
index 1d53dc5..0000000
--- a/jwt/api/symbols/KJUR.crypto.ECParameterDB.html
+++ /dev/null
@@ -1,708 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.crypto.ECParameterDB
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.crypto.ECParameterDB
-
-
-
-
-
-
-
- static object for elliptic curve names and parameters
-
-
- Defined in: ecparam-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- static object for elliptic curve names and parameters
-This class provides parameters for named elliptic curves.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
- KJUR.crypto.ECParameterDB.
getByName (nameOrAlias)
-
- get curve inforamtion associative array for curve name or alias
-
-
-
-
- <static>
-
- KJUR.crypto.ECParameterDB.
regist (name, keylen, pHex, aHex, bHex, nHex, hHex, gxHex, gyHex, aliasList, oid, info)
-
- register new curve
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.crypto.ECParameterDB ()
-
-
-
- static object for elliptic curve names and parameters
-This class provides parameters for named elliptic curves.
Currently it supoprts following curve names and aliases however
the name marked (*) are available for
KJUR.crypto.ECDSA and
KJUR.crypto.Signature classes.
secp128r1
secp160r1
secp160k1
secp192r1
secp192k1
secp224r1
secp256r1, NIST P-256, P-256, prime256v1 (*)
secp256k1 (*)
secp384r1, NIST P-384, P-384 (*)
secp521r1, NIST P-521, P-521
You can register new curves by using 'register' method.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
- {Array}
- KJUR.crypto.ECParameterDB. getByName (nameOrAlias)
-
-
-
- get curve inforamtion associative array for curve name or alias
-
-
-
-
-
-
-
var param = KJUR.crypto.ECParameterDB.getByName('prime256v1');
var keylen = param['keylen'];
var n = param['n'];
-
-
-
-
-
- Parameters:
-
-
- {String} nameOrAlias
-
-
- curve name or alias name
-
-
-
-
-
-
-
-
- Returns:
-
- {Array} associative array of curve parameters
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto.ECParameterDB. regist (name, keylen, pHex, aHex, bHex, nHex, hHex, gxHex, gyHex, aliasList, oid, info)
-
-
-
- register new curve
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} name
-
-
- name of curve
-
-
- {Integer} keylen
-
-
- key length
-
-
- {String} pHex
-
-
- hexadecimal value of p
-
-
- {String} aHex
-
-
- hexadecimal value of a
-
-
- {String} bHex
-
-
- hexadecimal value of b
-
-
- {String} nHex
-
-
- hexadecimal value of n
-
-
- {String} hHex
-
-
- hexadecimal value of h
-
-
- {String} gxHex
-
-
- hexadecimal value of Gx
-
-
- {String} gyHex
-
-
- hexadecimal value of Gy
-
-
- {Array} aliasList
-
-
- array of string for curve names aliases
-
-
- {String} oid
-
-
- Object Identifier for the curve
-
-
- {String} info
-
-
- information string for the curve
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.crypto.Mac.html b/jwt/api/symbols/KJUR.crypto.Mac.html
deleted file mode 100644
index f7a14f1..0000000
--- a/jwt/api/symbols/KJUR.crypto.Mac.html
+++ /dev/null
@@ -1,925 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.crypto.Mac
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.crypto.Mac
-
-
-
-
-
-
-
- Mac class which is very similar to java.security.Mac class
-
-
- Defined in: crypto-1.1.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- Mac(Message Authentication Code) class which is very similar to java.security.Mac class
-
-Currently this supports following algorithm and providers combination:
-
-hmacmd5 - cryptojs
-hmacsha1 - cryptojs
-hmacsha224 - cryptojs
-hmacsha256 - cryptojs
-hmacsha384 - cryptojs
-hmacsha512 - cryptojs
-
-NOTE: HmacSHA224 and HmacSHA384 issue was fixed since jsrsasign 4.1.4.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- completes hash calculation and returns hash result
-
-
-
-
-
- <static>
-
-
- performs final update on the digest using hexadecimal string,
-then completes the digest computation
-
-
-
-
-
- <static>
-
-
- performs final update on the digest using string, then completes the digest computation
-
-
-
-
-
- <static>
-
-
- set password for Mac
-This method will set password for (H)Mac internally.
-
-
-
-
- <static>
-
-
- update digest by specified hexadecimal string
-
-
-
-
-
- <static>
-
-
- update digest by specified string
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.crypto.Mac (params)
-
-
-
- Mac(Message Authentication Code) class which is very similar to java.security.Mac class
-
-Currently this supports following algorithm and providers combination:
-
-hmacmd5 - cryptojs
-hmacsha1 - cryptojs
-hmacsha224 - cryptojs
-hmacsha256 - cryptojs
-hmacsha384 - cryptojs
-hmacsha512 - cryptojs
-
-NOTE: HmacSHA224 and HmacSHA384 issue was fixed since jsrsasign 4.1.4.
-Please use 'ext/cryptojs-312-core-fix*.js' instead of 'core.js' of original CryptoJS
-to avoid those issue.
-
-NOTE2: Hmac signature bug was fixed in jsrsasign 4.9.0 by providing CryptoJS
-bug workaround.
-
-Please see
KJUR.crypto.Mac.setPassword , how to provide password
-in various ways in detail.
-
-
-
-
-
-
var mac = new KJUR.crypto.Mac({alg: "HmacSHA1", "pass": "pass"});
-mac.updateString('aaa')
-var macHex = md.doFinal()
-
-// other password representation
-var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": {"hex": "6161"}});
-var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": {"utf8": "aa"}});
-var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": {"rstr": "\x61\x61"}});
-var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": {"b64": "Mi02/+...a=="}});
-var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": {"b64u": "Mi02_-...a"}});
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- parameters for constructor
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.crypto.Mac. doFinal ()
-
-
-
- completes hash calculation and returns hash result
-
-
-
-
-
-
-
-
md.digest()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto.Mac. doFinalHex (hex)
-
-
-
- performs final update on the digest using hexadecimal string,
-then completes the digest computation
-
-
-
-
-
-
-
-
md.digestHex('0f2abd')
-
-
-
-
-
- Parameters:
-
-
- {String} hex
-
-
- hexadecimal string to final update
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto.Mac. doFinalString (str)
-
-
-
- performs final update on the digest using string, then completes the digest computation
-
-
-
-
-
-
-
-
md.digestString('aaa')
-
-
-
-
-
- Parameters:
-
-
- {String} str
-
-
- string to final update
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto.Mac. setPassword (pass)
-
-
-
- set password for Mac
-This method will set password for (H)Mac internally.
-Argument 'pass' can be specified as following:
-
-even length string of 0..9, a..f or A-F: implicitly specified as hexadecimal string
-not above string: implicitly specified as raw string
-{rstr: "\x65\x70"}: explicitly specified as raw string
-{hex: "6570"}: explicitly specified as hexacedimal string
-{utf8: "秘密"}: explicitly specified as UTF8 string
-{b64: "Mi78..=="}: explicitly specified as Base64 string
-{b64u: "Mi7-_"}: explicitly specified as Base64URL string
-
-It is *STRONGLY RECOMMENDED* that explicit representation of password argument
-to avoid ambiguity. For example string "6161" can mean a string "6161" or
-a hexadecimal string of "aa" (i.e. \x61\x61).
-
-
-
-
-
-
-
mac = KJUR.crypto.Mac({'alg': 'hmacsha256'});
-// set password by implicit raw string
-mac.setPassword("\x65\x70\xb9\x0b");
-mac.setPassword("password");
-// set password by implicit hexadecimal string
-mac.setPassword("6570b90b");
-mac.setPassword("6570B90B");
-// set password by explicit raw string
-mac.setPassword({"rstr": "\x65\x70\xb9\x0b"});
-// set password by explicit hexadecimal string
-mac.setPassword({"hex": "6570b90b"});
-// set password by explicit utf8 string
-mac.setPassword({"utf8": "passwordパスワード");
-// set password by explicit Base64 string
-mac.setPassword({"b64": "Mb+c3f/=="});
-// set password by explicit Base64URL string
-mac.setPassword({"b64u": "Mb-c3f_"});
-
-
-
-
-
- Parameters:
-
-
- {Object} pass
-
-
- password for Mac
-
-
-
-
-
-
- Since:
- crypto 1.1.7 jsrsasign 4.9.0
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto.Mac. updateHex (hex)
-
-
-
- update digest by specified hexadecimal string
-
-
-
-
-
-
-
-
md.updateHex('0afe36');
-
-
-
-
-
- Parameters:
-
-
- {String} hex
-
-
- hexadecimal string to update
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto.Mac. updateString (str)
-
-
-
- update digest by specified string
-
-
-
-
-
-
-
-
md.updateString('New York');
-
-
-
-
-
- Parameters:
-
-
- {String} str
-
-
- string to update
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.crypto.MessageDigest.html b/jwt/api/symbols/KJUR.crypto.MessageDigest.html
deleted file mode 100644
index 1561c2a..0000000
--- a/jwt/api/symbols/KJUR.crypto.MessageDigest.html
+++ /dev/null
@@ -1,890 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.crypto.MessageDigest
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.crypto.MessageDigest
-
-
-
-
-
-
-
- MessageDigest class which is very similar to java.security.MessageDigest class
-
-
- Defined in: crypto-1.1.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- MessageDigest class which is very similar to java.security.MessageDigest class
-
-Currently this supports following algorithm and providers combination:
-
-md5 - cryptojs
-sha1 - cryptojs
-sha224 - cryptojs
-sha256 - cryptojs
-sha384 - cryptojs
-sha512 - cryptojs
-ripemd160 - cryptojs
-sha256 - sjcl (NEW from crypto.js 1.0.4)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
- KJUR.crypto.MessageDigest.
digest ()
-
- completes hash calculation and returns hash result
-
-
-
-
-
- <static>
-
-
- performs final update on the digest using hexadecimal string, then completes the digest computation
-
-
-
-
-
- <static>
-
-
- performs final update on the digest using string, then completes the digest computation
-
-
-
-
-
- <static>
-
-
- set hash algorithm and provider
-
-
-
-
-
- <static>
-
-
- update digest by specified hexadecimal string
-
-
-
-
-
- <static>
-
-
- update digest by specified string
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.crypto.MessageDigest (params)
-
-
-
- MessageDigest class which is very similar to java.security.MessageDigest class
-
-Currently this supports following algorithm and providers combination:
-
-md5 - cryptojs
-sha1 - cryptojs
-sha224 - cryptojs
-sha256 - cryptojs
-sha384 - cryptojs
-sha512 - cryptojs
-ripemd160 - cryptojs
-sha256 - sjcl (NEW from crypto.js 1.0.4)
-
-
-
-
-
-
-
// CryptoJS provider sample
-var md = new KJUR.crypto.MessageDigest({alg: "sha1", prov: "cryptojs"});
-md.updateString('aaa')
-var mdHex = md.digest()
-
-// SJCL(Stanford JavaScript Crypto Library) provider sample
-var md = new KJUR.crypto.MessageDigest({alg: "sha256", prov: "sjcl"}); // sjcl supports sha256 only
-md.updateString('aaa')
-var mdHex = md.digest()
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- parameters for constructor
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.crypto.MessageDigest. digest ()
-
-
-
- completes hash calculation and returns hash result
-
-
-
-
-
-
-
-
md.digest()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto.MessageDigest. digestHex (hex)
-
-
-
- performs final update on the digest using hexadecimal string, then completes the digest computation
-
-
-
-
-
-
-
-
md.digestHex('0f2abd')
-
-
-
-
-
- Parameters:
-
-
- {String} hex
-
-
- hexadecimal string to final update
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto.MessageDigest. digestString (str)
-
-
-
- performs final update on the digest using string, then completes the digest computation
-
-
-
-
-
-
-
-
md.digestString('aaa')
-
-
-
-
-
- Parameters:
-
-
- {String} str
-
-
- string to final update
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto.MessageDigest. setAlgAndProvider (alg, prov)
-
-
-
- set hash algorithm and provider
-
-
-
-
-
-
-
-
// for SHA1
-md.setAlgAndProvider('sha1', 'cryptojs');
-// for RIPEMD160
-md.setAlgAndProvider('ripemd160', 'cryptojs');
-
-
-
-
-
- Parameters:
-
-
- {String} alg
-
-
- hash algorithm name
-
-
- {String} prov
-
-
- provider name
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto.MessageDigest. updateHex (hex)
-
-
-
- update digest by specified hexadecimal string
-
-
-
-
-
-
-
-
md.updateHex('0afe36');
-
-
-
-
-
- Parameters:
-
-
- {String} hex
-
-
- hexadecimal string to update
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto.MessageDigest. updateString (str)
-
-
-
- update digest by specified string
-
-
-
-
-
-
-
-
md.updateString('New York');
-
-
-
-
-
- Parameters:
-
-
- {String} str
-
-
- string to update
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.crypto.OID.html b/jwt/api/symbols/KJUR.crypto.OID.html
deleted file mode 100644
index a789e4b..0000000
--- a/jwt/api/symbols/KJUR.crypto.OID.html
+++ /dev/null
@@ -1,580 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.crypto.OID
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.crypto.OID
-
-
-
-
-
-
-
- static object for cryptography related OIDs
-
-
- Defined in: crypto-1.1.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- static object for cryptographic function utilities
-
-
-
-
-
-
-
-
-
-
-
-
- Field Summary
-
-
- Field Attributes
- Field Name and Description
-
-
-
-
-
-
-
-
- key value of hexadecimal OID and its name
- (ex.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.crypto.OID ()
-
-
-
- static object for cryptographic function utilities
-
-
-
-
-
-
-
-
-
-
-
- Since:
- crypto 1.1.3
-
-
-
-
-
-
-
-
-
-
-
-
-
- Field Detail
-
-
-
-
-
- {Array}
- oidhex2name
-
-
-
- key value of hexadecimal OID and its name
- (ex. '2a8648ce3d030107' and 'secp256r1')
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.crypto.Signature.html b/jwt/api/symbols/KJUR.crypto.Signature.html
deleted file mode 100644
index 612ef5c..0000000
--- a/jwt/api/symbols/KJUR.crypto.Signature.html
+++ /dev/null
@@ -1,1352 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.crypto.Signature
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.crypto.Signature
-
-
-
-
-
-
-
- Signature class which is very similar to java.security.Signature class
-
-
- Defined in: crypto-1.1.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- Signature class which is very similar to java.security.Signature class
-
-As for params of constructor's argument, it can be specify following attributes:
-
-alg - signature algorithm name (ex.
-
-
-
-
-
-
-
-
-
-
-
- Field Summary
-
-
- Field Attributes
- Field Name and Description
-
-
-
-
-
-
-
-
- Current state of this signature object whether 'SIGN', 'VERIFY' or null
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
- KJUR.crypto.Signature.
init (key, pass)
-
- Initialize this object for signing or verifying depends on key
-This method is very useful initialize method for Signature class since
-you just specify key then this method will automatically initialize it
-using
KEYUTIL.getKey method.
-
-
-
-
- <static>
-
-
- Initialize this object for signing
-Private key information will be provided as 'param' parameter and the value will be
-following:
-
-RSAKey object for RSA signing
-associative array for ECDSA signing
- (ex.
-
-
-
-
- <static>
-
-
- Initialize this object for verifying with a certficate
-
-
-
-
-
- <static>
-
-
- Initialize this object for verifying with a public key
-Public key information will be provided as 'param' parameter and the value will be
-following:
-
-RSAKey object for RSA verification
-associative array for ECDSA verification
- (ex.
-
-
-
-
- <static>
-
-
- set signature algorithm and provider
-
-
-
-
-
- <static>
-
- KJUR.crypto.Signature.
sign ()
-
- Returns the signature bytes of all data updates as a hexadecimal string
-
-
-
-
-
- <static>
-
- KJUR.crypto.Signature.
signHex (hex)
-
- performs final update on the sign using hexadecimal string, then returns the signature bytes of all data updates as a hexadecimal string
-
-
-
-
-
- <static>
-
-
- performs final update on the sign using string, then returns the signature bytes of all data updates as a hexadecimal string
-
-
-
-
-
- <static>
-
-
- Updates the data to be signed or verified by a hexadecimal string
-
-
-
-
-
- <static>
-
-
- Updates the data to be signed or verified by a string
-
-
-
-
-
- <static>
-
- KJUR.crypto.Signature.
verify (str)
-
- verifies the passed-in signature.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.crypto.Signature (params)
-
-
-
- Signature class which is very similar to java.security.Signature class
-
-As for params of constructor's argument, it can be specify following attributes:
-
-alg - signature algorithm name (ex. {MD5,SHA1,SHA224,SHA256,SHA384,SHA512,RIPEMD160}with{RSA,ECDSA,DSA})
-provider - currently 'cryptojs/jsrsa' only
-
-
SUPPORTED ALGORITHMS AND PROVIDERS
-This Signature class supports following signature algorithm and provider names:
-
-MD5withRSA - cryptojs/jsrsa
-SHA1withRSA - cryptojs/jsrsa
-SHA224withRSA - cryptojs/jsrsa
-SHA256withRSA - cryptojs/jsrsa
-SHA384withRSA - cryptojs/jsrsa
-SHA512withRSA - cryptojs/jsrsa
-RIPEMD160withRSA - cryptojs/jsrsa
-MD5withECDSA - cryptojs/jsrsa
-SHA1withECDSA - cryptojs/jsrsa
-SHA224withECDSA - cryptojs/jsrsa
-SHA256withECDSA - cryptojs/jsrsa
-SHA384withECDSA - cryptojs/jsrsa
-SHA512withECDSA - cryptojs/jsrsa
-RIPEMD160withECDSA - cryptojs/jsrsa
-MD5withRSAandMGF1 - cryptojs/jsrsa
-SHA1withRSAandMGF1 - cryptojs/jsrsa
-SHA224withRSAandMGF1 - cryptojs/jsrsa
-SHA256withRSAandMGF1 - cryptojs/jsrsa
-SHA384withRSAandMGF1 - cryptojs/jsrsa
-SHA512withRSAandMGF1 - cryptojs/jsrsa
-RIPEMD160withRSAandMGF1 - cryptojs/jsrsa
-SHA1withDSA - cryptojs/jsrsa
-SHA224withDSA - cryptojs/jsrsa
-SHA256withDSA - cryptojs/jsrsa
-
-Here are supported elliptic cryptographic curve names and their aliases for ECDSA:
-
-secp256k1
-secp256r1, NIST P-256, P-256, prime256v1
-secp384r1, NIST P-384, P-384
-
-NOTE1: DSA signing algorithm is also supported since crypto 1.1.5.
-
EXAMPLES
-
-
-
-
-
-
// RSA signature generation
-var sig = new KJUR.crypto.Signature({"alg": "SHA1withRSA"});
-sig.init(prvKeyPEM);
-sig.updateString('aaa');
-var hSigVal = sig.sign();
-
-// DSA signature validation
-var sig2 = new KJUR.crypto.Signature({"alg": "SHA1withDSA"});
-sig2.init(certPEM);
-sig.updateString('aaa');
-var isValid = sig2.verify(hSigVal);
-
-// ECDSA signing
-var sig = new KJUR.crypto.Signature({'alg':'SHA1withECDSA'});
-sig.init(prvKeyPEM);
-sig.updateString('aaa');
-var sigValueHex = sig.sign();
-
-// ECDSA verifying
-var sig2 = new KJUR.crypto.Signature({'alg':'SHA1withECDSA'});
-sig.init(certPEM);
-sig.updateString('aaa');
-var isValid = sig.verify(sigValueHex);
-
-
-
-
-
-
- Parameters:
-
-
- {Array} params
-
-
- parameters for constructor
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Field Detail
-
-
-
-
-
- {String}
- state
-
-
-
- Current state of this signature object whether 'SIGN', 'VERIFY' or null
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.crypto.Signature. init (key, pass)
-
-
-
- Initialize this object for signing or verifying depends on key
-This method is very useful initialize method for Signature class since
-you just specify key then this method will automatically initialize it
-using
KEYUTIL.getKey method.
-As for 'key', following argument type are supported:
-
signing
-
-PEM formatted PKCS#8 encrypted RSA/ECDSA private key concluding "BEGIN ENCRYPTED PRIVATE KEY"
-PEM formatted PKCS#5 encrypted RSA/DSA private key concluding "BEGIN RSA/DSA PRIVATE KEY" and ",ENCRYPTED"
-PEM formatted PKCS#8 plain RSA/ECDSA private key concluding "BEGIN PRIVATE KEY"
-PEM formatted PKCS#5 plain RSA/DSA private key concluding "BEGIN RSA/DSA PRIVATE KEY" without ",ENCRYPTED"
-RSAKey object of private key
-KJUR.crypto.ECDSA object of private key
-KJUR.crypto.DSA object of private key
-
-
verification
-
-PEM formatted PKCS#8 RSA/EC/DSA public key concluding "BEGIN PUBLIC KEY"
-PEM formatted X.509 certificate with RSA/EC/DSA public key concluding
- "BEGIN CERTIFICATE", "BEGIN X509 CERTIFICATE" or "BEGIN TRUSTED CERTIFICATE".
-RSAKey object of public key
-KJUR.crypto.ECDSA object of public key
-KJUR.crypto.DSA object of public key
-
-
-
-
-
-
-
-
sig.init(sCertPEM)
-
-
-
-
-
- Parameters:
-
-
- {Object} key
-
-
- specifying public or private key as plain/encrypted PKCS#5/8 PEM file, certificate PEM or RSAKey , KJUR.crypto.DSA or KJUR.crypto.ECDSA object
-
-
- {String} pass
-
-
- (OPTION) passcode for encrypted private key
-
-
-
-
-
-
- Since:
- crypto 1.1.3
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto.Signature. initSign (param)
-
-
-
- Initialize this object for signing
-Private key information will be provided as 'param' parameter and the value will be
-following:
-
-RSAKey object for RSA signing
-associative array for ECDSA signing
- (ex. {'ecprvhex': '1d3f..', 'eccurvename': 'secp256r1'}
)
-
-
-
-
-
-
-
-
sig.initSign(prvKey)
-
-
-
-
-
- Parameters:
-
-
- {Object} param
-
-
- RSAKey object of public key or associative array for ECDSA
-
-
-
-
-
- Deprecated:
-
- from crypto 1.1.5. please use init() method instead.
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto.Signature. initVerifyByCertificatePEM (certPEM)
-
-
-
- Initialize this object for verifying with a certficate
-
-
-
-
-
-
-
-
sig.initVerifyByCertificatePEM(certPEM)
-
-
-
-
-
- Parameters:
-
-
- {String} certPEM
-
-
- PEM formatted string of certificate
-
-
-
-
-
- Deprecated:
-
- from crypto 1.1.5. please use init() method instead.
-
-
-
-
-
- Since:
- 1.0.2
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto.Signature. initVerifyByPublicKey (param)
-
-
-
- Initialize this object for verifying with a public key
-Public key information will be provided as 'param' parameter and the value will be
-following:
-
-RSAKey object for RSA verification
-associative array for ECDSA verification
- (ex. {'ecpubhex': '041f..', 'eccurvename': 'secp256r1'}
)
-
-
-
-
-
-
-
-
-
sig.initVerifyByPublicKey(rsaPrvKey)
-
-
-
-
-
- Parameters:
-
-
- {Object} param
-
-
- RSAKey object of public key or associative array for ECDSA
-
-
-
-
-
- Deprecated:
-
- from crypto 1.1.5. please use init() method instead.
-
-
-
-
-
- Since:
- 1.0.2
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto.Signature. setAlgAndProvider (alg, prov)
-
-
-
- set signature algorithm and provider
-
-
-
-
-
-
-
-
md.setAlgAndProvider('SHA1withRSA', 'cryptojs/jsrsa');
-
-
-
-
-
- Parameters:
-
-
- {String} alg
-
-
- signature algorithm name
-
-
- {String} prov
-
-
- provider name
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto.Signature. sign ()
-
-
-
- Returns the signature bytes of all data updates as a hexadecimal string
-
-
-
-
-
-
-
-
var hSigValue = sig.sign()
-
-
-
-
-
-
-
-
-
- Returns:
-
- the signature bytes as a hexadecimal string
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto.Signature. signHex (hex)
-
-
-
- performs final update on the sign using hexadecimal string, then returns the signature bytes of all data updates as a hexadecimal string
-
-
-
-
-
-
-
-
var hSigValue = sig.signHex('1fdc33')
-
-
-
-
-
- Parameters:
-
-
- {String} hex
-
-
- hexadecimal string to final update
-
-
-
-
-
-
-
-
- Returns:
-
- the signature bytes of a hexadecimal string
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto.Signature. signString (str)
-
-
-
- performs final update on the sign using string, then returns the signature bytes of all data updates as a hexadecimal string
-
-
-
-
-
-
-
-
var hSigValue = sig.signString('aaa')
-
-
-
-
-
- Parameters:
-
-
- {String} str
-
-
- string to final update
-
-
-
-
-
-
-
-
- Returns:
-
- the signature bytes of a hexadecimal string
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto.Signature. updateHex (hex)
-
-
-
- Updates the data to be signed or verified by a hexadecimal string
-
-
-
-
-
-
-
-
sig.updateHex('1f2f3f')
-
-
-
-
-
- Parameters:
-
-
- {String} hex
-
-
- hexadecimal string to use for the update
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto.Signature. updateString (str)
-
-
-
- Updates the data to be signed or verified by a string
-
-
-
-
-
-
-
-
sig.updateString('aaa')
-
-
-
-
-
- Parameters:
-
-
- {String} str
-
-
- string to use for the update
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Boolean}
- KJUR.crypto.Signature. verify (str)
-
-
-
- verifies the passed-in signature.
-
-
-
-
-
-
-
-
var isValid = sig.verify('1fbcefdca4823a7(snip)')
-
-
-
-
-
- Parameters:
-
-
- {String} str
-
-
- string to final update
-
-
-
-
-
-
-
-
- Returns:
-
- {Boolean} true if the signature was verified, otherwise false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.crypto.Util.html b/jwt/api/symbols/KJUR.crypto.Util.html
deleted file mode 100644
index 030c4cd..0000000
--- a/jwt/api/symbols/KJUR.crypto.Util.html
+++ /dev/null
@@ -1,1168 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.crypto.Util
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.crypto.Util
-
-
-
-
-
-
-
- static object for cryptographic function utilities
-
-
- Defined in: crypto-1.1.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- static object for cryptographic function utilities
-
-
-
-
-
-
-
-
-
-
-
-
- Field Summary
-
-
- Field Attributes
- Field Name and Description
-
-
-
-
-
-
-
-
- associative array of default provider name for each hash and signature algorithms
-
-
-
-
-
-
-
- PKCS#1 DigestInfo heading hexadecimal bytes for each hash algorithms
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- get hexadecimal DigestInfo
-
-
-
-
- <static>
-
-
- get PKCS#1 padded hexadecimal DigestInfo
-
-
-
-
- <static>
-
- KJUR.crypto.Util.
hashHex (sHex, alg)
-
- get hexadecimal hash of hexadecimal string with specified algorithm
-
-
-
-
- <static>
-
-
- get hexadecimal hash of string with specified algorithm
-
-
-
-
- <static>
-
- KJUR.crypto.Util.
md5 (s)
-
- get hexadecimal MD5 hash of string
-
-
-
-
- <static>
-
-
- get hexadecimal RIPEMD160 hash of string
-
-
-
-
- <static>
-
- KJUR.crypto.Util.
sha1 (s)
-
- get hexadecimal SHA1 hash of string
-
-
-
-
- <static>
-
-
- get hexadecimal SHA256 hash of string
-
-
-
-
- <static>
-
-
- get hexadecimal SHA512 hash of string
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.crypto.Util ()
-
-
-
- static object for cryptographic function utilities
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Field Detail
-
-
-
-
-
- {Array}
- DEFAULTPROVIDER
-
-
-
- associative array of default provider name for each hash and signature algorithms
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {Array}
- DIGESTINFOHEAD
-
-
-
- PKCS#1 DigestInfo heading hexadecimal bytes for each hash algorithms
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
- {String}
- KJUR.crypto.Util. getDigestInfoHex (hHash, alg)
-
-
-
- get hexadecimal DigestInfo
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} hHash
-
-
- hexadecimal hash value
-
-
- {String} alg
-
-
- hash algorithm name (ex. 'sha1')
-
-
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string DigestInfo ASN.1 structure
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KJUR.crypto.Util. getPaddedDigestInfoHex (hHash, alg, keySize)
-
-
-
- get PKCS#1 padded hexadecimal DigestInfo
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} hHash
-
-
- hexadecimal hash value of message to be signed
-
-
- {String} alg
-
-
- hash algorithm name (ex. 'sha1')
-
-
- {Integer} keySize
-
-
- key bit length (ex. 1024)
-
-
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of PKCS#1 padded DigestInfo
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KJUR.crypto.Util. hashHex (sHex, alg)
-
-
-
- get hexadecimal hash of hexadecimal string with specified algorithm
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} sHex
-
-
- input hexadecimal string to be hashed
-
-
- {String} alg
-
-
- hash algorithm name
-
-
-
-
-
-
- Since:
- 1.1.1
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of hash value
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KJUR.crypto.Util. hashString (s, alg)
-
-
-
- get hexadecimal hash of string with specified algorithm
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- input string to be hashed
-
-
- {String} alg
-
-
- hash algorithm name
-
-
-
-
-
-
- Since:
- 1.1.1
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of hash value
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KJUR.crypto.Util. md5 (s)
-
-
-
- get hexadecimal MD5 hash of string
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- input string to be hashed
-
-
-
-
-
-
- Since:
- 1.0.3
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of hash value
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KJUR.crypto.Util. ripemd160 (s)
-
-
-
- get hexadecimal RIPEMD160 hash of string
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- input string to be hashed
-
-
-
-
-
-
- Since:
- 1.0.3
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of hash value
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KJUR.crypto.Util. sha1 (s)
-
-
-
- get hexadecimal SHA1 hash of string
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- input string to be hashed
-
-
-
-
-
-
- Since:
- 1.0.3
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of hash value
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KJUR.crypto.Util. sha256 (s)
-
-
-
- get hexadecimal SHA256 hash of string
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- input string to be hashed
-
-
-
-
-
-
- Since:
- 1.0.3
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of hash value
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KJUR.crypto.Util. sha512 (s)
-
-
-
- get hexadecimal SHA512 hash of string
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- input string to be hashed
-
-
-
-
-
-
- Since:
- 1.0.3
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of hash value
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.crypto.html b/jwt/api/symbols/KJUR.crypto.html
deleted file mode 100644
index 415a3b0..0000000
--- a/jwt/api/symbols/KJUR.crypto.html
+++ /dev/null
@@ -1,1405 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.crypto
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Namespace KJUR.crypto
-
-
-
-
-
-
-
-
-
-
- Defined in: crypto-1.1.js .
-
-
-
-
-
-
- Namespace Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- kjur's cryptographic algorithm provider library name space
-
-This namespace privides following crytpgrahic classes.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
- KJUR.crypto.digest ()
-
-
-
-
-
-
- <static>
-
- KJUR.crypto.digestHex (hex)
-
-
-
-
-
-
- <static>
-
- KJUR.crypto.digestString (str)
-
-
-
-
-
-
- <static>
-
- KJUR.crypto.doFinal ()
-
-
-
-
-
-
- <static>
-
- KJUR.crypto.doFinalHex (hex)
-
-
-
-
-
-
- <static>
-
- KJUR.crypto.doFinalString (str)
-
-
-
-
-
-
- <static>
-
- KJUR.crypto.init (keyparam, pass)
-
-
-
-
-
-
- <static>
-
- KJUR.crypto.initSign (params)
-
-
-
-
-
-
- <static>
-
- KJUR.crypto.initVerifyByCertificatePEM (certPEM)
-
-
-
-
-
-
- <static>
-
- KJUR.crypto.initVerifyByPublicKey (params)
-
-
-
-
-
-
- <static>
-
-
- Parses a byte array containing a DER-encoded signature.
-
-
-
-
- <static>
-
-
- Serialize a signature into DER format.
-
-
-
-
- <static>
-
- KJUR.crypto.setAlgAndProvider (alg, prov)
-
-
-
-
-
-
- <static>
-
- KJUR.crypto.sign ()
-
-
-
-
-
-
- <static>
-
- KJUR.crypto.signHex (hex)
-
-
-
-
-
-
- <static>
-
- KJUR.crypto.signString (str)
-
-
-
-
-
-
- <static>
-
- KJUR.crypto.updateHex (hex)
-
-
-
-
-
-
- <static>
-
- KJUR.crypto.updateString (str)
-
-
-
-
-
-
- <static>
-
- KJUR.crypto.verify (hSigVal)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Namespace Detail
-
-
-
- KJUR.crypto
-
-
-
- kjur's cryptographic algorithm provider library name space
-
-This namespace privides following crytpgrahic classes.
-
-NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.crypto. digest ()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto. digestHex (hex)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- hex
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto. digestString (str)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- str
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto. doFinal ()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto. doFinalHex (hex)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- hex
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto. doFinalString (str)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- str
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto. init (keyparam, pass)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- keyparam
-
-
-
-
-
- pass
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto. initSign (params)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- params
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto. initVerifyByCertificatePEM (certPEM)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- certPEM
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto. initVerifyByPublicKey (params)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- params
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto. parseSig (sig)
-
-
-
- Parses a byte array containing a DER-encoded signature.
-
-This function will return an object of the form:
-
-{
- r: BigInteger,
- s: BigInteger
-}
-
-
-
Defined in: ecdsa-modified-1.0.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- sig
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto. serializeSig (r, s)
-
-
-
- Serialize a signature into DER format.
-
-Takes two BigIntegers representing r and s and returns a byte array.
-
-
-
Defined in: ecdsa-modified-1.0.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- r
-
-
-
-
-
- s
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto. setAlgAndProvider (alg, prov)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- alg
-
-
-
-
-
- prov
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto. sign ()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto. signHex (hex)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- hex
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto. signString (str)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- str
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto. updateHex (hex)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- hex
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto. updateString (str)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- str
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.crypto. verify (hSigVal)
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- hSigVal
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.html b/jwt/api/symbols/KJUR.html
deleted file mode 100644
index bd03a1b..0000000
--- a/jwt/api/symbols/KJUR.html
+++ /dev/null
@@ -1,541 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Namespace KJUR
-
-
-
-
-
-
-
- kjur's class library name space
-
-
- Defined in: asn1-1.0.js .
-
-
-
-
-
-
- Namespace Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- kjur's class library name space
-
-This name space provides following name spaces:
-
-KJUR.asn1 - ASN.1 primitive hexadecimal encoder
-KJUR.asn1.x509 - ASN.1 structure for X.509 certificate and CRL
-KJUR.crypto - Java Cryptographic Extension(JCE) style MessageDigest/Signature
-class and utilities
-
-
-NOTE: Please ignore method summary and document of this namespace.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Namespace Detail
-
-
-
- KJUR
-
-
-
- kjur's class library name space
-
-This name space provides following name spaces:
-
-KJUR.asn1 - ASN.1 primitive hexadecimal encoder
-KJUR.asn1.x509 - ASN.1 structure for X.509 certificate and CRL
-KJUR.crypto - Java Cryptographic Extension(JCE) style MessageDigest/Signature
-class and utilities
-
-
-NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.jws.IntDate.html b/jwt/api/symbols/KJUR.jws.IntDate.html
deleted file mode 100644
index 650c5ae..0000000
--- a/jwt/api/symbols/KJUR.jws.IntDate.html
+++ /dev/null
@@ -1,889 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.jws.IntDate
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.jws.IntDate
-
-
-
-
-
-
-
- KJUR.jws.IntDate class
-
-
- Defined in: jws-3.3.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- IntDate class for time representation for JSON Web Token(JWT)
-Utility class for IntDate which is integer representation of UNIX origin time
-used in JSON Web Token(JWT).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
- KJUR.jws.IntDate.
get (s)
-
- get UNIX origin time from by string
-This method will accept following representation of time.
-
-
-
-
- <static>
-
-
- get UNIX origin time of current time
-This method provides UNIX origin time for current time
-
-
-
-
- <static>
-
-
- get UNIX origin time from Zulu time representation string
-This method provides UNIX origin time from Zulu time.
-
-
-
-
- <static>
-
-
- get UTC time string from UNIX origin time value
-This method provides UTC time string for UNIX origin time value.
-
-
-
-
- <static>
-
-
- get UTC time string from UNIX origin time value
-This method provides Zulu time string for UNIX origin time value.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.jws.IntDate ()
-
-
-
- IntDate class for time representation for JSON Web Token(JWT)
-Utility class for IntDate which is integer representation of UNIX origin time
-used in JSON Web Token(JWT).
-
-
-
-
-
-
-
-
-
-
- Since:
- jws 3.0.1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
- {Integer}
- KJUR.jws.IntDate. get (s)
-
-
-
- get UNIX origin time from by string
-This method will accept following representation of time.
-
-now - current time
-now + 1hour - after 1 hour from now
-now + 1day - after 1 day from now
-now + 1month - after 30 days from now
-now + 1year - after 365 days from now
-YYYYmmDDHHMMSSZ - UTC time (ex. 20130828235959Z)
-number - UNIX origin time (seconds from 1970-01-01 00:00:00) (ex. 1377714748)
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- string of time representation
-
-
-
-
-
-
- Since:
- jws 3.0.1
-
-
-
-
-
- Throws:
-
-
-
-
- "unsupported format: s" when malformed format
-
-
-
-
-
- Returns:
-
- {Integer} UNIX origin time in seconds for argument 's'
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Integer}
- KJUR.jws.IntDate. getNow ()
-
-
-
- get UNIX origin time of current time
-This method provides UNIX origin time for current time
-
-
-
-
-
-
-
KJUR.jws.IntDate.getNow() => 1478...
-
-
-
-
-
-
-
- Since:
- jws 3.0.1
-
-
-
-
-
-
- Returns:
-
- {Integer} UNIX origin time for current time
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Integer}
- KJUR.jws.IntDate. getZulu (s)
-
-
-
- get UNIX origin time from Zulu time representation string
-This method provides UNIX origin time from Zulu time.
-Following representations are supported:
-
-YYYYMMDDHHmmSSZ - GeneralizedTime format
-YYMMDDHHmmSSZ - UTCTime format. If YY is greater or equal to
-50 then it represents 19YY otherwise 20YY.
-
-
-
-
-
-
-
-
KJUR.jws.IntDate.getZulu("20151012125959Z") => 1478...
-KJUR.jws.IntDate.getZulu("151012125959Z") => 1478...
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- string of Zulu time representation (ex. 20151012125959Z)
-
-
-
-
-
-
- Since:
- jws 3.0.1
-
-
-
-
-
- Throws:
-
-
-
-
- "unsupported format: s" when malformed format
-
-
-
-
-
- Returns:
-
- {Integer} UNIX origin time in seconds for argument 's'
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KJUR.jws.IntDate. intDate2UTCString (intDate)
-
-
-
- get UTC time string from UNIX origin time value
-This method provides UTC time string for UNIX origin time value.
-
-
-
-
-
-
-
KJUR.jws.IntDate.intDate2UTCString(1478...) => "2015 Oct ..."
-
-
-
-
-
- Parameters:
-
-
- {Integer} intDate
-
-
- UNIX origin time value (ex. 1478...)
-
-
-
-
-
-
- Since:
- jws 3.0.1
-
-
-
-
-
-
- Returns:
-
- {String} UTC time string
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KJUR.jws.IntDate. intDate2Zulu (intDate)
-
-
-
- get UTC time string from UNIX origin time value
-This method provides Zulu time string for UNIX origin time value.
-
-
-
-
-
-
-
KJUR.jws.IntDate.intDate2UTCString(1478...) => "20151012...Z"
-
-
-
-
-
- Parameters:
-
-
- {Integer} intDate
-
-
- UNIX origin time value (ex. 1478...)
-
-
-
-
-
-
- Since:
- jws 3.0.1
-
-
-
-
-
-
- Returns:
-
- {String} Zulu time string
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.jws.JWS.html b/jwt/api/symbols/KJUR.jws.JWS.html
deleted file mode 100644
index e604de5..0000000
--- a/jwt/api/symbols/KJUR.jws.JWS.html
+++ /dev/null
@@ -1,1627 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.jws.JWS
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.jws.JWS
-
-
-
-
-
-
-
- JSON Web Signature(JWS) class
-
-
- Defined in: jws-3.3.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- JSON Web Signature(JWS) class.
-
-
-
-
-
-
-
-
-
-
-
- Field Summary
-
-
- Field Attributes
- Field Name and Description
-
-
-
-
-
- <static>
-
-
- static associative array of general signature algorithm name from JWS algorithm name
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- get Encoed Signature Value from JWS string.
-
-
-
-
- <static>
-
-
- get RFC 7638 JWK thumbprint from JWK object
-This method calculates JWK thmubprint for specified JWK object
-as described in
-
RFC 7638 .
-
-
-
-
- <static>
-
-
- check whether item is included by array
-
-
-
-
- <static>
-
-
- check whether array is included by another array
-
-
-
-
- <static>
-
-
- check whether a String "s" is a safe JSON string or not.
-
-
-
-
- <static>
-
- KJUR.jws.JWS.
parse (sJWS)
-
- parse header and payload of JWS signature
-This method parses JWS signature string.
-
-
-
-
- <static>
-
-
- parse JWS string and set public property 'parsedJWS' dictionary.
-
-
-
-
- <static>
-
-
- read a String "s" as JSON object if it is safe.
-
-
-
-
- <static>
-
- KJUR.jws.JWS.
sign (alg, spHead, spPayload, key, pass)
-
- generate JWS signature by specified key
-This method supports following algorithms.
-
-
-
-
- <static>
-
- KJUR.jws.JWS.
verify (sJWS, key, acceptAlgs)
-
-
-
-
-
-
- <static>
-
- KJUR.jws.JWS.
verifyJWT (sJWT, key, acceptField)
-
- This method verifies a
-
RFC 7519
-JSON Web Token(JWT).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- KJUR.jws.JWS ()
-
-
-
- JSON Web Signature(JWS) class.
-This class provides JSON Web Signature(JWS)/JSON Web Token(JWT) signing and validation.
-
Supported Algorithms
-Here is supported algorithm names for
KJUR.jws.JWS.sign and
KJUR.jws.JWS.verify
-methods.
-
-alg value spec requirement jsjws support
-HS256 REQUIRED SUPPORTED
-HS384 OPTIONAL SUPPORTED
-HS512 OPTIONAL SUPPORTED
-RS256 RECOMMENDED SUPPORTED
-RS384 OPTIONAL SUPPORTED
-RS512 OPTIONAL SUPPORTED
-ES256 RECOMMENDED+ SUPPORTED
-ES384 OPTIONAL SUPPORTED
-ES512 OPTIONAL -
-PS256 OPTIONAL SUPPORTED
-PS384 OPTIONAL SUPPORTED
-PS512 OPTIONAL SUPPORTED
-none REQUIRED SUPPORTED(signature generation only)
-
-
-NOTE1
-HS384 is supported since jsjws 3.0.2 with jsrsasign 4.1.4.
- NOTE2
-Some deprecated methods have been removed since jws 3.3 of jsrsasign 4.10.0.
-Removed methods are following:
-
-JWS.verifyJWSByNE
-JWS.verifyJWSByKey
-JWS.generateJWSByNED
-JWS.generateJWSByKey
-JWS.generateJWSByP1PrvKey
-
-
-
EXAMPLE
-
-
-
-
-
-
// JWS signing
-sJWS = KJUR.jws.JWS.sign(null, '{"alg":"HS256", "cty":"JWT"}', '{"age": 21}', "password");
-// JWS validation
-isValid = KJUR.jws.JWS.verify('eyJjdHkiOiJKV1QiLCJhbGc...', "password");
-// JWT validation
-isValid = KJUR.jws.JWS.verifyJWT('eyJh...', "password", {
- alg: ['HS256', 'HS384'],
- iss: ['http://foo.com']
-});
-
-
-
-
-
-
-
-
- Since:
- jsjws 1.0
-
-
-
-
-
-
-
- See:
-
- 'jwjws'(JWS JavaScript Library) home page http://kjur.github.com/jsjws/
-
- 'jwrsasign'(RSA Sign JavaScript Library) home page http://kjur.github.com/jsrsasign/
-
- IETF I-D JSON Web Algorithms (JWA)
-
-
-
-
-
-
-
-
-
-
- Field Detail
-
-
-
-
<static>
-
-
- KJUR.jws.JWS. jwsalg2sigalg
-
-
-
- static associative array of general signature algorithm name from JWS algorithm name
-
-
-
-
-
-
-
-
-
- Since:
- jws 3.0.0
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
- {String}
- KJUR.jws.JWS. getEncodedSignatureValueFromJWS (sJWS)
-
-
-
- get Encoed Signature Value from JWS string.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} sJWS
-
-
- JWS signature string to be verified
-
-
-
-
-
-
-
- Throws:
-
-
-
-
- if sJWS is not comma separated string such like "Header.Payload.Signature".
-
-
-
-
-
- Returns:
-
- {String} string of Encoded Signature Value
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KJUR.jws.JWS. getJWKthumbprint (o)
-
-
-
- get RFC 7638 JWK thumbprint from JWK object
-This method calculates JWK thmubprint for specified JWK object
-as described in
-
RFC 7638 .
-It supports all type of "kty". (i.e. "RSA", "EC" and "oct"
-(for symmetric key))
-Working sample is
-
here .
-
-
-
-
-
-
-
jwk = {"kty":"RSA", "n":"0vx...", "e":"AQAB", ...};
-thumbprint = KJUR.jws.JWS.getJWKthumbprint(jwk);
-
-
-
-
-
- Parameters:
-
-
- {String} o
-
-
- JWK object to be calculated thumbprint
-
-
-
-
-
-
- Since:
- jsrsasign 5.0.2 jws 3.3.2
-
-
-
-
-
-
- Returns:
-
- {String} Base64 URL encoded JWK thumbprint value
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Boolean}
- KJUR.jws.JWS. inArray (item, a)
-
-
-
- check whether item is included by array
-
-
-
-
-
-
-
KJUR.jws.JWS.inArray('b', ['b', 'c', 'a']) => true
-KJUR.jws.JWS.inArray('a', ['b', 'c', 'a']) => true
-KJUR.jws.JWS.inArray('a', ['b', 'c']) => false
-
-
-
-
-
- Parameters:
-
-
- {String} item
-
-
- check whether item is included by array
-
-
- {Array} a
-
-
- check whether item is included by array
-
-
-
-
-
-
- Since:
- jws 3.2.3
-This method verifies whether an item is included by an array.
-It doesn't care about item ordering in an array.
-
-
-
-
-
-
- Returns:
-
- {Boolean} check whether item is included by array
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Boolean}
- KJUR.jws.JWS. includedArray (a1, a2)
-
-
-
- check whether array is included by another array
-
-
-
-
-
-
-
KJUR.jws.JWS.includedArray(['b'], ['b', 'c', 'a']) => true
-KJUR.jws.JWS.includedArray(['a', 'b'], ['b', 'c', 'a']) => true
-KJUR.jws.JWS.includedArray(['a', 'b'], ['b', 'c']) => false
-
-
-
-
-
- Parameters:
-
-
- {Array} a1
-
-
- check whether set a1 is included by a2
-
-
- {Array} a2
-
-
- check whether set a1 is included by a2
-
-
-
-
-
-
- Since:
- jws 3.2.3
-This method verifies whether an array is included by another array.
-It doesn't care about item ordering in a array.
-
-
-
-
-
-
- Returns:
-
- {Boolean} check whether set a1 is included by a2
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Number}
- KJUR.jws.JWS. isSafeJSONString (s)
-
-
-
- check whether a String "s" is a safe JSON string or not.
-If a String "s" is a malformed JSON string or an other object type
-this returns 0, otherwise this returns 1.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- JSON string
-
-
-
-
-
-
-
-
- Returns:
-
- {Number} 1 or 0
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Array}
- KJUR.jws.JWS. parse (sJWS)
-
-
-
- parse header and payload of JWS signature
-This method parses JWS signature string.
-Resulted associative array has following properties:
-
-headerObj - JSON object of header
-payloadObj - JSON object of payload if payload is JSON string otherwise undefined
-headerPP - pretty printed JSON header by stringify
-payloadPP - pretty printed JSON payload by stringify if payload is JSON otherwise Base64URL decoded raw string of payload
-sigHex - hexadecimal string of signature
-
-
-
-
-
-
-
-
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..."
-}
-
-
-
-
-
- Parameters:
-
-
- {String} sJWS
-
-
- string of JWS signature to parse
-
-
-
-
-
-
- Since:
- jws 3.3.3
-
-
-
-
-
- Throws:
-
-
-
-
- if sJWS is malformed JWS signature
-
-
-
-
-
- Returns:
-
- {Array} associative array of parsed header and payload. See below.
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.jws.JWS. parseJWS (sJWS)
-
-
-
- parse JWS string and set public property 'parsedJWS' dictionary.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} sJWS
-
-
- JWS signature string to be parsed.
-
-
-
-
-
-
- Since:
- jws 1.1
-
-
-
-
-
- Throws:
-
-
-
-
- if sJWS is not comma separated string such like "Header.Payload.Signature".
-
-
-
-
- if JWS Header is a malformed JSON string.
-
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Object}
- KJUR.jws.JWS. readSafeJSONString (s)
-
-
-
- read a String "s" as JSON object if it is safe.
-If a String "s" is a malformed JSON string or not JSON string,
-this returns null, otherwise returns JSON object.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- JSON string
-
-
-
-
-
-
- Since:
- 1.1.1
-
-
-
-
-
-
- Returns:
-
- {Object} JSON object or null
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- KJUR.jws.JWS. sign (alg, spHead, spPayload, key, pass)
-
-
-
- generate JWS signature by specified key
-This method supports following algorithms.
-
-alg value spec requirement jsjws support
-HS256 REQUIRED SUPPORTED
-HS384 OPTIONAL SUPPORTED
-HS512 OPTIONAL SUPPORTED
-RS256 RECOMMENDED SUPPORTED
-RS384 OPTIONAL SUPPORTED
-RS512 OPTIONAL SUPPORTED
-ES256 RECOMMENDED+ SUPPORTED
-ES384 OPTIONAL SUPPORTED
-ES512 OPTIONAL -
-PS256 OPTIONAL SUPPORTED
-PS384 OPTIONAL SUPPORTED
-PS512 OPTIONAL SUPPORTED
-none REQUIRED SUPPORTED(signature generation only)
-
-
-NOTE1:
- salt length of RSAPSS signature is the same as the hash algorithm length
-because of IETF JOSE ML discussion .
- NOTE2:
- To support HS384, patched version of CryptoJS is used.
-See here for detail .
- NOTE3:
-From jsrsasign 4.10.0 jws 3.3.0, Way to provide password
-for HS* algorithm is changed. The 'key' attribute value is
-passed to KJUR.crypto.Mac.setPassword so please see
-KJUR.crypto.Mac.setPassword for detail.
-As for backword compatibility, if key is a string, has even length and
-0..9, A-F or a-f characters, key string is treated as a hexadecimal
-otherwise it is treated as a raw string.
-
-
-
EXAMPLE
-
-
-
-
-
-
-
// sign HS256 signature with password "aaa" implicitly handled as string
-sJWS = KJUR.jws.JWS.sign(null, {alg: "HS256", cty: "JWT"}, {age: 21}, "aaa");
-// sign HS256 signature with password "6161" implicitly handled as hex
-sJWS = KJUR.jws.JWS.sign(null, {alg: "HS256", cty: "JWT"}, {age: 21}, "6161");
-// sign HS256 signature with base64 password
-sJWS = KJUR.jws.JWS.sign(null, {alg: "HS256"}, {age: 21}, {b64: "Mi/8..a="});
-// sign RS256 signature with PKCS#8 PEM RSA private key
-sJWS = KJUR.jws.JWS.sign(null, {alg: "RS256"}, {age: 21}, "-----BEGIN PRIVATE KEY...");
-// sign RS256 signature with PKCS#8 PEM ECC private key with passcode
-sJWS = KJUR.jws.JWS.sign(null, {alg: "ES256"}, {age: 21},
- "-----BEGIN PRIVATE KEY...", "keypass");
-// header and payload can be passed by both string and object
-sJWS = KJUR.jws.JWS.sign(null, '{alg:"HS256",cty:"JWT"}', '{age:21}', "aaa");
-
-
-
-
-
- Parameters:
-
-
- {String} alg
-
-
- JWS algorithm name to sign and force set to sHead or null
-
-
- {String} spHead
-
-
- string or object of JWS Header
-
-
- {String} spPayload
-
-
- string or object of JWS Payload
-
-
- {String} key
-
-
- string of private key or mac key object to sign
-
-
- {String} pass
-
-
- (OPTION)passcode to use encrypted asymmetric private key
-
-
-
-
-
-
- Since:
- jws 3.0.0
-
-
-
-
-
-
- Returns:
-
- {String} JWS signature string
-
-
-
-
-
-
- See:
-
- jsrsasign KJUR.crypto.Signature method
-
- jsrsasign KJUR.crypto.Mac method
-
-
-
-
-
-
-
-
<static>
-
- {Boolean}
- KJUR.jws.JWS. verify (sJWS, key, acceptAlgs)
-
-
-
- verify JWS signature by specified key or certificate
-
-This method verifies a JSON Web Signature Compact Serialization string by the validation
-algorithm as described in
-
-the section 5 of Internet Draft draft-jones-json-web-signature-04.
-
-
-Since 3.2.0 strict key checking has been provided against a JWS algorithm
-in a JWS header.
-
-In case 'alg' is 'HS*' in the JWS header,
-'key' shall be hexadecimal string for Hmac{256,384,512} shared secret key.
-Otherwise it raise an error.
-In case 'alg' is 'RS*' or 'PS*' in the JWS header,
-'key' shall be a RSAKey object or a PEM string of
-X.509 RSA public key certificate or PKCS#8 RSA public key.
-Otherwise it raise an error.
-In case 'alg' is 'ES*' in the JWS header,
-'key' shall be a KJUR.crypto.ECDSA object or a PEM string of
-X.509 ECC public key certificate or PKCS#8 ECC public key.
-Otherwise it raise an error.
-In case 'alg' is 'none' in the JWS header,
-validation not supported after jsjws 3.1.0.
-
-
-
-NOTE1: The argument 'acceptAlgs' is supported since 3.2.0.
-Strongly recommended to provide acceptAlgs to mitigate
-signature replacement attacks.
-
-
-NOTE2: From jsrsasign 4.9.0 jws 3.2.5, Way to provide password
-for HS* algorithm is changed. The 'key' attribute value is
-passed to KJUR.crypto.Mac.setPassword so please see
-KJUR.crypto.Mac.setPassword for detail.
-As for backword compatibility, if key is a string, has even length and
-0..9, A-F or a-f characters, key string is treated as a hexadecimal
-otherwise it is treated as a raw string.
-
-
-
-
-
-
-
-
// 1) verify a RS256 JWS signature by a certificate string.
-isValid = KJUR.jws.JWS.verify('eyJh...', '-----BEGIN...', ['RS256']);
-
-// 2) verify a HS256 JWS signature by a certificate string.
-isValid = KJUR.jws.JWS.verify('eyJh...', {hex: '6f62ad...'}, ['HS256']);
-isValid = KJUR.jws.JWS.verify('eyJh...', {b64: 'Mi/ab8...a=='}, ['HS256']);
-isValid = KJUR.jws.JWS.verify('eyJh...', {utf8: 'Secret秘密'}, ['HS256']);
-isValid = KJUR.jws.JWS.verify('eyJh...', '6f62ad', ['HS256']); // implicit hex
-isValid = KJUR.jws.JWS.verify('eyJh...', '6f62ada', ['HS256']); // implicit raw string
-
-// 3) verify a ES256 JWS signature by a KJUR.crypto.ECDSA key object.
-var pubkey = KEYUTIL.getKey('-----BEGIN CERT...');
-var isValid = KJUR.jws.JWS.verify('eyJh...', pubkey);
-
-
-
-
-
- Parameters:
-
-
- {String} sJWS
-
-
- string of JWS signature to verify
-
-
- {Object} key
-
-
- string of public key, certificate or key object to verify
-
-
- {String} acceptAlgs
-
-
- array of algorithm name strings (OPTION)
-
-
-
-
-
-
- Since:
- jws 3.0.0
-
-
-
-
-
-
- Returns:
-
- {Boolean} true if the signature is valid otherwise false
-
-
-
-
-
-
- See:
-
- jsrsasign KJUR.crypto.Signature method
-
- jsrsasign KJUR.crypto.Mac method
-
-
-
-
-
-
-
-
<static>
-
- {Boolean}
- KJUR.jws.JWS. verifyJWT (sJWT, key, acceptField)
-
-
-
- This method verifies a
-
RFC 7519
-JSON Web Token(JWT).
-It will verify following:
-
-Header.alg
-
-alg is specified in JWT header.
-alg is included in acceptField.alg array. (MANDATORY)
-alg is proper for key.
-
-
-Payload.iss (issuer) - Payload.iss is included in acceptField.iss array if specified. (OPTION)
-Payload.sub (subject) - Payload.sub is included in acceptField.sub array if specified. (OPTION)
-Payload.aud (audience) - Payload.aud is included in acceptField.aud array or
- the same as value if specified. (OPTION)
-Time validity
-
-
-If acceptField.verifyAt as number of UNIX origin time is specifed for validation time,
-this method will verify at the time for it, otherwise current time will be used to verify.
-
-
-Clock of JWT generator or verifier can be fast or slow. If these clocks are
-very different, JWT validation may fail. To avoid such case, 'jsrsasign' supports
-'acceptField.gracePeriod' parameter which specifies acceptable time difference
-of those clocks in seconds. So if you want to accept slow or fast in 2 hours,
-you can specify acceptField.gracePeriod = 2 * 60 * 60;
.
-"gracePeriod" is zero by default.
-"gracePeriod" is supported since jsrsasign 5.0.12.
-
-Payload.exp (expire) - Validation time is smaller than Payload.exp + gracePeriod.
-Payload.nbf (not before) - Validation time is greater than Payload.nbf - gracePeriod.
-Payload.iat (issued at) - Validation time is greater than Payload.iat - gracePeriod.
-
-
-Payload.jti (JWT id) - Payload.jti is included in acceptField.jti if specified. (OPTION)
-JWS signature of JWS is valid for specified key.
-
-
-
-
-
-
-
-
// simple validation for HS256
-isValid = KJUR.jws.JWS.verifyJWT("eyJhbG...", "616161", {alg: ["HS256"]}),
-
-// full validation for RS or PS
-pubkey = KEYUTIL.getKey('-----BEGIN CERT...');
-isValid = KJUR.jws.JWS.verifyJWT('eyJh...', pubkey, {
- alg: ['RS256', 'RS512', 'PS256', 'PS512'],
- iss: ['http://foo.com'],
- sub: ['mailto:john@foo.com', 'mailto:alice@foo.com'],
- verifyAt: KJUR.jws.IntDate.get('20150520235959Z'),
- aud: ['http://foo.com'], // aud: 'http://foo.com' is fine too.
- jti: 'id123456',
- gracePeriod: 1 * 60 * 60 // accept 1 hour slow or fast
-});
-
-
-
-
-
- Parameters:
-
-
- {String} sJWT
-
-
- string of JSON Web Token(JWT) to verify
-
-
- {Object} key
-
-
- string of public key, certificate or key object to verify
-
-
- {Array} acceptField
-
-
- associative array of acceptable fields (OPTION)
-
-
-
-
-
-
- Since:
- jws 3.2.3 jsrsasign 4.8.0
-
-
-
-
-
-
- Returns:
-
- {Boolean} true if the JWT token is valid otherwise false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.jws.JWSJS.html b/jwt/api/symbols/KJUR.jws.JWSJS.html
deleted file mode 100644
index 7bf11dc..0000000
--- a/jwt/api/symbols/KJUR.jws.JWSJS.html
+++ /dev/null
@@ -1,1038 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.jws.JWSJS
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class KJUR.jws.JWSJS
-
-
-
-
- Version
- 1.0 (18 May 2012).
-
-
-
- JSON Web Signature JSON Serialization (JWSJS) class
-
-
- Defined in: jwsjs-2.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- JSON Web Signature JSON Serialization (JWSJS) class.
-
-
-
-
-
-
-
-
-
-
-
- Field Summary
-
-
- Field Attributes
- Field Name and Description
-
-
-
-
-
-
-
-
- array of Encoded JWS Headers
-
-
-
-
-
-
-
- array of Encoded JWS signature value
-
-
-
-
-
-
-
- Encoded JWS payload
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- add a signature to existing JWS-JS by Header and PKCS1 private key.
-
-
-
-
- <static>
-
-
- add a signature to existing JWS-JS by Header, Payload and PKCS1 private key.
-
-
-
-
- <static>
-
-
- get JSON object for this JWS-JS object.
-
-
-
-
- <static>
-
-
- (re-)initialize this object.
-
-
-
-
- <static>
-
-
- (re-)initialize and set first signature with JWS.
-
-
-
-
- <static>
-
-
- check if this JWS-JS object is empty.
-
-
-
-
- <static>
-
-
- read JWS-JS string.
-
-
-
-
- <static>
-
-
- verify JWS-JS object with array of certificate string.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Field Detail
-
-
-
-
-
- {array of String}
- aHeader
-
-
-
- array of Encoded JWS Headers
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {array of String}
- aSignature
-
-
-
- array of Encoded JWS signature value
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {String}
- sPayload
-
-
-
- Encoded JWS payload
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
-
- KJUR.jws.JWSJS. addSignatureByHeaderKey (sHead, sPemPrvKey)
-
-
-
- add a signature to existing JWS-JS by Header and PKCS1 private key.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} sHead
-
-
- JSON string of JWS Header for adding signature.
-
-
- {String} sPemPrvKey
-
-
- string of PKCS1 private key
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.jws.JWSJS. addSignatureByHeaderPayloadKey (sHead, sPayload, sPemPrvKey)
-
-
-
- add a signature to existing JWS-JS by Header, Payload and PKCS1 private key.
-This is to add first signature to JWS-JS object.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} sHead
-
-
- JSON string of JWS Header for adding signature.
-
-
- {String} sPayload
-
-
- string of JWS Payload for adding signature.
-
-
- {String} sPemPrvKey
-
-
- string of PKCS1 private key
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.jws.JWSJS. getJSON ()
-
-
-
- get JSON object for this JWS-JS object.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.jws.JWSJS. init ()
-
-
-
- (re-)initialize this object.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.jws.JWSJS. initWithJWS (sJWS)
-
-
-
- (re-)initialize and set first signature with JWS.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} sJWS
-
-
- JWS signature to set
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.jws.JWSJS. isEmpty ()
-
-
-
- check if this JWS-JS object is empty.
-
-
-
-
-
-
-
-
-
-
-
-
- Returns:
-
- 1 if there is no signatures in this object, otherwise 0.
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.jws.JWSJS. raedJWSJS (string)
-
-
-
- read JWS-JS string.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} string
-
-
- of JWS-JS to load.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- KJUR.jws.JWSJS. verifyWithCerts (aCert)
-
-
-
- verify JWS-JS object with array of certificate string.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {array of String} aCert
-
-
- array of string for X.509 PEM certificate.
-
-
-
-
-
-
-
-
- Returns:
-
- 1 if signature is valid.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/KJUR.jws.html b/jwt/api/symbols/KJUR.jws.html
deleted file mode 100644
index 324150f..0000000
--- a/jwt/api/symbols/KJUR.jws.html
+++ /dev/null
@@ -1,527 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - KJUR.jws
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Namespace KJUR.jws
-
-
-
-
-
-
-
-
-
-
- Defined in: jws-3.3.js .
-
-
-
-
-
-
- Namespace Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- kjur's JSON Web Signature/Token(JWS/JWT) library name space
-
-This namespace privides following JWS/JWS related classes.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Namespace Detail
-
-
-
- KJUR.jws
-
-
-
- kjur's JSON Web Signature/Token(JWS/JWT) library name space
-
-This namespace privides following JWS/JWS related classes.
-
-NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/PKCS5PKEY.html b/jwt/api/symbols/PKCS5PKEY.html
deleted file mode 100644
index 4c2fdbf..0000000
--- a/jwt/api/symbols/PKCS5PKEY.html
+++ /dev/null
@@ -1,2514 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - PKCS5PKEY
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class PKCS5PKEY
-
-
-
-
-
-
-
- class for PKCS#5 and PKCS#8 private key
-
-
- Defined in: pkcs5pkey-1.0.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
-
-
PKCS5PKEY class has following features:
-
-read and parse PEM formatted encrypted PKCS#5 private key
- generate PEM formatted encrypted PKCS#5 private key
- read and parse PEM formatted plain PKCS#8 private key
- read and parse PEM formatted encrypted PKCS#8 private key by PBKDF2/HmacSHA1/3DES
-
-Currently supports only RSA private key and
-following symmetric key algorithms to protect private key.
-
-
-
-
-
-
-
-
-
-
-
- Field Summary
-
-
- Field Attributes
- Field Name and Description
-
-
-
-
-
- <static>
-
-
- decrypt private key by shared key
-version string of PKCS5PKEY class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- decrypt PEM formatted protected PKCS#5 private key with passcode
-
-
-
-
- <static>
-
-
- decrypt private key by shared key
-
-
-
-
- <static>
-
-
- get PEM formatted encrypted PKCS#5 private key from hexadecimal string of plain private key
-
-generate PEM formatted encrypted PKCS#5 private key by hexadecimal string encoded
-ASN.1 object of plain RSA private key.
-
-
-
-
- <static>
-
-
- get PEM formatted encrypted PKCS#5 private key from RSAKey object of private key
-
-generate PEM formatted encrypted PKCS#5 private key by
-
RSAKey object of RSA private key and passcode.
-
-
-
-
- <static>
-
-
- get hexacedimal string of PEM format
-
-
-
-
- <static>
-
-
- the same function as OpenSSL EVP_BytsToKey to generate shared key and IV
-
-
-
-
- <static>
-
-
- get RSAKey/ECDSA private key object from encrypted PEM PKCS#8 private key
-
-
-
-
- <static>
-
-
- get RSAKey/ECDSA private key object from HEX plain PEM PKCS#8 private key
-
-
-
-
- <static>
-
-
- get RSAKey/ECDSA private key object from PEM plain PEM PKCS#8 private key
-
-
-
-
- <static>
-
-
- get RSAKey/ECDSA public key object from hexadecimal string of PKCS#8 public key
-
-
-
-
- <static>
-
-
- get RSAKey/ECDSA public key object from PEM PKCS#8 public key
-
-
-
-
- <static>
-
-
- generate PBKDF2 key hexstring with specified passcode and information
-As for info, this uses following properties:
-
-info.pbkdf2Salt - hexadecimal string of PBKDF2 salt
-info.pkbdf2Iter - iteration count
-
-Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
-
-
-
-
- <static>
-
-
- read PEM formatted encrypted PKCS#8 private key and returns hexadecimal string of plain PKCS#8 private key
-Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
-
-
-
-
- <static>
-
-
- read PEM formatted encrypted PKCS#5 private key and returns RSAKey object
-
-
-
-
- <static>
-
-
- read PEM formatted encrypted PKCS#8 private key and returns RSAKey object
-Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
-
-
-
-
- <static>
-
-
- provide hexadecimal string of unencrypted PKCS#8 private key and returns RSAKey object
-
-
-
-
- <static>
-
-
- read PEM formatted unencrypted PKCS#8 private key and returns RSAKey object
-
-
-
-
- <static>
-
-
- provide hexadecimal string of unencrypted PKCS#8 private key and returns RSAKey object
-
-
-
-
- <static>
-
-
- read PEM formatted PKCS#8 public key and returns RSAKey object
-
-
-
-
- <static>
-
-
- generate RSAKey and PEM formatted encrypted PKCS#5 private key
-
-
-
-
- <static>
-
-
- generate PBKDF2 key hexstring with specified passcode and information
-The associative array which is returned by this method has following properties:
-
-info.pbkdf2Salt - hexadecimal string of PBKDF2 salt
-info.pkbdf2Iter - iteration count
-info.ciphertext - hexadecimal string of encrypted private key
-info.encryptionSchemeAlg - encryption algorithm name (currently TripleDES only)
-info.encryptionSchemeIV - initial vector for encryption algorithm
-
-Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
-
-
-
-
- <static>
-
-
- parse PEM formatted passcode protected PKCS#5 private key
-Resulted hash has following attributes.
-
-
-
-
- <static>
-
-
- parse hexadecimal string of plain PKCS#8 private key
-Resulted associative array has following properties:
-
-algoid - hexadecimal string of OID of asymmetric key algorithm
-algparam - hexadecimal string of OID of ECC curve name or null
-keyidx - string starting index of key in pkcs8PrvHex
-
-
-
-
-
- <static>
-
-
- parse hexadecimal string of ECC private key
-Following properties are added to associative array 'info'
-
-key - hexadecimal string of ECC private key
-
-
-
-
-
- <static>
-
-
- parse hexadecimal string of RSA private key
-Following properties are added to associative array 'info'
-
-n - hexadecimal string of public key
- e - hexadecimal string of public exponent
- d - hexadecimal string of private key
- p - hexadecimal string
- q - hexadecimal string
- dp - hexadecimal string
- dq - hexadecimal string
- co - hexadecimal string
-
-
-
-
-
- <static>
-
-
- parse hexadecimal string of PKCS#8 public key
-Resulted hash has following attributes.
-
-
-
-
- <static>
-
-
- parse hexadecimal string of plain PKCS#8 private key
-Resulted associative array has following properties:
-
-n - hexadecimal string of public key
- e - hexadecimal string of public exponent
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- PKCS5PKEY ()
-
-
-
-
-
PKCS5PKEY class has following features:
-
-read and parse PEM formatted encrypted PKCS#5 private key
- generate PEM formatted encrypted PKCS#5 private key
- read and parse PEM formatted plain PKCS#8 private key
- read and parse PEM formatted encrypted PKCS#8 private key by PBKDF2/HmacSHA1/3DES
-
-Currently supports only RSA private key and
-following symmetric key algorithms to protect private key.
-
-DES-EDE3-CBC
-AES-256-CBC
-AES-192-CBC
-AES-128-CBC
-
-
-
METHOD SUMMARY
-
-PKCS8 PRIVATE KEY METHODS
-
- PKCS5 PRIVATE KEY METHODS
-
- PKCS8 PUBLIC KEY METHODS
-
- UTITILIY METHODS
-
-
-
-
-
-
-
-
Here is an example of PEM formatted encrypted PKCS#5 private key.
------BEGIN RSA PRIVATE KEY-----
-Proc-Type: 4,ENCRYPTED
-DEK-Info: AES-256-CBC,40555967F759530864FE022E257DE34E
-
-jV7uXajRw4cccDaliagcqiLOiQEUCe19l761pXRxzgQP+DH4rCi12T4puTdZyy6l
- ...(snip)...
-qxLS+BASmyGm4DME6m+kltZ12LXwPgNU6+d+XQ4NXSA=
------END RSA PRIVATE KEY-----
-
-
-
-
-
-
-
- Deprecated:
-
- Since jsrsasign 4.1.3. Please use KEYUTIL class.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Field Detail
-
-
-
-
<static>
-
-
- PKCS5PKEY. version
-
-
-
- decrypt private key by shared key
-version string of PKCS5PKEY class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
- {String}
- PKCS5PKEY. getDecryptedKeyHex (sEncryptedPEM, passcode)
-
-
-
- decrypt PEM formatted protected PKCS#5 private key with passcode
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} sEncryptedPEM
-
-
- PEM formatted protected passcode protected PKCS#5 private key
-
-
- {String} passcode
-
-
- passcode to decrypt private key (ex. 'password')
-
-
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of decrypted RSA priavte key
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- PKCS5PKEY. getDecryptedKeyHexByKeyIV (encryptedKeyHex, algName, sharedKeyHex, ivHex)
-
-
-
- decrypt private key by shared key
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} encryptedKeyHex
-
-
- hexadecimal string of encrypted private key
-
-
- {String} algName
-
-
- name of symmetric key algorithm (ex. 'DES-EBE3-CBC')
-
-
- {String} sharedKeyHex
-
-
- hexadecimal string of symmetric key
-
-
- {String} ivHex
-
-
- hexadecimal string of initial vector(IV).
-
-
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of decrypted privated key
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- PKCS5PKEY. getEryptedPKCS5PEMFromPrvKeyHex (hPrvKey, passcode, sharedKeyAlgName, ivsaltHex)
-
-
-
- get PEM formatted encrypted PKCS#5 private key from hexadecimal string of plain private key
-
-generate PEM formatted encrypted PKCS#5 private key by hexadecimal string encoded
-ASN.1 object of plain RSA private key.
-Following arguments can be omitted.
-
-alg - AES-256-CBC will be used if omitted.
-ivsaltHex - automatically generate IV and salt which length depends on algorithm
-
-
-
-
-
-
-
-
var pem =
- PKCS5PKEY.getEryptedPKCS5PEMFromPrvKeyHex(plainKeyHex, "password");
-var pem2 =
- PKCS5PKEY.getEryptedPKCS5PEMFromPrvKeyHex(plainKeyHex, "password", "AES-128-CBC");
-var pem3 =
- PKCS5PKEY.getEryptedPKCS5PEMFromPrvKeyHex(plainKeyHex, "password", "AES-128-CBC", "1f3d02...");
-
-
-
-
-
- Parameters:
-
-
- {String} hPrvKey
-
-
- hexadecimal string of plain private key
-
-
- {String} passcode
-
-
- pass code to protect private key (ex. password)
-
-
- {String} sharedKeyAlgName
-
-
- algorithm name to protect private key (ex. AES-256-CBC)
-
-
- {String} ivsaltHex
-
-
- hexadecimal string of IV and salt
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.2
-
-
-
-
-
-
- Returns:
-
- {String} string of PEM formatted encrypted PKCS#5 private key
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- PKCS5PKEY. getEryptedPKCS5PEMFromRSAKey (pKey, passcode, alg, ivsaltHex)
-
-
-
- get PEM formatted encrypted PKCS#5 private key from RSAKey object of private key
-
-generate PEM formatted encrypted PKCS#5 private key by
-
RSAKey object of RSA private key and passcode.
-Following argument can be omitted.
-
-alg - AES-256-CBC will be used if omitted.
-ivsaltHex - automatically generate IV and salt which length depends on algorithm
-
-
-
-
-
-
-
-
var pkey = new RSAKey();
-pkey.generate(1024, '10001'); // generate 1024bit RSA private key with public exponent 'x010001'
-var pem = PKCS5PKEY.getEryptedPKCS5PEMFromRSAKey(pkey, "password");
-
-
-
-
-
- Parameters:
-
-
- {RSAKey } pKey
-
-
- RSAKey object of private key
-
-
- {String} passcode
-
-
- pass code to protect private key (ex. password)
-
-
- {String} alg
-
-
- algorithm name to protect private key (default AES-256-CBC)
-
-
- {String} ivsaltHex
-
-
- hexadecimal string of IV and salt (default generated random IV)
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.2
-
-
-
-
-
-
- Returns:
-
- {String} string of PEM formatted encrypted PKCS#5 private key
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- PKCS5PKEY. getHexFromPEM (sPEM, sHead)
-
-
-
- get hexacedimal string of PEM format
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} sPEM
-
-
- PEM formatted string
-
-
- {String} sHead
-
-
- PEM header string without BEGIN/END
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.5
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string data of PEM contents
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Hash}
- PKCS5PKEY. getKeyAndUnusedIvByPasscodeAndIvsalt (algName, passcode, hexadecimal)
-
-
-
- the same function as OpenSSL EVP_BytsToKey to generate shared key and IV
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} algName
-
-
- name of symmetric key algorithm (ex. 'DES-EBE3-CBC')
-
-
- {String} passcode
-
-
- passcode to decrypt private key (ex. 'password')
-
-
- {String} hexadecimal
-
-
- string of IV. heading 8 bytes will be used for passcode salt
-
-
-
-
-
-
-
-
- Returns:
-
- {Hash} hash of key and unused IV (ex. {keyhex:2fe3..., ivhex:3fad..})
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Object}
- PKCS5PKEY. getKeyFromEncryptedPKCS8PEM (pkcs8PEM, passcode)
-
-
-
- get RSAKey/ECDSA private key object from encrypted PEM PKCS#8 private key
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} pkcs8PEM
-
-
- string of PEM formatted PKCS#8 private key
-
-
- {String} passcode
-
-
- passcode string to decrypt key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.5
-
-
-
-
-
-
- Returns:
-
- {Object} RSAKey or KJUR.crypto.ECDSA private key object
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Object}
- PKCS5PKEY. getKeyFromPlainPrivatePKCS8Hex (prvKeyHex)
-
-
-
- get RSAKey/ECDSA private key object from HEX plain PEM PKCS#8 private key
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} prvKeyHex
-
-
- hexadecimal string of plain PKCS#8 private key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.5
-
-
-
-
-
-
- Returns:
-
- {Object} RSAKey or KJUR.crypto.ECDSA private key object
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Object}
- PKCS5PKEY. getKeyFromPlainPrivatePKCS8PEM (pkcs8PEM)
-
-
-
- get RSAKey/ECDSA private key object from PEM plain PEM PKCS#8 private key
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} pkcs8PEM
-
-
- string of plain PEM formatted PKCS#8 private key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.5
-
-
-
-
-
-
- Returns:
-
- {Object} RSAKey or KJUR.crypto.ECDSA private key object
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Object}
- PKCS5PKEY. getKeyFromPublicPKCS8Hex (pkcsPub8Hex)
-
-
-
- get RSAKey/ECDSA public key object from hexadecimal string of PKCS#8 public key
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} pkcsPub8Hex
-
-
- hexadecimal string of PKCS#8 public key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.5
-
-
-
-
-
-
- Returns:
-
- {Object} RSAKey or KJUR.crypto.ECDSA private key object
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Object}
- PKCS5PKEY. getKeyFromPublicPKCS8PEM (pkcsPub8PEM)
-
-
-
- get RSAKey/ECDSA public key object from PEM PKCS#8 public key
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} pkcsPub8PEM
-
-
- string of PEM formatted PKCS#8 public key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.5
-
-
-
-
-
-
- Returns:
-
- {Object} RSAKey or KJUR.crypto.ECDSA private key object
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- PKCS5PKEY. getPBKDF2KeyHexFromParam (info, passcode)
-
-
-
- generate PBKDF2 key hexstring with specified passcode and information
-As for info, this uses following properties:
-
-info.pbkdf2Salt - hexadecimal string of PBKDF2 salt
-info.pkbdf2Iter - iteration count
-
-Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
-
-keyDerivationFunc = pkcs5PBKDF2 with HmacSHA1
-encryptionScheme = des-EDE3-CBC(i.e. TripleDES
-
-
-
-
-
-
-
-
// to convert plain PKCS#5 private key to encrypted PKCS#8 private
-// key with PBKDF2 with TripleDES
-% openssl pkcs8 -in plain_p5.pem -topk8 -v2 -des3 -out encrypted_p8.pem
-
-
-
-
-
- Parameters:
-
-
- {Array} info
-
-
- result of parseHexOfEncryptedPKCS8 which has preference of PKCS#8 file
-
-
- {String} passcode
-
-
- passcode to decrypto private key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.3
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of PBKDF2 key
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- PKCS5PKEY. getPlainPKCS8HexFromEncryptedPKCS8PEM (pkcs8PEM, passcode)
-
-
-
- read PEM formatted encrypted PKCS#8 private key and returns hexadecimal string of plain PKCS#8 private key
-Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
-
-keyDerivationFunc = pkcs5PBKDF2 with HmacSHA1
-encryptionScheme = des-EDE3-CBC(i.e. TripleDES
-
-
-
-
-
-
-
-
// to convert plain PKCS#5 private key to encrypted PKCS#8 private
-// key with PBKDF2 with TripleDES
-% openssl pkcs8 -in plain_p5.pem -topk8 -v2 -des3 -out encrypted_p8.pem
-
-
-
-
-
- Parameters:
-
-
- {String} pkcs8PEM
-
-
- PEM formatted encrypted PKCS#8 private key
-
-
- {String} passcode
-
-
- passcode to decrypto private key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.3
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of plain PKCS#8 private key
-
-
-
-
-
-
-
-
-
-
<static>
-
-
{RSAKey }
-
PKCS5PKEY. getRSAKeyFromEncryptedPKCS5PEM (sEncryptedP5PEM, passcode)
-
-
-
- read PEM formatted encrypted PKCS#5 private key and returns RSAKey object
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} sEncryptedP5PEM
-
-
- PEM formatted encrypted PKCS#5 private key
-
-
- {String} passcode
-
-
- passcode to decrypt private key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.2
-
-
-
-
-
-
- Returns:
-
- {RSAKey } loaded RSAKey object of RSA private key
-
-
-
-
-
-
-
-
-
-
<static>
-
-
{RSAKey }
-
PKCS5PKEY. getRSAKeyFromEncryptedPKCS8PEM (pkcs8PEM, passcode)
-
-
-
- read PEM formatted encrypted PKCS#8 private key and returns RSAKey object
-Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
-
-keyDerivationFunc = pkcs5PBKDF2 with HmacSHA1
-encryptionScheme = des-EDE3-CBC(i.e. TripleDES
-
-
-
-
-
-
-
-
// to convert plain PKCS#5 private key to encrypted PKCS#8 private
-// key with PBKDF2 with TripleDES
-% openssl pkcs8 -in plain_p5.pem -topk8 -v2 -des3 -out encrypted_p8.pem
-
-
-
-
-
- Parameters:
-
-
- {String} pkcs8PEM
-
-
- PEM formatted encrypted PKCS#8 private key
-
-
- {String} passcode
-
-
- passcode to decrypto private key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.3
-
-
-
-
-
-
- Returns:
-
- {RSAKey } loaded RSAKey object of RSA private key
-
-
-
-
-
-
-
-
-
-
<static>
-
-
{RSAKey }
-
PKCS5PKEY. getRSAKeyFromPlainPKCS8Hex (prvKeyHex)
-
-
-
- provide hexadecimal string of unencrypted PKCS#8 private key and returns RSAKey object
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} prvKeyHex
-
-
- hexadecimal string of unencrypted PKCS#8 private key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.3
-
-
-
-
-
-
- Returns:
-
- {RSAKey } loaded RSAKey object of RSA private key
-
-
-
-
-
-
-
-
-
-
<static>
-
-
{RSAKey }
-
PKCS5PKEY. getRSAKeyFromPlainPKCS8PEM (pkcs8PEM)
-
-
-
- read PEM formatted unencrypted PKCS#8 private key and returns RSAKey object
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} pkcs8PEM
-
-
- PEM formatted unencrypted PKCS#8 private key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.1
-
-
-
-
-
-
- Returns:
-
- {RSAKey } loaded RSAKey object of RSA private key
-
-
-
-
-
-
-
-
-
-
<static>
-
-
{RSAKey }
-
PKCS5PKEY. getRSAKeyFromPublicPKCS8Hex (pkcs8PubHex)
-
-
-
- provide hexadecimal string of unencrypted PKCS#8 private key and returns RSAKey object
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} pkcs8PubHex
-
-
- hexadecimal string of unencrypted PKCS#8 public key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.4
-
-
-
-
-
-
- Returns:
-
- {RSAKey } loaded RSAKey object of RSA public key
-
-
-
-
-
-
-
-
-
-
<static>
-
-
{RSAKey }
-
PKCS5PKEY. getRSAKeyFromPublicPKCS8PEM (pkcs8PubPEM)
-
-
-
- read PEM formatted PKCS#8 public key and returns RSAKey object
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} pkcs8PubPEM
-
-
- PEM formatted PKCS#8 public key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.4
-
-
-
-
-
-
- Returns:
-
- {RSAKey } loaded RSAKey object of RSA public key
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- PKCS5PKEY. newEncryptedPKCS5PEM (passcode, keyLen, hPublicExponent, alg)
-
-
-
- generate RSAKey and PEM formatted encrypted PKCS#5 private key
-
-
-
-
-
-
-
var pem1 = PKCS5PKEY.newEncryptedPKCS5PEM("password"); // RSA1024bit/10001/AES-256-CBC
-var pem2 = PKCS5PKEY.newEncryptedPKCS5PEM("password", 512); // RSA 512bit/10001/AES-256-CBC
-var pem3 = PKCS5PKEY.newEncryptedPKCS5PEM("password", 512, '3'); // RSA 512bit/ 3/AES-256-CBC
-
-
-
-
-
- Parameters:
-
-
- {String} passcode
-
-
- pass code to protect private key (ex. password)
-
-
- {Integer} keyLen
-
-
- key bit length of RSA key to be generated. (default 1024)
-
-
- {String} hPublicExponent
-
-
- hexadecimal string of public exponent (default 10001)
-
-
- {String} alg
-
-
- shared key algorithm to encrypt private key (default AES-258-CBC)
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.2
-
-
-
-
-
-
- Returns:
-
- {String} string of PEM formatted encrypted PKCS#5 private key
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Array}
- PKCS5PKEY. parseHexOfEncryptedPKCS8 (passcode)
-
-
-
- generate PBKDF2 key hexstring with specified passcode and information
-The associative array which is returned by this method has following properties:
-
-info.pbkdf2Salt - hexadecimal string of PBKDF2 salt
-info.pkbdf2Iter - iteration count
-info.ciphertext - hexadecimal string of encrypted private key
-info.encryptionSchemeAlg - encryption algorithm name (currently TripleDES only)
-info.encryptionSchemeIV - initial vector for encryption algorithm
-
-Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
-
-keyDerivationFunc = pkcs5PBKDF2 with HmacSHA1
-encryptionScheme = des-EDE3-CBC(i.e. TripleDES
-
-
-
-
-
-
-
-
// to convert plain PKCS#5 private key to encrypted PKCS#8 private
-// key with PBKDF2 with TripleDES
-% openssl pkcs8 -in plain_p5.pem -topk8 -v2 -des3 -out encrypted_p8.pem
-
-
-
-
-
- Parameters:
-
-
- {String} passcode
-
-
- passcode to decrypto private key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.3
-
-
-
-
-
-
- Returns:
-
- {Array} info associative array of PKCS#8 parameters
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Hash}
- PKCS5PKEY. parsePKCS5PEM (sEncryptedPEM)
-
-
-
- parse PEM formatted passcode protected PKCS#5 private key
-Resulted hash has following attributes.
-
-cipher - symmetric key algorithm name (ex. 'DES-EBE3-CBC', 'AES-256-CBC')
-ivsalt - IV used for decrypt. Its heading 8 bytes will be used for passcode salt.
-type - asymmetric key algorithm name of private key described in PEM header.
-data - base64 encoded encrypted private key.
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} sEncryptedPEM
-
-
- PEM formatted protected passcode protected PKCS#5 private key
-
-
-
-
-
-
-
-
- Returns:
-
- {Hash} hash of key information
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Array}
- PKCS5PKEY. parsePlainPrivatePKCS8Hex (pkcs8PrvHex)
-
-
-
- parse hexadecimal string of plain PKCS#8 private key
-Resulted associative array has following properties:
-
-algoid - hexadecimal string of OID of asymmetric key algorithm
-algparam - hexadecimal string of OID of ECC curve name or null
-keyidx - string starting index of key in pkcs8PrvHex
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} pkcs8PrvHex
-
-
- hexadecimal string of PKCS#8 plain private key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.5
-
-
-
-
-
-
- Returns:
-
- {Array} associative array of parsed key
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Array}
- PKCS5PKEY. parsePrivateRawECKeyHexAtObj (pkcs8PrvHex)
-
-
-
- parse hexadecimal string of ECC private key
-Following properties are added to associative array 'info'
-
-key - hexadecimal string of ECC private key
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} pkcs8PrvHex
-
-
- hexadecimal string of PKCS#8 private key concluding EC private key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.5
-
-
-
-
-
-
- Returns:
-
- {Array} info associative array to add parsed ECC private key information
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Array}
- PKCS5PKEY. parsePrivateRawRSAKeyHexAtObj (pkcs8PrvHex)
-
-
-
- parse hexadecimal string of RSA private key
-Following properties are added to associative array 'info'
-
-n - hexadecimal string of public key
- e - hexadecimal string of public exponent
- d - hexadecimal string of private key
- p - hexadecimal string
- q - hexadecimal string
- dp - hexadecimal string
- dq - hexadecimal string
- co - hexadecimal string
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} pkcs8PrvHex
-
-
- hexadecimal string of PKCS#8 private key concluding RSA private key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.5
-
-
-
-
-
-
- Returns:
-
- {Array} info associative array to add parsed RSA private key information
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Hash}
- PKCS5PKEY. parsePublicPKCS8Hex (pkcs8PubHex)
-
-
-
- parse hexadecimal string of PKCS#8 public key
-Resulted hash has following attributes.
-
-algoid - hexadecimal string of OID of asymmetric key algorithm
-algparam - hexadecimal string of OID of ECC curve name or null
-key - hexadecimal string of public key
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} pkcs8PubHex
-
-
- hexadecimal string of PKCS#8 public key
-
-
-
-
-
-
-
-
- Returns:
-
- {Hash} hash of key information
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Array}
- PKCS5PKEY. parsePublicRawRSAKeyHex (pubRawRSAHex)
-
-
-
- parse hexadecimal string of plain PKCS#8 private key
-Resulted associative array has following properties:
-
-n - hexadecimal string of public key
- e - hexadecimal string of public exponent
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} pubRawRSAHex
-
-
- hexadecimal string of ASN.1 encoded PKCS#8 public key
-
-
-
-
-
-
- Since:
- pkcs5pkey 1.0.5
-
-
-
-
-
-
- Returns:
-
- {Array} associative array of parsed key
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/RSAKey.html b/jwt/api/symbols/RSAKey.html
deleted file mode 100644
index 6edfeec..0000000
--- a/jwt/api/symbols/RSAKey.html
+++ /dev/null
@@ -1,1195 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - RSAKey
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class RSAKey
-
-
-
-
-
-
-
- key of RSA public key algorithm
-
-
- Defined in: rsasign-1.2.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- Tom Wu's RSA Key class and extension
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
-
-
-
- read RSA private key from a ASN.1 hexadecimal string
-
-
-
-
-
-
-
- read PKCS#1 private key from a string
-
-
-
-
- <static>
-
-
- sign for a message string with RSA private key.
-
-
-
-
- <static>
-
-
- sign for a message string with RSA private key by PKCS#1 PSS signing.
-
-
-
-
- <static>
-
-
- sign hash value of message to be signed with RSA private key.
-
-
-
-
- <static>
-
-
- sign hash value of message with RSA private key by PKCS#1 PSS signing.
-
-
-
-
-
-
-
- verifies a sigature for a message string with RSA public key.
-
-
-
-
- <static>
-
-
- verifies a sigature for a message string with RSA public key by PKCS#1 PSS sign.
-
-
-
-
- <static>
-
-
- verifies a sigature for a message string with RSA public key.
-
-
-
-
- <static>
-
-
- verifies a sigature for a hash value of message string with RSA public key by PKCS#1 PSS sign.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- RSAKey ()
-
-
-
- Tom Wu's RSA Key class and extension
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
-
-
- readPrivateKeyFromASN1HexString (keyHex)
-
-
-
- read RSA private key from a ASN.1 hexadecimal string
-
-
-
Defined in: rsapem-1.1.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} keyHex
-
-
- ASN.1 hexadecimal string of PKCS#1 private key.
-
-
-
-
-
-
- Since:
- 1.1.1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- readPrivateKeyFromPEMString (keyPEM)
-
-
-
- read PKCS#1 private key from a string
-
-
-
Defined in: rsapem-1.1.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} keyPEM
-
-
- string of PKCS#1 private key.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- RSAKey. signString (s, hashAlg)
-
-
-
- sign for a message string with RSA private key.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- message string to be signed.
-
-
- {String} hashAlg
-
-
- hash algorithm name for signing.
-
-
-
-
-
-
-
-
- Returns:
-
- returns hexadecimal string of signature value.
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- RSAKey. signStringPSS (s, hashAlg, sLen)
-
-
-
- sign for a message string with RSA private key by PKCS#1 PSS signing.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- message string to be signed.
-
-
- {String} hashAlg
-
-
- hash algorithm name for signing.
-
-
- {Integer} sLen
-
-
- salt byte length from 0 to (keybytelen - hashbytelen - 2).
- There are two special values:
-
- -1: sets the salt length to the digest length
- -2: sets the salt length to maximum permissible value
- (i.e. keybytelen - hashbytelen - 2)
-
- DEFAULT is -1. (NOTE: OpenSSL's default is -2.)
-
-
-
-
-
-
-
-
- Returns:
-
- returns hexadecimal string of signature value.
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- RSAKey. signWithMessageHash (sHashHex, hashAlg)
-
-
-
- sign hash value of message to be signed with RSA private key.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} sHashHex
-
-
- hexadecimal string of hash value of message to be signed.
-
-
- {String} hashAlg
-
-
- hash algorithm name for signing.
-
-
-
-
-
-
- Since:
- rsasign 1.2.6
-
-
-
-
-
-
- Returns:
-
- returns hexadecimal string of signature value.
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- RSAKey. signWithMessageHashPSS (hHash, hashAlg, sLen)
-
-
-
- sign hash value of message with RSA private key by PKCS#1 PSS signing.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} hHash
-
-
- hexadecimal hash value of message to be signed.
-
-
- {String} hashAlg
-
-
- hash algorithm name for signing.
-
-
- {Integer} sLen
-
-
- salt byte length from 0 to (keybytelen - hashbytelen - 2).
- There are two special values:
-
- -1: sets the salt length to the digest length
- -2: sets the salt length to maximum permissible value
- (i.e. keybytelen - hashbytelen - 2)
-
- DEFAULT is -1. (NOTE: OpenSSL's default is -2.)
-
-
-
-
-
-
- Since:
- rsasign 1.2.6
-
-
-
-
-
-
- Returns:
-
- returns hexadecimal string of signature value.
-
-
-
-
-
-
-
-
-
-
-
-
- verifyString (sMsg, hSig)
-
-
-
- verifies a sigature for a message string with RSA public key.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} sMsg
-
-
- message string to be verified.
-
-
- {String} hSig
-
-
- hexadecimal string of siganture.
- non-hexadecimal charactors including new lines will be ignored.
-
-
-
-
-
-
-
-
- Returns:
-
- returns 1 if valid, otherwise 0
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- RSAKey. verifyStringPSS (sMsg, hSig, hashAlg, sLen)
-
-
-
- verifies a sigature for a message string with RSA public key by PKCS#1 PSS sign.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} sMsg
-
-
- message string to be verified.
-
-
- {String} hSig
-
-
- hexadecimal string of signature value
-
-
- {String} hashAlg
-
-
- hash algorithm name
-
-
- {Integer} sLen
-
-
- salt byte length from 0 to (keybytelen - hashbytelen - 2).
- There are two special values:
-
- -1: sets the salt length to the digest length
- -2: sets the salt length to maximum permissible value
- (i.e. keybytelen - hashbytelen - 2)
-
- DEFAULT is -1. (NOTE: OpenSSL's default is -2.)
-
-
-
-
-
-
-
-
- Returns:
-
- returns true if valid, otherwise false
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- RSAKey. verifyWithMessageHash (sHashHex, hSig)
-
-
-
- verifies a sigature for a message string with RSA public key.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} sHashHex
-
-
- hexadecimal hash value of message to be verified.
-
-
- {String} hSig
-
-
- hexadecimal string of siganture.
- non-hexadecimal charactors including new lines will be ignored.
-
-
-
-
-
-
- Since:
- rsasign 1.2.6
-
-
-
-
-
-
- Returns:
-
- returns 1 if valid, otherwise 0
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- RSAKey. verifyWithMessageHashPSS (hHash, hSig, hashAlg, sLen)
-
-
-
- verifies a sigature for a hash value of message string with RSA public key by PKCS#1 PSS sign.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} hHash
-
-
- hexadecimal hash value of message string to be verified.
-
-
- {String} hSig
-
-
- hexadecimal string of signature value
-
-
- {String} hashAlg
-
-
- hash algorithm name
-
-
- {Integer} sLen
-
-
- salt byte length from 0 to (keybytelen - hashbytelen - 2).
- There are two special values:
-
- -1: sets the salt length to the digest length
- -2: sets the salt length to maximum permissible value
- (i.e. keybytelen - hashbytelen - 2)
-
- DEFAULT is -1 (NOTE: OpenSSL's default is -2.)
-
-
-
-
-
-
- Since:
- rsasign 1.2.6
-
-
-
-
-
-
- Returns:
-
- returns true if valid, otherwise false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/X509.html b/jwt/api/symbols/X509.html
deleted file mode 100644
index 9dd389b..0000000
--- a/jwt/api/symbols/X509.html
+++ /dev/null
@@ -1,2727 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - X509
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class X509
-
-
-
-
- Version
- 1.0.1 (08 May 2012).
-
-
-
- hexadecimal X.509 certificate ASN.1 parser class
-
-
- Defined in: x509-1.1.js .
-
-
-
-
-
-
- Class Summary
-
-
- Constructor Attributes
- Constructor Name and Description
-
-
-
-
-
-
-
- hexadecimal X.509 certificate ASN.1 parser class.
-
-
-
-
-
-
-
-
-
-
-
- Field Summary
-
-
- Field Attributes
- Field Name and Description
-
-
-
-
-
-
-
-
- hexacedimal string for X.509 certificate.
-
-
-
-
-
-
-
- Tom Wu's RSAKey object
-
-
-
-
-
-
-
- hexadecimal string for public exponent of RSA public key
-
-
-
-
-
-
-
- hexadecimal string for modulus of RSA public key
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
- <static>
-
-
- get AuthorityInfoAccess extension value in the certificate as associative array
-This method will get authority info access value
-as associate array which has following properties:
-
-ocsp - array of string for OCSP responder URL
-caissuer - array of string for caIssuer value (i.e.
-
-
-
-
- <static>
-
-
- get authorityKeyIdentifier value as JSON object in the certificate
-This method will get authority key identifier extension value
-as JSON object.
-
-
-
-
- <static>
-
-
- get BasicConstraints extension value as object in the certificate
-This method will get basic constraints extension value as object with following paramters.
-
-
-
-
- <static>
-
-
- get array of string for fullName URIs in cRLDistributionPoints(CDP) in the certificate
-This method will get all fullName URIs of cRLDistributionPoints extension
-in the certificate as array of URI string.
-
-
-
-
- <static>
-
-
- get extKeyUsage value as array of name string in the certificate
-This method will get extended key usage extension value
-as array of name or OID string.
-
-
-
-
- <static>
-
-
- get KeyUsage extension value as binary string in the certificate
-This method will get key usage extension value
-as binary string such like '101'.
-
-
-
-
- <static>
-
-
- get KeyUsage extension value as names in the certificate
-This method will get key usage extension value
-as comma separated string of usage names.
-
-
-
-
- <static>
-
-
- get subjectAltName value as array of string in the certificate
-This method will get subject alt name extension value
-as array of name.
-
-
-
-
- <static>
-
-
- get subjectKeyIdentifier value as hexadecimal string in the certificate
-This method will get subject key identifier extension value
-as hexadecimal string.
-
-
-
-
- <static>
-
-
- get X.509 V3 extension value ASN.1 TLV for specified oid or name
-This method will get X.509v3 extension value of ASN.1 TLV
-which is specifyed by extension name or oid.
-
-
-
-
- <static>
-
-
- get X.509 V3 extension value ASN.1 V for specified oid or name
-This method will get X.509v3 extension value of ASN.1 value
-which is specifyed by extension name or oid.
-
-
-
-
-
-
-
- get certificate information as string.
-
-
-
-
-
-
-
- get hexadecimal string of issuer field TLV of certificate.
-
-
-
-
-
-
-
- get string of issuer field of certificate.
-
-
-
-
-
-
-
- get notAfter field string of certificate.
-
-
-
-
-
-
-
- get notBefore field string of certificate.
-
-
-
-
- <static>
-
-
- get index in the certificate hexa string for specified oid or name specified extension
-This method will get X.509v3 extension value of ASN.1 V(value)
-which is specifyed by extension name or oid.
-
-
-
-
- <static>
-
-
- get RSAKey/ECDSA public key object from PEM certificate string
-NOTE: DSA is also supported since x509 1.1.2.
-
-
-
-
- <static>
-
-
- get position of subjectPublicKeyInfo field from HEX certificate
-get position for SubjectPublicKeyInfo field in the hexadecimal string of
-certificate.
-
-
-
-
- <static>
-
-
- get public key information from PEM certificate
-Resulted associative array has following properties:
-
-algoid - hexadecimal string of OID of asymmetric key algorithm
-algparam - hexadecimal string of OID of ECC curve name or null
-keyhex - hexadecimal string of key in the certificate
-
-NOTE: X509v1 certificate is also supported since x509.js 1.1.9.
-
-
-
-
-
-
-
- get hexadecimal string of serialNumber field of certificate.
-
-
-
-
-
-
-
- get signature algorithm name in basic field
-This method will get a name of signature algorithm field of certificate:
-
-
-
-
- <static>
-
-
- get signature algorithm name from hexadecimal certificate data
-This method will get signature algorithm name of certificate:
-
-
-
-
- <static>
-
-
- get signature value in hexadecimal string
-This method will get signature value of certificate:
-
-
-
-
-
-
-
- get hexadecimal string of subject field of certificate.
-
-
-
-
-
-
-
- get string of subject field of certificate.
-
-
-
-
- <static>
-
-
- get array of X.509 V3 extension value information in hex string of certificate
-This method will get all extension information of a X.509 certificate.
-
-
-
-
- <static>
-
-
- get X.509 V3 extension value information at the specified position
-This method will get some information of a X.509 V extension
-which is referred by an index of hexadecimal string of X.509
-certificate.
-
-
-
-
- <static>
-
-
- get Base64 string from PEM certificate string
-
-
-
-
- <static>
-
-
- get a hexa decimal string from PEM certificate string
-
-
-
-
-
-
-
- read PEM formatted X.509 certificate from string.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Class Detail
-
-
-
- X509 ()
-
-
-
- hexadecimal X.509 certificate ASN.1 parser class.
-X509 class provides following functionality:
-
-parse X.509 certificate ASN.1 structure
-get basic fields, extensions, signature algorithms and signature values
-read PEM certificate
-
-
-
-TO GET FIELDS
-
-
-TO GET EXTENSIONS
-
-
-UTILITIES
-
-
-
-
Author: Kenji Urushima.
-
-
-
-
-
-
-
-
-
-
-
-
-
- See:
-
- 'jsrsasign'(RSA Sign JavaScript Library) home page http://kjur.github.com/jsrsasign/
-
-
-
-
-
-
-
-
-
-
- Field Detail
-
-
-
-
-
- {String}
- hex
-
-
-
- hexacedimal string for X.509 certificate.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{RSAKey }
-
subjectPublicKeyRSA
-
-
-
- Tom Wu's RSAKey object
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {String}
- subjectPublicKeyRSA_hE
-
-
-
- hexadecimal string for public exponent of RSA public key
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {String}
- subjectPublicKeyRSA_hN
-
-
-
- hexadecimal string for modulus of RSA public key
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
<static>
-
- {Object}
- X509. getExtAIAInfo (hCert)
-
-
-
- get AuthorityInfoAccess extension value in the certificate as associative array
-This method will get authority info access value
-as associate array which has following properties:
-
-ocsp - array of string for OCSP responder URL
-caissuer - array of string for caIssuer value (i.e. CA certificates URL)
-
-If there is no key usage extension in the certificate,
-it returns null;
-
-
-
-
-
-
-
oAIA = X509.getExtAIAInfo(hCert);
-// result will be such like:
-// oAIA.ocsp = ["http://ocsp.foo.com"];
-// oAIA.caissuer = ["http://rep.foo.com/aaa.p8m"];
-
-
-
-
-
- Parameters:
-
-
- {String} hCert
-
-
- hexadecimal string of X.509 certificate binary
-
-
-
-
-
-
- Since:
- x509 1.1.6
-
-
-
-
-
-
- Returns:
-
- {Object} associative array of AIA extension properties
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Object}
- X509. getExtAuthorityKeyIdentifier (hCert)
-
-
-
- get authorityKeyIdentifier value as JSON object in the certificate
-This method will get authority key identifier extension value
-as JSON object.
-If there is no its extension in the certificate,
-it returns null.
-
-NOTE: Currently this method only supports keyIdentifier so that
-authorityCertIssuer and authorityCertSerialNumber will not
-be return in the JSON object.
-
-
-
-
-
-
-
akid = X509.getExtAuthorityKeyIdentifier(hCert);
-// returns following JSON object
-{ kid: "1234abcd..." }
-
-
-
-
-
- Parameters:
-
-
- {String} hCert
-
-
- hexadecimal string of X.509 certificate binary
-
-
-
-
-
-
- Since:
- jsrsasign 5.0.10 x509 1.1.8
-
-
-
-
-
-
- Returns:
-
- {Object} JSON object of authority key identifier or null
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Object}
- X509. getExtBasicConstraints (hCert)
-
-
-
- get BasicConstraints extension value as object in the certificate
-This method will get basic constraints extension value as object with following paramters.
-
-cA - CA flag whether CA or not
-pathLen - maximum intermediate certificate length
-
-There are use cases for return values:
-
-{cA:true, pathLen:3} - cA flag is true and pathLen is 3
-{cA:true} - cA flag is true and no pathLen
-{} - basic constraints has no value in case of end entity certificate
-null - there is no basic constraints extension
-
-
-
-
-
-
-
-
obj = X509.getExtBasicConstraints(hCert);
-
-
-
-
-
- Parameters:
-
-
- {String} hCert
-
-
- hexadecimal string of X.509 certificate binary
-
-
-
-
-
-
- Since:
- x509 1.1.7
-
-
-
-
-
-
- Returns:
-
- {Object} associative array which may have "cA" and "pathLen" parameters
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Object}
- X509. getExtCRLDistributionPointsURI (hCert)
-
-
-
- get array of string for fullName URIs in cRLDistributionPoints(CDP) in the certificate
-This method will get all fullName URIs of cRLDistributionPoints extension
-in the certificate as array of URI string.
-If there is no its extension in the certificate,
-it returns null.
-
-NOTE: Currently this method supports only fullName URI so that
-other parameters will not be returned.
-
-
-
-
-
-
-
cdpuri = X509.getExtCRLDistributionPointsURI(hCert);
-// returns following array:
-["http://example.com/aaa.crl", "http://example.org/aaa.crl"]
-
-
-
-
-
- Parameters:
-
-
- {String} hCert
-
-
- hexadecimal string of X.509 certificate binary
-
-
-
-
-
-
- Since:
- jsrsasign 5.0.10 x509 1.1.8
-
-
-
-
-
-
- Returns:
-
- {Object} array of fullName URIs of CDP of the certificate
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Object}
- X509. getExtExtKeyUsageName (hCert)
-
-
-
- get extKeyUsage value as array of name string in the certificate
-This method will get extended key usage extension value
-as array of name or OID string.
-If there is no its extension in the certificate,
-it returns null.
-
-NOTE: Supported extended key usage ID names are defined in
-name2oidList parameter in asn1x509.js file.
-
-
-
-
-
-
-
eku = X509.getExtExtKeyUsageName(hCert);
-// returns following array:
-["serverAuth", "clientAuth", "0.1.2.3.4.5"]
-
-
-
-
-
- Parameters:
-
-
- {String} hCert
-
-
- hexadecimal string of X.509 certificate binary
-
-
-
-
-
-
- Since:
- jsrsasign 5.0.10 x509 1.1.8
-
-
-
-
-
-
- Returns:
-
- {Object} array of extended key usage ID name or oid
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- X509. getExtKeyUsageBin (hCert)
-
-
-
- get KeyUsage extension value as binary string in the certificate
-This method will get key usage extension value
-as binary string such like '101'.
-Key usage bits definition is in the RFC 5280.
-If there is no key usage extension in the certificate,
-it returns empty string (i.e. '').
-
-
-
-
-
-
-
bKeyUsage = X509.getExtKeyUsageBin(hCert);
-// bKeyUsage will be such like '101'.
-// 1 - digitalSignature
-// 0 - nonRepudiation
-// 1 - keyEncipherment
-
-
-
-
-
- Parameters:
-
-
- {String} hCert
-
-
- hexadecimal string of X.509 certificate binary
-
-
-
-
-
-
- Since:
- x509 1.1.6
-
-
-
-
-
-
- Returns:
-
- {String} binary string of key usage bits (ex. '101')
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- X509. getExtKeyUsageString (hCert)
-
-
-
- get KeyUsage extension value as names in the certificate
-This method will get key usage extension value
-as comma separated string of usage names.
-If there is no key usage extension in the certificate,
-it returns empty string (i.e. '').
-
-
-
-
-
-
-
sKeyUsage = X509.getExtKeyUsageString(hCert);
-// sKeyUsage will be such like 'digitalSignature,keyEncipherment'.
-
-
-
-
-
- Parameters:
-
-
- {String} hCert
-
-
- hexadecimal string of X.509 certificate binary
-
-
-
-
-
-
- Since:
- x509 1.1.6
-
-
-
-
-
-
- Returns:
-
- {String} comma separated string of key usage
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Object}
- X509. getExtSubjectAltName (hCert)
-
-
-
- get subjectAltName value as array of string in the certificate
-This method will get subject alt name extension value
-as array of name.
-If there is no its extension in the certificate,
-it returns null.
-
-NOTE: Currently this method supports only dNSName so that
-other name type such like iPAddress or generalName will not be returned.
-
-
-
-
-
-
-
san = X509.getExtSubjectAltName(hCert);
-// returns following array:
-["example.com", "example.org"]
-
-
-
-
-
- Parameters:
-
-
- {String} hCert
-
-
- hexadecimal string of X.509 certificate binary
-
-
-
-
-
-
- Since:
- jsrsasign 5.0.10 x509 1.1.8
-
-
-
-
-
-
- Returns:
-
- {Object} array of alt names
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- X509. getExtSubjectKeyIdentifier (hCert)
-
-
-
- get subjectKeyIdentifier value as hexadecimal string in the certificate
-This method will get subject key identifier extension value
-as hexadecimal string.
-If there is no its extension in the certificate,
-it returns null.
-
-
-
-
-
-
-
skid = X509.getExtSubjectKeyIdentifier(hCert);
-
-
-
-
-
- Parameters:
-
-
- {String} hCert
-
-
- hexadecimal string of X.509 certificate binary
-
-
-
-
-
-
- Since:
- jsrsasign 5.0.10 x509 1.1.8
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of subject key identifier or null
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- X509. getHexOfTLV_V3ExtValue (hCert, oidOrName)
-
-
-
- get X.509 V3 extension value ASN.1 TLV for specified oid or name
-This method will get X.509v3 extension value of ASN.1 TLV
-which is specifyed by extension name or oid.
-If there is no such extension in the certificate, it returns null.
-
-
-
-
-
-
-
hExtValue = X509.getHexOfTLV_V3ExtValue(hCert, "keyUsage");
-// hExtValue will be such like '030205a0'.
-
-
-
-
-
- Parameters:
-
-
- {String} hCert
-
-
- hexadecimal string of X.509 certificate binary
-
-
- {String} oidOrName
-
-
- oid or name for extension (ex. 'keyUsage' or '2.5.29.15')
-
-
-
-
-
-
- Since:
- x509 1.1.6
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of extension ASN.1 TLV
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- X509. getHexOfV_V3ExtValue (hCert, oidOrName)
-
-
-
- get X.509 V3 extension value ASN.1 V for specified oid or name
-This method will get X.509v3 extension value of ASN.1 value
-which is specifyed by extension name or oid.
-If there is no such extension in the certificate, it returns null.
-Available extension names and oids are defined
-in the
KJUR.asn1.x509.OID class.
-
-
-
-
-
-
-
hExtValue = X509.getHexOfV_V3ExtValue(hCert, "keyUsage");
-// hExtValue will be such like '05a0'.
-
-
-
-
-
- Parameters:
-
-
- {String} hCert
-
-
- hexadecimal string of X.509 certificate binary
-
-
- {String} oidOrName
-
-
- oid or name for extension (ex. 'keyUsage' or '2.5.29.15')
-
-
-
-
-
-
- Since:
- x509 1.1.6
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of extension ASN.1 TLV
-
-
-
-
-
-
-
-
-
-
-
- {String}
- getInfo ()
-
-
-
- get certificate information as string.
-
-
-
-
-
-
-
x = new X509();
-x.readCertPEM(certPEM);
-console.log(x.getInfo());
-// this shows as following
-Basic Fields
- serial number: 02ac5c266a0b409b8f0b79f2ae462577
- signature algorithm: SHA1withRSA
- issuer: /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance EV Root CA
- notBefore: 061110000000Z
- notAfter: 311110000000Z
- subject: /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance EV Root CA
- subject public key info:
- key algorithm: RSA
- n=c6cce573e6fbd4bb...
- e=10001
-X509v3 Extensions:
- keyUsage CRITICAL:
- digitalSignature,keyCertSign,cRLSign
- basicConstraints CRITICAL:
- cA=true
- subjectKeyIdentifier :
- b13ec36903f8bf4701d498261a0802ef63642bc3
- authorityKeyIdentifier :
- kid=b13ec36903f8bf4701d498261a0802ef63642bc3
-signature algorithm: SHA1withRSA
-signature: 1c1a0697dcd79c9f...
-
-
-
-
-
-
-
- Since:
- jsrsasign 5.0.10 x509 1.1.8
-
-
-
-
-
-
- Returns:
-
- {String} certificate information string
-
-
-
-
-
-
-
-
-
-
-
- {String}
- getIssuerHex ()
-
-
-
- get hexadecimal string of issuer field TLV of certificate.
-
-
-
-
-
-
-
var x = new X509();
-x.readCertPEM(sCertPEM);
-var issuer = x.getIssuerHex(); // return string like "3013..."
-
-
-
-
-
-
-
-
-
- Returns:
-
- {String} hexadecial string of issuer DN ASN.1
-
-
-
-
-
-
-
-
-
-
-
- {String}
- getIssuerString ()
-
-
-
- get string of issuer field of certificate.
-
-
-
-
-
-
-
var x = new X509();
-x.readCertPEM(sCertPEM);
-var issuer = x.getIssuerString(); // return string like "/C=US/O=TEST"
-
-
-
-
-
-
-
-
-
- Returns:
-
- {String} issuer DN string
-
-
-
-
-
-
-
-
-
-
-
- {String}
- getNotAfter ()
-
-
-
- get notAfter field string of certificate.
-
-
-
-
-
-
-
var x = new X509();
-x.readCertPEM(sCertPEM);
-var notAfter = x.getNotAfter(); // return string like "151231235959Z"
-
-
-
-
-
-
-
-
-
- Returns:
-
- {String} not after time value (ex. "151231235959Z")
-
-
-
-
-
-
-
-
-
-
-
- {String}
- getNotBefore ()
-
-
-
- get notBefore field string of certificate.
-
-
-
-
-
-
-
var x = new X509();
-x.readCertPEM(sCertPEM);
-var notBefore = x.getNotBefore(); // return string like "151231235959Z"
-
-
-
-
-
-
-
-
-
- Returns:
-
- {String} not before time value (ex. "151231235959Z")
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Integer}
- X509. getPosOfTLV_V3ExtValue (hCert, oidOrName)
-
-
-
- get index in the certificate hexa string for specified oid or name specified extension
-This method will get X.509v3 extension value of ASN.1 V(value)
-which is specifyed by extension name or oid.
-If there is no such extension in the certificate,
-it returns -1.
-Available extension names and oids are defined
-in the
KJUR.asn1.x509.OID class.
-
-
-
-
-
-
-
idx = X509.getPosOfV_V3ExtValue(hCert, "keyUsage");
-// The 'idx' will be index in the string for keyUsage value ASN.1 TLV.
-
-
-
-
-
- Parameters:
-
-
- {String} hCert
-
-
- hexadecimal string of X.509 certificate binary
-
-
- {String} oidOrName
-
-
- oid or name for extension (ex. 'keyUsage' or '2.5.29.15')
-
-
-
-
-
-
- Since:
- x509 1.1.6
-
-
-
-
-
-
- Returns:
-
- {Integer} index in the hexadecimal string of certficate for specified extension
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- X509. getPublicKeyFromCertPEM (sCertPEM)
-
-
-
- get RSAKey/ECDSA public key object from PEM certificate string
-NOTE: DSA is also supported since x509 1.1.2.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} sCertPEM
-
-
- PEM formatted RSA/ECDSA/DSA X.509 certificate
-
-
-
-
-
-
- Since:
- x509 1.1.1
-
-
-
-
-
-
- Returns:
-
- returns RSAKey/KJUR.crypto.{ECDSA,DSA} object of public key
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Integer}
- X509. getPublicKeyInfoPosOfCertHEX (hCert)
-
-
-
- get position of subjectPublicKeyInfo field from HEX certificate
-get position for SubjectPublicKeyInfo field in the hexadecimal string of
-certificate.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} hCert
-
-
- hexadecimal string of certificate
-
-
-
-
-
-
- Since:
- x509 1.1.4
-
-
-
-
-
-
- Returns:
-
- {Integer} position in hexadecimal string
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Hash}
- X509. getPublicKeyInfoPropOfCertPEM (sCertPEM)
-
-
-
- get public key information from PEM certificate
-Resulted associative array has following properties:
-
-algoid - hexadecimal string of OID of asymmetric key algorithm
-algparam - hexadecimal string of OID of ECC curve name or null
-keyhex - hexadecimal string of key in the certificate
-
-NOTE: X509v1 certificate is also supported since x509.js 1.1.9.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} sCertPEM
-
-
- string of PEM formatted certificate
-
-
-
-
-
-
- Since:
- x509 1.1.1
-
-
-
-
-
-
- Returns:
-
- {Hash} hash of information for public key
-
-
-
-
-
-
-
-
-
-
-
- {String}
- getSerialNumberHex ()
-
-
-
- get hexadecimal string of serialNumber field of certificate.
-
-
-
-
-
-
-
var x = new X509();
-x.readCertPEM(sCertPEM);
-var sn = x.getSerialNumberHex(); // return string like "01ad..."
-
-
-
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of certificate serial number
-
-
-
-
-
-
-
-
-
-
-
- {String}
- getSignatureAlgorithmField ()
-
-
-
- get signature algorithm name in basic field
-This method will get a name of signature algorithm field of certificate:
-
-
-
-
-
-
-
var x = new X509();
-x.readCertPEM(sCertPEM);
-algName = x.getSignatureAlgorithmField();
-
-
-
-
-
-
-
- Since:
- x509 1.1.8
-
-
-
-
-
-
- Returns:
-
- {String} signature algorithm name (ex. SHA1withRSA, SHA256withECDSA)
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- X509. getSignatureAlgorithmName (hCert)
-
-
-
- get signature algorithm name from hexadecimal certificate data
-This method will get signature algorithm name of certificate:
-
-
-
-
-
-
-
algName = X509.getSignatureAlgorithmName(hCert);
-
-
-
-
-
- Parameters:
-
-
- {String} hCert
-
-
- hexadecimal string of X.509 certificate binary
-
-
-
-
-
-
- Since:
- x509 1.1.7
-
-
-
-
-
-
- Returns:
-
- {String} signature algorithm name (ex. SHA1withRSA, SHA256withECDSA)
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- X509. getSignatureValueHex (hCert)
-
-
-
- get signature value in hexadecimal string
-This method will get signature value of certificate:
-
-
-
-
-
-
-
sigHex = X509.getSignatureValueHex(hCert);
-
-
-
-
-
- Parameters:
-
-
- {String} hCert
-
-
- hexadecimal string of X.509 certificate binary
-
-
-
-
-
-
- Since:
- x509 1.1.7
-
-
-
-
-
-
- Returns:
-
- {String} signature value hexadecimal string without BitString unused bits
-
-
-
-
-
-
-
-
-
-
-
- {String}
- getSubjectHex ()
-
-
-
- get hexadecimal string of subject field of certificate.
-
-
-
-
-
-
-
var x = new X509();
-x.readCertPEM(sCertPEM);
-var subject = x.getSubjectHex(); // return string like "3013..."
-
-
-
-
-
-
-
-
-
- Returns:
-
- {String} hexadecial string of subject DN ASN.1
-
-
-
-
-
-
-
-
-
-
-
- {String}
- getSubjectString ()
-
-
-
- get string of subject field of certificate.
-
-
-
-
-
-
-
var x = new X509();
-x.readCertPEM(sCertPEM);
-var subject = x.getSubjectString(); // return string like "/C=US/O=TEST"
-
-
-
-
-
-
-
-
-
- Returns:
-
- {String} subject DN string
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Array}
- X509. getV3ExtInfoListOfCertHex (hCert)
-
-
-
- get array of X.509 V3 extension value information in hex string of certificate
-This method will get all extension information of a X.509 certificate.
-Items of resulting array has following properties:
-
-posTLV - index of ASN.1 TLV for the extension. same as 'pos' argument.
-oid - dot noted string of extension oid (ex. 2.5.29.14)
-critical - critical flag value for this extension
-posV - index of ASN.1 TLV for the extension value.
-This is a position of a content of ENCAPSULATED OCTET STRING.
-
-
-
-
-
-
-
-
hCert = X509.pemToHex(certGithubPEM);
-a = X509.getV3ExtInfoListOfCertHex(hCert);
-// Then a will be an array of like following:
-[{posTLV: 1952, oid: "2.5.29.35", critical: false, posV: 1968},
- {posTLV: 1974, oid: "2.5.29.19", critical: true, posV: 1986}, ...]
-
-
-
-
-
- Parameters:
-
-
- {String} hCert
-
-
- hexadecimal string of X.509 certificate binary
-
-
-
-
-
-
- Since:
- x509 1.1.5
-
-
-
-
-
-
- Returns:
-
- {Array} array of result object by X509.getV3ExtInfoListOfCertHex
-
-
-
-
-
-
-
-
-
-
<static>
-
- {Object}
- X509. getV3ExtItemInfo_AtObj (hCert, pos)
-
-
-
- get X.509 V3 extension value information at the specified position
-This method will get some information of a X.509 V extension
-which is referred by an index of hexadecimal string of X.509
-certificate.
-Resulting object has following properties:
-
-posTLV - index of ASN.1 TLV for the extension. same as 'pos' argument.
-oid - dot noted string of extension oid (ex. 2.5.29.14)
-critical - critical flag value for this extension
-posV - index of ASN.1 TLV for the extension value.
-This is a position of a content of ENCAPSULATED OCTET STRING.
-
-This method is used by
X509.getV3ExtInfoListOfCertHex internally.
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} hCert
-
-
- hexadecimal string of X.509 certificate binary
-
-
- {Integer} pos
-
-
- index of hexadecimal string for the extension
-
-
-
-
-
-
- Since:
- x509 1.1.5
-
-
-
-
-
-
- Returns:
-
- {Object} properties for the extension
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- X509. pemToBase64 (sCertPEM)
-
-
-
- get Base64 string from PEM certificate string
-
-
-
-
-
-
-
b64 = X509.pemToBase64(certPEM);
-
-
-
-
-
- Parameters:
-
-
- {String} sCertPEM
-
-
- PEM formatted RSA/ECDSA/DSA X.509 certificate
-
-
-
-
-
-
-
-
- Returns:
-
- {String} Base64 string of PEM certificate
-
-
-
-
-
-
-
-
-
-
<static>
-
- {String}
- X509. pemToHex (sCertPEM)
-
-
-
- get a hexa decimal string from PEM certificate string
-
-
-
-
-
-
-
hex = X509.pemToHex(certPEM);
-
-
-
-
-
- Parameters:
-
-
- {String} sCertPEM
-
-
- PEM formatted RSA/ECDSA/DSA X.509 certificate
-
-
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of PEM certificate
-
-
-
-
-
-
-
-
-
-
-
-
- readCertPEM (sCertPEM)
-
-
-
- read PEM formatted X.509 certificate from string.
-
-
-
-
-
-
-
x = new X509();
-x.readCertPEM(sCertPEM); // read certificate
-
-
-
-
-
- Parameters:
-
-
- {String} sCertPEM
-
-
- string for PEM formatted X.509 certificate
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/global__.html b/jwt/api/symbols/global__.html
deleted file mode 100644
index 4e2a847..0000000
--- a/jwt/api/symbols/global__.html
+++ /dev/null
@@ -1,2313 +0,0 @@
-
-
-
-
-
-
-
jsrsasign 4.8.7 JavaScript API Reference - global__
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Built-In Namespace global__
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
-
- Method Attributes
- Method Name and Description
-
-
-
-
-
-
-
-
- convert a Base64 encoded string to a Base64URL encoded string.
-
-
-
-
-
-
-
- convert a Base64 encoded string to a UTF-8 encoded string including CJK or Latin.
-
-
-
-
-
-
-
- convert a Base64URL encoded string to a Base64 encoded string.
-
-
-
-
-
-
-
- convert a Base64URL encoded string to a hexadecimal string.
-
-
-
-
-
-
-
- convert a Base64URL encoded string to a ASCII string.
-
-
-
-
-
-
- b64utoutf8 (s)
-
-
-
-
-
-
-
-
-
- convert an array of bytes(Number) to hexadecimal string.
-
-
-
-
-
-
-
- convert an array of character codes to a string
-
-
-
-
-
-
-
- convert UTFa hexadecimal string to a URLComponent string such like "%67%68".
-
-
-
-
-
-
-
- convert a hexadecimal string to a Base64URL encoded string.
-
-
-
-
-
-
-
- convert a hexadecimal encoded string to raw string including non printable characters.
-
-
-
-
-
-
-
- convert a hexadecimal string to a URLComponent string such like "%67%68".
-
-
-
-
-
-
-
- convert a hexadecimal encoded string to a UTF-8 encoded string including CJK or Latin.
-
-
-
-
-
-
-
- convert string of integer array to hexadecimal string.
-
-
-
-
-
-
-
- convert all UNIX new line("\r\n") to DOS new line("\n") in
-a String "s".
-
-
-
-
-
-
-
- convert all DOS new line("\r\n") to UNIX new line("\n") in
-a String "s".
-
-
-
-
-
-
-
- read file and return file contents
-This function only works in Node.js.
-
-
-
-
-
-
-
- read binary file and return file contents as hexadecimal string
-This function only works in Node.js.
-
-
-
-
-
-
-
- read file and return file contents as utf-8 string
-This function only works in Node.js.
-
-
-
-
-
-
-
- convert a raw string including non printable characters to hexadecimal encoded string.
-
-
-
-
-
-
-
- save raw string to file
-This function only works in Node.js.
-
-
-
-
-
-
-
- save data represented by hexadecimal string to file
-This function only works in Node.js.
-
-
-
-
-
-
-
- convert a ASCII string to a Base64 encoded string.
-
-
-
-
-
-
-
- convert a ASCII string to a Base64URL encoded string.
-
-
-
-
-
-
-
- convert a string to an array of character codes
-
-
-
-
-
-
-
- convert a ASCII string to a hexadecimal string of ASCII codes.
-
-
-
-
-
-
-
- find index of string where two string differs
-
-
-
-
-
-
-
- convert a URLComponent string such like "%67%68" to a hexadecimal string.
-
-
-
-
-
-
-
- convert a UTF-8 encoded string including CJK or Latin to a Base64 encoded string.
-
-
-
-
-
-
- utf8tob64u (s)
-
-
-
-
-
-
-
-
-
- convert a UTF-8 encoded string including CJK or Latin to a hexadecimal encoded string.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
-
- {String}
- b64tob64u (s)
-
-
-
- convert a Base64 encoded string to a Base64URL encoded string.
-Example: "ab+c3f/==" → "ab-c3f_"
-
-
-
Defined in: base64x-1.1.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- Base64 encoded string
-
-
-
-
-
-
-
-
- Returns:
-
- {String} Base64URL encoded string
-
-
-
-
-
-
-
-
-
-
-
- {String}
- b64toutf8 (s)
-
-
-
- convert a Base64 encoded string to a UTF-8 encoded string including CJK or Latin.
-
-
-
Defined in: base64x-1.1.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- Base64 encoded string
-
-
-
-
-
-
- Since:
- 1.1.1
-
-
-
-
-
-
- Returns:
-
- {String} UTF-8 encoded string
-
-
-
-
-
-
-
-
-
-
-
- {String}
- b64utob64 (s)
-
-
-
- convert a Base64URL encoded string to a Base64 encoded string.
-Example: "ab-c3f_" → "ab+c3f/=="
-
-
-
Defined in: base64x-1.1.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- Base64URL encoded string
-
-
-
-
-
-
-
-
- Returns:
-
- {String} Base64 encoded string
-
-
-
-
-
-
-
-
-
-
-
- {String}
- b64utohex (s)
-
-
-
- convert a Base64URL encoded string to a hexadecimal string.
-
-
-
Defined in: base64x-1.1.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- Base64URL encoded string
-
-
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string
-
-
-
-
-
-
-
-
-
-
-
- {String}
- b64utos (s)
-
-
-
- convert a Base64URL encoded string to a ASCII string.
-NOTE: This can't be used for Base64URL encoded non ASCII characters.
-
-
-
Defined in: base64x-1.1.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {s} s
-
-
- Base64URL encoded string
-
-
-
-
-
-
-
-
- Returns:
-
- {String} ASCII string
-
-
-
-
-
-
-
-
-
-
-
-
- b64utoutf8 (s)
-
-
-
-
-
-
-
-
- Parameters:
-
-
- s
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {String}
- BAtohex (a)
-
-
-
- convert an array of bytes(Number) to hexadecimal string.
-
-
-
Defined in: base64x-1.1.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array of Numbers} a
-
-
- array of bytes
-
-
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string
-
-
-
-
-
-
-
-
-
-
-
- {String}
- BAtos (a)
-
-
-
- convert an array of character codes to a string
-
-
-
Defined in: base64x-1.1.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {Array of Numbers} a
-
-
- array of character codes
-
-
-
-
-
-
-
-
- Returns:
-
- {String} s
-
-
-
-
-
-
-
-
-
-
-
- {String}
- encodeURIComponentAll (s)
-
-
-
- convert UTFa hexadecimal string to a URLComponent string such like "%67%68".
-Note that these "
0-9A-Za-z!'()*-._~
" characters will not
-converted to "%xx" format by builtin 'encodeURIComponent()' function.
-However this 'encodeURIComponentAll()' function will convert
-all of characters into "%xx" format.
-
-
-
Defined in: base64x-1.1.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- hexadecimal string
-
-
-
-
-
-
- Since:
- 1.1
-
-
-
-
-
-
- Returns:
-
- {String} URIComponent string such like "%67%68"
-
-
-
-
-
-
-
-
-
-
-
- {String}
- hextob64u (s)
-
-
-
- convert a hexadecimal string to a Base64URL encoded string.
-convert a hexadecimal string to a Base64URL encoded string.
-NOTE: If leading "0" is omitted and odd number length for
-hexadecimal leading "0" is automatically added.
-
-
-
Defined in: base64x-1.1.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- hexadecimal string
-
-
-
-
-
-
-
-
- Returns:
-
- {String} Base64URL encoded string
-
-
-
-
-
-
-
-
-
-
-
- {String}
- hextorstr (s)
-
-
-
- convert a hexadecimal encoded string to raw string including non printable characters.
-
-
-
Defined in: base64x-1.1.js .
-
-
-
-
-
-
-
hextorstr("610061") → "a\x00a"
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- hexadecimal encoded string
-
-
-
-
-
-
- Since:
- 1.1.2
-
-
-
-
-
-
- Returns:
-
- {String} raw string
-
-
-
-
-
-
-
-
-
-
-
- {String}
- hextouricmp (s)
-
-
-
- convert a hexadecimal string to a URLComponent string such like "%67%68".
-
-
-
Defined in: base64x-1.1.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- hexadecimal string
-
-
-
-
-
-
- Since:
- 1.1
-
-
-
-
-
-
- Returns:
-
- {String} URIComponent string such like "%67%68"
-
-
-
-
-
-
-
-
-
-
-
- {String}
- hextoutf8 (s)
-
-
-
- convert a hexadecimal encoded string to a UTF-8 encoded string including CJK or Latin.
-Note that when input is improper hexadecimal string as UTF-8 string, this function returns
-'null'.
-
-
-
Defined in: base64x-1.1.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- hexadecimal encoded string
-
-
-
-
-
-
- Since:
- 1.1.1
-
-
-
-
-
-
- Returns:
-
- {String} UTF-8 encoded string or null
-
-
-
-
-
-
-
-
-
-
-
- {String}
- intarystrtohex (s)
-
-
-
- convert string of integer array to hexadecimal string.
-This function converts a string of JavaScript integer array to
-a hexadecimal string. Each integer value shall be in a range
-from 0 to 255 otherwise it raise exception. Input string can
-have extra space or newline string so that they will be ignored.
-
-
-
Defined in: base64x-1.1.js .
-
-
-
-
-
-
-
intarystrtohex(" [123, 34, 101, 34, 58] ")
--> 7b2265223a (i.e. `{"e":` as string)
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- string of integer array
-
-
-
-
-
-
- Since:
- base64x 1.1.6 jsrsasign 5.0.2
-
-
-
-
-
- Throws:
-
-
-
-
- "malformed integer array string: *" for wrong input
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string
-
-
-
-
-
-
-
-
-
-
-
- {String}
- newline_toDos (s)
-
-
-
- convert all UNIX new line("\r\n") to DOS new line("\n") in
-a String "s".
-
-
-
Defined in: base64x-1.1.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- string
-
-
-
-
-
-
-
-
- Returns:
-
- {String} converted string
-
-
-
-
-
-
-
-
-
-
-
- {String}
- newline_toUnix (s)
-
-
-
- convert all DOS new line("\r\n") to UNIX new line("\n") in
-a String "s".
-
-
-
Defined in: base64x-1.1.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- string
-
-
-
-
-
-
-
-
- Returns:
-
- {String} converted string
-
-
-
-
-
-
-
-
-
-
-
- {String}
- readFile (binFile)
-
-
-
- read file and return file contents
-This function only works in Node.js.
-
-
-
Defined in: nodeutil-1.0.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} binFile
-
-
- file name to be read
-
-
-
-
-
-
-
-
- Returns:
-
- {String} raw string of file contents
-
-
-
-
-
-
-
-
-
-
-
- {String}
- readFileHexByBin (binFile)
-
-
-
- read binary file and return file contents as hexadecimal string
-This function only works in Node.js.
-
-
-
Defined in: nodeutil-1.0.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} binFile
-
-
- file name to be read
-
-
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string of file contents
-
-
-
-
-
-
-
-
-
-
-
- {String}
- readFileUTF8 (utf8File)
-
-
-
- read file and return file contents as utf-8 string
-This function only works in Node.js.
-
-
-
Defined in: nodeutil-1.0.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} utf8File
-
-
- file name to be read
-
-
-
-
-
-
-
-
- Returns:
-
- {String} utf-8 string of file contents
-
-
-
-
-
-
-
-
-
-
-
- {String}
- rstrtohex (s)
-
-
-
- convert a raw string including non printable characters to hexadecimal encoded string.
-
-
-
Defined in: base64x-1.1.js .
-
-
-
-
-
-
-
rstrtohex("a\x00a") → "610061"
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- raw string
-
-
-
-
-
-
- Since:
- 1.1.2
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal encoded string
-
-
-
-
-
-
-
-
-
-
-
-
- saveFile (binFile, rawString)
-
-
-
- save raw string to file
-This function only works in Node.js.
-
-
-
Defined in: nodeutil-1.0.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} binFile
-
-
- file name to save contents.
-
-
- {String} rawString
-
-
- string contents to be saved.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- saveFileBinByHex (binFile, hexString)
-
-
-
- save data represented by hexadecimal string to file
-This function only works in Node.js.
-
-
-
Defined in: nodeutil-1.0.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} binFile
-
-
- file name to save contents.
-
-
- {String} hexString
-
-
- hexadecimal string to be saved.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {String}
- stob64 (s)
-
-
-
- convert a ASCII string to a Base64 encoded string.
-NOTE: This can't be used for non ASCII characters.
-
-
-
Defined in: base64x-1.1.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {s} s
-
-
- ASCII string
-
-
-
-
-
-
-
-
- Returns:
-
- {String} Base64 encoded string
-
-
-
-
-
-
-
-
-
-
-
- {String}
- stob64u (s)
-
-
-
- convert a ASCII string to a Base64URL encoded string.
-NOTE: This can't be used for non ASCII characters.
-
-
-
Defined in: base64x-1.1.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {s} s
-
-
- ASCII string
-
-
-
-
-
-
-
-
- Returns:
-
- {String} Base64URL encoded string
-
-
-
-
-
-
-
-
-
-
-
- {Array of Numbers}
- stoBA (s)
-
-
-
- convert a string to an array of character codes
-
-
-
Defined in: base64x-1.1.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
-
-
-
-
-
-
-
-
-
- Returns:
-
- {Array of Numbers}
-
-
-
-
-
-
-
-
-
-
-
- {String}
- stohex (s)
-
-
-
- convert a ASCII string to a hexadecimal string of ASCII codes.
-NOTE: This can't be used for non ASCII characters.
-
-
-
Defined in: base64x-1.1.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {s} s
-
-
- ASCII string
-
-
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string
-
-
-
-
-
-
-
-
-
-
-
- {Number}
- strdiffidx (s1, s2)
-
-
-
- find index of string where two string differs
-
-
-
Defined in: base64x-1.1.js .
-
-
-
-
-
-
-
strdiffidx("abcdefg", "abcd4fg") -> 4
-strdiffidx("abcdefg", "abcdefg") -> -1
-strdiffidx("abcdefg", "abcdef") -> 6
-strdiffidx("abcdefgh", "abcdef") -> 6
-
-
-
-
-
- Parameters:
-
-
- {String} s1
-
-
- string to compare
-
-
- {String} s2
-
-
- string to compare
-
-
-
-
-
-
- Since:
- jsrsasign 4.9.0 base64x 1.1.5
-
-
-
-
-
-
- Returns:
-
- {Number} string index of where character differs. Return -1 if same.
-
-
-
-
-
-
-
-
-
-
-
- {String}
- uricmptohex (s)
-
-
-
- convert a URLComponent string such like "%67%68" to a hexadecimal string.
-
-
-
Defined in: base64x-1.1.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- URIComponent string such like "%67%68"
-
-
-
-
-
-
- Since:
- 1.1
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal string
-
-
-
-
-
-
-
-
-
-
-
- {String}
- utf8tob64 (s)
-
-
-
- convert a UTF-8 encoded string including CJK or Latin to a Base64 encoded string.
-
-
-
Defined in: base64x-1.1.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- UTF-8 encoded string
-
-
-
-
-
-
- Since:
- 1.1.1
-
-
-
-
-
-
- Returns:
-
- {String} Base64 encoded string
-
-
-
-
-
-
-
-
-
-
-
-
- utf8tob64u (s)
-
-
-
-
-
-
-
-
- Parameters:
-
-
- s
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {String}
- utf8tohex (s)
-
-
-
- convert a UTF-8 encoded string including CJK or Latin to a hexadecimal encoded string.
-
-
-
Defined in: base64x-1.1.js .
-
-
-
-
-
-
-
-
- Parameters:
-
-
- {String} s
-
-
- UTF-8 encoded string
-
-
-
-
-
-
- Since:
- 1.1.1
-
-
-
-
-
-
- Returns:
-
- {String} hexadecimal encoded string
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- © 2012-2015 Kenji Urushima, All rights reserved
-
- Documentation generated by
JsDoc Toolkit 2.4.0
-
-
-
diff --git a/jwt/api/symbols/src/asn1-1.0.js.html b/jwt/api/symbols/src/asn1-1.0.js.html
deleted file mode 100644
index 5ef9749..0000000
--- a/jwt/api/symbols/src/asn1-1.0.js.html
+++ /dev/null
@@ -1,1561 +0,0 @@
-
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
- 5 *
- 6 * Copyright (c) 2013-2015 Kenji Urushima (kenji.urushima@gmail.com)
- 7 *
- 8 * This software is licensed under the terms of the MIT License.
- 9 * http://kjur.github.com/jsrsasign/license
- 10 *
- 11 * The above copyright and license notice shall be
- 12 * included in all copies or substantial portions of the Software.
- 13 */
- 14
- 15 /**
- 16 * @fileOverview
- 17 * @name asn1-1.0.js
- 18 * @author Kenji Urushima kenji.urushima@gmail.com
- 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 */
- 23
- 24 /**
- 25 * kjur's class library name space
- 26 * <p>
- 27 * This name space provides following name spaces:
- 28 * <ul>
- 29 * <li>{@link KJUR.asn1} - ASN.1 primitive hexadecimal encoder</li>
- 30 * <li>{@link KJUR.asn1.x509} - ASN.1 structure for X.509 certificate and CRL</li>
- 31 * <li>{@link KJUR.crypto} - Java Cryptographic Extension(JCE) style MessageDigest/Signature
- 32 * class and utilities</li>
- 33 * </ul>
- 34 * </p>
- 35 * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.
- 36 * @name KJUR
- 37 * @namespace kjur's class library name space
- 38 */
- 39 if ( typeof KJUR == "undefined" || ! KJUR ) KJUR = { } ;
- 40
- 41 /**
- 42 * kjur's ASN.1 class library name space
- 43 * <p>
- 44 * This is ITU-T X.690 ASN.1 DER encoder class library and
- 45 * class structure and methods is very similar to
- 46 * org.bouncycastle.asn1 package of
- 47 * well known BouncyCaslte Cryptography Library.
- 48 * <h4>PROVIDING ASN.1 PRIMITIVES</h4>
- 49 * Here are ASN.1 DER primitive classes.
- 50 * <ul>
- 51 * <li>0x01 {@link KJUR.asn1.DERBoolean}</li>
- 52 * <li>0x02 {@link KJUR.asn1.DERInteger}</li>
- 53 * <li>0x03 {@link KJUR.asn1.DERBitString}</li>
- 54 * <li>0x04 {@link KJUR.asn1.DEROctetString}</li>
- 55 * <li>0x05 {@link KJUR.asn1.DERNull}</li>
- 56 * <li>0x06 {@link KJUR.asn1.DERObjectIdentifier}</li>
- 57 * <li>0x0a {@link KJUR.asn1.DEREnumerated}</li>
- 58 * <li>0x0c {@link KJUR.asn1.DERUTF8String}</li>
- 59 * <li>0x12 {@link KJUR.asn1.DERNumericString}</li>
- 60 * <li>0x13 {@link KJUR.asn1.DERPrintableString}</li>
- 61 * <li>0x14 {@link KJUR.asn1.DERTeletexString}</li>
- 62 * <li>0x16 {@link KJUR.asn1.DERIA5String}</li>
- 63 * <li>0x17 {@link KJUR.asn1.DERUTCTime}</li>
- 64 * <li>0x18 {@link KJUR.asn1.DERGeneralizedTime}</li>
- 65 * <li>0x30 {@link KJUR.asn1.DERSequence}</li>
- 66 * <li>0x31 {@link KJUR.asn1.DERSet}</li>
- 67 * </ul>
- 68 * <h4>OTHER ASN.1 CLASSES</h4>
- 69 * <ul>
- 70 * <li>{@link KJUR.asn1.ASN1Object}</li>
- 71 * <li>{@link KJUR.asn1.DERAbstractString}</li>
- 72 * <li>{@link KJUR.asn1.DERAbstractTime}</li>
- 73 * <li>{@link KJUR.asn1.DERAbstractStructured}</li>
- 74 * <li>{@link KJUR.asn1.DERTaggedObject}</li>
- 75 * </ul>
- 76 * <h4>SUB NAME SPACES</h4>
- 77 * <ul>
- 78 * <li>{@link KJUR.asn1.cades} - CAdES long term signature format</li>
- 79 * <li>{@link KJUR.asn1.cms} - Cryptographic Message Syntax</li>
- 80 * <li>{@link KJUR.asn1.csr} - Certificate Signing Request (CSR/PKCS#10)</li>
- 81 * <li>{@link KJUR.asn1.tsp} - RFC 3161 Timestamping Protocol Format</li>
- 82 * <li>{@link KJUR.asn1.x509} - RFC 5280 X.509 certificate and CRL</li>
- 83 * </ul>
- 84 * </p>
- 85 * NOTE: Please ignore method summary and document of this namespace.
- 86 * This caused by a bug of jsdoc2.
- 87 * @name KJUR.asn1
- 88 * @namespace
- 89 */
- 90 if ( typeof KJUR.asn1 == "undefined" || ! KJUR.asn1 ) KJUR.asn1 = { } ;
- 91
- 92 /**
- 93 * ASN1 utilities class
- 94 * @name KJUR.asn1.ASN1Util
- 95 * @class ASN1 utilities class
- 96 * @since asn1 1.0.2
- 97 */
- 98 KJUR.asn1.ASN1Util = new function ( ) {
- 99 this.integerToByteHex = function ( i ) {
-100 var h = i.toString ( 16 ) ;
-101 if ( ( h.length % 2 ) == 1 ) h = '0' + h ;
-102 return h ;
-103 } ;
-104 this.bigIntToMinTwosComplementsHex = function ( bigIntegerValue ) {
-105 var h = bigIntegerValue.toString ( 16 ) ;
-106 if ( h.substr ( 0 , 1 ) != '-' ) {
-107 if ( h.length % 2 == 1 ) {
-108 h = '0' + h ;
-109 } else {
-110 if ( ! h.match ( /^[0-7]/ ) ) {
-111 h = '00' + h ;
-112 }
-113 }
-114 } else {
-115 var hPos = h.substr ( 1 ) ;
-116 var xorLen = hPos.length ;
-117 if ( xorLen % 2 == 1 ) {
-118 xorLen + = 1 ;
-119 } else {
-120 if ( ! h.match ( /^[0-7]/ ) ) {
-121 xorLen + = 2 ;
-122 }
-123 }
-124 var hMask = '' ;
-125 for ( var i = 0 ; i < xorLen ; i ++ ) {
-126 hMask + = 'f' ;
-127 }
-128 var biMask = new BigInteger ( hMask , 16 ) ;
-129 var biNeg = biMask.xor ( bigIntegerValue ) . add ( BigInteger.ONE ) ;
-130 h = biNeg.toString ( 16 ) . replace ( /^-/ , '' ) ;
-131 }
-132 return h ;
-133 } ;
-134 /**
-135 * get PEM string from hexadecimal data and header string
-136 * @name getPEMStringFromHex
-137 * @memberOf KJUR.asn1.ASN1Util
-138 * @function
-139 * @param {String} dataHex hexadecimal string of PEM body
-140 * @param {String} pemHeader PEM header string (ex. 'RSA PRIVATE KEY')
-141 * @return {String} PEM formatted string of input data
-142 * @description
-143 * @example
-144 * var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex('616161', 'RSA PRIVATE KEY');
-145 * // value of pem will be:
-146 * -----BEGIN PRIVATE KEY-----
-147 * YWFh
-148 * -----END PRIVATE KEY-----
-149 */
-150 this.getPEMStringFromHex = function ( dataHex , pemHeader ) {
-151 var ns1 = KJUR.asn1 ;
-152 var dataWA = CryptoJS.enc.Hex.parse ( dataHex ) ;
-153 var dataB64 = CryptoJS.enc.Base64.stringify ( dataWA ) ;
-154 var pemBody = dataB64.replace ( /(.{64})/g , "$1\r\n" ) ;
-155 pemBody = pemBody.replace ( /\r\n$/ , '' ) ;
-156 return "-----BEGIN " + pemHeader + "-----\r\n" +
-157 pemBody +
-158 "\r\n-----END " + pemHeader + "-----\r\n" ;
-159 } ;
-160
-161 /**
-162 * generate ASN1Object specifed by JSON parameters
-163 * @name newObject
-164 * @memberOf KJUR.asn1.ASN1Util
-165 * @function
-166 * @param {Array} param JSON parameter to generate ASN1Object
-167 * @return {KJUR.asn1.ASN1Object} generated object
-168 * @since asn1 1.0.3
-169 * @description
-170 * generate any ASN1Object specified by JSON param
-171 * including ASN.1 primitive or structured.
-172 * Generally 'param' can be described as follows:
-173 * <blockquote>
-174 * {TYPE-OF-ASNOBJ: ASN1OBJ-PARAMETER}
-175 * </blockquote>
-176 * 'TYPE-OF-ASN1OBJ' can be one of following symbols:
-177 * <ul>
-178 * <li>'bool' - DERBoolean</li>
-179 * <li>'int' - DERInteger</li>
-180 * <li>'bitstr' - DERBitString</li>
-181 * <li>'octstr' - DEROctetString</li>
-182 * <li>'null' - DERNull</li>
-183 * <li>'oid' - DERObjectIdentifier</li>
-184 * <li>'enum' - DEREnumerated</li>
-185 * <li>'utf8str' - DERUTF8String</li>
-186 * <li>'numstr' - DERNumericString</li>
-187 * <li>'prnstr' - DERPrintableString</li>
-188 * <li>'telstr' - DERTeletexString</li>
-189 * <li>'ia5str' - DERIA5String</li>
-190 * <li>'utctime' - DERUTCTime</li>
-191 * <li>'gentime' - DERGeneralizedTime</li>
-192 * <li>'seq' - DERSequence</li>
-193 * <li>'set' - DERSet</li>
-194 * <li>'tag' - DERTaggedObject</li>
-195 * </ul>
-196 * @example
-197 * newObject({'prnstr': 'aaa'});
-198 * newObject({'seq': [{'int': 3}, {'prnstr': 'aaa'}]})
-199 * // ASN.1 Tagged Object
-200 * newObject({'tag': {'tag': 'a1',
-201 * 'explicit': true,
-202 * 'obj': {'seq': [{'int': 3}, {'prnstr': 'aaa'}]}}});
-203 * // more simple representation of ASN.1 Tagged Object
-204 * newObject({'tag': ['a1',
-205 * true,
-206 * {'seq': [
-207 * {'int': 3},
-208 * {'prnstr': 'aaa'}]}
-209 * ]});
-210 */
-211 this.newObject = function ( param ) {
-212 var ns1 = KJUR.asn1 ;
-213 var keys = Object.keys ( param ) ;
-214 if ( keys.length != 1 )
-215 throw "key of param shall be only one." ;
-216 var key = keys [ 0 ] ;
-217
-218 if ( ":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:" . indexOf ( ":" + key + ":" ) == - 1 )
-219 throw "undefined key: " + key ;
-220
-221 if ( key == "bool" ) return new ns1.DERBoolean ( param [ key ] ) ;
-222 if ( key == "int" ) return new ns1.DERInteger ( param [ key ] ) ;
-223 if ( key == "bitstr" ) return new ns1.DERBitString ( param [ key ] ) ;
-224 if ( key == "octstr" ) return new ns1.DEROctetString ( param [ key ] ) ;
-225 if ( key == "null" ) return new ns1.DERNull ( param [ key ] ) ;
-226 if ( key == "oid" ) return new ns1.DERObjectIdentifier ( param [ key ] ) ;
-227 if ( key == "enum" ) return new ns1.DEREnumerated ( param [ key ] ) ;
-228 if ( key == "utf8str" ) return new ns1.DERUTF8String ( param [ key ] ) ;
-229 if ( key == "numstr" ) return new ns1.DERNumericString ( param [ key ] ) ;
-230 if ( key == "prnstr" ) return new ns1.DERPrintableString ( param [ key ] ) ;
-231 if ( key == "telstr" ) return new ns1.DERTeletexString ( param [ key ] ) ;
-232 if ( key == "ia5str" ) return new ns1.DERIA5String ( param [ key ] ) ;
-233 if ( key == "utctime" ) return new ns1.DERUTCTime ( param [ key ] ) ;
-234 if ( key == "gentime" ) return new ns1.DERGeneralizedTime ( param [ key ] ) ;
-235
-236 if ( key == "seq" ) {
-237 var paramList = param [ key ] ;
-238 var a = [ ] ;
-239 for ( var i = 0 ; i < paramList.length ; i ++ ) {
-240 var asn1Obj = ns1.ASN1Util.newObject ( paramList [ i ] ) ;
-241 a.push ( asn1Obj ) ;
-242 }
-243 return new ns1.DERSequence ( { 'array' : a } ) ;
-244 }
-245
-246 if ( key == "set" ) {
-247 var paramList = param [ key ] ;
-248 var a = [ ] ;
-249 for ( var i = 0 ; i < paramList.length ; i ++ ) {
-250 var asn1Obj = ns1.ASN1Util.newObject ( paramList [ i ] ) ;
-251 a.push ( asn1Obj ) ;
-252 }
-253 return new ns1.DERSet ( { 'array' : a } ) ;
-254 }
-255
-256 if ( key == "tag" ) {
-257 var tagParam = param [ key ] ;
-258 if ( Object.prototype.toString.call ( tagParam ) === '[object Array]' &&
-259 tagParam.length == 3 ) {
-260 var obj = ns1.ASN1Util.newObject ( tagParam [ 2 ] ) ;
-261 return new ns1.DERTaggedObject ( { tag : tagParam [ 0 ] , explicit : tagParam [ 1 ] , obj : obj } ) ;
-262 } else {
-263 var newParam = { } ;
-264 if ( tagParam.explicit !== undefined )
-265 newParam.explicit = tagParam.explicit ;
-266 if ( tagParam.tag !== undefined )
-267 newParam.tag = tagParam.tag ;
-268 if ( tagParam.obj === undefined )
-269 throw "obj shall be specified for 'tag'." ;
-270 newParam.obj = ns1.ASN1Util.newObject ( tagParam.obj ) ;
-271 return new ns1.DERTaggedObject ( newParam ) ;
-272 }
-273 }
-274 } ;
-275
-276 /**
-277 * get encoded hexadecimal string of ASN1Object specifed by JSON parameters
-278 * @name jsonToASN1HEX
-279 * @memberOf KJUR.asn1.ASN1Util
-280 * @function
-281 * @param {Array} param JSON parameter to generate ASN1Object
-282 * @return hexadecimal string of ASN1Object
-283 * @since asn1 1.0.4
-284 * @description
-285 * As for ASN.1 object representation of JSON object,
-286 * please see {@link newObject}.
-287 * @example
-288 * jsonToASN1HEX({'prnstr': 'aaa'});
-289 */
-290 this.jsonToASN1HEX = function ( param ) {
-291 var asn1Obj = this.newObject ( param ) ;
-292 return asn1Obj.getEncodedHex ( ) ;
-293 } ;
-294 } ;
-295
-296 /**
-297 * get dot noted oid number string from hexadecimal value of OID
-298 * @name oidHexToInt
-299 * @memberOf KJUR.asn1.ASN1Util
-300 * @function
-301 * @param {String} hex hexadecimal value of object identifier
-302 * @return {String} dot noted string of object identifier
-303 * @since jsrsasign 4.8.3 asn1 1.0.7
-304 * @description
-305 * This static method converts from hexadecimal string representation of
-306 * ASN.1 value of object identifier to oid number string.
-307 * @example
-308 * KJUR.asn1.ASN1Util.oidHexToInt('550406') → "2.5.4.6"
-309 */
-310 KJUR.asn1.ASN1Util.oidHexToInt = function ( hex ) {
-311 var s = "" ;
-312 var i01 = parseInt ( hex.substr ( 0 , 2 ) , 16 ) ;
-313 var i0 = Math.floor ( i01 / 40 ) ;
-314 var i1 = i01 % 40 ;
-315 var s = i0 + "." + i1 ;
-316
-317 var binbuf = "" ;
-318 for ( var i = 2 ; i < hex.length ; i + = 2 ) {
-319 var value = parseInt ( hex.substr ( i , 2 ) , 16 ) ;
-320 var bin = ( "00000000" + value.toString ( 2 ) ) . slice ( - 8 ) ;
-321 binbuf = binbuf + bin.substr ( 1 , 7 ) ;
-322 if ( bin.substr ( 0 , 1 ) == "0" ) {
-323 var bi = new BigInteger ( binbuf , 2 ) ;
-324 s = s + "." + bi.toString ( 10 ) ;
-325 binbuf = "" ;
-326 }
-327 } ;
-328
-329 return s ;
-330 } ;
-331
-332 /**
-333 * get hexadecimal value of object identifier from dot noted oid value
-334 * @name oidIntToHex
-335 * @memberOf KJUR.asn1.ASN1Util
-336 * @function
-337 * @param {String} oidString dot noted string of object identifier
-338 * @return {String} hexadecimal value of object identifier
-339 * @since jsrsasign 4.8.3 asn1 1.0.7
-340 * @description
-341 * This static method converts from object identifier value string.
-342 * to hexadecimal string representation of it.
-343 * @example
-344 * KJUR.asn1.ASN1Util.oidIntToHex("2.5.4.6") → "550406"
-345 */
-346 KJUR.asn1.ASN1Util.oidIntToHex = function ( oidString ) {
-347 var itox = function ( i ) {
-348 var h = i.toString ( 16 ) ;
-349 if ( h.length == 1 ) h = '0' + h ;
-350 return h ;
-351 } ;
-352
-353 var roidtox = function ( roid ) {
-354 var h = '' ;
-355 var bi = new BigInteger ( roid , 10 ) ;
-356 var b = bi.toString ( 2 ) ;
-357 var padLen = 7 - b.length % 7 ;
-358 if ( padLen == 7 ) padLen = 0 ;
-359 var bPad = '' ;
-360 for ( var i = 0 ; i < padLen ; i ++ ) bPad + = '0' ;
-361 b = bPad + b ;
-362 for ( var i = 0 ; i < b.length - 1 ; i + = 7 ) {
-363 var b8 = b.substr ( i , 7 ) ;
-364 if ( i != b.length - 7 ) b8 = '1' + b8 ;
-365 h + = itox ( parseInt ( b8 , 2 ) ) ;
-366 }
-367 return h ;
-368 } ;
-369
-370 if ( ! oidString.match ( /^[0-9.]+$/ ) ) {
-371 throw "malformed oid string: " + oidString ;
-372 }
-373 var h = '' ;
-374 var a = oidString.split ( '.' ) ;
-375 var i0 = parseInt ( a [ 0 ] ) * 40 + parseInt ( a [ 1 ] ) ;
-376 h + = itox ( i0 ) ;
-377 a.splice ( 0 , 2 ) ;
-378 for ( var i = 0 ; i < a.length ; i ++ ) {
-379 h + = roidtox ( a [ i ] ) ;
-380 }
-381 return h ;
-382 } ;
-383
-384
-385 // ********************************************************************
-386 // Abstract ASN.1 Classes
-387 // ********************************************************************
-388
-389 // ********************************************************************
-390
-391 /**
-392 * base class for ASN.1 DER encoder object
-393 * @name KJUR.asn1.ASN1Object
-394 * @class base class for ASN.1 DER encoder object
-395 * @property {Boolean} isModified flag whether internal data was changed
-396 * @property {String} hTLV hexadecimal string of ASN.1 TLV
-397 * @property {String} hT hexadecimal string of ASN.1 TLV tag(T)
-398 * @property {String} hL hexadecimal string of ASN.1 TLV length(L)
-399 * @property {String} hV hexadecimal string of ASN.1 TLV value(V)
-400 * @description
-401 */
-402 KJUR.asn1.ASN1Object = function ( ) {
-403 var isModified = true ;
-404 var hTLV = null ;
-405 var hT = '00' ;
-406 var hL = '00' ;
-407 var hV = '' ;
-408
-409 /**
-410 * get hexadecimal ASN.1 TLV length(L) bytes from TLV value(V)
-411 * @name getLengthHexFromValue
-412 * @memberOf KJUR.asn1.ASN1Object
-413 * @function
-414 * @return {String} hexadecimal string of ASN.1 TLV length(L)
-415 */
-416 this.getLengthHexFromValue = function ( ) {
-417 if ( typeof this.hV == "undefined" || this.hV == null ) {
-418 throw "this.hV is null or undefined." ;
-419 }
-420 if ( this.hV.length % 2 == 1 ) {
-421 throw "value hex must be even length: n=" + hV.length + ",v=" + this.hV ;
-422 }
-423 var n = this.hV.length / 2 ;
-424 var hN = n.toString ( 16 ) ;
-425 if ( hN.length % 2 == 1 ) {
-426 hN = "0" + hN ;
-427 }
-428 if ( n < 128 ) {
-429 return hN ;
-430 } else {
-431 var hNlen = hN.length / 2 ;
-432 if ( hNlen > 15 ) {
-433 throw "ASN.1 length too long to represent by 8x: n = " + n.toString ( 16 ) ;
-434 }
-435 var head = 128 + hNlen ;
-436 return head.toString ( 16 ) + hN ;
-437 }
-438 } ;
-439
-440 /**
-441 * get hexadecimal string of ASN.1 TLV bytes
-442 * @name getEncodedHex
-443 * @memberOf KJUR.asn1.ASN1Object
-444 * @function
-445 * @return {String} hexadecimal string of ASN.1 TLV
-446 */
-447 this.getEncodedHex = function ( ) {
-448 if ( this.hTLV == null || this.isModified ) {
-449 this.hV = this.getFreshValueHex ( ) ;
-450 this.hL = this.getLengthHexFromValue ( ) ;
-451 this.hTLV = this.hT + this.hL + this.hV ;
-452 this.isModified = false ;
-453 //alert("first time: " + this.hTLV);
-454 }
-455 return this.hTLV ;
-456 } ;
-457
-458 /**
-459 * get hexadecimal string of ASN.1 TLV value(V) bytes
-460 * @name getValueHex
-461 * @memberOf KJUR.asn1.ASN1Object
-462 * @function
-463 * @return {String} hexadecimal string of ASN.1 TLV value(V) bytes
-464 */
-465 this.getValueHex = function ( ) {
-466 this.getEncodedHex ( ) ;
-467 return this.hV ;
-468 }
-469
-470 this.getFreshValueHex = function ( ) {
-471 return '' ;
-472 } ;
-473 } ;
-474
-475 // == BEGIN DERAbstractString ================================================
-476 /**
-477 * base class for ASN.1 DER string classes
-478 * @name KJUR.asn1.DERAbstractString
-479 * @class base class for ASN.1 DER string classes
-480 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})
-481 * @property {String} s internal string of value
-482 * @extends KJUR.asn1.ASN1Object
-483 * @description
-484 * <br/>
-485 * As for argument 'params' for constructor, you can specify one of
-486 * following properties:
-487 * <ul>
-488 * <li>str - specify initial ASN.1 value(V) by a string</li>
-489 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li>
-490 * </ul>
-491 * NOTE: 'params' can be omitted.
-492 */
-493 KJUR.asn1.DERAbstractString = function ( params ) {
-494 KJUR.asn1.DERAbstractString.superclass.constructor.call ( this ) ;
-495 var s = null ;
-496 var hV = null ;
-497
-498 /**
-499 * get string value of this string object
-500 * @name getString
-501 * @memberOf KJUR.asn1.DERAbstractString
-502 * @function
-503 * @return {String} string value of this string object
-504 */
-505 this.getString = function ( ) {
-506 return this.s ;
-507 } ;
-508
-509 /**
-510 * set value by a string
-511 * @name setString
-512 * @memberOf KJUR.asn1.DERAbstractString
-513 * @function
-514 * @param {String} newS value by a string to set
-515 */
-516 this.setString = function ( newS ) {
-517 this.hTLV = null ;
-518 this.isModified = true ;
-519 this.s = newS ;
-520 this.hV = stohex ( this.s ) ;
-521 } ;
-522
-523 /**
-524 * set value by a hexadecimal string
-525 * @name setStringHex
-526 * @memberOf KJUR.asn1.DERAbstractString
-527 * @function
-528 * @param {String} newHexString value by a hexadecimal string to set
-529 */
-530 this.setStringHex = function ( newHexString ) {
-531 this.hTLV = null ;
-532 this.isModified = true ;
-533 this.s = null ;
-534 this.hV = newHexString ;
-535 } ;
-536
-537 this.getFreshValueHex = function ( ) {
-538 return this.hV ;
-539 } ;
-540
-541 if ( typeof params != "undefined" ) {
-542 if ( typeof params == "string" ) {
-543 this.setString ( params ) ;
-544 } else if ( typeof params [ 'str' ] != "undefined" ) {
-545 this.setString ( params [ 'str' ] ) ;
-546 } else if ( typeof params [ 'hex' ] != "undefined" ) {
-547 this.setStringHex ( params [ 'hex' ] ) ;
-548 }
-549 }
-550 } ;
-551 YAHOO.lang.extend ( KJUR.asn1.DERAbstractString , KJUR.asn1.ASN1Object ) ;
-552 // == END DERAbstractString ================================================
-553
-554 // == BEGIN DERAbstractTime ==================================================
-555 /**
-556 * base class for ASN.1 DER Generalized/UTCTime class
-557 * @name KJUR.asn1.DERAbstractTime
-558 * @class base class for ASN.1 DER Generalized/UTCTime class
-559 * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'})
-560 * @extends KJUR.asn1.ASN1Object
-561 * @description
-562 * @see KJUR.asn1.ASN1Object - superclass
-563 */
-564 KJUR.asn1.DERAbstractTime = function ( params ) {
-565 KJUR.asn1.DERAbstractTime.superclass.constructor.call ( this ) ;
-566 var s = null ;
-567 var date = null ;
-568
-569 // --- PRIVATE METHODS --------------------
-570 this.localDateToUTC = function ( d ) {
-571 utc = d.getTime ( ) + ( d.getTimezoneOffset ( ) * 60000 ) ;
-572 var utcDate = new Date ( utc ) ;
-573 return utcDate ;
-574 } ;
-575
-576 /*
-577 * format date string by Data object
-578 * @name formatDate
-579 * @memberOf KJUR.asn1.AbstractTime;
-580 * @param {Date} dateObject
-581 * @param {string} type 'utc' or 'gen'
-582 * @param {boolean} withMillis flag for with millisections or not
-583 * @description
-584 * 'withMillis' flag is supported from asn1 1.0.6.
-585 */
-586 this.formatDate = function ( dateObject , type , withMillis ) {
-587 var pad = this.zeroPadding ;
-588 var d = this.localDateToUTC ( dateObject ) ;
-589 var year = String ( d.getFullYear ( ) ) ;
-590 if ( type == 'utc' ) year = year.substr ( 2 , 2 ) ;
-591 var month = pad ( String ( d.getMonth ( ) + 1 ) , 2 ) ;
-592 var day = pad ( String ( d.getDate ( ) ) , 2 ) ;
-593 var hour = pad ( String ( d.getHours ( ) ) , 2 ) ;
-594 var min = pad ( String ( d.getMinutes ( ) ) , 2 ) ;
-595 var sec = pad ( String ( d.getSeconds ( ) ) , 2 ) ;
-596 var s = year + month + day + hour + min + sec ;
-597 if ( withMillis === true ) {
-598 var millis = d.getMilliseconds ( ) ;
-599 if ( millis != 0 ) {
-600 var sMillis = pad ( String ( millis ) , 3 ) ;
-601 sMillis = sMillis.replace ( /[0]+$/ , "" ) ;
-602 s = s + "." + sMillis ;
-603 }
-604 }
-605 return s + "Z" ;
-606 } ;
-607
-608 this.zeroPadding = function ( s , len ) {
-609 if ( s.length >= len ) return s ;
-610 return new Array ( len - s.length + 1 ) . join ( '0' ) + s ;
-611 } ;
-612
-613 // --- PUBLIC METHODS --------------------
-614 /**
-615 * get string value of this string object
-616 * @name getString
-617 * @memberOf KJUR.asn1.DERAbstractTime
-618 * @function
-619 * @return {String} string value of this time object
-620 */
-621 this.getString = function ( ) {
-622 return this.s ;
-623 } ;
-624
-625 /**
-626 * set value by a string
-627 * @name setString
-628 * @memberOf KJUR.asn1.DERAbstractTime
-629 * @function
-630 * @param {String} newS value by a string to set such like "130430235959Z"
-631 */
-632 this.setString = function ( newS ) {
-633 this.hTLV = null ;
-634 this.isModified = true ;
-635 this.s = newS ;
-636 this.hV = stohex ( newS ) ;
-637 } ;
-638
-639 /**
-640 * set value by a Date object
-641 * @name setByDateValue
-642 * @memberOf KJUR.asn1.DERAbstractTime
-643 * @function
-644 * @param {Integer} year year of date (ex. 2013)
-645 * @param {Integer} month month of date between 1 and 12 (ex. 12)
-646 * @param {Integer} day day of month
-647 * @param {Integer} hour hours of date
-648 * @param {Integer} min minutes of date
-649 * @param {Integer} sec seconds of date
-650 */
-651 this.setByDateValue = function ( year , month , day , hour , min , sec ) {
-652 var dateObject = new Date ( Date.UTC ( year , month - 1 , day , hour , min , sec , 0 ) ) ;
-653 this.setByDate ( dateObject ) ;
-654 } ;
-655
-656 this.getFreshValueHex = function ( ) {
-657 return this.hV ;
-658 } ;
-659 } ;
-660 YAHOO.lang.extend ( KJUR.asn1.DERAbstractTime , KJUR.asn1.ASN1Object ) ;
-661 // == END DERAbstractTime ==================================================
-662
-663 // == BEGIN DERAbstractStructured ============================================
-664 /**
-665 * base class for ASN.1 DER structured class
-666 * @name KJUR.asn1.DERAbstractStructured
-667 * @class base class for ASN.1 DER structured class
-668 * @property {Array} asn1Array internal array of ASN1Object
-669 * @extends KJUR.asn1.ASN1Object
-670 * @description
-671 * @see KJUR.asn1.ASN1Object - superclass
-672 */
-673 KJUR.asn1.DERAbstractStructured = function ( params ) {
-674 KJUR.asn1.DERAbstractString.superclass.constructor.call ( this ) ;
-675 var asn1Array = null ;
-676
-677 /**
-678 * set value by array of ASN1Object
-679 * @name setByASN1ObjectArray
-680 * @memberOf KJUR.asn1.DERAbstractStructured
-681 * @function
-682 * @param {array} asn1ObjectArray array of ASN1Object to set
-683 */
-684 this.setByASN1ObjectArray = function ( asn1ObjectArray ) {
-685 this.hTLV = null ;
-686 this.isModified = true ;
-687 this.asn1Array = asn1ObjectArray ;
-688 } ;
-689
-690 /**
-691 * append an ASN1Object to internal array
-692 * @name appendASN1Object
-693 * @memberOf KJUR.asn1.DERAbstractStructured
-694 * @function
-695 * @param {ASN1Object} asn1Object to add
-696 */
-697 this.appendASN1Object = function ( asn1Object ) {
-698 this.hTLV = null ;
-699 this.isModified = true ;
-700 this.asn1Array.push ( asn1Object ) ;
-701 } ;
-702
-703 this.asn1Array = new Array ( ) ;
-704 if ( typeof params != "undefined" ) {
-705 if ( typeof params [ 'array' ] != "undefined" ) {
-706 this.asn1Array = params [ 'array' ] ;
-707 }
-708 }
-709 } ;
-710 YAHOO.lang.extend ( KJUR.asn1.DERAbstractStructured , KJUR.asn1.ASN1Object ) ;
-711
-712
-713 // ********************************************************************
-714 // ASN.1 Object Classes
-715 // ********************************************************************
-716
-717 // ********************************************************************
-718 /**
-719 * class for ASN.1 DER Boolean
-720 * @name KJUR.asn1.DERBoolean
-721 * @class class for ASN.1 DER Boolean
-722 * @extends KJUR.asn1.ASN1Object
-723 * @description
-724 * @see KJUR.asn1.ASN1Object - superclass
-725 */
-726 KJUR.asn1.DERBoolean = function ( ) {
-727 KJUR.asn1.DERBoolean.superclass.constructor.call ( this ) ;
-728 this.hT = "01" ;
-729 this.hTLV = "0101ff" ;
-730 } ;
-731 YAHOO.lang.extend ( KJUR.asn1.DERBoolean , KJUR.asn1.ASN1Object ) ;
-732
-733 // ********************************************************************
-734 /**
-735 * class for ASN.1 DER Integer
-736 * @name KJUR.asn1.DERInteger
-737 * @class class for ASN.1 DER Integer
-738 * @extends KJUR.asn1.ASN1Object
-739 * @description
-740 * <br/>
-741 * As for argument 'params' for constructor, you can specify one of
-742 * following properties:
-743 * <ul>
-744 * <li>int - specify initial ASN.1 value(V) by integer value</li>
-745 * <li>bigint - specify initial ASN.1 value(V) by BigInteger object</li>
-746 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li>
-747 * </ul>
-748 * NOTE: 'params' can be omitted.
-749 */
-750 KJUR.asn1.DERInteger = function ( params ) {
-751 KJUR.asn1.DERInteger.superclass.constructor.call ( this ) ;
-752 this.hT = "02" ;
-753
-754 /**
-755 * set value by Tom Wu's BigInteger object
-756 * @name setByBigInteger
-757 * @memberOf KJUR.asn1.DERInteger
-758 * @function
-759 * @param {BigInteger} bigIntegerValue to set
-760 */
-761 this.setByBigInteger = function ( bigIntegerValue ) {
-762 this.hTLV = null ;
-763 this.isModified = true ;
-764 this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex ( bigIntegerValue ) ;
-765 } ;
-766
-767 /**
-768 * set value by integer value
-769 * @name setByInteger
-770 * @memberOf KJUR.asn1.DERInteger
-771 * @function
-772 * @param {Integer} integer value to set
-773 */
-774 this.setByInteger = function ( intValue ) {
-775 var bi = new BigInteger ( String ( intValue ) , 10 ) ;
-776 this.setByBigInteger ( bi ) ;
-777 } ;
-778
-779 /**
-780 * set value by integer value
-781 * @name setValueHex
-782 * @memberOf KJUR.asn1.DERInteger
-783 * @function
-784 * @param {String} hexadecimal string of integer value
-785 * @description
-786 * <br/>
-787 * NOTE: Value shall be represented by minimum octet length of
-788 * two's complement representation.
-789 * @example
-790 * new KJUR.asn1.DERInteger(123);
-791 * new KJUR.asn1.DERInteger({'int': 123});
-792 * new KJUR.asn1.DERInteger({'hex': '1fad'});
-793 */
-794 this.setValueHex = function ( newHexString ) {
-795 this.hV = newHexString ;
-796 } ;
-797
-798 this.getFreshValueHex = function ( ) {
-799 return this.hV ;
-800 } ;
-801
-802 if ( typeof params != "undefined" ) {
-803 if ( typeof params [ 'bigint' ] != "undefined" ) {
-804 this.setByBigInteger ( params [ 'bigint' ] ) ;
-805 } else if ( typeof params [ 'int' ] != "undefined" ) {
-806 this.setByInteger ( params [ 'int' ] ) ;
-807 } else if ( typeof params == "number" ) {
-808 this.setByInteger ( params ) ;
-809 } else if ( typeof params [ 'hex' ] != "undefined" ) {
-810 this.setValueHex ( params [ 'hex' ] ) ;
-811 }
-812 }
-813 } ;
-814 YAHOO.lang.extend ( KJUR.asn1.DERInteger , KJUR.asn1.ASN1Object ) ;
-815
-816 // ********************************************************************
-817 /**
-818 * class for ASN.1 DER encoded BitString primitive
-819 * @name KJUR.asn1.DERBitString
-820 * @class class for ASN.1 DER encoded BitString primitive
-821 * @extends KJUR.asn1.ASN1Object
-822 * @description
-823 * <br/>
-824 * As for argument 'params' for constructor, you can specify one of
-825 * following properties:
-826 * <ul>
-827 * <li>bin - specify binary string (ex. '10111')</li>
-828 * <li>array - specify array of boolean (ex. [true,false,true,true])</li>
-829 * <li>hex - specify hexadecimal string of ASN.1 value(V) including unused bits</li>
-830 * </ul>
-831 * NOTE: 'params' can be omitted.
-832 */
-833 KJUR.asn1.DERBitString = function ( params ) {
-834 KJUR.asn1.DERBitString.superclass.constructor.call ( this ) ;
-835 this.hT = "03" ;
-836
-837 /**
-838 * set ASN.1 value(V) by a hexadecimal string including unused bits
-839 * @name setHexValueIncludingUnusedBits
-840 * @memberOf KJUR.asn1.DERBitString
-841 * @function
-842 * @param {String} newHexStringIncludingUnusedBits
-843 */
-844 this.setHexValueIncludingUnusedBits = function ( newHexStringIncludingUnusedBits ) {
-845 this.hTLV = null ;
-846 this.isModified = true ;
-847 this.hV = newHexStringIncludingUnusedBits ;
-848 } ;
-849
-850 /**
-851 * set ASN.1 value(V) by unused bit and hexadecimal string of value
-852 * @name setUnusedBitsAndHexValue
-853 * @memberOf KJUR.asn1.DERBitString
-854 * @function
-855 * @param {Integer} unusedBits
-856 * @param {String} hValue
-857 */
-858 this.setUnusedBitsAndHexValue = function ( unusedBits , hValue ) {
-859 if ( unusedBits < 0 || 7 < unusedBits ) {
-860 throw "unused bits shall be from 0 to 7: u = " + unusedBits ;
-861 }
-862 var hUnusedBits = "0" + unusedBits ;
-863 this.hTLV = null ;
-864 this.isModified = true ;
-865 this.hV = hUnusedBits + hValue ;
-866 } ;
-867
-868 /**
-869 * set ASN.1 DER BitString by binary string
-870 * @name setByBinaryString
-871 * @memberOf KJUR.asn1.DERBitString
-872 * @function
-873 * @param {String} binaryString binary value string (i.e. '10111')
-874 * @description
-875 * Its unused bits will be calculated automatically by length of
-876 * 'binaryValue'. <br/>
-877 * NOTE: Trailing zeros '0' will be ignored.
-878 */
-879 this.setByBinaryString = function ( binaryString ) {
-880 binaryString = binaryString.replace ( /0+$/ , '' ) ;
-881 var unusedBits = 8 - binaryString.length % 8 ;
-882 if ( unusedBits == 8 ) unusedBits = 0 ;
-883 for ( var i = 0 ; i <= unusedBits ; i ++ ) {
-884 binaryString + = '0' ;
-885 }
-886 var h = '' ;
-887 for ( var i = 0 ; i < binaryString.length - 1 ; i + = 8 ) {
-888 var b = binaryString.substr ( i , 8 ) ;
-889 var x = parseInt ( b , 2 ) . toString ( 16 ) ;
-890 if ( x.length == 1 ) x = '0' + x ;
-891 h + = x ;
-892 }
-893 this.hTLV = null ;
-894 this.isModified = true ;
-895 this.hV = '0' + unusedBits + h ;
-896 } ;
-897
-898 /**
-899 * set ASN.1 TLV value(V) by an array of boolean
-900 * @name setByBooleanArray
-901 * @memberOf KJUR.asn1.DERBitString
-902 * @function
-903 * @param {array} booleanArray array of boolean (ex. [true, false, true])
-904 * @description
-905 * NOTE: Trailing falses will be ignored.
-906 */
-907 this.setByBooleanArray = function ( booleanArray ) {
-908 var s = '' ;
-909 for ( var i = 0 ; i < booleanArray.length ; i ++ ) {
-910 if ( booleanArray [ i ] == true ) {
-911 s + = '1' ;
-912 } else {
-913 s + = '0' ;
-914 }
-915 }
-916 this.setByBinaryString ( s ) ;
-917 } ;
-918
-919 /**
-920 * generate an array of false with specified length
-921 * @name newFalseArray
-922 * @memberOf KJUR.asn1.DERBitString
-923 * @function
-924 * @param {Integer} nLength length of array to generate
-925 * @return {array} array of boolean faluse
-926 * @description
-927 * This static method may be useful to initialize boolean array.
-928 */
-929 this.newFalseArray = function ( nLength ) {
-930 var a = new Array ( nLength ) ;
-931 for ( var i = 0 ; i < nLength ; i ++ ) {
-932 a [ i ] = false ;
-933 }
-934 return a ;
-935 } ;
-936
-937 this.getFreshValueHex = function ( ) {
-938 return this.hV ;
-939 } ;
-940
-941 if ( typeof params != "undefined" ) {
-942 if ( typeof params == "string" && params.toLowerCase ( ) . match ( /^[0-9a-f]+$/ ) ) {
-943 this.setHexValueIncludingUnusedBits ( params ) ;
-944 } else if ( typeof params [ 'hex' ] != "undefined" ) {
-945 this.setHexValueIncludingUnusedBits ( params [ 'hex' ] ) ;
-946 } else if ( typeof params [ 'bin' ] != "undefined" ) {
-947 this.setByBinaryString ( params [ 'bin' ] ) ;
-948 } else if ( typeof params [ 'array' ] != "undefined" ) {
-949 this.setByBooleanArray ( params [ 'array' ] ) ;
-950 }
-951 }
-952 } ;
-953 YAHOO.lang.extend ( KJUR.asn1.DERBitString , KJUR.asn1.ASN1Object ) ;
-954
-955 // ********************************************************************
-956 /**
-957 * class for ASN.1 DER OctetString
-958 * @name KJUR.asn1.DEROctetString
-959 * @class class for ASN.1 DER OctetString
-960 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})
-961 * @extends KJUR.asn1.DERAbstractString
-962 * @description
-963 * @see KJUR.asn1.DERAbstractString - superclass
-964 */
-965 KJUR.asn1.DEROctetString = function ( params ) {
-966 KJUR.asn1.DEROctetString.superclass.constructor.call ( this , params ) ;
-967 this.hT = "04" ;
-968 } ;
-969 YAHOO.lang.extend ( KJUR.asn1.DEROctetString , KJUR.asn1.DERAbstractString ) ;
-970
-971 // ********************************************************************
-972 /**
-973 * class for ASN.1 DER Null
-974 * @name KJUR.asn1.DERNull
-975 * @class class for ASN.1 DER Null
-976 * @extends KJUR.asn1.ASN1Object
-977 * @description
-978 * @see KJUR.asn1.ASN1Object - superclass
-979 */
-980 KJUR.asn1.DERNull = function ( ) {
-981 KJUR.asn1.DERNull.superclass.constructor.call ( this ) ;
-982 this.hT = "05" ;
-983 this.hTLV = "0500" ;
-984 } ;
-985 YAHOO.lang.extend ( KJUR.asn1.DERNull , KJUR.asn1.ASN1Object ) ;
-986
-987 // ********************************************************************
-988 /**
-989 * class for ASN.1 DER ObjectIdentifier
-990 * @name KJUR.asn1.DERObjectIdentifier
-991 * @class class for ASN.1 DER ObjectIdentifier
-992 * @param {Array} params associative array of parameters (ex. {'oid': '2.5.4.5'})
-993 * @extends KJUR.asn1.ASN1Object
-994 * @description
-995 * <br/>
-996 * As for argument 'params' for constructor, you can specify one of
-997 * following properties:
-998 * <ul>
-999 * <li>oid - specify initial ASN.1 value(V) by a oid string (ex. 2.5.4.13)</li>
-1000 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li>
-1001 * </ul>
-1002 * NOTE: 'params' can be omitted.
-1003 */
-1004 KJUR.asn1.DERObjectIdentifier = function ( params ) {
-1005 var itox = function ( i ) {
-1006 var h = i.toString ( 16 ) ;
-1007 if ( h.length == 1 ) h = '0' + h ;
-1008 return h ;
-1009 } ;
-1010 var roidtox = function ( roid ) {
-1011 var h = '' ;
-1012 var bi = new BigInteger ( roid , 10 ) ;
-1013 var b = bi.toString ( 2 ) ;
-1014 var padLen = 7 - b.length % 7 ;
-1015 if ( padLen == 7 ) padLen = 0 ;
-1016 var bPad = '' ;
-1017 for ( var i = 0 ; i < padLen ; i ++ ) bPad + = '0' ;
-1018 b = bPad + b ;
-1019 for ( var i = 0 ; i < b.length - 1 ; i + = 7 ) {
-1020 var b8 = b.substr ( i , 7 ) ;
-1021 if ( i != b.length - 7 ) b8 = '1' + b8 ;
-1022 h + = itox ( parseInt ( b8 , 2 ) ) ;
-1023 }
-1024 return h ;
-1025 }
-1026
-1027 KJUR.asn1.DERObjectIdentifier.superclass.constructor.call ( this ) ;
-1028 this.hT = "06" ;
-1029
-1030 /**
-1031 * set value by a hexadecimal string
-1032 * @name setValueHex
-1033 * @memberOf KJUR.asn1.DERObjectIdentifier
-1034 * @function
-1035 * @param {String} newHexString hexadecimal value of OID bytes
-1036 */
-1037 this.setValueHex = function ( newHexString ) {
-1038 this.hTLV = null ;
-1039 this.isModified = true ;
-1040 this.s = null ;
-1041 this.hV = newHexString ;
-1042 } ;
-1043
-1044 /**
-1045 * set value by a OID string
-1046 * @name setValueOidString
-1047 * @memberOf KJUR.asn1.DERObjectIdentifier
-1048 * @function
-1049 * @param {String} oidString OID string (ex. 2.5.4.13)
-1050 */
-1051 this.setValueOidString = function ( oidString ) {
-1052 if ( ! oidString.match ( /^[0-9.]+$/ ) ) {
-1053 throw "malformed oid string: " + oidString ;
-1054 }
-1055 var h = '' ;
-1056 var a = oidString.split ( '.' ) ;
-1057 var i0 = parseInt ( a [ 0 ] ) * 40 + parseInt ( a [ 1 ] ) ;
-1058 h + = itox ( i0 ) ;
-1059 a.splice ( 0 , 2 ) ;
-1060 for ( var i = 0 ; i < a.length ; i ++ ) {
-1061 h + = roidtox ( a [ i ] ) ;
-1062 }
-1063 this.hTLV = null ;
-1064 this.isModified = true ;
-1065 this.s = null ;
-1066 this.hV = h ;
-1067 } ;
-1068
-1069 /**
-1070 * set value by a OID name
-1071 * @name setValueName
-1072 * @memberOf KJUR.asn1.DERObjectIdentifier
-1073 * @function
-1074 * @param {String} oidName OID name (ex. 'serverAuth')
-1075 * @since 1.0.1
-1076 * @description
-1077 * OID name shall be defined in 'KJUR.asn1.x509.OID.name2oidList'.
-1078 * Otherwise raise error.
-1079 */
-1080 this.setValueName = function ( oidName ) {
-1081 if ( typeof KJUR.asn1.x509.OID.name2oidList [ oidName ] != "undefined" ) {
-1082 var oid = KJUR.asn1.x509.OID.name2oidList [ oidName ] ;
-1083 this.setValueOidString ( oid ) ;
-1084 } else {
-1085 throw "DERObjectIdentifier oidName undefined: " + oidName ;
-1086 }
-1087 } ;
-1088
-1089 this.getFreshValueHex = function ( ) {
-1090 return this.hV ;
-1091 } ;
-1092
-1093 if ( typeof params != "undefined" ) {
-1094 if ( typeof params == "string" && params.match ( /^[0-2].[0-9.]+$/ ) ) {
-1095 this.setValueOidString ( params ) ;
-1096 } else if ( KJUR.asn1.x509.OID.name2oidList [ params ] !== undefined ) {
-1097 this.setValueOidString ( KJUR.asn1.x509.OID.name2oidList [ params ] ) ;
-1098 } else if ( typeof params [ 'oid' ] != "undefined" ) {
-1099 this.setValueOidString ( params [ 'oid' ] ) ;
-1100 } else if ( typeof params [ 'hex' ] != "undefined" ) {
-1101 this.setValueHex ( params [ 'hex' ] ) ;
-1102 } else if ( typeof params [ 'name' ] != "undefined" ) {
-1103 this.setValueName ( params [ 'name' ] ) ;
-1104 }
-1105 }
-1106 } ;
-1107 YAHOO.lang.extend ( KJUR.asn1.DERObjectIdentifier , KJUR.asn1.ASN1Object ) ;
-1108
-1109 // ********************************************************************
-1110 /**
-1111 * class for ASN.1 DER Enumerated
-1112 * @name KJUR.asn1.DEREnumerated
-1113 * @class class for ASN.1 DER Enumerated
-1114 * @extends KJUR.asn1.ASN1Object
-1115 * @description
-1116 * <br/>
-1117 * As for argument 'params' for constructor, you can specify one of
-1118 * following properties:
-1119 * <ul>
-1120 * <li>int - specify initial ASN.1 value(V) by integer value</li>
-1121 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li>
-1122 * </ul>
-1123 * NOTE: 'params' can be omitted.
-1124 */
-1125 KJUR.asn1.DEREnumerated = function ( params ) {
-1126 KJUR.asn1.DEREnumerated.superclass.constructor.call ( this ) ;
-1127 this.hT = "0a" ;
-1128
-1129 /**
-1130 * set value by Tom Wu's BigInteger object
-1131 * @name setByBigInteger
-1132 * @memberOf KJUR.asn1.DEREnumerated
-1133 * @function
-1134 * @param {BigInteger} bigIntegerValue to set
-1135 */
-1136 this.setByBigInteger = function ( bigIntegerValue ) {
-1137 this.hTLV = null ;
-1138 this.isModified = true ;
-1139 this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex ( bigIntegerValue ) ;
-1140 } ;
-1141
-1142 /**
-1143 * set value by integer value
-1144 * @name setByInteger
-1145 * @memberOf KJUR.asn1.DEREnumerated
-1146 * @function
-1147 * @param {Integer} integer value to set
-1148 */
-1149 this.setByInteger = function ( intValue ) {
-1150 var bi = new BigInteger ( String ( intValue ) , 10 ) ;
-1151 this.setByBigInteger ( bi ) ;
-1152 } ;
-1153
-1154 /**
-1155 * set value by integer value
-1156 * @name setValueHex
-1157 * @memberOf KJUR.asn1.DEREnumerated
-1158 * @function
-1159 * @param {String} hexadecimal string of integer value
-1160 * @description
-1161 * <br/>
-1162 * NOTE: Value shall be represented by minimum octet length of
-1163 * two's complement representation.
-1164 * @example
-1165 * new KJUR.asn1.DEREnumerated(123);
-1166 * new KJUR.asn1.DEREnumerated({'int': 123});
-1167 * new KJUR.asn1.DEREnumerated({'hex': '1fad'});
-1168 */
-1169 this.setValueHex = function ( newHexString ) {
-1170 this.hV = newHexString ;
-1171 } ;
-1172
-1173 this.getFreshValueHex = function ( ) {
-1174 return this.hV ;
-1175 } ;
-1176
-1177 if ( typeof params != "undefined" ) {
-1178 if ( typeof params [ 'int' ] != "undefined" ) {
-1179 this.setByInteger ( params [ 'int' ] ) ;
-1180 } else if ( typeof params == "number" ) {
-1181 this.setByInteger ( params ) ;
-1182 } else if ( typeof params [ 'hex' ] != "undefined" ) {
-1183 this.setValueHex ( params [ 'hex' ] ) ;
-1184 }
-1185 }
-1186 } ;
-1187 YAHOO.lang.extend ( KJUR.asn1.DEREnumerated , KJUR.asn1.ASN1Object ) ;
-1188
-1189 // ********************************************************************
-1190 /**
-1191 * class for ASN.1 DER UTF8String
-1192 * @name KJUR.asn1.DERUTF8String
-1193 * @class class for ASN.1 DER UTF8String
-1194 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})
-1195 * @extends KJUR.asn1.DERAbstractString
-1196 * @description
-1197 * @see KJUR.asn1.DERAbstractString - superclass
-1198 */
-1199 KJUR.asn1.DERUTF8String = function ( params ) {
-1200 KJUR.asn1.DERUTF8String.superclass.constructor.call ( this , params ) ;
-1201 this.hT = "0c" ;
-1202 } ;
-1203 YAHOO.lang.extend ( KJUR.asn1.DERUTF8String , KJUR.asn1.DERAbstractString ) ;
-1204
-1205 // ********************************************************************
-1206 /**
-1207 * class for ASN.1 DER NumericString
-1208 * @name KJUR.asn1.DERNumericString
-1209 * @class class for ASN.1 DER NumericString
-1210 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})
-1211 * @extends KJUR.asn1.DERAbstractString
-1212 * @description
-1213 * @see KJUR.asn1.DERAbstractString - superclass
-1214 */
-1215 KJUR.asn1.DERNumericString = function ( params ) {
-1216 KJUR.asn1.DERNumericString.superclass.constructor.call ( this , params ) ;
-1217 this.hT = "12" ;
-1218 } ;
-1219 YAHOO.lang.extend ( KJUR.asn1.DERNumericString , KJUR.asn1.DERAbstractString ) ;
-1220
-1221 // ********************************************************************
-1222 /**
-1223 * class for ASN.1 DER PrintableString
-1224 * @name KJUR.asn1.DERPrintableString
-1225 * @class class for ASN.1 DER PrintableString
-1226 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})
-1227 * @extends KJUR.asn1.DERAbstractString
-1228 * @description
-1229 * @see KJUR.asn1.DERAbstractString - superclass
-1230 */
-1231 KJUR.asn1.DERPrintableString = function ( params ) {
-1232 KJUR.asn1.DERPrintableString.superclass.constructor.call ( this , params ) ;
-1233 this.hT = "13" ;
-1234 } ;
-1235 YAHOO.lang.extend ( KJUR.asn1.DERPrintableString , KJUR.asn1.DERAbstractString ) ;
-1236
-1237 // ********************************************************************
-1238 /**
-1239 * class for ASN.1 DER TeletexString
-1240 * @name KJUR.asn1.DERTeletexString
-1241 * @class class for ASN.1 DER TeletexString
-1242 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})
-1243 * @extends KJUR.asn1.DERAbstractString
-1244 * @description
-1245 * @see KJUR.asn1.DERAbstractString - superclass
-1246 */
-1247 KJUR.asn1.DERTeletexString = function ( params ) {
-1248 KJUR.asn1.DERTeletexString.superclass.constructor.call ( this , params ) ;
-1249 this.hT = "14" ;
-1250 } ;
-1251 YAHOO.lang.extend ( KJUR.asn1.DERTeletexString , KJUR.asn1.DERAbstractString ) ;
-1252
-1253 // ********************************************************************
-1254 /**
-1255 * class for ASN.1 DER IA5String
-1256 * @name KJUR.asn1.DERIA5String
-1257 * @class class for ASN.1 DER IA5String
-1258 * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})
-1259 * @extends KJUR.asn1.DERAbstractString
-1260 * @description
-1261 * @see KJUR.asn1.DERAbstractString - superclass
-1262 */
-1263 KJUR.asn1.DERIA5String = function ( params ) {
-1264 KJUR.asn1.DERIA5String.superclass.constructor.call ( this , params ) ;
-1265 this.hT = "16" ;
-1266 } ;
-1267 YAHOO.lang.extend ( KJUR.asn1.DERIA5String , KJUR.asn1.DERAbstractString ) ;
-1268
-1269 // ********************************************************************
-1270 /**
-1271 * class for ASN.1 DER UTCTime
-1272 * @name KJUR.asn1.DERUTCTime
-1273 * @class class for ASN.1 DER UTCTime
-1274 * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'})
-1275 * @extends KJUR.asn1.DERAbstractTime
-1276 * @description
-1277 * <br/>
-1278 * As for argument 'params' for constructor, you can specify one of
-1279 * following properties:
-1280 * <ul>
-1281 * <li>str - specify initial ASN.1 value(V) by a string (ex.'130430235959Z')</li>
-1282 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li>
-1283 * <li>date - specify Date object.</li>
-1284 * </ul>
-1285 * NOTE: 'params' can be omitted.
-1286 * <h4>EXAMPLES</h4>
-1287 * @example
-1288 * var d1 = new KJUR.asn1.DERUTCTime();
-1289 * d1.setString('130430125959Z');
-1290 *
-1291 * var d2 = new KJUR.asn1.DERUTCTime({'str': '130430125959Z'});
-1292 * var d3 = new KJUR.asn1.DERUTCTime({'date': new Date(Date.UTC(2015, 0, 31, 0, 0, 0, 0))});
-1293 * var d4 = new KJUR.asn1.DERUTCTime('130430125959Z');
-1294 */
-1295 KJUR.asn1.DERUTCTime = function ( params ) {
-1296 KJUR.asn1.DERUTCTime.superclass.constructor.call ( this , params ) ;
-1297 this.hT = "17" ;
-1298
-1299 /**
-1300 * set value by a Date object
-1301 * @name setByDate
-1302 * @memberOf KJUR.asn1.DERUTCTime
-1303 * @function
-1304 * @param {Date} dateObject Date object to set ASN.1 value(V)
-1305 */
-1306 this.setByDate = function ( dateObject ) {
-1307 this.hTLV = null ;
-1308 this.isModified = true ;
-1309 this.date = dateObject ;
-1310 this.s = this.formatDate ( this.date , 'utc' ) ;
-1311 this.hV = stohex ( this.s ) ;
-1312 } ;
-1313
-1314 this.getFreshValueHex = function ( ) {
-1315 if ( typeof this.date == "undefined" && typeof this.s == "undefined" ) {
-1316 this.date = new Date ( ) ;
-1317 this.s = this.formatDate ( this.date , 'utc' ) ;
-1318 this.hV = stohex ( this.s ) ;
-1319 }
-1320 return this.hV ;
-1321 } ;
-1322
-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 ( params.hex !== undefined ) {
-1329 this.setStringHex ( params.hex ) ;
-1330 } else if ( params.date !== undefined ) {
-1331 this.setByDate ( params.date ) ;
-1332 }
-1333 }
-1334 } ;
-1335 YAHOO.lang.extend ( KJUR.asn1.DERUTCTime , KJUR.asn1.DERAbstractTime ) ;
-1336
-1337 // ********************************************************************
-1338 /**
-1339 * class for ASN.1 DER GeneralizedTime
-1340 * @name KJUR.asn1.DERGeneralizedTime
-1341 * @class class for ASN.1 DER GeneralizedTime
-1342 * @param {Array} params associative array of parameters (ex. {'str': '20130430235959Z'})
-1343 * @property {Boolean} withMillis flag to show milliseconds or not
-1344 * @extends KJUR.asn1.DERAbstractTime
-1345 * @description
-1346 * <br/>
-1347 * As for argument 'params' for constructor, you can specify one of
-1348 * following properties:
-1349 * <ul>
-1350 * <li>str - specify initial ASN.1 value(V) by a string (ex.'20130430235959Z')</li>
-1351 * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li>
-1352 * <li>date - specify Date object.</li>
-1353 * <li>millis - specify flag to show milliseconds (from 1.0.6)</li>
-1354 * </ul>
-1355 * NOTE1: 'params' can be omitted.
-1356 * NOTE2: 'withMillis' property is supported from asn1 1.0.6.
-1357 */
-1358 KJUR.asn1.DERGeneralizedTime = function ( params ) {
-1359 KJUR.asn1.DERGeneralizedTime.superclass.constructor.call ( this , params ) ;
-1360 this.hT = "18" ;
-1361 this.withMillis = false ;
-1362
-1363 /**
-1364 * set value by a Date object
-1365 * @name setByDate
-1366 * @memberOf KJUR.asn1.DERGeneralizedTime
-1367 * @function
-1368 * @param {Date} dateObject Date object to set ASN.1 value(V)
-1369 * @example
-1370 * When you specify UTC time, use 'Date.UTC' method like this:<br/>
-1371 * var o = new DERUTCTime();
-1372 * var date = new Date(Date.UTC(2015, 0, 31, 23, 59, 59, 0)); #2015JAN31 23:59:59
-1373 * o.setByDate(date);
-1374 */
-1375 this.setByDate = function ( dateObject ) {
-1376 this.hTLV = null ;
-1377 this.isModified = true ;
-1378 this.date = dateObject ;
-1379 this.s = this.formatDate ( this.date , 'gen' , this.withMillis ) ;
-1380 this.hV = stohex ( this.s ) ;
-1381 } ;
-1382
-1383 this.getFreshValueHex = function ( ) {
-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 ) ;
-1388 }
-1389 return this.hV ;
-1390 } ;
-1391
-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 ( params.hex !== undefined ) {
-1398 this.setStringHex ( params.hex ) ;
-1399 } else if ( params.date !== undefined ) {
-1400 this.setByDate ( params.date ) ;
-1401 }
-1402 if ( params.millis === true ) {
-1403 this.withMillis = true ;
-1404 }
-1405 }
-1406 } ;
-1407 YAHOO.lang.extend ( KJUR.asn1.DERGeneralizedTime , KJUR.asn1.DERAbstractTime ) ;
-1408
-1409 // ********************************************************************
-1410 /**
-1411 * class for ASN.1 DER Sequence
-1412 * @name KJUR.asn1.DERSequence
-1413 * @class class for ASN.1 DER Sequence
-1414 * @extends KJUR.asn1.DERAbstractStructured
-1415 * @description
-1416 * <br/>
-1417 * As for argument 'params' for constructor, you can specify one of
-1418 * following properties:
-1419 * <ul>
-1420 * <li>array - specify array of ASN1Object to set elements of content</li>
-1421 * </ul>
-1422 * NOTE: 'params' can be omitted.
-1423 */
-1424 KJUR.asn1.DERSequence = function ( params ) {
-1425 KJUR.asn1.DERSequence.superclass.constructor.call ( this , params ) ;
-1426 this.hT = "30" ;
-1427 this.getFreshValueHex = function ( ) {
-1428 var h = '' ;
-1429 for ( var i = 0 ; i < this.asn1Array.length ; i ++ ) {
-1430 var asn1Obj = this.asn1Array [ i ] ;
-1431 h + = asn1Obj.getEncodedHex ( ) ;
-1432 }
-1433 this.hV = h ;
-1434 return this.hV ;
-1435 } ;
-1436 } ;
-1437 YAHOO.lang.extend ( KJUR.asn1.DERSequence , KJUR.asn1.DERAbstractStructured ) ;
-1438
-1439 // ********************************************************************
-1440 /**
-1441 * class for ASN.1 DER Set
-1442 * @name KJUR.asn1.DERSet
-1443 * @class class for ASN.1 DER Set
-1444 * @extends KJUR.asn1.DERAbstractStructured
-1445 * @description
-1446 * <br/>
-1447 * As for argument 'params' for constructor, you can specify one of
-1448 * following properties:
-1449 * <ul>
-1450 * <li>array - specify array of ASN1Object to set elements of content</li>
-1451 * <li>sortflag - flag for sort (default: true). ASN.1 BER is not sorted in 'SET OF'.</li>
-1452 * </ul>
-1453 * NOTE1: 'params' can be omitted.<br/>
-1454 * NOTE2: sortflag is supported since 1.0.5.
-1455 */
-1456 KJUR.asn1.DERSet = function ( params ) {
-1457 KJUR.asn1.DERSet.superclass.constructor.call ( this , params ) ;
-1458 this.hT = "31" ;
-1459 this.sortFlag = true ; // item shall be sorted only in ASN.1 DER
-1460 this.getFreshValueHex = function ( ) {
-1461 var a = new Array ( ) ;
-1462 for ( var i = 0 ; i < this.asn1Array.length ; i ++ ) {
-1463 var asn1Obj = this.asn1Array [ i ] ;
-1464 a.push ( asn1Obj.getEncodedHex ( ) ) ;
-1465 }
-1466 if ( this.sortFlag == true ) a.sort ( ) ;
-1467 this.hV = a.join ( '' ) ;
-1468 return this.hV ;
-1469 } ;
-1470
-1471 if ( typeof params != "undefined" ) {
-1472 if ( typeof params.sortflag != "undefined" &&
-1473 params.sortflag == false )
-1474 this.sortFlag = false ;
-1475 }
-1476 } ;
-1477 YAHOO.lang.extend ( KJUR.asn1.DERSet , KJUR.asn1.DERAbstractStructured ) ;
-1478
-1479 // ********************************************************************
-1480 /**
-1481 * class for ASN.1 DER TaggedObject
-1482 * @name KJUR.asn1.DERTaggedObject
-1483 * @class class for ASN.1 DER TaggedObject
-1484 * @extends KJUR.asn1.ASN1Object
-1485 * @description
-1486 * <br/>
-1487 * Parameter 'tagNoNex' is ASN.1 tag(T) value for this object.
-1488 * For example, if you find '[1]' tag in a ASN.1 dump,
-1489 * 'tagNoHex' will be 'a1'.
-1490 * <br/>
-1491 * As for optional argument 'params' for constructor, you can specify *ANY* of
-1492 * following properties:
-1493 * <ul>
-1494 * <li>explicit - specify true if this is explicit tag otherwise false
-1495 * (default is 'true').</li>
-1496 * <li>tag - specify tag (default is 'a0' which means [0])</li>
-1497 * <li>obj - specify ASN1Object which is tagged</li>
-1498 * </ul>
-1499 * @example
-1500 * d1 = new KJUR.asn1.DERUTF8String({'str':'a'});
-1501 * d2 = new KJUR.asn1.DERTaggedObject({'obj': d1});
-1502 * hex = d2.getEncodedHex();
-1503 */
-1504 KJUR.asn1.DERTaggedObject = function ( params ) {
-1505 KJUR.asn1.DERTaggedObject.superclass.constructor.call ( this ) ;
-1506 this.hT = "a0" ;
-1507 this.hV = '' ;
-1508 this.isExplicit = true ;
-1509 this.asn1Object = null ;
-1510
-1511 /**
-1512 * set value by an ASN1Object
-1513 * @name setString
-1514 * @memberOf KJUR.asn1.DERTaggedObject
-1515 * @function
-1516 * @param {Boolean} isExplicitFlag flag for explicit/implicit tag
-1517 * @param {Integer} tagNoHex hexadecimal string of ASN.1 tag
-1518 * @param {ASN1Object} asn1Object ASN.1 to encapsulate
-1519 */
-1520 this.setASN1Object = function ( isExplicitFlag , tagNoHex , asn1Object ) {
-1521 this.hT = tagNoHex ;
-1522 this.isExplicit = isExplicitFlag ;
-1523 this.asn1Object = asn1Object ;
-1524 if ( this.isExplicit ) {
-1525 this.hV = this.asn1Object.getEncodedHex ( ) ;
-1526 this.hTLV = null ;
-1527 this.isModified = true ;
-1528 } else {
-1529 this.hV = null ;
-1530 this.hTLV = asn1Object.getEncodedHex ( ) ;
-1531 this.hTLV = this.hTLV.replace ( /^../ , tagNoHex ) ;
-1532 this.isModified = false ;
-1533 }
-1534 } ;
-1535
-1536 this.getFreshValueHex = function ( ) {
-1537 return this.hV ;
-1538 } ;
-1539
-1540 if ( typeof params != "undefined" ) {
-1541 if ( typeof params [ 'tag' ] != "undefined" ) {
-1542 this.hT = params [ 'tag' ] ;
-1543 }
-1544 if ( typeof params [ 'explicit' ] != "undefined" ) {
-1545 this.isExplicit = params [ 'explicit' ] ;
-1546 }
-1547 if ( typeof params [ 'obj' ] != "undefined" ) {
-1548 this.asn1Object = params [ 'obj' ] ;
-1549 this.setASN1Object ( this.isExplicit , this.hT , this.asn1Object ) ;
-1550 }
-1551 }
-1552 } ;
-1553 YAHOO.lang.extend ( KJUR.asn1.DERTaggedObject , KJUR.asn1.ASN1Object ) ;
-1554
\ No newline at end of file
diff --git a/jwt/api/symbols/src/asn1cades-1.0.js.html b/jwt/api/symbols/src/asn1cades-1.0.js.html
deleted file mode 100644
index 549fe72..0000000
--- a/jwt/api/symbols/src/asn1cades-1.0.js.html
+++ /dev/null
@@ -1,783 +0,0 @@
-
1 /*! asn1cades-1.0.0.js (c) 2013-2014 Kenji Urushima | kjur.github.com/jsrsasign/license
- 2 */
- 3 /*
- 4 * asn1cades.js - ASN.1 DER encoder classes for RFC 5126 CAdES long term signature
- 5 *
- 6 * Copyright (c) 2014 Kenji Urushima (kenji.urushima@gmail.com)
- 7 *
- 8 * This software is licensed under the terms of the MIT License.
- 9 * http://kjur.github.com/jsrsasign/license
- 10 *
- 11 * The above copyright and license notice shall be
- 12 * included in all copies or substantial portions of the Software.
- 13 */
- 14
- 15 /**
- 16 * @fileOverview
- 17 * @name asn1cades-1.0.js
- 18 * @author Kenji Urushima kenji.urushima@gmail.com
- 19 * @version 1.0.0 (2014-May-28)
- 20 * @since jsrsasign 4.7.0
- 21 * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a>
- 22 */
- 23
- 24 /**
- 25 * kjur's class library name space
- 26 * // already documented in asn1-1.0.js
- 27 * @name KJUR
- 28 * @namespace kjur's class library name space
- 29 */
- 30 if ( typeof KJUR == "undefined" || ! KJUR ) KJUR = { } ;
- 31
- 32 /**
- 33 * kjur's ASN.1 class library name space
- 34 * // already documented in asn1-1.0.js
- 35 * @name KJUR.asn1
- 36 * @namespace
- 37 */
- 38 if ( typeof KJUR.asn1 == "undefined" || ! KJUR.asn1 ) KJUR.asn1 = { } ;
- 39
- 40 /**
- 41 * kjur's ASN.1 class for RFC 5126 CAdES long term signature
- 42 * <p>
- 43 * This name space provides
- 44 * <a href="https://tools.ietf.org/html/rfc5126">RFC 5126
- 45 * CAdES(CMS Advanced Electronic Signature)</a> generator.
- 46 *
- 47 * <h4>SUPPORTED FORMATS</h4>
- 48 * Following CAdES formats is supported by this library.
- 49 * <ul>
- 50 * <li>CAdES-BES - CAdES Basic Electronic Signature</li>
- 51 * <li>CAdES-EPES - CAdES Explicit Policy-based Electronic Signature</li>
- 52 * <li>CAdES-T - Electronic Signature with Time</li>
- 53 * </ul>
- 54 * </p>
- 55 *
- 56 * <h4>PROVIDED ATTRIBUTE CLASSES</h4>
- 57 * <ul>
- 58 * <li>{@link KJUR.asn1.cades.SignaturePolicyIdentifier} - for CAdES-EPES</li>
- 59 * <li>{@link KJUR.asn1.cades.SignatureTimeStamp} - for CAdES-T</li>
- 60 * <li>{@link KJUR.asn1.cades.CompleteCertificateRefs} - for CAdES-C(for future use)</li>
- 61 * </ul>
- 62 * NOTE: Currntly CAdES-C is not supported since parser can't
- 63 * handle unsigned attribute.
- 64 *
- 65 * <h4>OTHER CLASSES</h4>
- 66 * <ul>
- 67 * <li>{@link KJUR.asn1.cades.OtherHashAlgAndValue}</li>
- 68 * <li>{@link KJUR.asn1.cades.OtherHash}</li>
- 69 * <li>{@link KJUR.asn1.cades.OtherCertID}</li>
- 70 * <li>{@link KJUR.asn1.cades.CAdESUtil} - utilities for CAdES</li>
- 71 * </ul>
- 72 *
- 73 * <h4>GENERATE CAdES-BES</h4>
- 74 * To generate CAdES-BES, {@link KJUR.asn.cades} namespace
- 75 * classes are not required and already {@link KJUR.asn.cms} namespace
- 76 * provides attributes for CAdES-BES.
- 77 * Create {@link KJUR.asn1.cms.SignedData} with following
- 78 * mandatory attribute in CAdES-BES:
- 79 * <ul>
- 80 * <li>{@link KJUR.asn1.cms.ContentType}</li>
- 81 * <li>{@link KJUR.asn1.cms.MessageDigest}</li>
- 82 * <li>{@link KJUR.asn1.cms.SigningCertificate} or </li>
- 83 * <li>{@link KJUR.asn1.cms.SigningCertificateV2}</li>
- 84 * </ul>
- 85 * CMSUtil.newSignedData method is very useful to generate CAdES-BES.
- 86 * <pre>
- 87 * sd = KJUR.asn1.cms.CMSUtil.newSignedData({
- 88 * content: {str: "aaa"},
- 89 * certs: [certPEM],
- 90 * signerInfos: [{
- 91 * hashAlg: 'sha256',
- 92 * sAttr: {SigningCertificateV2: {array: [certPEM]}},
- 93 * signerCert: certPEM,
- 94 * sigAlg: 'SHA256withRSA',
- 95 * signerPrvKey: pkcs8PrvKeyPEM
- 96 * }]
- 97 * });
- 98 * signedDataHex = sd.getContentInfoEncodedHex();
- 99 * </pre>
-100 * NOTE: ContentType and MessageDigest signed attributes
-101 * are automatically added by default.
-102 *
-103 * <h4>GENERATE CAdES-BES with multiple signers</h4>
-104 * If you need signature by multiple signers, you can
-105 * specify one or more items in 'signerInfos' property as below.
-106 * <pre>
-107 * sd = KJUR.asn1.cms.CMSUtil.newSignedData({
-108 * content: {str: "aaa"},
-109 * certs: [certPEM1, certPEM2],
-110 * signerInfos: [{
-111 * hashAlg: 'sha256',
-112 * sAttr: {SigningCertificateV2: {array: [certPEM1]}},
-113 * signerCert: certPEM1,
-114 * sigAlg: 'SHA256withRSA',
-115 * signerPrvKey: pkcs8PrvKeyPEM1
-116 * },{
-117 * hashAlg: 'sha1',
-118 * sAttr: {SigningCertificateV2: {array: [certPEM2]}},
-119 * signerCert: certPEM2,
-120 * sigAlg: 'SHA1withRSA',
-121 * signerPrvKey: pkcs8PrvKeyPEM2
-122 * }]
-123 * });
-124 * signedDataHex = sd.getContentInfoEncodedHex();
-125 * </pre>
-126 *
-127 * <h4>GENERATE CAdES-EPES</h4>
-128 * When you need a CAdES-EPES signature,
-129 * you just need to add 'SignaturePolicyIdentifier'
-130 * attribute as below.
-131 * <pre>
-132 * sd = KJUR.asn1.cms.CMSUtil.newSignedData({
-133 * content: {str: "aaa"},
-134 * certs: [certPEM],
-135 * signerInfos: [{
-136 * hashAlg: 'sha256',
-137 * sAttr: {
-138 * SigningCertificateV2: {array: [certPEM]},
-139 * SignaturePolicyIdentifier: {
-140 * oid: '1.2.3.4.5',
-141 * hash: {alg: 'sha1', hash: 'b1b2b3b4b...'}
-142 * },
-143 * },
-144 * signerCert: certPEM,
-145 * sigAlg: 'SHA256withRSA',
-146 * signerPrvKey: pkcs8PrvKeyPEM
-147 * }]
-148 * });
-149 * signedDataHex = sd.getContentInfoEncodedHex();
-150 * </pre>
-151 *
-152 * <h4>GENERATE CAdES-T</h4>
-153 * After a signed CAdES-BES or CAdES-EPES signature have been generated,
-154 * you can generate CAdES-T by adding SigningTimeStamp unsigned attribute.
-155 * <pre>
-156 * beshex = "30..."; // hex of CAdES-BES or EPES data
-157 * info = KJUR.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned(beshex);
-158 * // You can refer a hexadecimal string of signature value
-159 * // in the first signerInfo in the CAdES-BES/EPES with a variable:
-160 * // 'info.si[0].sigval'. You need to get RFC 3161 TimeStampToken
-161 * // from a trusted time stamp authority. Otherwise you can also
-162 * // get it by 'KJUR.asn1.tsp' module. We suppose that we could
-163 * // get proper time stamp.
-164 * tsthex0 = "30..."; // hex of TimeStampToken for signerInfo[0] sigval
-165 * si0 = info.obj.signerInfoList[0];
-166 * si0.addUnsigned(new KJUR.asn1.cades.SignatureTimeStamp({tst: tsthex0});
-167 * esthex = info.obj.getContentInfoEncodedHex(); // CAdES-T
-168 * </pre>
-169 * </p>
-170 *
-171 * <h4>SAMPLE CODES</h4>
-172 * <ul>
-173 * <li><a href="../../tool_cades.html">demo program for CAdES-BES/EPES/T generation</a></li>
-174 * <li><a href="../../test/qunit-do-asn1cades.html">Unit test code for KJUR.asn1.cades package</a></li>
-175 * <li><a href="../../test/qunit-do-asn1tsp.html">Unit test code for KJUR.asn1.tsp package (See SimpleTSAAdaptor test)</a></li>
-176 * <li><a href="../../test/qunit-do-asn1cms.html">Unit test code for KJUR.asn1.cms package (See newSignedData test)</a></li>
-177 * </ul>
-178 *
-179 * @name KJUR.asn1.cades
-180 * @namespace
-181 */
-182 if ( typeof KJUR.asn1.cades == "undefined" || ! KJUR.asn1.cades ) KJUR.asn1.cades = { } ;
-183
-184 /**
-185 * class for RFC 5126 CAdES SignaturePolicyIdentifier attribute
-186 * @name KJUR.asn1.cades.SignaturePolicyIdentifier
-187 * @class class for RFC 5126 CAdES SignaturePolicyIdentifier attribute
-188 * @param {Array} params associative array of parameters
-189 * @extends KJUR.asn1.cms.Attribute
-190 * @since jsrsasign 4.7.0 asn1cades 1.0.0
-191 * @description
-192 * <pre>
-193 * SignaturePolicyIdentifier ::= CHOICE {
-194 * signaturePolicyId SignaturePolicyId,
-195 * signaturePolicyImplied SignaturePolicyImplied } -- not used
-196 *
-197 * SignaturePolicyImplied ::= NULL
-198 * SignaturePolicyId ::= SEQUENCE {
-199 * sigPolicyId SigPolicyId,
-200 * sigPolicyHash SigPolicyHash,
-201 * sigPolicyQualifiers SEQUENCE SIZE (1..MAX) OF
-202 * SigPolicyQualifierInfo OPTIONAL }
-203 * SigPolicyId ::= OBJECT IDENTIFIER
-204 * SigPolicyHash ::= OtherHashAlgAndValue
-205 * </pre>
-206 * @example
-207 * var o = new KJUR.asn1.cades.SignaturePolicyIdentifier({
-208 * oid: '1.2.3.4.5',
-209 * hash: {alg: 'sha1', hash: 'a1a2a3a4...'}
-210 * });
-211 */
-212 /*
-213 * id-aa-ets-sigPolicyId OBJECT IDENTIFIER ::= { iso(1)
-214 * member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
-215 * smime(16) id-aa(2) 15 }
-216 *
-217 * signature-policy-identifier attribute values have ASN.1 type
-218 * SignaturePolicyIdentifier:
-219 *
-220 * SigPolicyQualifierInfo ::= SEQUENCE {
-221 * sigPolicyQualifierId SigPolicyQualifierId,
-222 * sigQualifier ANY DEFINED BY sigPolicyQualifierId }
-223 *
-224 * sigpolicyQualifierIds defined in the present document:
-225 * SigPolicyQualifierId ::= OBJECT IDENTIFIER
-226 * id-spq-ets-uri OBJECT IDENTIFIER ::= { iso(1)
-227 * member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
-228 * smime(16) id-spq(5) 1 }
-229 *
-230 * SPuri ::= IA5String
-231 *
-232 * id-spq-ets-unotice OBJECT IDENTIFIER ::= { iso(1)
-233 * member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
-234 * smime(16) id-spq(5) 2 }
-235 *
-236 * SPUserNotice ::= SEQUENCE {
-237 * noticeRef NoticeReference OPTIONAL,
-238 * explicitText DisplayText OPTIONAL}
-239 *
-240 * NoticeReference ::= SEQUENCE {
-241 * organization DisplayText,
-242 * noticeNumbers SEQUENCE OF INTEGER }
-243 *
-244 * DisplayText ::= CHOICE {
-245 * visibleString VisibleString (SIZE (1..200)),
-246 * bmpString BMPString (SIZE (1..200)),
-247 * utf8String UTF8String (SIZE (1..200)) }
-248 */
-249 KJUR.asn1.cades.SignaturePolicyIdentifier = function ( params ) {
-250 KJUR.asn1.cades.SignaturePolicyIdentifier.superclass.constructor.call ( this ) ;
-251 this.attrTypeOid = "1.2.840.113549.1.9.16.2.15" ;
-252 var nA = KJUR.asn1 ;
-253 var nC = KJUR.asn1.cades ;
-254
-255 if ( typeof params != "undefined" ) {
-256 if ( typeof params.oid == "string" &&
-257 typeof params.hash == "object" ) {
-258 var dOid = new nA.DERObjectIdentifier ( { oid : params.oid } ) ;
-259 var dHash = new nC.OtherHashAlgAndValue ( params.hash ) ;
-260 var seq = new nA.DERSequence ( { array : [ dOid , dHash ] } ) ;
-261 this.valueList = [ seq ] ;
-262 }
-263 }
-264 } ;
-265 YAHOO.lang.extend ( KJUR.asn1.cades.SignaturePolicyIdentifier ,
-266 KJUR.asn1.cms.Attribute ) ;
-267
-268 /**
-269 * class for OtherHashAlgAndValue ASN.1 object
-270 * @name KJUR.asn1.cades.OtherHashAlgAndValue
-271 * @class class for OtherHashAlgAndValue ASN.1 object
-272 * @param {Array} params associative array of parameters
-273 * @extends KJUR.asn1.ASN1Object
-274 * @since jsrsasign 4.7.0 asn1cades 1.0.0
-275 * @description
-276 * <pre>
-277 * OtherHashAlgAndValue ::= SEQUENCE {
-278 * hashAlgorithm AlgorithmIdentifier,
-279 * hashValue OtherHashValue }
-280 * OtherHashValue ::= OCTET STRING
-281 * </pre>
-282 */
-283 KJUR.asn1.cades.OtherHashAlgAndValue = function ( params ) {
-284 KJUR.asn1.cades.OtherHashAlgAndValue.superclass.constructor.call ( this ) ;
-285 var nA = KJUR.asn1 ;
-286 var nX = KJUR.asn1.x509 ;
-287 this.dAlg = null ;
-288 this.dHash = null ;
-289
-290 this.getEncodedHex = function ( ) {
-291 var seq = new nA.DERSequence ( { array : [ this.dAlg , this.dHash ] } ) ;
-292 this.hTLV = seq.getEncodedHex ( ) ;
-293 return this.hTLV ;
-294 } ;
-295
-296 if ( typeof params != "undefined" ) {
-297 if ( typeof params.alg == "string" &&
-298 typeof params.hash == "string" ) {
-299 this.dAlg = new nX.AlgorithmIdentifier ( { name : params.alg } ) ;
-300 this.dHash = new nA.DEROctetString ( { hex : params.hash } ) ;
-301 }
-302 }
-303 } ;
-304 YAHOO.lang.extend ( KJUR.asn1.cades.OtherHashAlgAndValue , KJUR.asn1.ASN1Object ) ;
-305
-306 /**
-307 * class for RFC 5126 CAdES SignatureTimeStamp attribute
-308 * @name KJUR.asn1.cades.SignatureTimeStamp
-309 * @class class for RFC 5126 CAdES SignatureTimeStamp attribute
-310 * @param {Array} params associative array of parameters
-311 * @extends KJUR.asn1.cms.Attribute
-312 * @since jsrsasign 4.7.0 asn1cades 1.0.0
-313 * @description
-314 * <pre>
-315 * id-aa-signatureTimeStampToken OBJECT IDENTIFIER ::=
-316 * 1.2.840.113549.1.9.16.2.14
-317 * SignatureTimeStampToken ::= TimeStampToken
-318 * </pre>
-319 */
-320 KJUR.asn1.cades.SignatureTimeStamp = function ( params ) {
-321 KJUR.asn1.cades.SignatureTimeStamp.superclass.constructor.call ( this ) ;
-322 this.attrTypeOid = "1.2.840.113549.1.9.16.2.14" ;
-323 this.tstHex = null ;
-324 var nA = KJUR.asn1 ;
-325
-326 if ( typeof params != "undefined" ) {
-327 if ( typeof params.res != "undefined" ) {
-328 if ( typeof params.res == "string" &&
-329 params.res.match ( /^[0-9A-Fa-f]+$/ ) ) {
-330 } else if ( params.res instanceof KJUR.asn1.ASN1Object ) {
-331 } else {
-332 throw "res param shall be ASN1Object or hex string" ;
-333 }
-334 }
-335 if ( typeof params.tst != "undefined" ) {
-336 if ( typeof params.tst == "string" &&
-337 params.tst.match ( /^[0-9A-Fa-f]+$/ ) ) {
-338 var d = new nA.ASN1Object ( ) ;
-339 this.tstHex = params.tst ;
-340 d.hTLV = this.tstHex ;
-341 d.getEncodedHex ( ) ;
-342 this.valueList = [ d ] ;
-343 } else if ( params.tst instanceof KJUR.asn1.ASN1Object ) {
-344 } else {
-345 throw "tst param shall be ASN1Object or hex string" ;
-346 }
-347 }
-348 }
-349 } ;
-350 YAHOO.lang.extend ( KJUR.asn1.cades.SignatureTimeStamp ,
-351 KJUR.asn1.cms.Attribute ) ;
-352
-353 /**
-354 * class for RFC 5126 CAdES CompleteCertificateRefs attribute
-355 * @name KJUR.asn1.cades.CompleteCertificateRefs
-356 * @class class for RFC 5126 CAdES CompleteCertificateRefs attribute
-357 * @param {Array} params associative array of parameters
-358 * @extends KJUR.asn1.cms.Attribute
-359 * @since jsrsasign 4.7.0 asn1cades 1.0.0
-360 * @description
-361 * <pre>
-362 * id-aa-ets-certificateRefs OBJECT IDENTIFIER =
-363 * 1.2.840.113549.1.9.16.2.21
-364 * CompleteCertificateRefs ::= SEQUENCE OF OtherCertID
-365 * </pre>
-366 * @example
-367 * o = new KJUR.asn1.cades.CompleteCertificateRefs([certPEM1,certPEM2]);
-368 */
-369 KJUR.asn1.cades.CompleteCertificateRefs = function ( params ) {
-370 KJUR.asn1.cades.CompleteCertificateRefs.superclass.constructor.call ( this ) ;
-371 this.attrTypeOid = "1.2.840.113549.1.9.16.2.21" ;
-372 var nA = KJUR.asn1 ;
-373 var nD = KJUR.asn1.cades ;
-374
-375 /**
-376 * set value by array
-377 * @name setByArray
-378 * @memberOf KJUR.asn1.cades.CompleteCertificateRefs
-379 * @function
-380 * @param {Array} a array of {@link KJUR.asn1.cades.OtherCertID} argument
-381 * @return unspecified
-382 * @description
-383 */
-384 this.setByArray = function ( a ) {
-385 this.valueList = [ ] ;
-386 for ( var i = 0 ; i < a.length ; i ++ ) {
-387 var o = new nD.OtherCertID ( a [ i ] ) ;
-388 this.valueList.push ( o ) ;
-389 }
-390 } ;
-391
-392 if ( typeof params != "undefined" ) {
-393 if ( typeof params == "object" &&
-394 typeof params.length == "number" ) {
-395 this.setByArray ( params ) ;
-396 }
-397 }
-398 } ;
-399 YAHOO.lang.extend ( KJUR.asn1.cades.CompleteCertificateRefs ,
-400 KJUR.asn1.cms.Attribute ) ;
-401
-402 /**
-403 * class for OtherCertID ASN.1 object
-404 * @name KJUR.asn1.cades.OtherCertID
-405 * @class class for OtherCertID ASN.1 object
-406 * @param {Array} params associative array of parameters
-407 * @extends KJUR.asn1.ASN1Object
-408 * @since jsrsasign 4.7.0 asn1cades 1.0.0
-409 * @description
-410 * <pre>
-411 * OtherCertID ::= SEQUENCE {
-412 * otherCertHash OtherHash,
-413 * issuerSerial IssuerSerial OPTIONAL }
-414 * </pre>
-415 * @example
-416 * o = new KJUR.asn1.cades.OtherCertID(certPEM);
-417 * o = new KJUR.asn1.cades.OtherCertID({cert:certPEM, hasis: false});
-418 */
-419 KJUR.asn1.cades.OtherCertID = function ( params ) {
-420 KJUR.asn1.cades.OtherCertID.superclass.constructor.call ( this ) ;
-421 var nA = KJUR.asn1 ;
-422 var nC = KJUR.asn1.cms ;
-423 var nD = KJUR.asn1.cades ;
-424 this.hasIssuerSerial = true ;
-425 this.dOtherCertHash = null ;
-426 this.dIssuerSerial = null ;
-427
-428 /**
-429 * set value by PEM string of certificate
-430 * @name setByCertPEM
-431 * @memberOf KJUR.asn1.cades.OtherCertID
-432 * @function
-433 * @param {String} certPEM PEM string of certificate
-434 * @return unspecified
-435 * @description
-436 * This method will set value by a PEM string of a certificate.
-437 * This will add IssuerAndSerialNumber by default
-438 * which depends on hasIssuerSerial flag.
-439 */
-440 this.setByCertPEM = function ( certPEM ) {
-441 this.dOtherCertHash = new nD.OtherHash ( certPEM ) ;
-442 if ( this.hasIssuerSerial )
-443 this.dIssuerSerial = new nC.IssuerAndSerialNumber ( certPEM ) ;
-444 } ;
-445
-446 this.getEncodedHex = function ( ) {
-447 if ( this.hTLV != null ) return this.hTLV ;
-448 if ( this.dOtherCertHash == null )
-449 throw "otherCertHash not set" ;
-450 var a = [ this.dOtherCertHash ] ;
-451 if ( this.dIssuerSerial != null )
-452 a.push ( this.dIssuerSerial ) ;
-453 var seq = new nA.DERSequence ( { array : a } ) ;
-454 this.hTLV = seq.getEncodedHex ( ) ;
-455 return this.hTLV ;
-456 } ;
-457
-458 if ( typeof params != "undefined" ) {
-459 if ( typeof params == "string" &&
-460 params.indexOf ( "-----BEGIN " ) != - 1 ) {
-461 this.setByCertPEM ( params ) ;
-462 }
-463 if ( typeof params == "object" ) {
-464 if ( params.hasis === false )
-465 this.hasIssuerSerial = false ;
-466 if ( typeof params.cert == "string" )
-467 this.setByCertPEM ( params.cert ) ;
-468 }
-469 }
-470 } ;
-471 YAHOO.lang.extend ( KJUR.asn1.cades.OtherCertID , KJUR.asn1.ASN1Object ) ;
-472
-473 /**
-474 * class for OtherHash ASN.1 object
-475 * @name KJUR.asn1.cades.OtherHash
-476 * @class class for OtherHash ASN.1 object
-477 * @param {Array} params associative array of parameters
-478 * @extends KJUR.asn1.ASN1Object
-479 * @since jsrsasign 4.7.0 asn1cades 1.0.0
-480 * @description
-481 * <pre>
-482 * OtherHash ::= CHOICE {
-483 * sha1Hash OtherHashValue, -- This contains a SHA-1 hash
-484 * otherHash OtherHashAlgAndValue}
-485 * OtherHashValue ::= OCTET STRING
-486 * </pre>
-487 * @example
-488 * o = new KJUR.asn1.cades.OtherHash("1234");
-489 * o = new KJUR.asn1.cades.OtherHash(certPEMStr); // default alg=sha256
-490 * o = new KJUR.asn1.cades.OtherHash({alg: 'sha256', hash: '1234'});
-491 * o = new KJUR.asn1.cades.OtherHash({alg: 'sha256', cert: certPEM});
-492 * o = new KJUR.asn1.cades.OtherHash({cert: certPEM});
-493 */
-494 KJUR.asn1.cades.OtherHash = function ( params ) {
-495 KJUR.asn1.cades.OtherHash.superclass.constructor.call ( this ) ;
-496 var nA = KJUR.asn1 ;
-497 var nD = KJUR.asn1.cades ;
-498 this.alg = 'sha256' ;
-499 this.dOtherHash = null ;
-500
-501 /**
-502 * set value by PEM string of certificate
-503 * @name setByCertPEM
-504 * @memberOf KJUR.asn1.cades.OtherHash
-505 * @function
-506 * @param {String} certPEM PEM string of certificate
-507 * @return unspecified
-508 * @description
-509 * This method will set value by a PEM string of a certificate.
-510 * An algorithm used to hash certificate data will
-511 * be defined by 'alg' property and 'sha256' is default.
-512 */
-513 this.setByCertPEM = function ( certPEM ) {
-514 if ( certPEM.indexOf ( "-----BEGIN " ) == - 1 )
-515 throw "certPEM not to seem PEM format" ;
-516 var hex = X509.pemToHex ( certPEM ) ;
-517 var hash = KJUR.crypto.Util.hashHex ( hex , this.alg ) ;
-518 this.dOtherHash =
-519 new nD.OtherHashAlgAndValue ( { alg : this.alg , hash : hash } ) ;
-520 } ;
-521
-522 this.getEncodedHex = function ( ) {
-523 if ( this.dOtherHash == null )
-524 throw "OtherHash not set" ;
-525 return this.dOtherHash.getEncodedHex ( ) ;
-526 } ;
-527
-528 if ( typeof params != "undefined" ) {
-529 if ( typeof params == "string" ) {
-530 if ( params.indexOf ( "-----BEGIN " ) != - 1 ) {
-531 this.setByCertPEM ( params ) ;
-532 } else if ( params.match ( /^[0-9A-Fa-f]+$/ ) ) {
-533 this.dOtherHash = new nA.DEROctetString ( { hex : params } ) ;
-534 } else {
-535 throw "unsupported string value for params" ;
-536 }
-537 } else if ( typeof params == "object" ) {
-538 if ( typeof params.cert == "string" ) {
-539 if ( typeof params.alg == "string" )
-540 this.alg = params.alg ;
-541 this.setByCertPEM ( params.cert ) ;
-542 } else {
-543 this.dOtherHash = new nD.OtherHashAlgAndValue ( params ) ;
-544 }
-545 }
-546 }
-547 } ;
-548 YAHOO.lang.extend ( KJUR.asn1.cades.OtherHash , KJUR.asn1.ASN1Object ) ;
-549
-550
-551 // == BEGIN UTILITIES =====================================================
-552
-553 /**
-554 * CAdES utiliteis class
-555 * @name KJUR.asn1.cades.CAdESUtil
-556 * @class CAdES utilities class
-557 * @since jsrsasign 4.7.0 asn1cades 1.0.0
-558 */
-559 KJUR.asn1.cades.CAdESUtil = new function ( ) {
-560 } ;
-561 /*
-562 *
-563 */
-564 KJUR.asn1.cades.CAdESUtil.addSigTS = function ( dCMS , siIdx , sigTSHex ) {
-565 } ;
-566 /**
-567 * parse CMS SignedData to add unsigned attributes
-568 * @name parseSignedDataForAddingUnsigned
-569 * @memberOf KJUR.asn1.cades.CAdESUtil
-570 * @function
-571 * @param {String} hex hexadecimal string of ContentInfo of CMS SignedData
-572 * @return {Object} associative array of parsed data
-573 * @description
-574 * This method will parse a hexadecimal string of
-575 * ContentInfo with CMS SignedData to add a attribute
-576 * to unsigned attributes field in a signerInfo field.
-577 * Parsed result will be an associative array which has
-578 * following properties:
-579 * <ul>
-580 * <li>version - hex of CMSVersion ASN.1 TLV</li>
-581 * <li>algs - hex of DigestAlgorithms ASN.1 TLV</li>
-582 * <li>encapcontent - hex of EncapContentInfo ASN.1 TLV</li>
-583 * <li>certs - hex of Certificates ASN.1 TLV</li>
-584 * <li>revs - hex of RevocationInfoChoices ASN.1 TLV</li>
-585 * <li>si[] - array of SignerInfo properties</li>
-586 * <li>obj - parsed KJUR.asn1.cms.SignedData object</li>
-587 * </ul>
-588 * @example
-589 * info = KJUR.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned(beshex);
-590 * sd = info.obj;
-591 */
-592 KJUR.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned = function ( hex ) {
-593 var nA = KJUR.asn1 ;
-594 var nC = KJUR.asn1.cms ;
-595 var nU = KJUR.asn1.cades.CAdESUtil ;
-596 var r = { } ;
-597
-598 // 1. not oid signed-data then error
-599 if ( ASN1HEX.getDecendantHexTLVByNthList ( hex , 0 , [ 0 ] ) !=
-600 "06092a864886f70d010702" )
-601 throw "hex is not CMS SignedData" ;
-602
-603 var iSD = ASN1HEX.getDecendantIndexByNthList ( hex , 0 , [ 1 , 0 ] ) ;
-604 var aSDChildIdx = ASN1HEX.getPosArrayOfChildren_AtObj ( hex , iSD ) ;
-605 if ( aSDChildIdx.length < 4 )
-606 throw "num of SignedData elem shall be 4 at least" ;
-607
-608 // 2. HEXs of SignedData children
-609 // 2.1. SignedData.CMSVersion
-610 var iVersion = aSDChildIdx.shift ( ) ;
-611 r.version = ASN1HEX.getHexOfTLV_AtObj ( hex , iVersion ) ;
-612
-613 // 2.2. SignedData.DigestAlgorithms
-614 var iAlgs = aSDChildIdx.shift ( ) ;
-615 r.algs = ASN1HEX.getHexOfTLV_AtObj ( hex , iAlgs ) ;
-616
-617 // 2.3. SignedData.EncapContentInfo
-618 var iEncapContent = aSDChildIdx.shift ( ) ;
-619 r.encapcontent = ASN1HEX.getHexOfTLV_AtObj ( hex , iEncapContent ) ;
-620
-621 // 2.4. [0]Certs
-622 r.certs = null ;
-623 r.revs = null ;
-624 r.si = [ ] ;
-625
-626 var iNext = aSDChildIdx.shift ( ) ;
-627 if ( hex.substr ( iNext , 2 ) == "a0" ) {
-628 r.certs = ASN1HEX.getHexOfTLV_AtObj ( hex , iNext ) ;
-629 iNext = aSDChildIdx.shift ( ) ;
-630 }
-631
-632 // 2.5. [1]Revs
-633 if ( hex.substr ( iNext , 2 ) == "a1" ) {
-634 r.revs = ASN1HEX.getHexOfTLV_AtObj ( hex , iNext ) ;
-635 iNext = aSDChildIdx.shift ( ) ;
-636 }
-637
-638 // 2.6. SignerInfos
-639 var iSignerInfos = iNext ;
-640 if ( hex.substr ( iSignerInfos , 2 ) != "31" )
-641 throw "Can't find signerInfos" ;
-642
-643 var aSIIndex = ASN1HEX.getPosArrayOfChildren_AtObj ( hex , iSignerInfos ) ;
-644 //alert(aSIIndex.join("-"));
-645
-646 for ( var i = 0 ; i < aSIIndex.length ; i ++ ) {
-647 var iSI = aSIIndex [ i ] ;
-648 var pSI = nU.parseSignerInfoForAddingUnsigned ( hex , iSI , i ) ;
-649 r.si [ i ] = pSI ;
-650 }
-651
-652 // x. obj(SignedData)
-653 var tmp = null ;
-654 r.obj = new nC.SignedData ( ) ;
-655
-656 tmp = new nA.ASN1Object ( ) ;
-657 tmp.hTLV = r.version ;
-658 r.obj.dCMSVersion = tmp ;
-659
-660 tmp = new nA.ASN1Object ( ) ;
-661 tmp.hTLV = r.algs ;
-662 r.obj.dDigestAlgs = tmp ;
-663
-664 tmp = new nA.ASN1Object ( ) ;
-665 tmp.hTLV = r.encapcontent ;
-666 r.obj.dEncapContentInfo = tmp ;
-667
-668 tmp = new nA.ASN1Object ( ) ;
-669 tmp.hTLV = r.certs ;
-670 r.obj.dCerts = tmp ;
-671
-672 r.obj.signerInfoList = [ ] ;
-673 for ( var i = 0 ; i < r.si.length ; i ++ ) {
-674 r.obj.signerInfoList.push ( r.si [ i ] . obj ) ;
-675 }
-676
-677 return r ;
-678 } ;
-679
-680 /**
-681 * parse SignerInfo to add unsigned attributes
-682 * @name parseSignerInfoForAddingUnsigned
-683 * @memberOf KJUR.asn1.cades.CAdESUtil
-684 * @function
-685 * @param {String} hex hexadecimal string of SignerInfo
-686 * @return {Object} associative array of parsed data
-687 * @description
-688 * This method will parse a hexadecimal string of
-689 * SignerInfo to add a attribute
-690 * to unsigned attributes field in a signerInfo field.
-691 * Parsed result will be an associative array which has
-692 * following properties:
-693 * <ul>
-694 * <li>version - hex TLV of version</li>
-695 * <li>si - hex TLV of SignerIdentifier</li>
-696 * <li>digalg - hex TLV of DigestAlgorithm</li>
-697 * <li>sattrs - hex TLV of SignedAttributes</li>
-698 * <li>sigalg - hex TLV of SignatureAlgorithm</li>
-699 * <li>sig - hex TLV of signature</li>
-700 * <li>sigval = hex V of signature</li>
-701 * <li>obj - parsed KJUR.asn1.cms.SignerInfo object</li>
-702 * </ul>
-703 * NOTE: Parsing of unsigned attributes will be provided in the
-704 * future version. That's way this version provides support
-705 * for CAdES-T and not for CAdES-C.
-706 */
-707 KJUR.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned =
-708 function ( hex , iSI , nth ) {
-709 var nA = KJUR.asn1 ;
-710 var nC = KJUR.asn1.cms ;
-711 var r = { } ;
-712 var aSIChildIdx = ASN1HEX.getPosArrayOfChildren_AtObj ( hex , iSI ) ;
-713 //alert(aSIChildIdx.join("="));
-714
-715 if ( aSIChildIdx.length != 6 )
-716 throw "not supported items for SignerInfo (!=6)" ;
-717
-718 // 1. SignerInfo.CMSVersion
-719 var iVersion = aSIChildIdx.shift ( ) ;
-720 r.version = ASN1HEX.getHexOfTLV_AtObj ( hex , iVersion ) ;
-721
-722 // 2. SignerIdentifier(IssuerAndSerialNumber)
-723 var iIdentifier = aSIChildIdx.shift ( ) ;
-724 r.si = ASN1HEX.getHexOfTLV_AtObj ( hex , iIdentifier ) ;
-725
-726 // 3. DigestAlgorithm
-727 var iDigestAlg = aSIChildIdx.shift ( ) ;
-728 r.digalg = ASN1HEX.getHexOfTLV_AtObj ( hex , iDigestAlg ) ;
-729
-730 // 4. SignedAttrs
-731 var iSignedAttrs = aSIChildIdx.shift ( ) ;
-732 r.sattrs = ASN1HEX.getHexOfTLV_AtObj ( hex , iSignedAttrs ) ;
-733
-734 // 5. SigAlg
-735 var iSigAlg = aSIChildIdx.shift ( ) ;
-736 r.sigalg = ASN1HEX.getHexOfTLV_AtObj ( hex , iSigAlg ) ;
-737
-738 // 6. Signature
-739 var iSig = aSIChildIdx.shift ( ) ;
-740 r.sig = ASN1HEX.getHexOfTLV_AtObj ( hex , iSig ) ;
-741 r.sigval = ASN1HEX.getHexOfV_AtObj ( hex , iSig ) ;
-742
-743 // 7. obj(SignerInfo)
-744 var tmp = null ;
-745 r.obj = new nC.SignerInfo ( ) ;
-746
-747 tmp = new nA.ASN1Object ( ) ;
-748 tmp.hTLV = r.version ;
-749 r.obj.dCMSVersion = tmp ;
-750
-751 tmp = new nA.ASN1Object ( ) ;
-752 tmp.hTLV = r.si ;
-753 r.obj.dSignerIdentifier = tmp ;
-754
-755 tmp = new nA.ASN1Object ( ) ;
-756 tmp.hTLV = r.digalg ;
-757 r.obj.dDigestAlgorithm = tmp ;
-758
-759 tmp = new nA.ASN1Object ( ) ;
-760 tmp.hTLV = r.sattrs ;
-761 r.obj.dSignedAttrs = tmp ;
-762
-763 tmp = new nA.ASN1Object ( ) ;
-764 tmp.hTLV = r.sigalg ;
-765 r.obj.dSigAlg = tmp ;
-766
-767 tmp = new nA.ASN1Object ( ) ;
-768 tmp.hTLV = r.sig ;
-769 r.obj.dSig = tmp ;
-770
-771 r.obj.dUnsignedAttrs = new nC.AttributeList ( ) ;
-772
-773 return r ;
-774 } ;
-775
-776
\ No newline at end of file
diff --git a/jwt/api/symbols/src/asn1cms-1.0.js.html b/jwt/api/symbols/src/asn1cms-1.0.js.html
deleted file mode 100644
index 356165d..0000000
--- a/jwt/api/symbols/src/asn1cms-1.0.js.html
+++ /dev/null
@@ -1,992 +0,0 @@
-
1 /*! asn1cms-1.0.2.js (c) 2013-2014 Kenji Urushima | kjur.github.com/jsrsasign/license
- 2 */
- 3 /*
- 4 * asn1cms.js - ASN.1 DER encoder classes for Cryptographic Message Syntax(CMS)
- 5 *
- 6 * Copyright (c) 2014 Kenji Urushima (kenji.urushima@gmail.com)
- 7 *
- 8 * This software is licensed under the terms of the MIT License.
- 9 * http://kjur.github.com/jsrsasign/license
- 10 *
- 11 * The above copyright and license notice shall be
- 12 * included in all copies or substantial portions of the Software.
- 13 */
- 14
- 15 /**
- 16 * @fileOverview
- 17 * @name asn1cms-1.0.js
- 18 * @author Kenji Urushima kenji.urushima@gmail.com
- 19 * @version 1.0.2 (2014-Jun-07)
- 20 * @since jsrsasign 4.2.4
- 21 * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a>
- 22 */
- 23
- 24 /**
- 25 * kjur's class library name space
- 26 * // already documented in asn1-1.0.js
- 27 * @name KJUR
- 28 * @namespace kjur's class library name space
- 29 */
- 30 if ( typeof KJUR == "undefined" || ! KJUR ) KJUR = { } ;
- 31
- 32 /**
- 33 * kjur's ASN.1 class library name space
- 34 * // already documented in asn1-1.0.js
- 35 * @name KJUR.asn1
- 36 * @namespace
- 37 */
- 38 if ( typeof KJUR.asn1 == "undefined" || ! KJUR.asn1 ) KJUR.asn1 = { } ;
- 39
- 40 /**
- 41 * kjur's ASN.1 class for Cryptographic Message Syntax(CMS)
- 42 * <p>
- 43 * This name space provides
- 44 * <a href="https://tools.ietf.org/html/rfc5652">RFC 5652
- 45 * Cryptographic Message Syntax (CMS)</a> SignedData generator.
- 46 *
- 47 * <h4>FEATURES</h4>
- 48 * <ul>
- 49 * <li>easily generate CMS SignedData</li>
- 50 * <li>APIs are very similar to BouncyCastle library ASN.1 classes. So easy to learn.</li>
- 51 * </ul>
- 52 *
- 53 * <h4>PROVIDED CLASSES</h4>
- 54 * <ul>
- 55 * <li>{@link KJUR.asn1.cms.SignedData}</li>
- 56 * <li>{@link KJUR.asn1.cms.SignerInfo}</li>
- 57 * <li>{@link KJUR.asn1.cms.AttributeList}</li>
- 58 * <li>{@link KJUR.asn1.cms.ContentInfo}</li>
- 59 * <li>{@link KJUR.asn1.cms.EncapsulatedContentInfo}</li>
- 60 * <li>{@link KJUR.asn1.cms.IssuerAndSerialNumber}</li>
- 61 * <li>{@link KJUR.asn1.cms.CMSUtil}</li>
- 62 * <li>{@link KJUR.asn1.cms.Attribute}</li>
- 63 * <li>{@link KJUR.asn1.cms.ContentType}</li>
- 64 * <li>{@link KJUR.asn1.cms.MessageDigest}</li>
- 65 * <li>{@link KJUR.asn1.cms.SigningTime}</li>
- 66 * <li>{@link KJUR.asn1.cms.SigningCertificate}</li>
- 67 * <li>{@link KJUR.asn1.cms.SigningCertificateV2}</li>
- 68 * </ul>
- 69 * NOTE: Please ignore method summary and document of this namespace.
- 70 * This caused by a bug of jsdoc2.
- 71 * </p>
- 72 * @name KJUR.asn1.cms
- 73 * @namespace
- 74 */
- 75 if ( typeof KJUR.asn1.cms == "undefined" || ! KJUR.asn1.cms ) KJUR.asn1.cms = { } ;
- 76
- 77 /**
- 78 * Attribute class for base of CMS attribute
- 79 * @name KJUR.asn1.cms.Attribute
- 80 * @class Attribute class for base of CMS attribute
- 81 * @param {Array} params associative array of parameters
- 82 * @extends KJUR.asn1.ASN1Object
- 83 * @since jsrsasign 4.2.4 asn1cms 1.0.0
- 84 * @description
- 85 * <pre>
- 86 * Attributes ::= SET OF Attribute
- 87 * Attribute ::= SEQUENCE {
- 88 * type OBJECT IDENTIFIER,
- 89 * values AttributeSetValue }
- 90 * AttributeSetValue ::= SET OF ANY
- 91 * </pre>
- 92 */
- 93 KJUR.asn1.cms.Attribute = function ( params ) {
- 94 KJUR.asn1.cms.Attribute.superclass.constructor.call ( this ) ;
- 95 var valueList = [ ] ; // array of values
- 96
- 97 this.getEncodedHex = function ( ) {
- 98 var attrTypeASN1 , attrValueASN1 , seq ;
- 99 attrTypeASN1 = new KJUR.asn1.DERObjectIdentifier ( { "oid" : this.attrTypeOid } ) ;
-100
-101 attrValueASN1 = new KJUR.asn1.DERSet ( { "array" : this.valueList } ) ;
-102 try {
-103 attrValueASN1.getEncodedHex ( ) ;
-104 } catch ( ex ) {
-105 throw "fail valueSet.getEncodedHex in Attribute(1)/" + ex ;
-106 }
-107
-108 seq = new KJUR.asn1.DERSequence ( { "array" : [ attrTypeASN1 , attrValueASN1 ] } ) ;
-109 try {
-110 this.hTLV = seq.getEncodedHex ( ) ;
-111 } catch ( ex ) {
-112 throw "failed seq.getEncodedHex in Attribute(2)/" + ex ;
-113 }
-114
-115 return this.hTLV ;
-116 } ;
-117 } ;
-118 YAHOO.lang.extend ( KJUR.asn1.cms.Attribute , KJUR.asn1.ASN1Object ) ;
-119
-120 /**
-121 * class for CMS ContentType attribute
-122 * @name KJUR.asn1.cms.ContentType
-123 * @class class for CMS ContentType attribute
-124 * @param {Array} params associative array of parameters
-125 * @extends KJUR.asn1.cms.Attribute
-126 * @since jsrsasign 4.2.4 asn1cms 1.0.0
-127 * @description
-128 * <pre>
-129 * Attribute ::= SEQUENCE {
-130 * type OBJECT IDENTIFIER,
-131 * values AttributeSetValue }
-132 * AttributeSetValue ::= SET OF ANY
-133 * ContentType ::= OBJECT IDENTIFIER
-134 * </pre>
-135 * @example
-136 * o = new KJUR.asn1.cms.ContentType({name: 'data'});
-137 * o = new KJUR.asn1.cms.ContentType({oid: '1.2.840.113549.1.9.16.1.4'});
-138 */
-139 KJUR.asn1.cms.ContentType = function ( params ) {
-140 KJUR.asn1.cms.ContentType.superclass.constructor.call ( this ) ;
-141 this.attrTypeOid = "1.2.840.113549.1.9.3" ;
-142 var contentTypeASN1 = null ;
-143
-144 if ( typeof params != "undefined" ) {
-145 var contentTypeASN1 = new KJUR.asn1.DERObjectIdentifier ( params ) ;
-146 this.valueList = [ contentTypeASN1 ] ;
-147 }
-148 } ;
-149 YAHOO.lang.extend ( KJUR.asn1.cms.ContentType , KJUR.asn1.cms.Attribute ) ;
-150
-151 /**
-152 * class for CMS MessageDigest attribute
-153 * @name KJUR.asn1.cms.MessageDigest
-154 * @class class for CMS MessageDigest attribute
-155 * @param {Array} params associative array of parameters
-156 * @extends KJUR.asn1.cms.Attribute
-157 * @since jsrsasign 4.2.4 asn1cms 1.0.0
-158 * @description
-159 * <pre>
-160 * Attribute ::= SEQUENCE {
-161 * type OBJECT IDENTIFIER,
-162 * values AttributeSetValue }
-163 * AttributeSetValue ::= SET OF ANY
-164 * MessageDigest ::= OCTET STRING
-165 * </pre>
-166 * @example
-167 * o = new KJUR.asn1.cms.MessageDigest({hex: 'a1a2a3a4...'});
-168 */
-169 KJUR.asn1.cms.MessageDigest = function ( params ) {
-170 KJUR.asn1.cms.MessageDigest.superclass.constructor.call ( this ) ;
-171 this.attrTypeOid = "1.2.840.113549.1.9.4" ;
-172
-173 if ( typeof params != "undefined" ) {
-174 if ( params.eciObj instanceof KJUR.asn1.cms.EncapsulatedContentInfo &&
-175 typeof params.hashAlg == "string" ) {
-176 var dataHex = params.eciObj.eContentValueHex ;
-177 var hashAlg = params.hashAlg ;
-178 var hashValueHex = KJUR.crypto.Util.hashHex ( dataHex , hashAlg ) ;
-179 var dAttrValue1 = new KJUR.asn1.DEROctetString ( { hex : hashValueHex } ) ;
-180 dAttrValue1.getEncodedHex ( ) ;
-181 this.valueList = [ dAttrValue1 ] ;
-182 } else {
-183 var dAttrValue1 = new KJUR.asn1.DEROctetString ( params ) ;
-184 dAttrValue1.getEncodedHex ( ) ;
-185 this.valueList = [ dAttrValue1 ] ;
-186 }
-187 }
-188 } ;
-189 YAHOO.lang.extend ( KJUR.asn1.cms.MessageDigest , KJUR.asn1.cms.Attribute ) ;
-190
-191 /**
-192 * class for CMS SigningTime attribute
-193 * @name KJUR.asn1.cms.SigningTime
-194 * @class class for CMS SigningTime attribute
-195 * @param {Array} params associative array of parameters
-196 * @extends KJUR.asn1.cms.Attribute
-197 * @since jsrsasign 4.2.4 asn1cms 1.0.0
-198 * @description
-199 * <pre>
-200 * Attribute ::= SEQUENCE {
-201 * type OBJECT IDENTIFIER,
-202 * values AttributeSetValue }
-203 * AttributeSetValue ::= SET OF ANY
-204 * SigningTime ::= Time
-205 * Time ::= CHOICE {
-206 * utcTime UTCTime,
-207 * generalTime GeneralizedTime }
-208 * </pre>
-209 * @example
-210 * o = new KJUR.asn1.cms.SigningTime(); // current time UTCTime by default
-211 * o = new KJUR.asn1.cms.SigningTime({type: 'gen'}); // current time GeneralizedTime
-212 * o = new KJUR.asn1.cms.SigningTime({str: '20140517093800Z'}); // specified GeneralizedTime
-213 * o = new KJUR.asn1.cms.SigningTime({str: '140517093800Z'}); // specified UTCTime
-214 */
-215 KJUR.asn1.cms.SigningTime = function ( params ) {
-216 KJUR.asn1.cms.SigningTime.superclass.constructor.call ( this ) ;
-217 this.attrTypeOid = "1.2.840.113549.1.9.5" ;
-218
-219 if ( typeof params != "undefined" ) {
-220 var asn1 = new KJUR.asn1.x509.Time ( params ) ;
-221 try {
-222 asn1.getEncodedHex ( ) ;
-223 } catch ( ex ) {
-224 throw "SigningTime.getEncodedHex() failed/" + ex ;
-225 }
-226 this.valueList = [ asn1 ] ;
-227 }
-228 } ;
-229 YAHOO.lang.extend ( KJUR.asn1.cms.SigningTime , KJUR.asn1.cms.Attribute ) ;
-230
-231 /**
-232 * class for CMS SigningCertificate attribute
-233 * @name KJUR.asn1.cms.SigningCertificate
-234 * @class class for CMS SigningCertificate attribute
-235 * @param {Array} params associative array of parameters
-236 * @extends KJUR.asn1.cms.Attribute
-237 * @since jsrsasign 4.5.1 asn1cms 1.0.1
-238 * @description
-239 * <pre>
-240 * Attribute ::= SEQUENCE {
-241 * type OBJECT IDENTIFIER,
-242 * values AttributeSetValue }
-243 * AttributeSetValue ::= SET OF ANY
-244 * SigningCertificate ::= SEQUENCE {
-245 * certs SEQUENCE OF ESSCertID,
-246 * policies SEQUENCE OF PolicyInformation OPTIONAL }
-247 * ESSCertID ::= SEQUENCE {
-248 * certHash Hash,
-249 * issuerSerial IssuerSerial OPTIONAL }
-250 * IssuerSerial ::= SEQUENCE {
-251 * issuer GeneralNames,
-252 * serialNumber CertificateSerialNumber }
-253 * </pre>
-254 * @example
-255 * o = new KJUR.asn1.cms.SigningCertificate({array: [certPEM]});
-256 */
-257 KJUR.asn1.cms.SigningCertificate = function ( params ) {
-258 KJUR.asn1.cms.SigningCertificate.superclass.constructor.call ( this ) ;
-259 this.attrTypeOid = "1.2.840.113549.1.9.16.2.12" ;
-260 var nA = KJUR.asn1 ;
-261 var nC = KJUR.asn1.cms ;
-262 var nY = KJUR.crypto ;
-263
-264 this.setCerts = function ( listPEM ) {
-265 var list = [ ] ;
-266 for ( var i = 0 ; i < listPEM.length ; i ++ ) {
-267 var hex = KEYUTIL.getHexFromPEM ( listPEM [ i ] ) ;
-268 var certHashHex = nY.Util.hashHex ( hex , 'sha1' ) ;
-269 var dCertHash = new nA.DEROctetString ( { hex : certHashHex } ) ;
-270 dCertHash.getEncodedHex ( ) ;
-271 var dIssuerSerial =
-272 new nC.IssuerAndSerialNumber ( { cert : listPEM [ i ] } ) ;
-273 dIssuerSerial.getEncodedHex ( ) ;
-274 var dESSCertID =
-275 new nA.DERSequence ( { array : [ dCertHash , dIssuerSerial ] } ) ;
-276 dESSCertID.getEncodedHex ( ) ;
-277 list.push ( dESSCertID ) ;
-278 }
-279
-280 var dValue = new nA.DERSequence ( { array : list } ) ;
-281 dValue.getEncodedHex ( ) ;
-282 this.valueList = [ dValue ] ;
-283 } ;
-284
-285 if ( typeof params != "undefined" ) {
-286 if ( typeof params.array == "object" ) {
-287 this.setCerts ( params.array ) ;
-288 }
-289 }
-290 } ;
-291 YAHOO.lang.extend ( KJUR.asn1.cms.SigningCertificate , KJUR.asn1.cms.Attribute ) ;
-292
-293 /**
-294 * class for CMS SigningCertificateV2 attribute
-295 * @name KJUR.asn1.cms.SigningCertificateV2
-296 * @class class for CMS SigningCertificateV2 attribute
-297 * @param {Array} params associative array of parameters
-298 * @extends KJUR.asn1.cms.Attribute
-299 * @since jsrsasign 4.5.1 asn1cms 1.0.1
-300 * @description
-301 * <pre>
-302 * oid-signingCertificateV2 = 1.2.840.113549.1.9.16.2.47
-303 * Attribute ::= SEQUENCE {
-304 * type OBJECT IDENTIFIER,
-305 * values AttributeSetValue }
-306 * AttributeSetValue ::= SET OF ANY
-307 * SigningCertificateV2 ::= SEQUENCE {
-308 * certs SEQUENCE OF ESSCertIDv2,
-309 * policies SEQUENCE OF PolicyInformation OPTIONAL }
-310 * ESSCertIDv2 ::= SEQUENCE {
-311 * hashAlgorithm AlgorithmIdentifier
-312 * DEFAULT {algorithm id-sha256},
-313 * certHash Hash,
-314 * issuerSerial IssuerSerial OPTIONAL }
-315 * Hash ::= OCTET STRING
-316 * IssuerSerial ::= SEQUENCE {
-317 * issuer GeneralNames,
-318 * serialNumber CertificateSerialNumber }
-319 * </pre>
-320 * @example
-321 * // hash algorithm is sha256 by default:
-322 * o = new KJUR.asn1.cms.SigningCertificateV2({array: [certPEM]});
-323 * o = new KJUR.asn1.cms.SigningCertificateV2({array: [certPEM],
-324 * hashAlg: 'sha512'});
-325 */
-326 KJUR.asn1.cms.SigningCertificateV2 = function ( params ) {
-327 KJUR.asn1.cms.SigningCertificateV2.superclass.constructor.call ( this ) ;
-328 this.attrTypeOid = "1.2.840.113549.1.9.16.2.47" ;
-329 var nA = KJUR.asn1 ;
-330 var nX = KJUR.asn1.x509 ;
-331 var nC = KJUR.asn1.cms ;
-332 var nY = KJUR.crypto ;
-333
-334 this.setCerts = function ( listPEM , hashAlg ) {
-335 var list = [ ] ;
-336 for ( var i = 0 ; i < listPEM.length ; i ++ ) {
-337 var hex = KEYUTIL.getHexFromPEM ( listPEM [ i ] ) ;
-338
-339 var a = [ ] ;
-340 if ( hashAlg != "sha256" )
-341 a.push ( new nX.AlgorithmIdentifier ( { name : hashAlg } ) ) ;
-342
-343 var certHashHex = nY.Util.hashHex ( hex , hashAlg ) ;
-344 var dCertHash = new nA.DEROctetString ( { hex : certHashHex } ) ;
-345 dCertHash.getEncodedHex ( ) ;
-346 a.push ( dCertHash ) ;
-347
-348 var dIssuerSerial =
-349 new nC.IssuerAndSerialNumber ( { cert : listPEM [ i ] } ) ;
-350 dIssuerSerial.getEncodedHex ( ) ;
-351 a.push ( dIssuerSerial ) ;
-352
-353 var dESSCertIDv2 =
-354 new nA.DERSequence ( { array : a } ) ;
-355 dESSCertIDv2.getEncodedHex ( ) ;
-356 list.push ( dESSCertIDv2 ) ;
-357 }
-358
-359 var dValue = new nA.DERSequence ( { array : list } ) ;
-360 dValue.getEncodedHex ( ) ;
-361 this.valueList = [ dValue ] ;
-362 } ;
-363
-364 if ( typeof params != "undefined" ) {
-365 if ( typeof params.array == "object" ) {
-366 var hashAlg = "sha256" ; // sha2 default
-367 if ( typeof params.hashAlg == "string" )
-368 hashAlg = params.hashAlg ;
-369 this.setCerts ( params.array , hashAlg ) ;
-370 }
-371 }
-372 } ;
-373 YAHOO.lang.extend ( KJUR.asn1.cms.SigningCertificateV2 , KJUR.asn1.cms.Attribute ) ;
-374
-375 /**
-376 * class for IssuerAndSerialNumber ASN.1 structure for CMS
-377 * @name KJUR.asn1.cms.IssuerAndSerialNumber
-378 * @class class for CMS IssuerAndSerialNumber ASN.1 structure for CMS
-379 * @param {Array} params associative array of parameters
-380 * @extends KJUR.asn1.ASN1Object
-381 * @since jsrsasign 4.2.4 asn1cms 1.0.0
-382 * @description
-383 * <pre>
-384 * IssuerAndSerialNumber ::= SEQUENCE {
-385 * issuer Name,
-386 * serialNumber CertificateSerialNumber }
-387 * CertificateSerialNumber ::= INTEGER
-388 * </pre>
-389 * @example
-390 * // specify by X500Name and DERInteger
-391 * o = new KJUR.asn1.cms.IssuerAndSerialNumber(
-392 * {issuer: {str: '/C=US/O=T1'}, serial {int: 3}});
-393 * // specify by PEM certificate
-394 * o = new KJUR.asn1.cms.IssuerAndSerialNumber({cert: certPEM});
-395 * o = new KJUR.asn1.cms.IssuerAndSerialNumber(certPEM); // since 1.0.3
-396 */
-397 KJUR.asn1.cms.IssuerAndSerialNumber = function ( params ) {
-398 KJUR.asn1.cms.IssuerAndSerialNumber.superclass.constructor.call ( this ) ;
-399 var dIssuer = null ;
-400 var dSerial = null ;
-401 var nA = KJUR.asn1 ;
-402 var nX = nA.x509 ;
-403
-404 /*
-405 * @since asn1cms 1.0.1
-406 */
-407 this.setByCertPEM = function ( certPEM ) {
-408 var certHex = KEYUTIL.getHexFromPEM ( certPEM ) ;
-409 var x = new X509 ( ) ;
-410 x.hex = certHex ;
-411 var issuerTLVHex = x.getIssuerHex ( ) ;
-412 this.dIssuer = new nX.X500Name ( ) ;
-413 this.dIssuer.hTLV = issuerTLVHex ;
-414 var serialVHex = x.getSerialNumberHex ( ) ;
-415 this.dSerial = new nA.DERInteger ( { hex : serialVHex } ) ;
-416 } ;
-417
-418 this.getEncodedHex = function ( ) {
-419 var seq = new KJUR.asn1.DERSequence ( { "array" : [ this.dIssuer ,
-420 this.dSerial ] } ) ;
-421 this.hTLV = seq.getEncodedHex ( ) ;
-422 return this.hTLV ;
-423 } ;
-424
-425 if ( typeof params != "undefined" ) {
-426 if ( typeof params == "string" &&
-427 params.indexOf ( "-----BEGIN " ) != - 1 ) {
-428 this.setByCertPEM ( params ) ;
-429 }
-430 if ( params.issuer && params.serial ) {
-431 if ( params.issuer instanceof KJUR.asn1.x509.X500Name ) {
-432 this.dIssuer = params.issuer ;
-433 } else {
-434 this.dIssuer = new KJUR.asn1.x509.X500Name ( params.issuer ) ;
-435 }
-436 if ( params.serial instanceof KJUR.asn1.DERInteger ) {
-437 this.dSerial = params.serial ;
-438 } else {
-439 this.dSerial = new KJUR.asn1.DERInteger ( params.serial ) ;
-440 }
-441 }
-442 if ( typeof params.cert == "string" ) {
-443 this.setByCertPEM ( params.cert ) ;
-444 }
-445 }
-446 } ;
-447 YAHOO.lang.extend ( KJUR.asn1.cms.IssuerAndSerialNumber , KJUR.asn1.ASN1Object ) ;
-448
-449 /**
-450 * class for Attributes ASN.1 structure for CMS
-451 * @name KJUR.asn1.cms.AttributeList
-452 * @class class for Attributes ASN.1 structure for CMS
-453 * @param {Array} params associative array of parameters
-454 * @extends KJUR.asn1.ASN1Object
-455 * @since jsrsasign 4.2.4 asn1cms 1.0.0
-456 * @description
-457 * <pre>
-458 * Attributes ::= SET OF Attribute
-459 * Attribute ::= SEQUENCE {
-460 * type OBJECT IDENTIFIER,
-461 * values AttributeSetValue }
-462 * </pre>
-463 * @example
-464 * // specify by X500Name and DERInteger
-465 * o = new KJUR.asn1.cms.AttributeList({sorted: false}); // ASN.1 BER unsorted SET OF
-466 * o = new KJUR.asn1.cms.AttributeList(); // ASN.1 DER sorted by default
-467 * o.clear(); // clear list of Attributes
-468 * n = o.length(); // get number of Attribute
-469 * o.add(new KJUR.asn1.cms.SigningTime()); // add SigningTime attribute
-470 * hex = o.getEncodedHex(); // get hex encoded ASN.1 data
-471 */
-472 KJUR.asn1.cms.AttributeList = function ( params ) {
-473 KJUR.asn1.cms.AttributeList.superclass.constructor.call ( this ) ;
-474 this.list = new Array ( ) ;
-475 this.sortFlag = true ;
-476
-477 this.add = function ( item ) {
-478 if ( item instanceof KJUR.asn1.cms.Attribute ) {
-479 this.list.push ( item ) ;
-480 }
-481 } ;
-482
-483 this.length = function ( ) {
-484 return this.list.length ;
-485 } ;
-486
-487 this.clear = function ( ) {
-488 this.list = new Array ( ) ;
-489 this.hTLV = null ;
-490 this.hV = null ;
-491 } ;
-492
-493 this.getEncodedHex = function ( ) {
-494 if ( typeof this.hTLV == "string" ) return this.hTLV ;
-495 var set = new KJUR.asn1.DERSet ( { array : this.list ,
-496 sortflag : this.sortFlag } ) ;
-497 this.hTLV = set.getEncodedHex ( ) ;
-498 return this.hTLV ;
-499 } ;
-500
-501 if ( typeof params != "undefined" ) {
-502 if ( typeof params.sortflag != "undefined" &&
-503 params.sortflag == false )
-504 this.sortFlag = false ;
-505 }
-506 } ;
-507 YAHOO.lang.extend ( KJUR.asn1.cms.AttributeList , KJUR.asn1.ASN1Object ) ;
-508
-509 /**
-510 * class for SignerInfo ASN.1 structure of CMS SignedData
-511 * @name KJUR.asn1.cms.SignerInfo
-512 * @class class for Attributes ASN.1 structure of CMS SigndData
-513 * @param {Array} params associative array of parameters
-514 * @extends KJUR.asn1.ASN1Object
-515 * @since jsrsasign 4.2.4 asn1cms 1.0.0
-516 * @description
-517 * <pre>
-518 * SignerInfo ::= SEQUENCE {
-519 * version CMSVersion,
-520 * sid SignerIdentifier,
-521 * digestAlgorithm DigestAlgorithmIdentifier,
-522 * signedAttrs [0] IMPLICIT SignedAttributes OPTIONAL,
-523 * signatureAlgorithm SignatureAlgorithmIdentifier,
-524 * signature SignatureValue,
-525 * unsignedAttrs [1] IMPLICIT UnsignedAttributes OPTIONAL }
-526 * </pre>
-527 * @example
-528 * o = new KJUR.asn1.cms.SignerInfo();
-529 * o.setSignerIdentifier(certPEMstring);
-530 * o.dSignedAttrs.add(new KJUR.asn1.cms.ContentType({name: 'data'}));
-531 * o.dSignedAttrs.add(new KJUR.asn1.cms.MessageDigest({hex: 'a1b2...'}));
-532 * o.dSignedAttrs.add(new KJUR.asn1.cms.SigningTime());
-533 * o.sign(privteKeyParam, "SHA1withRSA");
-534 */
-535 KJUR.asn1.cms.SignerInfo = function ( params ) {
-536 KJUR.asn1.cms.SignerInfo.superclass.constructor.call ( this ) ;
-537 var nA = KJUR.asn1 ;
-538 var nC = KJUR.asn1.cms ;
-539 var nX = KJUR.asn1.x509 ;
-540
-541 this.dCMSVersion = new nA.DERInteger ( { 'int' : 1 } ) ;
-542 this.dSignerIdentifier = null ;
-543 this.dDigestAlgorithm = null ;
-544 this.dSignedAttrs = new nC.AttributeList ( ) ;
-545 this.dSigAlg = null ;
-546 this.dSig = null ;
-547 this.dUnsignedAttrs = new nC.AttributeList ( ) ;
-548
-549 this.setSignerIdentifier = function ( params ) {
-550 if ( typeof params == "string" &&
-551 params.indexOf ( "CERTIFICATE" ) != - 1 &&
-552 params.indexOf ( "BEGIN" ) != - 1 &&
-553 params.indexOf ( "END" ) != - 1 ) {
-554
-555 var certPEM = params ;
-556 this.dSignerIdentifier =
-557 new nC.IssuerAndSerialNumber ( { cert : params } ) ;
-558 }
-559 } ;
-560
-561 /**
-562 * set ContentType/MessageDigest/DigestAlgorithms for SignerInfo/SignedData
-563 * @name setForContentAndHash
-564 * @memberOf KJUR.asn1.cms.SignerInfo
-565 * @param {Array} params JSON parameter to set content related field
-566 * @description
-567 * This method will specify following fields by a parameters:
-568 * <ul>
-569 * <li>add ContentType signed attribute by encapContentInfo</li>
-570 * <li>add MessageDigest signed attribute by encapContentInfo and hashAlg</li>
-571 * <li>add a hash algorithm used in MessageDigest to digestAlgorithms field of SignedData</li>
-572 * <li>set a hash algorithm used in MessageDigest to digestAlgorithm field of SignerInfo</li>
-573 * </ul>
-574 * Argument 'params' is an associative array having following elements:
-575 * <ul>
-576 * <li>eciObj - {@link KJUR.asn1.cms.EncapsulatedContentInfo} object</li>
-577 * <li>sdObj - {@link KJUR.asn1.cms.SignedData} object (Option) to set DigestAlgorithms</li>
-578 * <li>hashAlg - string of hash algorithm name which is used for MessageDigest attribute</li>
-579 * </ul>
-580 * some of elements can be omited.
-581 * @example
-582 * sd = new KJUR.asn1.cms.SignedData();
-583 * signerInfo.setForContentAndHash({sdObj: sd,
-584 * eciObj: sd.dEncapContentInfo,
-585 * hashAlg: 'sha256'});
-586 */
-587 this.setForContentAndHash = function ( params ) {
-588 if ( typeof params != "undefined" ) {
-589 if ( params.eciObj instanceof KJUR.asn1.cms.EncapsulatedContentInfo ) {
-590 this.dSignedAttrs.add ( new nC.ContentType ( { oid : '1.2.840.113549.1.7.1' } ) ) ;
-591 this.dSignedAttrs.add ( new nC.MessageDigest ( { eciObj : params.eciObj ,
-592 hashAlg : params.hashAlg } ) ) ;
-593 }
-594 if ( typeof params.sdObj != "undefined" &&
-595 params.sdObj instanceof KJUR.asn1.cms.SignedData ) {
-596 if ( params.sdObj.digestAlgNameList.join ( ":" ) . indexOf ( params.hashAlg ) == - 1 ) {
-597 params.sdObj.digestAlgNameList.push ( params.hashAlg ) ;
-598 }
-599 }
-600 if ( typeof params.hashAlg == "string" ) {
-601 this.dDigestAlgorithm = new nX.AlgorithmIdentifier ( { name : params.hashAlg } ) ;
-602 }
-603 }
-604 } ;
-605
-606 this.sign = function ( keyParam , sigAlg ) {
-607 // set algorithm
-608 this.dSigAlg = new nX.AlgorithmIdentifier ( { name : sigAlg } ) ;
-609
-610 // set signature
-611 var data = this.dSignedAttrs.getEncodedHex ( ) ;
-612 var prvKey = KEYUTIL.getKey ( keyParam ) ;
-613 var sig = new KJUR.crypto.Signature ( { alg : sigAlg } ) ;
-614 sig.init ( prvKey ) ;
-615 sig.updateHex ( data ) ;
-616 var sigValHex = sig.sign ( ) ;
-617 this.dSig = new nA.DEROctetString ( { hex : sigValHex } ) ;
-618 } ;
-619
-620 /*
-621 * @since asn1cms 1.0.3
-622 */
-623 this.addUnsigned = function ( attr ) {
-624 this.hTLV = null ;
-625 this.dUnsignedAttrs.hTLV = null ;
-626 this.dUnsignedAttrs.add ( attr ) ;
-627 } ;
-628
-629 this.getEncodedHex = function ( ) {
-630 //alert("sattrs.hTLV=" + this.dSignedAttrs.hTLV);
-631 if ( this.dSignedAttrs instanceof KJUR.asn1.cms.AttributeList &&
-632 this.dSignedAttrs.length ( ) == 0 ) {
-633 throw "SignedAttrs length = 0 (empty)" ;
-634 }
-635 var sa = new nA.DERTaggedObject ( { obj : this.dSignedAttrs ,
-636 tag : 'a0' , explicit : false } ) ;
-637 var ua = null ; ;
-638 if ( this.dUnsignedAttrs.length ( ) > 0 ) {
-639 ua = new nA.DERTaggedObject ( { obj : this.dUnsignedAttrs ,
-640 tag : 'a1' , explicit : false } ) ;
-641 }
-642
-643 var items = [
-644 this.dCMSVersion ,
-645 this.dSignerIdentifier ,
-646 this.dDigestAlgorithm ,
-647 sa ,
-648 this.dSigAlg ,
-649 this.dSig ,
-650 ] ;
-651 if ( ua != null ) items.push ( ua ) ;
-652
-653 var seq = new nA.DERSequence ( { array : items } ) ;
-654 this.hTLV = seq.getEncodedHex ( ) ;
-655 return this.hTLV ;
-656 } ;
-657 } ;
-658 YAHOO.lang.extend ( KJUR.asn1.cms.SignerInfo , KJUR.asn1.ASN1Object ) ;
-659
-660 /**
-661 * class for EncapsulatedContentInfo ASN.1 structure for CMS
-662 * @name KJUR.asn1.cms.EncapsulatedContentInfo
-663 * @class class for EncapsulatedContentInfo ASN.1 structure for CMS
-664 * @param {Array} params associative array of parameters
-665 * @extends KJUR.asn1.ASN1Object
-666 * @since jsrsasign 4.2.4 asn1cms 1.0.0
-667 * @description
-668 * <pre>
-669 * EncapsulatedContentInfo ::= SEQUENCE {
-670 * eContentType ContentType,
-671 * eContent [0] EXPLICIT OCTET STRING OPTIONAL }
-672 * ContentType ::= OBJECT IDENTIFIER
-673 * </pre>
-674 * @example
-675 * o = new KJUR.asn1.cms.EncapsulatedContentInfo();
-676 * o.setContentType('1.2.3.4.5'); // specify eContentType by OID
-677 * o.setContentType('data'); // specify eContentType by name
-678 * o.setContentValueHex('a1a2a4...'); // specify eContent data by hex string
-679 * o.setContentValueStr('apple'); // specify eContent data by UTF-8 string
-680 * // for detached contents (i.e. data not concluded in eContent)
-681 * o.isDetached = true; // false as default
-682 */
-683 KJUR.asn1.cms.EncapsulatedContentInfo = function ( params ) {
-684 KJUR.asn1.cms.EncapsulatedContentInfo.superclass.constructor.call ( this ) ;
-685 var nA = KJUR.asn1 ;
-686 var nC = KJUR.asn1.cms ;
-687 var nX = KJUR.asn1.x509 ;
-688 this.dEContentType = new nA.DERObjectIdentifier ( { name : 'data' } ) ;
-689 this.dEContent = null ;
-690 this.isDetached = false ;
-691 this.eContentValueHex = null ;
-692
-693 this.setContentType = function ( nameOrOid ) {
-694 if ( nameOrOid.match ( /^[0-2][.][0-9.]+$/ ) ) {
-695 this.dEContentType = new nA.DERObjectIdentifier ( { oid : nameOrOid } ) ;
-696 } else {
-697 this.dEContentType = new nA.DERObjectIdentifier ( { name : nameOrOid } ) ;
-698 }
-699 } ;
-700
-701 this.setContentValue = function ( params ) {
-702 if ( typeof params != "undefined" ) {
-703 if ( typeof params.hex == "string" ) {
-704 this.eContentValueHex = params.hex ;
-705 } else if ( typeof params.str == "string" ) {
-706 this.eContentValueHex = utf8tohex ( params.str ) ;
-707 }
-708 }
-709 } ;
-710
-711 this.setContentValueHex = function ( valueHex ) {
-712 this.eContentValueHex = valueHex ;
-713 } ;
-714
-715 this.setContentValueStr = function ( valueStr ) {
-716 this.eContentValueHex = utf8tohex ( valueStr ) ;
-717 } ;
-718
-719 this.getEncodedHex = function ( ) {
-720 if ( typeof this.eContentValueHex != "string" ) {
-721 throw "eContentValue not yet set" ;
-722 }
-723
-724 var dValue = new nA.DEROctetString ( { hex : this.eContentValueHex } ) ;
-725 this.dEContent = new nA.DERTaggedObject ( { obj : dValue ,
-726 tag : 'a0' ,
-727 explicit : true } ) ;
-728
-729 var a = [ this.dEContentType ] ;
-730 if ( ! this.isDetached ) a.push ( this.dEContent ) ;
-731 var seq = new nA.DERSequence ( { array : a } ) ;
-732 this.hTLV = seq.getEncodedHex ( ) ;
-733 return this.hTLV ;
-734 } ;
-735 } ;
-736 YAHOO.lang.extend ( KJUR.asn1.cms.EncapsulatedContentInfo , KJUR.asn1.ASN1Object ) ;
-737
-738 // - type
-739 // - obj
-740 /**
-741 * class for ContentInfo ASN.1 structure for CMS
-742 * @name KJUR.asn1.cms.ContentInfo
-743 * @class class for ContentInfo ASN.1 structure for CMS
-744 * @param {Array} params associative array of parameters
-745 * @extends KJUR.asn1.ASN1Object
-746 * @since jsrsasign 4.2.4 asn1cms 1.0.0
-747 * @description
-748 * <pre>
-749 * ContentInfo ::= SEQUENCE {
-750 * contentType ContentType,
-751 * content [0] EXPLICIT ANY DEFINED BY contentType }
-752 * ContentType ::= OBJECT IDENTIFIER
-753 * </pre>
-754 * @example
-755 * a = [new KJUR.asn1.DERInteger({int: 1}),
-756 * new KJUR.asn1.DERInteger({int: 2})];
-757 * seq = new KJUR.asn1.DERSequence({array: a});
-758 * o = new KJUR.asn1.cms.ContentInfo({type: 'data', obj: seq});
-759 */
-760 KJUR.asn1.cms.ContentInfo = function ( params ) {
-761 KJUR.asn1.cms.ContentInfo.superclass.constructor.call ( this ) ;
-762 var nA = KJUR.asn1 ;
-763 var nC = KJUR.asn1.cms ;
-764 var nX = KJUR.asn1.x509 ;
-765
-766 this.dContentType = null ;
-767 this.dContent = null ;
-768
-769 this.setContentType = function ( params ) {
-770 if ( typeof params == "string" ) {
-771 this.dContentType = nX.OID.name2obj ( params ) ;
-772 }
-773 } ;
-774
-775 this.getEncodedHex = function ( ) {
-776 var dContent0 = new nA.DERTaggedObject ( { obj : this.dContent , tag : 'a0' , explicit : true } ) ;
-777 var seq = new nA.DERSequence ( { array : [ this.dContentType , dContent0 ] } ) ;
-778 this.hTLV = seq.getEncodedHex ( ) ;
-779 return this.hTLV ;
-780 } ;
-781
-782 if ( typeof params != "undefined" ) {
-783 if ( params.type ) this.setContentType ( params.type ) ;
-784 if ( params.obj && params.obj instanceof nA.ASN1Object ) this.dContent = params.obj ;
-785 }
-786 } ;
-787 YAHOO.lang.extend ( KJUR.asn1.cms.ContentInfo , KJUR.asn1.ASN1Object ) ;
-788
-789 /**
-790 * class for SignerInfo ASN.1 structure of CMS SignedData
-791 * @name KJUR.asn1.cms.SignedData
-792 * @class class for Attributes ASN.1 structure of CMS SigndData
-793 * @param {Array} params associative array of parameters
-794 * @extends KJUR.asn1.ASN1Object
-795 * @since jsrsasign 4.2.4 asn1cms 1.0.0
-796 *
-797 * @description
-798 * <pre>
-799 * SignedData ::= SEQUENCE {
-800 * version CMSVersion,
-801 * digestAlgorithms DigestAlgorithmIdentifiers,
-802 * encapContentInfo EncapsulatedContentInfo,
-803 * certificates [0] IMPLICIT CertificateSet OPTIONAL,
-804 * crls [1] IMPLICIT RevocationInfoChoices OPTIONAL,
-805 * signerInfos SignerInfos }
-806 * SignerInfos ::= SET OF SignerInfo
-807 * CertificateSet ::= SET OF CertificateChoices
-808 * DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier
-809 * CertificateSet ::= SET OF CertificateChoices
-810 * RevocationInfoChoices ::= SET OF RevocationInfoChoice
-811 * </pre>
-812 *
-813 * @example
-814 * sd = new KJUR.asn1.cms.SignedData();
-815 * sd.dEncapContentInfo.setContentValueStr("test string");
-816 * sd.signerInfoList[0].setForContentAndHash({sdObj: sd,
-817 * eciObj: sd.dEncapContentInfo,
-818 * hashAlg: 'sha256'});
-819 * sd.signerInfoList[0].dSignedAttrs.add(new KJUR.asn1.cms.SigningTime());
-820 * sd.signerInfoList[0].setSignerIdentifier(certPEM);
-821 * sd.signerInfoList[0].sign(prvP8PEM, "SHA256withRSA");
-822 * hex = sd.getContentInfoEncodedHex();
-823 */
-824 KJUR.asn1.cms.SignedData = function ( params ) {
-825 KJUR.asn1.cms.SignedData.superclass.constructor.call ( this ) ;
-826 var nA = KJUR.asn1 ;
-827 var nC = KJUR.asn1.cms ;
-828 var nX = KJUR.asn1.x509 ;
-829
-830 this.dCMSVersion = new nA.DERInteger ( { 'int' : 1 } ) ;
-831 this.dDigestAlgs = null ;
-832 this.digestAlgNameList = [ ] ;
-833 this.dEncapContentInfo = new nC.EncapsulatedContentInfo ( ) ;
-834 this.dCerts = null ;
-835 this.certificateList = [ ] ;
-836 this.crlList = [ ] ;
-837 this.signerInfoList = [ new nC.SignerInfo ( ) ] ;
-838
-839 this.addCertificatesByPEM = function ( certPEM ) {
-840 var hex = KEYUTIL.getHexFromPEM ( certPEM ) ;
-841 var o = new nA.ASN1Object ( ) ;
-842 o.hTLV = hex ;
-843 this.certificateList.push ( o ) ;
-844 } ;
-845
-846 this.getEncodedHex = function ( ) {
-847 if ( typeof this.hTLV == "string" ) return this.hTLV ;
-848
-849 if ( this.dDigestAlgs == null ) {
-850 var digestAlgList = [ ] ;
-851 for ( var i = 0 ; i < this.digestAlgNameList.length ; i ++ ) {
-852 var name = this.digestAlgNameList [ i ] ;
-853 var o = new nX.AlgorithmIdentifier ( { name : name } ) ;
-854 digestAlgList.push ( o ) ;
-855 }
-856 this.dDigestAlgs = new nA.DERSet ( { array : digestAlgList } ) ;
-857 }
-858
-859 var a = [ this.dCMSVersion ,
-860 this.dDigestAlgs ,
-861 this.dEncapContentInfo ] ;
-862
-863 if ( this.dCerts == null ) {
-864 if ( this.certificateList.length > 0 ) {
-865 var o1 = new nA.DERSet ( { array : this.certificateList } ) ;
-866 this.dCerts
-867 = new nA.DERTaggedObject ( { obj : o1 ,
-868 tag : 'a0' ,
-869 explicit : false } ) ;
-870 }
-871 }
-872 if ( this.dCerts != null ) a.push ( this.dCerts ) ;
-873
-874 var dSignerInfos = new nA.DERSet ( { array : this.signerInfoList } ) ;
-875 a.push ( dSignerInfos ) ;
-876
-877 var seq = new nA.DERSequence ( { array : a } ) ;
-878 this.hTLV = seq.getEncodedHex ( ) ;
-879 return this.hTLV ;
-880 } ;
-881
-882 this.getContentInfo = function ( ) {
-883 this.getEncodedHex ( ) ;
-884 var ci = new nC.ContentInfo ( { type : 'signed-data' , obj : this } ) ;
-885 return ci ;
-886 } ;
-887
-888 this.getContentInfoEncodedHex = function ( ) {
-889 var ci = this.getContentInfo ( ) ;
-890 var ciHex = ci.getEncodedHex ( ) ;
-891 return ciHex ;
-892 } ;
-893
-894 this.getPEM = function ( ) {
-895 var hex = this.getContentInfoEncodedHex ( ) ;
-896 var pem = nA.ASN1Util.getPEMStringFromHex ( hex , "CMS" ) ;
-897 return pem ;
-898 } ;
-899 } ;
-900 YAHOO.lang.extend ( KJUR.asn1.cms.SignedData , KJUR.asn1.ASN1Object ) ;
-901
-902 /**
-903 * CMS utiliteis class
-904 * @name KJUR.asn1.cms.CMSUtil
-905 * @class CMS utilities class
-906 */
-907 KJUR.asn1.cms.CMSUtil = new function ( ) {
-908 } ;
-909 /**
-910 * generate SignedData object specified by JSON parameters
-911 * @name newSignedData
-912 * @memberOf KJUR.asn1.cms.CMSUtil
-913 * @function
-914 * @param {Array} param JSON parameter to generate CMS SignedData
-915 * @return {KJUR.asn1.cms.SignedData} object just generated
-916 * @description
-917 * This method provides more easy way to genereate
-918 * CMS SignedData ASN.1 structure by JSON data.
-919 * @example
-920 * var sd = KJUR.asn1.cms.CMSUtil.newSignedData({
-921 * content: {str: "jsrsasign"},
-922 * certs: [certPEM],
-923 * signerInfos: [{
-924 * hashAlg: 'sha256',
-925 * sAttr: {
-926 * SigningTime: {}
-927 * SigningCertificateV2: {array: [certPEM]},
-928 * },
-929 * signerCert: certPEM,
-930 * sigAlg: 'SHA256withRSA',
-931 * signerPrvKey: prvPEM
-932 * }]
-933 * });
-934 */
-935 KJUR.asn1.cms.CMSUtil.newSignedData = function ( param ) {
-936 var nC = KJUR.asn1.cms ;
-937 var nE = KJUR.asn1.cades ;
-938 var sd = new nC.SignedData ( ) ;
-939
-940 sd.dEncapContentInfo.setContentValue ( param.content ) ;
-941
-942 if ( typeof param.certs == "object" ) {
-943 for ( var i = 0 ; i < param.certs.length ; i ++ ) {
-944 sd.addCertificatesByPEM ( param.certs [ i ] ) ;
-945 }
-946 }
-947
-948 sd.signerInfoList = [ ] ;
-949 for ( var i = 0 ; i < param.signerInfos.length ; i ++ ) {
-950 var siParam = param.signerInfos [ i ] ;
-951 var si = new nC.SignerInfo ( ) ;
-952 si.setSignerIdentifier ( siParam.signerCert ) ;
-953
-954 si.setForContentAndHash ( { sdObj : sd ,
-955 eciObj : sd.dEncapContentInfo ,
-956 hashAlg : siParam.hashAlg } ) ;
-957
-958 for ( attrName in siParam.sAttr ) {
-959 var attrParam = siParam.sAttr [ attrName ] ;
-960 if ( attrName == "SigningTime" ) {
-961 var attr = new nC.SigningTime ( attrParam ) ;
-962 si.dSignedAttrs.add ( attr ) ;
-963 }
-964 if ( attrName == "SigningCertificate" ) {
-965 var attr = new nC.SigningCertificate ( attrParam ) ;
-966 si.dSignedAttrs.add ( attr ) ;
-967 }
-968 if ( attrName == "SigningCertificateV2" ) {
-969 var attr = new nC.SigningCertificateV2 ( attrParam ) ;
-970 si.dSignedAttrs.add ( attr ) ;
-971 }
-972 if ( attrName == "SignaturePolicyIdentifier" ) {
-973 var attr = new nE.SignaturePolicyIdentifier ( attrParam ) ;
-974 si.dSignedAttrs.add ( attr ) ;
-975 }
-976 }
-977
-978 si.sign ( siParam.signerPrvKey , siParam.sigAlg ) ;
-979 sd.signerInfoList.push ( si ) ;
-980 }
-981
-982 return sd ;
-983 } ;
-984
-985
\ No newline at end of file
diff --git a/jwt/api/symbols/src/asn1csr-1.0.js.html b/jwt/api/symbols/src/asn1csr-1.0.js.html
deleted file mode 100644
index 0040e3e..0000000
--- a/jwt/api/symbols/src/asn1csr-1.0.js.html
+++ /dev/null
@@ -1,318 +0,0 @@
-
1 /*! asn1csr-1.0.0.js (c) 2015 Kenji Urushima | kjur.github.com/jsrsasign/license
- 2 */
- 3 /*
- 4 * asn1csr.js - ASN.1 DER encoder classes for PKCS#10 CSR
- 5 *
- 6 * Copyright (c) 2015 Kenji Urushima (kenji.urushima@gmail.com)
- 7 *
- 8 * This software is licensed under the terms of the MIT License.
- 9 * http://kjur.github.com/jsrsasign/license
- 10 *
- 11 * The above copyright and license notice shall be
- 12 * included in all copies or substantial portions of the Software.
- 13 */
- 14
- 15 /**
- 16 * @fileOverview
- 17 * @name asn1csr-1.0.js
- 18 * @author Kenji Urushima kenji.urushima@gmail.com
- 19 * @version 1.0.0 (2015-Sep-12)
- 20 * @since jsrsasign 4.8.7
- 21 * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a>
- 22 */
- 23
- 24 /**
- 25 * kjur's ASN.1 class for CSR/PKCS#10 name space
- 26 * <p>
- 27 * This name space is a sub name space for {@link KJUR.asn1}.
- 28 * This name space contains classes for
- 29 * <a href="https://tools.ietf.org/html/rfc2986">RFC 2986</a>
- 30 * certificate signing request(CSR/PKCS#10) and its utilities
- 31 * to be issued your certificate from certification authorities.
- 32 * <h4>PROVIDING ASN.1 STRUCTURES</h4>
- 33 * <ul>
- 34 * <li>{@link KJUR.asn1.csr.CertificationRequest}</li>
- 35 * <li>{@link KJUR.asn1.csr.CertificationRequestInfo}</li>
- 36 * </ul>
- 37 * <h4>PROVIDING UTILITY CLASSES</h4>
- 38 * <ul>
- 39 * <li>{@link KJUR.asn1.csr.CSRUtil}</li>
- 40 * </ul>
- 41 * {@link KJUR.asn1.csr.CSRUtil.newCSRPEM} method is very useful to
- 42 * get your certificate signing request (CSR/PKCS#10) file.
- 43 * </p>
- 44 * @name KJUR.asn1.csr
- 45 * @namespace
- 46 */
- 47 if ( typeof KJUR.asn1.csr == "undefined" || ! KJUR.asn1.csr ) KJUR.asn1.csr = { } ;
- 48
- 49 /**
- 50 * ASN.1 CertificationRequest structure class
- 51 * @name KJUR.asn1.csr.CertificationRequest
- 52 * @class ASN.1 CertificationRequest structure class
- 53 * @param {Array} params associative array of parameters (ex. {})
- 54 * @extends KJUR.asn1.ASN1Object
- 55 * @since jsrsasign 4.8.7 asn1csr 1.0.0
- 56 * @description
- 57 * <br/>
- 58 * @example
- 59 * csri = new KJUR.asn1.csr.CertificationRequestInfo();
- 60 * csri.setSubjectByParam({'str': '/C=US/O=Test/CN=example.com'});
- 61 * csri.setSubjectPublicKeyByGetKey(pubKeyObj);
- 62 * csr = new KJUR.asn1.csr.CertificationRequest({'csrinfo': csri});
- 63 * csr.sign("SHA256withRSA", prvKeyObj);
- 64 * pem = csr.getPEMString();
- 65 *
- 66 * // -- DEFINITION OF ASN.1 SYNTAX --
- 67 * // CertificationRequest ::= SEQUENCE {
- 68 * // certificationRequestInfo CertificationRequestInfo,
- 69 * // signatureAlgorithm AlgorithmIdentifier{{ SignatureAlgorithms }},
- 70 * // signature BIT STRING }
- 71 */
- 72 KJUR.asn1.csr.CertificationRequest = function ( params ) {
- 73 KJUR.asn1.csr.CertificationRequest.superclass.constructor.call ( this ) ;
- 74 var asn1CSRInfo = null ;
- 75 var asn1SignatureAlg = null ;
- 76 var asn1Sig = null ;
- 77 var hexSig = null ;
- 78 var prvKey = null ;
- 79
- 80 /**
- 81 * sign CertificationRequest and set signature value internally
- 82 * @name sign
- 83 * @memberOf KJUR.asn1.csr.CertificationRequest
- 84 * @function
- 85 * @description
- 86 * This method self-signs CertificateRequestInfo with a subject's
- 87 * private key and set signature value internally.
- 88 * <br/>
- 89 * @example
- 90 * csr = new KJUR.asn1.csr.CertificationRequest({'csrinfo': csri});
- 91 * csr.sign("SHA256withRSA", prvKeyObj);
- 92 */
- 93 this.sign = function ( sigAlgName , prvKeyObj ) {
- 94 if ( this.prvKey == null ) this.prvKey = prvKeyObj ;
- 95
- 96 this.asn1SignatureAlg =
- 97 new KJUR.asn1.x509.AlgorithmIdentifier ( { 'name' : sigAlgName } ) ;
- 98
- 99 sig = new KJUR.crypto.Signature ( { 'alg' : sigAlgName } ) ;
-100 sig.initSign ( this.prvKey ) ;
-101 sig.updateHex ( this.asn1CSRInfo.getEncodedHex ( ) ) ;
-102 this.hexSig = sig.sign ( ) ;
-103
-104 this.asn1Sig = new KJUR.asn1.DERBitString ( { 'hex' : '00' + this.hexSig } ) ;
-105 var seq = new KJUR.asn1.DERSequence ( { 'array' : [ this.asn1CSRInfo ,
-106 this.asn1SignatureAlg ,
-107 this.asn1Sig ] } ) ;
-108 this.hTLV = seq.getEncodedHex ( ) ;
-109 this.isModified = false ;
-110 } ;
-111
-112 /**
-113 * get PEM formatted certificate signing request (CSR/PKCS#10)
-114 * @name getPEMString
-115 * @memberOf KJUR.asn1.csr.CertificationRequest
-116 * @function
-117 * @return PEM formatted string of CSR/PKCS#10
-118 * @description
-119 * This method is to a get CSR PEM string after signed.
-120 * <br/>
-121 * @example
-122 * csr = new KJUR.asn1.csr.CertificationRequest({'csrinfo': csri});
-123 * csr.sign();
-124 * pem = csr.getPEMString();
-125 * // pem will be following:
-126 * // -----BEGIN CERTIFICATE REQUEST-----
-127 * // MII ...snip...
-128 * // -----END CERTIFICATE REQUEST-----
-129 */
-130 this.getPEMString = function ( ) {
-131 var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex ( this.getEncodedHex ( ) ,
-132 "CERTIFICATE REQUEST" ) ;
-133 return pem ;
-134 } ;
-135
-136 this.getEncodedHex = function ( ) {
-137 if ( this.isModified == false && this.hTLV != null ) return this.hTLV ;
-138 throw "not signed yet" ;
-139 } ;
-140
-141 if ( typeof params != "undefined" ) {
-142 if ( typeof params [ 'csrinfo' ] != "undefined" ) {
-143 this.asn1CSRInfo = params [ 'csrinfo' ] ;
-144 }
-145 }
-146 } ;
-147 YAHOO.lang.extend ( KJUR.asn1.csr.CertificationRequest , KJUR.asn1.ASN1Object ) ;
-148
-149 /**
-150 * ASN.1 CertificationRequestInfo structure class
-151 * @name KJUR.asn1.csr.CertificationRequestInfo
-152 * @class ASN.1 CertificationRequestInfo structure class
-153 * @param {Array} params associative array of parameters (ex. {})
-154 * @extends KJUR.asn1.ASN1Object
-155 * @since jsrsasign 4.8.7 asn1csr 1.0.0
-156 * @description
-157 * <br/>
-158 * @example
-159 * csri = new KJUR.asn1.csr.CertificationRequestInfo();
-160 * csri.setSubjectByParam({'str': '/C=US/O=Test/CN=example.com'});
-161 * csri.setSubjectPublicKeyByGetKey(pubKeyObj);
-162 *
-163 * // -- DEFINITION OF ASN.1 SYNTAX --
-164 * // CertificationRequestInfo ::= SEQUENCE {
-165 * // version INTEGER { v1(0) } (v1,...),
-166 * // subject Name,
-167 * // subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }},
-168 * // attributes [0] Attributes{{ CRIAttributes }} }
-169 *
-170 */
-171 KJUR.asn1.csr.CertificationRequestInfo = function ( params ) {
-172 KJUR.asn1.csr.CertificationRequestInfo.superclass.constructor.call ( this ) ;
-173
-174 this._initialize = function ( ) {
-175 this.asn1Array = new Array ( ) ;
-176
-177 this.asn1Version = new KJUR.asn1.DERInteger ( { 'int' : 0 } ) ;
-178 this.asn1Subject = null ;
-179 this.asn1SubjPKey = null ;
-180 this.extensionsArray = new Array ( ) ;
-181 } ;
-182
-183 /**
-184 * set subject name field by parameter
-185 * @name setSubjectByParam
-186 * @memberOf KJUR.asn1.csr.CertificationRequestInfo
-187 * @function
-188 * @param {Array} x500NameParam X500Name parameter
-189 * @description
-190 * @example
-191 * csri.setSubjectByParam({'str': '/C=US/CN=b'});
-192 * @see KJUR.asn1.x509.X500Name
-193 */
-194 this.setSubjectByParam = function ( x500NameParam ) {
-195 this.asn1Subject = new KJUR.asn1.x509.X500Name ( x500NameParam ) ;
-196 } ;
-197
-198 /**
-199 * set subject public key info by RSA/ECDSA/DSA key parameter
-200 * @name setSubjectPublicKeyByGetKey
-201 * @memberOf KJUR.asn1.csr.CertificationRequestInfo
-202 * @function
-203 * @param {Object} keyParam public key parameter which passed to {@link KEYUTIL.getKey} argument
-204 * @description
-205 * @example
-206 * csri.setSubjectPublicKeyByGetKeyParam(certPEMString); // or
-207 * csri.setSubjectPublicKeyByGetKeyParam(pkcs8PublicKeyPEMString); // or
-208 * csir.setSubjectPublicKeyByGetKeyParam(kjurCryptoECDSAKeyObject); // et.al.
-209 * @see KJUR.asn1.x509.SubjectPublicKeyInfo
-210 * @see KEYUTIL.getKey
-211 */
-212 this.setSubjectPublicKeyByGetKey = function ( keyParam ) {
-213 var keyObj = KEYUTIL.getKey ( keyParam ) ;
-214 this.asn1SubjPKey = new KJUR.asn1.x509.SubjectPublicKeyInfo ( keyObj ) ;
-215 } ;
-216
-217 this.getEncodedHex = function ( ) {
-218 this.asn1Array = new Array ( ) ;
-219
-220 this.asn1Array.push ( this.asn1Version ) ;
-221 this.asn1Array.push ( this.asn1Subject ) ;
-222 this.asn1Array.push ( this.asn1SubjPKey ) ;
-223
-224 var extSeq = new KJUR.asn1.DERSequence ( { "array" : this.extensionsArray } ) ;
-225 var extTagObj = new KJUR.asn1.DERTaggedObject ( { 'explicit' : false ,
-226 'tag' : 'a0' ,
-227 'obj' : extSeq } ) ;
-228 this.asn1Array.push ( extTagObj ) ;
-229
-230 var o = new KJUR.asn1.DERSequence ( { "array" : this.asn1Array } ) ;
-231 this.hTLV = o.getEncodedHex ( ) ;
-232 this.isModified = false ;
-233 return this.hTLV ;
-234 } ;
-235
-236 this._initialize ( ) ;
-237 } ;
-238 YAHOO.lang.extend ( KJUR.asn1.csr.CertificationRequestInfo , KJUR.asn1.ASN1Object ) ;
-239
-240 /**
-241 * Certification Request (CSR/PKCS#10) utilities class
-242 * @name KJUR.asn1.csr.CSRUtil
-243 * @class Certification Request (CSR/PKCS#10) utilities class
-244 */
-245 KJUR.asn1.csr.CSRUtil = new function ( ) {
-246 } ;
-247
-248 /**
-249 * generate a PEM format of CSR/PKCS#10 certificate signing request
-250 * @name newCSRPEM
-251 * @memberOf KJUR.asn1.csr.CSRUtil
-252 * @function
-253 * @param {Array} param parameter to generate CSR
-254 * @since jsrsasign 4.8.7 asn1csr 1.0.0
-255 * @description
-256 * This method can generate a CSR certificate signing
-257 * request by a simple JSON object which has following parameters:
-258 * <ul>
-259 * <li>subject - parameter to be passed to {@link KJUR.asn1.x509.X500Name}</li>
-260 * <li>sbjpubkey - parameter to be passed to {@link KEYUTIL.getKey}</li>
-261 * <li>sigalg - signature algorithm name (ex. SHA256withRSA)</li>
-262 * <li>sbjprvkey - parameter to be passed to {@link KEYUTIL.getKey}</li>
-263 * </ul>
-264 *
-265 * @example
-266 * // 1) by key object
-267 * pem = KJUR.asn1.csr.CSRUtil.newCSRPEM({
-268 * subject: {str: '/C=US/O=Test/CN=example.com'},
-269 * sbjpubkey: pubKeyObj,
-270 * sigalg: "SHA256withRSA",
-271 * sbjprvkey: prvKeyObj
-272 * });
-273 *
-274 * // 2) by private/public key PEM
-275 * pem = KJUR.asn1.csr.CSRUtil.newCSRPEM({
-276 * subject: {str: '/C=US/O=Test/CN=example.com'},
-277 * sbjpubkey: pubKeyPEM,
-278 * sigalg: "SHA256withRSA",
-279 * sbjprvkey: prvKeyPEM
-280 * });
-281 *
-282 * // 3) with generateKeypair
-283 * kp = KEYUTIL.generateKeypair("RSA", 2048);
-284 * pem = KJUR.asn1.csr.CSRUtil.newCSRPEM({
-285 * subject: {str: '/C=US/O=Test/CN=example.com'},
-286 * sbjpubkey: kp.pubKeyObj,
-287 * sigalg: "SHA256withRSA",
-288 * sbjprvkey: kp.prvKeyObj
-289 * });
-290 */
-291 KJUR.asn1.csr.CSRUtil.newCSRPEM = function ( param ) {
-292 var ns1 = KJUR.asn1.csr ;
-293
-294 if ( param.subject === undefined ) throw "parameter subject undefined" ;
-295 if ( param.sbjpubkey === undefined ) throw "parameter sbjpubkey undefined" ;
-296 if ( param.sigalg === undefined ) throw "parameter sigalg undefined" ;
-297 if ( param.sbjprvkey === undefined ) throw "parameter sbjpubkey undefined" ;
-298
-299 var csri = new ns1.CertificationRequestInfo ( ) ;
-300 csri.setSubjectByParam ( param.subject ) ;
-301 csri.setSubjectPublicKeyByGetKey ( param.sbjpubkey ) ;
-302
-303 var csr = new ns1.CertificationRequest ( { 'csrinfo' : csri } ) ;
-304 var prvKey = KEYUTIL.getKey ( param.sbjprvkey ) ;
-305 csr.sign ( param.sigalg , prvKey ) ;
-306
-307 var pem = csr.getPEMString ( ) ;
-308 return pem ;
-309 } ;
-310
-311
\ No newline at end of file
diff --git a/jwt/api/symbols/src/asn1hex-1.1.js.html b/jwt/api/symbols/src/asn1hex-1.1.js.html
deleted file mode 100644
index 7e3f7ae..0000000
--- a/jwt/api/symbols/src/asn1hex-1.1.js.html
+++ /dev/null
@@ -1,613 +0,0 @@
-
1 /*! asn1hex-1.1.6.js (c) 2012-2016 Kenji Urushima | kjur.github.com/jsrsasign/license
- 2 */
- 3 /*
- 4 * asn1hex.js - Hexadecimal represented ASN.1 string library
- 5 *
- 6 * Copyright (c) 2010-2016 Kenji Urushima (kenji.urushima@gmail.com)
- 7 *
- 8 * This software is licensed under the terms of the MIT License.
- 9 * http://kjur.github.com/jsrsasign/license/
- 10 *
- 11 * The above copyright and license notice shall be
- 12 * included in all copies or substantial portions of the Software.
- 13 */
- 14
- 15 /**
- 16 * @fileOverview
- 17 * @name asn1hex-1.1.js
- 18 * @author Kenji Urushima kenji.urushima@gmail.com
- 19 * @version asn1hex 1.1.6 (2015-Jun-11)
- 20 * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a>
- 21 */
- 22
- 23 /*
- 24 * MEMO:
- 25 * f('3082025b02...', 2) ... 82025b ... 3bytes
- 26 * f('020100', 2) ... 01 ... 1byte
- 27 * f('0203001...', 2) ... 03 ... 1byte
- 28 * f('02818003...', 2) ... 8180 ... 2bytes
- 29 * f('3080....0000', 2) ... 80 ... -1
- 30 *
- 31 * Requirements:
- 32 * - ASN.1 type octet length MUST be 1.
- 33 * (i.e. ASN.1 primitives like SET, SEQUENCE, INTEGER, OCTETSTRING ...)
- 34 */
- 35
- 36 /**
- 37 * ASN.1 DER encoded hexadecimal string utility class
- 38 * @name ASN1HEX
- 39 * @class ASN.1 DER encoded hexadecimal string utility class
- 40 * @since jsrsasign 1.1
- 41 * @description
- 42 * This class provides a parser for hexadecimal string of
- 43 * DER encoded ASN.1 binary data.
- 44 * Here are major methods of this class.
- 45 * <ul>
- 46 * <li><b>ACCESS BY POSITION</b>
- 47 * <ul>
- 48 * <li>{@link ASN1HEX.getHexOfTLV_AtObj} - get ASN.1 TLV at specified position</li>
- 49 * <li>{@link ASN1HEX.getHexOfV_AtObj} - get ASN.1 V at specified position</li>
- 50 * <li>{@link ASN1HEX.getHexOfL_AtObj} - get hexadecimal ASN.1 L at specified position</li>
- 51 * <li>{@link ASN1HEX.getIntOfL_AtObj} - get integer ASN.1 L at specified position</li>
- 52 * <li>{@link ASN1HEX.getStartPosOfV_AtObj} - get ASN.1 V position from its ASN.1 TLV position</li>
- 53 * </ul>
- 54 * </li>
- 55 * <li><b>ACCESS FOR CHILD ITEM</b>
- 56 * <ul>
- 57 * <li>{@link ASN1HEX.getNthChildIndex_AtObj} - get nth child index at specified position</li>
- 58 * <li>{@link ASN1HEX.getPosArrayOfChildren_AtObj} - get indexes of children</li>
- 59 * <li>{@link ASN1HEX.getPosOfNextSibling_AtObj} - get position of next sibling</li>
- 60 * </ul>
- 61 * </li>
- 62 * <li><b>ACCESS NESTED ASN.1 STRUCTURE</b>
- 63 * <ul>
- 64 * <li>{@link ASN1HEX.getDecendantHexTLVByNthList} - get ASN.1 TLV at specified list index</li>
- 65 * <li>{@link ASN1HEX.getDecendantHexVByNthList} - get ASN.1 V at specified list index</li>
- 66 * <li>{@link ASN1HEX.getDecendantIndexByNthList} - get index at specified list index</li>
- 67 * </ul>
- 68 * </li>
- 69 * <li><b>UTILITIES</b>
- 70 * <ul>
- 71 * <li>{@link ASN1HEX.dump} - dump ASN.1 structure</li>
- 72 * <li>{@link ASN1HEX.isASN1HEX} - check whether ASN.1 hexadecimal string or not</li>
- 73 * <li>{@link ASN1HEX.hextooidstr} - convert hexadecimal string of OID to dotted integer list</li>
- 74 * </ul>
- 75 * </li>
- 76 * </ul>
- 77 */
- 78 var ASN1HEX = new function ( ) {
- 79 /**
- 80 * get byte length for ASN.1 L(length) bytes
- 81 * @name getByteLengthOfL_AtObj
- 82 * @memberOf ASN1HEX
- 83 * @function
- 84 * @param {String} s hexadecimal string of ASN.1 DER encoded data
- 85 * @param {Number} pos string index
- 86 * @return byte length for ASN.1 L(length) bytes
- 87 */
- 88 this.getByteLengthOfL_AtObj = function ( s , pos ) {
- 89 if ( s.substring ( pos + 2 , pos + 3 ) != '8' ) return 1 ;
- 90 var i = parseInt ( s.substring ( pos + 3 , pos + 4 ) ) ;
- 91 if ( i == 0 ) return - 1 ; // length octet '80' indefinite length
- 92 if ( 0 < i && i < 10 ) return i + 1 ; // including '8?' octet;
- 93 return - 2 ; // malformed format
- 94 } ;
- 95
- 96 /**
- 97 * get hexadecimal string for ASN.1 L(length) bytes
- 98 * @name getHexOfL_AtObj
- 99 * @memberOf ASN1HEX
-100 * @function
-101 * @param {String} s hexadecimal string of ASN.1 DER encoded data
-102 * @param {Number} pos string index
-103 * @return {String} hexadecimal string for ASN.1 L(length) bytes
-104 */
-105 this.getHexOfL_AtObj = function ( s , pos ) {
-106 var len = this.getByteLengthOfL_AtObj ( s , pos ) ;
-107 if ( len < 1 ) return '' ;
-108 return s.substring ( pos + 2 , pos + 2 + len * 2 ) ;
-109 } ;
-110
-111 // getting ASN.1 length value at the position 'idx' of
-112 // hexa decimal string 's'.
-113 //
-114 // f('3082025b02...', 0) ... 82025b ... ???
-115 // f('020100', 0) ... 01 ... 1
-116 // f('0203001...', 0) ... 03 ... 3
-117 // f('02818003...', 0) ... 8180 ... 128
-118 /**
-119 * get integer value of ASN.1 length for ASN.1 data
-120 * @name getIntOfL_AtObj
-121 * @memberOf ASN1HEX
-122 * @function
-123 * @param {String} s hexadecimal string of ASN.1 DER encoded data
-124 * @param {Number} pos string index
-125 * @return ASN.1 L(length) integer value
-126 */
-127 this.getIntOfL_AtObj = function ( s , pos ) {
-128 var hLength = this.getHexOfL_AtObj ( s , pos ) ;
-129 if ( hLength == '' ) return - 1 ;
-130 var bi ;
-131 if ( parseInt ( hLength.substring ( 0 , 1 ) ) < 8 ) {
-132 bi = new BigInteger ( hLength , 16 ) ;
-133 } else {
-134 bi = new BigInteger ( hLength.substring ( 2 ) , 16 ) ;
-135 }
-136 return bi.intValue ( ) ;
-137 } ;
-138
-139 /**
-140 * get ASN.1 value starting string position for ASN.1 object refered by index 'idx'.
-141 * @name getStartPosOfV_AtObj
-142 * @memberOf ASN1HEX
-143 * @function
-144 * @param {String} s hexadecimal string of ASN.1 DER encoded data
-145 * @param {Number} pos string index
-146 */
-147 this.getStartPosOfV_AtObj = function ( s , pos ) {
-148 var l_len = this.getByteLengthOfL_AtObj ( s , pos ) ;
-149 if ( l_len < 0 ) return l_len ;
-150 return pos + ( l_len + 1 ) * 2 ;
-151 } ;
-152
-153 /**
-154 * get hexadecimal string of ASN.1 V(value)
-155 * @name getHexOfV_AtObj
-156 * @memberOf ASN1HEX
-157 * @function
-158 * @param {String} s hexadecimal string of ASN.1 DER encoded data
-159 * @param {Number} pos string index
-160 * @return {String} hexadecimal string of ASN.1 value.
-161 */
-162 this.getHexOfV_AtObj = function ( s , pos ) {
-163 var pos1 = this.getStartPosOfV_AtObj ( s , pos ) ;
-164 var len = this.getIntOfL_AtObj ( s , pos ) ;
-165 return s.substring ( pos1 , pos1 + len * 2 ) ;
-166 } ;
-167
-168 /**
-169 * get hexadecimal string of ASN.1 TLV at
-170 * @name getHexOfTLV_AtObj
-171 * @memberOf ASN1HEX
-172 * @function
-173 * @param {String} s hexadecimal string of ASN.1 DER encoded data
-174 * @param {Number} pos string index
-175 * @return {String} hexadecimal string of ASN.1 TLV.
-176 * @since 1.1
-177 */
-178 this.getHexOfTLV_AtObj = function ( s , pos ) {
-179 var hT = s.substr ( pos , 2 ) ;
-180 var hL = this.getHexOfL_AtObj ( s , pos ) ;
-181 var hV = this.getHexOfV_AtObj ( s , pos ) ;
-182 return hT + hL + hV ;
-183 } ;
-184
-185 /**
-186 * get next sibling starting index for ASN.1 object string
-187 * @name getPosOfNextSibling_AtObj
-188 * @memberOf ASN1HEX
-189 * @function
-190 * @param {String} s hexadecimal string of ASN.1 DER encoded data
-191 * @param {Number} pos string index
-192 * @return next sibling starting index for ASN.1 object string
-193 */
-194 this.getPosOfNextSibling_AtObj = function ( s , pos ) {
-195 var pos1 = this.getStartPosOfV_AtObj ( s , pos ) ;
-196 var len = this.getIntOfL_AtObj ( s , pos ) ;
-197 return pos1 + len * 2 ;
-198 } ;
-199
-200 /**
-201 * get array of indexes of child ASN.1 objects
-202 * @name getPosArrayOfChildren_AtObj
-203 * @memberOf ASN1HEX
-204 * @function
-205 * @param {String} s hexadecimal string of ASN.1 DER encoded data
-206 * @param {Number} start string index of ASN.1 object
-207 * @return {Array of Number} array of indexes for childen of ASN.1 objects
-208 */
-209 this.getPosArrayOfChildren_AtObj = function ( h , pos ) {
-210 var a = new Array ( ) ;
-211 var p0 = this.getStartPosOfV_AtObj ( h , pos ) ;
-212 a.push ( p0 ) ;
-213
-214 var len = this.getIntOfL_AtObj ( h , pos ) ;
-215 var p = p0 ;
-216 var k = 0 ;
-217 while ( 1 ) {
-218 var pNext = this.getPosOfNextSibling_AtObj ( h , p ) ;
-219 if ( pNext == null || ( pNext - p0 >= ( len * 2 ) ) ) break ;
-220 if ( k >= 200 ) break ;
-221
-222 a.push ( pNext ) ;
-223 p = pNext ;
-224
-225 k ++ ;
-226 }
-227
-228 return a ;
-229 } ;
-230
-231 /**
-232 * get string index of nth child object of ASN.1 object refered by h, idx
-233 * @name getNthChildIndex_AtObj
-234 * @memberOf ASN1HEX
-235 * @function
-236 * @param {String} h hexadecimal string of ASN.1 DER encoded data
-237 * @param {Number} idx start string index of ASN.1 object
-238 * @param {Number} nth for child
-239 * @return {Number} string index of nth child.
-240 * @since 1.1
-241 */
-242 this.getNthChildIndex_AtObj = function ( h , idx , nth ) {
-243 var a = this.getPosArrayOfChildren_AtObj ( h , idx ) ;
-244 return a [ nth ] ;
-245 } ;
-246
-247 // ========== decendant methods ==============================
-248 /**
-249 * get string index of nth child object of ASN.1 object refered by h, idx
-250 * @name getDecendantIndexByNthList
-251 * @memberOf ASN1HEX
-252 * @function
-253 * @param {String} h hexadecimal string of ASN.1 DER encoded data
-254 * @param {Number} currentIndex start string index of ASN.1 object
-255 * @param {Array of Number} nthList array list of nth
-256 * @return {Number} string index refered by nthList
-257 * @since 1.1
-258 * @example
-259 * The "nthList" is a index list of structured ASN.1 object
-260 * reference. Here is a sample structure and "nthList"s which
-261 * refers each objects.
-262 *
-263 * SQUENCE -
-264 * SEQUENCE - [0]
-265 * IA5STRING 000 - [0, 0]
-266 * UTF8STRING 001 - [0, 1]
-267 * SET - [1]
-268 * IA5STRING 010 - [1, 0]
-269 * UTF8STRING 011 - [1, 1]
-270 */
-271 this.getDecendantIndexByNthList = function ( h , currentIndex , nthList ) {
-272 if ( nthList.length == 0 ) {
-273 return currentIndex ;
-274 }
-275 var firstNth = nthList.shift ( ) ;
-276 var a = this.getPosArrayOfChildren_AtObj ( h , currentIndex ) ;
-277 return this.getDecendantIndexByNthList ( h , a [ firstNth ] , nthList ) ;
-278 } ;
-279
-280 /**
-281 * get hexadecimal string of ASN.1 TLV refered by current index and nth index list.
-282 * @name getDecendantHexTLVByNthList
-283 * @memberOf ASN1HEX
-284 * @function
-285 * @param {String} h hexadecimal string of ASN.1 DER encoded data
-286 * @param {Number} currentIndex start string index of ASN.1 object
-287 * @param {Array of Number} nthList array list of nth
-288 * @return {Number} hexadecimal string of ASN.1 TLV refered by nthList
-289 * @since 1.1
-290 */
-291 this.getDecendantHexTLVByNthList = function ( h , currentIndex , nthList ) {
-292 var idx = this.getDecendantIndexByNthList ( h , currentIndex , nthList ) ;
-293 return this.getHexOfTLV_AtObj ( h , idx ) ;
-294 } ;
-295
-296 /**
-297 * get hexadecimal string of ASN.1 V refered by current index and nth index list.
-298 * @name getDecendantHexVByNthList
-299 * @memberOf ASN1HEX
-300 * @function
-301 * @param {String} h hexadecimal string of ASN.1 DER encoded data
-302 * @param {Number} currentIndex start string index of ASN.1 object
-303 * @param {Array of Number} nthList array list of nth
-304 * @return {Number} hexadecimal string of ASN.1 V refered by nthList
-305 * @since 1.1
-306 */
-307 this.getDecendantHexVByNthList = function ( h , currentIndex , nthList ) {
-308 var idx = this.getDecendantIndexByNthList ( h , currentIndex , nthList ) ;
-309 return this.getHexOfV_AtObj ( h , idx ) ;
-310 } ;
-311 } ;
-312
-313 /*
-314 * @since asn1hex 1.1.4
-315 */
-316 ASN1HEX.getVbyList = function ( h , currentIndex , nthList , checkingTag ) {
-317 var idx = this.getDecendantIndexByNthList ( h , currentIndex , nthList ) ;
-318 if ( idx === undefined ) {
-319 throw "can't find nthList object" ;
-320 }
-321 if ( checkingTag !== undefined ) {
-322 if ( h.substr ( idx , 2 ) != checkingTag ) {
-323 throw "checking tag doesn't match: " +
-324 h.substr ( idx , 2 ) + "!=" + checkingTag ;
-325 }
-326 }
-327 return this.getHexOfV_AtObj ( h , idx ) ;
-328 } ;
-329
-330 /**
-331 * get OID string from hexadecimal encoded value
-332 * @name hextooidstr
-333 * @memberOf ASN1HEX
-334 * @function
-335 * @param {String} hex hexadecmal string of ASN.1 DER encoded OID value
-336 * @return {String} OID string (ex. '1.2.3.4.567')
-337 * @since asn1hex 1.1.5
-338 */
-339 ASN1HEX.hextooidstr = function ( hex ) {
-340 var zeroPadding = function ( s , len ) {
-341 if ( s.length >= len ) return s ;
-342 return new Array ( len - s.length + 1 ) . join ( '0' ) + s ;
-343 } ;
-344
-345 var a = [ ] ;
-346
-347 // a[0], a[1]
-348 var hex0 = hex.substr ( 0 , 2 ) ;
-349 var i0 = parseInt ( hex0 , 16 ) ;
-350 a [ 0 ] = new String ( Math.floor ( i0 / 40 ) ) ;
-351 a [ 1 ] = new String ( i0 % 40 ) ;
-352
-353 // a[2]..a[n]
-354 var hex1 = hex.substr ( 2 ) ;
-355 var b = [ ] ;
-356 for ( var i = 0 ; i < hex1.length / 2 ; i ++ ) {
-357 b.push ( parseInt ( hex1.substr ( i * 2 , 2 ) , 16 ) ) ;
-358 }
-359 var c = [ ] ;
-360 var cbin = "" ;
-361 for ( var i = 0 ; i < b.length ; i ++ ) {
-362 if ( b [ i ] & 0x80 ) {
-363 cbin = cbin + zeroPadding ( ( b [ i ] & 0x7f ) . toString ( 2 ) , 7 ) ;
-364 } else {
-365 cbin = cbin + zeroPadding ( ( b [ i ] & 0x7f ) . toString ( 2 ) , 7 ) ;
-366 c.push ( new String ( parseInt ( cbin , 2 ) ) ) ;
-367 cbin = "" ;
-368 }
-369 }
-370
-371 var s = a.join ( "." ) ;
-372 if ( c.length > 0 ) s = s + "." + c.join ( "." ) ;
-373 return s ;
-374 } ;
-375
-376 /**
-377 * get string of simple ASN.1 dump from hexadecimal ASN.1 data
-378 * @name dump
-379 * @memberOf ASN1HEX
-380 * @function
-381 * @param {String} hex hexadecmal string of ASN.1 data
-382 * @param {Array} associative array of flags for dump (OPTION)
-383 * @param {Number} idx string index for starting dump (OPTION)
-384 * @param {String} indent string (OPTION)
-385 * @return {String} string of simple ASN.1 dump
-386 * @since jsrsasign 4.8.3 asn1hex 1.1.6
-387 * @description
-388 * This method will get an ASN.1 dump from
-389 * hexadecmal string of ASN.1 DER encoded data.
-390 * Here are features:
-391 * <ul>
-392 * <li>ommit long hexadecimal string</li>
-393 * <li>dump encapsulated OCTET STRING (good for X.509v3 extensions)</li>
-394 * <li>structured/primitive context specific tag support (i.e. [0], [3] ...)</li>
-395 * <li>automatic decode for implicit primitive context specific tag
-396 * (good for X.509v3 extension value)
-397 * <ul>
-398 * <li>if hex starts '68747470'(i.e. http) it is decoded as utf8 encoded string.</li>
-399 * <li>if it is in 'subjectAltName' extension value and is '[2]'(dNSName) tag
-400 * value will be encoded as utf8 string</li>
-401 * <li>otherwise it shows as hexadecimal string</li>
-402 * </ul>
-403 * </li>
-404 * </ul>
-405 * @example
-406 * // ASN.1 INTEGER
-407 * ASN1HEX.dump('0203012345')
-408 * ↓
-409 * INTEGER 012345
-410 *
-411 * // ASN.1 Object Identifier
-412 * ASN1HEX.dump('06052b0e03021a')
-413 * ↓
-414 * ObjectIdentifier sha1 (1 3 14 3 2 26)
-415 *
-416 * // ASN.1 SEQUENCE
-417 * ASN1HEX.dump('3006020101020102')
-418 * ↓
-419 * SEQUENCE
-420 * INTEGER 01
-421 * INTEGER 02
-422 *
-423 * // ASN.1 DUMP FOR X.509 CERTIFICATE
-424 * ASN1HEX.dump(X509.pemToHex(certPEM))
-425 * ↓
-426 * SEQUENCE
-427 * SEQUENCE
-428 * [0]
-429 * INTEGER 02
-430 * INTEGER 0c009310d206dbe337553580118ddc87
-431 * SEQUENCE
-432 * ObjectIdentifier SHA256withRSA (1 2 840 113549 1 1 11)
-433 * NULL
-434 * SEQUENCE
-435 * SET
-436 * SEQUENCE
-437 * ObjectIdentifier countryName (2 5 4 6)
-438 * PrintableString 'US'
-439 * :
-440 */
-441 ASN1HEX.dump = function ( hex , flags , idx , indent ) {
-442 var _skipLongHex = function ( hex , limitNumOctet ) {
-443 if ( hex.length <= limitNumOctet * 2 ) {
-444 return hex ;
-445 } else {
-446 var s = hex.substr ( 0 , limitNumOctet ) +
-447 "..(total " + hex.length / 2 + "bytes).." +
-448 hex.substr ( hex.length - limitNumOctet , limitNumOctet ) ;
-449 return s ;
-450 } ;
-451 } ;
-452
-453 if ( flags === undefined ) flags = { "ommit_long_octet" : 32 } ;
-454 if ( idx === undefined ) idx = 0 ;
-455 if ( indent === undefined ) indent = "" ;
-456 var skipLongHex = flags.ommit_long_octet ;
-457
-458 if ( hex.substr ( idx , 2 ) == "01" ) {
-459 var v = ASN1HEX.getHexOfV_AtObj ( hex , idx ) ;
-460 if ( v == "00" ) {
-461 return indent + "BOOLEAN FALSE\n" ;
-462 } else {
-463 return indent + "BOOLEAN TRUE\n" ;
-464 }
-465 }
-466 if ( hex.substr ( idx , 2 ) == "02" ) {
-467 var v = ASN1HEX.getHexOfV_AtObj ( hex , idx ) ;
-468 return indent + "INTEGER " + _skipLongHex ( v , skipLongHex ) + "\n" ;
-469 }
-470 if ( hex.substr ( idx , 2 ) == "03" ) {
-471 var v = ASN1HEX.getHexOfV_AtObj ( hex , idx ) ;
-472 return indent + "BITSTRING " + _skipLongHex ( v , skipLongHex ) + "\n" ;
-473 }
-474 if ( hex.substr ( idx , 2 ) == "04" ) {
-475 var v = ASN1HEX.getHexOfV_AtObj ( hex , idx ) ;
-476 if ( ASN1HEX.isASN1HEX ( v ) ) {
-477 var s = indent + "OCTETSTRING, encapsulates\n" ;
-478 s = s + ASN1HEX.dump ( v , flags , 0 , indent + " " ) ;
-479 return s ;
-480 } else {
-481 return indent + "OCTETSTRING " + _skipLongHex ( v , skipLongHex ) + "\n" ;
-482 }
-483 }
-484 if ( hex.substr ( idx , 2 ) == "05" ) {
-485 return indent + "NULL\n" ;
-486 }
-487 if ( hex.substr ( idx , 2 ) == "06" ) {
-488 var hV = ASN1HEX.getHexOfV_AtObj ( hex , idx ) ;
-489 var oidDot = KJUR.asn1.ASN1Util.oidHexToInt ( hV ) ;
-490 var oidName = KJUR.asn1.x509.OID.oid2name ( oidDot ) ;
-491 var oidSpc = oidDot.replace ( /\./g , ' ' ) ;
-492 if ( oidName != '' ) {
-493 return indent + "ObjectIdentifier " + oidName + " (" + oidSpc + ")\n" ;
-494 } else {
-495 return indent + "ObjectIdentifier (" + oidSpc + ")\n" ;
-496 }
-497 }
-498 if ( hex.substr ( idx , 2 ) == "0c" ) {
-499 return indent + "UTF8String '" + hextoutf8 ( ASN1HEX.getHexOfV_AtObj ( hex , idx ) ) + "'\n" ;
-500 }
-501 if ( hex.substr ( idx , 2 ) == "13" ) {
-502 return indent + "PrintableString '" + hextoutf8 ( ASN1HEX.getHexOfV_AtObj ( hex , idx ) ) + "'\n" ;
-503 }
-504 if ( hex.substr ( idx , 2 ) == "14" ) {
-505 return indent + "TeletexString '" + hextoutf8 ( ASN1HEX.getHexOfV_AtObj ( hex , idx ) ) + "'\n" ;
-506 }
-507 if ( hex.substr ( idx , 2 ) == "16" ) {
-508 return indent + "IA5String '" + hextoutf8 ( ASN1HEX.getHexOfV_AtObj ( hex , idx ) ) + "'\n" ;
-509 }
-510 if ( hex.substr ( idx , 2 ) == "17" ) {
-511 return indent + "UTCTime " + hextoutf8 ( ASN1HEX.getHexOfV_AtObj ( hex , idx ) ) + "\n" ;
-512 }
-513 if ( hex.substr ( idx , 2 ) == "18" ) {
-514 return indent + "GeneralizedTime " + hextoutf8 ( ASN1HEX.getHexOfV_AtObj ( hex , idx ) ) + "\n" ;
-515 }
-516 if ( hex.substr ( idx , 2 ) == "30" ) {
-517 if ( hex.substr ( idx , 4 ) == "3000" ) {
-518 return indent + "SEQUENCE {}\n" ;
-519 }
-520
-521 var s = indent + "SEQUENCE\n" ;
-522 var aIdx = ASN1HEX.getPosArrayOfChildren_AtObj ( hex , idx ) ;
-523
-524 var flagsTemp = flags ;
-525
-526 if ( ( aIdx.length == 2 || aIdx.length == 3 ) &&
-527 hex.substr ( aIdx [ 0 ] , 2 ) == "06" &&
-528 hex.substr ( aIdx [ aIdx.length - 1 ] , 2 ) == "04" ) { // supposed X.509v3 extension
-529 var oidHex = ASN1HEX.getHexOfV_AtObj ( hex , aIdx [ 0 ] ) ;
-530 var oidDot = KJUR.asn1.ASN1Util.oidHexToInt ( oidHex ) ;
-531 var oidName = KJUR.asn1.x509.OID.oid2name ( oidDot ) ;
-532
-533 var flagsClone = JSON.parse ( JSON.stringify ( flags ) ) ;
-534 flagsClone.x509ExtName = oidName ;
-535 flagsTemp = flagsClone ;
-536 }
-537
-538 for ( var i = 0 ; i < aIdx.length ; i ++ ) {
-539 s = s + ASN1HEX.dump ( hex , flagsTemp , aIdx [ i ] , indent + " " ) ;
-540 }
-541 return s ;
-542 }
-543 if ( hex.substr ( idx , 2 ) == "31" ) {
-544 var s = indent + "SET\n" ;
-545 var aIdx = ASN1HEX.getPosArrayOfChildren_AtObj ( hex , idx ) ;
-546 for ( var i = 0 ; i < aIdx.length ; i ++ ) {
-547 s = s + ASN1HEX.dump ( hex , flags , aIdx [ i ] , indent + " " ) ;
-548 }
-549 return s ;
-550 }
-551 var tag = parseInt ( hex.substr ( idx , 2 ) , 16 ) ;
-552 if ( ( tag & 128 ) != 0 ) { // context specific
-553 var tagNumber = tag & 31 ;
-554 if ( ( tag & 32 ) != 0 ) { // structured tag
-555 var s = indent + "[" + tagNumber + "]\n" ;
-556 var aIdx = ASN1HEX.getPosArrayOfChildren_AtObj ( hex , idx ) ;
-557 for ( var i = 0 ; i < aIdx.length ; i ++ ) {
-558 s = s + ASN1HEX.dump ( hex , flags , aIdx [ i ] , indent + " " ) ;
-559 }
-560 return s ;
-561 } else { // primitive tag
-562 var v = ASN1HEX.getHexOfV_AtObj ( hex , idx ) ;
-563 if ( v.substr ( 0 , 8 ) == "68747470" ) { // http
-564 v = hextoutf8 ( v ) ;
-565 }
-566 if ( flags.x509ExtName === "subjectAltName" &&
-567 tagNumber == 2 ) {
-568 v = hextoutf8 ( v ) ;
-569 }
-570
-571 var s = indent + "[" + tagNumber + "] " + v + "\n" ;
-572 return s ;
-573 }
-574 }
-575 return indent + "UNKNOWN(" + hex.substr ( idx , 2 ) + ") " + ASN1HEX.getHexOfV_AtObj ( hex , idx ) + "\n" ;
-576 } ;
-577
-578 /**
-579 * check wheather the string is ASN.1 hexadecimal string or not
-580 * @name isASN1HEX
-581 * @memberOf ASN1HEX
-582 * @function
-583 * @param {String} hex string to check whether it is hexadecmal string for ASN.1 DER or not
-584 * @return {Boolean} true if it is hexadecimal string of ASN.1 data otherwise false
-585 * @since jsrsasign 4.8.3 asn1hex 1.1.6
-586 * @description
-587 * This method checks wheather the argument 'hex' is a hexadecimal string of
-588 * ASN.1 data or not.
-589 * @example
-590 * ASN1HEX.isASN1HEX('0203012345') → true // PROPER ASN.1 INTEGER
-591 * ASN1HEX.isASN1HEX('0203012345ff') → false // TOO LONG VALUE
-592 * ASN1HEX.isASN1HEX('02030123') → false // TOO SHORT VALUE
-593 * ASN1HEX.isASN1HEX('fa3bcd') → false // WRONG FOR ASN.1
-594 */
-595 ASN1HEX.isASN1HEX = function ( hex ) {
-596 if ( hex.length % 2 == 1 ) return false ;
-597
-598 var intL = ASN1HEX.getIntOfL_AtObj ( hex , 0 ) ;
-599 var tV = hex.substr ( 0 , 2 ) ;
-600 var lV = ASN1HEX.getHexOfL_AtObj ( hex , 0 ) ;
-601 var hVLength = hex.length - tV.length - lV.length ;
-602 if ( hVLength == intL * 2 ) return true ;
-603
-604 return false ;
-605 } ;
-606
\ No newline at end of file
diff --git a/jwt/api/symbols/src/asn1tsp-1.0.js.html b/jwt/api/symbols/src/asn1tsp-1.0.js.html
deleted file mode 100644
index 212a240..0000000
--- a/jwt/api/symbols/src/asn1tsp-1.0.js.html
+++ /dev/null
@@ -1,828 +0,0 @@
-
1 /*! asn1tsp-1.0.1.js (c) 2014 Kenji Urushima | kjur.github.com/jsrsasign/license
- 2 */
- 3 /*
- 4 * asn1tsp.js - ASN.1 DER encoder classes for RFC 3161 Time Stamp Protocol
- 5 *
- 6 * Copyright (c) 2014 Kenji Urushima (kenji.urushima@gmail.com)
- 7 *
- 8 * This software is licensed under the terms of the MIT License.
- 9 * http://kjur.github.com/jsrsasign/license
- 10 *
- 11 * The above copyright and license notice shall be
- 12 * included in all copies or substantial portions of the Software.
- 13 */
- 14
- 15 /**
- 16 * @fileOverview
- 17 * @name asn1tsp-1.0.js
- 18 * @author Kenji Urushima kenji.urushima@gmail.com
- 19 * @version 1.0.1 (2014-Jun-07)
- 20 * @since jsrsasign 4.5.1
- 21 * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a>
- 22 */
- 23
- 24 /*
- 25 * kjur's class library name space
- 26 * // already documented in asn1-1.0.js
- 27 * @name KJUR
- 28 * @namespace kjur's class library name space
- 29 */
- 30 if ( typeof KJUR == "undefined" || ! KJUR ) KJUR = { } ;
- 31
- 32 /*
- 33 * kjur's ASN.1 class library name space
- 34 * // already documented in asn1-1.0.js
- 35 * @name KJUR.asn1
- 36 * @namespace
- 37 */
- 38 if ( typeof KJUR.asn1 == "undefined" || ! KJUR.asn1 ) KJUR.asn1 = { } ;
- 39
- 40 /**
- 41 * kjur's ASN.1 class for RFC 3161 Time Stamp Protocol
- 42 * <p>
- 43 * This name space provides
- 44 * <a href="https://tools.ietf.org/html/rfc3161">RFC 3161
- 45 * Time-Stamp Protocol(TSP)</a> data generator.
- 46 *
- 47 * <h4>FEATURES</h4>
- 48 * <ul>
- 49 * <li>easily generate CMS SignedData</li>
- 50 * <li>APIs are very similar to BouncyCastle library ASN.1 classes. So easy to learn.</li>
- 51 * </ul>
- 52 *
- 53 * <h4>PROVIDED CLASSES</h4>
- 54 * <ul>
- 55 * </ul>
- 56 * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.
- 57 * </p>
- 58 * @name KJUR.asn1.tsp
- 59 * @namespace
- 60 */
- 61 if ( typeof KJUR.asn1.tsp == "undefined" || ! KJUR.asn1.tsp ) KJUR.asn1.tsp = { } ;
- 62
- 63 /**
- 64 * class for TSP Accuracy ASN.1 object
- 65 * @name KJUR.asn1.tsp.Accuracy
- 66 * @class class for TSP Accuracy ASN.1 object
- 67 * @param {Array} params associative array of parameters
- 68 * @extends KJUR.asn1.ASN1Object
- 69 * @since jsrsasign 4.6.0 asn1tsp 1.0.0
- 70 * @description
- 71 * <pre>
- 72 * Accuracy ::= SEQUENCE {
- 73 * seconds INTEGER OPTIONAL,
- 74 * millis [0] INTEGER (1..999) OPTIONAL,
- 75 * micros [1] INTEGER (1..999) OPTIONAL }
- 76 * </pre>
- 77 * @example
- 78 * o = new KJUR.asn1.tsp.Accuracy({seconds: 1,
- 79 * millis: 500,
- 80 * micros: 500});
- 81 */
- 82 KJUR.asn1.tsp.Accuracy = function ( params ) {
- 83 KJUR.asn1.tsp.Accuracy.superclass.constructor.call ( this ) ;
- 84 var nA = KJUR.asn1 ;
- 85 this.seconds = null ;
- 86 this.millis = null ;
- 87 this.micros = null ;
- 88
- 89 this.getEncodedHex = function ( ) {
- 90 var dSeconds = null ;
- 91 var dTagMillis = null ;
- 92 var dTagMicros = null ;
- 93
- 94 var a = [ ] ;
- 95 if ( this.seconds != null ) {
- 96 dSeconds = new nA.DERInteger ( { 'int' : this.seconds } ) ;
- 97 a.push ( dSeconds ) ;
- 98 }
- 99 if ( this.millis != null ) {
-100 var dMillis = new nA.DERInteger ( { 'int' : this.millis } ) ;
-101 dTagMillis = new nA.DERTaggedObject ( { obj : dMillis ,
-102 tag : '80' ,
-103 explicit : false } ) ;
-104 a.push ( dTagMillis ) ;
-105 }
-106 if ( this.micros != null ) {
-107 var dMicros = new nA.DERInteger ( { 'int' : this.micros } ) ;
-108 dTagMicros = new nA.DERTaggedObject ( { obj : dMicros ,
-109 tag : '81' ,
-110 explicit : false } ) ;
-111 a.push ( dTagMicros ) ;
-112 }
-113 var seq = new nA.DERSequence ( { array : a } ) ;
-114 this.hTLV = seq.getEncodedHex ( ) ;
-115 return this.hTLV ;
-116 } ;
-117
-118 if ( typeof params != "undefined" ) {
-119 if ( typeof params.seconds == "number" ) this.seconds = params.seconds ;
-120 if ( typeof params.millis == "number" ) this.millis = params.millis ;
-121 if ( typeof params.micros == "number" ) this.micros = params.micros ;
-122 }
-123 } ;
-124 YAHOO.lang.extend ( KJUR.asn1.tsp.Accuracy , KJUR.asn1.ASN1Object ) ;
-125
-126 /**
-127 * class for TSP MessageImprint ASN.1 object
-128 * @name KJUR.asn1.tsp.MessageImprint
-129 * @class class for TSP MessageImprint ASN.1 object
-130 * @param {Array} params associative array of parameters
-131 * @extends KJUR.asn1.ASN1Object
-132 * @since jsrsasign 4.6.0 asn1tsp 1.0.0
-133 * @description
-134 * <pre>
-135 * MessageImprint ::= SEQUENCE {
-136 * hashAlgorithm AlgorithmIdentifier,
-137 * hashedMessage OCTET STRING }
-138 * </pre>
-139 * @example
-140 * o = new KJUR.asn1.tsp.MessageImprint({hashAlg: 'sha1',
-141 * hashValue: '1f3dea...'});
-142 */
-143 KJUR.asn1.tsp.MessageImprint = function ( params ) {
-144 KJUR.asn1.tsp.MessageImprint.superclass.constructor.call ( this ) ;
-145 var nA = KJUR.asn1 ;
-146 var nX = KJUR.asn1.x509 ;
-147 this.dHashAlg = null ;
-148 this.dHashValue = null ;
-149
-150 this.getEncodedHex = function ( ) {
-151 if ( typeof this.hTLV == "string" ) return this.hTLV ;
-152 var seq =
-153 new nA.DERSequence ( { array : [ this.dHashAlg , this.dHashValue ] } ) ;
-154 return seq.getEncodedHex ( ) ;
-155 } ;
-156
-157 if ( typeof params != "undefined" ) {
-158 if ( typeof params.hashAlg == "string" ) {
-159 this.dHashAlg = new nX.AlgorithmIdentifier ( { name : params.hashAlg } ) ;
-160 }
-161 if ( typeof params.hashValue == "string" ) {
-162 this.dHashValue = new nA.DEROctetString ( { hex : params.hashValue } ) ;
-163 }
-164 }
-165 } ;
-166 YAHOO.lang.extend ( KJUR.asn1.tsp.MessageImprint , KJUR.asn1.ASN1Object ) ;
-167
-168 /**
-169 * class for TSP TimeStampReq ASN.1 object
-170 * @name KJUR.asn1.tsp.TimeStampReq
-171 * @class class for TSP TimeStampReq ASN.1 object
-172 * @param {Array} params associative array of parameters
-173 * @extends KJUR.asn1.ASN1Object
-174 * @since jsrsasign 4.6.0 asn1tsp 1.0.0
-175 * @description
-176 * <pre>
-177 * TimeStampReq ::= SEQUENCE {
-178 * version INTEGER { v1(1) },
-179 * messageImprint MessageImprint,
-180 * reqPolicy TSAPolicyId OPTIONAL,
-181 * nonce INTEGER OPTIONAL,
-182 * certReq BOOLEAN DEFAULT FALSE,
-183 * extensions [0] IMPLICIT Extensions OPTIONAL }
-184 * </pre>
-185 */
-186 KJUR.asn1.tsp.TimeStampReq = function ( params ) {
-187 KJUR.asn1.tsp.TimeStampReq.superclass.constructor.call ( this ) ;
-188 var nA = KJUR.asn1 ;
-189 var nT = KJUR.asn1.tsp ;
-190 this.dVersion = new nA.DERInteger ( { 'int' : 1 } ) ;
-191 this.dMessageImprint = null ;
-192 this.dPolicy = null ;
-193 this.dNonce = null ;
-194 this.certReq = true ;
-195
-196 this.setMessageImprint = function ( params ) {
-197 if ( params instanceof KJUR.asn1.tsp.MessageImprint ) {
-198 this.dMessageImprint = params ;
-199 return ;
-200 }
-201 if ( typeof params == "object" ) {
-202 this.dMessageImprint = new nT.MessageImprint ( params ) ;
-203 }
-204 } ;
-205
-206 this.getEncodedHex = function ( ) {
-207 if ( this.dMessageImprint == null )
-208 throw "messageImprint shall be specified" ;
-209
-210 var a = [ this.dVersion , this.dMessageImprint ] ;
-211 if ( this.dPolicy != null ) a.push ( this.dPolicy ) ;
-212 if ( this.dNonce != null ) a.push ( this.dNonce ) ;
-213 if ( this.certReq ) a.push ( new nA.DERBoolean ( ) ) ;
-214
-215 var seq = new nA.DERSequence ( { array : a } ) ;
-216 this.hTLV = seq.getEncodedHex ( ) ;
-217 return this.hTLV ;
-218 } ;
-219
-220 if ( typeof params != "undefined" ) {
-221 if ( typeof params.mi == "object" ) {
-222 this.setMessageImprint ( params.mi ) ;
-223 }
-224 if ( typeof params.policy == "object" ) {
-225 this.dPolicy = new nA.DERObjectIdentifier ( params.policy ) ;
-226 }
-227 if ( typeof params.nonce == "object" ) {
-228 this.dNonce = new nA.DERInteger ( params.nonce ) ;
-229 }
-230 if ( typeof params.certreq == "boolean" ) {
-231 this.certReq = params.certreq ;
-232 }
-233 }
-234 } ;
-235 YAHOO.lang.extend ( KJUR.asn1.tsp.TimeStampReq , KJUR.asn1.ASN1Object ) ;
-236
-237 /**
-238 * class for TSP TSTInfo ASN.1 object
-239 * @name KJUR.asn1.tsp.TSTInfo
-240 * @class class for TSP TSTInfo ASN.1 object
-241 * @param {Array} params associative array of parameters
-242 * @extends KJUR.asn1.ASN1Object
-243 * @since jsrsasign 4.6.0 asn1tsp 1.0.0
-244 * @description
-245 * <pre>
-246 * TSTInfo ::= SEQUENCE {
-247 * version INTEGER { v1(1) },
-248 * policy TSAPolicyId,
-249 * messageImprint MessageImprint,
-250 * serialNumber INTEGER, -- up to 160bit
-251 * genTime GeneralizedTime,
-252 * accuracy Accuracy OPTIONAL,
-253 * ordering BOOLEAN DEFAULT FALSE,
-254 * nonce INTEGER OPTIONAL,
-255 * tsa [0] GeneralName OPTIONAL,
-256 * extensions [1] IMPLICIT Extensions OPTIONAL }
-257 * </pre>
-258 * @example
-259 * o = new KJUR.asn1.tsp.TSTInfo({
-260 * policy: '1.2.3.4.5',
-261 * messageImprint: {hashAlg: 'sha256', hashMsgHex: '1abc...'},
-262 * genTime: {withMillis: true}, // OPTION
-263 * accuracy: {micros: 500}, // OPTION
-264 * ordering: true, // OPITON
-265 * nonce: {hex: '52fab1...'}, // OPTION
-266 * tsa: {str: '/C=US/O=TSA1'} // OPITON
-267 * });
-268 */
-269 KJUR.asn1.tsp.TSTInfo = function ( params ) {
-270 KJUR.asn1.tsp.TSTInfo.superclass.constructor.call ( this ) ;
-271 var nA = KJUR.asn1 ;
-272 var nX = KJUR.asn1.x509 ;
-273 var nT = KJUR.asn1.tsp ;
-274
-275 this.dVersion = new nA.DERInteger ( { 'int' : 1 } ) ;
-276 this.dPolicy = null ;
-277 this.dMessageImprint = null ;
-278 this.dSerialNumber = null ;
-279 this.dGenTime = null ;
-280 this.dAccuracy = null ;
-281 this.dOrdering = null ;
-282 this.dNonce = null ;
-283 this.dTsa = null ;
-284
-285 this.getEncodedHex = function ( ) {
-286 var a = [ this.dVersion ] ;
-287
-288 if ( this.dPolicy == null ) throw "policy shall be specified." ;
-289 a.push ( this.dPolicy ) ;
-290
-291 if ( this.dMessageImprint == null )
-292 throw "messageImprint shall be specified." ;
-293 a.push ( this.dMessageImprint ) ;
-294
-295 if ( this.dSerialNumber == null )
-296 throw "serialNumber shall be specified." ;
-297 a.push ( this.dSerialNumber ) ;
-298
-299 if ( this.dGenTime == null )
-300 throw "genTime shall be specified." ;
-301 a.push ( this.dGenTime ) ;
-302
-303 if ( this.dAccuracy != null ) a.push ( this.dAccuracy ) ;
-304 if ( this.dOrdering != null ) a.push ( this.dOrdering ) ;
-305 if ( this.dNonce != null ) a.push ( this.dNonce ) ;
-306 if ( this.dTsa != null ) a.push ( this.dTsa ) ;
-307
-308 var seq = new nA.DERSequence ( { array : a } ) ;
-309 this.hTLV = seq.getEncodedHex ( ) ;
-310 return this.hTLV ;
-311 } ;
-312
-313 if ( typeof params != "undefined" ) {
-314 if ( typeof params.policy == "string" ) {
-315 if ( ! params.policy.match ( /^[0-9.]+$/ ) )
-316 throw "policy shall be oid like 0.1.4.134" ;
-317 this.dPolicy = new nA.DERObjectIdentifier ( { oid : params.policy } ) ;
-318 }
-319 if ( typeof params.messageImprint != "undefined" ) {
-320 this.dMessageImprint = new nT.MessageImprint ( params.messageImprint ) ;
-321 }
-322 if ( typeof params.serialNumber != "undefined" ) {
-323 this.dSerialNumber = new nA.DERInteger ( params.serialNumber ) ;
-324 }
-325 if ( typeof params.genTime != "undefined" ) {
-326 this.dGenTime = new nA.DERGeneralizedTime ( params.genTime ) ;
-327 }
-328 if ( typeof params.accuracy != "undefind" ) {
-329 this.dAccuracy = new nT.Accuracy ( params.accuracy ) ;
-330 }
-331 if ( typeof params.ordering != "undefined" &&
-332 params.ordering == true ) {
-333 this.dOrdering = new nA.DERBoolean ( ) ;
-334 }
-335 if ( typeof params.nonce != "undefined" ) {
-336 this.dNonce = new nA.DERInteger ( params.nonce ) ;
-337 }
-338 if ( typeof params.tsa != "undefined" ) {
-339 this.dTsa = new nX.X500Name ( params.tsa ) ;
-340 }
-341 }
-342 } ;
-343 YAHOO.lang.extend ( KJUR.asn1.tsp.TSTInfo , KJUR.asn1.ASN1Object ) ;
-344
-345 /**
-346 * class for TSP TimeStampResp ASN.1 object
-347 * @name KJUR.asn1.tsp.TimeStampResp
-348 * @class class for TSP TimeStampResp ASN.1 object
-349 * @param {Array} params associative array of parameters
-350 * @extends KJUR.asn1.ASN1Object
-351 * @since jsrsasign 4.6.0 asn1tsp 1.0.0
-352 * @description
-353 * <pre>
-354 * TimeStampResp ::= SEQUENCE {
-355 * status PKIStatusInfo,
-356 * timeStampToken TimeStampToken OPTIONAL }
-357 * </pre>
-358 */
-359 KJUR.asn1.tsp.TimeStampResp = function ( params ) {
-360 KJUR.asn1.tsp.TimeStampResp.superclass.constructor.call ( this ) ;
-361 var nA = KJUR.asn1 ;
-362 var nT = KJUR.asn1.tsp ;
-363 this.dStatus = null ;
-364 this.dTST = null ;
-365
-366 this.getEncodedHex = function ( ) {
-367 if ( this.dStatus == null )
-368 throw "status shall be specified" ;
-369 var a = [ this.dStatus ] ;
-370 if ( this.dTST != null ) a.push ( this.dTST ) ;
-371 var seq = new nA.DERSequence ( { array : a } ) ;
-372 this.hTLV = seq.getEncodedHex ( ) ;
-373 return this.hTLV ;
-374 } ;
-375
-376 if ( typeof params != "undefined" ) {
-377 if ( typeof params.status == "object" ) {
-378 this.dStatus = new nT.PKIStatusInfo ( params.status ) ;
-379 }
-380 if ( typeof params.tst != "undefined" &&
-381 params.tst instanceof KJUR.asn1.ASN1Object ) {
-382 this.dTST = params.tst.getContentInfo ( ) ;
-383 }
-384 }
-385 } ;
-386 YAHOO.lang.extend ( KJUR.asn1.tsp.TimeStampResp , KJUR.asn1.ASN1Object ) ;
-387
-388 // --- BEGIN OF RFC 2510 CMP -----------------------------------------------
-389
-390 /**
-391 * class for TSP PKIStatusInfo ASN.1 object
-392 * @name KJUR.asn1.tsp.PKIStatusInfo
-393 * @class class for TSP PKIStatusInfo ASN.1 object
-394 * @param {Array} params associative array of parameters
-395 * @extends KJUR.asn1.ASN1Object
-396 * @since jsrsasign 4.6.0 asn1tsp 1.0.0
-397 * @description
-398 * <pre>
-399 * PKIStatusInfo ::= SEQUENCE {
-400 * status PKIStatus,
-401 * statusString PKIFreeText OPTIONAL,
-402 * failInfo PKIFailureInfo OPTIONAL }
-403 * </pre>
-404 */
-405 KJUR.asn1.tsp.PKIStatusInfo = function ( params ) {
-406 KJUR.asn1.tsp.PKIStatusInfo.superclass.constructor.call ( this ) ;
-407 var nA = KJUR.asn1 ;
-408 var nT = KJUR.asn1.tsp ;
-409 this.dStatus = null ;
-410 this.dStatusString = null ;
-411 this.dFailureInfo = null ;
-412
-413 this.getEncodedHex = function ( ) {
-414 if ( this.dStatus == null )
-415 throw "status shall be specified" ;
-416 var a = [ this.dStatus ] ;
-417 if ( this.dStatusString != null ) a.push ( this.dStatusString ) ;
-418 if ( this.dFailureInfo != null ) a.push ( this.dFailureInfo ) ;
-419 var seq = new nA.DERSequence ( { array : a } ) ;
-420 this.hTLV = seq.getEncodedHex ( ) ;
-421 return this.hTLV ;
-422 } ;
-423
-424 if ( typeof params != "undefined" ) {
-425 if ( typeof params.status == "object" ) { // param for int
-426 this.dStatus = new nT.PKIStatus ( params.status ) ;
-427 }
-428 if ( typeof params.statstr == "object" ) { // array of str
-429 this.dStatusString =
-430 new nT.PKIFreeText ( { array : params.statstr } ) ;
-431 }
-432 if ( typeof params.failinfo == "object" ) {
-433 this.dFailureInfo =
-434 new nT.PKIFailureInfo ( params.failinfo ) ; // param for bitstr
-435 }
-436 } ;
-437 } ;
-438 YAHOO.lang.extend ( KJUR.asn1.tsp.PKIStatusInfo , KJUR.asn1.ASN1Object ) ;
-439
-440 /**
-441 * class for TSP PKIStatus ASN.1 object
-442 * @name KJUR.asn1.tsp.PKIStatus
-443 * @class class for TSP PKIStatus ASN.1 object
-444 * @param {Array} params associative array of parameters
-445 * @extends KJUR.asn1.ASN1Object
-446 * @since jsrsasign 4.6.0 asn1tsp 1.0.0
-447 * @description
-448 * <pre>
-449 * PKIStatus ::= INTEGER {
-450 * granted (0),
-451 * grantedWithMods (1),
-452 * rejection (2),
-453 * waiting (3),
-454 * revocationWarning (4),
-455 * revocationNotification (5) }
-456 * </pre>
-457 */
-458 KJUR.asn1.tsp.PKIStatus = function ( params ) {
-459 KJUR.asn1.tsp.PKIStatus.superclass.constructor.call ( this ) ;
-460 var nA = KJUR.asn1 ;
-461 var nT = KJUR.asn1.tsp ;
-462 var dStatus = null ;
-463
-464 this.getEncodedHex = function ( ) {
-465 this.hTLV = this.dStatus.getEncodedHex ( ) ;
-466 return this.hTLV ;
-467 } ;
-468
-469 if ( typeof params != "undefined" ) {
-470 if ( typeof params.name != "undefined" ) {
-471 var list = nT.PKIStatus.valueList ;
-472 if ( typeof list [ params.name ] == "undefined" )
-473 throw "name undefined: " + params.name ;
-474 this.dStatus =
-475 new nA.DERInteger ( { 'int' : list [ params.name ] } ) ;
-476 } else {
-477 this.dStatus = new nA.DERInteger ( params ) ;
-478 }
-479 }
-480 } ;
-481 YAHOO.lang.extend ( KJUR.asn1.tsp.PKIStatus , KJUR.asn1.ASN1Object ) ;
-482
-483 KJUR.asn1.tsp.PKIStatus.valueList = {
-484 granted : 0 ,
-485 grantedWithMods : 1 ,
-486 rejection : 2 ,
-487 waiting : 3 ,
-488 revocationWarning : 4 ,
-489 revocationNotification : 5
-490 } ;
-491
-492 /**
-493 * class for TSP PKIFreeText ASN.1 object
-494 * @name KJUR.asn1.tsp.PKIFreeText
-495 * @class class for TSP PKIFreeText ASN.1 object
-496 * @param {Array} params associative array of parameters
-497 * @extends KJUR.asn1.ASN1Object
-498 * @since jsrsasign 4.6.0 asn1tsp 1.0.0
-499 * @description
-500 * <pre>
-501 * PKIFreeText ::= SEQUENCE {
-502 * SIZE (1..MAX) OF UTF8String }
-503 * </pre>
-504 */
-505 KJUR.asn1.tsp.PKIFreeText = function ( params ) {
-506 KJUR.asn1.tsp.PKIFreeText.superclass.constructor.call ( this ) ;
-507 var nA = KJUR.asn1 ;
-508 this.textList = [ ] ;
-509
-510 this.getEncodedHex = function ( ) {
-511 var a = [ ] ;
-512 for ( var i = 0 ; i < this.textList.length ; i ++ ) {
-513 a.push ( new nA.DERUTF8String ( { str : this.textList [ i ] } ) ) ;
-514 }
-515 var seq = new nA.DERSequence ( { array : a } ) ;
-516 this.hTLV = seq.getEncodedHex ( ) ;
-517 return this.hTLV ;
-518 } ;
-519
-520 if ( typeof params != "undefined" ) {
-521 if ( typeof params.array == "object" ) {
-522 this.textList = params.array ;
-523 }
-524 }
-525 } ;
-526 YAHOO.lang.extend ( KJUR.asn1.tsp.PKIFreeText , KJUR.asn1.ASN1Object ) ;
-527
-528 /**
-529 * class for TSP PKIFailureInfo ASN.1 object
-530 * @name KJUR.asn1.tsp.PKIFailureInfo
-531 * @class class for TSP PKIFailureInfo ASN.1 object
-532 * @param {Array} params associative array of parameters
-533 * @extends KJUR.asn1.ASN1Object
-534 * @since jsrsasign 4.6.0 asn1tsp 1.0.0
-535 * @description
-536 * <pre>
-537 * PKIFailureInfo ::= BIT STRING {
-538 * badAlg (0),
-539 * badRequest (2),
-540 * badDataFormat (5),
-541 * timeNotAvailable (14),
-542 * unacceptedPolicy (15),
-543 * unacceptedExtension (16),
-544 * addInfoNotAvailable (17),
-545 * systemFailure (25) }
-546 * </pre>
-547 */
-548 KJUR.asn1.tsp.PKIFailureInfo = function ( params ) {
-549 KJUR.asn1.tsp.PKIFailureInfo.superclass.constructor.call ( this ) ;
-550 var nA = KJUR.asn1 ;
-551 var nT = KJUR.asn1.tsp ;
-552 this.value = null ;
-553
-554 this.getEncodedHex = function ( ) {
-555 if ( this.value == null )
-556 throw "value shall be specified" ;
-557 var binValue = new Number ( this.value ) . toString ( 2 ) ;
-558 var dValue = new nA.DERBitString ( ) ;
-559 dValue.setByBinaryString ( binValue ) ;
-560 this.hTLV = dValue.getEncodedHex ( ) ;
-561 return this.hTLV ;
-562 } ;
-563
-564 if ( typeof params != "undefined" ) {
-565 if ( typeof params.name == "string" ) {
-566 var list = nT.PKIFailureInfo.valueList ;
-567 if ( typeof list [ params.name ] == "undefined" )
-568 throw "name undefined: " + params.name ;
-569 this.value = list [ params.name ] ;
-570 } else if ( typeof params [ 'int' ] == "number" ) {
-571 this.value = params [ 'int' ] ;
-572 }
-573 }
-574 } ;
-575 YAHOO.lang.extend ( KJUR.asn1.tsp.PKIFailureInfo , KJUR.asn1.ASN1Object ) ;
-576
-577 KJUR.asn1.tsp.PKIFailureInfo.valueList = {
-578 badAlg : 0 ,
-579 badRequest : 2 ,
-580 badDataFormat : 5 ,
-581 timeNotAvailable : 14 ,
-582 unacceptedPolicy : 15 ,
-583 unacceptedExtension : 16 ,
-584 addInfoNotAvailable : 17 ,
-585 systemFailure : 25
-586 } ;
-587
-588 // --- END OF RFC 2510 CMP -------------------------------------------
-589
-590 /**
-591 * abstract class for TimeStampToken generator
-592 * @name KJUR.asn1.tsp.AbstractTSAAdapter
-593 * @class abstract class for TimeStampToken generator
-594 * @param {Array} params associative array of parameters
-595 * @since jsrsasign 4.7.0 asn1tsp 1.0.1
-596 * @description
-597 */
-598 KJUR.asn1.tsp.AbstractTSAAdapter = function ( params ) {
-599 this.getTSTHex = function ( msgHex , hashAlg ) {
-600 throw "not implemented yet" ;
-601 } ;
-602 } ;
-603
-604 /**
-605 * class for simple TimeStampToken generator
-606 * @name KJUR.asn1.tsp.SimpleTSAAdapter
-607 * @class class for simple TimeStampToken generator
-608 * @param {Array} params associative array of parameters
-609 * @since jsrsasign 4.7.0 asn1tsp 1.0.1
-610 * @description
-611 */
-612 KJUR.asn1.tsp.SimpleTSAAdapter = function ( initParams ) {
-613 KJUR.asn1.tsp.SimpleTSAAdapter.superclass.constructor.call ( this ) ;
-614 this.params = null ;
-615 this.serial = 0 ;
-616
-617 this.getTSTHex = function ( msgHex , hashAlg ) {
-618 // messageImprint
-619 var hashHex = KJUR.crypto.Util.hashHex ( msgHex , hashAlg ) ;
-620 this.params.tstInfo.messageImprint =
-621 { hashAlg : hashAlg , hashValue : hashHex } ;
-622
-623 // serial
-624 this.params.tstInfo.serialNumber = { 'int' : this.serial ++ } ;
-625
-626 // nonce
-627 var nonceValue = Math.floor ( Math.random ( ) * 1000000000 ) ;
-628 this.params.tstInfo.nonce = { 'int' : nonceValue } ;
-629
-630 var obj =
-631 KJUR.asn1.tsp.TSPUtil.newTimeStampToken ( this.params ) ;
-632 return obj.getContentInfoEncodedHex ( ) ;
-633 } ;
-634
-635 if ( typeof initParams != "undefined" ) {
-636 this.params = initParams ;
-637 }
-638 } ;
-639 YAHOO.lang.extend ( KJUR.asn1.tsp.SimpleTSAAdapter ,
-640 KJUR.asn1.tsp.AbstractTSAAdapter ) ;
-641
-642 /**
-643 * class for fixed TimeStampToken generator
-644 * @name KJUR.asn1.tsp.FixedTSAAdapter
-645 * @class class for fixed TimeStampToken generator
-646 * @param {Array} params associative array of parameters
-647 * @since jsrsasign 4.7.0 asn1tsp 1.0.1
-648 * @description
-649 * This class generates fixed TimeStampToken except messageImprint
-650 * for testing purpose.
-651 * General TSA generates TimeStampToken which varies following
-652 * fields:
-653 * <ul>
-654 * <li>genTime</li>
-655 * <li>serialNumber</li>
-656 * <li>nonce</li>
-657 * </ul>
-658 * Those values are provided by initial parameters.
-659 */
-660 KJUR.asn1.tsp.FixedTSAAdapter = function ( initParams ) {
-661 KJUR.asn1.tsp.FixedTSAAdapter.superclass.constructor.call ( this ) ;
-662 this.params = null ;
-663
-664 this.getTSTHex = function ( msgHex , hashAlg ) {
-665 // fixed serialNumber
-666 // fixed nonce
-667 var hashHex = KJUR.crypto.Util.hashHex ( msgHex , hashAlg ) ;
-668 this.params.tstInfo.messageImprint =
-669 { hashAlg : hashAlg , hashValue : hashHex } ;
-670 var obj =
-671 KJUR.asn1.tsp.TSPUtil.newTimeStampToken ( this.params ) ;
-672 return obj.getContentInfoEncodedHex ( ) ;
-673 } ;
-674
-675 if ( typeof initParams != "undefined" ) {
-676 this.params = initParams ;
-677 }
-678 } ;
-679 YAHOO.lang.extend ( KJUR.asn1.tsp.FixedTSAAdapter ,
-680 KJUR.asn1.tsp.AbstractTSAAdapter ) ;
-681
-682 // --- TSP utilities -------------------------------------------------
-683
-684 /**
-685 * TSP utiliteis class
-686 * @name KJUR.asn1.tsp.TSPUtil
-687 * @class TSP utilities class
-688 */
-689 KJUR.asn1.tsp.TSPUtil = new function ( ) {
-690 } ;
-691 /**
-692 * generate TimeStampToken ASN.1 object specified by JSON parameters
-693 * @name newTimeStampToken
-694 * @memberOf KJUR.asn1.tsp.TSPUtil
-695 * @function
-696 * @param {Array} param JSON parameter to generate TimeStampToken
-697 * @return {KJUR.asn1.cms.SignedData} object just generated
-698 * @description
-699 * @example
-700 */
-701 KJUR.asn1.tsp.TSPUtil.newTimeStampToken = function ( param ) {
-702 var nC = KJUR.asn1.cms ;
-703 var nT = KJUR.asn1.tsp ;
-704 var sd = new nC.SignedData ( ) ;
-705
-706 var dTSTInfo = new nT.TSTInfo ( param.tstInfo ) ;
-707 var tstInfoHex = dTSTInfo.getEncodedHex ( ) ;
-708 sd.dEncapContentInfo.setContentValue ( { hex : tstInfoHex } ) ;
-709 sd.dEncapContentInfo.setContentType ( 'tstinfo' ) ;
-710
-711 if ( typeof param.certs == "object" ) {
-712 for ( var i = 0 ; i < param.certs.length ; i ++ ) {
-713 sd.addCertificatesByPEM ( param.certs [ i ] ) ;
-714 }
-715 }
-716
-717 var si = sd.signerInfoList [ 0 ] ;
-718 si.setSignerIdentifier ( param.signerCert ) ;
-719 si.setForContentAndHash ( { sdObj : sd ,
-720 eciObj : sd.dEncapContentInfo ,
-721 hashAlg : param.hashAlg } ) ;
-722 var signingCertificate =
-723 new nC.SigningCertificate ( { array : [ param.signerCert ] } ) ;
-724 si.dSignedAttrs.add ( signingCertificate ) ;
-725
-726 si.sign ( param.signerPrvKey , param.sigAlg ) ;
-727
-728 return sd ;
-729 } ;
-730
-731 /**
-732 * parse hexadecimal string of TimeStampReq
-733 * @name parseTimeStampReq
-734 * @memberOf KJUR.asn1.tsp.TSPUtil
-735 * @function
-736 * @param {String} hexadecimal string of TimeStampReq
-737 * @return {Array} JSON object of parsed parameters
-738 * @description
-739 * This method parses a hexadecimal string of TimeStampReq
-740 * and returns parsed their fields:
-741 * @example
-742 * var json = KJUR.asn1.tsp.TSPUtil.parseTimeStampReq("302602...");
-743 * // resulted DUMP of above 'json':
-744 * {mi: {hashAlg: 'sha256', // MessageImprint hashAlg
-745 * hashValue: 'a1a2a3a4...'}, // MessageImprint hashValue
-746 * policy: '1.2.3.4.5', // tsaPolicy (OPTION)
-747 * nonce: '9abcf318...', // nonce (OPTION)
-748 * certreq: true} // certReq (OPTION)
-749 */
-750 KJUR.asn1.tsp.TSPUtil.parseTimeStampReq = function ( reqHex ) {
-751 var json = { } ;
-752 json.certreq = false ;
-753
-754 var idxList = ASN1HEX.getPosArrayOfChildren_AtObj ( reqHex , 0 ) ;
-755
-756 if ( idxList.length < 2 )
-757 throw "TimeStampReq must have at least 2 items" ;
-758
-759 var miHex = ASN1HEX.getHexOfTLV_AtObj ( reqHex , idxList [ 1 ] ) ;
-760 json.mi = KJUR.asn1.tsp.TSPUtil.parseMessageImprint ( miHex ) ;
-761
-762 for ( var i = 2 ; i < idxList.length ; i ++ ) {
-763 var idx = idxList [ i ] ;
-764 var tag = reqHex.substr ( idx , 2 ) ;
-765 if ( tag == "06" ) { // case OID
-766 var policyHex = ASN1HEX.getHexOfV_AtObj ( reqHex , idx ) ;
-767 json.policy = ASN1HEX.hextooidstr ( policyHex ) ;
-768 }
-769 if ( tag == "02" ) { // case INTEGER
-770 json.nonce = ASN1HEX.getHexOfV_AtObj ( reqHex , idx ) ;
-771 }
-772 if ( tag == "01" ) { // case BOOLEAN
-773 json.certreq = true ;
-774 }
-775 }
-776
-777 return json ;
-778 } ;
-779
-780 /**
-781 * parse hexadecimal string of MessageImprint
-782 * @name parseMessageImprint
-783 * @memberOf KJUR.asn1.tsp.TSPUtil
-784 * @function
-785 * @param {String} hexadecimal string of MessageImprint
-786 * @return {Array} JSON object of parsed parameters
-787 * @description
-788 * This method parses a hexadecimal string of MessageImprint
-789 * and returns parsed their fields:
-790 * @example
-791 * var json = KJUR.asn1.tsp.TSPUtil.parseMessageImprint("302602...");
-792 * // resulted DUMP of above 'json':
-793 * {hashAlg: 'sha256', // MessageImprint hashAlg
-794 * hashValue: 'a1a2a3a4...'} // MessageImprint hashValue
-795 */
-796 KJUR.asn1.tsp.TSPUtil.parseMessageImprint = function ( miHex ) {
-797 var json = { } ;
-798
-799 if ( miHex.substr ( 0 , 2 ) != "30" )
-800 throw "head of messageImprint hex shall be '30'" ;
-801
-802 var idxList = ASN1HEX.getPosArrayOfChildren_AtObj ( miHex , 0 ) ;
-803 var hashAlgOidIdx =
-804 ASN1HEX.getDecendantIndexByNthList ( miHex , 0 , [ 0 , 0 ] ) ;
-805 var hashAlgHex = ASN1HEX.getHexOfV_AtObj ( miHex , hashAlgOidIdx ) ;
-806 var hashAlgOid = ASN1HEX.hextooidstr ( hashAlgHex ) ;
-807 var hashAlgName = KJUR.asn1.x509.OID.oid2name ( hashAlgOid ) ;
-808 if ( hashAlgName == '' )
-809 throw "hashAlg name undefined: " + hashAlgOid ;
-810 var hashAlg = hashAlgName ;
-811
-812 var hashValueIdx =
-813 ASN1HEX.getDecendantIndexByNthList ( miHex , 0 , [ 1 ] ) ;
-814
-815 json.hashAlg = hashAlg ;
-816 json.hashValue = ASN1HEX.getHexOfV_AtObj ( miHex , hashValueIdx ) ;
-817
-818 return json ;
-819 } ;
-820
-821
\ No newline at end of file
diff --git a/jwt/api/symbols/src/asn1x509-1.0.js.html b/jwt/api/symbols/src/asn1x509-1.0.js.html
deleted file mode 100644
index e31d81a..0000000
--- a/jwt/api/symbols/src/asn1x509-1.0.js.html
+++ /dev/null
@@ -1,2169 +0,0 @@
-
1 /*! asn1x509-1.0.14.js (c) 2013-2015 Kenji Urushima | kjur.github.com/jsrsasign/license
- 2 */
- 3 /*
- 4 * asn1x509.js - ASN.1 DER encoder classes for X.509 certificate
- 5 *
- 6 * Copyright (c) 2013-2015 Kenji Urushima (kenji.urushima@gmail.com)
- 7 *
- 8 * This software is licensed under the terms of the MIT License.
- 9 * http://kjur.github.com/jsrsasign/license
- 10 *
- 11 * The above copyright and license notice shall be
- 12 * included in all copies or substantial portions of the Software.
- 13 */
- 14
- 15 /**
- 16 * @fileOverview
- 17 * @name asn1x509-1.0.js
- 18 * @author Kenji Urushima kenji.urushima@gmail.com
- 19 * @version 1.0.14 (2016-May-10)
- 20 * @since jsrsasign 2.1
- 21 * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a>
- 22 */
- 23
- 24 /**
- 25 * kjur's class library name space
- 26 * // already documented in asn1-1.0.js
- 27 * @name KJUR
- 28 * @namespace kjur's class library name space
- 29 */
- 30 if ( typeof KJUR == "undefined" || ! KJUR ) KJUR = { } ;
- 31
- 32 /**
- 33 * kjur's ASN.1 class library name space
- 34 * // already documented in asn1-1.0.js
- 35 * @name KJUR.asn1
- 36 * @namespace
- 37 */
- 38 if ( typeof KJUR.asn1 == "undefined" || ! KJUR.asn1 ) KJUR.asn1 = { } ;
- 39
- 40 /**
- 41 * kjur's ASN.1 class for X.509 certificate library name space
- 42 * <p>
- 43 * <h4>FEATURES</h4>
- 44 * <ul>
- 45 * <li>easily issue any kind of certificate</li>
- 46 * <li>APIs are very similar to BouncyCastle library ASN.1 classes. So easy to learn.</li>
- 47 * </ul>
- 48 * </p>
- 49 * <h4>PROVIDED CLASSES</h4>
- 50 * <ul>
- 51 * <li>{@link KJUR.asn1.x509.Certificate}</li>
- 52 * <li>{@link KJUR.asn1.x509.TBSCertificate}</li>
- 53 * <li>{@link KJUR.asn1.x509.Extension}</li>
- 54 * <li>{@link KJUR.asn1.x509.X500Name}</li>
- 55 * <li>{@link KJUR.asn1.x509.RDN}</li>
- 56 * <li>{@link KJUR.asn1.x509.AttributeTypeAndValue}</li>
- 57 * <li>{@link KJUR.asn1.x509.SubjectPublicKeyInfo}</li>
- 58 * <li>{@link KJUR.asn1.x509.AlgorithmIdentifier}</li>
- 59 * <li>{@link KJUR.asn1.x509.GeneralName}</li>
- 60 * <li>{@link KJUR.asn1.x509.GeneralNames}</li>
- 61 * <li>{@link KJUR.asn1.x509.DistributionPointName}</li>
- 62 * <li>{@link KJUR.asn1.x509.DistributionPoint}</li>
- 63 * <li>{@link KJUR.asn1.x509.CRL}</li>
- 64 * <li>{@link KJUR.asn1.x509.TBSCertList}</li>
- 65 * <li>{@link KJUR.asn1.x509.CRLEntry}</li>
- 66 * <li>{@link KJUR.asn1.x509.OID}</li>
- 67 * </ul>
- 68 * <h4>SUPPORTED EXTENSIONS</h4>
- 69 * <ul>
- 70 * <li>{@link KJUR.asn1.x509.BasicConstraints}</li>
- 71 * <li>{@link KJUR.asn1.x509.KeyUsage}</li>
- 72 * <li>{@link KJUR.asn1.x509.CRLDistributionPoints}</li>
- 73 * <li>{@link KJUR.asn1.x509.ExtKeyUsage}</li>
- 74 * <li>{@link KJUR.asn1.x509.AuthorityKeyIdentifier}</li>
- 75 * </ul>
- 76 * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.
- 77 * @name KJUR.asn1.x509
- 78 * @namespace
- 79 */
- 80 if ( typeof KJUR.asn1.x509 == "undefined" || ! KJUR.asn1.x509 ) KJUR.asn1.x509 = { } ;
- 81
- 82 // === BEGIN Certificate ===================================================
- 83
- 84 /**
- 85 * X.509 Certificate class to sign and generate hex encoded certificate
- 86 * @name KJUR.asn1.x509.Certificate
- 87 * @class X.509 Certificate class to sign and generate hex encoded certificate
- 88 * @param {Array} params associative array of parameters (ex. {'tbscertobj': obj, 'prvkeyobj': key})
- 89 * @extends KJUR.asn1.ASN1Object
- 90 * @description
- 91 * <br/>
- 92 * As for argument 'params' for constructor, you can specify one of
- 93 * following properties:
- 94 * <ul>
- 95 * <li>tbscertobj - specify {@link KJUR.asn1.x509.TBSCertificate} object</li>
- 96 * <li>prvkeyobj - specify {@link RSAKey}, {@link KJUR.crypto.ECDSA} or {@link KJUR.crypto.DSA} object for CA private key to sign the certificate</li>
- 97 * <li>(DEPRECATED)rsaprvkey - specify {@link RSAKey} object CA private key</li>
- 98 * <li>(DEPRECATED)rsaprvpem - specify PEM string of RSA CA private key</li>
- 99 * </ul>
-100 * NOTE1: 'params' can be omitted.<br/>
-101 * NOTE2: DSA/ECDSA is also supported for CA signging key from asn1x509 1.0.6.
-102 * @example
-103 * var caKey = KEYUTIL.getKey(caKeyPEM); // CA's private key
-104 * var cert = new KJUR.asn1x509.Certificate({'tbscertobj': tbs, 'prvkeyobj': caKey});
-105 * cert.sign(); // issue certificate by CA's private key
-106 * var certPEM = cert.getPEMString();
-107 *
-108 * // Certificate ::= SEQUENCE {
-109 * // tbsCertificate TBSCertificate,
-110 * // signatureAlgorithm AlgorithmIdentifier,
-111 * // signature BIT STRING }
-112 */
-113 KJUR.asn1.x509.Certificate = function ( params ) {
-114 KJUR.asn1.x509.Certificate.superclass.constructor.call ( this ) ;
-115 var asn1TBSCert = null ;
-116 var asn1SignatureAlg = null ;
-117 var asn1Sig = null ;
-118 var hexSig = null ;
-119 var prvKey = null ;
-120 var rsaPrvKey = null ; // DEPRECATED
-121
-122
-123 /**
-124 * set PKCS#5 encrypted RSA PEM private key as CA key
-125 * @name setRsaPrvKeyByPEMandPass
-126 * @memberOf KJUR.asn1.x509.Certificate
-127 * @function
-128 * @param {String} rsaPEM string of PKCS#5 encrypted RSA PEM private key
-129 * @param {String} passPEM passcode string to decrypt private key
-130 * @since 1.0.1
-131 * @description
-132 * <br/>
-133 * <h4>EXAMPLES</h4>
-134 * @example
-135 * var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs});
-136 * cert.setRsaPrvKeyByPEMandPass("-----BEGIN RSA PRIVATE..(snip)", "password");
-137 */
-138 this.setRsaPrvKeyByPEMandPass = function ( rsaPEM , passPEM ) {
-139 var caKeyHex = PKCS5PKEY.getDecryptedKeyHex ( rsaPEM , passPEM ) ;
-140 var caKey = new RSAKey ( ) ;
-141 caKey.readPrivateKeyFromASN1HexString ( caKeyHex ) ;
-142 this.prvKey = caKey ;
-143 } ;
-144
-145 /**
-146 * sign TBSCertificate and set signature value internally
-147 * @name sign
-148 * @memberOf KJUR.asn1.x509.Certificate
-149 * @function
-150 * @description
-151 * @example
-152 * var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs, 'rsaprvkey': prvKey});
-153 * cert.sign();
-154 */
-155 this.sign = function ( ) {
-156 this.asn1SignatureAlg = this.asn1TBSCert.asn1SignatureAlg ;
-157
-158 sig = new KJUR.crypto.Signature ( { 'alg' : 'SHA1withRSA' } ) ;
-159 sig.init ( this.prvKey ) ;
-160 sig.updateHex ( this.asn1TBSCert.getEncodedHex ( ) ) ;
-161 this.hexSig = sig.sign ( ) ;
-162
-163 this.asn1Sig = new KJUR.asn1.DERBitString ( { 'hex' : '00' + this.hexSig } ) ;
-164
-165 var seq = new KJUR.asn1.DERSequence ( { 'array' : [ this.asn1TBSCert ,
-166 this.asn1SignatureAlg ,
-167 this.asn1Sig ] } ) ;
-168 this.hTLV = seq.getEncodedHex ( ) ;
-169 this.isModified = false ;
-170 } ;
-171
-172 /**
-173 * set signature value internally by hex string
-174 * @name setSignatureHex
-175 * @memberOf KJUR.asn1.x509.Certificate
-176 * @function
-177 * @since asn1x509 1.0.8
-178 * @description
-179 * @example
-180 * var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs});
-181 * cert.setSignatureHex('01020304');
-182 */
-183 this.setSignatureHex = function ( sigHex ) {
-184 this.asn1SignatureAlg = this.asn1TBSCert.asn1SignatureAlg ;
-185 this.hexSig = sigHex ;
-186 this.asn1Sig = new KJUR.asn1.DERBitString ( { 'hex' : '00' + this.hexSig } ) ;
-187
-188 var seq = new KJUR.asn1.DERSequence ( { 'array' : [ this.asn1TBSCert ,
-189 this.asn1SignatureAlg ,
-190 this.asn1Sig ] } ) ;
-191 this.hTLV = seq.getEncodedHex ( ) ;
-192 this.isModified = false ;
-193 } ;
-194
-195 this.getEncodedHex = function ( ) {
-196 if ( this.isModified == false && this.hTLV != null ) return this.hTLV ;
-197 throw "not signed yet" ;
-198 } ;
-199
-200 /**
-201 * get PEM formatted certificate string after signed
-202 * @name getPEMString
-203 * @memberOf KJUR.asn1.x509.Certificate
-204 * @function
-205 * @return PEM formatted string of certificate
-206 * @description
-207 * @example
-208 * var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs, 'rsaprvkey': prvKey});
-209 * cert.sign();
-210 * var sPEM = cert.getPEMString();
-211 */
-212 this.getPEMString = function ( ) {
-213 var hCert = this.getEncodedHex ( ) ;
-214 var wCert = CryptoJS.enc.Hex.parse ( hCert ) ;
-215 var b64Cert = CryptoJS.enc.Base64.stringify ( wCert ) ;
-216 var pemBody = b64Cert.replace ( /(.{64})/g , "$1\r\n" ) ;
-217 return "-----BEGIN CERTIFICATE-----\r\n" + pemBody + "\r\n-----END CERTIFICATE-----\r\n" ;
-218 } ;
-219
-220 if ( typeof params != "undefined" ) {
-221 if ( typeof params [ 'tbscertobj' ] != "undefined" ) {
-222 this.asn1TBSCert = params [ 'tbscertobj' ] ;
-223 }
-224 if ( typeof params [ 'prvkeyobj' ] != "undefined" ) {
-225 this.prvKey = params [ 'prvkeyobj' ] ;
-226 } else if ( typeof params [ 'rsaprvkey' ] != "undefined" ) {
-227 this.prvKey = params [ 'rsaprvkey' ] ;
-228 } else if ( ( typeof params [ 'rsaprvpem' ] != "undefined" ) &&
-229 ( typeof params [ 'rsaprvpas' ] != "undefined" ) ) {
-230 this.setRsaPrvKeyByPEMandPass ( params [ 'rsaprvpem' ] , params [ 'rsaprvpas' ] ) ;
-231 }
-232 }
-233 } ;
-234 YAHOO.lang.extend ( KJUR.asn1.x509.Certificate , KJUR.asn1.ASN1Object ) ;
-235
-236 /**
-237 * ASN.1 TBSCertificate structure class
-238 * @name KJUR.asn1.x509.TBSCertificate
-239 * @class ASN.1 TBSCertificate structure class
-240 * @param {Array} params associative array of parameters (ex. {})
-241 * @extends KJUR.asn1.ASN1Object
-242 * @description
-243 * <br/>
-244 * <h4>EXAMPLE</h4>
-245 * @example
-246 * var o = new KJUR.asn1.x509.TBSCertificate();
-247 * o.setSerialNumberByParam({'int': 4});
-248 * o.setSignatureAlgByParam({'name': 'SHA1withRSA'});
-249 * o.setIssuerByParam({'str': '/C=US/O=a'});
-250 * o.setNotBeforeByParam({'str': '130504235959Z'});
-251 * o.setNotAfterByParam({'str': '140504235959Z'});
-252 * o.setSubjectByParam({'str': '/C=US/CN=b'});
-253 * o.setSubjectPublicKeyByParam({'rsakey': rsaKey});
-254 * o.appendExtension(new KJUR.asn1.x509.BasicConstraints({'cA':true}));
-255 * o.appendExtension(new KJUR.asn1.x509.KeyUsage({'bin':'11'}));
-256 */
-257 KJUR.asn1.x509.TBSCertificate = function ( params ) {
-258 KJUR.asn1.x509.TBSCertificate.superclass.constructor.call ( this ) ;
-259
-260 this._initialize = function ( ) {
-261 this.asn1Array = new Array ( ) ;
-262
-263 this.asn1Version =
-264 new KJUR.asn1.DERTaggedObject ( { 'obj' : new KJUR.asn1.DERInteger ( { 'int' : 2 } ) } ) ;
-265 this.asn1SerialNumber = null ;
-266 this.asn1SignatureAlg = null ;
-267 this.asn1Issuer = null ;
-268 this.asn1NotBefore = null ;
-269 this.asn1NotAfter = null ;
-270 this.asn1Subject = null ;
-271 this.asn1SubjPKey = null ;
-272 this.extensionsArray = new Array ( ) ;
-273 } ;
-274
-275 /**
-276 * set serial number field by parameter
-277 * @name setSerialNumberByParam
-278 * @memberOf KJUR.asn1.x509.TBSCertificate
-279 * @function
-280 * @param {Array} intParam DERInteger param
-281 * @description
-282 * @example
-283 * tbsc.setSerialNumberByParam({'int': 3});
-284 */
-285 this.setSerialNumberByParam = function ( intParam ) {
-286 this.asn1SerialNumber = new KJUR.asn1.DERInteger ( intParam ) ;
-287 } ;
-288
-289 /**
-290 * set signature algorithm field by parameter
-291 * @name setSignatureAlgByParam
-292 * @memberOf KJUR.asn1.x509.TBSCertificate
-293 * @function
-294 * @param {Array} algIdParam AlgorithmIdentifier parameter
-295 * @description
-296 * @example
-297 * tbsc.setSignatureAlgByParam({'name': 'SHA1withRSA'});
-298 */
-299 this.setSignatureAlgByParam = function ( algIdParam ) {
-300 this.asn1SignatureAlg = new KJUR.asn1.x509.AlgorithmIdentifier ( algIdParam ) ;
-301 } ;
-302
-303 /**
-304 * set issuer name field by parameter
-305 * @name setIssuerByParam
-306 * @memberOf KJUR.asn1.x509.TBSCertificate
-307 * @function
-308 * @param {Array} x500NameParam X500Name parameter
-309 * @description
-310 * @example
-311 * tbsc.setIssuerParam({'str': '/C=US/CN=b'});
-312 * @see KJUR.asn1.x509.X500Name
-313 */
-314 this.setIssuerByParam = function ( x500NameParam ) {
-315 this.asn1Issuer = new KJUR.asn1.x509.X500Name ( x500NameParam ) ;
-316 } ;
-317
-318 /**
-319 * set notBefore field by parameter
-320 * @name setNotBeforeByParam
-321 * @memberOf KJUR.asn1.x509.TBSCertificate
-322 * @function
-323 * @param {Array} timeParam Time parameter
-324 * @description
-325 * @example
-326 * tbsc.setNotBeforeByParam({'str': '130508235959Z'});
-327 * @see KJUR.asn1.x509.Time
-328 */
-329 this.setNotBeforeByParam = function ( timeParam ) {
-330 this.asn1NotBefore = new KJUR.asn1.x509.Time ( timeParam ) ;
-331 } ;
-332
-333 /**
-334 * set notAfter field by parameter
-335 * @name setNotAfterByParam
-336 * @memberOf KJUR.asn1.x509.TBSCertificate
-337 * @function
-338 * @param {Array} timeParam Time parameter
-339 * @description
-340 * @example
-341 * tbsc.setNotAfterByParam({'str': '130508235959Z'});
-342 * @see KJUR.asn1.x509.Time
-343 */
-344 this.setNotAfterByParam = function ( timeParam ) {
-345 this.asn1NotAfter = new KJUR.asn1.x509.Time ( timeParam ) ;
-346 } ;
-347
-348 /**
-349 * set subject name field by parameter
-350 * @name setSubjectByParam
-351 * @memberOf KJUR.asn1.x509.TBSCertificate
-352 * @function
-353 * @param {Array} x500NameParam X500Name parameter
-354 * @description
-355 * @example
-356 * tbsc.setSubjectParam({'str': '/C=US/CN=b'});
-357 * @see KJUR.asn1.x509.X500Name
-358 */
-359 this.setSubjectByParam = function ( x500NameParam ) {
-360 this.asn1Subject = new KJUR.asn1.x509.X500Name ( x500NameParam ) ;
-361 } ;
-362
-363 /**
-364 * (DEPRECATED) set subject public key info field by RSA key parameter
-365 * @name setSubjectPublicKeyByParam
-366 * @memberOf KJUR.asn1.x509.TBSCertificate
-367 * @function
-368 * @param {Array} subjPKeyParam SubjectPublicKeyInfo parameter of RSA
-369 * @deprecated
-370 * @description
-371 * @example
-372 * tbsc.setSubjectPublicKeyByParam({'rsakey': pubKey});
-373 * @see KJUR.asn1.x509.SubjectPublicKeyInfo
-374 */
-375 this.setSubjectPublicKeyByParam = function ( subjPKeyParam ) {
-376 this.asn1SubjPKey = new KJUR.asn1.x509.SubjectPublicKeyInfo ( subjPKeyParam ) ;
-377 } ;
-378
-379 /**
-380 * set subject public key info by RSA/ECDSA/DSA key parameter
-381 * @name setSubjectPublicKeyByGetKey
-382 * @memberOf KJUR.asn1.x509.TBSCertificate
-383 * @function
-384 * @param {Object} keyParam public key parameter which passed to {@link KEYUTIL.getKey} argument
-385 * @description
-386 * @example
-387 * tbsc.setSubjectPublicKeyByGetKeyParam(certPEMString); // or
-388 * tbsc.setSubjectPublicKeyByGetKeyParam(pkcs8PublicKeyPEMString); // or
-389 * tbsc.setSubjectPublicKeyByGetKeyParam(kjurCryptoECDSAKeyObject); // et.al.
-390 * @see KJUR.asn1.x509.SubjectPublicKeyInfo
-391 * @see KEYUTIL.getKey
-392 * @since asn1x509 1.0.6
-393 */
-394 this.setSubjectPublicKeyByGetKey = function ( keyParam ) {
-395 var keyObj = KEYUTIL.getKey ( keyParam ) ;
-396 this.asn1SubjPKey = new KJUR.asn1.x509.SubjectPublicKeyInfo ( keyObj ) ;
-397 } ;
-398
-399 /**
-400 * append X.509v3 extension to this object
-401 * @name appendExtension
-402 * @memberOf KJUR.asn1.x509.TBSCertificate
-403 * @function
-404 * @param {Extension} extObj X.509v3 Extension object
-405 * @description
-406 * @example
-407 * tbsc.appendExtension(new KJUR.asn1.x509.BasicConstraints({'cA':true, 'critical': true}));
-408 * tbsc.appendExtension(new KJUR.asn1.x509.KeyUsage({'bin':'11'}));
-409 * @see KJUR.asn1.x509.Extension
-410 */
-411 this.appendExtension = function ( extObj ) {
-412 this.extensionsArray.push ( extObj ) ;
-413 } ;
-414
-415 /**
-416 * append X.509v3 extension to this object by name and parameters
-417 * @name appendExtensionByName
-418 * @memberOf KJUR.asn1.x509.TBSCertificate
-419 * @function
-420 * @param {name} name name of X.509v3 Extension object
-421 * @param {Array} extParams parameters as argument of Extension constructor.
-422 * @description
-423 * @example
-424 * tbsc.appendExtensionByName('BasicConstraints', {'cA':true, 'critical': true});
-425 * tbsc.appendExtensionByName('KeyUsage', {'bin':'11'});
-426 * tbsc.appendExtensionByName('CRLDistributionPoints', {uri: 'http://aaa.com/a.crl'});
-427 * tbsc.appendExtensionByName('ExtKeyUsage', {array: [{name: 'clientAuth'}]});
-428 * tbsc.appendExtensionByName('AuthorityKeyIdentifier', {kid: '1234ab..'});
-429 * @see KJUR.asn1.x509.Extension
-430 */
-431 this.appendExtensionByName = function ( name , extParams ) {
-432 if ( name.toLowerCase ( ) == "basicconstraints" ) {
-433 var extObj = new KJUR.asn1.x509.BasicConstraints ( extParams ) ;
-434 this.appendExtension ( extObj ) ;
-435 } else if ( name.toLowerCase ( ) == "keyusage" ) {
-436 var extObj = new KJUR.asn1.x509.KeyUsage ( extParams ) ;
-437 this.appendExtension ( extObj ) ;
-438 } else if ( name.toLowerCase ( ) == "crldistributionpoints" ) {
-439 var extObj = new KJUR.asn1.x509.CRLDistributionPoints ( extParams ) ;
-440 this.appendExtension ( extObj ) ;
-441 } else if ( name.toLowerCase ( ) == "extkeyusage" ) {
-442 var extObj = new KJUR.asn1.x509.ExtKeyUsage ( extParams ) ;
-443 this.appendExtension ( extObj ) ;
-444 } else if ( name.toLowerCase ( ) == "authoritykeyidentifier" ) {
-445 var extObj = new KJUR.asn1.x509.AuthorityKeyIdentifier ( extParams ) ;
-446 this.appendExtension ( extObj ) ;
-447 } else {
-448 throw "unsupported extension name: " + name ;
-449 }
-450 } ;
-451
-452 this.getEncodedHex = function ( ) {
-453 if ( this.asn1NotBefore == null || this.asn1NotAfter == null )
-454 throw "notBefore and/or notAfter not set" ;
-455 var asn1Validity =
-456 new KJUR.asn1.DERSequence ( { 'array' : [ this.asn1NotBefore , this.asn1NotAfter ] } ) ;
-457
-458 this.asn1Array = new Array ( ) ;
-459
-460 this.asn1Array.push ( this.asn1Version ) ;
-461 this.asn1Array.push ( this.asn1SerialNumber ) ;
-462 this.asn1Array.push ( this.asn1SignatureAlg ) ;
-463 this.asn1Array.push ( this.asn1Issuer ) ;
-464 this.asn1Array.push ( asn1Validity ) ;
-465 this.asn1Array.push ( this.asn1Subject ) ;
-466 this.asn1Array.push ( this.asn1SubjPKey ) ;
-467
-468 if ( this.extensionsArray.length > 0 ) {
-469 var extSeq = new KJUR.asn1.DERSequence ( { "array" : this.extensionsArray } ) ;
-470 var extTagObj = new KJUR.asn1.DERTaggedObject ( { 'explicit' : true ,
-471 'tag' : 'a3' ,
-472 'obj' : extSeq } ) ;
-473 this.asn1Array.push ( extTagObj ) ;
-474 }
-475
-476 var o = new KJUR.asn1.DERSequence ( { "array" : this.asn1Array } ) ;
-477 this.hTLV = o.getEncodedHex ( ) ;
-478 this.isModified = false ;
-479 return this.hTLV ;
-480 } ;
-481
-482 this._initialize ( ) ;
-483 } ;
-484 YAHOO.lang.extend ( KJUR.asn1.x509.TBSCertificate , KJUR.asn1.ASN1Object ) ;
-485
-486 // === END TBSCertificate ===================================================
-487
-488 // === BEGIN X.509v3 Extensions Related =======================================
-489
-490 /**
-491 * base Extension ASN.1 structure class
-492 * @name KJUR.asn1.x509.Extension
-493 * @class base Extension ASN.1 structure class
-494 * @param {Array} params associative array of parameters (ex. {'critical': true})
-495 * @extends KJUR.asn1.ASN1Object
-496 * @description
-497 * @example
-498 * // Extension ::= SEQUENCE {
-499 * // extnID OBJECT IDENTIFIER,
-500 * // critical BOOLEAN DEFAULT FALSE,
-501 * // extnValue OCTET STRING }
-502 */
-503 KJUR.asn1.x509.Extension = function ( params ) {
-504 KJUR.asn1.x509.Extension.superclass.constructor.call ( this ) ;
-505 var asn1ExtnValue = null ;
-506
-507 this.getEncodedHex = function ( ) {
-508 var asn1Oid = new KJUR.asn1.DERObjectIdentifier ( { 'oid' : this.oid } ) ;
-509 var asn1EncapExtnValue =
-510 new KJUR.asn1.DEROctetString ( { 'hex' : this.getExtnValueHex ( ) } ) ;
-511
-512 var asn1Array = new Array ( ) ;
-513 asn1Array.push ( asn1Oid ) ;
-514 if ( this.critical ) asn1Array.push ( new KJUR.asn1.DERBoolean ( ) ) ;
-515 asn1Array.push ( asn1EncapExtnValue ) ;
-516
-517 var asn1Seq = new KJUR.asn1.DERSequence ( { 'array' : asn1Array } ) ;
-518 return asn1Seq.getEncodedHex ( ) ;
-519 } ;
-520
-521 this.critical = false ;
-522 if ( typeof params != "undefined" ) {
-523 if ( typeof params [ 'critical' ] != "undefined" ) {
-524 this.critical = params [ 'critical' ] ;
-525 }
-526 }
-527 } ;
-528 YAHOO.lang.extend ( KJUR.asn1.x509.Extension , KJUR.asn1.ASN1Object ) ;
-529
-530 /**
-531 * KeyUsage ASN.1 structure class
-532 * @name KJUR.asn1.x509.KeyUsage
-533 * @class KeyUsage ASN.1 structure class
-534 * @param {Array} params associative array of parameters (ex. {'bin': '11', 'critical': true})
-535 * @extends KJUR.asn1.x509.Extension
-536 * @description
-537 * @example
-538 */
-539 KJUR.asn1.x509.KeyUsage = function ( params ) {
-540 KJUR.asn1.x509.KeyUsage.superclass.constructor.call ( this , params ) ;
-541
-542 this.getExtnValueHex = function ( ) {
-543 return this.asn1ExtnValue.getEncodedHex ( ) ;
-544 } ;
-545
-546 this.oid = "2.5.29.15" ;
-547 if ( typeof params != "undefined" ) {
-548 if ( typeof params [ 'bin' ] != "undefined" ) {
-549 this.asn1ExtnValue = new KJUR.asn1.DERBitString ( params ) ;
-550 }
-551 }
-552 } ;
-553 YAHOO.lang.extend ( KJUR.asn1.x509.KeyUsage , KJUR.asn1.x509.Extension ) ;
-554
-555 /**
-556 * BasicConstraints ASN.1 structure class
-557 * @name KJUR.asn1.x509.BasicConstraints
-558 * @class BasicConstraints ASN.1 structure class
-559 * @param {Array} params associative array of parameters (ex. {'cA': true, 'critical': true})
-560 * @extends KJUR.asn1.x509.Extension
-561 * @description
-562 * @example
-563 */
-564 KJUR.asn1.x509.BasicConstraints = function ( params ) {
-565 KJUR.asn1.x509.BasicConstraints.superclass.constructor.call ( this , params ) ;
-566 var cA = false ;
-567 var pathLen = - 1 ;
-568
-569 this.getExtnValueHex = function ( ) {
-570 var asn1Array = new Array ( ) ;
-571 if ( this.cA ) asn1Array.push ( new KJUR.asn1.DERBoolean ( ) ) ;
-572 if ( this.pathLen > - 1 )
-573 asn1Array.push ( new KJUR.asn1.DERInteger ( { 'int' : this.pathLen } ) ) ;
-574 var asn1Seq = new KJUR.asn1.DERSequence ( { 'array' : asn1Array } ) ;
-575 this.asn1ExtnValue = asn1Seq ;
-576 return this.asn1ExtnValue.getEncodedHex ( ) ;
-577 } ;
-578
-579 this.oid = "2.5.29.19" ;
-580 this.cA = false ;
-581 this.pathLen = - 1 ;
-582 if ( typeof params != "undefined" ) {
-583 if ( typeof params [ 'cA' ] != "undefined" ) {
-584 this.cA = params [ 'cA' ] ;
-585 }
-586 if ( typeof params [ 'pathLen' ] != "undefined" ) {
-587 this.pathLen = params [ 'pathLen' ] ;
-588 }
-589 }
-590 } ;
-591 YAHOO.lang.extend ( KJUR.asn1.x509.BasicConstraints , KJUR.asn1.x509.Extension ) ;
-592
-593 /**
-594 * CRLDistributionPoints ASN.1 structure class
-595 * @name KJUR.asn1.x509.CRLDistributionPoints
-596 * @class CRLDistributionPoints ASN.1 structure class
-597 * @param {Array} params associative array of parameters (ex. {'uri': 'http://a.com/', 'critical': true})
-598 * @extends KJUR.asn1.x509.Extension
-599 * @description
-600 * @example
-601 */
-602 KJUR.asn1.x509.CRLDistributionPoints = function ( params ) {
-603 KJUR.asn1.x509.CRLDistributionPoints.superclass.constructor.call ( this , params ) ;
-604
-605 this.getExtnValueHex = function ( ) {
-606 return this.asn1ExtnValue.getEncodedHex ( ) ;
-607 } ;
-608
-609 this.setByDPArray = function ( dpArray ) {
-610 this.asn1ExtnValue = new KJUR.asn1.DERSequence ( { 'array' : dpArray } ) ;
-611 } ;
-612
-613 this.setByOneURI = function ( uri ) {
-614 var gn1 = new KJUR.asn1.x509.GeneralNames ( [ { 'uri' : uri } ] ) ;
-615 var dpn1 = new KJUR.asn1.x509.DistributionPointName ( gn1 ) ;
-616 var dp1 = new KJUR.asn1.x509.DistributionPoint ( { 'dpobj' : dpn1 } ) ;
-617 this.setByDPArray ( [ dp1 ] ) ;
-618 } ;
-619
-620 this.oid = "2.5.29.31" ;
-621 if ( typeof params != "undefined" ) {
-622 if ( typeof params [ 'array' ] != "undefined" ) {
-623 this.setByDPArray ( params [ 'array' ] ) ;
-624 } else if ( typeof params [ 'uri' ] != "undefined" ) {
-625 this.setByOneURI ( params [ 'uri' ] ) ;
-626 }
-627 }
-628 } ;
-629 YAHOO.lang.extend ( KJUR.asn1.x509.CRLDistributionPoints , KJUR.asn1.x509.Extension ) ;
-630
-631 /**
-632 * KeyUsage ASN.1 structure class
-633 * @name KJUR.asn1.x509.ExtKeyUsage
-634 * @class ExtKeyUsage ASN.1 structure class
-635 * @param {Array} params associative array of parameters
-636 * @extends KJUR.asn1.x509.Extension
-637 * @description
-638 * @example
-639 * var e1 =
-640 * new KJUR.asn1.x509.ExtKeyUsage({'critical': true,
-641 * 'array':
-642 * [{'oid': '2.5.29.37.0', // anyExtendedKeyUsage
-643 * 'name': 'clientAuth'}]});
-644 *
-645 * // id-ce-extKeyUsage OBJECT IDENTIFIER ::= { id-ce 37 }
-646 * // ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId
-647 * // KeyPurposeId ::= OBJECT IDENTIFIER
-648 */
-649 KJUR.asn1.x509.ExtKeyUsage = function ( params ) {
-650 KJUR.asn1.x509.ExtKeyUsage.superclass.constructor.call ( this , params ) ;
-651
-652 this.setPurposeArray = function ( purposeArray ) {
-653 this.asn1ExtnValue = new KJUR.asn1.DERSequence ( ) ;
-654 for ( var i = 0 ; i < purposeArray.length ; i ++ ) {
-655 var o = new KJUR.asn1.DERObjectIdentifier ( purposeArray [ i ] ) ;
-656 this.asn1ExtnValue.appendASN1Object ( o ) ;
-657 }
-658 } ;
-659
-660 this.getExtnValueHex = function ( ) {
-661 return this.asn1ExtnValue.getEncodedHex ( ) ;
-662 } ;
-663
-664 this.oid = "2.5.29.37" ;
-665 if ( typeof params != "undefined" ) {
-666 if ( typeof params [ 'array' ] != "undefined" ) {
-667 this.setPurposeArray ( params [ 'array' ] ) ;
-668 }
-669 }
-670 } ;
-671 YAHOO.lang.extend ( KJUR.asn1.x509.ExtKeyUsage , KJUR.asn1.x509.Extension ) ;
-672
-673 /**
-674 * AuthorityKeyIdentifier ASN.1 structure class
-675 * @name KJUR.asn1.x509.AuthorityKeyIdentifier
-676 * @class AuthorityKeyIdentifier ASN.1 structure class
-677 * @param {Array} params associative array of parameters (ex. {'uri': 'http://a.com/', 'critical': true})
-678 * @extends KJUR.asn1.x509.Extension
-679 * @since asn1x509 1.0.8
-680 * @description
-681 * <pre>
-682 * d-ce-authorityKeyIdentifier OBJECT IDENTIFIER ::= { id-ce 35 }
-683 * AuthorityKeyIdentifier ::= SEQUENCE {
-684 * keyIdentifier [0] KeyIdentifier OPTIONAL,
-685 * authorityCertIssuer [1] GeneralNames OPTIONAL,
-686 * authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL }
-687 * KeyIdentifier ::= OCTET STRING
-688 * </pre>
-689 * @example
-690 * var param = {'kid': {'hex': '89ab'},
-691 * 'issuer': {'str': '/C=US/CN=a'},
-692 * 'sn': {'hex': '1234'},
-693 * 'critical': true});
-694 * var e1 = new KJUR.asn1.x509.AuthorityKeyIdentifier(param);
-695 */
-696 KJUR.asn1.x509.AuthorityKeyIdentifier = function ( params ) {
-697 KJUR.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call ( this , params ) ;
-698 this.asn1KID = null ;
-699 this.asn1CertIssuer = null ;
-700 this.asn1CertSN = null ;
-701
-702 this.getExtnValueHex = function ( ) {
-703 var a = new Array ( ) ;
-704 if ( this.asn1KID )
-705 a.push ( new KJUR.asn1.DERTaggedObject ( { 'explicit' : false ,
-706 'tag' : '80' ,
-707 'obj' : this.asn1KID } ) ) ;
-708 if ( this.asn1CertIssuer )
-709 a.push ( new KJUR.asn1.DERTaggedObject ( { 'explicit' : false ,
-710 'tag' : 'a1' ,
-711 'obj' : this.asn1CertIssuer } ) ) ;
-712 if ( this.asn1CertSN )
-713 a.push ( new KJUR.asn1.DERTaggedObject ( { 'explicit' : false ,
-714 'tag' : '82' ,
-715 'obj' : this.asn1CertSN } ) ) ;
-716
-717 var asn1Seq = new KJUR.asn1.DERSequence ( { 'array' : a } ) ;
-718 this.asn1ExtnValue = asn1Seq ;
-719 return this.asn1ExtnValue.getEncodedHex ( ) ;
-720 } ;
-721
-722 /**
-723 * set keyIdentifier value by DERInteger parameter
-724 * @name setKIDByParam
-725 * @memberOf KJUR.asn1.x509.AuthorityKeyIdentifier
-726 * @function
-727 * @param {Array} param array of {@link KJUR.asn1.DERInteger} parameter
-728 * @since asn1x509 1.0.8
-729 * @description
-730 * NOTE: Automatic keyIdentifier value calculation by an issuer
-731 * public key will be supported in future version.
-732 */
-733 this.setKIDByParam = function ( param ) {
-734 this.asn1KID = new KJUR.asn1.DEROctetString ( param ) ;
-735 } ;
-736
-737 /**
-738 * set authorityCertIssuer value by X500Name parameter
-739 * @name setCertIssuerByParam
-740 * @memberOf KJUR.asn1.x509.AuthorityKeyIdentifier
-741 * @function
-742 * @param {Array} param array of {@link KJUR.asn1.x509.X500Name} parameter
-743 * @since asn1x509 1.0.8
-744 * @description
-745 * NOTE: Automatic authorityCertIssuer name setting by an issuer
-746 * certificate will be supported in future version.
-747 */
-748 this.setCertIssuerByParam = function ( param ) {
-749 this.asn1CertIssuer = new KJUR.asn1.x509.X500Name ( param ) ;
-750 } ;
-751
-752 /**
-753 * set authorityCertSerialNumber value by DERInteger parameter
-754 * @name setCertSerialNumberByParam
-755 * @memberOf KJUR.asn1.x509.AuthorityKeyIdentifier
-756 * @function
-757 * @param {Array} param array of {@link KJUR.asn1.DERInteger} parameter
-758 * @since asn1x509 1.0.8
-759 * @description
-760 * NOTE: Automatic authorityCertSerialNumber setting by an issuer
-761 * certificate will be supported in future version.
-762 */
-763 this.setCertSNByParam = function ( param ) {
-764 this.asn1CertSN = new KJUR.asn1.DERInteger ( param ) ;
-765 } ;
-766
-767 this.oid = "2.5.29.35" ;
-768 if ( typeof params != "undefined" ) {
-769 if ( typeof params [ 'kid' ] != "undefined" ) {
-770 this.setKIDByParam ( params [ 'kid' ] ) ;
-771 }
-772 if ( typeof params [ 'issuer' ] != "undefined" ) {
-773 this.setCertIssuerByParam ( params [ 'issuer' ] ) ;
-774 }
-775 if ( typeof params [ 'sn' ] != "undefined" ) {
-776 this.setCertSNByParam ( params [ 'sn' ] ) ;
-777 }
-778 }
-779 } ;
-780 YAHOO.lang.extend ( KJUR.asn1.x509.AuthorityKeyIdentifier , KJUR.asn1.x509.Extension ) ;
-781
-782 // === END X.509v3 Extensions Related =======================================
-783
-784 // === BEGIN CRL Related ===================================================
-785 /**
-786 * X.509 CRL class to sign and generate hex encoded CRL
-787 * @name KJUR.asn1.x509.CRL
-788 * @class X.509 CRL class to sign and generate hex encoded certificate
-789 * @param {Array} params associative array of parameters (ex. {'tbsobj': obj, 'rsaprvkey': key})
-790 * @extends KJUR.asn1.ASN1Object
-791 * @since 1.0.3
-792 * @description
-793 * <br/>
-794 * As for argument 'params' for constructor, you can specify one of
-795 * following properties:
-796 * <ul>
-797 * <li>tbsobj - specify {@link KJUR.asn1.x509.TBSCertList} object to be signed</li>
-798 * <li>rsaprvkey - specify {@link RSAKey} object CA private key</li>
-799 * </ul>
-800 * NOTE: 'params' can be omitted.
-801 * <h4>EXAMPLE</h4>
-802 * @example
-803 * var prvKey = new RSAKey(); // CA's private key
-804 * prvKey.readPrivateKeyFromASN1HexString("3080...");
-805 * var crl = new KJUR.asn1x509.CRL({'tbsobj': tbs, 'rsaprvkey': prvKey});
-806 * crl.sign(); // issue CRL by CA's private key
-807 * var hCRL = crl.getEncodedHex();
-808 *
-809 * // CertificateList ::= SEQUENCE {
-810 * // tbsCertList TBSCertList,
-811 * // signatureAlgorithm AlgorithmIdentifier,
-812 * // signatureValue BIT STRING }
-813 */
-814 KJUR.asn1.x509.CRL = function ( params ) {
-815 KJUR.asn1.x509.CRL.superclass.constructor.call ( this ) ;
-816
-817 var asn1TBSCertList = null ;
-818 var asn1SignatureAlg = null ;
-819 var asn1Sig = null ;
-820 var hexSig = null ;
-821 var rsaPrvKey = null ;
-822
-823 /**
-824 * set PKCS#5 encrypted RSA PEM private key as CA key
-825 * @name setRsaPrvKeyByPEMandPass
-826 * @memberOf KJUR.asn1.x509.CRL
-827 * @function
-828 * @param {String} rsaPEM string of PKCS#5 encrypted RSA PEM private key
-829 * @param {String} passPEM passcode string to decrypt private key
-830 * @description
-831 * <br/>
-832 * <h4>EXAMPLES</h4>
-833 * @example
-834 */
-835 this.setRsaPrvKeyByPEMandPass = function ( rsaPEM , passPEM ) {
-836 var caKeyHex = PKCS5PKEY.getDecryptedKeyHex ( rsaPEM , passPEM ) ;
-837 var caKey = new RSAKey ( ) ;
-838 caKey.readPrivateKeyFromASN1HexString ( caKeyHex ) ;
-839 this.rsaPrvKey = caKey ;
-840 } ;
-841
-842 /**
-843 * sign TBSCertList and set signature value internally
-844 * @name sign
-845 * @memberOf KJUR.asn1.x509.CRL
-846 * @function
-847 * @description
-848 * @example
-849 * var cert = new KJUR.asn1.x509.CRL({'tbsobj': tbs, 'rsaprvkey': prvKey});
-850 * cert.sign();
-851 */
-852 this.sign = function ( ) {
-853 this.asn1SignatureAlg = this.asn1TBSCertList.asn1SignatureAlg ;
-854
-855 sig = new KJUR.crypto.Signature ( { 'alg' : 'SHA1withRSA' , 'prov' : 'cryptojs/jsrsa' } ) ;
-856 sig.initSign ( this.rsaPrvKey ) ;
-857 sig.updateHex ( this.asn1TBSCertList.getEncodedHex ( ) ) ;
-858 this.hexSig = sig.sign ( ) ;
-859
-860 this.asn1Sig = new KJUR.asn1.DERBitString ( { 'hex' : '00' + this.hexSig } ) ;
-861
-862 var seq = new KJUR.asn1.DERSequence ( { 'array' : [ this.asn1TBSCertList ,
-863 this.asn1SignatureAlg ,
-864 this.asn1Sig ] } ) ;
-865 this.hTLV = seq.getEncodedHex ( ) ;
-866 this.isModified = false ;
-867 } ;
-868
-869 this.getEncodedHex = function ( ) {
-870 if ( this.isModified == false && this.hTLV != null ) return this.hTLV ;
-871 throw "not signed yet" ;
-872 } ;
-873
-874 /**
-875 * get PEM formatted CRL string after signed
-876 * @name getPEMString
-877 * @memberOf KJUR.asn1.x509.CRL
-878 * @function
-879 * @return PEM formatted string of certificate
-880 * @description
-881 * @example
-882 * var cert = new KJUR.asn1.x509.CRL({'tbsobj': tbs, 'rsaprvkey': prvKey});
-883 * cert.sign();
-884 * var sPEM = cert.getPEMString();
-885 */
-886 this.getPEMString = function ( ) {
-887 var hCert = this.getEncodedHex ( ) ;
-888 var wCert = CryptoJS.enc.Hex.parse ( hCert ) ;
-889 var b64Cert = CryptoJS.enc.Base64.stringify ( wCert ) ;
-890 var pemBody = b64Cert.replace ( /(.{64})/g , "$1\r\n" ) ;
-891 return "-----BEGIN X509 CRL-----\r\n" + pemBody + "\r\n-----END X509 CRL-----\r\n" ;
-892 } ;
-893
-894 if ( typeof params != "undefined" ) {
-895 if ( typeof params [ 'tbsobj' ] != "undefined" ) {
-896 this.asn1TBSCertList = params [ 'tbsobj' ] ;
-897 }
-898 if ( typeof params [ 'rsaprvkey' ] != "undefined" ) {
-899 this.rsaPrvKey = params [ 'rsaprvkey' ] ;
-900 }
-901 if ( ( typeof params [ 'rsaprvpem' ] != "undefined" ) &&
-902 ( typeof params [ 'rsaprvpas' ] != "undefined" ) ) {
-903 this.setRsaPrvKeyByPEMandPass ( params [ 'rsaprvpem' ] , params [ 'rsaprvpas' ] ) ;
-904 }
-905 }
-906 } ;
-907 YAHOO.lang.extend ( KJUR.asn1.x509.CRL , KJUR.asn1.ASN1Object ) ;
-908
-909 /**
-910 * ASN.1 TBSCertList structure class for CRL
-911 * @name KJUR.asn1.x509.TBSCertList
-912 * @class ASN.1 TBSCertList structure class for CRL
-913 * @param {Array} params associative array of parameters (ex. {})
-914 * @extends KJUR.asn1.ASN1Object
-915 * @since 1.0.3
-916 * @description
-917 * <br/>
-918 * <h4>EXAMPLE</h4>
-919 * @example
-920 * var o = new KJUR.asn1.x509.TBSCertList();
-921 * o.setSignatureAlgByParam({'name': 'SHA1withRSA'});
-922 * o.setIssuerByParam({'str': '/C=US/O=a'});
-923 * o.setNotThisUpdateByParam({'str': '130504235959Z'});
-924 * o.setNotNextUpdateByParam({'str': '140504235959Z'});
-925 * o.addRevokedCert({'int': 4}, {'str':'130514235959Z'}));
-926 * o.addRevokedCert({'hex': '0f34dd'}, {'str':'130514235959Z'}));
-927 *
-928 * // TBSCertList ::= SEQUENCE {
-929 * // version Version OPTIONAL,
-930 * // -- if present, MUST be v2
-931 * // signature AlgorithmIdentifier,
-932 * // issuer Name,
-933 * // thisUpdate Time,
-934 * // nextUpdate Time OPTIONAL,
-935 * // revokedCertificates SEQUENCE OF SEQUENCE {
-936 * // userCertificate CertificateSerialNumber,
-937 * // revocationDate Time,
-938 * // crlEntryExtensions Extensions OPTIONAL
-939 * // -- if present, version MUST be v2
-940 * // } OPTIONAL,
-941 * // crlExtensions [0] EXPLICIT Extensions OPTIONAL
-942 */
-943 KJUR.asn1.x509.TBSCertList = function ( params ) {
-944 KJUR.asn1.x509.TBSCertList.superclass.constructor.call ( this ) ;
-945 var aRevokedCert = null ;
-946
-947 /**
-948 * set signature algorithm field by parameter
-949 * @name setSignatureAlgByParam
-950 * @memberOf KJUR.asn1.x509.TBSCertList
-951 * @function
-952 * @param {Array} algIdParam AlgorithmIdentifier parameter
-953 * @description
-954 * @example
-955 * tbsc.setSignatureAlgByParam({'name': 'SHA1withRSA'});
-956 */
-957 this.setSignatureAlgByParam = function ( algIdParam ) {
-958 this.asn1SignatureAlg = new KJUR.asn1.x509.AlgorithmIdentifier ( algIdParam ) ;
-959 } ;
-960
-961 /**
-962 * set issuer name field by parameter
-963 * @name setIssuerByParam
-964 * @memberOf KJUR.asn1.x509.TBSCertList
-965 * @function
-966 * @param {Array} x500NameParam X500Name parameter
-967 * @description
-968 * @example
-969 * tbsc.setIssuerParam({'str': '/C=US/CN=b'});
-970 * @see KJUR.asn1.x509.X500Name
-971 */
-972 this.setIssuerByParam = function ( x500NameParam ) {
-973 this.asn1Issuer = new KJUR.asn1.x509.X500Name ( x500NameParam ) ;
-974 } ;
-975
-976 /**
-977 * set thisUpdate field by parameter
-978 * @name setThisUpdateByParam
-979 * @memberOf KJUR.asn1.x509.TBSCertList
-980 * @function
-981 * @param {Array} timeParam Time parameter
-982 * @description
-983 * @example
-984 * tbsc.setThisUpdateByParam({'str': '130508235959Z'});
-985 * @see KJUR.asn1.x509.Time
-986 */
-987 this.setThisUpdateByParam = function ( timeParam ) {
-988 this.asn1ThisUpdate = new KJUR.asn1.x509.Time ( timeParam ) ;
-989 } ;
-990
-991 /**
-992 * set nextUpdate field by parameter
-993 * @name setNextUpdateByParam
-994 * @memberOf KJUR.asn1.x509.TBSCertList
-995 * @function
-996 * @param {Array} timeParam Time parameter
-997 * @description
-998 * @example
-999 * tbsc.setNextUpdateByParam({'str': '130508235959Z'});
-1000 * @see KJUR.asn1.x509.Time
-1001 */
-1002 this.setNextUpdateByParam = function ( timeParam ) {
-1003 this.asn1NextUpdate = new KJUR.asn1.x509.Time ( timeParam ) ;
-1004 } ;
-1005
-1006 /**
-1007 * add revoked certficate by parameter
-1008 * @name addRevokedCert
-1009 * @memberOf KJUR.asn1.x509.TBSCertList
-1010 * @function
-1011 * @param {Array} snParam DERInteger parameter for certificate serial number
-1012 * @param {Array} timeParam Time parameter for revocation date
-1013 * @description
-1014 * @example
-1015 * tbsc.addRevokedCert({'int': 3}, {'str': '130508235959Z'});
-1016 * @see KJUR.asn1.x509.Time
-1017 */
-1018 this.addRevokedCert = function ( snParam , timeParam ) {
-1019 var param = { } ;
-1020 if ( snParam != undefined && snParam != null ) param [ 'sn' ] = snParam ;
-1021 if ( timeParam != undefined && timeParam != null ) param [ 'time' ] = timeParam ;
-1022 var o = new KJUR.asn1.x509.CRLEntry ( param ) ;
-1023 this.aRevokedCert.push ( o ) ;
-1024 } ;
-1025
-1026 this.getEncodedHex = function ( ) {
-1027 this.asn1Array = new Array ( ) ;
-1028
-1029 if ( this.asn1Version != null ) this.asn1Array.push ( this.asn1Version ) ;
-1030 this.asn1Array.push ( this.asn1SignatureAlg ) ;
-1031 this.asn1Array.push ( this.asn1Issuer ) ;
-1032 this.asn1Array.push ( this.asn1ThisUpdate ) ;
-1033 if ( this.asn1NextUpdate != null ) this.asn1Array.push ( this.asn1NextUpdate ) ;
-1034
-1035 if ( this.aRevokedCert.length > 0 ) {
-1036 var seq = new KJUR.asn1.DERSequence ( { 'array' : this.aRevokedCert } ) ;
-1037 this.asn1Array.push ( seq ) ;
-1038 }
-1039
-1040 var o = new KJUR.asn1.DERSequence ( { "array" : this.asn1Array } ) ;
-1041 this.hTLV = o.getEncodedHex ( ) ;
-1042 this.isModified = false ;
-1043 return this.hTLV ;
-1044 } ;
-1045
-1046 this._initialize = function ( ) {
-1047 this.asn1Version = null ;
-1048 this.asn1SignatureAlg = null ;
-1049 this.asn1Issuer = null ;
-1050 this.asn1ThisUpdate = null ;
-1051 this.asn1NextUpdate = null ;
-1052 this.aRevokedCert = new Array ( ) ;
-1053 } ;
-1054
-1055 this._initialize ( ) ;
-1056 } ;
-1057 YAHOO.lang.extend ( KJUR.asn1.x509.TBSCertList , KJUR.asn1.ASN1Object ) ;
-1058
-1059 /**
-1060 * ASN.1 CRLEntry structure class for CRL
-1061 * @name KJUR.asn1.x509.CRLEntry
-1062 * @class ASN.1 CRLEntry structure class for CRL
-1063 * @param {Array} params associative array of parameters (ex. {})
-1064 * @extends KJUR.asn1.ASN1Object
-1065 * @since 1.0.3
-1066 * @description
-1067 * @example
-1068 * var e = new KJUR.asn1.x509.CRLEntry({'time': {'str': '130514235959Z'}, 'sn': {'int': 234}});
-1069 *
-1070 * // revokedCertificates SEQUENCE OF SEQUENCE {
-1071 * // userCertificate CertificateSerialNumber,
-1072 * // revocationDate Time,
-1073 * // crlEntryExtensions Extensions OPTIONAL
-1074 * // -- if present, version MUST be v2 }
-1075 */
-1076 KJUR.asn1.x509.CRLEntry = function ( params ) {
-1077 KJUR.asn1.x509.CRLEntry.superclass.constructor.call ( this ) ;
-1078 var sn = null ;
-1079 var time = null ;
-1080
-1081 /**
-1082 * set DERInteger parameter for serial number of revoked certificate
-1083 * @name setCertSerial
-1084 * @memberOf KJUR.asn1.x509.CRLEntry
-1085 * @function
-1086 * @param {Array} intParam DERInteger parameter for certificate serial number
-1087 * @description
-1088 * @example
-1089 * entry.setCertSerial({'int': 3});
-1090 */
-1091 this.setCertSerial = function ( intParam ) {
-1092 this.sn = new KJUR.asn1.DERInteger ( intParam ) ;
-1093 } ;
-1094
-1095 /**
-1096 * set Time parameter for revocation date
-1097 * @name setRevocationDate
-1098 * @memberOf KJUR.asn1.x509.CRLEntry
-1099 * @function
-1100 * @param {Array} timeParam Time parameter for revocation date
-1101 * @description
-1102 * @example
-1103 * entry.setRevocationDate({'str': '130508235959Z'});
-1104 */
-1105 this.setRevocationDate = function ( timeParam ) {
-1106 this.time = new KJUR.asn1.x509.Time ( timeParam ) ;
-1107 } ;
-1108
-1109 this.getEncodedHex = function ( ) {
-1110 var o = new KJUR.asn1.DERSequence ( { "array" : [ this.sn , this.time ] } ) ;
-1111 this.TLV = o.getEncodedHex ( ) ;
-1112 return this.TLV ;
-1113 } ;
-1114
-1115 if ( typeof params != "undefined" ) {
-1116 if ( typeof params [ 'time' ] != "undefined" ) {
-1117 this.setRevocationDate ( params [ 'time' ] ) ;
-1118 }
-1119 if ( typeof params [ 'sn' ] != "undefined" ) {
-1120 this.setCertSerial ( params [ 'sn' ] ) ;
-1121 }
-1122 }
-1123 } ;
-1124 YAHOO.lang.extend ( KJUR.asn1.x509.CRLEntry , KJUR.asn1.ASN1Object ) ;
-1125
-1126 // === END CRL Related ===================================================
-1127
-1128 // === BEGIN X500Name Related =================================================
-1129 /**
-1130 * X500Name ASN.1 structure class
-1131 * @name KJUR.asn1.x509.X500Name
-1132 * @class X500Name ASN.1 structure class
-1133 * @param {Array} params associative array of parameters (ex. {'str': '/C=US/O=a'})
-1134 * @extends KJUR.asn1.ASN1Object
-1135 * @description
-1136 * @example
-1137 * // 1. construct with string
-1138 * o = new KJUR.asn1.x509.X500Name({str: "/C=US/O=aaa/OU=bbb/CN=foo@example.com"});
-1139 * // 2. construct by object
-1140 * o = new KJUR.asn1.x509.X500Name({C: "US", O: "aaa", CN: "http://example.com/"});
-1141 */
-1142 KJUR.asn1.x509.X500Name = function ( params ) {
-1143 KJUR.asn1.x509.X500Name.superclass.constructor.call ( this ) ;
-1144 this.asn1Array = new Array ( ) ;
-1145
-1146 /**
-1147 * set DN by string
-1148 * @name setByString
-1149 * @memberOf KJUR.asn1.x509.X500Name
-1150 * @function
-1151 * @param {Array} dnStr distinguished name by string (ex. /C=US/O=aaa)
-1152 * @description
-1153 * @example
-1154 * name = new KJUR.asn1.x509.X500Name();
-1155 * name.setByString("/C=US/O=aaa/OU=bbb/CN=foo@example.com");
-1156 */
-1157 this.setByString = function ( dnStr ) {
-1158 var a = dnStr.split ( '/' ) ;
-1159 a.shift ( ) ;
-1160 for ( var i = 0 ; i < a.length ; i ++ ) {
-1161 this.asn1Array.push ( new KJUR.asn1.x509.RDN ( { 'str' : a [ i ] } ) ) ;
-1162 }
-1163 } ;
-1164
-1165 /**
-1166 * set DN by associative array
-1167 * @name setByObject
-1168 * @memberOf KJUR.asn1.x509.X500Name
-1169 * @function
-1170 * @param {Array} dnObj associative array of DN (ex. {C: "US", O: "aaa"})
-1171 * @since jsrsasign 4.9. asn1x509 1.0.13
-1172 * @description
-1173 * @example
-1174 * name = new KJUR.asn1.x509.X500Name();
-1175 * name.setByObject({C: "US", O: "aaa", CN="http://example.com/"1});
-1176 */
-1177 this.setByObject = function ( dnObj ) {
-1178 // Get all the dnObject attributes and stuff them in the ASN.1 array.
-1179 for ( var x in dnObj ) {
-1180 if ( dnObj.hasOwnProperty ( x ) ) {
-1181 var newRDN = new KJUR.asn1.x509.RDN (
-1182 { 'str' : x + '=' + dnObj [ x ] } ) ;
-1183 // Initialize or push into the ANS1 array.
-1184 this.asn1Array ? this.asn1Array.push ( newRDN )
-1185 : this.asn1Array = [ newRDN ] ;
-1186 }
-1187 }
-1188 } ;
-1189
-1190 this.getEncodedHex = function ( ) {
-1191 if ( typeof this.hTLV == "string" ) return this.hTLV ;
-1192 var o = new KJUR.asn1.DERSequence ( { "array" : this.asn1Array } ) ;
-1193 this.hTLV = o.getEncodedHex ( ) ;
-1194 return this.hTLV ;
-1195 } ;
-1196
-1197 if ( typeof params != "undefined" ) {
-1198 if ( typeof params [ 'str' ] != "undefined" ) {
-1199 this.setByString ( params [ 'str' ] ) ;
-1200 // If params is an object, then set the ASN1 array just using the object
-1201 // attributes. This is nice for fields that have lots of special
-1202 // characters (i.e. CN: 'http://www.github.com/kjur//').
-1203 } else if ( typeof params === "object" ) {
-1204 this.setByObject ( params ) ;
-1205 }
-1206
-1207 if ( typeof params.certissuer != "undefined" ) {
-1208 var x = new X509 ( ) ;
-1209 x.hex = X509.pemToHex ( params.certissuer ) ;
-1210 this.hTLV = x.getIssuerHex ( ) ;
-1211 }
-1212 if ( typeof params.certsubject != "undefined" ) {
-1213 var x = new X509 ( ) ;
-1214 x.hex = X509.pemToHex ( params.certsubject ) ;
-1215 this.hTLV = x.getSubjectHex ( ) ;
-1216 }
-1217 }
-1218 } ;
-1219 YAHOO.lang.extend ( KJUR.asn1.x509.X500Name , KJUR.asn1.ASN1Object ) ;
-1220
-1221 /**
-1222 * RDN (Relative Distinguish Name) ASN.1 structure class
-1223 * @name KJUR.asn1.x509.RDN
-1224 * @class RDN (Relative Distinguish Name) ASN.1 structure class
-1225 * @param {Array} params associative array of parameters (ex. {'str': 'C=US'})
-1226 * @extends KJUR.asn1.ASN1Object
-1227 * @description
-1228 * @example
-1229 */
-1230 KJUR.asn1.x509.RDN = function ( params ) {
-1231 KJUR.asn1.x509.RDN.superclass.constructor.call ( this ) ;
-1232 this.asn1Array = new Array ( ) ;
-1233
-1234 this.addByString = function ( rdnStr ) {
-1235 this.asn1Array.push ( new KJUR.asn1.x509.AttributeTypeAndValue ( { 'str' : rdnStr } ) ) ;
-1236 } ;
-1237
-1238 this.getEncodedHex = function ( ) {
-1239 var o = new KJUR.asn1.DERSet ( { "array" : this.asn1Array } ) ;
-1240 this.TLV = o.getEncodedHex ( ) ;
-1241 return this.TLV ;
-1242 } ;
-1243
-1244 if ( typeof params != "undefined" ) {
-1245 if ( typeof params [ 'str' ] != "undefined" ) {
-1246 this.addByString ( params [ 'str' ] ) ;
-1247 }
-1248 }
-1249 } ;
-1250 YAHOO.lang.extend ( KJUR.asn1.x509.RDN , KJUR.asn1.ASN1Object ) ;
-1251
-1252 /**
-1253 * AttributeTypeAndValue ASN.1 structure class
-1254 * @name KJUR.asn1.x509.AttributeTypeAndValue
-1255 * @class AttributeTypeAndValue ASN.1 structure class
-1256 * @param {Array} params associative array of parameters (ex. {'str': 'C=US'})
-1257 * @extends KJUR.asn1.ASN1Object
-1258 * @description
-1259 * @example
-1260 */
-1261 KJUR.asn1.x509.AttributeTypeAndValue = function ( params ) {
-1262 KJUR.asn1.x509.AttributeTypeAndValue.superclass.constructor.call ( this ) ;
-1263 var typeObj = null ;
-1264 var valueObj = null ;
-1265 var defaultDSType = "utf8" ;
-1266
-1267 this.setByString = function ( attrTypeAndValueStr ) {
-1268 if ( attrTypeAndValueStr.match ( /^([^=]+)=(.+)$/ ) ) {
-1269 this.setByAttrTypeAndValueStr ( RegExp.$1 , RegExp.$2 ) ;
-1270 } else {
-1271 throw "malformed attrTypeAndValueStr: " + attrTypeAndValueStr ;
-1272 }
-1273 } ;
-1274
-1275 this.setByAttrTypeAndValueStr = function ( shortAttrType , valueStr ) {
-1276 this.typeObj = KJUR.asn1.x509.OID.atype2obj ( shortAttrType ) ;
-1277 var dsType = defaultDSType ;
-1278 if ( shortAttrType == "C" ) dsType = "prn" ;
-1279 this.valueObj = this.getValueObj ( dsType , valueStr ) ;
-1280 } ;
-1281
-1282 this.getValueObj = function ( dsType , valueStr ) {
-1283 if ( dsType == "utf8" ) return new KJUR.asn1.DERUTF8String ( { "str" : valueStr } ) ;
-1284 if ( dsType == "prn" ) return new KJUR.asn1.DERPrintableString ( { "str" : valueStr } ) ;
-1285 if ( dsType == "tel" ) return new KJUR.asn1.DERTeletexString ( { "str" : valueStr } ) ;
-1286 if ( dsType == "ia5" ) return new KJUR.asn1.DERIA5String ( { "str" : valueStr } ) ;
-1287 throw "unsupported directory string type: type=" + dsType + " value=" + valueStr ;
-1288 } ;
-1289
-1290 this.getEncodedHex = function ( ) {
-1291 var o = new KJUR.asn1.DERSequence ( { "array" : [ this.typeObj , this.valueObj ] } ) ;
-1292 this.TLV = o.getEncodedHex ( ) ;
-1293 return this.TLV ;
-1294 } ;
-1295
-1296 if ( typeof params != "undefined" ) {
-1297 if ( typeof params [ 'str' ] != "undefined" ) {
-1298 this.setByString ( params [ 'str' ] ) ;
-1299 }
-1300 }
-1301 } ;
-1302 YAHOO.lang.extend ( KJUR.asn1.x509.AttributeTypeAndValue , KJUR.asn1.ASN1Object ) ;
-1303
-1304 // === END X500Name Related =================================================
-1305
-1306 // === BEGIN Other ASN1 structure class ======================================
-1307
-1308 /**
-1309 * SubjectPublicKeyInfo ASN.1 structure class
-1310 * @name KJUR.asn1.x509.SubjectPublicKeyInfo
-1311 * @class SubjectPublicKeyInfo ASN.1 structure class
-1312 * @param {Object} params parameter for subject public key
-1313 * @extends KJUR.asn1.ASN1Object
-1314 * @description
-1315 * <br/>
-1316 * As for argument 'params' for constructor, you can specify one of
-1317 * following properties:
-1318 * <ul>
-1319 * <li>{@link RSAKey} object</li>
-1320 * <li>{@link KJUR.crypto.ECDSA} object</li>
-1321 * <li>{@link KJUR.crypto.DSA} object</li>
-1322 * <li>(DEPRECATED)rsakey - specify {@link RSAKey} object of subject public key</li>
-1323 * <li>(DEPRECATED)rsapem - specify a string of PEM public key of RSA key</li>
-1324 * </ul>
-1325 * NOTE1: 'params' can be omitted.<br/>
-1326 * NOTE2: DSA/ECDSA key object is also supported since asn1x509 1.0.6.<br/>
-1327 * <h4>EXAMPLE</h4>
-1328 * @example
-1329 * var spki = new KJUR.asn1.x509.SubjectPublicKeyInfo(RSAKey_object);
-1330 * var spki = new KJUR.asn1.x509.SubjectPublicKeyInfo(KJURcryptoECDSA_object);
-1331 * var spki = new KJUR.asn1.x509.SubjectPublicKeyInfo(KJURcryptoDSA_object);
-1332 */
-1333 KJUR.asn1.x509.SubjectPublicKeyInfo = function ( params ) {
-1334 KJUR.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call ( this ) ;
-1335 var asn1AlgId = null ;
-1336 var asn1SubjPKey = null ;
-1337 var rsaKey = null ;
-1338
-1339 /**
-1340 * (DEPRECATED) set RSAKey object as subject public key
-1341 * @name setRSAKey
-1342 * @memberOf KJUR.asn1.x509.SubjectPublicKeyInfo
-1343 * @function
-1344 * @param {RSAKey} rsaKey {@link RSAKey} object for RSA public key
-1345 * @description
-1346 * @deprecated
-1347 * @example
-1348 * spki.setRSAKey(rsaKey);
-1349 */
-1350 this.setRSAKey = function ( rsaKey ) {
-1351 if ( ! RSAKey.prototype.isPrototypeOf ( rsaKey ) )
-1352 throw "argument is not RSAKey instance" ;
-1353 this.rsaKey = rsaKey ;
-1354 var asn1RsaN = new KJUR.asn1.DERInteger ( { 'bigint' : rsaKey.n } ) ;
-1355 var asn1RsaE = new KJUR.asn1.DERInteger ( { 'int' : rsaKey.e } ) ;
-1356 var asn1RsaPub = new KJUR.asn1.DERSequence ( { 'array' : [ asn1RsaN , asn1RsaE ] } ) ;
-1357 var rsaKeyHex = asn1RsaPub.getEncodedHex ( ) ;
-1358 this.asn1AlgId = new KJUR.asn1.x509.AlgorithmIdentifier ( { 'name' : 'rsaEncryption' } ) ;
-1359 this.asn1SubjPKey = new KJUR.asn1.DERBitString ( { 'hex' : '00' + rsaKeyHex } ) ;
-1360 } ;
-1361
-1362 /**
-1363 * (DEPRECATED) set a PEM formatted RSA public key string as RSA public key
-1364 * @name setRSAPEM
-1365 * @memberOf KJUR.asn1.x509.SubjectPublicKeyInfo
-1366 * @function
-1367 * @param {String} rsaPubPEM PEM formatted RSA public key string
-1368 * @deprecated
-1369 * @description
-1370 * @example
-1371 * spki.setRSAPEM(rsaPubPEM);
-1372 */
-1373 this.setRSAPEM = function ( rsaPubPEM ) {
-1374 if ( rsaPubPEM.match ( /-----BEGIN PUBLIC KEY-----/ ) ) {
-1375 var s = rsaPubPEM ;
-1376 s = s.replace ( /^-----[^-]+-----/ , '' ) ;
-1377 s = s.replace ( /-----[^-]+-----\s*$/ , '' ) ;
-1378 var rsaB64 = s.replace ( /\s+/g , '' ) ;
-1379 var rsaWA = CryptoJS.enc.Base64.parse ( rsaB64 ) ;
-1380 var rsaP8Hex = CryptoJS.enc.Hex.stringify ( rsaWA ) ;
-1381 var a = _rsapem_getHexValueArrayOfChildrenFromHex ( rsaP8Hex ) ;
-1382 var hBitStrVal = a [ 1 ] ;
-1383 var rsaHex = hBitStrVal.substr ( 2 ) ;
-1384 var a3 = _rsapem_getHexValueArrayOfChildrenFromHex ( rsaHex ) ;
-1385 var rsaKey = new RSAKey ( ) ;
-1386 rsaKey.setPublic ( a3 [ 0 ] , a3 [ 1 ] ) ;
-1387 this.setRSAKey ( rsaKey ) ;
-1388 } else {
-1389 throw "key not supported" ;
-1390 }
-1391 } ;
-1392
-1393 /*
-1394 * @since asn1x509 1.0.7
-1395 */
-1396 this.getASN1Object = function ( ) {
-1397 if ( this.asn1AlgId == null || this.asn1SubjPKey == null )
-1398 throw "algId and/or subjPubKey not set" ;
-1399 var o = new KJUR.asn1.DERSequence ( { 'array' :
-1400 [ this.asn1AlgId , this.asn1SubjPKey ] } ) ;
-1401 return o ;
-1402 } ;
-1403
-1404 this.getEncodedHex = function ( ) {
-1405 var o = this.getASN1Object ( ) ;
-1406 this.hTLV = o.getEncodedHex ( ) ;
-1407 return this.hTLV ;
-1408 } ;
-1409
-1410 this._setRSAKey = function ( key ) {
-1411 var asn1RsaPub = KJUR.asn1.ASN1Util.newObject ( {
-1412 'seq' : [ { 'int' : { 'bigint' : key.n } } , { 'int' : { 'int' : key.e } } ]
-1413 } ) ;
-1414 var rsaKeyHex = asn1RsaPub.getEncodedHex ( ) ;
-1415 this.asn1AlgId = new KJUR.asn1.x509.AlgorithmIdentifier ( { 'name' : 'rsaEncryption' } ) ;
-1416 this.asn1SubjPKey = new KJUR.asn1.DERBitString ( { 'hex' : '00' + rsaKeyHex } ) ;
-1417 } ;
-1418
-1419 this._setEC = function ( key ) {
-1420 var asn1Params = new KJUR.asn1.DERObjectIdentifier ( { 'name' : key.curveName } ) ;
-1421 this.asn1AlgId =
-1422 new KJUR.asn1.x509.AlgorithmIdentifier ( { 'name' : 'ecPublicKey' ,
-1423 'asn1params' : asn1Params } ) ;
-1424 this.asn1SubjPKey = new KJUR.asn1.DERBitString ( { 'hex' : '00' + key.pubKeyHex } ) ;
-1425 } ;
-1426
-1427 this._setDSA = function ( key ) {
-1428 var asn1Params = new KJUR.asn1.ASN1Util.newObject ( {
-1429 'seq' : [ { 'int' : { 'bigint' : key.p } } ,
-1430 { 'int' : { 'bigint' : key.q } } ,
-1431 { 'int' : { 'bigint' : key.g } } ]
-1432 } ) ;
-1433 this.asn1AlgId =
-1434 new KJUR.asn1.x509.AlgorithmIdentifier ( { 'name' : 'dsa' ,
-1435 'asn1params' : asn1Params } ) ;
-1436 var pubInt = new KJUR.asn1.DERInteger ( { 'bigint' : key.y } ) ;
-1437 this.asn1SubjPKey = new KJUR.asn1.DERBitString ( { 'hex' : '00' + pubInt.getEncodedHex ( ) } ) ;
-1438 } ;
-1439
-1440 if ( typeof params != "undefined" ) {
-1441 if ( typeof RSAKey != 'undefined' && params instanceof RSAKey ) {
-1442 this._setRSAKey ( params ) ;
-1443 } else if ( typeof KJUR.crypto.ECDSA != 'undefined' &&
-1444 params instanceof KJUR.crypto.ECDSA ) {
-1445 this._setEC ( params ) ;
-1446 } else if ( typeof KJUR.crypto.DSA != 'undefined' &&
-1447 params instanceof KJUR.crypto.DSA ) {
-1448 this._setDSA ( params ) ;
-1449 } else if ( typeof params [ 'rsakey' ] != "undefined" ) {
-1450 this.setRSAKey ( params [ 'rsakey' ] ) ;
-1451 } else if ( typeof params [ 'rsapem' ] != "undefined" ) {
-1452 this.setRSAPEM ( params [ 'rsapem' ] ) ;
-1453 }
-1454 }
-1455 } ;
-1456 YAHOO.lang.extend ( KJUR.asn1.x509.SubjectPublicKeyInfo , KJUR.asn1.ASN1Object ) ;
-1457
-1458 /**
-1459 * Time ASN.1 structure class
-1460 * @name KJUR.asn1.x509.Time
-1461 * @class Time ASN.1 structure class
-1462 * @param {Array} params associative array of parameters (ex. {'str': '130508235959Z'})
-1463 * @extends KJUR.asn1.ASN1Object
-1464 * @description
-1465 * <br/>
-1466 * <h4>EXAMPLES</h4>
-1467 * @example
-1468 * var t1 = new KJUR.asn1.x509.Time{'str': '130508235959Z'} // UTCTime by default
-1469 * var t2 = new KJUR.asn1.x509.Time{'type': 'gen', 'str': '20130508235959Z'} // GeneralizedTime
-1470 */
-1471 KJUR.asn1.x509.Time = function ( params ) {
-1472 KJUR.asn1.x509.Time.superclass.constructor.call ( this ) ;
-1473 var type = null ;
-1474 var timeParams = null ;
-1475
-1476 this.setTimeParams = function ( timeParams ) {
-1477 this.timeParams = timeParams ;
-1478 }
-1479
-1480 this.getEncodedHex = function ( ) {
-1481 var o = null ;
-1482
-1483 if ( this.timeParams != null ) {
-1484 if ( this.type == "utc" ) {
-1485 o = new KJUR.asn1.DERUTCTime ( this.timeParams ) ;
-1486 } else {
-1487 o = new KJUR.asn1.DERGeneralizedTime ( this.timeParams ) ;
-1488 }
-1489 } else {
-1490 if ( this.type == "utc" ) {
-1491 o = new KJUR.asn1.DERUTCTime ( ) ;
-1492 } else {
-1493 o = new KJUR.asn1.DERGeneralizedTime ( ) ;
-1494 }
-1495 }
-1496 this.TLV = o.getEncodedHex ( ) ;
-1497 return this.TLV ;
-1498 } ;
-1499
-1500 this.type = "utc" ;
-1501 if ( typeof params != "undefined" ) {
-1502 if ( typeof params.type != "undefined" ) {
-1503 this.type = params.type ;
-1504 } else {
-1505 if ( typeof params.str != "undefined" ) {
-1506 if ( params.str.match ( /^[0-9]{12}Z$/ ) ) this.type = "utc" ;
-1507 if ( params.str.match ( /^[0-9]{14}Z$/ ) ) this.type = "gen" ;
-1508 }
-1509 }
-1510 this.timeParams = params ;
-1511 }
-1512 } ;
-1513 YAHOO.lang.extend ( KJUR.asn1.x509.Time , KJUR.asn1.ASN1Object ) ;
-1514
-1515 /**
-1516 * AlgorithmIdentifier ASN.1 structure class
-1517 * @name KJUR.asn1.x509.AlgorithmIdentifier
-1518 * @class AlgorithmIdentifier ASN.1 structure class
-1519 * @param {Array} params associative array of parameters (ex. {'name': 'SHA1withRSA'})
-1520 * @extends KJUR.asn1.ASN1Object
-1521 * @description
-1522 * @example
-1523 */
-1524 KJUR.asn1.x509.AlgorithmIdentifier = function ( params ) {
-1525 KJUR.asn1.x509.AlgorithmIdentifier.superclass.constructor.call ( this ) ;
-1526 var nameAlg = null ;
-1527 var asn1Alg = null ;
-1528 var asn1Params = null ;
-1529 var paramEmpty = false ;
-1530
-1531 this.getEncodedHex = function ( ) {
-1532 if ( this.nameAlg == null && this.asn1Alg == null ) {
-1533 throw "algorithm not specified" ;
-1534 }
-1535 if ( this.nameAlg != null && this.asn1Alg == null ) {
-1536 this.asn1Alg = KJUR.asn1.x509.OID.name2obj ( this.nameAlg ) ;
-1537 }
-1538 var a = [ this.asn1Alg ] ;
-1539 if ( ! this.paramEmpty ) a.push ( this.asn1Params ) ;
-1540 var o = new KJUR.asn1.DERSequence ( { 'array' : a } ) ;
-1541 this.hTLV = o.getEncodedHex ( ) ;
-1542 return this.hTLV ;
-1543 } ;
-1544
-1545 if ( typeof params != "undefined" ) {
-1546 if ( typeof params [ 'name' ] != "undefined" ) {
-1547 this.nameAlg = params [ 'name' ] ;
-1548 }
-1549 if ( typeof params [ 'asn1params' ] != "undefined" ) {
-1550 this.asn1Params = params [ 'asn1params' ] ;
-1551 }
-1552 if ( typeof params [ 'paramempty' ] != "undefined" ) {
-1553 this.paramEmpty = params [ 'paramempty' ] ;
-1554 }
-1555 }
-1556 if ( this.asn1Params == null ) {
-1557 this.asn1Params = new KJUR.asn1.DERNull ( ) ;
-1558 }
-1559 } ;
-1560 YAHOO.lang.extend ( KJUR.asn1.x509.AlgorithmIdentifier , KJUR.asn1.ASN1Object ) ;
-1561
-1562 /**
-1563 * GeneralName ASN.1 structure class
-1564 * @name KJUR.asn1.x509.GeneralName
-1565 * @class GeneralName ASN.1 structure class
-1566 * @description
-1567 * <br/>
-1568 * As for argument 'params' for constructor, you can specify one of
-1569 * following properties:
-1570 * <ul>
-1571 * <li>rfc822 - rfc822Name[1] (ex. user1@foo.com)</li>
-1572 * <li>dns - dNSName[2] (ex. foo.com)</li>
-1573 * <li>uri - uniformResourceIdentifier[6] (ex. http://foo.com/)</li>
-1574 * <li>certissuer - directoryName[4] (PEM or hex string of cert)</li>
-1575 * <li>certsubj - directoryName[4] (PEM or hex string of cert)</li>
-1576 * </ul>
-1577 * NOTE1: certissuer and certsubj is supported since asn1x509 1.0.10.
-1578 *
-1579 * Here is definition of the ASN.1 syntax:
-1580 * <pre>
-1581 * -- NOTE: under the CHOICE, it will always be explicit.
-1582 * GeneralName ::= CHOICE {
-1583 * otherName [0] OtherName,
-1584 * rfc822Name [1] IA5String,
-1585 * dNSName [2] IA5String,
-1586 * x400Address [3] ORAddress,
-1587 * directoryName [4] Name,
-1588 * ediPartyName [5] EDIPartyName,
-1589 * uniformResourceIdentifier [6] IA5String,
-1590 * iPAddress [7] OCTET STRING,
-1591 * registeredID [8] OBJECT IDENTIFIER }
-1592 * </pre>
-1593 *
-1594 *
-1595 *
-1596 * @example
-1597 * gn = new KJUR.asn1.x509.GeneralName({rfc822: 'test@aaa.com'});
-1598 * gn = new KJUR.asn1.x509.GeneralName({dns: 'aaa.com'});
-1599 * gn = new KJUR.asn1.x509.GeneralName({uri: 'http://aaa.com/'});
-1600 * gn = new KJUR.asn1.x509.GeneralName({certissuer: certPEM});
-1601 * gn = new KJUR.asn1.x509.GeneralName({certsubj: certPEM});
-1602 */
-1603 KJUR.asn1.x509.GeneralName = function ( params ) {
-1604 KJUR.asn1.x509.GeneralName.superclass.constructor.call ( this ) ;
-1605 var asn1Obj = null ;
-1606 var type = null ;
-1607 var pTag = { rfc822 : '81' , dns : '82' , dn : 'a4' , uri : '86' } ;
-1608 this.explicit = false ;
-1609
-1610 this.setByParam = function ( params ) {
-1611 var str = null ;
-1612 var v = null ;
-1613
-1614 if ( typeof params == "undefined" ) return ;
-1615
-1616 if ( typeof params.rfc822 != "undefined" ) {
-1617 this.type = 'rfc822' ;
-1618 v = new KJUR.asn1.DERIA5String ( { 'str' : params [ this.type ] } ) ;
-1619 }
-1620 if ( typeof params.dns != "undefined" ) {
-1621 this.type = 'dns' ;
-1622 v = new KJUR.asn1.DERIA5String ( { 'str' : params [ this.type ] } ) ;
-1623 }
-1624 if ( typeof params.uri != "undefined" ) {
-1625 this.type = 'uri' ;
-1626 v = new KJUR.asn1.DERIA5String ( { 'str' : params [ this.type ] } ) ;
-1627 }
-1628 if ( typeof params.certissuer != "undefined" ) {
-1629 this.type = 'dn' ;
-1630 this.explicit = true ;
-1631 var certStr = params.certissuer ;
-1632 var certHex = null ;
-1633 if ( certStr.match ( /^[0-9A-Fa-f]+$/ ) ) {
-1634 certHex == certStr ;
-1635 }
-1636 if ( certStr.indexOf ( "-----BEGIN " ) != - 1 ) {
-1637 certHex = X509.pemToHex ( certStr ) ;
-1638 }
-1639 if ( certHex == null ) throw "certissuer param not cert" ;
-1640 var x = new X509 ( ) ;
-1641 x.hex = certHex ;
-1642 var dnHex = x.getIssuerHex ( ) ;
-1643 v = new KJUR.asn1.ASN1Object ( ) ;
-1644 v.hTLV = dnHex ;
-1645 }
-1646 if ( typeof params.certsubj != "undefined" ) {
-1647 this.type = 'dn' ;
-1648 this.explicit = true ;
-1649 var certStr = params.certsubj ;
-1650 var certHex = null ;
-1651 if ( certStr.match ( /^[0-9A-Fa-f]+$/ ) ) {
-1652 certHex == certStr ;
-1653 }
-1654 if ( certStr.indexOf ( "-----BEGIN " ) != - 1 ) {
-1655 certHex = X509.pemToHex ( certStr ) ;
-1656 }
-1657 if ( certHex == null ) throw "certsubj param not cert" ;
-1658 var x = new X509 ( ) ;
-1659 x.hex = certHex ;
-1660 var dnHex = x.getSubjectHex ( ) ;
-1661 v = new KJUR.asn1.ASN1Object ( ) ;
-1662 v.hTLV = dnHex ;
-1663 }
-1664
-1665 if ( this.type == null )
-1666 throw "unsupported type in params=" + params ;
-1667 this.asn1Obj = new KJUR.asn1.DERTaggedObject ( { 'explicit' : this.explicit ,
-1668 'tag' : pTag [ this.type ] ,
-1669 'obj' : v } ) ;
-1670 } ;
-1671
-1672 this.getEncodedHex = function ( ) {
-1673 return this.asn1Obj.getEncodedHex ( ) ;
-1674 }
-1675
-1676 if ( typeof params != "undefined" ) {
-1677 this.setByParam ( params ) ;
-1678 }
-1679
-1680 } ;
-1681 YAHOO.lang.extend ( KJUR.asn1.x509.GeneralName , KJUR.asn1.ASN1Object ) ;
-1682
-1683 /**
-1684 * GeneralNames ASN.1 structure class
-1685 * @name KJUR.asn1.x509.GeneralNames
-1686 * @class GeneralNames ASN.1 structure class
-1687 * @description
-1688 * <br/>
-1689 * <h4>EXAMPLE AND ASN.1 SYNTAX</h4>
-1690 * @example
-1691 * var gns = new KJUR.asn1.x509.GeneralNames([{'uri': 'http://aaa.com/'}, {'uri': 'http://bbb.com/'}]);
-1692 *
-1693 * GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
-1694 */
-1695 KJUR.asn1.x509.GeneralNames = function ( paramsArray ) {
-1696 KJUR.asn1.x509.GeneralNames.superclass.constructor.call ( this ) ;
-1697 var asn1Array = null ;
-1698
-1699 /**
-1700 * set a array of {@link KJUR.asn1.x509.GeneralName} parameters
-1701 * @name setByParamArray
-1702 * @memberOf KJUR.asn1.x509.GeneralNames
-1703 * @function
-1704 * @param {Array} paramsArray Array of {@link KJUR.asn1.x509.GeneralNames}
-1705 * @description
-1706 * <br/>
-1707 * <h4>EXAMPLES</h4>
-1708 * @example
-1709 * var gns = new KJUR.asn1.x509.GeneralNames();
-1710 * gns.setByParamArray([{'uri': 'http://aaa.com/'}, {'uri': 'http://bbb.com/'}]);
-1711 */
-1712 this.setByParamArray = function ( paramsArray ) {
-1713 for ( var i = 0 ; i < paramsArray.length ; i ++ ) {
-1714 var o = new KJUR.asn1.x509.GeneralName ( paramsArray [ i ] ) ;
-1715 this.asn1Array.push ( o ) ;
-1716 }
-1717 } ;
-1718
-1719 this.getEncodedHex = function ( ) {
-1720 var o = new KJUR.asn1.DERSequence ( { 'array' : this.asn1Array } ) ;
-1721 return o.getEncodedHex ( ) ;
-1722 } ;
-1723
-1724 this.asn1Array = new Array ( ) ;
-1725 if ( typeof paramsArray != "undefined" ) {
-1726 this.setByParamArray ( paramsArray ) ;
-1727 }
-1728 } ;
-1729 YAHOO.lang.extend ( KJUR.asn1.x509.GeneralNames , KJUR.asn1.ASN1Object ) ;
-1730
-1731 /**
-1732 * DistributionPointName ASN.1 structure class
-1733 * @name KJUR.asn1.x509.DistributionPointName
-1734 * @class DistributionPointName ASN.1 structure class
-1735 * @description
-1736 * @example
-1737 */
-1738 KJUR.asn1.x509.DistributionPointName = function ( gnOrRdn ) {
-1739 KJUR.asn1.x509.DistributionPointName.superclass.constructor.call ( this ) ;
-1740 var asn1Obj = null ;
-1741 var type = null ;
-1742 var tag = null ;
-1743 var asn1V = null ;
-1744
-1745 this.getEncodedHex = function ( ) {
-1746 if ( this.type != "full" )
-1747 throw "currently type shall be 'full': " + this.type ;
-1748 this.asn1Obj = new KJUR.asn1.DERTaggedObject ( { 'explicit' : false ,
-1749 'tag' : this.tag ,
-1750 'obj' : this.asn1V } ) ;
-1751 this.hTLV = this.asn1Obj.getEncodedHex ( ) ;
-1752 return this.hTLV ;
-1753 } ;
-1754
-1755 if ( typeof gnOrRdn != "undefined" ) {
-1756 if ( KJUR.asn1.x509.GeneralNames.prototype.isPrototypeOf ( gnOrRdn ) ) {
-1757 this.type = "full" ;
-1758 this.tag = "a0" ;
-1759 this.asn1V = gnOrRdn ;
-1760 } else {
-1761 throw "This class supports GeneralNames only as argument" ;
-1762 }
-1763 }
-1764 } ;
-1765 YAHOO.lang.extend ( KJUR.asn1.x509.DistributionPointName , KJUR.asn1.ASN1Object ) ;
-1766
-1767 /**
-1768 * DistributionPoint ASN.1 structure class
-1769 * @name KJUR.asn1.x509.DistributionPoint
-1770 * @class DistributionPoint ASN.1 structure class
-1771 * @description
-1772 * @example
-1773 */
-1774 KJUR.asn1.x509.DistributionPoint = function ( params ) {
-1775 KJUR.asn1.x509.DistributionPoint.superclass.constructor.call ( this ) ;
-1776 var asn1DP = null ;
-1777
-1778 this.getEncodedHex = function ( ) {
-1779 var seq = new KJUR.asn1.DERSequence ( ) ;
-1780 if ( this.asn1DP != null ) {
-1781 var o1 = new KJUR.asn1.DERTaggedObject ( { 'explicit' : true ,
-1782 'tag' : 'a0' ,
-1783 'obj' : this.asn1DP } ) ;
-1784 seq.appendASN1Object ( o1 ) ;
-1785 }
-1786 this.hTLV = seq.getEncodedHex ( ) ;
-1787 return this.hTLV ;
-1788 } ;
-1789
-1790 if ( typeof params != "undefined" ) {
-1791 if ( typeof params [ 'dpobj' ] != "undefined" ) {
-1792 this.asn1DP = params [ 'dpobj' ] ;
-1793 }
-1794 }
-1795 } ;
-1796 YAHOO.lang.extend ( KJUR.asn1.x509.DistributionPoint , KJUR.asn1.ASN1Object ) ;
-1797
-1798 /**
-1799 * static object for OID
-1800 * @name KJUR.asn1.x509.OID
-1801 * @class static object for OID
-1802 * @property {Assoc Array} atype2oidList for short attribyte type name and oid (i.e. 'C' and '2.5.4.6')
-1803 * @property {Assoc Array} name2oidList for oid name and oid (i.e. 'keyUsage' and '2.5.29.15')
-1804 * @property {Assoc Array} objCache for caching name and DERObjectIdentifier object
-1805 * @description
-1806 * <dl>
-1807 * <dt><b>atype2oidList</b>
-1808 * <dd>currently supports 'C', 'O', 'OU', 'ST', 'L' and 'CN' only.
-1809 * <dt><b>name2oidList</b>
-1810 * <dd>currently supports 'SHA1withRSA', 'rsaEncryption' and some extension OIDs
-1811 * </dl>
-1812 * @example
-1813 */
-1814 KJUR.asn1.x509.OID = new function ( params ) {
-1815 this.atype2oidList = {
-1816 'C' : '2.5.4.6' ,
-1817 'O' : '2.5.4.10' ,
-1818 'OU' : '2.5.4.11' ,
-1819 'ST' : '2.5.4.8' ,
-1820 'L' : '2.5.4.7' ,
-1821 'CN' : '2.5.4.3' ,
-1822 'SN' : '2.5.4.4' ,
-1823 'DN' : '2.5.4.49' ,
-1824 'DC' : '0.9.2342.19200300.100.1.25' ,
-1825 } ;
-1826 this.name2oidList = {
-1827 'sha1' : '1.3.14.3.2.26' ,
-1828 'sha256' : '2.16.840.1.101.3.4.2.1' ,
-1829 'sha384' : '2.16.840.1.101.3.4.2.2' ,
-1830 'sha512' : '2.16.840.1.101.3.4.2.3' ,
-1831 'sha224' : '2.16.840.1.101.3.4.2.4' ,
-1832 'md5' : '1.2.840.113549.2.5' ,
-1833 'md2' : '1.3.14.7.2.2.1' ,
-1834 'ripemd160' : '1.3.36.3.2.1' ,
-1835
-1836 'MD2withRSA' : '1.2.840.113549.1.1.2' ,
-1837 'MD4withRSA' : '1.2.840.113549.1.1.3' ,
-1838 'MD5withRSA' : '1.2.840.113549.1.1.4' ,
-1839 'SHA1withRSA' : '1.2.840.113549.1.1.5' ,
-1840 'SHA224withRSA' : '1.2.840.113549.1.1.14' ,
-1841 'SHA256withRSA' : '1.2.840.113549.1.1.11' ,
-1842 'SHA384withRSA' : '1.2.840.113549.1.1.12' ,
-1843 'SHA512withRSA' : '1.2.840.113549.1.1.13' ,
-1844
-1845 'SHA1withECDSA' : '1.2.840.10045.4.1' ,
-1846 'SHA224withECDSA' : '1.2.840.10045.4.3.1' ,
-1847 'SHA256withECDSA' : '1.2.840.10045.4.3.2' ,
-1848 'SHA384withECDSA' : '1.2.840.10045.4.3.3' ,
-1849 'SHA512withECDSA' : '1.2.840.10045.4.3.4' ,
-1850
-1851 'dsa' : '1.2.840.10040.4.1' ,
-1852 'SHA1withDSA' : '1.2.840.10040.4.3' ,
-1853 'SHA224withDSA' : '2.16.840.1.101.3.4.3.1' ,
-1854 'SHA256withDSA' : '2.16.840.1.101.3.4.3.2' ,
-1855
-1856 'rsaEncryption' : '1.2.840.113549.1.1.1' ,
-1857
-1858 'countryName' : '2.5.4.6' ,
-1859 'organization' : '2.5.4.10' ,
-1860 'organizationalUnit' : '2.5.4.11' ,
-1861 'stateOrProvinceName' : '2.5.4.8' ,
-1862 'locality' : '2.5.4.7' ,
-1863 'commonName' : '2.5.4.3' ,
-1864
-1865 'subjectKeyIdentifier' : '2.5.29.14' ,
-1866 'keyUsage' : '2.5.29.15' ,
-1867 'subjectAltName' : '2.5.29.17' ,
-1868 'basicConstraints' : '2.5.29.19' ,
-1869 'nameConstraints' : '2.5.29.30' ,
-1870 'cRLDistributionPoints' : '2.5.29.31' ,
-1871 'certificatePolicies' : '2.5.29.32' ,
-1872 'authorityKeyIdentifier' : '2.5.29.35' ,
-1873 'policyConstraints' : '2.5.29.36' ,
-1874 'extKeyUsage' : '2.5.29.37' ,
-1875 'authorityInfoAccess' : '1.3.6.1.5.5.7.1.1' ,
-1876
-1877 'anyExtendedKeyUsage' : '2.5.29.37.0' ,
-1878 'serverAuth' : '1.3.6.1.5.5.7.3.1' ,
-1879 'clientAuth' : '1.3.6.1.5.5.7.3.2' ,
-1880 'codeSigning' : '1.3.6.1.5.5.7.3.3' ,
-1881 'emailProtection' : '1.3.6.1.5.5.7.3.4' ,
-1882 'timeStamping' : '1.3.6.1.5.5.7.3.8' ,
-1883 'ocspSigning' : '1.3.6.1.5.5.7.3.9' ,
-1884
-1885 'ecPublicKey' : '1.2.840.10045.2.1' ,
-1886 'secp256r1' : '1.2.840.10045.3.1.7' ,
-1887 'secp256k1' : '1.3.132.0.10' ,
-1888 'secp384r1' : '1.3.132.0.34' ,
-1889
-1890 'pkcs5PBES2' : '1.2.840.113549.1.5.13' ,
-1891 'pkcs5PBKDF2' : '1.2.840.113549.1.5.12' ,
-1892
-1893 'des-EDE3-CBC' : '1.2.840.113549.3.7' ,
-1894
-1895 'data' : '1.2.840.113549.1.7.1' , // CMS data
-1896 'signed-data' : '1.2.840.113549.1.7.2' , // CMS signed-data
-1897 'enveloped-data' : '1.2.840.113549.1.7.3' , // CMS enveloped-data
-1898 'digested-data' : '1.2.840.113549.1.7.5' , // CMS digested-data
-1899 'encrypted-data' : '1.2.840.113549.1.7.6' , // CMS encrypted-data
-1900 'authenticated-data' : '1.2.840.113549.1.9.16.1.2' , // CMS authenticated-data
-1901 'tstinfo' : '1.2.840.113549.1.9.16.1.4' , // RFC3161 TSTInfo
-1902 } ;
-1903
-1904 this.objCache = { } ;
-1905
-1906 /**
-1907 * get DERObjectIdentifier by registered OID name
-1908 * @name name2obj
-1909 * @memberOf KJUR.asn1.x509.OID
-1910 * @function
-1911 * @param {String} name OID
-1912 * @description
-1913 * @example
-1914 * var asn1ObjOID = OID.name2obj('SHA1withRSA');
-1915 */
-1916 this.name2obj = function ( name ) {
-1917 if ( typeof this.objCache [ name ] != "undefined" )
-1918 return this.objCache [ name ] ;
-1919 if ( typeof this.name2oidList [ name ] == "undefined" )
-1920 throw "Name of ObjectIdentifier not defined: " + name ;
-1921 var oid = this.name2oidList [ name ] ;
-1922 var obj = new KJUR.asn1.DERObjectIdentifier ( { 'oid' : oid } ) ;
-1923 this.objCache [ name ] = obj ;
-1924 return obj ;
-1925 } ;
-1926
-1927 /**
-1928 * get DERObjectIdentifier by registered attribyte type name such like 'C' or 'CN'
-1929 * @name atype2obj
-1930 * @memberOf KJUR.asn1.x509.OID
-1931 * @function
-1932 * @param {String} atype short attribute type name such like 'C' or 'CN'
-1933 * @description
-1934 * @example
-1935 * var asn1ObjOID = OID.atype2obj('CN');
-1936 */
-1937 this.atype2obj = function ( atype ) {
-1938 if ( typeof this.objCache [ atype ] != "undefined" )
-1939 return this.objCache [ atype ] ;
-1940 if ( typeof this.atype2oidList [ atype ] == "undefined" )
-1941 throw "AttributeType name undefined: " + atype ;
-1942 var oid = this.atype2oidList [ atype ] ;
-1943 var obj = new KJUR.asn1.DERObjectIdentifier ( { 'oid' : oid } ) ;
-1944 this.objCache [ atype ] = obj ;
-1945 return obj ;
-1946 } ;
-1947 } ;
-1948
-1949 /*
-1950 * convert OID to name
-1951 * @name oid2name
-1952 * @memberOf KJUR.asn1.x509.OID
-1953 * @function
-1954 * @param {String} dot noted Object Identifer string (ex. 1.2.3.4)
-1955 * @return {String} OID name
-1956 * @description
-1957 * This static method converts OID string to its name.
-1958 * If OID is undefined then it returns empty string (i.e. '').
-1959 * @example
-1960 * name = KJUR.asn1.x509.OID.oid2name("1.3.6.1.5.5.7.1.1");
-1961 * // name will be 'authorityInfoAccess'.
-1962 * @since asn1x509 1.0.9
-1963 */
-1964 KJUR.asn1.x509.OID.oid2name = function ( oid ) {
-1965 var list = KJUR.asn1.x509.OID.name2oidList ;
-1966 for ( var name in list ) {
-1967 if ( list [ name ] == oid ) return name ;
-1968 }
-1969 return '' ;
-1970 } ;
-1971
-1972 /*
-1973 * convert name to OID
-1974 * @name name2oid
-1975 * @memberOf KJUR.asn1.x509.OID
-1976 * @function
-1977 * @param {String} OID name
-1978 * @return {String} dot noted Object Identifer string (ex. 1.2.3.4)
-1979 * @description
-1980 * This static method converts from OID name to OID string.
-1981 * If OID is undefined then it returns empty string (i.e. '').
-1982 * @example
-1983 * name = KJUR.asn1.x509.OID.name2oid("authorityInfoAccess");
-1984 * // name will be '1.3.6.1.5.5.7.1.1'.
-1985 * @since asn1x509 1.0.11
-1986 */
-1987 KJUR.asn1.x509.OID.name2oid = function ( name ) {
-1988 var list = KJUR.asn1.x509.OID.name2oidList ;
-1989 if ( list [ name ] === undefined ) return '' ;
-1990 return list [ name ] ;
-1991 } ;
-1992
-1993 /**
-1994 * X.509 certificate and CRL utilities class
-1995 * @name KJUR.asn1.x509.X509Util
-1996 * @class X.509 certificate and CRL utilities class
-1997 */
-1998 KJUR.asn1.x509.X509Util = new function ( ) {
-1999 /**
-2000 * get PKCS#8 PEM public key string from RSAKey object
-2001 * @name getPKCS8PubKeyPEMfromRSAKey
-2002 * @memberOf KJUR.asn1.x509.X509Util
-2003 * @function
-2004 * @param {RSAKey} rsaKey RSA public key of {@link RSAKey} object
-2005 * @description
-2006 * @example
-2007 * var pem = KJUR.asn1.x509.X509Util.getPKCS8PubKeyPEMfromRSAKey(pubKey);
-2008 */
-2009 this.getPKCS8PubKeyPEMfromRSAKey = function ( rsaKey ) {
-2010 var pem = null ;
-2011 var hN = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex ( rsaKey.n ) ;
-2012 var hE = KJUR.asn1.ASN1Util.integerToByteHex ( rsaKey.e ) ;
-2013 var iN = new KJUR.asn1.DERInteger ( { hex : hN } ) ;
-2014 var iE = new KJUR.asn1.DERInteger ( { hex : hE } ) ;
-2015 var asn1PubKey = new KJUR.asn1.DERSequence ( { array : [ iN , iE ] } ) ;
-2016 var hPubKey = asn1PubKey.getEncodedHex ( ) ;
-2017 var o1 = new KJUR.asn1.x509.AlgorithmIdentifier ( { name : 'rsaEncryption' } ) ;
-2018 var o2 = new KJUR.asn1.DERBitString ( { hex : '00' + hPubKey } ) ;
-2019 var seq = new KJUR.asn1.DERSequence ( { array : [ o1 , o2 ] } ) ;
-2020 var hP8 = seq.getEncodedHex ( ) ;
-2021 var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex ( hP8 , "PUBLIC KEY" ) ;
-2022 return pem ;
-2023 } ;
-2024 } ;
-2025 /**
-2026 * issue a certificate in PEM format
-2027 * @name newCertPEM
-2028 * @memberOf KJUR.asn1.x509.X509Util
-2029 * @function
-2030 * @param {Array} param parameter to issue a certificate
-2031 * @since asn1x509 1.0.6
-2032 * @description
-2033 * This method can issue a certificate by a simple
-2034 * JSON object.
-2035 * Signature value will be provided by signing with
-2036 * private key using 'cakey' parameter or
-2037 * hexa decimal signature value by 'sighex' parameter.
-2038 *
-2039 * NOTE: When using DSA or ECDSA CA signing key,
-2040 * use 'paramempty' in 'sigalg' to ommit parameter field
-2041 * of AlgorithmIdentifer. In case of RSA, parameter
-2042 * NULL will be specified by default.
-2043 *
-2044 * @example
-2045 * var certPEM = KJUR.asn1.x509.X509Util.newCertPEM(
-2046 * { serial: {int: 4},
-2047 * sigalg: {name: 'SHA1withECDSA', paramempty: true},
-2048 * issuer: {str: '/C=US/O=a'},
-2049 * notbefore: {'str': '130504235959Z'},
-2050 * notafter: {'str': '140504235959Z'},
-2051 * subject: {str: '/C=US/O=b'},
-2052 * sbjpubkey: pubKeyPEM,
-2053 * ext: [
-2054 * {basicConstraints: {cA: true, critical: true}},
-2055 * {keyUsage: {bin: '11'}},
-2056 * ],
-2057 * cakey: [prvkey, pass]}
-2058 * );
-2059 * // -- or --
-2060 * var certPEM = KJUR.asn1.x509.X509Util.newCertPEM(
-2061 * { serial: {int: 1},
-2062 * sigalg: {name: 'SHA1withRSA', paramempty: true},
-2063 * issuer: {str: '/C=US/O=T1'},
-2064 * notbefore: {'str': '130504235959Z'},
-2065 * notafter: {'str': '140504235959Z'},
-2066 * subject: {str: '/C=US/O=T1'},
-2067 * sbjpubkey: pubKeyObj,
-2068 * sighex: '0102030405..'}
-2069 * );
-2070 * // for the issuer and subject field, another
-2071 * // representation is also available
-2072 * var certPEM = KJUR.asn1.x509.X509Util.newCertPEM(
-2073 * { serial: {int: 1},
-2074 * sigalg: {name: 'SHA1withRSA', paramempty: true},
-2075 * issuer: {C: "US", O: "T1"},
-2076 * notbefore: {'str': '130504235959Z'},
-2077 * notafter: {'str': '140504235959Z'},
-2078 * subject: {C: "US", O: "T1", CN: "http://example.com/"},
-2079 * sbjpubkey: pubKeyObj,
-2080 * sighex: '0102030405..'}
-2081 * );
-2082 */
-2083 KJUR.asn1.x509.X509Util.newCertPEM = function ( param ) {
-2084 var ns1 = KJUR.asn1.x509 ;
-2085 var o = new ns1.TBSCertificate ( ) ;
-2086
-2087 if ( param.serial !== undefined )
-2088 o.setSerialNumberByParam ( param.serial ) ;
-2089 else
-2090 throw "serial number undefined." ;
-2091
-2092 if ( typeof param.sigalg.name == 'string' )
-2093 o.setSignatureAlgByParam ( param.sigalg ) ;
-2094 else
-2095 throw "unproper signature algorithm name" ;
-2096
-2097 if ( param.issuer !== undefined )
-2098 o.setIssuerByParam ( param.issuer ) ;
-2099 else
-2100 throw "issuer name undefined." ;
-2101
-2102 if ( param.notbefore !== undefined )
-2103 o.setNotBeforeByParam ( param.notbefore ) ;
-2104 else
-2105 throw "notbefore undefined." ;
-2106
-2107 if ( param.notafter !== undefined )
-2108 o.setNotAfterByParam ( param.notafter ) ;
-2109 else
-2110 throw "notafter undefined." ;
-2111
-2112 if ( param.subject !== undefined )
-2113 o.setSubjectByParam ( param.subject ) ;
-2114 else
-2115 throw "subject name undefined." ;
-2116
-2117 if ( param.sbjpubkey !== undefined )
-2118 o.setSubjectPublicKeyByGetKey ( param.sbjpubkey ) ;
-2119 else
-2120 throw "subject public key undefined." ;
-2121
-2122 if ( param.ext !== undefined && param.ext.length !== undefined ) {
-2123 for ( var i = 0 ; i < param.ext.length ; i ++ ) {
-2124 for ( key in param.ext [ i ] ) {
-2125 o.appendExtensionByName ( key , param.ext [ i ] [ key ] ) ;
-2126 }
-2127 }
-2128 }
-2129
-2130 // set signature
-2131 if ( param.cakey === undefined && param.sighex === undefined )
-2132 throw "param cakey and sighex undefined." ;
-2133
-2134 var caKey = null ;
-2135 var cert = null ;
-2136
-2137 if ( param.cakey ) {
-2138 caKey = KEYUTIL.getKey.apply ( null , param.cakey ) ;
-2139 cert = new ns1.Certificate ( { 'tbscertobj' : o , 'prvkeyobj' : caKey } ) ;
-2140 cert.sign ( ) ;
-2141 }
-2142
-2143 if ( param.sighex ) {
-2144 cert = new ns1.Certificate ( { 'tbscertobj' : o } ) ;
-2145 cert.setSignatureHex ( param.sighex ) ;
-2146 }
-2147
-2148 return cert.getPEMString ( ) ;
-2149 } ;
-2150
-2151 /*
-2152 org.bouncycastle.asn1.x500
-2153 AttributeTypeAndValue
-2154 DirectoryString
-2155 RDN
-2156 X500Name
-2157 X500NameBuilder
-2158
-2159 org.bouncycastleasn1.x509
-2160 TBSCertificate
-2161 */
-2162
\ No newline at end of file
diff --git a/jwt/api/symbols/src/base64x-1.1.js.html b/jwt/api/symbols/src/base64x-1.1.js.html
deleted file mode 100644
index 9230045..0000000
--- a/jwt/api/symbols/src/base64x-1.1.js.html
+++ /dev/null
@@ -1,471 +0,0 @@
-
1 /*! base64x-1.1.6 (c) 2012-2015 Kenji Urushima | kjur.github.com/jsrsasign/license
- 2 */
- 3 /*
- 4 * base64x.js - Base64url and supplementary functions for Tom Wu's base64.js library
- 5 *
- 6 * version: 1.1.6 (2015-Nov-11)
- 7 *
- 8 * Copyright (c) 2012-2015 Kenji Urushima (kenji.urushima@gmail.com)
- 9 *
- 10 * This software is licensed under the terms of the MIT License.
- 11 * http://kjur.github.com/jsjws/license/
- 12 *
- 13 * The above copyright and license notice shall be
- 14 * included in all copies or substantial portions of the Software.
- 15 *
- 16 * DEPENDS ON:
- 17 * - base64.js - Tom Wu's Base64 library
- 18 */
- 19
- 20 /**
- 21 * @fileOverview
- 22 * @name base64x-1.1.js
- 23 * @author Kenji Urushima kenji.urushima@gmail.com
- 24 * @version asn1 1.1.6 (2015-Nov-11)
- 25 * @since jsrsasign 2.1
- 26 * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a>
- 27 */
- 28
- 29 /**
- 30 * Base64URL and supplementary functions for Tom Wu's base64.js library.<br/>
- 31 * This class is just provide information about global functions
- 32 * defined in 'base64x.js'. The 'base64x.js' script file provides
- 33 * global functions for converting following data each other.
- 34 * <ul>
- 35 * <li>(ASCII) String</li>
- 36 * <li>UTF8 String including CJK, Latin and other characters</li>
- 37 * <li>byte array</li>
- 38 * <li>hexadecimal encoded String</li>
- 39 * <li>Full URIComponent encoded String (such like "%69%94")</li>
- 40 * <li>Base64 encoded String</li>
- 41 * <li>Base64URL encoded String</li>
- 42 * </ul>
- 43 * All functions in 'base64x.js' are defined in {@link global__} and not
- 44 * in this class.
- 45 *
- 46 * @class Base64URL and supplementary functions for Tom Wu's base64.js library
- 47 * @author Kenji Urushima
- 48 * @version 1.1 (07 May 2012)
- 49 * @requires base64.js
- 50 * @see <a href="http://kjur.github.com/jsjws/">'jwjws'(JWS JavaScript Library) home page http://kjur.github.com/jsjws/</a>
- 51 * @see <a href="http://kjur.github.com/jsrsasigns/">'jwrsasign'(RSA Sign JavaScript Library) home page http://kjur.github.com/jsrsasign/</a>
- 52 */
- 53 function Base64x ( ) {
- 54 }
- 55
- 56 // ==== string / byte array ================================
- 57 /**
- 58 * convert a string to an array of character codes
- 59 * @param {String} s
- 60 * @return {Array of Numbers}
- 61 */
- 62 function stoBA ( s ) {
- 63 var a = new Array ( ) ;
- 64 for ( var i = 0 ; i < s.length ; i ++ ) {
- 65 a [ i ] = s.charCodeAt ( i ) ;
- 66 }
- 67 return a ;
- 68 }
- 69
- 70 /**
- 71 * convert an array of character codes to a string
- 72 * @param {Array of Numbers} a array of character codes
- 73 * @return {String} s
- 74 */
- 75 function BAtos ( a ) {
- 76 var s = "" ;
- 77 for ( var i = 0 ; i < a.length ; i ++ ) {
- 78 s = s + String.fromCharCode ( a [ i ] ) ;
- 79 }
- 80 return s ;
- 81 }
- 82
- 83 // ==== byte array / hex ================================
- 84 /**
- 85 * convert an array of bytes(Number) to hexadecimal string.<br/>
- 86 * @param {Array of Numbers} a array of bytes
- 87 * @return {String} hexadecimal string
- 88 */
- 89 function BAtohex ( a ) {
- 90 var s = "" ;
- 91 for ( var i = 0 ; i < a.length ; i ++ ) {
- 92 var hex1 = a [ i ] . toString ( 16 ) ;
- 93 if ( hex1.length == 1 ) hex1 = "0" + hex1 ;
- 94 s = s + hex1 ;
- 95 }
- 96 return s ;
- 97 }
- 98
- 99 // ==== string / hex ================================
-100 /**
-101 * convert a ASCII string to a hexadecimal string of ASCII codes.<br/>
-102 * NOTE: This can't be used for non ASCII characters.
-103 * @param {s} s ASCII string
-104 * @return {String} hexadecimal string
-105 */
-106 function stohex ( s ) {
-107 return BAtohex ( stoBA ( s ) ) ;
-108 }
-109
-110 // ==== string / base64 ================================
-111 /**
-112 * convert a ASCII string to a Base64 encoded string.<br/>
-113 * NOTE: This can't be used for non ASCII characters.
-114 * @param {s} s ASCII string
-115 * @return {String} Base64 encoded string
-116 */
-117 function stob64 ( s ) {
-118 return hex2b64 ( stohex ( s ) ) ;
-119 }
-120
-121 // ==== string / base64url ================================
-122 /**
-123 * convert a ASCII string to a Base64URL encoded string.<br/>
-124 * NOTE: This can't be used for non ASCII characters.
-125 * @param {s} s ASCII string
-126 * @return {String} Base64URL encoded string
-127 */
-128 function stob64u ( s ) {
-129 return b64tob64u ( hex2b64 ( stohex ( s ) ) ) ;
-130 }
-131
-132 /**
-133 * convert a Base64URL encoded string to a ASCII string.<br/>
-134 * NOTE: This can't be used for Base64URL encoded non ASCII characters.
-135 * @param {s} s Base64URL encoded string
-136 * @return {String} ASCII string
-137 */
-138 function b64utos ( s ) {
-139 return BAtos ( b64toBA ( b64utob64 ( s ) ) ) ;
-140 }
-141
-142 // ==== base64 / base64url ================================
-143 /**
-144 * convert a Base64 encoded string to a Base64URL encoded string.<br/>
-145 * Example: "ab+c3f/==" → "ab-c3f_"
-146 * @param {String} s Base64 encoded string
-147 * @return {String} Base64URL encoded string
-148 */
-149 function b64tob64u ( s ) {
-150 s = s.replace ( /\=/g , "" ) ;
-151 s = s.replace ( /\+/g , "-" ) ;
-152 s = s.replace ( /\//g , "_" ) ;
-153 return s ;
-154 }
-155
-156 /**
-157 * convert a Base64URL encoded string to a Base64 encoded string.<br/>
-158 * Example: "ab-c3f_" → "ab+c3f/=="
-159 * @param {String} s Base64URL encoded string
-160 * @return {String} Base64 encoded string
-161 */
-162 function b64utob64 ( s ) {
-163 if ( s.length % 4 == 2 ) s = s + "==" ;
-164 else if ( s.length % 4 == 3 ) s = s + "=" ;
-165 s = s.replace ( /-/g , "+" ) ;
-166 s = s.replace ( /_/g , "/" ) ;
-167 return s ;
-168 }
-169
-170 // ==== hex / base64url ================================
-171 /**
-172 * convert a hexadecimal string to a Base64URL encoded string.<br/>
-173 * @param {String} s hexadecimal string
-174 * @return {String} Base64URL encoded string
-175 * @description
-176 * convert a hexadecimal string to a Base64URL encoded string.
-177 * NOTE: If leading "0" is omitted and odd number length for
-178 * hexadecimal leading "0" is automatically added.
-179 */
-180 function hextob64u ( s ) {
-181 if ( s.length % 2 == 1 ) s = "0" + s ;
-182 return b64tob64u ( hex2b64 ( s ) ) ;
-183 }
-184
-185 /**
-186 * convert a Base64URL encoded string to a hexadecimal string.<br/>
-187 * @param {String} s Base64URL encoded string
-188 * @return {String} hexadecimal string
-189 */
-190 function b64utohex ( s ) {
-191 return b64tohex ( b64utob64 ( s ) ) ;
-192 }
-193
-194 var utf8tob64u , b64utoutf8 ;
-195
-196 if ( typeof Buffer === 'function' )
-197 {
-198 utf8tob64u = function ( s )
-199 {
-200 return b64tob64u ( new Buffer ( s , 'utf8' ) . toString ( 'base64' ) ) ;
-201 } ;
-202
-203 b64utoutf8 = function ( s )
-204 {
-205 return new Buffer ( b64utob64 ( s ) , 'base64' ) . toString ( 'utf8' ) ;
-206 } ;
-207 }
-208 else
-209 {
-210 // ==== utf8 / base64url ================================
-211 /**
-212 * convert a UTF-8 encoded string including CJK or Latin to a Base64URL encoded string.<br/>
-213 * @param {String} s UTF-8 encoded string
-214 * @return {String} Base64URL encoded string
-215 * @since 1.1
-216 */
-217 utf8tob64u = function ( s )
-218 {
-219 return hextob64u ( uricmptohex ( encodeURIComponentAll ( s ) ) ) ;
-220 } ;
-221
-222 /**
-223 * convert a Base64URL encoded string to a UTF-8 encoded string including CJK or Latin.<br/>
-224 * @param {String} s Base64URL encoded string
-225 * @return {String} UTF-8 encoded string
-226 * @since 1.1
-227 */
-228 b64utoutf8 = function ( s )
-229 {
-230 return decodeURIComponent ( hextouricmp ( b64utohex ( s ) ) ) ;
-231 } ;
-232 }
-233
-234 // ==== utf8 / base64url ================================
-235 /**
-236 * convert a UTF-8 encoded string including CJK or Latin to a Base64 encoded string.<br/>
-237 * @param {String} s UTF-8 encoded string
-238 * @return {String} Base64 encoded string
-239 * @since 1.1.1
-240 */
-241 function utf8tob64 ( s ) {
-242 return hex2b64 ( uricmptohex ( encodeURIComponentAll ( s ) ) ) ;
-243 }
-244
-245 /**
-246 * convert a Base64 encoded string to a UTF-8 encoded string including CJK or Latin.<br/>
-247 * @param {String} s Base64 encoded string
-248 * @return {String} UTF-8 encoded string
-249 * @since 1.1.1
-250 */
-251 function b64toutf8 ( s ) {
-252 return decodeURIComponent ( hextouricmp ( b64tohex ( s ) ) ) ;
-253 }
-254
-255 // ==== utf8 / hex ================================
-256 /**
-257 * convert a UTF-8 encoded string including CJK or Latin to a hexadecimal encoded string.<br/>
-258 * @param {String} s UTF-8 encoded string
-259 * @return {String} hexadecimal encoded string
-260 * @since 1.1.1
-261 */
-262 function utf8tohex ( s ) {
-263 return uricmptohex ( encodeURIComponentAll ( s ) ) ;
-264 }
-265
-266 /**
-267 * convert a hexadecimal encoded string to a UTF-8 encoded string including CJK or Latin.<br/>
-268 * Note that when input is improper hexadecimal string as UTF-8 string, this function returns
-269 * 'null'.
-270 * @param {String} s hexadecimal encoded string
-271 * @return {String} UTF-8 encoded string or null
-272 * @since 1.1.1
-273 */
-274 function hextoutf8 ( s ) {
-275 return decodeURIComponent ( hextouricmp ( s ) ) ;
-276 }
-277
-278 /**
-279 * convert a hexadecimal encoded string to raw string including non printable characters.<br/>
-280 * @param {String} s hexadecimal encoded string
-281 * @return {String} raw string
-282 * @since 1.1.2
-283 * @example
-284 * hextorstr("610061") → "a\x00a"
-285 */
-286 function hextorstr ( sHex ) {
-287 var s = "" ;
-288 for ( var i = 0 ; i < sHex.length - 1 ; i + = 2 ) {
-289 s + = String.fromCharCode ( parseInt ( sHex.substr ( i , 2 ) , 16 ) ) ;
-290 }
-291 return s ;
-292 }
-293
-294 /**
-295 * convert a raw string including non printable characters to hexadecimal encoded string.<br/>
-296 * @param {String} s raw string
-297 * @return {String} hexadecimal encoded string
-298 * @since 1.1.2
-299 * @example
-300 * rstrtohex("a\x00a") → "610061"
-301 */
-302 function rstrtohex ( s ) {
-303 var result = "" ;
-304 for ( var i = 0 ; i < s.length ; i ++ ) {
-305 result + = ( "0" + s.charCodeAt ( i ) . toString ( 16 ) ) . slice ( - 2 ) ;
-306 }
-307 return result ;
-308 }
-309
-310 // ==== hex / b64nl =======================================
-311
-312 /*
-313 * since base64x 1.1.3
-314 */
-315 function hextob64 ( s ) {
-316 return hex2b64 ( s ) ;
-317 }
-318
-319 /*
-320 * since base64x 1.1.3
-321 */
-322 function hextob64nl ( s ) {
-323 var b64 = hextob64 ( s ) ;
-324 var b64nl = b64.replace ( /(.{64})/g , "$1\r\n" ) ;
-325 b64nl = b64nl.replace ( /\r\n$/ , '' ) ;
-326 return b64nl ;
-327 }
-328
-329 /*
-330 * since base64x 1.1.3
-331 */
-332 function b64nltohex ( s ) {
-333 var b64 = s.replace ( /[^0-9A-Za-z\/+=]*/g , '' ) ;
-334 var hex = b64tohex ( b64 ) ;
-335 return hex ;
-336 }
-337
-338 // ==== URIComponent / hex ================================
-339 /**
-340 * convert a URLComponent string such like "%67%68" to a hexadecimal string.<br/>
-341 * @param {String} s URIComponent string such like "%67%68"
-342 * @return {String} hexadecimal string
-343 * @since 1.1
-344 */
-345 function uricmptohex ( s ) {
-346 return s.replace ( /%/g , "" ) ;
-347 }
-348
-349 /**
-350 * convert a hexadecimal string to a URLComponent string such like "%67%68".<br/>
-351 * @param {String} s hexadecimal string
-352 * @return {String} URIComponent string such like "%67%68"
-353 * @since 1.1
-354 */
-355 function hextouricmp ( s ) {
-356 return s.replace ( /(..)/g , "%$1" ) ;
-357 }
-358
-359 // ==== URIComponent ================================
-360 /**
-361 * convert UTFa hexadecimal string to a URLComponent string such like "%67%68".<br/>
-362 * Note that these "<code>0-9A-Za-z!'()*-._~</code>" characters will not
-363 * converted to "%xx" format by builtin 'encodeURIComponent()' function.
-364 * However this 'encodeURIComponentAll()' function will convert
-365 * all of characters into "%xx" format.
-366 * @param {String} s hexadecimal string
-367 * @return {String} URIComponent string such like "%67%68"
-368 * @since 1.1
-369 */
-370 function encodeURIComponentAll ( u8 ) {
-371 var s = encodeURIComponent ( u8 ) ;
-372 var s2 = "" ;
-373 for ( var i = 0 ; i < s.length ; i ++ ) {
-374 if ( s [ i ] == "%" ) {
-375 s2 = s2 + s.substr ( i , 3 ) ;
-376 i = i + 2 ;
-377 } else {
-378 s2 = s2 + "%" + stohex ( s [ i ] ) ;
-379 }
-380 }
-381 return s2 ;
-382 }
-383
-384 // ==== new lines ================================
-385 /**
-386 * convert all DOS new line("\r\n") to UNIX new line("\n") in
-387 * a String "s".
-388 * @param {String} s string
-389 * @return {String} converted string
-390 */
-391 function newline_toUnix ( s ) {
-392 s = s.replace ( /\r\n/mg , "\n" ) ;
-393 return s ;
-394 }
-395
-396 /**
-397 * convert all UNIX new line("\r\n") to DOS new line("\n") in
-398 * a String "s".
-399 * @param {String} s string
-400 * @return {String} converted string
-401 */
-402 function newline_toDos ( s ) {
-403 s = s.replace ( /\r\n/mg , "\n" ) ;
-404 s = s.replace ( /\n/mg , "\r\n" ) ;
-405 return s ;
-406 }
-407
-408 // ==== others ================================
-409
-410 /**
-411 * convert string of integer array to hexadecimal string.<br/>
-412 * @param {String} s string of integer array
-413 * @return {String} hexadecimal string
-414 * @since base64x 1.1.6 jsrsasign 5.0.2
-415 * @throws "malformed integer array string: *" for wrong input
-416 * @description
-417 * This function converts a string of JavaScript integer array to
-418 * a hexadecimal string. Each integer value shall be in a range
-419 * from 0 to 255 otherwise it raise exception. Input string can
-420 * have extra space or newline string so that they will be ignored.
-421 *
-422 * @example
-423 * intarystrtohex(" [123, 34, 101, 34, 58] ")
-424 * -> 7b2265223a (i.e. `{"e":` as string)
-425 */
-426 function intarystrtohex ( s ) {
-427 s = s.replace ( /^\s*\[\s*/ , '' ) ;
-428 s = s.replace ( /\s*\]\s*$/ , '' ) ;
-429 s = s.replace ( /\s*/g , '' ) ;
-430 try {
-431 var hex = s.split ( /,/ ) . map ( function ( element , index , array ) {
-432 var i = parseInt ( element ) ;
-433 if ( i < 0 || 255 < i ) throw "integer not in range 0-255" ;
-434 var hI = ( "00" + i.toString ( 16 ) ) . slice ( - 2 ) ;
-435 return hI ;
-436 } ) . join ( '' ) ;
-437 return hex ;
-438 } catch ( ex ) {
-439 throw "malformed integer array string: " + ex ;
-440 }
-441 }
-442
-443 /**
-444 * find index of string where two string differs
-445 * @param {String} s1 string to compare
-446 * @param {String} s2 string to compare
-447 * @return {Number} string index of where character differs. Return -1 if same.
-448 * @since jsrsasign 4.9.0 base64x 1.1.5
-449 * @example
-450 * strdiffidx("abcdefg", "abcd4fg") -> 4
-451 * strdiffidx("abcdefg", "abcdefg") -> -1
-452 * strdiffidx("abcdefg", "abcdef") -> 6
-453 * strdiffidx("abcdefgh", "abcdef") -> 6
-454 */
-455 var strdiffidx = function ( s1 , s2 ) {
-456 var n = s1.length ;
-457 if ( s1.length > s2.length ) n = s2.length ;
-458 for ( var i = 0 ; i < n ; i ++ ) {
-459 if ( s1.charCodeAt ( i ) != s2.charCodeAt ( i ) ) return i ;
-460 }
-461 if ( s1.length != s2.length ) return n ;
-462 return - 1 ; // same
-463 } ;
-464
\ No newline at end of file
diff --git a/jwt/api/symbols/src/crypto-1.1.js.html b/jwt/api/symbols/src/crypto-1.1.js.html
deleted file mode 100644
index 237551d..0000000
--- a/jwt/api/symbols/src/crypto-1.1.js.html
+++ /dev/null
@@ -1,1237 +0,0 @@
-
1 /*! crypto-1.1.8.js (c) 2013-2016 Kenji Urushima | kjur.github.com/jsrsasign/license
- 2 */
- 3 /*
- 4 * crypto.js - Cryptographic Algorithm Provider class
- 5 *
- 6 * Copyright (c) 2013-2016 Kenji Urushima (kenji.urushima@gmail.com)
- 7 *
- 8 * This software is licensed under the terms of the MIT License.
- 9 * http://kjur.github.com/jsrsasign/license
- 10 *
- 11 * The above copyright and license notice shall be
- 12 * included in all copies or substantial portions of the Software.
- 13 */
- 14
- 15 /**
- 16 * @fileOverview
- 17 * @name crypto-1.1.js
- 18 * @author Kenji Urushima kenji.urushima@gmail.com
- 19 * @version 1.1.8 (2016-Feb-28)
- 20 * @since jsrsasign 2.2
- 21 * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a>
- 22 */
- 23
- 24 /**
- 25 * kjur's class library name space
- 26 * @name KJUR
- 27 * @namespace kjur's class library name space
- 28 */
- 29 if ( typeof KJUR == "undefined" || ! KJUR ) KJUR = { } ;
- 30 /**
- 31 * kjur's cryptographic algorithm provider library name space
- 32 * <p>
- 33 * This namespace privides following crytpgrahic classes.
- 34 * <ul>
- 35 * <li>{@link KJUR.crypto.MessageDigest} - Java JCE(cryptograhic extension) style MessageDigest class</li>
- 36 * <li>{@link KJUR.crypto.Signature} - Java JCE(cryptograhic extension) style Signature class</li>
- 37 * <li>{@link KJUR.crypto.Util} - cryptographic utility functions and properties</li>
- 38 * </ul>
- 39 * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.
- 40 * </p>
- 41 * @name KJUR.crypto
- 42 * @namespace
- 43 */
- 44 if ( typeof KJUR.crypto == "undefined" || ! KJUR.crypto ) KJUR.crypto = { } ;
- 45
- 46 /**
- 47 * static object for cryptographic function utilities
- 48 * @name KJUR.crypto.Util
- 49 * @class static object for cryptographic function utilities
- 50 * @property {Array} DIGESTINFOHEAD PKCS#1 DigestInfo heading hexadecimal bytes for each hash algorithms
- 51 * @property {Array} DEFAULTPROVIDER associative array of default provider name for each hash and signature algorithms
- 52 * @description
- 53 */
- 54 KJUR.crypto.Util = new function ( ) {
- 55 this.DIGESTINFOHEAD = {
- 56 'sha1' : "3021300906052b0e03021a05000414" ,
- 57 'sha224' : "302d300d06096086480165030402040500041c" ,
- 58 'sha256' : "3031300d060960864801650304020105000420" ,
- 59 'sha384' : "3041300d060960864801650304020205000430" ,
- 60 'sha512' : "3051300d060960864801650304020305000440" ,
- 61 'md2' : "3020300c06082a864886f70d020205000410" ,
- 62 'md5' : "3020300c06082a864886f70d020505000410" ,
- 63 'ripemd160' : "3021300906052b2403020105000414" ,
- 64 } ;
- 65
- 66 /*
- 67 * @since crypto 1.1.1
- 68 */
- 69 this.DEFAULTPROVIDER = {
- 70 'md5' : 'cryptojs' ,
- 71 'sha1' : 'cryptojs' ,
- 72 'sha224' : 'cryptojs' ,
- 73 'sha256' : 'cryptojs' ,
- 74 'sha384' : 'cryptojs' ,
- 75 'sha512' : 'cryptojs' ,
- 76 'ripemd160' : 'cryptojs' ,
- 77 'hmacmd5' : 'cryptojs' ,
- 78 'hmacsha1' : 'cryptojs' ,
- 79 'hmacsha224' : 'cryptojs' ,
- 80 'hmacsha256' : 'cryptojs' ,
- 81 'hmacsha384' : 'cryptojs' ,
- 82 'hmacsha512' : 'cryptojs' ,
- 83 'hmacripemd160' : 'cryptojs' ,
- 84
- 85 'MD5withRSA' : 'cryptojs/jsrsa' ,
- 86 'SHA1withRSA' : 'cryptojs/jsrsa' ,
- 87 'SHA224withRSA' : 'cryptojs/jsrsa' ,
- 88 'SHA256withRSA' : 'cryptojs/jsrsa' ,
- 89 'SHA384withRSA' : 'cryptojs/jsrsa' ,
- 90 'SHA512withRSA' : 'cryptojs/jsrsa' ,
- 91 'RIPEMD160withRSA' : 'cryptojs/jsrsa' ,
- 92
- 93 'MD5withECDSA' : 'cryptojs/jsrsa' ,
- 94 'SHA1withECDSA' : 'cryptojs/jsrsa' ,
- 95 'SHA224withECDSA' : 'cryptojs/jsrsa' ,
- 96 'SHA256withECDSA' : 'cryptojs/jsrsa' ,
- 97 'SHA384withECDSA' : 'cryptojs/jsrsa' ,
- 98 'SHA512withECDSA' : 'cryptojs/jsrsa' ,
- 99 'RIPEMD160withECDSA' : 'cryptojs/jsrsa' ,
-100
-101 'SHA1withDSA' : 'cryptojs/jsrsa' ,
-102 'SHA224withDSA' : 'cryptojs/jsrsa' ,
-103 'SHA256withDSA' : 'cryptojs/jsrsa' ,
-104
-105 'MD5withRSAandMGF1' : 'cryptojs/jsrsa' ,
-106 'SHA1withRSAandMGF1' : 'cryptojs/jsrsa' ,
-107 'SHA224withRSAandMGF1' : 'cryptojs/jsrsa' ,
-108 'SHA256withRSAandMGF1' : 'cryptojs/jsrsa' ,
-109 'SHA384withRSAandMGF1' : 'cryptojs/jsrsa' ,
-110 'SHA512withRSAandMGF1' : 'cryptojs/jsrsa' ,
-111 'RIPEMD160withRSAandMGF1' : 'cryptojs/jsrsa' ,
-112 } ;
-113
-114 /*
-115 * @since crypto 1.1.2
-116 */
-117 this.CRYPTOJSMESSAGEDIGESTNAME = {
-118 'md5' : CryptoJS.algo.MD5 ,
-119 'sha1' : CryptoJS.algo.SHA1 ,
-120 'sha224' : CryptoJS.algo.SHA224 ,
-121 'sha256' : CryptoJS.algo.SHA256 ,
-122 'sha384' : CryptoJS.algo.SHA384 ,
-123 'sha512' : CryptoJS.algo.SHA512 ,
-124 'ripemd160' : CryptoJS.algo.RIPEMD160
-125 } ;
-126
-127 /**
-128 * get hexadecimal DigestInfo
-129 * @name getDigestInfoHex
-130 * @memberOf KJUR.crypto.Util
-131 * @function
-132 * @param {String} hHash hexadecimal hash value
-133 * @param {String} alg hash algorithm name (ex. 'sha1')
-134 * @return {String} hexadecimal string DigestInfo ASN.1 structure
-135 */
-136 this.getDigestInfoHex = function ( hHash , alg ) {
-137 if ( typeof this.DIGESTINFOHEAD [ alg ] == "undefined" )
-138 throw "alg not supported in Util.DIGESTINFOHEAD: " + alg ;
-139 return this.DIGESTINFOHEAD [ alg ] + hHash ;
-140 } ;
-141
-142 /**
-143 * get PKCS#1 padded hexadecimal DigestInfo
-144 * @name getPaddedDigestInfoHex
-145 * @memberOf KJUR.crypto.Util
-146 * @function
-147 * @param {String} hHash hexadecimal hash value of message to be signed
-148 * @param {String} alg hash algorithm name (ex. 'sha1')
-149 * @param {Integer} keySize key bit length (ex. 1024)
-150 * @return {String} hexadecimal string of PKCS#1 padded DigestInfo
-151 */
-152 this.getPaddedDigestInfoHex = function ( hHash , alg , keySize ) {
-153 var hDigestInfo = this.getDigestInfoHex ( hHash , alg ) ;
-154 var pmStrLen = keySize / 4 ; // minimum PM length
-155
-156 if ( hDigestInfo.length + 22 > pmStrLen ) // len(0001+ff(*8)+00+hDigestInfo)=22
-157 throw "key is too short for SigAlg: keylen=" + keySize + "," + alg ;
-158
-159 var hHead = "0001" ;
-160 var hTail = "00" + hDigestInfo ;
-161 var hMid = "" ;
-162 var fLen = pmStrLen - hHead.length - hTail.length ;
-163 for ( var i = 0 ; i < fLen ; i + = 2 ) {
-164 hMid + = "ff" ;
-165 }
-166 var hPaddedMessage = hHead + hMid + hTail ;
-167 return hPaddedMessage ;
-168 } ;
-169
-170 /**
-171 * get hexadecimal hash of string with specified algorithm
-172 * @name hashString
-173 * @memberOf KJUR.crypto.Util
-174 * @function
-175 * @param {String} s input string to be hashed
-176 * @param {String} alg hash algorithm name
-177 * @return {String} hexadecimal string of hash value
-178 * @since 1.1.1
-179 */
-180 this.hashString = function ( s , alg ) {
-181 var md = new KJUR.crypto.MessageDigest ( { 'alg' : alg } ) ;
-182 return md.digestString ( s ) ;
-183 } ;
-184
-185 /**
-186 * get hexadecimal hash of hexadecimal string with specified algorithm
-187 * @name hashHex
-188 * @memberOf KJUR.crypto.Util
-189 * @function
-190 * @param {String} sHex input hexadecimal string to be hashed
-191 * @param {String} alg hash algorithm name
-192 * @return {String} hexadecimal string of hash value
-193 * @since 1.1.1
-194 */
-195 this.hashHex = function ( sHex , alg ) {
-196 var md = new KJUR.crypto.MessageDigest ( { 'alg' : alg } ) ;
-197 return md.digestHex ( sHex ) ;
-198 } ;
-199
-200 /**
-201 * get hexadecimal SHA1 hash of string
-202 * @name sha1
-203 * @memberOf KJUR.crypto.Util
-204 * @function
-205 * @param {String} s input string to be hashed
-206 * @return {String} hexadecimal string of hash value
-207 * @since 1.0.3
-208 */
-209 this.sha1 = function ( s ) {
-210 var md = new KJUR.crypto.MessageDigest ( { 'alg' : 'sha1' , 'prov' : 'cryptojs' } ) ;
-211 return md.digestString ( s ) ;
-212 } ;
-213
-214 /**
-215 * get hexadecimal SHA256 hash of string
-216 * @name sha256
-217 * @memberOf KJUR.crypto.Util
-218 * @function
-219 * @param {String} s input string to be hashed
-220 * @return {String} hexadecimal string of hash value
-221 * @since 1.0.3
-222 */
-223 this.sha256 = function ( s ) {
-224 var md = new KJUR.crypto.MessageDigest ( { 'alg' : 'sha256' , 'prov' : 'cryptojs' } ) ;
-225 return md.digestString ( s ) ;
-226 } ;
-227
-228 this.sha256Hex = function ( s ) {
-229 var md = new KJUR.crypto.MessageDigest ( { 'alg' : 'sha256' , 'prov' : 'cryptojs' } ) ;
-230 return md.digestHex ( s ) ;
-231 } ;
-232
-233 /**
-234 * get hexadecimal SHA512 hash of string
-235 * @name sha512
-236 * @memberOf KJUR.crypto.Util
-237 * @function
-238 * @param {String} s input string to be hashed
-239 * @return {String} hexadecimal string of hash value
-240 * @since 1.0.3
-241 */
-242 this.sha512 = function ( s ) {
-243 var md = new KJUR.crypto.MessageDigest ( { 'alg' : 'sha512' , 'prov' : 'cryptojs' } ) ;
-244 return md.digestString ( s ) ;
-245 } ;
-246
-247 this.sha512Hex = function ( s ) {
-248 var md = new KJUR.crypto.MessageDigest ( { 'alg' : 'sha512' , 'prov' : 'cryptojs' } ) ;
-249 return md.digestHex ( s ) ;
-250 } ;
-251
-252 /**
-253 * get hexadecimal MD5 hash of string
-254 * @name md5
-255 * @memberOf KJUR.crypto.Util
-256 * @function
-257 * @param {String} s input string to be hashed
-258 * @return {String} hexadecimal string of hash value
-259 * @since 1.0.3
-260 */
-261 this.md5 = function ( s ) {
-262 var md = new KJUR.crypto.MessageDigest ( { 'alg' : 'md5' , 'prov' : 'cryptojs' } ) ;
-263 return md.digestString ( s ) ;
-264 } ;
-265
-266 /**
-267 * get hexadecimal RIPEMD160 hash of string
-268 * @name ripemd160
-269 * @memberOf KJUR.crypto.Util
-270 * @function
-271 * @param {String} s input string to be hashed
-272 * @return {String} hexadecimal string of hash value
-273 * @since 1.0.3
-274 */
-275 this.ripemd160 = function ( s ) {
-276 var md = new KJUR.crypto.MessageDigest ( { 'alg' : 'ripemd160' , 'prov' : 'cryptojs' } ) ;
-277 return md.digestString ( s ) ;
-278 } ;
-279
-280 /*
-281 * @since 1.1.2
-282 */
-283 this.getCryptoJSMDByName = function ( s ) {
-284
-285 } ;
-286 } ;
-287
-288 /**
-289 * MessageDigest class which is very similar to java.security.MessageDigest class
-290 * @name KJUR.crypto.MessageDigest
-291 * @class MessageDigest class which is very similar to java.security.MessageDigest class
-292 * @param {Array} params parameters for constructor
-293 * @description
-294 * <br/>
-295 * Currently this supports following algorithm and providers combination:
-296 * <ul>
-297 * <li>md5 - cryptojs</li>
-298 * <li>sha1 - cryptojs</li>
-299 * <li>sha224 - cryptojs</li>
-300 * <li>sha256 - cryptojs</li>
-301 * <li>sha384 - cryptojs</li>
-302 * <li>sha512 - cryptojs</li>
-303 * <li>ripemd160 - cryptojs</li>
-304 * <li>sha256 - sjcl (NEW from crypto.js 1.0.4)</li>
-305 * </ul>
-306 * @example
-307 * // CryptoJS provider sample
-308 * var md = new KJUR.crypto.MessageDigest({alg: "sha1", prov: "cryptojs"});
-309 * md.updateString('aaa')
-310 * var mdHex = md.digest()
-311 *
-312 * // SJCL(Stanford JavaScript Crypto Library) provider sample
-313 * var md = new KJUR.crypto.MessageDigest({alg: "sha256", prov: "sjcl"}); // sjcl supports sha256 only
-314 * md.updateString('aaa')
-315 * var mdHex = md.digest()
-316 */
-317 KJUR.crypto.MessageDigest = function ( params ) {
-318 var md = null ;
-319 var algName = null ;
-320 var provName = null ;
-321
-322 /**
-323 * set hash algorithm and provider
-324 * @name setAlgAndProvider
-325 * @memberOf KJUR.crypto.MessageDigest
-326 * @function
-327 * @param {String} alg hash algorithm name
-328 * @param {String} prov provider name
-329 * @description
-330 * @example
-331 * // for SHA1
-332 * md.setAlgAndProvider('sha1', 'cryptojs');
-333 * // for RIPEMD160
-334 * md.setAlgAndProvider('ripemd160', 'cryptojs');
-335 */
-336 this.setAlgAndProvider = function ( alg , prov ) {
-337 if ( alg != null && prov === undefined ) prov = KJUR.crypto.Util.DEFAULTPROVIDER [ alg ] ;
-338
-339 // for cryptojs
-340 if ( ':md5:sha1:sha224:sha256:sha384:sha512:ripemd160:' . indexOf ( alg ) != - 1 &&
-341 prov == 'cryptojs' ) {
-342 try {
-343 this.md = KJUR.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME [ alg ] . create ( ) ;
-344 } catch ( ex ) {
-345 throw "setAlgAndProvider hash alg set fail alg=" + alg + "/" + ex ;
-346 }
-347 this.updateString = function ( str ) {
-348 this.md.update ( str ) ;
-349 } ;
-350 this.updateHex = function ( hex ) {
-351 var wHex = CryptoJS.enc.Hex.parse ( hex ) ;
-352 this.md.update ( wHex ) ;
-353 } ;
-354 this.digest = function ( ) {
-355 var hash = this.md.finalize ( ) ;
-356 return hash.toString ( CryptoJS.enc.Hex ) ;
-357 } ;
-358 this.digestString = function ( str ) {
-359 this.updateString ( str ) ;
-360 return this.digest ( ) ;
-361 } ;
-362 this.digestHex = function ( hex ) {
-363 this.updateHex ( hex ) ;
-364 return this.digest ( ) ;
-365 } ;
-366 }
-367 if ( ':sha256:' . indexOf ( alg ) != - 1 &&
-368 prov == 'sjcl' ) {
-369 try {
-370 this.md = new sjcl.hash.sha256 ( ) ;
-371 } catch ( ex ) {
-372 throw "setAlgAndProvider hash alg set fail alg=" + alg + "/" + ex ;
-373 }
-374 this.updateString = function ( str ) {
-375 this.md.update ( str ) ;
-376 } ;
-377 this.updateHex = function ( hex ) {
-378 var baHex = sjcl.codec.hex.toBits ( hex ) ;
-379 this.md.update ( baHex ) ;
-380 } ;
-381 this.digest = function ( ) {
-382 var hash = this.md.finalize ( ) ;
-383 return sjcl.codec.hex.fromBits ( hash ) ;
-384 } ;
-385 this.digestString = function ( str ) {
-386 this.updateString ( str ) ;
-387 return this.digest ( ) ;
-388 } ;
-389 this.digestHex = function ( hex ) {
-390 this.updateHex ( hex ) ;
-391 return this.digest ( ) ;
-392 } ;
-393 }
-394 } ;
-395
-396 /**
-397 * update digest by specified string
-398 * @name updateString
-399 * @memberOf KJUR.crypto.MessageDigest
-400 * @function
-401 * @param {String} str string to update
-402 * @description
-403 * @example
-404 * md.updateString('New York');
-405 */
-406 this.updateString = function ( str ) {
-407 throw "updateString(str) not supported for this alg/prov: " + this.algName + "/" + this.provName ;
-408 } ;
-409
-410 /**
-411 * update digest by specified hexadecimal string
-412 * @name updateHex
-413 * @memberOf KJUR.crypto.MessageDigest
-414 * @function
-415 * @param {String} hex hexadecimal string to update
-416 * @description
-417 * @example
-418 * md.updateHex('0afe36');
-419 */
-420 this.updateHex = function ( hex ) {
-421 throw "updateHex(hex) not supported for this alg/prov: " + this.algName + "/" + this.provName ;
-422 } ;
-423
-424 /**
-425 * completes hash calculation and returns hash result
-426 * @name digest
-427 * @memberOf KJUR.crypto.MessageDigest
-428 * @function
-429 * @description
-430 * @example
-431 * md.digest()
-432 */
-433 this.digest = function ( ) {
-434 throw "digest() not supported for this alg/prov: " + this.algName + "/" + this.provName ;
-435 } ;
-436
-437 /**
-438 * performs final update on the digest using string, then completes the digest computation
-439 * @name digestString
-440 * @memberOf KJUR.crypto.MessageDigest
-441 * @function
-442 * @param {String} str string to final update
-443 * @description
-444 * @example
-445 * md.digestString('aaa')
-446 */
-447 this.digestString = function ( str ) {
-448 throw "digestString(str) not supported for this alg/prov: " + this.algName + "/" + this.provName ;
-449 } ;
-450
-451 /**
-452 * performs final update on the digest using hexadecimal string, then completes the digest computation
-453 * @name digestHex
-454 * @memberOf KJUR.crypto.MessageDigest
-455 * @function
-456 * @param {String} hex hexadecimal string to final update
-457 * @description
-458 * @example
-459 * md.digestHex('0f2abd')
-460 */
-461 this.digestHex = function ( hex ) {
-462 throw "digestHex(hex) not supported for this alg/prov: " + this.algName + "/" + this.provName ;
-463 } ;
-464
-465 if ( params !== undefined ) {
-466 if ( params [ 'alg' ] !== undefined ) {
-467 this.algName = params [ 'alg' ] ;
-468 if ( params [ 'prov' ] === undefined )
-469 this.provName = KJUR.crypto.Util.DEFAULTPROVIDER [ this.algName ] ;
-470 this.setAlgAndProvider ( this.algName , this.provName ) ;
-471 }
-472 }
-473 } ;
-474
-475 /**
-476 * Mac(Message Authentication Code) class which is very similar to java.security.Mac class
-477 * @name KJUR.crypto.Mac
-478 * @class Mac class which is very similar to java.security.Mac class
-479 * @param {Array} params parameters for constructor
-480 * @description
-481 * <br/>
-482 * Currently this supports following algorithm and providers combination:
-483 * <ul>
-484 * <li>hmacmd5 - cryptojs</li>
-485 * <li>hmacsha1 - cryptojs</li>
-486 * <li>hmacsha224 - cryptojs</li>
-487 * <li>hmacsha256 - cryptojs</li>
-488 * <li>hmacsha384 - cryptojs</li>
-489 * <li>hmacsha512 - cryptojs</li>
-490 * </ul>
-491 * NOTE: HmacSHA224 and HmacSHA384 issue was fixed since jsrsasign 4.1.4.
-492 * Please use 'ext/cryptojs-312-core-fix*.js' instead of 'core.js' of original CryptoJS
-493 * to avoid those issue.
-494 * <br/>
-495 * NOTE2: Hmac signature bug was fixed in jsrsasign 4.9.0 by providing CryptoJS
-496 * bug workaround.
-497 * <br/>
-498 * Please see {@link KJUR.crypto.Mac.setPassword}, how to provide password
-499 * in various ways in detail.
-500 * @example
-501 * var mac = new KJUR.crypto.Mac({alg: "HmacSHA1", "pass": "pass"});
-502 * mac.updateString('aaa')
-503 * var macHex = md.doFinal()
-504 *
-505 * // other password representation
-506 * var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": {"hex": "6161"}});
-507 * var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": {"utf8": "aa"}});
-508 * var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": {"rstr": "\x61\x61"}});
-509 * var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": {"b64": "Mi02/+...a=="}});
-510 * var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": {"b64u": "Mi02_-...a"}});
-511 */
-512 KJUR.crypto.Mac = function ( params ) {
-513 var mac = null ;
-514 var pass = null ;
-515 var algName = null ;
-516 var provName = null ;
-517 var algProv = null ;
-518
-519 this.setAlgAndProvider = function ( alg , prov ) {
-520 alg = alg.toLowerCase ( ) ;
-521
-522 if ( alg == null ) alg = "hmacsha1" ;
-523
-524 alg = alg.toLowerCase ( ) ;
-525 if ( alg.substr ( 0 , 4 ) != "hmac" ) {
-526 throw "setAlgAndProvider unsupported HMAC alg: " + alg ;
-527 }
-528
-529 if ( prov === undefined ) prov = KJUR.crypto.Util.DEFAULTPROVIDER [ alg ] ;
-530 this.algProv = alg + "/" + prov ;
-531
-532 var hashAlg = alg.substr ( 4 ) ;
-533
-534 // for cryptojs
-535 if ( ':md5:sha1:sha224:sha256:sha384:sha512:ripemd160:' . indexOf ( hashAlg ) != - 1 &&
-536 prov == 'cryptojs' ) {
-537 try {
-538 var mdObj = KJUR.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME [ hashAlg ] ;
-539 this.mac = CryptoJS.algo.HMAC.create ( mdObj , this.pass ) ;
-540 } catch ( ex ) {
-541 throw "setAlgAndProvider hash alg set fail hashAlg=" + hashAlg + "/" + ex ;
-542 }
-543 this.updateString = function ( str ) {
-544 this.mac.update ( str ) ;
-545 } ;
-546 this.updateHex = function ( hex ) {
-547 var wHex = CryptoJS.enc.Hex.parse ( hex ) ;
-548 this.mac.update ( wHex ) ;
-549 } ;
-550 this.doFinal = function ( ) {
-551 var hash = this.mac.finalize ( ) ;
-552 return hash.toString ( CryptoJS.enc.Hex ) ;
-553 } ;
-554 this.doFinalString = function ( str ) {
-555 this.updateString ( str ) ;
-556 return this.doFinal ( ) ;
-557 } ;
-558 this.doFinalHex = function ( hex ) {
-559 this.updateHex ( hex ) ;
-560 return this.doFinal ( ) ;
-561 } ;
-562 }
-563 } ;
-564
-565 /**
-566 * update digest by specified string
-567 * @name updateString
-568 * @memberOf KJUR.crypto.Mac
-569 * @function
-570 * @param {String} str string to update
-571 * @description
-572 * @example
-573 * md.updateString('New York');
-574 */
-575 this.updateString = function ( str ) {
-576 throw "updateString(str) not supported for this alg/prov: " + this.algProv ;
-577 } ;
-578
-579 /**
-580 * update digest by specified hexadecimal string
-581 * @name updateHex
-582 * @memberOf KJUR.crypto.Mac
-583 * @function
-584 * @param {String} hex hexadecimal string to update
-585 * @description
-586 * @example
-587 * md.updateHex('0afe36');
-588 */
-589 this.updateHex = function ( hex ) {
-590 throw "updateHex(hex) not supported for this alg/prov: " + this.algProv ;
-591 } ;
-592
-593 /**
-594 * completes hash calculation and returns hash result
-595 * @name doFinal
-596 * @memberOf KJUR.crypto.Mac
-597 * @function
-598 * @description
-599 * @example
-600 * md.digest()
-601 */
-602 this.doFinal = function ( ) {
-603 throw "digest() not supported for this alg/prov: " + this.algProv ;
-604 } ;
-605
-606 /**
-607 * performs final update on the digest using string, then completes the digest computation
-608 * @name doFinalString
-609 * @memberOf KJUR.crypto.Mac
-610 * @function
-611 * @param {String} str string to final update
-612 * @description
-613 * @example
-614 * md.digestString('aaa')
-615 */
-616 this.doFinalString = function ( str ) {
-617 throw "digestString(str) not supported for this alg/prov: " + this.algProv ;
-618 } ;
-619
-620 /**
-621 * performs final update on the digest using hexadecimal string,
-622 * then completes the digest computation
-623 * @name doFinalHex
-624 * @memberOf KJUR.crypto.Mac
-625 * @function
-626 * @param {String} hex hexadecimal string to final update
-627 * @description
-628 * @example
-629 * md.digestHex('0f2abd')
-630 */
-631 this.doFinalHex = function ( hex ) {
-632 throw "digestHex(hex) not supported for this alg/prov: " + this.algProv ;
-633 } ;
-634
-635 /**
-636 * set password for Mac
-637 * @name setPassword
-638 * @memberOf KJUR.crypto.Mac
-639 * @function
-640 * @param {Object} pass password for Mac
-641 * @since crypto 1.1.7 jsrsasign 4.9.0
-642 * @description
-643 * This method will set password for (H)Mac internally.
-644 * Argument 'pass' can be specified as following:
-645 * <ul>
-646 * <li>even length string of 0..9, a..f or A-F: implicitly specified as hexadecimal string</li>
-647 * <li>not above string: implicitly specified as raw string</li>
-648 * <li>{rstr: "\x65\x70"}: explicitly specified as raw string</li>
-649 * <li>{hex: "6570"}: explicitly specified as hexacedimal string</li>
-650 * <li>{utf8: "秘密"}: explicitly specified as UTF8 string</li>
-651 * <li>{b64: "Mi78..=="}: explicitly specified as Base64 string</li>
-652 * <li>{b64u: "Mi7-_"}: explicitly specified as Base64URL string</li>
-653 * </ul>
-654 * It is *STRONGLY RECOMMENDED* that explicit representation of password argument
-655 * to avoid ambiguity. For example string "6161" can mean a string "6161" or
-656 * a hexadecimal string of "aa" (i.e. \x61\x61).
-657 * @example
-658 * mac = KJUR.crypto.Mac({'alg': 'hmacsha256'});
-659 * // set password by implicit raw string
-660 * mac.setPassword("\x65\x70\xb9\x0b");
-661 * mac.setPassword("password");
-662 * // set password by implicit hexadecimal string
-663 * mac.setPassword("6570b90b");
-664 * mac.setPassword("6570B90B");
-665 * // set password by explicit raw string
-666 * mac.setPassword({"rstr": "\x65\x70\xb9\x0b"});
-667 * // set password by explicit hexadecimal string
-668 * mac.setPassword({"hex": "6570b90b"});
-669 * // set password by explicit utf8 string
-670 * mac.setPassword({"utf8": "passwordパスワード");
-671 * // set password by explicit Base64 string
-672 * mac.setPassword({"b64": "Mb+c3f/=="});
-673 * // set password by explicit Base64URL string
-674 * mac.setPassword({"b64u": "Mb-c3f_"});
-675 */
-676 this.setPassword = function ( pass ) {
-677 // internal this.pass shall be CryptoJS DWord Object for CryptoJS bug
-678 // work around. CrytoJS HMac password can be passed by
-679 // raw string as described in the manual however it doesn't
-680 // work properly in some case. If password was passed
-681 // by CryptoJS DWord which is not described in the manual
-682 // it seems to work. (fixed since crypto 1.1.7)
-683
-684 if ( typeof pass == 'string' ) {
-685 var hPass = pass ;
-686 if ( pass.length % 2 == 1 || ! pass.match ( /^[0-9A-Fa-f]+$/ ) ) { // raw str
-687 hPass = rstrtohex ( pass ) ;
-688 }
-689 this.pass = CryptoJS.enc.Hex.parse ( hPass ) ;
-690 return ;
-691 }
-692
-693 if ( typeof pass != 'object' )
-694 throw "KJUR.crypto.Mac unsupported password type: " + pass ;
-695
-696 var hPass = null ;
-697 if ( pass.hex !== undefined ) {
-698 if ( pass.hex.length % 2 != 0 || ! pass.hex.match ( /^[0-9A-Fa-f]+$/ ) )
-699 throw "Mac: wrong hex password: " + pass.hex ;
-700 hPass = pass.hex ;
-701 }
-702 if ( pass.utf8 !== undefined ) hPass = utf8tohex ( pass.utf8 ) ;
-703 if ( pass.rstr !== undefined ) hPass = rstrtohex ( pass.rstr ) ;
-704 if ( pass.b64 !== undefined ) hPass = b64tohex ( pass.b64 ) ;
-705 if ( pass.b64u !== undefined ) hPass = b64utohex ( pass.b64u ) ;
-706
-707 if ( hPass == null )
-708 throw "KJUR.crypto.Mac unsupported password type: " + pass ;
-709
-710 this.pass = CryptoJS.enc.Hex.parse ( hPass ) ;
-711 } ;
-712
-713 if ( params !== undefined ) {
-714 if ( params.pass !== undefined ) {
-715 this.setPassword ( params.pass ) ;
-716 }
-717 if ( params.alg !== undefined ) {
-718 this.algName = params.alg ;
-719 if ( params [ 'prov' ] === undefined )
-720 this.provName = KJUR.crypto.Util.DEFAULTPROVIDER [ this.algName ] ;
-721 this.setAlgAndProvider ( this.algName , this.provName ) ;
-722 }
-723 }
-724 } ;
-725
-726 /**
-727 * Signature class which is very similar to java.security.Signature class
-728 * @name KJUR.crypto.Signature
-729 * @class Signature class which is very similar to java.security.Signature class
-730 * @param {Array} params parameters for constructor
-731 * @property {String} state Current state of this signature object whether 'SIGN', 'VERIFY' or null
-732 * @description
-733 * <br/>
-734 * As for params of constructor's argument, it can be specify following attributes:
-735 * <ul>
-736 * <li>alg - signature algorithm name (ex. {MD5,SHA1,SHA224,SHA256,SHA384,SHA512,RIPEMD160}with{RSA,ECDSA,DSA})</li>
-737 * <li>provider - currently 'cryptojs/jsrsa' only</li>
-738 * </ul>
-739 * <h4>SUPPORTED ALGORITHMS AND PROVIDERS</h4>
-740 * This Signature class supports following signature algorithm and provider names:
-741 * <ul>
-742 * <li>MD5withRSA - cryptojs/jsrsa</li>
-743 * <li>SHA1withRSA - cryptojs/jsrsa</li>
-744 * <li>SHA224withRSA - cryptojs/jsrsa</li>
-745 * <li>SHA256withRSA - cryptojs/jsrsa</li>
-746 * <li>SHA384withRSA - cryptojs/jsrsa</li>
-747 * <li>SHA512withRSA - cryptojs/jsrsa</li>
-748 * <li>RIPEMD160withRSA - cryptojs/jsrsa</li>
-749 * <li>MD5withECDSA - cryptojs/jsrsa</li>
-750 * <li>SHA1withECDSA - cryptojs/jsrsa</li>
-751 * <li>SHA224withECDSA - cryptojs/jsrsa</li>
-752 * <li>SHA256withECDSA - cryptojs/jsrsa</li>
-753 * <li>SHA384withECDSA - cryptojs/jsrsa</li>
-754 * <li>SHA512withECDSA - cryptojs/jsrsa</li>
-755 * <li>RIPEMD160withECDSA - cryptojs/jsrsa</li>
-756 * <li>MD5withRSAandMGF1 - cryptojs/jsrsa</li>
-757 * <li>SHA1withRSAandMGF1 - cryptojs/jsrsa</li>
-758 * <li>SHA224withRSAandMGF1 - cryptojs/jsrsa</li>
-759 * <li>SHA256withRSAandMGF1 - cryptojs/jsrsa</li>
-760 * <li>SHA384withRSAandMGF1 - cryptojs/jsrsa</li>
-761 * <li>SHA512withRSAandMGF1 - cryptojs/jsrsa</li>
-762 * <li>RIPEMD160withRSAandMGF1 - cryptojs/jsrsa</li>
-763 * <li>SHA1withDSA - cryptojs/jsrsa</li>
-764 * <li>SHA224withDSA - cryptojs/jsrsa</li>
-765 * <li>SHA256withDSA - cryptojs/jsrsa</li>
-766 * </ul>
-767 * Here are supported elliptic cryptographic curve names and their aliases for ECDSA:
-768 * <ul>
-769 * <li>secp256k1</li>
-770 * <li>secp256r1, NIST P-256, P-256, prime256v1</li>
-771 * <li>secp384r1, NIST P-384, P-384</li>
-772 * </ul>
-773 * NOTE1: DSA signing algorithm is also supported since crypto 1.1.5.
-774 * <h4>EXAMPLES</h4>
-775 * @example
-776 * // RSA signature generation
-777 * var sig = new KJUR.crypto.Signature({"alg": "SHA1withRSA"});
-778 * sig.init(prvKeyPEM);
-779 * sig.updateString('aaa');
-780 * var hSigVal = sig.sign();
-781 *
-782 * // DSA signature validation
-783 * var sig2 = new KJUR.crypto.Signature({"alg": "SHA1withDSA"});
-784 * sig2.init(certPEM);
-785 * sig.updateString('aaa');
-786 * var isValid = sig2.verify(hSigVal);
-787 *
-788 * // ECDSA signing
-789 * var sig = new KJUR.crypto.Signature({'alg':'SHA1withECDSA'});
-790 * sig.init(prvKeyPEM);
-791 * sig.updateString('aaa');
-792 * var sigValueHex = sig.sign();
-793 *
-794 * // ECDSA verifying
-795 * var sig2 = new KJUR.crypto.Signature({'alg':'SHA1withECDSA'});
-796 * sig.init(certPEM);
-797 * sig.updateString('aaa');
-798 * var isValid = sig.verify(sigValueHex);
-799 */
-800 KJUR.crypto.Signature = function ( params ) {
-801 var prvKey = null ; // RSAKey/KJUR.crypto.{ECDSA,DSA} object for signing
-802 var pubKey = null ; // RSAKey/KJUR.crypto.{ECDSA,DSA} object for verifying
-803
-804 var md = null ; // KJUR.crypto.MessageDigest object
-805 var sig = null ;
-806 var algName = null ;
-807 var provName = null ;
-808 var algProvName = null ;
-809 var mdAlgName = null ;
-810 var pubkeyAlgName = null ; // rsa,ecdsa,rsaandmgf1(=rsapss)
-811 var state = null ;
-812 var pssSaltLen = - 1 ;
-813 var initParams = null ;
-814
-815 var sHashHex = null ; // hex hash value for hex
-816 var hDigestInfo = null ;
-817 var hPaddedDigestInfo = null ;
-818 var hSign = null ;
-819
-820 this._setAlgNames = function ( ) {
-821 if ( this.algName.match ( /^(.+)with(.+)$/ ) ) {
-822 this.mdAlgName = RegExp.$1.toLowerCase ( ) ;
-823 this.pubkeyAlgName = RegExp.$2.toLowerCase ( ) ;
-824 }
-825 } ;
-826
-827 this._zeroPaddingOfSignature = function ( hex , bitLength ) {
-828 var s = "" ;
-829 var nZero = bitLength / 4 - hex.length ;
-830 for ( var i = 0 ; i < nZero ; i ++ ) {
-831 s = s + "0" ;
-832 }
-833 return s + hex ;
-834 } ;
-835
-836 /**
-837 * set signature algorithm and provider
-838 * @name setAlgAndProvider
-839 * @memberOf KJUR.crypto.Signature
-840 * @function
-841 * @param {String} alg signature algorithm name
-842 * @param {String} prov provider name
-843 * @description
-844 * @example
-845 * md.setAlgAndProvider('SHA1withRSA', 'cryptojs/jsrsa');
-846 */
-847 this.setAlgAndProvider = function ( alg , prov ) {
-848 this._setAlgNames ( ) ;
-849 if ( prov != 'cryptojs/jsrsa' )
-850 throw "provider not supported: " + prov ;
-851
-852 if ( ':md5:sha1:sha224:sha256:sha384:sha512:ripemd160:' . indexOf ( this.mdAlgName ) != - 1 ) {
-853 try {
-854 this.md = new KJUR.crypto.MessageDigest ( { 'alg' : this.mdAlgName } ) ;
-855 } catch ( ex ) {
-856 throw "setAlgAndProvider hash alg set fail alg=" +
-857 this.mdAlgName + "/" + ex ;
-858 }
-859
-860 this.init = function ( keyparam , pass ) {
-861 var keyObj = null ;
-862 try {
-863 if ( pass === undefined ) {
-864 keyObj = KEYUTIL.getKey ( keyparam ) ;
-865 } else {
-866 keyObj = KEYUTIL.getKey ( keyparam , pass ) ;
-867 }
-868 } catch ( ex ) {
-869 throw "init failed:" + ex ;
-870 }
-871
-872 if ( keyObj.isPrivate === true ) {
-873 this.prvKey = keyObj ;
-874 this.state = "SIGN" ;
-875 } else if ( keyObj.isPublic === true ) {
-876 this.pubKey = keyObj ;
-877 this.state = "VERIFY" ;
-878 } else {
-879 throw "init failed.:" + keyObj ;
-880 }
-881 } ;
-882
-883 this.initSign = function ( params ) {
-884 if ( typeof params [ 'ecprvhex' ] == 'string' &&
-885 typeof params [ 'eccurvename' ] == 'string' ) {
-886 this.ecprvhex = params [ 'ecprvhex' ] ;
-887 this.eccurvename = params [ 'eccurvename' ] ;
-888 } else {
-889 this.prvKey = params ;
-890 }
-891 this.state = "SIGN" ;
-892 } ;
-893
-894 this.initVerifyByPublicKey = function ( params ) {
-895 if ( typeof params [ 'ecpubhex' ] == 'string' &&
-896 typeof params [ 'eccurvename' ] == 'string' ) {
-897 this.ecpubhex = params [ 'ecpubhex' ] ;
-898 this.eccurvename = params [ 'eccurvename' ] ;
-899 } else if ( params instanceof KJUR.crypto.ECDSA ) {
-900 this.pubKey = params ;
-901 } else if ( params instanceof RSAKey ) {
-902 this.pubKey = params ;
-903 }
-904 this.state = "VERIFY" ;
-905 } ;
-906
-907 this.initVerifyByCertificatePEM = function ( certPEM ) {
-908 var x509 = new X509 ( ) ;
-909 x509.readCertPEM ( certPEM ) ;
-910 this.pubKey = x509.subjectPublicKeyRSA ;
-911 this.state = "VERIFY" ;
-912 } ;
-913
-914 this.updateString = function ( str ) {
-915 this.md.updateString ( str ) ;
-916 } ;
-917
-918 this.updateHex = function ( hex ) {
-919 this.md.updateHex ( hex ) ;
-920 } ;
-921
-922 this.sign = function ( ) {
-923 this.sHashHex = this.md.digest ( ) ;
-924 if ( typeof this.ecprvhex != "undefined" &&
-925 typeof this.eccurvename != "undefined" ) {
-926 var ec = new KJUR.crypto.ECDSA ( { 'curve' : this.eccurvename } ) ;
-927 this.hSign = ec.signHex ( this.sHashHex , this.ecprvhex ) ;
-928 } else if ( this.prvKey instanceof RSAKey &&
-929 this.pubkeyAlgName == "rsaandmgf1" ) {
-930 this.hSign = this.prvKey.signWithMessageHashPSS ( this.sHashHex ,
-931 this.mdAlgName ,
-932 this.pssSaltLen ) ;
-933 } else if ( this.prvKey instanceof RSAKey &&
-934 this.pubkeyAlgName == "rsa" ) {
-935 this.hSign = this.prvKey.signWithMessageHash ( this.sHashHex ,
-936 this.mdAlgName ) ;
-937 } else if ( this.prvKey instanceof KJUR.crypto.ECDSA ) {
-938 this.hSign = this.prvKey.signWithMessageHash ( this.sHashHex ) ;
-939 } else if ( this.prvKey instanceof KJUR.crypto.DSA ) {
-940 this.hSign = this.prvKey.signWithMessageHash ( this.sHashHex ) ;
-941 } else {
-942 throw "Signature: unsupported public key alg: " + this.pubkeyAlgName ;
-943 }
-944 return this.hSign ;
-945 } ;
-946 this.signString = function ( str ) {
-947 this.updateString ( str ) ;
-948 return this.sign ( ) ;
-949 } ;
-950 this.signHex = function ( hex ) {
-951 this.updateHex ( hex ) ;
-952 return this.sign ( ) ;
-953 } ;
-954 this.verify = function ( hSigVal ) {
-955 this.sHashHex = this.md.digest ( ) ;
-956 if ( typeof this.ecpubhex != "undefined" &&
-957 typeof this.eccurvename != "undefined" ) {
-958 var ec = new KJUR.crypto.ECDSA ( { curve : this.eccurvename } ) ;
-959 return ec.verifyHex ( this.sHashHex , hSigVal , this.ecpubhex ) ;
-960 } else if ( this.pubKey instanceof RSAKey &&
-961 this.pubkeyAlgName == "rsaandmgf1" ) {
-962 return this.pubKey.verifyWithMessageHashPSS ( this.sHashHex , hSigVal ,
-963 this.mdAlgName ,
-964 this.pssSaltLen ) ;
-965 } else if ( this.pubKey instanceof RSAKey &&
-966 this.pubkeyAlgName == "rsa" ) {
-967 return this.pubKey.verifyWithMessageHash ( this.sHashHex , hSigVal ) ;
-968 } else if ( this.pubKey instanceof KJUR.crypto.ECDSA ) {
-969 return this.pubKey.verifyWithMessageHash ( this.sHashHex , hSigVal ) ;
-970 } else if ( this.pubKey instanceof KJUR.crypto.DSA ) {
-971 return this.pubKey.verifyWithMessageHash ( this.sHashHex , hSigVal ) ;
-972 } else {
-973 throw "Signature: unsupported public key alg: " + this.pubkeyAlgName ;
-974 }
-975 } ;
-976 }
-977 } ;
-978
-979 /**
-980 * Initialize this object for signing or verifying depends on key
-981 * @name init
-982 * @memberOf KJUR.crypto.Signature
-983 * @function
-984 * @param {Object} key specifying public or private key as plain/encrypted PKCS#5/8 PEM file, certificate PEM or {@link RSAKey}, {@link KJUR.crypto.DSA} or {@link KJUR.crypto.ECDSA} object
-985 * @param {String} pass (OPTION) passcode for encrypted private key
-986 * @since crypto 1.1.3
-987 * @description
-988 * This method is very useful initialize method for Signature class since
-989 * you just specify key then this method will automatically initialize it
-990 * using {@link KEYUTIL.getKey} method.
-991 * As for 'key', following argument type are supported:
-992 * <h5>signing</h5>
-993 * <ul>
-994 * <li>PEM formatted PKCS#8 encrypted RSA/ECDSA private key concluding "BEGIN ENCRYPTED PRIVATE KEY"</li>
-995 * <li>PEM formatted PKCS#5 encrypted RSA/DSA private key concluding "BEGIN RSA/DSA PRIVATE KEY" and ",ENCRYPTED"</li>
-996 * <li>PEM formatted PKCS#8 plain RSA/ECDSA private key concluding "BEGIN PRIVATE KEY"</li>
-997 * <li>PEM formatted PKCS#5 plain RSA/DSA private key concluding "BEGIN RSA/DSA PRIVATE KEY" without ",ENCRYPTED"</li>
-998 * <li>RSAKey object of private key</li>
-999 * <li>KJUR.crypto.ECDSA object of private key</li>
-1000 * <li>KJUR.crypto.DSA object of private key</li>
-1001 * </ul>
-1002 * <h5>verification</h5>
-1003 * <ul>
-1004 * <li>PEM formatted PKCS#8 RSA/EC/DSA public key concluding "BEGIN PUBLIC KEY"</li>
-1005 * <li>PEM formatted X.509 certificate with RSA/EC/DSA public key concluding
-1006 * "BEGIN CERTIFICATE", "BEGIN X509 CERTIFICATE" or "BEGIN TRUSTED CERTIFICATE".</li>
-1007 * <li>RSAKey object of public key</li>
-1008 * <li>KJUR.crypto.ECDSA object of public key</li>
-1009 * <li>KJUR.crypto.DSA object of public key</li>
-1010 * </ul>
-1011 * @example
-1012 * sig.init(sCertPEM)
-1013 */
-1014 this.init = function ( key , pass ) {
-1015 throw "init(key, pass) not supported for this alg:prov=" +
-1016 this.algProvName ;
-1017 } ;
-1018
-1019 /**
-1020 * Initialize this object for verifying with a public key
-1021 * @name initVerifyByPublicKey
-1022 * @memberOf KJUR.crypto.Signature
-1023 * @function
-1024 * @param {Object} param RSAKey object of public key or associative array for ECDSA
-1025 * @since 1.0.2
-1026 * @deprecated from crypto 1.1.5. please use init() method instead.
-1027 * @description
-1028 * Public key information will be provided as 'param' parameter and the value will be
-1029 * following:
-1030 * <ul>
-1031 * <li>{@link RSAKey} object for RSA verification</li>
-1032 * <li>associative array for ECDSA verification
-1033 * (ex. <code>{'ecpubhex': '041f..', 'eccurvename': 'secp256r1'}</code>)
-1034 * </li>
-1035 * </ul>
-1036 * @example
-1037 * sig.initVerifyByPublicKey(rsaPrvKey)
-1038 */
-1039 this.initVerifyByPublicKey = function ( rsaPubKey ) {
-1040 throw "initVerifyByPublicKey(rsaPubKeyy) not supported for this alg:prov=" +
-1041 this.algProvName ;
-1042 } ;
-1043
-1044 /**
-1045 * Initialize this object for verifying with a certficate
-1046 * @name initVerifyByCertificatePEM
-1047 * @memberOf KJUR.crypto.Signature
-1048 * @function
-1049 * @param {String} certPEM PEM formatted string of certificate
-1050 * @since 1.0.2
-1051 * @deprecated from crypto 1.1.5. please use init() method instead.
-1052 * @description
-1053 * @example
-1054 * sig.initVerifyByCertificatePEM(certPEM)
-1055 */
-1056 this.initVerifyByCertificatePEM = function ( certPEM ) {
-1057 throw "initVerifyByCertificatePEM(certPEM) not supported for this alg:prov=" +
-1058 this.algProvName ;
-1059 } ;
-1060
-1061 /**
-1062 * Initialize this object for signing
-1063 * @name initSign
-1064 * @memberOf KJUR.crypto.Signature
-1065 * @function
-1066 * @param {Object} param RSAKey object of public key or associative array for ECDSA
-1067 * @deprecated from crypto 1.1.5. please use init() method instead.
-1068 * @description
-1069 * Private key information will be provided as 'param' parameter and the value will be
-1070 * following:
-1071 * <ul>
-1072 * <li>{@link RSAKey} object for RSA signing</li>
-1073 * <li>associative array for ECDSA signing
-1074 * (ex. <code>{'ecprvhex': '1d3f..', 'eccurvename': 'secp256r1'}</code>)</li>
-1075 * </ul>
-1076 * @example
-1077 * sig.initSign(prvKey)
-1078 */
-1079 this.initSign = function ( prvKey ) {
-1080 throw "initSign(prvKey) not supported for this alg:prov=" + this.algProvName ;
-1081 } ;
-1082
-1083 /**
-1084 * Updates the data to be signed or verified by a string
-1085 * @name updateString
-1086 * @memberOf KJUR.crypto.Signature
-1087 * @function
-1088 * @param {String} str string to use for the update
-1089 * @description
-1090 * @example
-1091 * sig.updateString('aaa')
-1092 */
-1093 this.updateString = function ( str ) {
-1094 throw "updateString(str) not supported for this alg:prov=" + this.algProvName ;
-1095 } ;
-1096
-1097 /**
-1098 * Updates the data to be signed or verified by a hexadecimal string
-1099 * @name updateHex
-1100 * @memberOf KJUR.crypto.Signature
-1101 * @function
-1102 * @param {String} hex hexadecimal string to use for the update
-1103 * @description
-1104 * @example
-1105 * sig.updateHex('1f2f3f')
-1106 */
-1107 this.updateHex = function ( hex ) {
-1108 throw "updateHex(hex) not supported for this alg:prov=" + this.algProvName ;
-1109 } ;
-1110
-1111 /**
-1112 * Returns the signature bytes of all data updates as a hexadecimal string
-1113 * @name sign
-1114 * @memberOf KJUR.crypto.Signature
-1115 * @function
-1116 * @return the signature bytes as a hexadecimal string
-1117 * @description
-1118 * @example
-1119 * var hSigValue = sig.sign()
-1120 */
-1121 this.sign = function ( ) {
-1122 throw "sign() not supported for this alg:prov=" + this.algProvName ;
-1123 } ;
-1124
-1125 /**
-1126 * performs final update on the sign using string, then returns the signature bytes of all data updates as a hexadecimal string
-1127 * @name signString
-1128 * @memberOf KJUR.crypto.Signature
-1129 * @function
-1130 * @param {String} str string to final update
-1131 * @return the signature bytes of a hexadecimal string
-1132 * @description
-1133 * @example
-1134 * var hSigValue = sig.signString('aaa')
-1135 */
-1136 this.signString = function ( str ) {
-1137 throw "digestString(str) not supported for this alg:prov=" + this.algProvName ;
-1138 } ;
-1139
-1140 /**
-1141 * performs final update on the sign using hexadecimal string, then returns the signature bytes of all data updates as a hexadecimal string
-1142 * @name signHex
-1143 * @memberOf KJUR.crypto.Signature
-1144 * @function
-1145 * @param {String} hex hexadecimal string to final update
-1146 * @return the signature bytes of a hexadecimal string
-1147 * @description
-1148 * @example
-1149 * var hSigValue = sig.signHex('1fdc33')
-1150 */
-1151 this.signHex = function ( hex ) {
-1152 throw "digestHex(hex) not supported for this alg:prov=" + this.algProvName ;
-1153 } ;
-1154
-1155 /**
-1156 * verifies the passed-in signature.
-1157 * @name verify
-1158 * @memberOf KJUR.crypto.Signature
-1159 * @function
-1160 * @param {String} str string to final update
-1161 * @return {Boolean} true if the signature was verified, otherwise false
-1162 * @description
-1163 * @example
-1164 * var isValid = sig.verify('1fbcefdca4823a7(snip)')
-1165 */
-1166 this.verify = function ( hSigVal ) {
-1167 throw "verify(hSigVal) not supported for this alg:prov=" + this.algProvName ;
-1168 } ;
-1169
-1170 this.initParams = params ;
-1171
-1172 if ( params !== undefined ) {
-1173 if ( params [ 'alg' ] !== undefined ) {
-1174 this.algName = params [ 'alg' ] ;
-1175 if ( params [ 'prov' ] === undefined ) {
-1176 this.provName = KJUR.crypto.Util.DEFAULTPROVIDER [ this.algName ] ;
-1177 } else {
-1178 this.provName = params [ 'prov' ] ;
-1179 }
-1180 this.algProvName = this.algName + ":" + this.provName ;
-1181 this.setAlgAndProvider ( this.algName , this.provName ) ;
-1182 this._setAlgNames ( ) ;
-1183 }
-1184
-1185 if ( params [ 'psssaltlen' ] !== undefined ) this.pssSaltLen = params [ 'psssaltlen' ] ;
-1186
-1187 if ( params [ 'prvkeypem' ] !== undefined ) {
-1188 if ( params [ 'prvkeypas' ] !== undefined ) {
-1189 throw "both prvkeypem and prvkeypas parameters not supported" ;
-1190 } else {
-1191 try {
-1192 var prvKey = new RSAKey ( ) ;
-1193 prvKey.readPrivateKeyFromPEMString ( params [ 'prvkeypem' ] ) ;
-1194 this.initSign ( prvKey ) ;
-1195 } catch ( ex ) {
-1196 throw "fatal error to load pem private key: " + ex ;
-1197 }
-1198 }
-1199 }
-1200 }
-1201 } ;
-1202
-1203 /**
-1204 * static object for cryptographic function utilities
-1205 * @name KJUR.crypto.OID
-1206 * @class static object for cryptography related OIDs
-1207 * @property {Array} oidhex2name key value of hexadecimal OID and its name
-1208 * (ex. '2a8648ce3d030107' and 'secp256r1')
-1209 * @since crypto 1.1.3
-1210 * @description
-1211 */
-1212
-1213
-1214 KJUR.crypto.OID = new function ( ) {
-1215 this.oidhex2name = {
-1216 '2a864886f70d010101' : 'rsaEncryption' ,
-1217 '2a8648ce3d0201' : 'ecPublicKey' ,
-1218 '2a8648ce380401' : 'dsa' ,
-1219 '2a8648ce3d030107' : 'secp256r1' ,
-1220 '2b8104001f' : 'secp192k1' ,
-1221 '2b81040021' : 'secp224r1' ,
-1222 '2b8104000a' : 'secp256k1' ,
-1223 '2b81040023' : 'secp521r1' ,
-1224 '2b81040022' : 'secp384r1' ,
-1225 '2a8648ce380403' : 'SHA1withDSA' , // 1.2.840.10040.4.3
-1226 '608648016503040301' : 'SHA224withDSA' , // 2.16.840.1.101.3.4.3.1
-1227 '608648016503040302' : 'SHA256withDSA' , // 2.16.840.1.101.3.4.3.2
-1228 } ;
-1229 } ;
-1230
\ No newline at end of file
diff --git a/jwt/api/symbols/src/dsa-modified-1.0.js.html b/jwt/api/symbols/src/dsa-modified-1.0.js.html
deleted file mode 100644
index 5221a9d..0000000
--- a/jwt/api/symbols/src/dsa-modified-1.0.js.html
+++ /dev/null
@@ -1,389 +0,0 @@
-
1 /*! dsa-modified-1.0.1.js (c) Recurity Labs GmbH, Kenji Urushimma | github.com/openpgpjs/openpgpjs/blob/master/LICENSE
- 2 */
- 3 /*
- 4 * dsa-modified.js - modified DSA class of OpenPGP-JS
- 5 *
- 6 * Copyright (c) 2011-2013 Recurity Labs GmbH (github.com/openpgpjs)
- 7 * Kenji Urushima (kenji.urushima@gmail.com)
- 8 * LICENSE
- 9 * https://github.com/openpgpjs/openpgpjs/blob/master/LICENSE
- 10 */
- 11
- 12 /**
- 13 * @fileOverview
- 14 * @name dsa-modified-1.0.js
- 15 * @author Recurity Labs GmbH (github.com/openpgpjs) and Kenji Urushima (kenji.urushima@gmail.com)
- 16 * @version 1.0.1 (2013-Oct-06)
- 17 * @since jsrsasign 4.1.6
- 18 * @license <a href="https://github.com/openpgpjs/openpgpjs/blob/master/LICENSE">LGPL License</a>
- 19 */
- 20
- 21 if ( typeof KJUR == "undefined" || ! KJUR ) KJUR = { } ;
- 22 if ( typeof KJUR.crypto == "undefined" || ! KJUR.crypto ) KJUR.crypto = { } ;
- 23
- 24 /**
- 25 * class for DSA signing and verification
- 26 * @name KJUR.crypto.DSA
- 27 * @class class for DSA signing and verifcation
- 28 * @description
- 29 * <p>
- 30 * CAUTION: Most of the case, you don't need to use this class.
- 31 * Please use {@link KJUR.crypto.Signature} class instead.
- 32 * </p>
- 33 * <p>
- 34 * This class was originally developped by Recurity Labs GmbH for OpenPGP JavaScript library.
- 35 * (See {@link https://github.com/openpgpjs/openpgpjs/blob/master/src/ciphers/asymmetric/dsa.js})
- 36 * </p>
- 37 */
- 38 /* https://github.com/openpgpjs/openpgpjs/blob/master/src/ciphers/asymmetric/dsa.js */
- 39 KJUR.crypto.DSA = function ( ) {
- 40 this.p = null ;
- 41 this.q = null ;
- 42 this.g = null ;
- 43 this.y = null ;
- 44 this.x = null ;
- 45 this.type = "DSA" ;
- 46
- 47 //===========================
- 48 // PUBLIC METHODS
- 49 //===========================
- 50
- 51 /**
- 52 * set DSA private key by key specs
- 53 * @name setPrivate
- 54 * @memberOf KJUR.crypto.DSA
- 55 * @function
- 56 * @param {BigInteger} p prime P
- 57 * @param {BigInteger} q sub prime Q
- 58 * @param {BigInteger} g base G
- 59 * @param {BigInteger} y public key Y
- 60 * @param {BigInteger} x private key X
- 61 * @since dsa-modified 1.0.0
- 62 */
- 63 this.setPrivate = function ( p , q , g , y , x ) {
- 64 this.isPrivate = true ;
- 65 this.p = p ;
- 66 this.q = q ;
- 67 this.g = g ;
- 68 this.y = y ;
- 69 this.x = x ;
- 70 } ;
- 71
- 72 /**
- 73 * set DSA public key by key specs
- 74 * @name setPublic
- 75 * @memberOf KJUR.crypto.DSA
- 76 * @function
- 77 * @param {BigInteger} p prime P
- 78 * @param {BigInteger} q sub prime Q
- 79 * @param {BigInteger} g base G
- 80 * @param {BigInteger} y public key Y
- 81 * @since dsa-modified 1.0.0
- 82 */
- 83 this.setPublic = function ( p , q , g , y ) {
- 84 this.isPublic = true ;
- 85 this.p = p ;
- 86 this.q = q ;
- 87 this.g = g ;
- 88 this.y = y ;
- 89 this.x = null ;
- 90 } ;
- 91
- 92 /**
- 93 * sign to hashed message by this DSA private key object
- 94 * @name signWithMessageHash
- 95 * @memberOf KJUR.crypto.DSA
- 96 * @function
- 97 * @param {String} sHashHex hexadecimal string of hashed message
- 98 * @return {String} hexadecimal string of ASN.1 encoded DSA signature value
- 99 * @since dsa-modified 1.0.0
-100 */
-101 this.signWithMessageHash = function ( sHashHex ) {
-102 var p = this.p ;
-103 var q = this.q ;
-104 var g = this.g ;
-105 var y = this.y ;
-106 var x = this.x ;
-107
-108 // 1. trim message hash
-109 var hashHex = sHashHex.substr ( 0 , q.bitLength ( ) / 4 ) ;
-110 var hash = new BigInteger ( sHashHex , 16 ) ;
-111
-112 var k = getRandomBigIntegerInRange ( BigInteger.ONE.add ( BigInteger.ONE ) ,
-113 q.subtract ( BigInteger.ONE ) ) ;
-114 var s1 = ( g.modPow ( k , p ) ) . mod ( q ) ;
-115 var s2 = ( k.modInverse ( q ) . multiply ( hash.add ( x.multiply ( s1 ) ) ) ) . mod ( q ) ;
-116
-117 var result = KJUR.asn1.ASN1Util.jsonToASN1HEX ( {
-118 'seq' : [ { 'int' : { 'bigint' : s1 } } , { 'int' : { 'bigint' : s2 } } ]
-119 } ) ;
-120 return result ;
-121 } ;
-122
-123 /**
-124 * verify signature by this DSA public key object
-125 * @name verifyWithMessageHash
-126 * @memberOf KJUR.crypto.DSA
-127 * @function
-128 * @param {String} sHashHex hexadecimal string of hashed message
-129 * @param {String} hSigVal hexadecimal string of ASN.1 encoded DSA signature value
-130 * @return {Boolean} true if the signature is valid otherwise false.
-131 * @since dsa-modified 1.0.0
-132 */
-133 this.verifyWithMessageHash = function ( sHashHex , hSigVal ) {
-134 var p = this.p ;
-135 var q = this.q ;
-136 var g = this.g ;
-137 var y = this.y ;
-138
-139 // 1. parse ASN.1 signature
-140 var s1s2 = this.parseASN1Signature ( hSigVal ) ;
-141 var s1 = s1s2 [ 0 ] ;
-142 var s2 = s1s2 [ 1 ] ;
-143
-144 // 2. trim message hash
-145 var sHashHex = sHashHex.substr ( 0 , q.bitLength ( ) / 4 ) ;
-146 var hash = new BigInteger ( sHashHex , 16 ) ;
-147
-148 if ( BigInteger.ZERO.compareTo ( s1 ) > 0 ||
-149 s1.compareTo ( q ) > 0 ||
-150 BigInteger.ZERO.compareTo ( s2 ) > 0 ||
-151 s2.compareTo ( q ) > 0 ) {
-152 throw "invalid DSA signature" ;
-153 }
-154 var w = s2.modInverse ( q ) ;
-155 var u1 = hash.multiply ( w ) . mod ( q ) ;
-156 var u2 = s1.multiply ( w ) . mod ( q ) ;
-157 var dopublic = g.modPow ( u1 , p ) . multiply ( y.modPow ( u2 , p ) ) . mod ( p ) . mod ( q ) ;
-158 return dopublic.compareTo ( s1 ) == 0 ;
-159 } ;
-160
-161 /**
-162 * parse hexadecimal ASN.1 DSA signature value
-163 * @name parseASN1Signature
-164 * @memberOf KJUR.crypto.DSA
-165 * @function
-166 * @param {String} hSigVal hexadecimal string of ASN.1 encoded DSA signature value
-167 * @return {Array} array [s1, s2] of DSA signature value. Both s1 and s2 are BigInteger.
-168 * @since dsa-modified 1.0.0
-169 */
-170 this.parseASN1Signature = function ( hSigVal ) {
-171 try {
-172 var s1 = new BigInteger ( ASN1HEX.getVbyList ( hSigVal , 0 , [ 0 ] , "02" ) , 16 ) ;
-173 var s2 = new BigInteger ( ASN1HEX.getVbyList ( hSigVal , 0 , [ 1 ] , "02" ) , 16 ) ;
-174 return [ s1 , s2 ] ;
-175 } catch ( ex ) {
-176 throw "malformed DSA signature" ;
-177 }
-178 }
-179
-180 // s1 = ((g**s) mod p) mod q
-181 // s1 = ((s**-1)*(sha-1(m)+(s1*x) mod q)
-182 function sign ( hashalgo , m , g , p , q , x ) {
-183 // If the output size of the chosen hash is larger than the number of
-184 // bits of q, the hash result is truncated to fit by taking the number
-185 // of leftmost bits equal to the number of bits of q. This (possibly
-186 // truncated) hash function result is treated as a number and used
-187 // directly in the DSA signature algorithm.
-188
-189 var hashHex = KJUR.crypto.Util.hashString ( m , hashalgo.toLowerCase ( ) ) ;
-190 var hashHex = hashHex.substr ( 0 , q.bitLength ( ) / 4 ) ;
-191 var hash = new BigInteger ( hashHex , 16 ) ;
-192
-193 var k = getRandomBigIntegerInRange ( BigInteger.ONE.add ( BigInteger.ONE ) ,
-194 q.subtract ( BigInteger.ONE ) ) ;
-195 var s1 = ( g.modPow ( k , p ) ) . mod ( q ) ;
-196 var s2 = ( k.modInverse ( q ) . multiply ( hash.add ( x.multiply ( s1 ) ) ) ) . mod ( q ) ;
-197 var result = new Array ( ) ;
-198 result [ 0 ] = s1 ;
-199 result [ 1 ] = s2 ;
-200 return result ;
-201 }
-202
-203 function select_hash_algorithm ( q ) {
-204 var usersetting = openpgp.config.config.prefer_hash_algorithm ;
-205 /*
-206 * 1024-bit key, 160-bit q, SHA-1, SHA-224, SHA-256, SHA-384, or SHA-512 hash
-207 * 2048-bit key, 224-bit q, SHA-224, SHA-256, SHA-384, or SHA-512 hash
-208 * 2048-bit key, 256-bit q, SHA-256, SHA-384, or SHA-512 hash
-209 * 3072-bit key, 256-bit q, SHA-256, SHA-384, or SHA-512 hash
-210 */
-211 switch ( Math.round ( q.bitLength ( ) / 8 ) ) {
-212 case 20 : // 1024 bit
-213 if ( usersetting != 2 &&
-214 usersetting > 11 &&
-215 usersetting != 10 &&
-216 usersetting < 8 )
-217 return 2 ; // prefer sha1
-218 return usersetting ;
-219 case 28 : // 2048 bit
-220 if ( usersetting > 11 &&
-221 usersetting < 8 )
-222 return 11 ;
-223 return usersetting ;
-224 case 32 : // 4096 bit // prefer sha224
-225 if ( usersetting > 10 &&
-226 usersetting < 8 )
-227 return 8 ; // prefer sha256
-228 return usersetting ;
-229 default :
-230 util.print_debug ( "DSA select hash algorithm: returning null for an unknown length of q" ) ;
-231 return null ;
-232
-233 }
-234 }
-235 this.select_hash_algorithm = select_hash_algorithm ;
-236
-237 function verify ( hashalgo , s1 , s2 , m , p , q , g , y ) {
-238 var hashHex = KJUR.crypto.Util.hashString ( m , hashalgo.toLowerCase ( ) ) ;
-239 var hashHex = hashHex.substr ( 0 , q.bitLength ( ) / 4 ) ;
-240 var hash = new BigInteger ( hashHex , 16 ) ;
-241
-242 if ( BigInteger.ZERO.compareTo ( s1 ) > 0 ||
-243 s1.compareTo ( q ) > 0 ||
-244 BigInteger.ZERO.compareTo ( s2 ) > 0 ||
-245 s2.compareTo ( q ) > 0 ) {
-246 util.print_error ( "invalid DSA Signature" ) ;
-247 return null ;
-248 }
-249 var w = s2.modInverse ( q ) ;
-250 var u1 = hash.multiply ( w ) . mod ( q ) ;
-251 var u2 = s1.multiply ( w ) . mod ( q ) ;
-252 var dopublic = g.modPow ( u1 , p ) . multiply ( y.modPow ( u2 , p ) ) . mod ( p ) . mod ( q ) ;
-253 return dopublic.compareTo ( s1 ) == 0 ;
-254 }
-255
-256 /*
-257 * unused code. This can be used as a start to write a key generator
-258 * function.
-259 */
-260 function generateKey ( bitcount ) {
-261 var qi = new BigInteger ( bitcount , primeCenterie ) ;
-262 var pi = generateP ( q , 512 ) ;
-263 var gi = generateG ( p , q , bitcount ) ;
-264 var xi ;
-265 do {
-266 xi = new BigInteger ( q.bitCount ( ) , rand ) ;
-267 } while ( x.compareTo ( BigInteger.ZERO ) != 1 && x.compareTo ( q ) != - 1 ) ;
-268 var yi = g.modPow ( x , p ) ;
-269 return { x : xi , q : qi , p : pi , g : gi , y : yi } ;
-270 }
-271
-272 function generateP ( q , bitlength , randomfn ) {
-273 if ( bitlength % 64 != 0 ) {
-274 return false ;
-275 }
-276 var pTemp ;
-277 var pTemp2 ;
-278 do {
-279 pTemp = randomfn ( bitcount , true ) ;
-280 pTemp2 = pTemp.subtract ( BigInteger.ONE ) ;
-281 pTemp = pTemp.subtract ( pTemp2.remainder ( q ) ) ;
-282 } while ( ! pTemp.isProbablePrime ( primeCenterie ) || pTemp.bitLength ( ) != l ) ;
-283 return pTemp ;
-284 }
-285
-286 function generateG ( p , q , bitlength , randomfn ) {
-287 var aux = p.subtract ( BigInteger.ONE ) ;
-288 var pow = aux.divide ( q ) ;
-289 var gTemp ;
-290 do {
-291 gTemp = randomfn ( bitlength ) ;
-292 } while ( gTemp.compareTo ( aux ) != - 1 && gTemp.compareTo ( BigInteger.ONE ) != 1 ) ;
-293 return gTemp.modPow ( pow , p ) ;
-294 }
-295
-296 function generateK ( q , bitlength , randomfn ) {
-297 var tempK ;
-298 do {
-299 tempK = randomfn ( bitlength , false ) ;
-300 } while ( tempK.compareTo ( q ) != - 1 && tempK.compareTo ( BigInteger.ZERO ) != 1 ) ;
-301 return tempK ;
-302 }
-303
-304 function generateR ( q , p ) {
-305 k = generateK ( q ) ;
-306 var r = g.modPow ( k , p ) . mod ( q ) ;
-307 return r ;
-308 }
-309
-310 function generateS ( hashfn , k , r , m , q , x ) {
-311 var hash = hashfn ( m ) ;
-312 s = ( k.modInverse ( q ) . multiply ( hash.add ( x.multiply ( r ) ) ) ) . mod ( q ) ;
-313 return s ;
-314 }
-315 this.sign = sign ;
-316 this.verify = verify ;
-317 // this.generate = generateKey;
-318
-319 //
-320 // METHODS FROM
-321 // https://github.com/openpgpjs/openpgpjs/blob/master/src/ciphers/openpgp.crypto.js
-322 //
-323 function getRandomBigIntegerInRange ( min , max ) {
-324 if ( max.compareTo ( min ) <= 0 )
-325 return ;
-326 var range = max.subtract ( min ) ;
-327 var r = getRandomBigInteger ( range.bitLength ( ) ) ;
-328 while ( r > range ) {
-329 r = getRandomBigInteger ( range.bitLength ( ) ) ;
-330 }
-331 return min.add ( r ) ;
-332 }
-333
-334 function getRandomBigInteger ( bits ) {
-335 if ( bits < 0 )
-336 return null ;
-337 var numBytes = Math.floor ( ( bits + 7 ) / 8 ) ;
-338
-339 var randomBits = getRandomBytes ( numBytes ) ;
-340 if ( bits % 8 > 0 ) {
-341 randomBits = String.fromCharCode ( ( Math.pow ( 2 , bits % 8 ) - 1 ) &
-342 randomBits.charCodeAt ( 0 ) ) +
-343 randomBits.substring ( 1 ) ;
-344 }
-345 return new BigInteger ( hexstrdump ( randomBits ) , 16 ) ;
-346 }
-347
-348 function getRandomBytes ( length ) {
-349 var result = '' ;
-350 for ( var i = 0 ; i < length ; i ++ ) {
-351 result + = String.fromCharCode ( getSecureRandomOctet ( ) ) ;
-352 }
-353 return result ;
-354 }
-355
-356 function getSecureRandomOctet ( ) {
-357 var buf = new Uint32Array ( 1 ) ;
-358 window.crypto.getRandomValues ( buf ) ;
-359 return buf [ 0 ] & 0xFF ;
-360 }
-361
-362 // https://github.com/openpgpjs/openpgpjs/blob/master/src/util/util.js
-363 function hexstrdump ( str ) {
-364 if ( str == null )
-365 return "" ;
-366 var r = [ ] ;
-367 var e = str.length ;
-368 var c = 0 ;
-369 var h ;
-370 while ( c < e ) {
-371 h = str [ c ++ ] . charCodeAt ( ) . toString ( 16 ) ;
-372 while ( h.length < 2 ) h = "0" + h ;
-373 r.push ( "" + h ) ;
-374 }
-375 return r.join ( '' ) ;
-376 }
-377
-378 this.getRandomBigIntegerInRange = getRandomBigIntegerInRange ;
-379 this.getRandomBigInteger = getRandomBigInteger ;
-380 this.getRandomBytes = getRandomBytes ;
-381 }
-382
\ No newline at end of file
diff --git a/jwt/api/symbols/src/ecdsa-modified-1.0.js.html b/jwt/api/symbols/src/ecdsa-modified-1.0.js.html
deleted file mode 100644
index 85f20d7..0000000
--- a/jwt/api/symbols/src/ecdsa-modified-1.0.js.html
+++ /dev/null
@@ -1,616 +0,0 @@
-
1 /*! ecdsa-modified-1.0.4.js (c) Stephan Thomas, Kenji Urushima | github.com/bitcoinjs/bitcoinjs-lib/blob/master/LICENSE
- 2 */
- 3 /*
- 4 * ecdsa-modified.js - modified Bitcoin.ECDSA class
- 5 *
- 6 * Copyright (c) 2013 Stefan Thomas (github.com/justmoon)
- 7 * Kenji Urushima (kenji.urushima@gmail.com)
- 8 * LICENSE
- 9 * https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/LICENSE
- 10 */
- 11
- 12 /**
- 13 * @fileOverview
- 14 * @name ecdsa-modified-1.0.js
- 15 * @author Stefan Thomas (github.com/justmoon) and Kenji Urushima (kenji.urushima@gmail.com)
- 16 * @version 1.0.4 (2013-Oct-06)
- 17 * @since jsrsasign 4.0
- 18 * @license <a href="https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/LICENSE">MIT License</a>
- 19 */
- 20
- 21 if ( typeof KJUR == "undefined" || ! KJUR ) KJUR = { } ;
- 22 if ( typeof KJUR.crypto == "undefined" || ! KJUR.crypto ) KJUR.crypto = { } ;
- 23
- 24 /**
- 25 * class for EC key generation, ECDSA signing and verifcation
- 26 * @name KJUR.crypto.ECDSA
- 27 * @class class for EC key generation, ECDSA signing and verifcation
- 28 * @description
- 29 * <p>
- 30 * CAUTION: Most of the case, you don't need to use this class except
- 31 * for generating an EC key pair. Please use {@link KJUR.crypto.Signature} class instead.
- 32 * </p>
- 33 * <p>
- 34 * This class was originally developped by Stefan Thomas for Bitcoin JavaScript library.
- 35 * (See {@link https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/src/ecdsa.js})
- 36 * Currently this class supports following named curves and their aliases.
- 37 * <ul>
- 38 * <li>secp256r1, NIST P-256, P-256, prime256v1 (*)</li>
- 39 * <li>secp256k1 (*)</li>
- 40 * <li>secp384r1, NIST P-384, P-384 (*)</li>
- 41 * </ul>
- 42 * </p>
- 43 */
- 44 KJUR.crypto.ECDSA = function ( params ) {
- 45 var curveName = "secp256r1" ; // curve name default
- 46 var ecparams = null ;
- 47 var prvKeyHex = null ;
- 48 var pubKeyHex = null ;
- 49
- 50 var rng = new SecureRandom ( ) ;
- 51
- 52 var P_OVER_FOUR = null ;
- 53
- 54 this.type = "EC" ;
- 55
- 56 function implShamirsTrick ( P , k , Q , l ) {
- 57 var m = Math.max ( k.bitLength ( ) , l.bitLength ( ) ) ;
- 58 var Z = P.add2D ( Q ) ;
- 59 var R = P.curve.getInfinity ( ) ;
- 60
- 61 for ( var i = m - 1 ; i >= 0 ; -- i ) {
- 62 R = R.twice2D ( ) ;
- 63
- 64 R.z = BigInteger.ONE ;
- 65
- 66 if ( k.testBit ( i ) ) {
- 67 if ( l.testBit ( i ) ) {
- 68 R = R.add2D ( Z ) ;
- 69 } else {
- 70 R = R.add2D ( P ) ;
- 71 }
- 72 } else {
- 73 if ( l.testBit ( i ) ) {
- 74 R = R.add2D ( Q ) ;
- 75 }
- 76 }
- 77 }
- 78
- 79 return R ;
- 80 } ;
- 81
- 82 //===========================
- 83 // PUBLIC METHODS
- 84 //===========================
- 85 this.getBigRandom = function ( limit ) {
- 86 return new BigInteger ( limit.bitLength ( ) , rng )
- 87 . mod ( limit.subtract ( BigInteger.ONE ) )
- 88 . add ( BigInteger.ONE )
- 89 ;
- 90 } ;
- 91
- 92 this.setNamedCurve = function ( curveName ) {
- 93 this.ecparams = KJUR.crypto.ECParameterDB.getByName ( curveName ) ;
- 94 this.prvKeyHex = null ;
- 95 this.pubKeyHex = null ;
- 96 this.curveName = curveName ;
- 97 }
- 98
- 99 this.setPrivateKeyHex = function ( prvKeyHex ) {
-100 this.isPrivate = true ;
-101 this.prvKeyHex = prvKeyHex ;
-102 }
-103
-104 this.setPublicKeyHex = function ( pubKeyHex ) {
-105 this.isPublic = true ;
-106 this.pubKeyHex = pubKeyHex ;
-107 }
-108
-109 /**
-110 * generate a EC key pair
-111 * @name generateKeyPairHex
-112 * @memberOf KJUR.crypto.ECDSA
-113 * @function
-114 * @return {Array} associative array of hexadecimal string of private and public key
-115 * @since ecdsa-modified 1.0.1
-116 * @example
-117 * var ec = new KJUR.crypto.ECDSA({'curve': 'secp256r1'});
-118 * var keypair = ec.generateKeyPairHex();
-119 * var pubhex = keypair.ecpubhex; // hexadecimal string of EC private key (=d)
-120 * var prvhex = keypair.ecprvhex; // hexadecimal string of EC public key
-121 */
-122 this.generateKeyPairHex = function ( ) {
-123 var biN = this.ecparams [ 'n' ] ;
-124 var biPrv = this.getBigRandom ( biN ) ;
-125 var epPub = this.ecparams [ 'G' ] . multiply ( biPrv ) ;
-126 var biX = epPub.getX ( ) . toBigInteger ( ) ;
-127 var biY = epPub.getY ( ) . toBigInteger ( ) ;
-128
-129 var charlen = this.ecparams [ 'keylen' ] / 4 ;
-130 var hPrv = ( "0000000000" + biPrv.toString ( 16 ) ) . slice ( - charlen ) ;
-131 var hX = ( "0000000000" + biX.toString ( 16 ) ) . slice ( - charlen ) ;
-132 var hY = ( "0000000000" + biY.toString ( 16 ) ) . slice ( - charlen ) ;
-133 var hPub = "04" + hX + hY ;
-134
-135 this.setPrivateKeyHex ( hPrv ) ;
-136 this.setPublicKeyHex ( hPub ) ;
-137 return { 'ecprvhex' : hPrv , 'ecpubhex' : hPub } ;
-138 } ;
-139
-140 this.signWithMessageHash = function ( hashHex ) {
-141 return this.signHex ( hashHex , this.prvKeyHex ) ;
-142 } ;
-143
-144 /**
-145 * signing to message hash
-146 * @name signHex
-147 * @memberOf KJUR.crypto.ECDSA
-148 * @function
-149 * @param {String} hashHex hexadecimal string of hash value of signing message
-150 * @param {String} privHex hexadecimal string of EC private key
-151 * @return {String} hexadecimal string of ECDSA signature
-152 * @since ecdsa-modified 1.0.1
-153 * @example
-154 * var ec = new KJUR.crypto.ECDSA({'curve': 'secp256r1'});
-155 * var sigValue = ec.signHex(hash, prvKey);
-156 */
-157 this.signHex = function ( hashHex , privHex ) {
-158 var d = new BigInteger ( privHex , 16 ) ;
-159 var n = this.ecparams [ 'n' ] ;
-160 var e = new BigInteger ( hashHex , 16 ) ;
-161
-162 do {
-163 var k = this.getBigRandom ( n ) ;
-164 var G = this.ecparams [ 'G' ] ;
-165 var Q = G.multiply ( k ) ;
-166 var r = Q.getX ( ) . toBigInteger ( ) . mod ( n ) ;
-167 } while ( r.compareTo ( BigInteger.ZERO ) <= 0 ) ;
-168
-169 var s = k.modInverse ( n ) . multiply ( e.add ( d.multiply ( r ) ) ) . mod ( n ) ;
-170
-171 return KJUR.crypto.ECDSA.biRSSigToASN1Sig ( r , s ) ;
-172 } ;
-173
-174 this.sign = function ( hash , priv ) {
-175 var d = priv ;
-176 var n = this.ecparams [ 'n' ] ;
-177 var e = BigInteger.fromByteArrayUnsigned ( hash ) ;
-178
-179 do {
-180 var k = this.getBigRandom ( n ) ;
-181 var G = this.ecparams [ 'G' ] ;
-182 var Q = G.multiply ( k ) ;
-183 var r = Q.getX ( ) . toBigInteger ( ) . mod ( n ) ;
-184 } while ( r.compareTo ( BigInteger.ZERO ) <= 0 ) ;
-185
-186 var s = k.modInverse ( n ) . multiply ( e.add ( d.multiply ( r ) ) ) . mod ( n ) ;
-187 return this.serializeSig ( r , s ) ;
-188 } ;
-189
-190 this.verifyWithMessageHash = function ( hashHex , sigHex ) {
-191 return this.verifyHex ( hashHex , sigHex , this.pubKeyHex ) ;
-192 } ;
-193
-194 /**
-195 * verifying signature with message hash and public key
-196 * @name verifyHex
-197 * @memberOf KJUR.crypto.ECDSA
-198 * @function
-199 * @param {String} hashHex hexadecimal string of hash value of signing message
-200 * @param {String} sigHex hexadecimal string of signature value
-201 * @param {String} pubkeyHex hexadecimal string of public key
-202 * @return {Boolean} true if the signature is valid, otherwise false
-203 * @since ecdsa-modified 1.0.1
-204 * @example
-205 * var ec = new KJUR.crypto.ECDSA({'curve': 'secp256r1'});
-206 * var result = ec.verifyHex(msgHashHex, sigHex, pubkeyHex);
-207 */
-208 this.verifyHex = function ( hashHex , sigHex , pubkeyHex ) {
-209 var r , s ;
-210
-211 var obj = KJUR.crypto.ECDSA.parseSigHex ( sigHex ) ;
-212 r = obj.r ;
-213 s = obj.s ;
-214
-215 var Q ;
-216 Q = ECPointFp.decodeFromHex ( this.ecparams [ 'curve' ] , pubkeyHex ) ;
-217 var e = new BigInteger ( hashHex , 16 ) ;
-218
-219 return this.verifyRaw ( e , r , s , Q ) ;
-220 } ;
-221
-222 this.verify = function ( hash , sig , pubkey ) {
-223 var r , s ;
-224 if ( Bitcoin.Util.isArray ( sig ) ) {
-225 var obj = this.parseSig ( sig ) ;
-226 r = obj.r ;
-227 s = obj.s ;
-228 } else if ( "object" === typeof sig && sig.r && sig.s ) {
-229 r = sig.r ;
-230 s = sig.s ;
-231 } else {
-232 throw "Invalid value for signature" ;
-233 }
-234
-235 var Q ;
-236 if ( pubkey instanceof ECPointFp ) {
-237 Q = pubkey ;
-238 } else if ( Bitcoin.Util.isArray ( pubkey ) ) {
-239 Q = ECPointFp.decodeFrom ( this.ecparams [ 'curve' ] , pubkey ) ;
-240 } else {
-241 throw "Invalid format for pubkey value, must be byte array or ECPointFp" ;
-242 }
-243 var e = BigInteger.fromByteArrayUnsigned ( hash ) ;
-244
-245 return this.verifyRaw ( e , r , s , Q ) ;
-246 } ;
-247
-248 this.verifyRaw = function ( e , r , s , Q ) {
-249 var n = this.ecparams [ 'n' ] ;
-250 var G = this.ecparams [ 'G' ] ;
-251
-252 if ( r.compareTo ( BigInteger.ONE ) < 0 ||
-253 r.compareTo ( n ) >= 0 )
-254 return false ;
-255
-256 if ( s.compareTo ( BigInteger.ONE ) < 0 ||
-257 s.compareTo ( n ) >= 0 )
-258 return false ;
-259
-260 var c = s.modInverse ( n ) ;
-261
-262 var u1 = e.multiply ( c ) . mod ( n ) ;
-263 var u2 = r.multiply ( c ) . mod ( n ) ;
-264
-265 // TODO(!!!): For some reason Shamir's trick isn't working with
-266 // signed message verification!? Probably an implementation
-267 // error!
-268 //var point = implShamirsTrick(G, u1, Q, u2);
-269 var point = G.multiply ( u1 ) . add ( Q.multiply ( u2 ) ) ;
-270
-271 var v = point.getX ( ) . toBigInteger ( ) . mod ( n ) ;
-272
-273 return v.equals ( r ) ;
-274 } ;
-275
-276 /**
-277 * Serialize a signature into DER format.
-278 *
-279 * Takes two BigIntegers representing r and s and returns a byte array.
-280 */
-281 this.serializeSig = function ( r , s ) {
-282 var rBa = r.toByteArraySigned ( ) ;
-283 var sBa = s.toByteArraySigned ( ) ;
-284
-285 var sequence = [ ] ;
-286 sequence.push ( 0x02 ) ; // INTEGER
-287 sequence.push ( rBa.length ) ;
-288 sequence = sequence.concat ( rBa ) ;
-289
-290 sequence.push ( 0x02 ) ; // INTEGER
-291 sequence.push ( sBa.length ) ;
-292 sequence = sequence.concat ( sBa ) ;
-293
-294 sequence.unshift ( sequence.length ) ;
-295 sequence.unshift ( 0x30 ) ; // SEQUENCE
-296 return sequence ;
-297 } ;
-298
-299 /**
-300 * Parses a byte array containing a DER-encoded signature.
-301 *
-302 * This function will return an object of the form:
-303 *
-304 * {
-305 * r: BigInteger,
-306 * s: BigInteger
-307 * }
-308 */
-309 this.parseSig = function ( sig ) {
-310 var cursor ;
-311 if ( sig [ 0 ] != 0x30 )
-312 throw new Error ( "Signature not a valid DERSequence" ) ;
-313
-314 cursor = 2 ;
-315 if ( sig [ cursor ] != 0x02 )
-316 throw new Error ( "First element in signature must be a DERInteger" ) ; ;
-317 var rBa = sig.slice ( cursor + 2 , cursor + 2 + sig [ cursor + 1 ] ) ;
-318
-319 cursor + = 2 + sig [ cursor + 1 ] ;
-320 if ( sig [ cursor ] != 0x02 )
-321 throw new Error ( "Second element in signature must be a DERInteger" ) ;
-322 var sBa = sig.slice ( cursor + 2 , cursor + 2 + sig [ cursor + 1 ] ) ;
-323
-324 cursor + = 2 + sig [ cursor + 1 ] ;
-325
-326 //if (cursor != sig.length)
-327 // throw new Error("Extra bytes in signature");
-328
-329 var r = BigInteger.fromByteArrayUnsigned ( rBa ) ;
-330 var s = BigInteger.fromByteArrayUnsigned ( sBa ) ;
-331
-332 return { r : r , s : s } ;
-333 } ;
-334
-335 this.parseSigCompact = function ( sig ) {
-336 if ( sig.length !== 65 ) {
-337 throw "Signature has the wrong length" ;
-338 }
-339
-340 // Signature is prefixed with a type byte storing three bits of
-341 // information.
-342 var i = sig [ 0 ] - 27 ;
-343 if ( i < 0 || i > 7 ) {
-344 throw "Invalid signature type" ;
-345 }
-346
-347 var n = this.ecparams [ 'n' ] ;
-348 var r = BigInteger.fromByteArrayUnsigned ( sig.slice ( 1 , 33 ) ) . mod ( n ) ;
-349 var s = BigInteger.fromByteArrayUnsigned ( sig.slice ( 33 , 65 ) ) . mod ( n ) ;
-350
-351 return { r : r , s : s , i : i } ;
-352 } ;
-353
-354 /*
-355 * Recover a public key from a signature.
-356 *
-357 * See SEC 1: Elliptic Curve Cryptography, section 4.1.6, "Public
-358 * Key Recovery Operation".
-359 *
-360 * http://www.secg.org/download/aid-780/sec1-v2.pdf
-361 */
-362 /*
-363 recoverPubKey: function (r, s, hash, i) {
-364 // The recovery parameter i has two bits.
-365 i = i & 3;
-366
-367 // The less significant bit specifies whether the y coordinate
-368 // of the compressed point is even or not.
-369 var isYEven = i & 1;
-370
-371 // The more significant bit specifies whether we should use the
-372 // first or second candidate key.
-373 var isSecondKey = i >> 1;
-374
-375 var n = this.ecparams['n'];
-376 var G = this.ecparams['G'];
-377 var curve = this.ecparams['curve'];
-378 var p = curve.getQ();
-379 var a = curve.getA().toBigInteger();
-380 var b = curve.getB().toBigInteger();
-381
-382 // We precalculate (p + 1) / 4 where p is if the field order
-383 if (!P_OVER_FOUR) {
-384 P_OVER_FOUR = p.add(BigInteger.ONE).divide(BigInteger.valueOf(4));
-385 }
-386
-387 // 1.1 Compute x
-388 var x = isSecondKey ? r.add(n) : r;
-389
-390 // 1.3 Convert x to point
-391 var alpha = x.multiply(x).multiply(x).add(a.multiply(x)).add(b).mod(p);
-392 var beta = alpha.modPow(P_OVER_FOUR, p);
-393
-394 var xorOdd = beta.isEven() ? (i % 2) : ((i+1) % 2);
-395 // If beta is even, but y isn't or vice versa, then convert it,
-396 // otherwise we're done and y == beta.
-397 var y = (beta.isEven() ? !isYEven : isYEven) ? beta : p.subtract(beta);
-398
-399 // 1.4 Check that nR is at infinity
-400 var R = new ECPointFp(curve,
-401 curve.fromBigInteger(x),
-402 curve.fromBigInteger(y));
-403 R.validate();
-404
-405 // 1.5 Compute e from M
-406 var e = BigInteger.fromByteArrayUnsigned(hash);
-407 var eNeg = BigInteger.ZERO.subtract(e).mod(n);
-408
-409 // 1.6 Compute Q = r^-1 (sR - eG)
-410 var rInv = r.modInverse(n);
-411 var Q = implShamirsTrick(R, s, G, eNeg).multiply(rInv);
-412
-413 Q.validate();
-414 if (!this.verifyRaw(e, r, s, Q)) {
-415 throw "Pubkey recovery unsuccessful";
-416 }
-417
-418 var pubKey = new Bitcoin.ECKey();
-419 pubKey.pub = Q;
-420 return pubKey;
-421 },
-422 */
-423
-424 /*
-425 * Calculate pubkey extraction parameter.
-426 *
-427 * When extracting a pubkey from a signature, we have to
-428 * distinguish four different cases. Rather than putting this
-429 * burden on the verifier, Bitcoin includes a 2-bit value with the
-430 * signature.
-431 *
-432 * This function simply tries all four cases and returns the value
-433 * that resulted in a successful pubkey recovery.
-434 */
-435 /*
-436 calcPubkeyRecoveryParam: function (address, r, s, hash) {
-437 for (var i = 0; i < 4; i++) {
-438 try {
-439 var pubkey = Bitcoin.ECDSA.recoverPubKey(r, s, hash, i);
-440 if (pubkey.getBitcoinAddress().toString() == address) {
-441 return i;
-442 }
-443 } catch (e) {}
-444 }
-445 throw "Unable to find valid recovery factor";
-446 }
-447 */
-448
-449 if ( params !== undefined ) {
-450 if ( params [ 'curve' ] !== undefined ) {
-451 this.curveName = params [ 'curve' ] ;
-452 }
-453 }
-454 if ( this.curveName === undefined ) this.curveName = curveName ;
-455 this.setNamedCurve ( this.curveName ) ;
-456 if ( params !== undefined ) {
-457 if ( params [ 'prv' ] !== undefined ) this.setPrivateKeyHex ( params [ 'prv' ] ) ;
-458 if ( params [ 'pub' ] !== undefined ) this.setPublicKeyHex ( params [ 'pub' ] ) ;
-459 }
-460 } ;
-461
-462 /**
-463 * parse ASN.1 DER encoded ECDSA signature
-464 * @name parseSigHex
-465 * @memberOf KJUR.crypto.ECDSA
-466 * @function
-467 * @static
-468 * @param {String} sigHex hexadecimal string of ECDSA signature value
-469 * @return {Array} associative array of signature field r and s of BigInteger
-470 * @since ecdsa-modified 1.0.1
-471 * @example
-472 * var ec = new KJUR.crypto.ECDSA({'curve': 'secp256r1'});
-473 * var sig = ec.parseSigHex('30...');
-474 * var biR = sig.r; // BigInteger object for 'r' field of signature.
-475 * var biS = sig.s; // BigInteger object for 's' field of signature.
-476 */
-477 KJUR.crypto.ECDSA.parseSigHex = function ( sigHex ) {
-478 var p = KJUR.crypto.ECDSA.parseSigHexInHexRS ( sigHex ) ;
-479 var biR = new BigInteger ( p.r , 16 ) ;
-480 var biS = new BigInteger ( p.s , 16 ) ;
-481
-482 return { 'r' : biR , 's' : biS } ;
-483 } ;
-484
-485 /**
-486 * parse ASN.1 DER encoded ECDSA signature
-487 * @name parseSigHexInHexRS
-488 * @memberOf KJUR.crypto.ECDSA
-489 * @function
-490 * @static
-491 * @param {String} sigHex hexadecimal string of ECDSA signature value
-492 * @return {Array} associative array of signature field r and s in hexadecimal
-493 * @since ecdsa-modified 1.0.3
-494 * @example
-495 * var ec = new KJUR.crypto.ECDSA({'curve': 'secp256r1'});
-496 * var sig = ec.parseSigHexInHexRS('30...');
-497 * var hR = sig.r; // hexadecimal string for 'r' field of signature.
-498 * var hS = sig.s; // hexadecimal string for 's' field of signature.
-499 */
-500 KJUR.crypto.ECDSA.parseSigHexInHexRS = function ( sigHex ) {
-501 // 1. ASN.1 Sequence Check
-502 if ( sigHex.substr ( 0 , 2 ) != "30" )
-503 throw "signature is not a ASN.1 sequence" ;
-504
-505 // 2. Items of ASN.1 Sequence Check
-506 var a = ASN1HEX.getPosArrayOfChildren_AtObj ( sigHex , 0 ) ;
-507 if ( a.length != 2 )
-508 throw "number of signature ASN.1 sequence elements seem wrong" ;
-509
-510 // 3. Integer check
-511 var iTLV1 = a [ 0 ] ;
-512 var iTLV2 = a [ 1 ] ;
-513 if ( sigHex.substr ( iTLV1 , 2 ) != "02" )
-514 throw "1st item of sequene of signature is not ASN.1 integer" ;
-515 if ( sigHex.substr ( iTLV2 , 2 ) != "02" )
-516 throw "2nd item of sequene of signature is not ASN.1 integer" ;
-517
-518 // 4. getting value
-519 var hR = ASN1HEX.getHexOfV_AtObj ( sigHex , iTLV1 ) ;
-520 var hS = ASN1HEX.getHexOfV_AtObj ( sigHex , iTLV2 ) ;
-521
-522 return { 'r' : hR , 's' : hS } ;
-523 } ;
-524
-525 /**
-526 * convert hexadecimal ASN.1 encoded signature to concatinated signature
-527 * @name asn1SigToConcatSig
-528 * @memberOf KJUR.crypto.ECDSA
-529 * @function
-530 * @static
-531 * @param {String} asn1Hex hexadecimal string of ASN.1 encoded ECDSA signature value
-532 * @return {String} r-s concatinated format of ECDSA signature value
-533 * @since ecdsa-modified 1.0.3
-534 */
-535 KJUR.crypto.ECDSA.asn1SigToConcatSig = function ( asn1Sig ) {
-536 var pSig = KJUR.crypto.ECDSA.parseSigHexInHexRS ( asn1Sig ) ;
-537 var hR = pSig.r ;
-538 var hS = pSig.s ;
-539
-540 if ( hR.substr ( 0 , 2 ) == "00" && ( ( ( hR.length / 2 ) * 8 ) % ( 16 * 8 ) ) == 8 )
-541 hR = hR.substr ( 2 ) ;
-542
-543 if ( hS.substr ( 0 , 2 ) == "00" && ( ( ( hS.length / 2 ) * 8 ) % ( 16 * 8 ) ) == 8 )
-544 hS = hS.substr ( 2 ) ;
-545
-546 if ( ( ( ( hR.length / 2 ) * 8 ) % ( 16 * 8 ) ) != 0 )
-547 throw "unknown ECDSA sig r length error" ;
-548
-549 if ( ( ( ( hS.length / 2 ) * 8 ) % ( 16 * 8 ) ) != 0 )
-550 throw "unknown ECDSA sig s length error" ;
-551
-552 return hR + hS ;
-553 } ;
-554
-555 /**
-556 * convert hexadecimal concatinated signature to ASN.1 encoded signature
-557 * @name concatSigToASN1Sig
-558 * @memberOf KJUR.crypto.ECDSA
-559 * @function
-560 * @static
-561 * @param {String} concatSig r-s concatinated format of ECDSA signature value
-562 * @return {String} hexadecimal string of ASN.1 encoded ECDSA signature value
-563 * @since ecdsa-modified 1.0.3
-564 */
-565 KJUR.crypto.ECDSA.concatSigToASN1Sig = function ( concatSig ) {
-566 if ( ( ( ( concatSig.length / 2 ) * 8 ) % ( 16 * 8 ) ) != 0 )
-567 throw "unknown ECDSA concatinated r-s sig length error" ;
-568
-569 var hR = concatSig.substr ( 0 , concatSig.length / 2 ) ;
-570 var hS = concatSig.substr ( concatSig.length / 2 ) ;
-571 return KJUR.crypto.ECDSA.hexRSSigToASN1Sig ( hR , hS ) ;
-572 } ;
-573
-574 /**
-575 * convert hexadecimal R and S value of signature to ASN.1 encoded signature
-576 * @name hexRSSigToASN1Sig
-577 * @memberOf KJUR.crypto.ECDSA
-578 * @function
-579 * @static
-580 * @param {String} hR hexadecimal string of R field of ECDSA signature value
-581 * @param {String} hS hexadecimal string of S field of ECDSA signature value
-582 * @return {String} hexadecimal string of ASN.1 encoded ECDSA signature value
-583 * @since ecdsa-modified 1.0.3
-584 */
-585 KJUR.crypto.ECDSA.hexRSSigToASN1Sig = function ( hR , hS ) {
-586 var biR = new BigInteger ( hR , 16 ) ;
-587 var biS = new BigInteger ( hS , 16 ) ;
-588 return KJUR.crypto.ECDSA.biRSSigToASN1Sig ( biR , biS ) ;
-589 } ;
-590
-591 /**
-592 * convert R and S BigInteger object of signature to ASN.1 encoded signature
-593 * @name biRSSigToASN1Sig
-594 * @memberOf KJUR.crypto.ECDSA
-595 * @function
-596 * @static
-597 * @param {BigInteger} biR BigInteger object of R field of ECDSA signature value
-598 * @param {BigInteger} biS BIgInteger object of S field of ECDSA signature value
-599 * @return {String} hexadecimal string of ASN.1 encoded ECDSA signature value
-600 * @since ecdsa-modified 1.0.3
-601 */
-602 KJUR.crypto.ECDSA.biRSSigToASN1Sig = function ( biR , biS ) {
-603 var derR = new KJUR.asn1.DERInteger ( { 'bigint' : biR } ) ;
-604 var derS = new KJUR.asn1.DERInteger ( { 'bigint' : biS } ) ;
-605 var derSeq = new KJUR.asn1.DERSequence ( { 'array' : [ derR , derS ] } ) ;
-606 return derSeq.getEncodedHex ( ) ;
-607 } ;
-608
-609
\ No newline at end of file
diff --git a/jwt/api/symbols/src/ecparam-1.0.js.html b/jwt/api/symbols/src/ecparam-1.0.js.html
deleted file mode 100644
index 10b7b0e..0000000
--- a/jwt/api/symbols/src/ecparam-1.0.js.html
+++ /dev/null
@@ -1,256 +0,0 @@
-
1 /*! ecparam-1.0.0.js (c) 2013 Kenji Urushima | kjur.github.com/jsrsasign/license
- 2 */
- 3 /*
- 4 * ecparam.js - Elliptic Curve Cryptography Curve Parameter Definition class
- 5 *
- 6 * Copyright (c) 2013 Kenji Urushima (kenji.urushima@gmail.com)
- 7 *
- 8 * This software is licensed under the terms of the MIT License.
- 9 * http://kjur.github.com/jsrsasign/license
- 10 *
- 11 * The above copyright and license notice shall be
- 12 * included in all copies or substantial portions of the Software.
- 13 */
- 14
- 15 /**
- 16 * @fileOverview
- 17 * @name ecparam-1.1.js
- 18 * @author Kenji Urushima kenji.urushima@gmail.com
- 19 * @version 1.0.0 (2013-Jul-17)
- 20 * @since jsrsasign 4.0
- 21 * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a>
- 22 */
- 23
- 24 if ( typeof KJUR == "undefined" || ! KJUR ) KJUR = { } ;
- 25 if ( typeof KJUR.crypto == "undefined" || ! KJUR.crypto ) KJUR.crypto = { } ;
- 26
- 27 /**
- 28 * static object for elliptic curve names and parameters
- 29 * @name KJUR.crypto.ECParameterDB
- 30 * @class static object for elliptic curve names and parameters
- 31 * @description
- 32 * This class provides parameters for named elliptic curves.
- 33 * Currently it supoprts following curve names and aliases however
- 34 * the name marked (*) are available for {@link KJUR.crypto.ECDSA} and
- 35 * {@link KJUR.crypto.Signature} classes.
- 36 * <ul>
- 37 * <li>secp128r1</li>
- 38 * <li>secp160r1</li>
- 39 * <li>secp160k1</li>
- 40 * <li>secp192r1</li>
- 41 * <li>secp192k1</li>
- 42 * <li>secp224r1</li>
- 43 * <li>secp256r1, NIST P-256, P-256, prime256v1 (*)</li>
- 44 * <li>secp256k1 (*)</li>
- 45 * <li>secp384r1, NIST P-384, P-384 (*)</li>
- 46 * <li>secp521r1, NIST P-521, P-521</li>
- 47 * </ul>
- 48 * You can register new curves by using 'register' method.
- 49 */
- 50 KJUR.crypto.ECParameterDB = new function ( ) {
- 51 var db = { } ;
- 52 var aliasDB = { } ;
- 53
- 54 function hex2bi ( hex ) {
- 55 return new BigInteger ( hex , 16 ) ;
- 56 }
- 57
- 58 /**
- 59 * get curve inforamtion associative array for curve name or alias
- 60 * @name getByName
- 61 * @memberOf KJUR.crypto.ECParameterDB
- 62 * @function
- 63 * @param {String} nameOrAlias curve name or alias name
- 64 * @return {Array} associative array of curve parameters
- 65 * @example
- 66 * var param = KJUR.crypto.ECParameterDB.getByName('prime256v1');
- 67 * var keylen = param['keylen'];
- 68 * var n = param['n'];
- 69 */
- 70 this.getByName = function ( nameOrAlias ) {
- 71 var name = nameOrAlias ;
- 72 if ( typeof aliasDB [ name ] != "undefined" ) {
- 73 name = aliasDB [ nameOrAlias ] ;
- 74 }
- 75 if ( typeof db [ name ] != "undefined" ) {
- 76 return db [ name ] ;
- 77 }
- 78 throw "unregistered EC curve name: " + name ;
- 79 } ;
- 80
- 81 /**
- 82 * register new curve
- 83 * @name regist
- 84 * @memberOf KJUR.crypto.ECParameterDB
- 85 * @function
- 86 * @param {String} name name of curve
- 87 * @param {Integer} keylen key length
- 88 * @param {String} pHex hexadecimal value of p
- 89 * @param {String} aHex hexadecimal value of a
- 90 * @param {String} bHex hexadecimal value of b
- 91 * @param {String} nHex hexadecimal value of n
- 92 * @param {String} hHex hexadecimal value of h
- 93 * @param {String} gxHex hexadecimal value of Gx
- 94 * @param {String} gyHex hexadecimal value of Gy
- 95 * @param {Array} aliasList array of string for curve names aliases
- 96 * @param {String} oid Object Identifier for the curve
- 97 * @param {String} info information string for the curve
- 98 */
- 99 this.regist = function ( name , keylen , pHex , aHex , bHex , nHex , hHex , gxHex , gyHex , aliasList , oid , info ) {
-100 db [ name ] = { } ;
-101 var p = hex2bi ( pHex ) ;
-102 var a = hex2bi ( aHex ) ;
-103 var b = hex2bi ( bHex ) ;
-104 var n = hex2bi ( nHex ) ;
-105 var h = hex2bi ( hHex ) ;
-106 var curve = new ECCurveFp ( p , a , b ) ;
-107 var G = curve.decodePointHex ( "04" + gxHex + gyHex ) ;
-108 db [ name ] [ 'name' ] = name ;
-109 db [ name ] [ 'keylen' ] = keylen ;
-110 db [ name ] [ 'curve' ] = curve ;
-111 db [ name ] [ 'G' ] = G ;
-112 db [ name ] [ 'n' ] = n ;
-113 db [ name ] [ 'h' ] = h ;
-114 db [ name ] [ 'oid' ] = oid ;
-115 db [ name ] [ 'info' ] = info ;
-116
-117 for ( var i = 0 ; i < aliasList.length ; i ++ ) {
-118 aliasDB [ aliasList [ i ] ] = name ;
-119 }
-120 } ;
-121 } ;
-122
-123 KJUR.crypto.ECParameterDB.regist (
-124 "secp128r1" , // name / p = 2^128 - 2^97 - 1
-125 128 ,
-126 "FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF" , // p
-127 "FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC" , // a
-128 "E87579C11079F43DD824993C2CEE5ED3" , // b
-129 "FFFFFFFE0000000075A30D1B9038A115" , // n
-130 "1" , // h
-131 "161FF7528B899B2D0C28607CA52C5B86" , // gx
-132 "CF5AC8395BAFEB13C02DA292DDED7A83" , // gy
-133 [ ] , // alias
-134 "" , // oid (underconstruction)
-135 "secp128r1 : SECG curve over a 128 bit prime field" ) ; // info
-136
-137 KJUR.crypto.ECParameterDB.regist (
-138 "secp160k1" , // name / p = 2^160 - 2^32 - 2^14 - 2^12 - 2^9 - 2^8 - 2^7 - 2^3 - 2^2 - 1
-139 160 ,
-140 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73" , // p
-141 "0" , // a
-142 "7" , // b
-143 "0100000000000000000001B8FA16DFAB9ACA16B6B3" , // n
-144 "1" , // h
-145 "3B4C382CE37AA192A4019E763036F4F5DD4D7EBB" , // gx
-146 "938CF935318FDCED6BC28286531733C3F03C4FEE" , // gy
-147 [ ] , // alias
-148 "" , // oid
-149 "secp160k1 : SECG curve over a 160 bit prime field" ) ; // info
-150
-151 KJUR.crypto.ECParameterDB.regist (
-152 "secp160r1" , // name / p = 2^160 - 2^31 - 1
-153 160 ,
-154 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF" , // p
-155 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC" , // a
-156 "1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45" , // b
-157 "0100000000000000000001F4C8F927AED3CA752257" , // n
-158 "1" , // h
-159 "4A96B5688EF573284664698968C38BB913CBFC82" , // gx
-160 "23A628553168947D59DCC912042351377AC5FB32" , // gy
-161 [ ] , // alias
-162 "" , // oid
-163 "secp160r1 : SECG curve over a 160 bit prime field" ) ; // info
-164
-165 KJUR.crypto.ECParameterDB.regist (
-166 "secp192k1" , // name / p = 2^192 - 2^32 - 2^12 - 2^8 - 2^7 - 2^6 - 2^3 - 1
-167 192 ,
-168 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37" , // p
-169 "0" , // a
-170 "3" , // b
-171 "FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D" , // n
-172 "1" , // h
-173 "DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D" , // gx
-174 "9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D" , // gy
-175 [ ] ) ; // alias
-176
-177 KJUR.crypto.ECParameterDB.regist (
-178 "secp192r1" , // name / p = 2^192 - 2^64 - 1
-179 192 ,
-180 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF" , // p
-181 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC" , // a
-182 "64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1" , // b
-183 "FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831" , // n
-184 "1" , // h
-185 "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012" , // gx
-186 "07192B95FFC8DA78631011ED6B24CDD573F977A11E794811" , // gy
-187 [ ] ) ; // alias
-188
-189 KJUR.crypto.ECParameterDB.regist (
-190 "secp224r1" , // name / p = 2^224 - 2^96 + 1
-191 224 ,
-192 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001" , // p
-193 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE" , // a
-194 "B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4" , // b
-195 "FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D" , // n
-196 "1" , // h
-197 "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21" , // gx
-198 "BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34" , // gy
-199 [ ] ) ; // alias
-200
-201 KJUR.crypto.ECParameterDB.regist (
-202 "secp256k1" , // name / p = 2^256 - 2^32 - 2^9 - 2^8 - 2^7 - 2^6 - 2^4 - 1
-203 256 ,
-204 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F" , // p
-205 "0" , // a
-206 "7" , // b
-207 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141" , // n
-208 "1" , // h
-209 "79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798" , // gx
-210 "483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8" , // gy
-211 [ ] ) ; // alias
-212
-213 KJUR.crypto.ECParameterDB.regist (
-214 "secp256r1" , // name / p = 2^224 (2^32 - 1) + 2^192 + 2^96 - 1
-215 256 ,
-216 "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF" , // p
-217 "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC" , // a
-218 "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B" , // b
-219 "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551" , // n
-220 "1" , // h
-221 "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296" , // gx
-222 "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5" , // gy
-223 [ "NIST P-256" , "P-256" , "prime256v1" ] ) ; // alias
-224
-225 KJUR.crypto.ECParameterDB.regist (
-226 "secp384r1" , // name
-227 384 ,
-228 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF" , // p
-229 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC" , // a
-230 "B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF" , // b
-231 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973" , // n
-232 "1" , // h
-233 "AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7" , // gx
-234 "3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f" , // gy
-235 [ "NIST P-384" , "P-384" ] ) ; // alias
-236
-237 KJUR.crypto.ECParameterDB.regist (
-238 "secp521r1" , // name
-239 521 ,
-240 "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" , // p
-241 "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC" , // a
-242 "051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00" , // b
-243 "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409" , // n
-244 "1" , // h
-245 "C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66" , // gx
-246 "011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650" , // gy
-247 [ "NIST P-521" , "P-521" ] ) ; // alias
-248
-249
\ No newline at end of file
diff --git a/jwt/api/symbols/src/jws-3.3.js.html b/jwt/api/symbols/src/jws-3.3.js.html
deleted file mode 100644
index 75376ac..0000000
--- a/jwt/api/symbols/src/jws-3.3.js.html
+++ /dev/null
@@ -1,1053 +0,0 @@
-
1 /*! jws-3.3.4 (c) 2013-2016 Kenji Urushima | kjur.github.com/jsrsasign/license
- 2 */
- 3 /*
- 4 * jws.js - JSON Web Signature(JWS) and JSON Web Token(JWT) Class
- 5 *
- 6 * version: 3.3.4 (2016 May 17)
- 7 *
- 8 * Copyright (c) 2010-2016 Kenji Urushima (kenji.urushima@gmail.com)
- 9 *
- 10 * This software is licensed under the terms of the MIT License.
- 11 * http://kjur.github.com/jsrsasign/license/
- 12 *
- 13 * The above copyright and license notice shall be
- 14 * included in all copies or substantial portions of the Software.
- 15 */
- 16
- 17 /**
- 18 * @fileOverview
- 19 * @name jws-3.3.js
- 20 * @author Kenji Urushima kenji.urushima@gmail.com
- 21 * @version 3.3.4 (2016-May-17)
- 22 * @since jsjws 1.0, jsrsasign 4.8.0
- 23 * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a>
- 24 */
- 25
- 26 if ( typeof KJUR == "undefined" || ! KJUR ) KJUR = { } ;
- 27
- 28 /**
- 29 * kjur's JSON Web Signature/Token(JWS/JWT) library name space
- 30 * <p>
- 31 * This namespace privides following JWS/JWS related classes.
- 32 * <ul>
- 33 * <li>{@link KJUR.jws.JWS} - JSON Web Signature/Token(JWS/JWT) class</li>
- 34 * <li>{@link KJUR.jws.JWSJS} - JWS JSON Serialization(JWSJS) class</li>
- 35 * <li>{@link KJUR.jws.IntDate} - UNIX origin time utility class</li>
- 36 * </ul>
- 37 * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.
- 38 * </p>
- 39 * @name KJUR.jws
- 40 * @namespace
- 41 */
- 42 if ( typeof KJUR.jws == "undefined" || ! KJUR.jws ) KJUR.jws = { } ;
- 43
- 44 /**
- 45 * JSON Web Signature(JWS) class.<br/>
- 46 * @name KJUR.jws.JWS
- 47 * @class JSON Web Signature(JWS) class
- 48 * @see <a href="http://kjur.github.com/jsjws/">'jwjws'(JWS JavaScript Library) home page http://kjur.github.com/jsjws/</a>
- 49 * @see <a href="http://kjur.github.com/jsrsasigns/">'jwrsasign'(RSA Sign JavaScript Library) home page http://kjur.github.com/jsrsasign/</a>
- 50 * @see <a href="http://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-14">IETF I-D JSON Web Algorithms (JWA)</a>
- 51 * @since jsjws 1.0
- 52 * @description
- 53 * This class provides JSON Web Signature(JWS)/JSON Web Token(JWT) signing and validation.
- 54 * <h4>Supported Algorithms</h4>
- 55 * Here is supported algorithm names for {@link KJUR.jws.JWS.sign} and {@link KJUR.jws.JWS.verify}
- 56 * methods.
- 57 * <table>
- 58 * <tr><th>alg value</th><th>spec requirement</th><th>jsjws support</th></tr>
- 59 * <tr><td>HS256</td><td>REQUIRED</td><td>SUPPORTED</td></tr>
- 60 * <tr><td>HS384</td><td>OPTIONAL</td><td>SUPPORTED</td></tr>
- 61 * <tr><td>HS512</td><td>OPTIONAL</td><td>SUPPORTED</td></tr>
- 62 * <tr><td>RS256</td><td>RECOMMENDED</td><td>SUPPORTED</td></tr>
- 63 * <tr><td>RS384</td><td>OPTIONAL</td><td>SUPPORTED</td></tr>
- 64 * <tr><td>RS512</td><td>OPTIONAL</td><td>SUPPORTED</td></tr>
- 65 * <tr><td>ES256</td><td>RECOMMENDED+</td><td>SUPPORTED</td></tr>
- 66 * <tr><td>ES384</td><td>OPTIONAL</td><td>SUPPORTED</td></tr>
- 67 * <tr><td>ES512</td><td>OPTIONAL</td><td>-</td></tr>
- 68 * <tr><td>PS256</td><td>OPTIONAL</td><td>SUPPORTED</td></tr>
- 69 * <tr><td>PS384</td><td>OPTIONAL</td><td>SUPPORTED</td></tr>
- 70 * <tr><td>PS512</td><td>OPTIONAL</td><td>SUPPORTED</td></tr>
- 71 * <tr><td>none</td><td>REQUIRED</td><td>SUPPORTED(signature generation only)</td></tr>
- 72 * </table>
- 73 * <dl>
- 74 * <dt><b>NOTE1</b>
- 75 * <dd>HS384 is supported since jsjws 3.0.2 with jsrsasign 4.1.4.
- 76 * <dt><b>NOTE2</b>
- 77 * <dd>Some deprecated methods have been removed since jws 3.3 of jsrsasign 4.10.0.
- 78 * Removed methods are following:
- 79 * <ul>
- 80 * <li>JWS.verifyJWSByNE</li>
- 81 * <li>JWS.verifyJWSByKey</li>
- 82 * <li>JWS.generateJWSByNED</li>
- 83 * <li>JWS.generateJWSByKey</li>
- 84 * <li>JWS.generateJWSByP1PrvKey</li>
- 85 * </ul>
- 86 * </dl>
- 87 * <b>EXAMPLE</b><br/>
- 88 * @example
- 89 * // JWS signing
- 90 * sJWS = KJUR.jws.JWS.sign(null, '{"alg":"HS256", "cty":"JWT"}', '{"age": 21}', "password");
- 91 * // JWS validation
- 92 * isValid = KJUR.jws.JWS.verify('eyJjdHkiOiJKV1QiLCJhbGc...', "password");
- 93 * // JWT validation
- 94 * isValid = KJUR.jws.JWS.verifyJWT('eyJh...', "password", {
- 95 * alg: ['HS256', 'HS384'],
- 96 * iss: ['http://foo.com']
- 97 * });
- 98 */
- 99 KJUR.jws.JWS = function ( ) {
-100 var ns1 = KJUR.jws.JWS ;
-101
-102 // === utility =============================================================
-103
-104 /**
-105 * parse JWS string and set public property 'parsedJWS' dictionary.<br/>
-106 * @name parseJWS
-107 * @memberOf KJUR.jws.JWS
-108 * @function
-109 * @param {String} sJWS JWS signature string to be parsed.
-110 * @throws if sJWS is not comma separated string such like "Header.Payload.Signature".
-111 * @throws if JWS Header is a malformed JSON string.
-112 * @since jws 1.1
-113 */
-114 this.parseJWS = function ( sJWS , sigValNotNeeded ) {
-115 if ( ( this.parsedJWS !== undefined ) &&
-116 ( sigValNotNeeded || ( this.parsedJWS.sigvalH !== undefined ) ) ) {
-117 return ;
-118 }
-119 if ( sJWS.match ( /^([^.]+)\.([^.]+)\.([^.]+)$/ ) == null ) {
-120 throw "JWS signature is not a form of 'Head.Payload.SigValue'." ;
-121 }
-122 var b6Head = RegExp.$1 ;
-123 var b6Payload = RegExp.$2 ;
-124 var b6SigVal = RegExp.$3 ;
-125 var sSI = b6Head + "." + b6Payload ;
-126 this.parsedJWS = { } ;
-127 this.parsedJWS.headB64U = b6Head ;
-128 this.parsedJWS.payloadB64U = b6Payload ;
-129 this.parsedJWS.sigvalB64U = b6SigVal ;
-130 this.parsedJWS.si = sSI ;
-131
-132 if ( ! sigValNotNeeded ) {
-133 var hSigVal = b64utohex ( b6SigVal ) ;
-134 var biSigVal = parseBigInt ( hSigVal , 16 ) ;
-135 this.parsedJWS.sigvalH = hSigVal ;
-136 this.parsedJWS.sigvalBI = biSigVal ;
-137 }
-138
-139 var sHead = b64utoutf8 ( b6Head ) ;
-140 var sPayload = b64utoutf8 ( b6Payload ) ;
-141 this.parsedJWS.headS = sHead ;
-142 this.parsedJWS.payloadS = sPayload ;
-143
-144 if ( ! ns1.isSafeJSONString ( sHead , this.parsedJWS , 'headP' ) )
-145 throw "malformed JSON string for JWS Head: " + sHead ;
-146 } ;
-147 } ;
-148
-149 // === major static method ========================================================
-150
-151 /**
-152 * generate JWS signature by specified key<br/>
-153 * @name sign
-154 * @memberOf KJUR.jws.JWS
-155 * @function
-156 * @static
-157 * @param {String} alg JWS algorithm name to sign and force set to sHead or null
-158 * @param {String} spHead string or object of JWS Header
-159 * @param {String} spPayload string or object of JWS Payload
-160 * @param {String} key string of private key or mac key object to sign
-161 * @param {String} pass (OPTION)passcode to use encrypted asymmetric private key
-162 * @return {String} JWS signature string
-163 * @since jws 3.0.0
-164 * @see <a href="http://kjur.github.io/jsrsasign/api/symbols/KJUR.crypto.Signature.html">jsrsasign KJUR.crypto.Signature method</a>
-165 * @see <a href="http://kjur.github.io/jsrsasign/api/symbols/KJUR.crypto.Mac.html">jsrsasign KJUR.crypto.Mac method</a>
-166 * @description
-167 * This method supports following algorithms.
-168 * <table>
-169 * <tr><th>alg value</th><th>spec requirement</th><th>jsjws support</th></tr>
-170 * <tr><td>HS256</td><td>REQUIRED</td><td>SUPPORTED</td></tr>
-171 * <tr><td>HS384</td><td>OPTIONAL</td><td>SUPPORTED</td></tr>
-172 * <tr><td>HS512</td><td>OPTIONAL</td><td>SUPPORTED</td></tr>
-173 * <tr><td>RS256</td><td>RECOMMENDED</td><td>SUPPORTED</td></tr>
-174 * <tr><td>RS384</td><td>OPTIONAL</td><td>SUPPORTED</td></tr>
-175 * <tr><td>RS512</td><td>OPTIONAL</td><td>SUPPORTED</td></tr>
-176 * <tr><td>ES256</td><td>RECOMMENDED+</td><td>SUPPORTED</td></tr>
-177 * <tr><td>ES384</td><td>OPTIONAL</td><td>SUPPORTED</td></tr>
-178 * <tr><td>ES512</td><td>OPTIONAL</td><td>-</td></tr>
-179 * <tr><td>PS256</td><td>OPTIONAL</td><td>SUPPORTED</td></tr>
-180 * <tr><td>PS384</td><td>OPTIONAL</td><td>SUPPORTED</td></tr>
-181 * <tr><td>PS512</td><td>OPTIONAL</td><td>SUPPORTED</td></tr>
-182 * <tr><td>none</td><td>REQUIRED</td><td>SUPPORTED(signature generation only)</td></tr>
-183 * </table>
-184 * <dl>
-185 * <dt>NOTE1:
-186 * <dd>salt length of RSAPSS signature is the same as the hash algorithm length
-187 * because of <a href="http://www.ietf.org/mail-archive/web/jose/current/msg02901.html">IETF JOSE ML discussion</a>.
-188 * <dt>NOTE2:
-189 * <dd>To support HS384, patched version of CryptoJS is used.
-190 * <a href="https://code.google.com/p/crypto-js/issues/detail?id=84">See here for detail</a>.
-191 * <dt>NOTE3:
-192 * From jsrsasign 4.10.0 jws 3.3.0, Way to provide password
-193 * for HS* algorithm is changed. The 'key' attribute value is
-194 * passed to {@link KJUR.crypto.Mac.setPassword} so please see
-195 * {@link KJUR.crypto.Mac.setPassword} for detail.
-196 * As for backword compatibility, if key is a string, has even length and
-197 * 0..9, A-F or a-f characters, key string is treated as a hexadecimal
-198 * otherwise it is treated as a raw string.
-199 * <dd>
-200 * </dl>
-201 * <b>EXAMPLE</b><br/>
-202 * @example
-203 * // sign HS256 signature with password "aaa" implicitly handled as string
-204 * sJWS = KJUR.jws.JWS.sign(null, {alg: "HS256", cty: "JWT"}, {age: 21}, "aaa");
-205 * // sign HS256 signature with password "6161" implicitly handled as hex
-206 * sJWS = KJUR.jws.JWS.sign(null, {alg: "HS256", cty: "JWT"}, {age: 21}, "6161");
-207 * // sign HS256 signature with base64 password
-208 * sJWS = KJUR.jws.JWS.sign(null, {alg: "HS256"}, {age: 21}, {b64: "Mi/8..a="});
-209 * // sign RS256 signature with PKCS#8 PEM RSA private key
-210 * sJWS = KJUR.jws.JWS.sign(null, {alg: "RS256"}, {age: 21}, "-----BEGIN PRIVATE KEY...");
-211 * // sign RS256 signature with PKCS#8 PEM ECC private key with passcode
-212 * sJWS = KJUR.jws.JWS.sign(null, {alg: "ES256"}, {age: 21},
-213 * "-----BEGIN PRIVATE KEY...", "keypass");
-214 * // header and payload can be passed by both string and object
-215 * sJWS = KJUR.jws.JWS.sign(null, '{alg:"HS256",cty:"JWT"}', '{age:21}', "aaa");
-216 */
-217 KJUR.jws.JWS.sign = function ( alg , spHeader , spPayload , key , pass ) {
-218 var ns1 = KJUR.jws.JWS ;
-219 var sHeader , pHeader , sPayload ;
-220
-221 // 1. check signatureInput(Header, Payload) is string or object
-222 if ( typeof spHeader != 'string' && typeof spHeader != 'object' )
-223 throw "spHeader must be JSON string or object: " + spHeader ;
-224
-225 if ( typeof spHeader == 'object' ) {
-226 pHeader = spHeader ;
-227 sHeader = JSON.stringify ( pHeader ) ;
-228 }
-229
-230 if ( typeof spHeader == 'string' ) {
-231 sHeader = spHeader ;
-232 if ( ! ns1.isSafeJSONString ( sHeader ) )
-233 throw "JWS Head is not safe JSON string: " + sHeader ;
-234 pHeader = ns1.readSafeJSONString ( sHeader ) ;
-235
-236 }
-237
-238 sPayload = spPayload ;
-239 if ( typeof spPayload == 'object' ) sPayload = JSON.stringify ( spPayload ) ;
-240
-241 // 2. use alg if defined in sHeader
-242 if ( ( alg == '' || alg == null ) &&
-243 pHeader [ 'alg' ] !== undefined ) {
-244 alg = pHeader [ 'alg' ] ;
-245 }
-246
-247 // 3. update sHeader to add alg if alg undefined
-248 if ( ( alg != '' && alg != null ) &&
-249 pHeader [ 'alg' ] === undefined ) {
-250 pHeader [ 'alg' ] = alg ;
-251 sHeader = JSON.stringify ( pHeader ) ;
-252 }
-253
-254 // 4. check explicit algorithm doesn't match with JWS header.
-255 if ( alg !== pHeader.alg )
-256 throw "alg and sHeader.alg doesn't match: " + alg + "!=" + pHeader.alg ;
-257
-258 // 5. set signature algorithm like SHA1withRSA
-259 var sigAlg = null ;
-260 if ( ns1.jwsalg2sigalg [ alg ] === undefined ) {
-261 throw "unsupported alg name: " + alg ;
-262 } else {
-263 sigAlg = ns1.jwsalg2sigalg [ alg ] ;
-264 }
-265
-266 var uHeader = utf8tob64u ( sHeader ) ;
-267 var uPayload = utf8tob64u ( sPayload ) ;
-268 var uSignatureInput = uHeader + "." + uPayload
-269 // 6. sign
-270 var hSig = "" ;
-271 if ( sigAlg.substr ( 0 , 4 ) == "Hmac" ) {
-272 if ( key === undefined )
-273 throw "mac key shall be specified for HS* alg" ;
-274 //alert("sigAlg=" + sigAlg);
-275 var mac = new KJUR.crypto.Mac ( { 'alg' : sigAlg , 'prov' : 'cryptojs' , 'pass' : key } ) ;
-276 mac.updateString ( uSignatureInput ) ;
-277 hSig = mac.doFinal ( ) ;
-278 } else if ( sigAlg.indexOf ( "withECDSA" ) != - 1 ) {
-279 var sig = new KJUR.crypto.Signature ( { 'alg' : sigAlg } ) ;
-280 sig.init ( key , pass ) ;
-281 sig.updateString ( uSignatureInput ) ;
-282 hASN1Sig = sig.sign ( ) ;
-283 hSig = KJUR.crypto.ECDSA.asn1SigToConcatSig ( hASN1Sig ) ;
-284 } else if ( sigAlg != "none" ) {
-285 var sig = new KJUR.crypto.Signature ( { 'alg' : sigAlg } ) ;
-286 sig.init ( key , pass ) ;
-287 sig.updateString ( uSignatureInput ) ;
-288 hSig = sig.sign ( ) ;
-289 }
-290
-291 var uSig = hextob64u ( hSig ) ;
-292 return uSignatureInput + "." + uSig ;
-293 } ;
-294
-295 /**
-296 * verify JWS signature by specified key or certificate<br/>
-297 * @name verify
-298 * @memberOf KJUR.jws.JWS
-299 * @function
-300 * @static
-301 * @param {String} sJWS string of JWS signature to verify
-302 * @param {Object} key string of public key, certificate or key object to verify
-303 * @param {String} acceptAlgs array of algorithm name strings (OPTION)
-304 * @return {Boolean} true if the signature is valid otherwise false
-305 * @since jws 3.0.0
-306 * @see <a href="http://kjur.github.io/jsrsasign/api/symbols/KJUR.crypto.Signature.html">jsrsasign KJUR.crypto.Signature method</a>
-307 * @see <a href="http://kjur.github.io/jsrsasign/api/symbols/KJUR.crypto.Mac.html">jsrsasign KJUR.crypto.Mac method</a>
-308 * @description
-309 * <p>
-310 * This method verifies a JSON Web Signature Compact Serialization string by the validation
-311 * algorithm as described in
-312 * <a href="http://self-issued.info/docs/draft-jones-json-web-signature-04.html#anchor5">
-313 * the section 5 of Internet Draft draft-jones-json-web-signature-04.</a>
-314 * </p>
-315 * <p>
-316 * Since 3.2.0 strict key checking has been provided against a JWS algorithm
-317 * in a JWS header.
-318 * <ul>
-319 * <li>In case 'alg' is 'HS*' in the JWS header,
-320 * 'key' shall be hexadecimal string for Hmac{256,384,512} shared secret key.
-321 * Otherwise it raise an error.</li>
-322 * <li>In case 'alg' is 'RS*' or 'PS*' in the JWS header,
-323 * 'key' shall be a RSAKey object or a PEM string of
-324 * X.509 RSA public key certificate or PKCS#8 RSA public key.
-325 * Otherwise it raise an error.</li>
-326 * <li>In case 'alg' is 'ES*' in the JWS header,
-327 * 'key' shall be a KJUR.crypto.ECDSA object or a PEM string of
-328 * X.509 ECC public key certificate or PKCS#8 ECC public key.
-329 * Otherwise it raise an error.</li>
-330 * <li>In case 'alg' is 'none' in the JWS header,
-331 * validation not supported after jsjws 3.1.0.</li>
-332 * </ul>
-333 * </p>
-334 * <p>
-335 * NOTE1: The argument 'acceptAlgs' is supported since 3.2.0.
-336 * Strongly recommended to provide acceptAlgs to mitigate
-337 * signature replacement attacks.<br/>
-338 * </p>
-339 * <p>
-340 * NOTE2: From jsrsasign 4.9.0 jws 3.2.5, Way to provide password
-341 * for HS* algorithm is changed. The 'key' attribute value is
-342 * passed to {@link KJUR.crypto.Mac.setPassword} so please see
-343 * {@link KJUR.crypto.Mac.setPassword} for detail.
-344 * As for backword compatibility, if key is a string, has even length and
-345 * 0..9, A-F or a-f characters, key string is treated as a hexadecimal
-346 * otherwise it is treated as a raw string.
-347 * </p>
-348 * @example
-349 * // 1) verify a RS256 JWS signature by a certificate string.
-350 * isValid = KJUR.jws.JWS.verify('eyJh...', '-----BEGIN...', ['RS256']);
-351 *
-352 * // 2) verify a HS256 JWS signature by a certificate string.
-353 * isValid = KJUR.jws.JWS.verify('eyJh...', {hex: '6f62ad...'}, ['HS256']);
-354 * isValid = KJUR.jws.JWS.verify('eyJh...', {b64: 'Mi/ab8...a=='}, ['HS256']);
-355 * isValid = KJUR.jws.JWS.verify('eyJh...', {utf8: 'Secret秘密'}, ['HS256']);
-356 * isValid = KJUR.jws.JWS.verify('eyJh...', '6f62ad', ['HS256']); // implicit hex
-357 * isValid = KJUR.jws.JWS.verify('eyJh...', '6f62ada', ['HS256']); // implicit raw string
-358 *
-359 * // 3) verify a ES256 JWS signature by a KJUR.crypto.ECDSA key object.
-360 * var pubkey = KEYUTIL.getKey('-----BEGIN CERT...');
-361 * var isValid = KJUR.jws.JWS.verify('eyJh...', pubkey);
-362 */
-363 KJUR.jws.JWS.verify = function ( sJWS , key , acceptAlgs ) {
-364 var jws = KJUR.jws.JWS ;
-365 var a = sJWS.split ( "." ) ;
-366 var uHeader = a [ 0 ] ;
-367 var uPayload = a [ 1 ] ;
-368 var uSignatureInput = uHeader + "." + uPayload ;
-369 var hSig = b64utohex ( a [ 2 ] ) ;
-370
-371 // 1. parse JWS header
-372 var pHeader = jws.readSafeJSONString ( b64utoutf8 ( a [ 0 ] ) ) ;
-373 var alg = null ;
-374 var algType = null ; // HS|RS|PS|ES|no
-375 if ( pHeader.alg === undefined ) {
-376 throw "algorithm not specified in header" ;
-377 } else {
-378 alg = pHeader.alg ;
-379 algType = alg.substr ( 0 , 2 ) ;
-380 }
-381
-382 // 2. check whether alg is acceptable algorithms
-383 if ( acceptAlgs != null &&
-384 Object.prototype.toString.call ( acceptAlgs ) === '[object Array]' &&
-385 acceptAlgs.length > 0 ) {
-386 var acceptAlgStr = ":" + acceptAlgs.join ( ":" ) + ":" ;
-387 if ( acceptAlgStr.indexOf ( ":" + alg + ":" ) == - 1 ) {
-388 throw "algorithm '" + alg + "' not accepted in the list" ;
-389 }
-390 }
-391
-392 // 3. check whether key is a proper key for alg.
-393 if ( alg != "none" && key === null ) {
-394 throw "key shall be specified to verify." ;
-395 }
-396
-397 // 3.1. There is no key check for HS* because Mac will check it.
-398 // since jsrsasign 5.0.0.
-399
-400 // 3.2. convert key object if key is a public key or cert PEM string
-401 if ( typeof key == "string" &&
-402 key.indexOf ( "-----BEGIN " ) != - 1 ) {
-403 key = KEYUTIL.getKey ( key ) ;
-404 }
-405
-406 // 3.3. check whether key is RSAKey obj if alg is RS* or PS*.
-407 if ( algType == "RS" || algType == "PS" ) {
-408 if ( ! ( key instanceof RSAKey ) ) {
-409 throw "key shall be a RSAKey obj for RS* and PS* algs" ;
-410 }
-411 }
-412
-413 // 3.4. check whether key is ECDSA obj if alg is ES*.
-414 if ( algType == "ES" ) {
-415 if ( ! ( key instanceof KJUR.crypto.ECDSA ) ) {
-416 throw "key shall be a ECDSA obj for ES* algs" ;
-417 }
-418 }
-419
-420 // 3.5. check when alg is 'none'
-421 if ( alg == "none" ) {
-422 }
-423
-424 // 4. check whether alg is supported alg in jsjws.
-425 var sigAlg = null ;
-426 if ( jws.jwsalg2sigalg [ pHeader.alg ] === undefined ) {
-427 throw "unsupported alg name: " + alg ;
-428 } else {
-429 sigAlg = jws.jwsalg2sigalg [ alg ] ;
-430 }
-431
-432 // 5. verify
-433 if ( sigAlg == "none" ) {
-434 throw "not supported" ;
-435 } else if ( sigAlg.substr ( 0 , 4 ) == "Hmac" ) {
-436 var hSig2 = null ;
-437 if ( key === undefined )
-438 throw "hexadecimal key shall be specified for HMAC" ;
-439 //try {
-440 var mac = new KJUR.crypto.Mac ( { 'alg' : sigAlg , 'pass' : key } ) ;
-441 mac.updateString ( uSignatureInput ) ;
-442 hSig2 = mac.doFinal ( ) ;
-443 //} catch(ex) {};
-444 return hSig == hSig2 ;
-445 } else if ( sigAlg.indexOf ( "withECDSA" ) != - 1 ) {
-446 var hASN1Sig = null ;
-447 try {
-448 hASN1Sig = KJUR.crypto.ECDSA.concatSigToASN1Sig ( hSig ) ;
-449 } catch ( ex ) {
-450 return false ;
-451 }
-452 var sig = new KJUR.crypto.Signature ( { 'alg' : sigAlg } ) ;
-453 sig.init ( key )
-454 sig.updateString ( uSignatureInput ) ;
-455 return sig.verify ( hASN1Sig ) ;
-456 } else {
-457 var sig = new KJUR.crypto.Signature ( { 'alg' : sigAlg } ) ;
-458 sig.init ( key )
-459 sig.updateString ( uSignatureInput ) ;
-460 return sig.verify ( hSig ) ;
-461 }
-462 } ;
-463
-464 /**
-465 * parse header and payload of JWS signature<br/>
-466 * @name parse
-467 * @memberOf KJUR.jws.JWS
-468 * @function
-469 * @static
-470 * @param {String} sJWS string of JWS signature to parse
-471 * @return {Array} associative array of parsed header and payload. See below.
-472 * @throws if sJWS is malformed JWS signature
-473 * @since jws 3.3.3
-474 * @description
-475 * This method parses JWS signature string.
-476 * Resulted associative array has following properties:
-477 * <ul>
-478 * <li>headerObj - JSON object of header</li>
-479 * <li>payloadObj - JSON object of payload if payload is JSON string otherwise undefined</li>
-480 * <li>headerPP - pretty printed JSON header by stringify</li>
-481 * <li>payloadPP - pretty printed JSON payload by stringify if payload is JSON otherwise Base64URL decoded raw string of payload</li>
-482 * <li>sigHex - hexadecimal string of signature</li>
-483 * </ul>
-484 * @example
-485 * KJUR.jws.JWS.parse(sJWS) ->
-486 * {
-487 * headerObj: {"alg": "RS256", "typ": "JWS"},
-488 * payloadObj: {"product": "orange", "quantity": 100},
-489 * headerPP:
-490 * '{
-491 * "alg": "RS256",
-492 * "typ": "JWS"
-493 * }',
-494 * payloadPP:
-495 * '{
-496 * "product": "orange",
-497 * "quantity": 100
-498 * }',
-499 * sigHex: "91f3cd..."
-500 * }
-501 */
-502 KJUR.jws.JWS.parse = function ( sJWS ) {
-503 var a = sJWS.split ( "." ) ;
-504 var result = { } ;
-505 var uHeader , uPayload , uSig ;
-506 if ( a.length != 2 && a.length != 3 )
-507 throw "malformed sJWS: wrong number of '.' splitted elements" ;
-508
-509 uHeader = a [ 0 ] ;
-510 uPayload = a [ 1 ] ;
-511 if ( a.length == 3 ) uSig = a [ 2 ] ;
-512
-513 result.headerObj = KJUR.jws.JWS.readSafeJSONString ( b64utoutf8 ( uHeader ) ) ;
-514 result.payloadObj = KJUR.jws.JWS.readSafeJSONString ( b64utoutf8 ( uPayload ) ) ;
-515
-516 result.headerPP = JSON.stringify ( result.headerObj , null , " " ) ;
-517 if ( result.payloadObj == null ) {
-518 result.payloadPP = b64utoutf8 ( uPayload ) ;
-519 } else {
-520 result.payloadPP = JSON.stringify ( result.payloadObj , null , " " ) ;
-521 }
-522
-523 if ( uSig !== undefined ) {
-524 result.sigHex = b64utohex ( uSig ) ;
-525 }
-526
-527 return result ;
-528 } ;
-529
-530 /**
-531 * @name verifyJWT
-532 * @memberOf KJUR.jws.JWS
-533 * @function
-534 * @static
-535 * @param {String} sJWT string of JSON Web Token(JWT) to verify
-536 * @param {Object} key string of public key, certificate or key object to verify
-537 * @param {Array} acceptField associative array of acceptable fields (OPTION)
-538 * @return {Boolean} true if the JWT token is valid otherwise false
-539 * @since jws 3.2.3 jsrsasign 4.8.0
-540 *
-541 * @description
-542 * This method verifies a
-543 * <a href="https://tools.ietf.org/html/rfc7519">RFC 7519</a>
-544 * JSON Web Token(JWT).
-545 * It will verify following:
-546 * <ul>
-547 * <li>Header.alg
-548 * <ul>
-549 * <li>alg is specified in JWT header.</li>
-550 * <li>alg is included in acceptField.alg array. (MANDATORY)</li>
-551 * <li>alg is proper for key.</li>
-552 * </ul>
-553 * </li>
-554 * <li>Payload.iss (issuer) - Payload.iss is included in acceptField.iss array if specified. (OPTION)</li>
-555 * <li>Payload.sub (subject) - Payload.sub is included in acceptField.sub array if specified. (OPTION)</li>
-556 * <li>Payload.aud (audience) - Payload.aud is included in acceptField.aud array or
-557 * the same as value if specified. (OPTION)</li>
-558 * <li>Time validity
-559 * <ul>
-560 * <li>
-561 * If acceptField.verifyAt as number of UNIX origin time is specifed for validation time,
-562 * this method will verify at the time for it, otherwise current time will be used to verify.
-563 * </li>
-564 * <li>
-565 * Clock of JWT generator or verifier can be fast or slow. If these clocks are
-566 * very different, JWT validation may fail. To avoid such case, 'jsrsasign' supports
-567 * 'acceptField.gracePeriod' parameter which specifies acceptable time difference
-568 * of those clocks in seconds. So if you want to accept slow or fast in 2 hours,
-569 * you can specify <code>acceptField.gracePeriod = 2 * 60 * 60;</code>.
-570 * "gracePeriod" is zero by default.
-571 * "gracePeriod" is supported since jsrsasign 5.0.12.
-572 * </li>
-573 * <li>Payload.exp (expire) - Validation time is smaller than Payload.exp + gracePeriod.</li>
-574 * <li>Payload.nbf (not before) - Validation time is greater than Payload.nbf - gracePeriod.</li>
-575 * <li>Payload.iat (issued at) - Validation time is greater than Payload.iat - gracePeriod.</li>
-576 * </ul>
-577 * </li>
-578 * <li>Payload.jti (JWT id) - Payload.jti is included in acceptField.jti if specified. (OPTION)</li>
-579 * <li>JWS signature of JWS is valid for specified key.</li>
-580 * </ul>
-581 *
-582 * @example
-583 * // simple validation for HS256
-584 * isValid = KJUR.jws.JWS.verifyJWT("eyJhbG...", "616161", {alg: ["HS256"]}),
-585 *
-586 * // full validation for RS or PS
-587 * pubkey = KEYUTIL.getKey('-----BEGIN CERT...');
-588 * isValid = KJUR.jws.JWS.verifyJWT('eyJh...', pubkey, {
-589 * alg: ['RS256', 'RS512', 'PS256', 'PS512'],
-590 * iss: ['http://foo.com'],
-591 * sub: ['mailto:john@foo.com', 'mailto:alice@foo.com'],
-592 * verifyAt: KJUR.jws.IntDate.get('20150520235959Z'),
-593 * aud: ['http://foo.com'], // aud: 'http://foo.com' is fine too.
-594 * jti: 'id123456',
-595 * gracePeriod: 1 * 60 * 60 // accept 1 hour slow or fast
-596 * });
-597 */
-598 KJUR.jws.JWS.verifyJWT = function ( sJWT , key , acceptField ) {
-599 var ns1 = KJUR.jws.JWS ;
-600
-601 // 1. parse JWT
-602 var a = sJWT.split ( "." ) ;
-603 var uHeader = a [ 0 ] ;
-604 var uPayload = a [ 1 ] ;
-605 var uSignatureInput = uHeader + "." + uPayload ;
-606 var hSig = b64utohex ( a [ 2 ] ) ;
-607
-608 // 2. parse JWS header
-609 var pHeader = ns1.readSafeJSONString ( b64utoutf8 ( uHeader ) ) ;
-610
-611 // 3. parse JWS payload
-612 var pPayload = ns1.readSafeJSONString ( b64utoutf8 ( uPayload ) ) ;
-613
-614 // 4. algorithm ('alg' in header) check
-615 if ( pHeader.alg === undefined ) return false ;
-616 if ( acceptField.alg === undefined )
-617 throw "acceptField.alg shall be specified" ;
-618 if ( ! ns1.inArray ( pHeader.alg , acceptField.alg ) ) return false ;
-619
-620 // 5. issuer ('iss' in payload) check
-621 if ( pPayload.iss !== undefined && typeof acceptField.iss === "object" ) {
-622 if ( ! ns1.inArray ( pPayload.iss , acceptField.iss ) ) return false ;
-623 }
-624
-625 // 6. subject ('sub' in payload) check
-626 if ( pPayload.sub !== undefined && typeof acceptField.sub === "object" ) {
-627 if ( ! ns1.inArray ( pPayload.sub , acceptField.sub ) ) return false ;
-628 }
-629
-630 // 7. audience ('aud' in payload) check
-631 if ( pPayload.aud !== undefined && typeof acceptField.aud === "object" ) {
-632 if ( typeof pPayload.aud == "string" ) {
-633 if ( ! ns1.inArray ( pPayload.aud , acceptField.aud ) )
-634 return false ;
-635 } else if ( typeof pPayload.aud == "object" ) {
-636 if ( ! ns1.includedArray ( pPayload.aud , acceptField.aud ) )
-637 return false ;
-638 }
-639 }
-640
-641 // 8. time validity
-642 // (nbf - gracePeriod < now < exp + gracePeriod) && (iat - gracePeriod < now)
-643 var now = KJUR.jws.IntDate.getNow ( ) ;
-644 if ( acceptField.verifyAt !== undefined && typeof acceptField.verifyAt === "number" ) {
-645 now = acceptField.verifyAt ;
-646 }
-647 if ( acceptField.gracePeriod === undefined ||
-648 typeof acceptField.gracePeriod !== "number" ) {
-649 acceptField.gracePeriod = 0 ;
-650 }
-651
-652 // 8.1 expired time 'exp' check
-653 if ( pPayload.exp !== undefined && typeof pPayload.exp == "number" ) {
-654 if ( pPayload.exp + acceptField.gracePeriod < now ) return false ;
-655 }
-656
-657 // 8.2 not before time 'nbf' check
-658 if ( pPayload.nbf !== undefined && typeof pPayload.nbf == "number" ) {
-659 if ( now < pPayload.nbf - acceptField.gracePeriod ) return false ;
-660 }
-661
-662 // 8.3 issued at time 'iat' check
-663 if ( pPayload.iat !== undefined && typeof pPayload.iat == "number" ) {
-664 if ( now < pPayload.iat - acceptField.gracePeriod ) return false ;
-665 }
-666
-667 // 9 JWT id 'jti' check
-668 if ( pPayload.jti !== undefined && acceptField.jti !== undefined ) {
-669 if ( pPayload.jti !== acceptField.jti ) return false ;
-670 }
-671
-672 // 10 JWS signature check
-673 if ( ! KJUR.jws.JWS.verify ( sJWT , key , acceptField.alg ) ) return false ;
-674
-675 // 11 passed all check
-676 return true ;
-677 } ;
-678
-679 /**
-680 * check whether array is included by another array
-681 * @name includedArray
-682 * @memberOf KJUR.jws.JWS
-683 * @function
-684 * @static
-685 * @param {Array} a1 check whether set a1 is included by a2
-686 * @param {Array} a2 check whether set a1 is included by a2
-687 * @return {Boolean} check whether set a1 is included by a2
-688 * @since jws 3.2.3
-689 * This method verifies whether an array is included by another array.
-690 * It doesn't care about item ordering in a array.
-691 * @example
-692 * KJUR.jws.JWS.includedArray(['b'], ['b', 'c', 'a']) => true
-693 * KJUR.jws.JWS.includedArray(['a', 'b'], ['b', 'c', 'a']) => true
-694 * KJUR.jws.JWS.includedArray(['a', 'b'], ['b', 'c']) => false
-695 */
-696 KJUR.jws.JWS.includedArray = function ( a1 , a2 ) {
-697 var inArray = KJUR.jws.JWS.inArray ;
-698 if ( a1 === null ) return false ;
-699 if ( typeof a1 !== "object" ) return false ;
-700 if ( typeof a1.length !== "number" ) return false ;
-701
-702 for ( var i = 0 ; i < a1.length ; i ++ ) {
-703 if ( ! inArray ( a1 [ i ] , a2 ) ) return false ;
-704 }
-705 return true ;
-706 } ;
-707
-708 /**
-709 * check whether item is included by array
-710 * @name inArray
-711 * @memberOf KJUR.jws.JWS
-712 * @function
-713 * @static
-714 * @param {String} item check whether item is included by array
-715 * @param {Array} a check whether item is included by array
-716 * @return {Boolean} check whether item is included by array
-717 * @since jws 3.2.3
-718 * This method verifies whether an item is included by an array.
-719 * It doesn't care about item ordering in an array.
-720 * @example
-721 * KJUR.jws.JWS.inArray('b', ['b', 'c', 'a']) => true
-722 * KJUR.jws.JWS.inArray('a', ['b', 'c', 'a']) => true
-723 * KJUR.jws.JWS.inArray('a', ['b', 'c']) => false
-724 */
-725 KJUR.jws.JWS.inArray = function ( item , a ) {
-726 if ( a === null ) return false ;
-727 if ( typeof a !== "object" ) return false ;
-728 if ( typeof a.length !== "number" ) return false ;
-729 for ( var i = 0 ; i < a.length ; i ++ ) {
-730 if ( a [ i ] == item ) return true ;
-731 }
-732 return false ;
-733 } ;
-734
-735 /**
-736 * static associative array of general signature algorithm name from JWS algorithm name
-737 * @since jws 3.0.0
-738 */
-739 KJUR.jws.JWS.jwsalg2sigalg = {
-740 "HS256" : "HmacSHA256" ,
-741 "HS384" : "HmacSHA384" ,
-742 "HS512" : "HmacSHA512" ,
-743 "RS256" : "SHA256withRSA" ,
-744 "RS384" : "SHA384withRSA" ,
-745 "RS512" : "SHA512withRSA" ,
-746 "ES256" : "SHA256withECDSA" ,
-747 "ES384" : "SHA384withECDSA" ,
-748 //"ES512": "SHA512withECDSA", // unsupported because of jsrsasign's bug
-749 "PS256" : "SHA256withRSAandMGF1" ,
-750 "PS384" : "SHA384withRSAandMGF1" ,
-751 "PS512" : "SHA512withRSAandMGF1" ,
-752 "none" : "none" ,
-753 } ;
-754
-755 // === utility static method ==================================================
-756
-757 /**
-758 * check whether a String "s" is a safe JSON string or not.<br/>
-759 * If a String "s" is a malformed JSON string or an other object type
-760 * this returns 0, otherwise this returns 1.
-761 * @name isSafeJSONString
-762 * @memberOf KJUR.jws.JWS
-763 * @function
-764 * @static
-765 * @param {String} s JSON string
-766 * @return {Number} 1 or 0
-767 */
-768 KJUR.jws.JWS.isSafeJSONString = function ( s , h , p ) {
-769 var o = null ;
-770 try {
-771 o = jsonParse ( s ) ;
-772 if ( typeof o != "object" ) return 0 ;
-773 if ( o.constructor === Array ) return 0 ;
-774 if ( h ) h [ p ] = o ;
-775 return 1 ;
-776 } catch ( ex ) {
-777 return 0 ;
-778 }
-779 } ;
-780
-781 /**
-782 * read a String "s" as JSON object if it is safe.<br/>
-783 * If a String "s" is a malformed JSON string or not JSON string,
-784 * this returns null, otherwise returns JSON object.
-785 * @name readSafeJSONString
-786 * @memberOf KJUR.jws.JWS
-787 * @function
-788 * @static
-789 * @param {String} s JSON string
-790 * @return {Object} JSON object or null
-791 * @since 1.1.1
-792 */
-793 KJUR.jws.JWS.readSafeJSONString = function ( s ) {
-794 var o = null ;
-795 try {
-796 o = jsonParse ( s ) ;
-797 if ( typeof o != "object" ) return null ;
-798 if ( o.constructor === Array ) return null ;
-799 return o ;
-800 } catch ( ex ) {
-801 return null ;
-802 }
-803 } ;
-804
-805 /**
-806 * get Encoed Signature Value from JWS string.<br/>
-807 * @name getEncodedSignatureValueFromJWS
-808 * @memberOf KJUR.jws.JWS
-809 * @function
-810 * @static
-811 * @param {String} sJWS JWS signature string to be verified
-812 * @return {String} string of Encoded Signature Value
-813 * @throws if sJWS is not comma separated string such like "Header.Payload.Signature".
-814 */
-815 KJUR.jws.JWS.getEncodedSignatureValueFromJWS = function ( sJWS ) {
-816 if ( sJWS.match ( /^[^.]+\.[^.]+\.([^.]+)$/ ) == null ) {
-817 throw "JWS signature is not a form of 'Head.Payload.SigValue'." ;
-818 }
-819 return RegExp.$1 ;
-820 } ;
-821
-822 /**
-823 * get RFC 7638 JWK thumbprint from JWK object
-824 * @name getJWKthumbprint
-825 * @memberOf KJUR.jws.JWS
-826 * @function
-827 * @static
-828 * @param {String} o JWK object to be calculated thumbprint
-829 * @return {String} Base64 URL encoded JWK thumbprint value
-830 * @since jsrsasign 5.0.2 jws 3.3.2
-831 * @description
-832 * This method calculates JWK thmubprint for specified JWK object
-833 * as described in
-834 * <a href="https://tools.ietf.org/html/rfc7638">RFC 7638</a>.
-835 * It supports all type of "kty". (i.e. "RSA", "EC" and "oct"
-836 * (for symmetric key))
-837 * Working sample is
-838 * <a href="https://kjur.github.io/jsrsasign/sample/tool_jwktp.html">here</a>.
-839 * @example
-840 * jwk = {"kty":"RSA", "n":"0vx...", "e":"AQAB", ...};
-841 * thumbprint = KJUR.jws.JWS.getJWKthumbprint(jwk);
-842 */
-843 KJUR.jws.JWS.getJWKthumbprint = function ( o ) {
-844 if ( o.kty !== "RSA" &&
-845 o.kty !== "EC" &&
-846 o.kty !== "oct" )
-847 throw "unsupported algorithm for JWK Thumprint" ;
-848
-849 // 1. get canonically ordered json string
-850 var s = '{' ;
-851 if ( o.kty === "RSA" ) {
-852 if ( typeof o.n != "string" || typeof o.e != "string" )
-853 throw "wrong n and e value for RSA key" ;
-854 s + = '"' + 'e' + '":"' + o.e + '",' ;
-855 s + = '"' + 'kty' + '":"' + o.kty + '",' ;
-856 s + = '"' + 'n' + '":"' + o.n + '"}' ;
-857 } else if ( o.kty === "EC" ) {
-858 if ( typeof o.crv != "string" ||
-859 typeof o.x != "string" ||
-860 typeof o.y != "string" )
-861 throw "wrong crv, x and y value for EC key" ;
-862 s + = '"' + 'crv' + '":"' + o.crv + '",' ;
-863 s + = '"' + 'kty' + '":"' + o.kty + '",' ;
-864 s + = '"' + 'x' + '":"' + o.x + '",' ;
-865 s + = '"' + 'y' + '":"' + o.y + '"}' ;
-866 } else if ( o.kty === "oct" ) {
-867 if ( typeof o.k != "string" )
-868 throw "wrong k value for oct(symmetric) key" ;
-869 s + = '"' + 'kty' + '":"' + o.kty + '",' ;
-870 s + = '"' + 'k' + '":"' + o.k + '"}' ;
-871 }
-872 //alert(s);
-873
-874 // 2. get thumb print
-875 var hJWK = rstrtohex ( s ) ;
-876 var hash = KJUR.crypto.Util.hashHex ( hJWK , "sha256" ) ;
-877 var hashB64U = hextob64u ( hash ) ;
-878
-879 return hashB64U ;
-880 } ;
-881
-882 /**
-883 * IntDate class for time representation for JSON Web Token(JWT)
-884 * @class KJUR.jws.IntDate class
-885 * @name KJUR.jws.IntDate
-886 * @since jws 3.0.1
-887 * @description
-888 * Utility class for IntDate which is integer representation of UNIX origin time
-889 * used in JSON Web Token(JWT).
-890 */
-891 KJUR.jws.IntDate = { } ;
-892
-893 /**
-894 * get UNIX origin time from by string
-895 * @name get
-896 * @memberOf KJUR.jws.IntDate
-897 * @function
-898 * @static
-899 * @param {String} s string of time representation
-900 * @return {Integer} UNIX origin time in seconds for argument 's'
-901 * @since jws 3.0.1
-902 * @throws "unsupported format: s" when malformed format
-903 * @description
-904 * This method will accept following representation of time.
-905 * <ul>
-906 * <li>now - current time</li>
-907 * <li>now + 1hour - after 1 hour from now</li>
-908 * <li>now + 1day - after 1 day from now</li>
-909 * <li>now + 1month - after 30 days from now</li>
-910 * <li>now + 1year - after 365 days from now</li>
-911 * <li>YYYYmmDDHHMMSSZ - UTC time (ex. 20130828235959Z)</li>
-912 * <li>number - UNIX origin time (seconds from 1970-01-01 00:00:00) (ex. 1377714748)</li>
-913 * </ul>
-914 */
-915 KJUR.jws.IntDate.get = function ( s ) {
-916 if ( s == "now" ) {
-917 return KJUR.jws.IntDate.getNow ( ) ;
-918 } else if ( s == "now + 1hour" ) {
-919 return KJUR.jws.IntDate.getNow ( ) + 60 * 60 ;
-920 } else if ( s == "now + 1day" ) {
-921 return KJUR.jws.IntDate.getNow ( ) + 60 * 60 * 24 ;
-922 } else if ( s == "now + 1month" ) {
-923 return KJUR.jws.IntDate.getNow ( ) + 60 * 60 * 24 * 30 ;
-924 } else if ( s == "now + 1year" ) {
-925 return KJUR.jws.IntDate.getNow ( ) + 60 * 60 * 24 * 365 ;
-926 } else if ( s.match ( /Z$/ ) ) {
-927 return KJUR.jws.IntDate.getZulu ( s ) ;
-928 } else if ( s.match ( /^[0-9]+$/ ) ) {
-929 return parseInt ( s ) ;
-930 }
-931 throw "unsupported format: " + s ;
-932 } ;
-933
-934 /**
-935 * get UNIX origin time from Zulu time representation string
-936 * @name getZulu
-937 * @memberOf KJUR.jws.IntDate
-938 * @function
-939 * @static
-940 * @param {String} s string of Zulu time representation (ex. 20151012125959Z)
-941 * @return {Integer} UNIX origin time in seconds for argument 's'
-942 * @since jws 3.0.1
-943 * @throws "unsupported format: s" when malformed format
-944 * @description
-945 * This method provides UNIX origin time from Zulu time.
-946 * Following representations are supported:
-947 * <ul>
-948 * <li>YYYYMMDDHHmmSSZ - GeneralizedTime format</li>
-949 * <li>YYMMDDHHmmSSZ - UTCTime format. If YY is greater or equal to
-950 * 50 then it represents 19YY otherwise 20YY.</li>
-951 * </ul>
-952 * @example
-953 * KJUR.jws.IntDate.getZulu("20151012125959Z") => 1478...
-954 * KJUR.jws.IntDate.getZulu("151012125959Z") => 1478...
-955 */
-956 KJUR.jws.IntDate.getZulu = function ( s ) {
-957 var a ;
-958 if ( a = s.match ( /(\d+)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)Z/ ) ) {
-959 var sYear = RegExp.$1 ;
-960 var year = parseInt ( sYear ) ;
-961 if ( sYear.length == 4 ) {
-962 } else if ( sYear.length == 2 ) {
-963 if ( 50 <= year && year < 100 ) {
-964 year = 1900 + year ;
-965 } else if ( 0 <= year && year < 50 ) {
-966 year = 2000 + year ;
-967 } else {
-968 throw "malformed year string for UTCTime" ;
-969 }
-970 } else {
-971 throw "malformed year string" ;
-972 }
-973 var month = parseInt ( RegExp.$2 ) - 1 ;
-974 var day = parseInt ( RegExp.$3 ) ;
-975 var hour = parseInt ( RegExp.$4 ) ;
-976 var min = parseInt ( RegExp.$5 ) ;
-977 var sec = parseInt ( RegExp.$6 ) ;
-978 var d = new Date ( Date.UTC ( year , month , day , hour , min , sec ) ) ;
-979 return ~ ~ ( d / 1000 ) ;
-980 }
-981 throw "unsupported format: " + s ;
-982 } ;
-983
-984 /**
-985 * get UNIX origin time of current time
-986 * @name getNow
-987 * @memberOf KJUR.jws.IntDate
-988 * @function
-989 * @static
-990 * @return {Integer} UNIX origin time for current time
-991 * @since jws 3.0.1
-992 * @description
-993 * This method provides UNIX origin time for current time
-994 * @example
-995 * KJUR.jws.IntDate.getNow() => 1478...
-996 */
-997 KJUR.jws.IntDate.getNow = function ( ) {
-998 var d = ~ ~ ( new Date ( ) / 1000 ) ;
-999 return d ;
-1000 } ;
-1001
-1002 /**
-1003 * get UTC time string from UNIX origin time value
-1004 * @name intDate2UTCString
-1005 * @memberOf KJUR.jws.IntDate
-1006 * @function
-1007 * @static
-1008 * @param {Integer} intDate UNIX origin time value (ex. 1478...)
-1009 * @return {String} UTC time string
-1010 * @since jws 3.0.1
-1011 * @description
-1012 * This method provides UTC time string for UNIX origin time value.
-1013 * @example
-1014 * KJUR.jws.IntDate.intDate2UTCString(1478...) => "2015 Oct ..."
-1015 */
-1016 KJUR.jws.IntDate.intDate2UTCString = function ( intDate ) {
-1017 var d = new Date ( intDate * 1000 ) ;
-1018 return d.toUTCString ( ) ;
-1019 } ;
-1020
-1021 /**
-1022 * get UTC time string from UNIX origin time value
-1023 * @name intDate2Zulu
-1024 * @memberOf KJUR.jws.IntDate
-1025 * @function
-1026 * @static
-1027 * @param {Integer} intDate UNIX origin time value (ex. 1478...)
-1028 * @return {String} Zulu time string
-1029 * @since jws 3.0.1
-1030 * @description
-1031 * This method provides Zulu time string for UNIX origin time value.
-1032 * @example
-1033 * KJUR.jws.IntDate.intDate2UTCString(1478...) => "20151012...Z"
-1034 */
-1035 KJUR.jws.IntDate.intDate2Zulu = function ( intDate ) {
-1036 var d = new Date ( intDate * 1000 ) ;
-1037 var year = ( "0000" + d.getUTCFullYear ( ) ) . slice ( - 4 ) ;
-1038 var mon = ( "00" + ( d.getUTCMonth ( ) + 1 ) ) . slice ( - 2 ) ;
-1039 var day = ( "00" + d.getUTCDate ( ) ) . slice ( - 2 ) ;
-1040 var hour = ( "00" + d.getUTCHours ( ) ) . slice ( - 2 ) ;
-1041 var min = ( "00" + d.getUTCMinutes ( ) ) . slice ( - 2 ) ;
-1042 var sec = ( "00" + d.getUTCSeconds ( ) ) . slice ( - 2 ) ;
-1043 return year + mon + day + hour + min + sec + "Z" ;
-1044 } ;
-1045
-1046
\ No newline at end of file
diff --git a/jwt/api/symbols/src/jwsjs-2.0.js.html b/jwt/api/symbols/src/jwsjs-2.0.js.html
deleted file mode 100644
index db2e270..0000000
--- a/jwt/api/symbols/src/jwsjs-2.0.js.html
+++ /dev/null
@@ -1,211 +0,0 @@
-
1 /*! jwsjs-2.0.2 (c) 2010-2015 Kenji Urushima | kjur.github.com/jsrsasign/license
- 2 */
- 3 /*
- 4 * jwsjs.js - JSON Web Signature JSON Serialization (JWSJS) Class
- 5 *
- 6 * version: 2.0.2 (2015 May 29)
- 7 *
- 8 * Copyright (c) 2010-2015 Kenji Urushima (kenji.urushima@gmail.com)
- 9 *
- 10 * This software is licensed under the terms of the MIT License.
- 11 * http://kjur.github.com/jsrsasign/license/
- 12 *
- 13 * The above copyright and license notice shall be
- 14 * included in all copies or substantial portions of the Software.
- 15 */
- 16
- 17 /**
- 18 * @fileOverview
- 19 * @name jwsjs-2.0.js
- 20 * @author Kenji Urushima kenji.urushima@gmail.com
- 21 * @version 2.0.2 (2015 May 29)
- 22 * @since jsjws 1.2, jsrsasign 4.8.0
- 23 * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a>
- 24 */
- 25
- 26 if ( typeof KJUR == "undefined" || ! KJUR ) KJUR = { } ;
- 27 if ( typeof KJUR.jws == "undefined" || ! KJUR.jws ) KJUR.jws = { } ;
- 28
- 29 /**
- 30 * JSON Web Signature JSON Serialization (JWSJS) class.<br/>
- 31 * @class JSON Web Signature JSON Serialization (JWSJS) class
- 32 * @name KJUR.jws.JWSJS
- 33 * @property {array of String} aHeader array of Encoded JWS Headers
- 34 * @property {String} sPayload Encoded JWS payload
- 35 * @property {array of String} aSignature array of Encoded JWS signature value
- 36 * @author Kenji Urushima
- 37 * @version 1.0 (18 May 2012)
- 38 * @requires base64x.js, json-sans-eval.js, jws.js and jsrsasign library
- 39 * @see <a href="http://kjur.github.com/jsjws/">'jwjws'(JWS JavaScript Library) home page http://kjur.github.com/jsjws/</a>
- 40 * @see <a href="http://kjur.github.com/jsrsasigns/">'jwrsasign'(RSA Sign JavaScript Library) home page http://kjur.github.com/jsrsasign/</a>
- 41 * @see <a href="http://tools.ietf.org/html/draft-jones-json-web-signature-json-serialization-01">IETF I-D JSON Web Signature JSON Serialization (JWS-JS) specification</a>
- 42 */
- 43 KJUR.jws.JWSJS = function ( ) {
- 44 var ns1 = KJUR.jws.JWS ;
- 45
- 46 this.aHeader = [ ] ;
- 47 this.sPayload = "" ;
- 48 this.aSignature = [ ] ;
- 49
- 50 // == initialize ===================================================================
- 51 /**
- 52 * (re-)initialize this object.<br/>
- 53 * @name init
- 54 * @memberOf KJUR.jws.JWSJS
- 55 * @function
- 56 */
- 57 this.init = function ( ) {
- 58 this.aHeader = [ ] ;
- 59 this.sPayload = "" ;
- 60 this.aSignature = [ ] ;
- 61 } ;
- 62
- 63 /**
- 64 * (re-)initialize and set first signature with JWS.<br/>
- 65 * @name initWithJWS
- 66 * @memberOf KJUR.jws.JWSJS
- 67 * @param {String} sJWS JWS signature to set
- 68 * @function
- 69 */
- 70 this.initWithJWS = function ( sJWS ) {
- 71 this.init ( ) ;
- 72
- 73 var jws = new KJUR.jws.JWS ( ) ;
- 74 jws.parseJWS ( sJWS ) ;
- 75
- 76 this.aHeader.push ( jws.parsedJWS.headB64U ) ;
- 77 this.sPayload = jws.parsedJWS.payloadB64U ;
- 78 this.aSignature.push ( jws.parsedJWS.sigvalB64U ) ;
- 79 } ;
- 80
- 81 // == add signature ===================================================================
- 82 /**
- 83 * add a signature to existing JWS-JS by Header and PKCS1 private key.<br/>
- 84 * @name addSignatureByHeaderKey
- 85 * @memberOf KJUR.jws.JWSJS
- 86 * @function
- 87 * @param {String} sHead JSON string of JWS Header for adding signature.
- 88 * @param {String} sPemPrvKey string of PKCS1 private key
- 89 */
- 90 this.addSignatureByHeaderKey = function ( sHead , sPemPrvKey ) {
- 91 var sPayload = b64utoutf8 ( this.sPayload ) ;
- 92
- 93 var jws = new KJUR.jws.JWS ( ) ;
- 94 var sJWS = jws.generateJWSByP1PrvKey ( sHead , sPayload , sPemPrvKey ) ;
- 95
- 96 this.aHeader.push ( jws.parsedJWS.headB64U ) ;
- 97 this.aSignature.push ( jws.parsedJWS.sigvalB64U ) ;
- 98 } ;
- 99
-100 /**
-101 * add a signature to existing JWS-JS by Header, Payload and PKCS1 private key.<br/>
-102 * This is to add first signature to JWS-JS object.
-103 * @name addSignatureByHeaderPayloadKey
-104 * @memberOf KJUR.jws.JWSJS
-105 * @function
-106 * @param {String} sHead JSON string of JWS Header for adding signature.
-107 * @param {String} sPayload string of JWS Payload for adding signature.
-108 * @param {String} sPemPrvKey string of PKCS1 private key
-109 */
-110 this.addSignatureByHeaderPayloadKey = function ( sHead , sPayload , sPemPrvKey ) {
-111 var jws = new KJUR.jws.JWS ( ) ;
-112 var sJWS = jws.generateJWSByP1PrvKey ( sHead , sPayload , sPemPrvKey ) ;
-113
-114 this.aHeader.push ( jws.parsedJWS.headB64U ) ;
-115 this.sPayload = jws.parsedJWS.payloadB64U ;
-116 this.aSignature.push ( jws.parsedJWS.sigvalB64U ) ;
-117 } ;
-118
-119 // == verify signature ===================================================================
-120 /**
-121 * verify JWS-JS object with array of certificate string.<br/>
-122 * @name verifyWithCerts
-123 * @memberOf KJUR.jws.JWSJS
-124 * @function
-125 * @param {array of String} aCert array of string for X.509 PEM certificate.
-126 * @return 1 if signature is valid.
-127 * @throw if JWS-JS signature is invalid.
-128 */
-129 this.verifyWithCerts = function ( aCert ) {
-130 if ( this.aHeader.length != aCert.length )
-131 throw "num headers does not match with num certs" ;
-132 if ( this.aSignature.length != aCert.length )
-133 throw "num signatures does not match with num certs" ;
-134
-135 var payload = this.sPayload ;
-136 var errMsg = "" ;
-137 for ( var i = 0 ; i < aCert.length ; i ++ ) {
-138 var cert = aCert [ i ] ;
-139 var header = this.aHeader [ i ] ;
-140 var sig = this.aSignature [ i ] ;
-141 var sJWS = header + "." + payload + "." + sig ;
-142
-143 var jws = new KJUR.jws.JWS ( ) ;
-144 try {
-145 var result = jws.verifyJWSByPemX509Cert ( sJWS , cert ) ;
-146 if ( result != 1 ) {
-147 errMsg + = ( i + 1 ) + "th signature unmatch. " ;
-148 }
-149 } catch ( ex ) {
-150 errMsg + = ( i + 1 ) + "th signature fail(" + ex + "). " ;
-151 }
-152 }
-153
-154 if ( errMsg == "" ) {
-155 return 1 ;
-156 } else {
-157 throw errMsg ;
-158 }
-159 } ;
-160
-161 /**
-162 * read JWS-JS string.<br/>
-163 * @name raedJWSJS
-164 * @memberOf KJUR.jws.JWSJS
-165 * @function
-166 * @param {String} string of JWS-JS to load.
-167 * @throw if sJWSJS is malformed or not JSON string.
-168 */
-169 this.readJWSJS = function ( sJWSJS ) {
-170 var oJWSJS = ns1.readSafeJSONString ( sJWSJS ) ;
-171 if ( oJWSJS == null ) throw "argument is not JSON string: " + sJWSJS ;
-172
-173 this.aHeader = oJWSJS.headers ;
-174 this.sPayload = oJWSJS.payload ;
-175 this.aSignature = oJWSJS.signatures ;
-176 } ;
-177
-178 // == utility ===================================================================
-179 /**
-180 * get JSON object for this JWS-JS object.<br/>
-181 * @name getJSON
-182 * @memberOf KJUR.jws.JWSJS
-183 * @function
-184 */
-185 this.getJSON = function ( ) {
-186 return { "headers" : this.aHeader ,
-187 "payload" : this.sPayload ,
-188 "signatures" : this.aSignature } ;
-189 } ;
-190
-191 /**
-192 * check if this JWS-JS object is empty.<br/>
-193 * @name isEmpty
-194 * @memberOf KJUR.jws.JWSJS
-195 * @function
-196 * @return 1 if there is no signatures in this object, otherwise 0.
-197 */
-198 this.isEmpty = function ( ) {
-199 if ( this.aHeader.length == 0 ) return 1 ;
-200 return 0 ;
-201 } ;
-202 } ;
-203
-204
\ No newline at end of file
diff --git a/jwt/api/symbols/src/keyutil-1.0.js.html b/jwt/api/symbols/src/keyutil-1.0.js.html
deleted file mode 100644
index 7ef050d..0000000
--- a/jwt/api/symbols/src/keyutil-1.0.js.html
+++ /dev/null
@@ -1,2028 +0,0 @@
-
1 /*! keyutil-1.0.12.js (c) 2013-2015 Kenji Urushima | kjur.github.com/jsrsasign/license
- 2 */
- 3 /*
- 4 * keyutil.js - key utility for PKCS#1/5/8 PEM, RSA/DSA/ECDSA key object
- 5 *
- 6 * Copyright (c) 2013-2015 Kenji Urushima (kenji.urushima@gmail.com)
- 7 *
- 8 * This software is licensed under the terms of the MIT License.
- 9 * http://kjur.github.com/jsrsasign/license
- 10 *
- 11 * The above copyright and license notice shall be
- 12 * included in all copies or substantial portions of the Software.
- 13 */
- 14 /**
- 15 * @fileOverview
- 16 * @name keyutil-1.0.js
- 17 * @author Kenji Urushima kenji.urushima@gmail.com
- 18 * @version keyutil 1.0.12 (2015-Oct-14)
- 19 * @since jsrsasign 4.1.4
- 20 * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a>
- 21 */
- 22
- 23 /**
- 24 * @name KEYUTIL
- 25 * @class class for RSA/ECC/DSA key utility
- 26 * @description
- 27 * <br/>
- 28 * {@link KEYUTIL} class is an update of former {@link PKCS5PKEY} class.
- 29 * So for now, {@link PKCS5PKEY} is deprecated class.
- 30 * {@link KEYUTIL} class has following features:
- 31 * <dl>
- 32 * <dt><b>key loading - {@link KEYUTIL.getKey}</b>
- 33 * <dd>
- 34 * <ul>
- 35 * <li>supports RSAKey and KJUR.crypto.{ECDSA,DSA} key object</li>
- 36 * <li>supports private key and public key</li>
- 37 * <li>supports encrypted and plain private key</li>
- 38 * <li>supports PKCS#1, PKCS#5 and PKCS#8 key</li>
- 39 * <li>supports public key in X.509 certificate</li>
- 40 * <li>key represented by JSON object</li>
- 41 * </ul>
- 42 * NOTE1: Encrypted PKCS#8 only supports PBKDF2/HmacSHA1/3DES <br/>
- 43 * NOTE2: Encrypted PKCS#5 supports DES-CBC, DES-EDE3-CBC, AES-{128,192.256}-CBC <br/>
- 44 *
- 45 * <dt><b>exporting key - {@link KEYUTIL.getPEM}</b>
- 46 * <dd>
- 47 * {@link KEYUTIL.getPEM} method supports following formats:
- 48 * <ul>
- 49 * <li>supports RSA/EC/DSA keys</li>
- 50 * <li>PKCS#1 plain RSA/EC/DSA private key</li>
- 51 * <li>PKCS#5 encrypted RSA/EC/DSA private key with DES-CBC, DES-EDE3-CBC, AES-{128,192.256}-CBC</li>
- 52 * <li>PKCS#8 plain RSA/EC/DSA private key</li>
- 53 * <li>PKCS#8 encrypted RSA/EC/DSA private key with PBKDF2_HmacSHA1_3DES</li>
- 54 * </ul>
- 55 *
- 56 * <dt><b>keypair generation - {@link KEYUTIL.generateKeypair}</b>
- 57 * <ul>
- 58 * <li>generate key pair of {@link RSAKey} or {@link KJUR.crypto.ECDSA}.</li>
- 59 * <li>generate private key and convert it to PKCS#5 encrypted private key.</li>
- 60 * </ul>
- 61 * NOTE: {@link KJUR.crypto.DSA} is not yet supported.
- 62 * </dl>
- 63 *
- 64 * @example
- 65 * // 1. loading PEM private key
- 66 * var key = KEYUTIL.getKey(pemPKCS1PrivateKey);
- 67 * var key = KEYUTIL.getKey(pemPKCS5EncryptedPrivateKey, "passcode");
- 68 * var key = KEYUTIL.getKey(pemPKC85PlainPrivateKey);
- 69 * var key = KEYUTIL.getKey(pemPKC85EncryptedPrivateKey, "passcode");
- 70 * // 2. loading PEM public key
- 71 * var key = KEYUTIL.getKey(pemPKCS8PublicKey);
- 72 * var key = KEYUTIL.getKey(pemX509Certificate);
- 73 * // 3. exporting private key
- 74 * var pem = KEYUTIL.getPEM(privateKeyObj, "PKCS1PRV");
- 75 * var pem = KEYUTIL.getPEM(privateKeyObj, "PKCS5PRV", "passcode"); // DES-EDE3-CBC by default
- 76 * var pem = KEYUTIL.getPEM(privateKeyObj, "PKCS5PRV", "passcode", "DES-CBC");
- 77 * var pem = KEYUTIL.getPEM(privateKeyObj, "PKCS8PRV");
- 78 * var pem = KEYUTIL.getPEM(privateKeyObj, "PKCS8PRV", "passcode");
- 79 * // 4. exporting public key
- 80 * var pem = KEYUTIL.getPEM(publicKeyObj);
- 81 */
- 82 /*
- 83 * DEPRECATED METHODS
- 84 * GET PKCS8
- 85 * KEYUTIL.getRSAKeyFromPlainPKCS8PEM
- 86 * KEYUTIL.getRSAKeyFromPlainPKCS8Hex
- 87 * KEYUTIL.getRSAKeyFromEncryptedPKCS8PEM
- 88 * P8 UTIL (make internal use)
- 89 * KEYUTIL.getPlainPKCS8HexFromEncryptedPKCS8PEM
- 90 * GET PKCS8 PUB
- 91 * KEYUTIL.getKeyFromPublicPKCS8PEM
- 92 * KEYUTIL.getKeyFromPublicPKCS8Hex
- 93 * KEYUTIL.getRSAKeyFromPublicPKCS8PEM
- 94 * KEYUTIL.getRSAKeyFromPublicPKCS8Hex
- 95 * GET PKCS5
- 96 * KEYUTIL.getRSAKeyFromEncryptedPKCS5PEM
- 97 * PUT PKCS5
- 98 * KEYUTIL.getEncryptedPKCS5PEMFromRSAKey
- 99 * OTHER METHODS (FOR INTERNAL?)
-100 * KEYUTIL.getHexFromPEM
-101 * KEYUTIL.getDecryptedKeyHexByKeyIV
-102 */
-103 var KEYUTIL = function ( ) {
-104 // *****************************************************************
-105 // *** PRIVATE PROPERTIES AND METHODS *******************************
-106 // *****************************************************************
-107 // shared key decryption ------------------------------------------
-108 var decryptAES = function ( dataHex , keyHex , ivHex ) {
-109 return decryptGeneral ( CryptoJS.AES , dataHex , keyHex , ivHex ) ;
-110 } ;
-111
-112 var decrypt3DES = function ( dataHex , keyHex , ivHex ) {
-113 return decryptGeneral ( CryptoJS.TripleDES , dataHex , keyHex , ivHex ) ;
-114 } ;
-115
-116 var decryptDES = function ( dataHex , keyHex , ivHex ) {
-117 return decryptGeneral ( CryptoJS.DES , dataHex , keyHex , ivHex ) ;
-118 } ;
-119
-120 var decryptGeneral = function ( f , dataHex , keyHex , ivHex ) {
-121 var data = CryptoJS.enc.Hex.parse ( dataHex ) ;
-122 var key = CryptoJS.enc.Hex.parse ( keyHex ) ;
-123 var iv = CryptoJS.enc.Hex.parse ( ivHex ) ;
-124 var encrypted = { } ;
-125 encrypted.key = key ;
-126 encrypted.iv = iv ;
-127 encrypted.ciphertext = data ;
-128 var decrypted = f.decrypt ( encrypted , key , { iv : iv } ) ;
-129 return CryptoJS.enc.Hex.stringify ( decrypted ) ;
-130 } ;
-131
-132 // shared key decryption ------------------------------------------
-133 var encryptAES = function ( dataHex , keyHex , ivHex ) {
-134 return encryptGeneral ( CryptoJS.AES , dataHex , keyHex , ivHex ) ;
-135 } ;
-136
-137 var encrypt3DES = function ( dataHex , keyHex , ivHex ) {
-138 return encryptGeneral ( CryptoJS.TripleDES , dataHex , keyHex , ivHex ) ;
-139 } ;
-140
-141 var encryptDES = function ( dataHex , keyHex , ivHex ) {
-142 return encryptGeneral ( CryptoJS.DES , dataHex , keyHex , ivHex ) ;
-143 } ;
-144
-145 var encryptGeneral = function ( f , dataHex , keyHex , ivHex ) {
-146 var data = CryptoJS.enc.Hex.parse ( dataHex ) ;
-147 var key = CryptoJS.enc.Hex.parse ( keyHex ) ;
-148 var iv = CryptoJS.enc.Hex.parse ( ivHex ) ;
-149 var encryptedHex = f.encrypt ( data , key , { iv : iv } ) ;
-150 var encryptedWA = CryptoJS.enc.Hex.parse ( encryptedHex.toString ( ) ) ;
-151 var encryptedB64 = CryptoJS.enc.Base64.stringify ( encryptedWA ) ;
-152 return encryptedB64 ;
-153 } ;
-154
-155 // other methods and properties ----------------------------------------
-156 var ALGLIST = {
-157 'AES-256-CBC' : { 'proc' : decryptAES , 'eproc' : encryptAES , keylen : 32 , ivlen : 16 } ,
-158 'AES-192-CBC' : { 'proc' : decryptAES , 'eproc' : encryptAES , keylen : 24 , ivlen : 16 } ,
-159 'AES-128-CBC' : { 'proc' : decryptAES , 'eproc' : encryptAES , keylen : 16 , ivlen : 16 } ,
-160 'DES-EDE3-CBC' : { 'proc' : decrypt3DES , 'eproc' : encrypt3DES , keylen : 24 , ivlen : 8 } ,
-161 'DES-CBC' : { 'proc' : decryptDES , 'eproc' : encryptDES , keylen : 8 , ivlen : 8 }
-162 } ;
-163
-164 var getFuncByName = function ( algName ) {
-165 return ALGLIST [ algName ] [ 'proc' ] ;
-166 } ;
-167
-168 var _generateIvSaltHex = function ( numBytes ) {
-169 var wa = CryptoJS.lib.WordArray.random ( numBytes ) ;
-170 var hex = CryptoJS.enc.Hex.stringify ( wa ) ;
-171 return hex ;
-172 } ;
-173
-174 var _parsePKCS5PEM = function ( sPKCS5PEM ) {
-175 var info = { } ;
-176 if ( sPKCS5PEM.match ( new RegExp ( "DEK-Info: ([^,]+),([0-9A-Fa-f]+)" , "m" ) ) ) {
-177 info.cipher = RegExp.$1 ;
-178 info.ivsalt = RegExp.$2 ;
-179 }
-180 if ( sPKCS5PEM.match ( new RegExp ( "-----BEGIN ([A-Z]+) PRIVATE KEY-----" ) ) ) {
-181 info.type = RegExp.$1 ;
-182 }
-183 var i1 = - 1 ;
-184 var lenNEWLINE = 0 ;
-185 if ( sPKCS5PEM.indexOf ( "\r\n\r\n" ) != - 1 ) {
-186 i1 = sPKCS5PEM.indexOf ( "\r\n\r\n" ) ;
-187 lenNEWLINE = 2 ;
-188 }
-189 if ( sPKCS5PEM.indexOf ( "\n\n" ) != - 1 ) {
-190 i1 = sPKCS5PEM.indexOf ( "\n\n" ) ;
-191 lenNEWLINE = 1 ;
-192 }
-193 var i2 = sPKCS5PEM.indexOf ( "-----END" ) ;
-194 if ( i1 != - 1 && i2 != - 1 ) {
-195 var s = sPKCS5PEM.substring ( i1 + lenNEWLINE * 2 , i2 - lenNEWLINE ) ;
-196 s = s.replace ( /\s+/g , '' ) ;
-197 info.data = s ;
-198 }
-199 return info ;
-200 } ;
-201
-202 var _getKeyAndUnusedIvByPasscodeAndIvsalt = function ( algName , passcode , ivsaltHex ) {
-203 //alert("ivsaltHex(2) = " + ivsaltHex);
-204 var saltHex = ivsaltHex.substring ( 0 , 16 ) ;
-205 //alert("salt = " + saltHex);
-206
-207 var salt = CryptoJS.enc.Hex.parse ( saltHex ) ;
-208 var data = CryptoJS.enc.Utf8.parse ( passcode ) ;
-209 //alert("salt = " + salt);
-210 //alert("data = " + data);
-211
-212 var nRequiredBytes = ALGLIST [ algName ] [ 'keylen' ] + ALGLIST [ algName ] [ 'ivlen' ] ;
-213 var hHexValueJoined = '' ;
-214 var hLastValue = null ;
-215 //alert("nRequiredBytes = " + nRequiredBytes);
-216 for ( ; ; ) {
-217 var h = CryptoJS.algo.MD5.create ( ) ;
-218 if ( hLastValue != null ) {
-219 h.update ( hLastValue ) ;
-220 }
-221 h.update ( data ) ;
-222 h.update ( salt ) ;
-223 hLastValue = h.finalize ( ) ;
-224 hHexValueJoined = hHexValueJoined + CryptoJS.enc.Hex.stringify ( hLastValue ) ;
-225 //alert("joined = " + hHexValueJoined);
-226 if ( hHexValueJoined.length >= nRequiredBytes * 2 ) {
-227 break ;
-228 }
-229 }
-230 var result = { } ;
-231 result.keyhex = hHexValueJoined.substr ( 0 , ALGLIST [ algName ] [ 'keylen' ] * 2 ) ;
-232 result.ivhex = hHexValueJoined.substr ( ALGLIST [ algName ] [ 'keylen' ] * 2 , ALGLIST [ algName ] [ 'ivlen' ] * 2 ) ;
-233 return result ;
-234 } ;
-235
-236 /*
-237 * @param {String} privateKeyB64 base64 string of encrypted private key
-238 * @param {String} sharedKeyAlgName algorithm name of shared key encryption
-239 * @param {String} sharedKeyHex hexadecimal string of shared key to encrypt
-240 * @param {String} ivsaltHex hexadecimal string of IV and salt
-241 * @param {String} hexadecimal string of decrypted private key
-242 */
-243 var _decryptKeyB64 = function ( privateKeyB64 , sharedKeyAlgName , sharedKeyHex , ivsaltHex ) {
-244 var privateKeyWA = CryptoJS.enc.Base64.parse ( privateKeyB64 ) ;
-245 var privateKeyHex = CryptoJS.enc.Hex.stringify ( privateKeyWA ) ;
-246 var f = ALGLIST [ sharedKeyAlgName ] [ 'proc' ] ;
-247 var decryptedKeyHex = f ( privateKeyHex , sharedKeyHex , ivsaltHex ) ;
-248 return decryptedKeyHex ;
-249 } ;
-250
-251 /*
-252 * @param {String} privateKeyHex hexadecimal string of private key
-253 * @param {String} sharedKeyAlgName algorithm name of shared key encryption
-254 * @param {String} sharedKeyHex hexadecimal string of shared key to encrypt
-255 * @param {String} ivsaltHex hexadecimal string of IV and salt
-256 * @param {String} base64 string of encrypted private key
-257 */
-258 var _encryptKeyHex = function ( privateKeyHex , sharedKeyAlgName , sharedKeyHex , ivsaltHex ) {
-259 var f = ALGLIST [ sharedKeyAlgName ] [ 'eproc' ] ;
-260 var encryptedKeyB64 = f ( privateKeyHex , sharedKeyHex , ivsaltHex ) ;
-261 return encryptedKeyB64 ;
-262 } ;
-263
-264 // *****************************************************************
-265 // *** PUBLIC PROPERTIES AND METHODS *******************************
-266 // *****************************************************************
-267 return {
-268 // -- UTILITY METHODS ------------------------------------------------------------
-269 /**
-270 * decrypt private key by shared key
-271 * @name version
-272 * @memberOf KEYUTIL
-273 * @property {String} version
-274 * @description version string of KEYUTIL class
-275 */
-276 version : "1.0.0" ,
-277
-278 /**
-279 * get hexacedimal string of PEM format
-280 * @name getHexFromPEM
-281 * @memberOf KEYUTIL
-282 * @function
-283 * @param {String} sPEM PEM formatted string
-284 * @param {String} sHead PEM header string without BEGIN/END
-285 * @return {String} hexadecimal string data of PEM contents
-286 * @since pkcs5pkey 1.0.5
-287 */
-288 getHexFromPEM : function ( sPEM , sHead ) {
-289 var s = sPEM ;
-290 if ( s.indexOf ( "-----BEGIN " ) == - 1 ) {
-291 throw "can't find PEM header: " + sHead ;
-292 }
-293 if ( typeof sHead == "string" && sHead != "" ) {
-294 s = s.replace ( "-----BEGIN " + sHead + "-----" , "" ) ;
-295 s = s.replace ( "-----END " + sHead + "-----" , "" ) ;
-296 } else {
-297 s = s.replace ( /-----BEGIN [^-]+-----/ , '' ) ;
-298 s = s.replace ( /-----END [^-]+-----/ , '' ) ;
-299 }
-300 var sB64 = s.replace ( /\s+/g , '' ) ;
-301 var dataHex = b64tohex ( sB64 ) ;
-302 return dataHex ;
-303 } ,
-304
-305 /**
-306 * decrypt private key by shared key
-307 * @name getDecryptedKeyHexByKeyIV
-308 * @memberOf KEYUTIL
-309 * @function
-310 * @param {String} encryptedKeyHex hexadecimal string of encrypted private key
-311 * @param {String} algName name of symmetric key algorithm (ex. 'DES-EBE3-CBC')
-312 * @param {String} sharedKeyHex hexadecimal string of symmetric key
-313 * @param {String} ivHex hexadecimal string of initial vector(IV).
-314 * @return {String} hexadecimal string of decrypted privated key
-315 */
-316 getDecryptedKeyHexByKeyIV : function ( encryptedKeyHex , algName , sharedKeyHex , ivHex ) {
-317 var f1 = getFuncByName ( algName ) ;
-318 return f1 ( encryptedKeyHex , sharedKeyHex , ivHex ) ;
-319 } ,
-320
-321 /**
-322 * parse PEM formatted passcode protected PKCS#5 private key
-323 * @name parsePKCS5PEM
-324 * @memberOf KEYUTIL
-325 * @function
-326 * @param {String} sEncryptedPEM PEM formatted protected passcode protected PKCS#5 private key
-327 * @return {Hash} hash of key information
-328 * @description
-329 * Resulted hash has following attributes.
-330 * <ul>
-331 * <li>cipher - symmetric key algorithm name (ex. 'DES-EBE3-CBC', 'AES-256-CBC')</li>
-332 * <li>ivsalt - IV used for decrypt. Its heading 8 bytes will be used for passcode salt.</li>
-333 * <li>type - asymmetric key algorithm name of private key described in PEM header.</li>
-334 * <li>data - base64 encoded encrypted private key.</li>
-335 * </ul>
-336 *
-337 */
-338 parsePKCS5PEM : function ( sPKCS5PEM ) {
-339 return _parsePKCS5PEM ( sPKCS5PEM ) ;
-340 } ,
-341
-342 /**
-343 * the same function as OpenSSL EVP_BytsToKey to generate shared key and IV
-344 * @name getKeyAndUnusedIvByPasscodeAndIvsalt
-345 * @memberOf KEYUTIL
-346 * @function
-347 * @param {String} algName name of symmetric key algorithm (ex. 'DES-EBE3-CBC')
-348 * @param {String} passcode passcode to decrypt private key (ex. 'password')
-349 * @param {String} hexadecimal string of IV. heading 8 bytes will be used for passcode salt
-350 * @return {Hash} hash of key and unused IV (ex. {keyhex:2fe3..., ivhex:3fad..})
-351 */
-352 getKeyAndUnusedIvByPasscodeAndIvsalt : function ( algName , passcode , ivsaltHex ) {
-353 return _getKeyAndUnusedIvByPasscodeAndIvsalt ( algName , passcode , ivsaltHex ) ;
-354 } ,
-355
-356 decryptKeyB64 : function ( privateKeyB64 , sharedKeyAlgName , sharedKeyHex , ivsaltHex ) {
-357 return _decryptKeyB64 ( privateKeyB64 , sharedKeyAlgName , sharedKeyHex , ivsaltHex ) ;
-358 } ,
-359
-360 /**
-361 * decrypt PEM formatted protected PKCS#5 private key with passcode
-362 * @name getDecryptedKeyHex
-363 * @memberOf KEYUTIL
-364 * @function
-365 * @param {String} sEncryptedPEM PEM formatted protected passcode protected PKCS#5 private key
-366 * @param {String} passcode passcode to decrypt private key (ex. 'password')
-367 * @return {String} hexadecimal string of decrypted RSA priavte key
-368 */
-369 getDecryptedKeyHex : function ( sEncryptedPEM , passcode ) {
-370 // 1. parse pem
-371 var info = _parsePKCS5PEM ( sEncryptedPEM ) ;
-372 var publicKeyAlgName = info.type ;
-373 var sharedKeyAlgName = info.cipher ;
-374 var ivsaltHex = info.ivsalt ;
-375 var privateKeyB64 = info.data ;
-376 //alert("ivsaltHex = " + ivsaltHex);
-377
-378 // 2. generate shared key
-379 var sharedKeyInfo = _getKeyAndUnusedIvByPasscodeAndIvsalt ( sharedKeyAlgName , passcode , ivsaltHex ) ;
-380 var sharedKeyHex = sharedKeyInfo.keyhex ;
-381 //alert("sharedKeyHex = " + sharedKeyHex);
-382
-383 // 3. decrypt private key
-384 var decryptedKey = _decryptKeyB64 ( privateKeyB64 , sharedKeyAlgName , sharedKeyHex , ivsaltHex ) ;
-385 return decryptedKey ;
-386 } ,
-387
-388 /**
-389 * (DEPRECATED) read PEM formatted encrypted PKCS#5 private key and returns RSAKey object
-390 * @name getRSAKeyFromEncryptedPKCS5PEM
-391 * @memberOf KEYUTIL
-392 * @function
-393 * @param {String} sEncryptedP5PEM PEM formatted encrypted PKCS#5 private key
-394 * @param {String} passcode passcode to decrypt private key
-395 * @return {RSAKey} loaded RSAKey object of RSA private key
-396 * @since pkcs5pkey 1.0.2
-397 * @deprecated From jsrsasign 4.2.1 please use {@link KEYUTIL.getKey#}.
-398 */
-399 getRSAKeyFromEncryptedPKCS5PEM : function ( sEncryptedP5PEM , passcode ) {
-400 var hPKey = this.getDecryptedKeyHex ( sEncryptedP5PEM , passcode ) ;
-401 var rsaKey = new RSAKey ( ) ;
-402 rsaKey.readPrivateKeyFromASN1HexString ( hPKey ) ;
-403 return rsaKey ;
-404 } ,
-405
-406 /*
-407 * get PEM formatted encrypted PKCS#5 private key from hexadecimal string of plain private key
-408 * @name getEncryptedPKCS5PEMFromPrvKeyHex
-409 * @memberOf KEYUTIL
-410 * @function
-411 * @param {String} pemHeadAlg algorithm name in the pem header (i.e. RSA,EC or DSA)
-412 * @param {String} hPrvKey hexadecimal string of plain private key
-413 * @param {String} passcode pass code to protect private key (ex. password)
-414 * @param {String} sharedKeyAlgName algorithm name to protect private key (ex. AES-256-CBC)
-415 * @param {String} ivsaltHex hexadecimal string of IV and salt
-416 * @return {String} string of PEM formatted encrypted PKCS#5 private key
-417 * @since pkcs5pkey 1.0.2
-418 * @description
-419 * <br/>
-420 * generate PEM formatted encrypted PKCS#5 private key by hexadecimal string encoded
-421 * ASN.1 object of plain RSA private key.
-422 * Following arguments can be omitted.
-423 * <ul>
-424 * <li>alg - AES-256-CBC will be used if omitted.</li>
-425 * <li>ivsaltHex - automatically generate IV and salt which length depends on algorithm</li>
-426 * </ul>
-427 * NOTE1: DES-CBC, DES-EDE3-CBC, AES-{128,192.256}-CBC algorithm are supported.
-428 * @example
-429 * var pem =
-430 * KEYUTIL.getEncryptedPKCS5PEMFromPrvKeyHex(plainKeyHex, "password");
-431 * var pem2 =
-432 * KEYUTIL.getEncryptedPKCS5PEMFromPrvKeyHex(plainKeyHex, "password", "AES-128-CBC");
-433 * var pem3 =
-434 * KEYUTIL.getEncryptedPKCS5PEMFromPrvKeyHex(plainKeyHex, "password", "AES-128-CBC", "1f3d02...");
-435 */
-436 getEncryptedPKCS5PEMFromPrvKeyHex : function ( pemHeadAlg , hPrvKey , passcode , sharedKeyAlgName , ivsaltHex ) {
-437 var sPEM = "" ;
-438
-439 // 1. set sharedKeyAlgName if undefined (default AES-256-CBC)
-440 if ( typeof sharedKeyAlgName == "undefined" || sharedKeyAlgName == null ) {
-441 sharedKeyAlgName = "AES-256-CBC" ;
-442 }
-443 if ( typeof ALGLIST [ sharedKeyAlgName ] == "undefined" )
-444 throw "KEYUTIL unsupported algorithm: " + sharedKeyAlgName ;
-445
-446 // 2. set ivsaltHex if undefined
-447 if ( typeof ivsaltHex == "undefined" || ivsaltHex == null ) {
-448 var ivlen = ALGLIST [ sharedKeyAlgName ] [ 'ivlen' ] ;
-449 var randIV = _generateIvSaltHex ( ivlen ) ;
-450 ivsaltHex = randIV.toUpperCase ( ) ;
-451 }
-452
-453 // 3. get shared key
-454 //alert("ivsalthex=" + ivsaltHex);
-455 var sharedKeyInfo = _getKeyAndUnusedIvByPasscodeAndIvsalt ( sharedKeyAlgName , passcode , ivsaltHex ) ;
-456 var sharedKeyHex = sharedKeyInfo.keyhex ;
-457 // alert("sharedKeyHex = " + sharedKeyHex);
-458
-459 // 3. get encrypted Key in Base64
-460 var encryptedKeyB64 = _encryptKeyHex ( hPrvKey , sharedKeyAlgName , sharedKeyHex , ivsaltHex ) ;
-461
-462 var pemBody = encryptedKeyB64.replace ( /(.{64})/g , "$1\r\n" ) ;
-463 var sPEM = "-----BEGIN " + pemHeadAlg + " PRIVATE KEY-----\r\n" ;
-464 sPEM + = "Proc-Type: 4,ENCRYPTED\r\n" ;
-465 sPEM + = "DEK-Info: " + sharedKeyAlgName + "," + ivsaltHex + "\r\n" ;
-466 sPEM + = "\r\n" ;
-467 sPEM + = pemBody ;
-468 sPEM + = "\r\n-----END " + pemHeadAlg + " PRIVATE KEY-----\r\n" ;
-469
-470 return sPEM ;
-471 } ,
-472
-473 /**
-474 * (DEPRECATED) get PEM formatted encrypted PKCS#5 private key from RSAKey object of private key
-475 * @name getEncryptedPKCS5PEMFromRSAKey
-476 * @memberOf KEYUTIL
-477 * @function
-478 * @param {RSAKey} pKey RSAKey object of private key
-479 * @param {String} passcode pass code to protect private key (ex. password)
-480 * @param {String} alg algorithm name to protect private key (default AES-256-CBC)
-481 * @param {String} ivsaltHex hexadecimal string of IV and salt (default generated random IV)
-482 * @return {String} string of PEM formatted encrypted PKCS#5 private key
-483 * @since pkcs5pkey 1.0.2
-484 * @deprecated From jsrsasign 4.2.1 please use {@link KEYUTIL.getPEM#}.
-485 * @description
-486 * <br/>
-487 * generate PEM formatted encrypted PKCS#5 private key by
-488 * {@link RSAKey} object of RSA private key and passcode.
-489 * Following argument can be omitted.
-490 * <ul>
-491 * <li>alg - AES-256-CBC will be used if omitted.</li>
-492 * <li>ivsaltHex - automatically generate IV and salt which length depends on algorithm</li>
-493 * </ul>
-494 * @example
-495 * var pkey = new RSAKey();
-496 * pkey.generate(1024, '10001'); // generate 1024bit RSA private key with public exponent 'x010001'
-497 * var pem = KEYUTIL.getEncryptedPKCS5PEMFromRSAKey(pkey, "password");
-498 */
-499 getEncryptedPKCS5PEMFromRSAKey : function ( pKey , passcode , alg , ivsaltHex ) {
-500 var version = new KJUR.asn1.DERInteger ( { 'int' : 0 } ) ;
-501 var n = new KJUR.asn1.DERInteger ( { 'bigint' : pKey.n } ) ;
-502 var e = new KJUR.asn1.DERInteger ( { 'int' : pKey.e } ) ;
-503 var d = new KJUR.asn1.DERInteger ( { 'bigint' : pKey.d } ) ;
-504 var p = new KJUR.asn1.DERInteger ( { 'bigint' : pKey.p } ) ;
-505 var q = new KJUR.asn1.DERInteger ( { 'bigint' : pKey.q } ) ;
-506 var dmp1 = new KJUR.asn1.DERInteger ( { 'bigint' : pKey.dmp1 } ) ;
-507 var dmq1 = new KJUR.asn1.DERInteger ( { 'bigint' : pKey.dmq1 } ) ;
-508 var coeff = new KJUR.asn1.DERInteger ( { 'bigint' : pKey.coeff } ) ;
-509 var seq = new KJUR.asn1.DERSequence ( { 'array' : [ version , n , e , d , p , q , dmp1 , dmq1 , coeff ] } ) ;
-510 var hex = seq.getEncodedHex ( ) ;
-511 return this.getEncryptedPKCS5PEMFromPrvKeyHex ( "RSA" , hex , passcode , alg , ivsaltHex ) ;
-512 } ,
-513
-514 /**
-515 * generate RSAKey and PEM formatted encrypted PKCS#5 private key
-516 * @name newEncryptedPKCS5PEM
-517 * @memberOf KEYUTIL
-518 * @function
-519 * @param {String} passcode pass code to protect private key (ex. password)
-520 * @param {Integer} keyLen key bit length of RSA key to be generated. (default 1024)
-521 * @param {String} hPublicExponent hexadecimal string of public exponent (default 10001)
-522 * @param {String} alg shared key algorithm to encrypt private key (default AES-258-CBC)
-523 * @return {String} string of PEM formatted encrypted PKCS#5 private key
-524 * @since pkcs5pkey 1.0.2
-525 * @example
-526 * var pem1 = KEYUTIL.newEncryptedPKCS5PEM("password"); // RSA1024bit/10001/AES-256-CBC
-527 * var pem2 = KEYUTIL.newEncryptedPKCS5PEM("password", 512); // RSA 512bit/10001/AES-256-CBC
-528 * var pem3 = KEYUTIL.newEncryptedPKCS5PEM("password", 512, '3'); // RSA 512bit/ 3/AES-256-CBC
-529 */
-530 newEncryptedPKCS5PEM : function ( passcode , keyLen , hPublicExponent , alg ) {
-531 if ( typeof keyLen == "undefined" || keyLen == null ) {
-532 keyLen = 1024 ;
-533 }
-534 if ( typeof hPublicExponent == "undefined" || hPublicExponent == null ) {
-535 hPublicExponent = '10001' ;
-536 }
-537 var pKey = new RSAKey ( ) ;
-538 pKey.generate ( keyLen , hPublicExponent ) ;
-539 var pem = null ;
-540 if ( typeof alg == "undefined" || alg == null ) {
-541 pem = this.getEncryptedPKCS5PEMFromRSAKey ( pKey , passcode ) ;
-542 } else {
-543 pem = this.getEncryptedPKCS5PEMFromRSAKey ( pKey , passcode , alg ) ;
-544 }
-545 return pem ;
-546 } ,
-547
-548 // === PKCS8 ===============================================================
-549
-550 /**
-551 * (DEPRECATED) read PEM formatted unencrypted PKCS#8 private key and returns RSAKey object
-552 * @name getRSAKeyFromPlainPKCS8PEM
-553 * @memberOf KEYUTIL
-554 * @function
-555 * @param {String} pkcs8PEM PEM formatted unencrypted PKCS#8 private key
-556 * @return {RSAKey} loaded RSAKey object of RSA private key
-557 * @since pkcs5pkey 1.0.1
-558 * @deprecated From jsrsasign 4.2.1 please use {@link KEYUTIL.getKey#}.
-559 */
-560 getRSAKeyFromPlainPKCS8PEM : function ( pkcs8PEM ) {
-561 if ( pkcs8PEM.match ( /ENCRYPTED/ ) )
-562 throw "pem shall be not ENCRYPTED" ;
-563 var prvKeyHex = this.getHexFromPEM ( pkcs8PEM , "PRIVATE KEY" ) ;
-564 var rsaKey = this.getRSAKeyFromPlainPKCS8Hex ( prvKeyHex ) ;
-565 return rsaKey ;
-566 } ,
-567
-568 /**
-569 * (DEPRECATED) provide hexadecimal string of unencrypted PKCS#8 private key and returns RSAKey object
-570 * @name getRSAKeyFromPlainPKCS8Hex
-571 * @memberOf KEYUTIL
-572 * @function
-573 * @param {String} prvKeyHex hexadecimal string of unencrypted PKCS#8 private key
-574 * @return {RSAKey} loaded RSAKey object of RSA private key
-575 * @since pkcs5pkey 1.0.3
-576 * @deprecated From jsrsasign 4.2.1 please use {@link KEYUTIL.getKey#}.
-577 */
-578 getRSAKeyFromPlainPKCS8Hex : function ( prvKeyHex ) {
-579 var a1 = ASN1HEX.getPosArrayOfChildren_AtObj ( prvKeyHex , 0 ) ;
-580 if ( a1.length != 3 )
-581 throw "outer DERSequence shall have 3 elements: " + a1.length ;
-582 var algIdTLV = ASN1HEX.getHexOfTLV_AtObj ( prvKeyHex , a1 [ 1 ] ) ;
-583 if ( algIdTLV != "300d06092a864886f70d0101010500" ) // AlgId rsaEncryption
-584 throw "PKCS8 AlgorithmIdentifier is not rsaEnc: " + algIdTLV ;
-585 var algIdTLV = ASN1HEX.getHexOfTLV_AtObj ( prvKeyHex , a1 [ 1 ] ) ;
-586 var octetStr = ASN1HEX.getHexOfTLV_AtObj ( prvKeyHex , a1 [ 2 ] ) ;
-587 var p5KeyHex = ASN1HEX.getHexOfV_AtObj ( octetStr , 0 ) ;
-588 //alert(p5KeyHex);
-589 var rsaKey = new RSAKey ( ) ;
-590 rsaKey.readPrivateKeyFromASN1HexString ( p5KeyHex ) ;
-591 return rsaKey ;
-592 } ,
-593
-594 /**
-595 * generate PBKDF2 key hexstring with specified passcode and information
-596 * @name parseHexOfEncryptedPKCS8
-597 * @memberOf KEYUTIL
-598 * @function
-599 * @param {String} passcode passcode to decrypto private key
-600 * @return {Array} info associative array of PKCS#8 parameters
-601 * @since pkcs5pkey 1.0.3
-602 * @description
-603 * The associative array which is returned by this method has following properties:
-604 * <ul>
-605 * <li>info.pbkdf2Salt - hexadecimal string of PBKDF2 salt</li>
-606 * <li>info.pkbdf2Iter - iteration count</li>
-607 * <li>info.ciphertext - hexadecimal string of encrypted private key</li>
-608 * <li>info.encryptionSchemeAlg - encryption algorithm name (currently TripleDES only)</li>
-609 * <li>info.encryptionSchemeIV - initial vector for encryption algorithm</li>
-610 * </ul>
-611 * Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
-612 * <ul>
-613 * <li>keyDerivationFunc = pkcs5PBKDF2 with HmacSHA1</li>
-614 * <li>encryptionScheme = des-EDE3-CBC(i.e. TripleDES</li>
-615 * </ul>
-616 * @example
-617 * // to convert plain PKCS#5 private key to encrypted PKCS#8 private
-618 * // key with PBKDF2 with TripleDES
-619 * % openssl pkcs8 -in plain_p5.pem -topk8 -v2 -des3 -out encrypted_p8.pem
-620 */
-621 parseHexOfEncryptedPKCS8 : function ( sHEX ) {
-622 var info = { } ;
-623
-624 var a0 = ASN1HEX.getPosArrayOfChildren_AtObj ( sHEX , 0 ) ;
-625 if ( a0.length != 2 )
-626 throw "malformed format: SEQUENCE(0).items != 2: " + a0.length ;
-627
-628 // 1. ciphertext
-629 info.ciphertext = ASN1HEX.getHexOfV_AtObj ( sHEX , a0 [ 1 ] ) ;
-630
-631 // 2. pkcs5PBES2
-632 var a0_0 = ASN1HEX.getPosArrayOfChildren_AtObj ( sHEX , a0 [ 0 ] ) ;
-633 if ( a0_0.length != 2 )
-634 throw "malformed format: SEQUENCE(0.0).items != 2: " + a0_0.length ;
-635
-636 // 2.1 check if pkcs5PBES2(1 2 840 113549 1 5 13)
-637 if ( ASN1HEX.getHexOfV_AtObj ( sHEX , a0_0 [ 0 ] ) != "2a864886f70d01050d" )
-638 throw "this only supports pkcs5PBES2" ;
-639
-640 // 2.2 pkcs5PBES2 param
-641 var a0_0_1 = ASN1HEX.getPosArrayOfChildren_AtObj ( sHEX , a0_0 [ 1 ] ) ;
-642 if ( a0_0.length != 2 )
-643 throw "malformed format: SEQUENCE(0.0.1).items != 2: " + a0_0_1.length ;
-644
-645 // 2.2.1 encryptionScheme
-646 var a0_0_1_1 = ASN1HEX.getPosArrayOfChildren_AtObj ( sHEX , a0_0_1 [ 1 ] ) ;
-647 if ( a0_0_1_1.length != 2 )
-648 throw "malformed format: SEQUENCE(0.0.1.1).items != 2: " + a0_0_1_1.length ;
-649 if ( ASN1HEX.getHexOfV_AtObj ( sHEX , a0_0_1_1 [ 0 ] ) != "2a864886f70d0307" )
-650 throw "this only supports TripleDES" ;
-651 info.encryptionSchemeAlg = "TripleDES" ;
-652
-653 // 2.2.1.1 IV of encryptionScheme
-654 info.encryptionSchemeIV = ASN1HEX.getHexOfV_AtObj ( sHEX , a0_0_1_1 [ 1 ] ) ;
-655
-656 // 2.2.2 keyDerivationFunc
-657 var a0_0_1_0 = ASN1HEX.getPosArrayOfChildren_AtObj ( sHEX , a0_0_1 [ 0 ] ) ;
-658 if ( a0_0_1_0.length != 2 )
-659 throw "malformed format: SEQUENCE(0.0.1.0).items != 2: " + a0_0_1_0.length ;
-660 if ( ASN1HEX.getHexOfV_AtObj ( sHEX , a0_0_1_0 [ 0 ] ) != "2a864886f70d01050c" )
-661 throw "this only supports pkcs5PBKDF2" ;
-662
-663 // 2.2.2.1 pkcs5PBKDF2 param
-664 var a0_0_1_0_1 = ASN1HEX.getPosArrayOfChildren_AtObj ( sHEX , a0_0_1_0 [ 1 ] ) ;
-665 if ( a0_0_1_0_1.length < 2 )
-666 throw "malformed format: SEQUENCE(0.0.1.0.1).items < 2: " + a0_0_1_0_1.length ;
-667
-668 // 2.2.2.1.1 PBKDF2 salt
-669 info.pbkdf2Salt = ASN1HEX.getHexOfV_AtObj ( sHEX , a0_0_1_0_1 [ 0 ] ) ;
-670
-671 // 2.2.2.1.2 PBKDF2 iter
-672 var iterNumHex = ASN1HEX.getHexOfV_AtObj ( sHEX , a0_0_1_0_1 [ 1 ] ) ;
-673 try {
-674 info.pbkdf2Iter = parseInt ( iterNumHex , 16 ) ;
-675 } catch ( ex ) {
-676 throw "malformed format pbkdf2Iter: " + iterNumHex ;
-677 }
-678
-679 return info ;
-680 } ,
-681
-682 /**
-683 * generate PBKDF2 key hexstring with specified passcode and information
-684 * @name getPBKDF2KeyHexFromParam
-685 * @memberOf KEYUTIL
-686 * @function
-687 * @param {Array} info result of {@link parseHexOfEncryptedPKCS8} which has preference of PKCS#8 file
-688 * @param {String} passcode passcode to decrypto private key
-689 * @return {String} hexadecimal string of PBKDF2 key
-690 * @since pkcs5pkey 1.0.3
-691 * @description
-692 * As for info, this uses following properties:
-693 * <ul>
-694 * <li>info.pbkdf2Salt - hexadecimal string of PBKDF2 salt</li>
-695 * <li>info.pkbdf2Iter - iteration count</li>
-696 * </ul>
-697 * Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
-698 * <ul>
-699 * <li>keyDerivationFunc = pkcs5PBKDF2 with HmacSHA1</li>
-700 * <li>encryptionScheme = des-EDE3-CBC(i.e. TripleDES</li>
-701 * </ul>
-702 * @example
-703 * // to convert plain PKCS#5 private key to encrypted PKCS#8 private
-704 * // key with PBKDF2 with TripleDES
-705 * % openssl pkcs8 -in plain_p5.pem -topk8 -v2 -des3 -out encrypted_p8.pem
-706 */
-707 getPBKDF2KeyHexFromParam : function ( info , passcode ) {
-708 var pbkdf2SaltWS = CryptoJS.enc.Hex.parse ( info.pbkdf2Salt ) ;
-709 var pbkdf2Iter = info.pbkdf2Iter ;
-710 var pbkdf2KeyWS = CryptoJS.PBKDF2 ( passcode ,
-711 pbkdf2SaltWS ,
-712 { keySize : 192 / 32 , iterations : pbkdf2Iter } ) ;
-713 var pbkdf2KeyHex = CryptoJS.enc.Hex.stringify ( pbkdf2KeyWS ) ;
-714 return pbkdf2KeyHex ;
-715 } ,
-716
-717 /**
-718 * read PEM formatted encrypted PKCS#8 private key and returns hexadecimal string of plain PKCS#8 private key
-719 * @name getPlainPKCS8HexFromEncryptedPKCS8PEM
-720 * @memberOf KEYUTIL
-721 * @function
-722 * @param {String} pkcs8PEM PEM formatted encrypted PKCS#8 private key
-723 * @param {String} passcode passcode to decrypto private key
-724 * @return {String} hexadecimal string of plain PKCS#8 private key
-725 * @since pkcs5pkey 1.0.3
-726 * @description
-727 * Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
-728 * <ul>
-729 * <li>keyDerivationFunc = pkcs5PBKDF2 with HmacSHA1</li>
-730 * <li>encryptionScheme = des-EDE3-CBC(i.e. TripleDES</li>
-731 * </ul>
-732 * @example
-733 * // to convert plain PKCS#5 private key to encrypted PKCS#8 private
-734 * // key with PBKDF2 with TripleDES
-735 * % openssl pkcs8 -in plain_p5.pem -topk8 -v2 -des3 -out encrypted_p8.pem
-736 */
-737 getPlainPKCS8HexFromEncryptedPKCS8PEM : function ( pkcs8PEM , passcode ) {
-738 // 1. derHex - PKCS#8 private key encrypted by PBKDF2
-739 var derHex = this.getHexFromPEM ( pkcs8PEM , "ENCRYPTED PRIVATE KEY" ) ;
-740 // 2. info - PKCS#5 PBES info
-741 var info = this.parseHexOfEncryptedPKCS8 ( derHex ) ;
-742 // 3. hKey - PBKDF2 key
-743 var pbkdf2KeyHex = KEYUTIL.getPBKDF2KeyHexFromParam ( info , passcode ) ;
-744 // 4. decrypt ciphertext by PBKDF2 key
-745 var encrypted = { } ;
-746 encrypted.ciphertext = CryptoJS.enc.Hex.parse ( info.ciphertext ) ;
-747 var pbkdf2KeyWS = CryptoJS.enc.Hex.parse ( pbkdf2KeyHex ) ;
-748 var des3IVWS = CryptoJS.enc.Hex.parse ( info.encryptionSchemeIV ) ;
-749 var decWS = CryptoJS.TripleDES.decrypt ( encrypted , pbkdf2KeyWS , { iv : des3IVWS } ) ;
-750 var decHex = CryptoJS.enc.Hex.stringify ( decWS ) ;
-751 return decHex ;
-752 } ,
-753
-754 /**
-755 * (DEPRECATED) read PEM formatted encrypted PKCS#8 private key and returns RSAKey object
-756 * @name getRSAKeyFromEncryptedPKCS8PEM
-757 * @memberOf KEYUTIL
-758 * @function
-759 * @param {String} pkcs8PEM PEM formatted encrypted PKCS#8 private key
-760 * @param {String} passcode passcode to decrypto private key
-761 * @return {RSAKey} loaded RSAKey object of RSA private key
-762 * @since pkcs5pkey 1.0.3
-763 * @deprecated From jsrsasign 4.2.1 please use {@link KEYUTIL.getKey#}.
-764 * @description
-765 * Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
-766 * <ul>
-767 * <li>keyDerivationFunc = pkcs5PBKDF2 with HmacSHA1</li>
-768 * <li>encryptionScheme = des-EDE3-CBC(i.e. TripleDES</li>
-769 * </ul>
-770 * @example
-771 * // to convert plain PKCS#5 private key to encrypted PKCS#8 private
-772 * // key with PBKDF2 with TripleDES
-773 * % openssl pkcs8 -in plain_p5.pem -topk8 -v2 -des3 -out encrypted_p8.pem
-774 */
-775 getRSAKeyFromEncryptedPKCS8PEM : function ( pkcs8PEM , passcode ) {
-776 var prvKeyHex = this.getPlainPKCS8HexFromEncryptedPKCS8PEM ( pkcs8PEM , passcode ) ;
-777 var rsaKey = this.getRSAKeyFromPlainPKCS8Hex ( prvKeyHex ) ;
-778 return rsaKey ;
-779 } ,
-780
-781 /**
-782 * get RSAKey/ECDSA private key object from encrypted PEM PKCS#8 private key
-783 * @name getKeyFromEncryptedPKCS8PEM
-784 * @memberOf KEYUTIL
-785 * @function
-786 * @param {String} pkcs8PEM string of PEM formatted PKCS#8 private key
-787 * @param {String} passcode passcode string to decrypt key
-788 * @return {Object} RSAKey or KJUR.crypto.ECDSA private key object
-789 * @since pkcs5pkey 1.0.5
-790 */
-791 getKeyFromEncryptedPKCS8PEM : function ( pkcs8PEM , passcode ) {
-792 var prvKeyHex = this.getPlainPKCS8HexFromEncryptedPKCS8PEM ( pkcs8PEM , passcode ) ;
-793 var key = this.getKeyFromPlainPrivatePKCS8Hex ( prvKeyHex ) ;
-794 return key ;
-795 } ,
-796
-797 /**
-798 * parse hexadecimal string of plain PKCS#8 private key
-799 * @name parsePlainPrivatePKCS8Hex
-800 * @memberOf KEYUTIL
-801 * @function
-802 * @param {String} pkcs8PrvHex hexadecimal string of PKCS#8 plain private key
-803 * @return {Array} associative array of parsed key
-804 * @since pkcs5pkey 1.0.5
-805 * @description
-806 * Resulted associative array has following properties:
-807 * <ul>
-808 * <li>algoid - hexadecimal string of OID of asymmetric key algorithm</li>
-809 * <li>algparam - hexadecimal string of OID of ECC curve name or null</li>
-810 * <li>keyidx - string starting index of key in pkcs8PrvHex</li>
-811 * </ul>
-812 */
-813 parsePlainPrivatePKCS8Hex : function ( pkcs8PrvHex ) {
-814 var result = { } ;
-815 result.algparam = null ;
-816
-817 // 1. sequence
-818 if ( pkcs8PrvHex.substr ( 0 , 2 ) != "30" )
-819 throw "malformed plain PKCS8 private key(code:001)" ; // not sequence
-820
-821 var a1 = ASN1HEX.getPosArrayOfChildren_AtObj ( pkcs8PrvHex , 0 ) ;
-822 if ( a1.length != 3 )
-823 throw "malformed plain PKCS8 private key(code:002)" ;
-824
-825 // 2. AlgID
-826 if ( pkcs8PrvHex.substr ( a1 [ 1 ] , 2 ) != "30" )
-827 throw "malformed PKCS8 private key(code:003)" ; // AlgId not sequence
-828
-829 var a2 = ASN1HEX.getPosArrayOfChildren_AtObj ( pkcs8PrvHex , a1 [ 1 ] ) ;
-830 if ( a2.length != 2 )
-831 throw "malformed PKCS8 private key(code:004)" ; // AlgId not have two elements
-832
-833 // 2.1. AlgID OID
-834 if ( pkcs8PrvHex.substr ( a2 [ 0 ] , 2 ) != "06" )
-835 throw "malformed PKCS8 private key(code:005)" ; // AlgId.oid is not OID
-836
-837 result.algoid = ASN1HEX.getHexOfV_AtObj ( pkcs8PrvHex , a2 [ 0 ] ) ;
-838
-839 // 2.2. AlgID param
-840 if ( pkcs8PrvHex.substr ( a2 [ 1 ] , 2 ) == "06" ) {
-841 result.algparam = ASN1HEX.getHexOfV_AtObj ( pkcs8PrvHex , a2 [ 1 ] ) ;
-842 }
-843
-844 // 3. Key index
-845 if ( pkcs8PrvHex.substr ( a1 [ 2 ] , 2 ) != "04" )
-846 throw "malformed PKCS8 private key(code:006)" ; // not octet string
-847
-848 result.keyidx = ASN1HEX.getStartPosOfV_AtObj ( pkcs8PrvHex , a1 [ 2 ] ) ;
-849
-850 return result ;
-851 } ,
-852
-853 /**
-854 * get RSAKey/ECDSA private key object from PEM plain PEM PKCS#8 private key
-855 * @name getKeyFromPlainPrivatePKCS8PEM
-856 * @memberOf KEYUTIL
-857 * @function
-858 * @param {String} pkcs8PEM string of plain PEM formatted PKCS#8 private key
-859 * @return {Object} RSAKey or KJUR.crypto.ECDSA private key object
-860 * @since pkcs5pkey 1.0.5
-861 */
-862 getKeyFromPlainPrivatePKCS8PEM : function ( prvKeyPEM ) {
-863 var prvKeyHex = this.getHexFromPEM ( prvKeyPEM , "PRIVATE KEY" ) ;
-864 var key = this.getKeyFromPlainPrivatePKCS8Hex ( prvKeyHex ) ;
-865 return key ;
-866 } ,
-867
-868 /**
-869 * get RSAKey/ECDSA private key object from HEX plain PEM PKCS#8 private key
-870 * @name getKeyFromPlainPrivatePKCS8Hex
-871 * @memberOf KEYUTIL
-872 * @function
-873 * @param {String} prvKeyHex hexadecimal string of plain PKCS#8 private key
-874 * @return {Object} RSAKey or KJUR.crypto.ECDSA private key object
-875 * @since pkcs5pkey 1.0.5
-876 */
-877 getKeyFromPlainPrivatePKCS8Hex : function ( prvKeyHex ) {
-878 var p8 = this.parsePlainPrivatePKCS8Hex ( prvKeyHex ) ;
-879
-880 if ( p8.algoid == "2a864886f70d010101" ) { // RSA
-881 this.parsePrivateRawRSAKeyHexAtObj ( prvKeyHex , p8 ) ;
-882 var k = p8.key ;
-883 var key = new RSAKey ( ) ;
-884 key.setPrivateEx ( k.n , k.e , k.d , k.p , k.q , k.dp , k.dq , k.co ) ;
-885 return key ;
-886 } else if ( p8.algoid == "2a8648ce3d0201" ) { // ECC
-887 this.parsePrivateRawECKeyHexAtObj ( prvKeyHex , p8 ) ;
-888 if ( KJUR.crypto.OID.oidhex2name [ p8.algparam ] === undefined )
-889 throw "KJUR.crypto.OID.oidhex2name undefined: " + p8.algparam ;
-890 var curveName = KJUR.crypto.OID.oidhex2name [ p8.algparam ] ;
-891 var key = new KJUR.crypto.ECDSA ( { 'curve' : curveName } ) ;
-892 key.setPublicKeyHex ( p8.pubkey ) ;
-893 key.setPrivateKeyHex ( p8.key ) ;
-894 key.isPublic = false ;
-895 return key ;
-896 } else if ( p8.algoid == "2a8648ce380401" ) { // DSA
-897 var hP = ASN1HEX.getVbyList ( prvKeyHex , 0 , [ 1 , 1 , 0 ] , "02" ) ;
-898 var hQ = ASN1HEX.getVbyList ( prvKeyHex , 0 , [ 1 , 1 , 1 ] , "02" ) ;
-899 var hG = ASN1HEX.getVbyList ( prvKeyHex , 0 , [ 1 , 1 , 2 ] , "02" ) ;
-900 var hX = ASN1HEX.getVbyList ( prvKeyHex , 0 , [ 2 , 0 ] , "02" ) ;
-901 var biP = new BigInteger ( hP , 16 ) ;
-902 var biQ = new BigInteger ( hQ , 16 ) ;
-903 var biG = new BigInteger ( hG , 16 ) ;
-904 var biX = new BigInteger ( hX , 16 ) ;
-905 var key = new KJUR.crypto.DSA ( ) ;
-906 key.setPrivate ( biP , biQ , biG , null , biX ) ;
-907 return key ;
-908 } else {
-909 throw "unsupported private key algorithm" ;
-910 }
-911 } ,
-912
-913 // === PKCS8 RSA Public Key ================================================
-914 /**
-915 * (DEPRECATED) read PEM formatted PKCS#8 public key and returns RSAKey object
-916 * @name getRSAKeyFromPublicPKCS8PEM
-917 * @memberOf KEYUTIL
-918 * @function
-919 * @param {String} pkcs8PubPEM PEM formatted PKCS#8 public key
-920 * @return {RSAKey} loaded RSAKey object of RSA public key
-921 * @since pkcs5pkey 1.0.4
-922 * @deprecated From jsrsasign 4.2.1 please use {@link KEYUTIL.getKey#}.
-923 */
-924 getRSAKeyFromPublicPKCS8PEM : function ( pkcs8PubPEM ) {
-925 var pubKeyHex = this.getHexFromPEM ( pkcs8PubPEM , "PUBLIC KEY" ) ;
-926 var rsaKey = this.getRSAKeyFromPublicPKCS8Hex ( pubKeyHex ) ;
-927 return rsaKey ;
-928 } ,
-929
-930 /**
-931 * (DEPRECATED) get RSAKey/ECDSA public key object from PEM PKCS#8 public key
-932 * @name getKeyFromPublicPKCS8PEM
-933 * @memberOf KEYUTIL
-934 * @function
-935 * @param {String} pkcsPub8PEM string of PEM formatted PKCS#8 public key
-936 * @return {Object} RSAKey or KJUR.crypto.ECDSA private key object
-937 * @since pkcs5pkey 1.0.5
-938 * @deprecated From jsrsasign 4.2.1 please use {@link KEYUTIL.getKey#}.
-939 */
-940 getKeyFromPublicPKCS8PEM : function ( pkcs8PubPEM ) {
-941 var pubKeyHex = this.getHexFromPEM ( pkcs8PubPEM , "PUBLIC KEY" ) ;
-942 var key = this.getKeyFromPublicPKCS8Hex ( pubKeyHex ) ;
-943 return key ;
-944 } ,
-945
-946 /**
-947 * (DEPRECATED) get RSAKey/DSA/ECDSA public key object from hexadecimal string of PKCS#8 public key
-948 * @name getKeyFromPublicPKCS8Hex
-949 * @memberOf KEYUTIL
-950 * @function
-951 * @param {String} pkcsPub8Hex hexadecimal string of PKCS#8 public key
-952 * @return {Object} RSAKey or KJUR.crypto.{ECDSA,DSA} private key object
-953 * @since pkcs5pkey 1.0.5
-954 * @deprecated From jsrsasign 4.2.1 please use {@link KEYUTIL.getKey#}.
-955 */
-956 getKeyFromPublicPKCS8Hex : function ( pkcs8PubHex ) {
-957 var p8 = this.parsePublicPKCS8Hex ( pkcs8PubHex ) ;
-958
-959 if ( p8.algoid == "2a864886f70d010101" ) { // RSA
-960 var aRSA = this.parsePublicRawRSAKeyHex ( p8.key ) ;
-961 var key = new RSAKey ( ) ;
-962 key.setPublic ( aRSA.n , aRSA.e ) ;
-963 return key ;
-964 } else if ( p8.algoid == "2a8648ce3d0201" ) { // ECC
-965 if ( KJUR.crypto.OID.oidhex2name [ p8.algparam ] === undefined )
-966 throw "KJUR.crypto.OID.oidhex2name undefined: " + p8.algparam ;
-967 var curveName = KJUR.crypto.OID.oidhex2name [ p8.algparam ] ;
-968 var key = new KJUR.crypto.ECDSA ( { 'curve' : curveName , 'pub' : p8.key } ) ;
-969 return key ;
-970 } else if ( p8.algoid == "2a8648ce380401" ) { // DSA 1.2.840.10040.4.1
-971 var param = p8.algparam ;
-972 var y = ASN1HEX.getHexOfV_AtObj ( p8.key , 0 ) ;
-973 var key = new KJUR.crypto.DSA ( ) ;
-974 key.setPublic ( new BigInteger ( param.p , 16 ) ,
-975 new BigInteger ( param.q , 16 ) ,
-976 new BigInteger ( param.g , 16 ) ,
-977 new BigInteger ( y , 16 ) ) ;
-978 return key ;
-979 } else {
-980 throw "unsupported public key algorithm" ;
-981 }
-982 } ,
-983
-984 /**
-985 * parse hexadecimal string of plain PKCS#8 private key
-986 * @name parsePublicRawRSAKeyHex
-987 * @memberOf KEYUTIL
-988 * @function
-989 * @param {String} pubRawRSAHex hexadecimal string of ASN.1 encoded PKCS#8 public key
-990 * @return {Array} associative array of parsed key
-991 * @since pkcs5pkey 1.0.5
-992 * @description
-993 * Resulted associative array has following properties:
-994 * <ul>
-995 * <li>n - hexadecimal string of public key
-996 * <li>e - hexadecimal string of public exponent
-997 * </ul>
-998 */
-999 parsePublicRawRSAKeyHex : function ( pubRawRSAHex ) {
-1000 var result = { } ;
-1001
-1002 // 1. Sequence
-1003 if ( pubRawRSAHex.substr ( 0 , 2 ) != "30" )
-1004 throw "malformed RSA key(code:001)" ; // not sequence
-1005
-1006 var a1 = ASN1HEX.getPosArrayOfChildren_AtObj ( pubRawRSAHex , 0 ) ;
-1007 if ( a1.length != 2 )
-1008 throw "malformed RSA key(code:002)" ; // not 2 items in seq
-1009
-1010 // 2. public key "N"
-1011 if ( pubRawRSAHex.substr ( a1 [ 0 ] , 2 ) != "02" )
-1012 throw "malformed RSA key(code:003)" ; // 1st item is not integer
-1013
-1014 result.n = ASN1HEX.getHexOfV_AtObj ( pubRawRSAHex , a1 [ 0 ] ) ;
-1015
-1016 // 3. public key "E"
-1017 if ( pubRawRSAHex.substr ( a1 [ 1 ] , 2 ) != "02" )
-1018 throw "malformed RSA key(code:004)" ; // 2nd item is not integer
-1019
-1020 result.e = ASN1HEX.getHexOfV_AtObj ( pubRawRSAHex , a1 [ 1 ] ) ;
-1021
-1022 return result ;
-1023 } ,
-1024
-1025 /**
-1026 * parse hexadecimal string of RSA private key
-1027 * @name parsePrivateRawRSAKeyHexAtObj
-1028 * @memberOf KEYUTIL
-1029 * @function
-1030 * @param {String} pkcs8PrvHex hexadecimal string of PKCS#8 private key concluding RSA private key
-1031 * @return {Array} info associative array to add parsed RSA private key information
-1032 * @since pkcs5pkey 1.0.5
-1033 * @description
-1034 * Following properties are added to associative array 'info'
-1035 * <ul>
-1036 * <li>n - hexadecimal string of public key
-1037 * <li>e - hexadecimal string of public exponent
-1038 * <li>d - hexadecimal string of private key
-1039 * <li>p - hexadecimal string
-1040 * <li>q - hexadecimal string
-1041 * <li>dp - hexadecimal string
-1042 * <li>dq - hexadecimal string
-1043 * <li>co - hexadecimal string
-1044 * </ul>
-1045 */
-1046 parsePrivateRawRSAKeyHexAtObj : function ( pkcs8PrvHex , info ) {
-1047 var keyIdx = info.keyidx ;
-1048
-1049 // 1. sequence
-1050 if ( pkcs8PrvHex.substr ( keyIdx , 2 ) != "30" )
-1051 throw "malformed RSA private key(code:001)" ; // not sequence
-1052
-1053 var a1 = ASN1HEX.getPosArrayOfChildren_AtObj ( pkcs8PrvHex , keyIdx ) ;
-1054 if ( a1.length != 9 )
-1055 throw "malformed RSA private key(code:002)" ; // not sequence
-1056
-1057 // 2. RSA key
-1058 info.key = { } ;
-1059 info.key.n = ASN1HEX.getHexOfV_AtObj ( pkcs8PrvHex , a1 [ 1 ] ) ;
-1060 info.key.e = ASN1HEX.getHexOfV_AtObj ( pkcs8PrvHex , a1 [ 2 ] ) ;
-1061 info.key.d = ASN1HEX.getHexOfV_AtObj ( pkcs8PrvHex , a1 [ 3 ] ) ;
-1062 info.key.p = ASN1HEX.getHexOfV_AtObj ( pkcs8PrvHex , a1 [ 4 ] ) ;
-1063 info.key.q = ASN1HEX.getHexOfV_AtObj ( pkcs8PrvHex , a1 [ 5 ] ) ;
-1064 info.key.dp = ASN1HEX.getHexOfV_AtObj ( pkcs8PrvHex , a1 [ 6 ] ) ;
-1065 info.key.dq = ASN1HEX.getHexOfV_AtObj ( pkcs8PrvHex , a1 [ 7 ] ) ;
-1066 info.key.co = ASN1HEX.getHexOfV_AtObj ( pkcs8PrvHex , a1 [ 8 ] ) ;
-1067 } ,
-1068
-1069 /**
-1070 * parse hexadecimal string of ECC private key
-1071 * @name parsePrivateRawECKeyHexAtObj
-1072 * @memberOf KEYUTIL
-1073 * @function
-1074 * @param {String} pkcs8PrvHex hexadecimal string of PKCS#8 private key concluding EC private key
-1075 * @return {Array} info associative array to add parsed ECC private key information
-1076 * @since pkcs5pkey 1.0.5
-1077 * @description
-1078 * Following properties are added to associative array 'info'
-1079 * <ul>
-1080 * <li>key - hexadecimal string of ECC private key
-1081 * </ul>
-1082 */
-1083 parsePrivateRawECKeyHexAtObj : function ( pkcs8PrvHex , info ) {
-1084 var keyIdx = info.keyidx ;
-1085
-1086 var key = ASN1HEX.getVbyList ( pkcs8PrvHex , keyIdx , [ 1 ] , "04" ) ;
-1087 var pubkey = ASN1HEX.getVbyList ( pkcs8PrvHex , keyIdx , [ 2 , 0 ] , "03" ) . substr ( 2 ) ;
-1088
-1089 info.key = key ;
-1090 info.pubkey = pubkey ;
-1091 } ,
-1092
-1093 /**
-1094 * parse hexadecimal string of PKCS#8 RSA/EC/DSA public key
-1095 * @name parsePublicPKCS8Hex
-1096 * @memberOf KEYUTIL
-1097 * @function
-1098 * @param {String} pkcs8PubHex hexadecimal string of PKCS#8 public key
-1099 * @return {Hash} hash of key information
-1100 * @description
-1101 * Resulted hash has following attributes.
-1102 * <ul>
-1103 * <li>algoid - hexadecimal string of OID of asymmetric key algorithm</li>
-1104 * <li>algparam - hexadecimal string of OID of ECC curve name, parameter SEQUENCE of DSA or null</li>
-1105 * <li>key - hexadecimal string of public key</li>
-1106 * </ul>
-1107 */
-1108 parsePublicPKCS8Hex : function ( pkcs8PubHex ) {
-1109 var result = { } ;
-1110 result.algparam = null ;
-1111
-1112 // 1. AlgID and Key bit string
-1113 var a1 = ASN1HEX.getPosArrayOfChildren_AtObj ( pkcs8PubHex , 0 ) ;
-1114 if ( a1.length != 2 )
-1115 throw "outer DERSequence shall have 2 elements: " + a1.length ;
-1116
-1117 // 2. AlgID
-1118 var idxAlgIdTLV = a1 [ 0 ] ;
-1119 if ( pkcs8PubHex.substr ( idxAlgIdTLV , 2 ) != "30" )
-1120 throw "malformed PKCS8 public key(code:001)" ; // AlgId not sequence
-1121
-1122 var a2 = ASN1HEX.getPosArrayOfChildren_AtObj ( pkcs8PubHex , idxAlgIdTLV ) ;
-1123 if ( a2.length != 2 )
-1124 throw "malformed PKCS8 public key(code:002)" ; // AlgId not have two elements
-1125
-1126 // 2.1. AlgID OID
-1127 if ( pkcs8PubHex.substr ( a2 [ 0 ] , 2 ) != "06" )
-1128 throw "malformed PKCS8 public key(code:003)" ; // AlgId.oid is not OID
-1129
-1130 result.algoid = ASN1HEX.getHexOfV_AtObj ( pkcs8PubHex , a2 [ 0 ] ) ;
-1131
-1132 // 2.2. AlgID param
-1133 if ( pkcs8PubHex.substr ( a2 [ 1 ] , 2 ) == "06" ) { // OID for EC
-1134 result.algparam = ASN1HEX.getHexOfV_AtObj ( pkcs8PubHex , a2 [ 1 ] ) ;
-1135 } else if ( pkcs8PubHex.substr ( a2 [ 1 ] , 2 ) == "30" ) { // SEQ for DSA
-1136 result.algparam = { } ;
-1137 result.algparam.p = ASN1HEX.getVbyList ( pkcs8PubHex , a2 [ 1 ] , [ 0 ] , "02" ) ;
-1138 result.algparam.q = ASN1HEX.getVbyList ( pkcs8PubHex , a2 [ 1 ] , [ 1 ] , "02" ) ;
-1139 result.algparam.g = ASN1HEX.getVbyList ( pkcs8PubHex , a2 [ 1 ] , [ 2 ] , "02" ) ;
-1140 }
-1141
-1142 // 3. Key
-1143 if ( pkcs8PubHex.substr ( a1 [ 1 ] , 2 ) != "03" )
-1144 throw "malformed PKCS8 public key(code:004)" ; // Key is not bit string
-1145
-1146 result.key = ASN1HEX.getHexOfV_AtObj ( pkcs8PubHex , a1 [ 1 ] ) . substr ( 2 ) ;
-1147
-1148 // 4. return result assoc array
-1149 return result ;
-1150 } ,
-1151
-1152 /**
-1153 * (DEPRECATED) provide hexadecimal string of unencrypted PKCS#8 private key and returns RSAKey object
-1154 * @name getRSAKeyFromPublicPKCS8Hex
-1155 * @memberOf KEYUTIL
-1156 * @function
-1157 * @param {String} pkcs8PubHex hexadecimal string of unencrypted PKCS#8 public key
-1158 * @return {RSAKey} loaded RSAKey object of RSA public key
-1159 * @since pkcs5pkey 1.0.4
-1160 * @deprecated From jsrsasign 4.2.1 please use {@link KEYUTIL.getKey#}.
-1161 */
-1162 getRSAKeyFromPublicPKCS8Hex : function ( pkcs8PubHex ) {
-1163 var a1 = ASN1HEX.getPosArrayOfChildren_AtObj ( pkcs8PubHex , 0 ) ;
-1164 if ( a1.length != 2 )
-1165 throw "outer DERSequence shall have 2 elements: " + a1.length ;
-1166
-1167 var algIdTLV = ASN1HEX.getHexOfTLV_AtObj ( pkcs8PubHex , a1 [ 0 ] ) ;
-1168 if ( algIdTLV != "300d06092a864886f70d0101010500" ) // AlgId rsaEncryption
-1169 throw "PKCS8 AlgorithmId is not rsaEncryption" ;
-1170
-1171 if ( pkcs8PubHex.substr ( a1 [ 1 ] , 2 ) != "03" )
-1172 throw "PKCS8 Public Key is not BITSTRING encapslated." ;
-1173
-1174 var idxPub = ASN1HEX.getStartPosOfV_AtObj ( pkcs8PubHex , a1 [ 1 ] ) + 2 ; // 2 for unused bit
-1175
-1176 if ( pkcs8PubHex.substr ( idxPub , 2 ) != "30" )
-1177 throw "PKCS8 Public Key is not SEQUENCE." ;
-1178
-1179 var a2 = ASN1HEX.getPosArrayOfChildren_AtObj ( pkcs8PubHex , idxPub ) ;
-1180 if ( a2.length != 2 )
-1181 throw "inner DERSequence shall have 2 elements: " + a2.length ;
-1182
-1183 if ( pkcs8PubHex.substr ( a2 [ 0 ] , 2 ) != "02" )
-1184 throw "N is not ASN.1 INTEGER" ;
-1185 if ( pkcs8PubHex.substr ( a2 [ 1 ] , 2 ) != "02" )
-1186 throw "E is not ASN.1 INTEGER" ;
-1187
-1188 var hN = ASN1HEX.getHexOfV_AtObj ( pkcs8PubHex , a2 [ 0 ] ) ;
-1189 var hE = ASN1HEX.getHexOfV_AtObj ( pkcs8PubHex , a2 [ 1 ] ) ;
-1190
-1191 var pubKey = new RSAKey ( ) ;
-1192 pubKey.setPublic ( hN , hE ) ;
-1193
-1194 return pubKey ;
-1195 } ,
-1196
-1197 //addAlgorithm: function(functionObject, algName, keyLen, ivLen) {
-1198 //}
-1199 } ;
-1200 } ( ) ;
-1201
-1202 // -- MAJOR PUBLIC METHODS -------------------------------------------------------
-1203 /**
-1204 * get private or public key object from any arguments
-1205 * @name getKey
-1206 * @memberOf KEYUTIL
-1207 * @function
-1208 * @static
-1209 * @param {Object} param parameter to get key object. see description in detail.
-1210 * @param {String} passcode (OPTION) parameter to get key object. see description in detail.
-1211 * @param {String} hextype (OPTOIN) parameter to get key object. see description in detail.
-1212 * @return {Object} {@link RSAKey}, {@link KJUR.crypto.ECDSA} or {@link KJUR.crypto.ECDSA} object
-1213 * @since keyutil 1.0.0
-1214 * @description
-1215 * This method gets private or public key object({@link RSAKey}, {@link KJUR.crypto.DSA} or {@link KJUR.crypto.ECDSA})
-1216 * for RSA, DSA and ECC.
-1217 * Arguments for this methods depends on a key format you specify.
-1218 * Following key representations are supported.
-1219 * <ul>
-1220 * <li>ECC private/public key object(as is): param=KJUR.crypto.ECDSA</li>
-1221 * <li>DSA private/public key object(as is): param=KJUR.crypto.DSA</li>
-1222 * <li>RSA private/public key object(as is): param=RSAKey </li>
-1223 * <li>ECC private key parameters: param={d: d, curve: curveName}</li>
-1224 * <li>RSA private key parameters: param={n: n, e: e, d: d, p: p, q: q, dp: dp, dq: dq, co: co}<br/>
-1225 * NOTE: Each value shall be hexadecimal string of key spec.</li>
-1226 * <li>DSA private key parameters: param={p: p, q: q, g: g, y: y, x: x}<br/>
-1227 * NOTE: Each value shall be hexadecimal string of key spec.</li>
-1228 * <li>ECC public key parameters: param={xy: xy, curve: curveName}<br/>
-1229 * NOTE: ECC public key 'xy' shall be concatination of "04", x-bytes-hex and y-bytes-hex.</li>
-1230 * <li>DSA public key parameters: param={p: p, q: q, g: g, y: y}<br/>
-1231 * NOTE: Each value shall be hexadecimal string of key spec.</li>
-1232 * <li>RSA public key parameters: param={n: n, e: e} </li>
-1233 * <li>X.509v1/v3 PEM certificate (RSA/DSA/ECC): param=pemString</li>
-1234 * <li>PKCS#8 hexadecimal RSA/ECC public key: param=pemString, null, "pkcs8pub"</li>
-1235 * <li>PKCS#8 PEM RSA/DSA/ECC public key: param=pemString</li>
-1236 * <li>PKCS#5 plain hexadecimal RSA private key: param=hexString, null, "pkcs5prv"</li>
-1237 * <li>PKCS#5 plain PEM DSA/RSA private key: param=pemString</li>
-1238 * <li>PKCS#8 plain PEM RSA/ECDSA private key: param=pemString</li>
-1239 * <li>PKCS#5 encrypted PEM RSA/DSA private key: param=pemString, passcode</li>
-1240 * <li>PKCS#8 encrypted PEM RSA/ECDSA private key: param=pemString, passcode</li>
-1241 * </ul>
-1242 * Please note following limitation on encrypted keys:
-1243 * <ul>
-1244 * <li>Encrypted PKCS#8 only supports PBKDF2/HmacSHA1/3DES</li>
-1245 * <li>Encrypted PKCS#5 supports DES-CBC, DES-EDE3-CBC, AES-{128,192.256}-CBC</li>
-1246 * <li>JWT plain ECC private/public key</li>
-1247 * <li>JWT plain RSA public key</li>
-1248 * <li>JWT plain RSA private key with P/Q/DP/DQ/COEFF</li>
-1249 * <li>JWT plain RSA private key without P/Q/DP/DQ/COEFF (since jsrsasign 5.0.0)</li>
-1250 * </ul>
-1251 * NOTE1: <a href="https://tools.ietf.org/html/rfc7517">RFC 7517 JSON Web Key(JWK)</a> support for RSA/ECC private/public key from jsrsasign 4.8.1.<br/>
-1252 * NOTE2: X509v1 support is added since jsrsasign 5.0.11.
-1253 *
-1254 * <h5>EXAMPLE</h5>
-1255 * @example
-1256 * // 1. loading private key from PEM string
-1257 * keyObj = KEYUTIL.getKey("-----BEGIN RSA PRIVATE KEY...");
-1258 * keyObj = KEYUTIL.getKey("-----BEGIN RSA PRIVATE KEY..., "passcode");
-1259 * keyObj = KEYUTIL.getKey("-----BEGIN PRIVATE KEY...");
-1260 * keyObj = KEYUTIL.getKey("-----BEGIN PRIVATE KEY...", "passcode");
-1261 * // 2. loading public key from PEM string
-1262 * keyObj = KEYUTIL.getKey("-----BEGIN PUBLIC KEY...");
-1263 * keyObj = KEYUTIL.getKey("-----BEGIN X509 CERTIFICATE...");
-1264 * // 3. loading hexadecimal PKCS#5/PKCS#8 key
-1265 * keyObj = KEYUTIL.getKey("308205c1...", null, "pkcs8pub");
-1266 * keyObj = KEYUTIL.getKey("3082048b...", null, "pkcs5prv");
-1267 * // 4. loading JSON Web Key(JWK)
-1268 * keyObj = KEYUTIL.getKey({kty: "RSA", n: "0vx7...", e: "AQAB"});
-1269 * keyObj = KEYUTIL.getKey({kty: "EC", crv: "P-256",
-1270 * x: "MKBC...", y: "4Etl6...", d: "870Mb..."});
-1271 * // 5. bare hexadecimal key
-1272 * keyObj = KEYUTIL.getKey({n: "75ab..", e: "010001"});
-1273 */
-1274 KEYUTIL.getKey = function ( param , passcode , hextype ) {
-1275 // 1. by key RSAKey/KJUR.crypto.ECDSA/KJUR.crypto.DSA object
-1276 if ( typeof RSAKey != 'undefined' && param instanceof RSAKey )
-1277 return param ;
-1278 if ( typeof KJUR.crypto.ECDSA != 'undefined' && param instanceof KJUR.crypto.ECDSA )
-1279 return param ;
-1280 if ( typeof KJUR.crypto.DSA != 'undefined' && param instanceof KJUR.crypto.DSA )
-1281 return param ;
-1282
-1283 // 2. by parameters of key
-1284
-1285 // 2.1. bare ECC
-1286 // 2.1.1. bare ECC public key by hex values
-1287 if ( param.curve !== undefined &&
-1288 param.xy !== undefined && param.d === undefined ) {
-1289 return new KJUR.crypto.ECDSA ( { pub : param.xy , curve : param.curve } ) ;
-1290 }
-1291
-1292 // 2.1.2. bare ECC private key by hex values
-1293 if ( param.curve !== undefined && param.d !== undefined ) {
-1294 return new KJUR.crypto.ECDSA ( { prv : param.d , curve : param.curve } ) ;
-1295 }
-1296
-1297 // 2.2. bare RSA
-1298 // 2.2.1. bare RSA public key by hex values
-1299 if ( param.kty === undefined &&
-1300 param.n !== undefined && param.e !== undefined &&
-1301 param.d === undefined ) {
-1302 var key = new RSAKey ( ) ;
-1303 key.setPublic ( param.n , param.e ) ;
-1304 return key ;
-1305 }
-1306
-1307 // 2.2.2. bare RSA private key with P/Q/DP/DQ/COEFF by hex values
-1308 if ( param.kty === undefined &&
-1309 param.n !== undefined &&
-1310 param.e !== undefined &&
-1311 param.d !== undefined &&
-1312 param.p !== undefined &&
-1313 param.q !== undefined &&
-1314 param.dp !== undefined &&
-1315 param.dq !== undefined &&
-1316 param.co !== undefined &&
-1317 param.qi === undefined ) {
-1318 var key = new RSAKey ( ) ;
-1319 key.setPrivateEx ( param.n , param.e , param.d , param.p , param.q ,
-1320 param.dp , param.dq , param.co ) ;
-1321 return key ;
-1322 }
-1323
-1324 // 2.2.3. bare RSA public key without P/Q/DP/DQ/COEFF by hex values
-1325 if ( param.kty === undefined &&
-1326 param.n !== undefined &&
-1327 param.e !== undefined &&
-1328 param.d !== undefined &&
-1329 param.p === undefined ) {
-1330 var key = new RSAKey ( ) ;
-1331 key.setPrivate ( param.n , param.e , param.d ) ;
-1332 return key ;
-1333 }
-1334
-1335 // 2.3. bare DSA
-1336 // 2.3.1. bare DSA public key by hex values
-1337 if ( param.p !== undefined && param.q !== undefined &&
-1338 param.g !== undefined &&
-1339 param.y !== undefined && param.x === undefined ) {
-1340 var key = new KJUR.crypto.DSA ( ) ;
-1341 key.setPublic ( param.p , param.q , param.g , param.y ) ;
-1342 return key ;
-1343 }
-1344
-1345 // 2.3.2. bare DSA private key by hex values
-1346 if ( param.p !== undefined && param.q !== undefined &&
-1347 param.g !== undefined &&
-1348 param.y !== undefined && param.x !== undefined ) {
-1349 var key = new KJUR.crypto.DSA ( ) ;
-1350 key.setPrivate ( param.p , param.q , param.g , param.y , param.x ) ;
-1351 return key ;
-1352 }
-1353
-1354 // 3. JWK
-1355 // 3.1. JWK RSA
-1356 // 3.1.1. JWK RSA public key by b64u values
-1357 if ( param.kty === "RSA" &&
-1358 param.n !== undefined &&
-1359 param.e !== undefined &&
-1360 param.d === undefined ) {
-1361 var key = new RSAKey ( ) ;
-1362 key.setPublic ( b64utohex ( param.n ) , b64utohex ( param.e ) ) ;
-1363 return key ;
-1364 }
-1365
-1366 // 3.1.2. JWK RSA private key with p/q/dp/dq/coeff by b64u values
-1367 if ( param.kty === "RSA" &&
-1368 param.n !== undefined &&
-1369 param.e !== undefined &&
-1370 param.d !== undefined &&
-1371 param.p !== undefined &&
-1372 param.q !== undefined &&
-1373 param.dp !== undefined &&
-1374 param.dq !== undefined &&
-1375 param.qi !== undefined ) {
-1376 var key = new RSAKey ( ) ;
-1377 key.setPrivateEx ( b64utohex ( param.n ) ,
-1378 b64utohex ( param.e ) ,
-1379 b64utohex ( param.d ) ,
-1380 b64utohex ( param.p ) ,
-1381 b64utohex ( param.q ) ,
-1382 b64utohex ( param.dp ) ,
-1383 b64utohex ( param.dq ) ,
-1384 b64utohex ( param.qi ) ) ;
-1385 return key ;
-1386 }
-1387
-1388 // 3.1.3. JWK RSA private key without p/q/dp/dq/coeff by b64u
-1389 // since jsrsasign 5.0.0 keyutil 1.0.11
-1390 if ( param.kty === "RSA" &&
-1391 param.n !== undefined &&
-1392 param.e !== undefined &&
-1393 param.d !== undefined ) {
-1394 var key = new RSAKey ( ) ;
-1395 key.setPrivate ( b64utohex ( param.n ) ,
-1396 b64utohex ( param.e ) ,
-1397 b64utohex ( param.d ) ) ;
-1398 return key ;
-1399 }
-1400
-1401 // 3.2. JWK ECC
-1402 // 3.2.1. JWK ECC public key by b64u values
-1403 if ( param.kty === "EC" &&
-1404 param.crv !== undefined &&
-1405 param.x !== undefined &&
-1406 param.y !== undefined &&
-1407 param.d === undefined ) {
-1408 var ec = new KJUR.crypto.ECDSA ( { "curve" : param.crv } ) ;
-1409 var charlen = ec.ecparams.keylen / 4 ;
-1410 var hX = ( "0000000000" + b64utohex ( param.x ) ) . slice ( - charlen ) ;
-1411 var hY = ( "0000000000" + b64utohex ( param.y ) ) . slice ( - charlen ) ;
-1412 var hPub = "04" + hX + hY ;
-1413 ec.setPublicKeyHex ( hPub ) ;
-1414 return ec ;
-1415 }
-1416
-1417 // 3.2.2. JWK ECC private key by b64u values
-1418 if ( param.kty === "EC" &&
-1419 param.crv !== undefined &&
-1420 param.x !== undefined &&
-1421 param.y !== undefined &&
-1422 param.d !== undefined ) {
-1423 var ec = new KJUR.crypto.ECDSA ( { "curve" : param.crv } ) ;
-1424 var charlen = ec.ecparams.keylen / 4 ;
-1425 var hPrv = ( "0000000000" + b64utohex ( param.d ) ) . slice ( - charlen ) ;
-1426 ec.setPrivateKeyHex ( hPrv ) ;
-1427 return ec ;
-1428 }
-1429
-1430 // 4. by PEM certificate (-----BEGIN ... CERTIFITE----)
-1431 if ( param.indexOf ( "-END CERTIFICATE-" , 0 ) != - 1 ||
-1432 param.indexOf ( "-END X509 CERTIFICATE-" , 0 ) != - 1 ||
-1433 param.indexOf ( "-END TRUSTED CERTIFICATE-" , 0 ) != - 1 ) {
-1434 return X509.getPublicKeyFromCertPEM ( param ) ;
-1435 }
-1436
-1437 // 4. public key by PKCS#8 hexadecimal string
-1438 if ( hextype === "pkcs8pub" ) {
-1439 return KEYUTIL.getKeyFromPublicPKCS8Hex ( param ) ;
-1440 }
-1441
-1442 // 5. public key by PKCS#8 PEM string
-1443 if ( param.indexOf ( "-END PUBLIC KEY-" ) != - 1 ) {
-1444 return KEYUTIL.getKeyFromPublicPKCS8PEM ( param ) ;
-1445 }
-1446
-1447 // 6. private key by PKCS#5 plain hexadecimal RSA string
-1448 if ( hextype === "pkcs5prv" ) {
-1449 var key = new RSAKey ( ) ;
-1450 key.readPrivateKeyFromASN1HexString ( param ) ;
-1451 return key ;
-1452 }
-1453
-1454 // 7. private key by plain PKCS#5 hexadecimal RSA string
-1455 if ( hextype === "pkcs5prv" ) {
-1456 var key = new RSAKey ( ) ;
-1457 key.readPrivateKeyFromASN1HexString ( param ) ;
-1458 return key ;
-1459 }
-1460
-1461 // 8. private key by plain PKCS#5 PEM RSA string
-1462 // getKey("-----BEGIN RSA PRIVATE KEY-...")
-1463 if ( param.indexOf ( "-END RSA PRIVATE KEY-" ) != - 1 &&
-1464 param.indexOf ( "4,ENCRYPTED" ) == - 1 ) {
-1465 var hex = KEYUTIL.getHexFromPEM ( param , "RSA PRIVATE KEY" ) ;
-1466 return KEYUTIL.getKey ( hex , null , "pkcs5prv" ) ;
-1467 }
-1468
-1469 // 8.2. private key by plain PKCS#5 PEM DSA string
-1470 if ( param.indexOf ( "-END DSA PRIVATE KEY-" ) != - 1 &&
-1471 param.indexOf ( "4,ENCRYPTED" ) == - 1 ) {
-1472
-1473 var hKey = this.getHexFromPEM ( param , "DSA PRIVATE KEY" ) ;
-1474 var p = ASN1HEX.getVbyList ( hKey , 0 , [ 1 ] , "02" ) ;
-1475 var q = ASN1HEX.getVbyList ( hKey , 0 , [ 2 ] , "02" ) ;
-1476 var g = ASN1HEX.getVbyList ( hKey , 0 , [ 3 ] , "02" ) ;
-1477 var y = ASN1HEX.getVbyList ( hKey , 0 , [ 4 ] , "02" ) ;
-1478 var x = ASN1HEX.getVbyList ( hKey , 0 , [ 5 ] , "02" ) ;
-1479 var key = new KJUR.crypto.DSA ( ) ;
-1480 key.setPrivate ( new BigInteger ( p , 16 ) ,
-1481 new BigInteger ( q , 16 ) ,
-1482 new BigInteger ( g , 16 ) ,
-1483 new BigInteger ( y , 16 ) ,
-1484 new BigInteger ( x , 16 ) ) ;
-1485 return key ;
-1486 }
-1487
-1488 // 9. private key by plain PKCS#8 PEM ECC/RSA string
-1489 if ( param.indexOf ( "-END PRIVATE KEY-" ) != - 1 ) {
-1490 return KEYUTIL.getKeyFromPlainPrivatePKCS8PEM ( param ) ;
-1491 }
-1492
-1493 // 10. private key by encrypted PKCS#5 PEM RSA string
-1494 if ( param.indexOf ( "-END RSA PRIVATE KEY-" ) != - 1 &&
-1495 param.indexOf ( "4,ENCRYPTED" ) != - 1 ) {
-1496 return KEYUTIL.getRSAKeyFromEncryptedPKCS5PEM ( param , passcode ) ;
-1497 }
-1498
-1499 // 10.2. private key by encrypted PKCS#5 PEM ECDSA string
-1500 if ( param.indexOf ( "-END EC PRIVATE KEY-" ) != - 1 &&
-1501 param.indexOf ( "4,ENCRYPTED" ) != - 1 ) {
-1502 var hKey = KEYUTIL.getDecryptedKeyHex ( param , passcode ) ;
-1503
-1504 var key = ASN1HEX.getVbyList ( hKey , 0 , [ 1 ] , "04" ) ;
-1505 var curveNameOidHex = ASN1HEX.getVbyList ( hKey , 0 , [ 2 , 0 ] , "06" ) ;
-1506 var pubkey = ASN1HEX.getVbyList ( hKey , 0 , [ 3 , 0 ] , "03" ) . substr ( 2 ) ;
-1507 var curveName = "" ;
-1508
-1509 if ( KJUR.crypto.OID.oidhex2name [ curveNameOidHex ] !== undefined ) {
-1510 curveName = KJUR.crypto.OID.oidhex2name [ curveNameOidHex ] ;
-1511 } else {
-1512 throw "undefined OID(hex) in KJUR.crypto.OID: " + curveNameOidHex ;
-1513 }
-1514
-1515 var ec = new KJUR.crypto.ECDSA ( { 'name' : curveName } ) ;
-1516 ec.setPublicKeyHex ( pubkey ) ;
-1517 ec.setPrivateKeyHex ( key ) ;
-1518 ec.isPublic = false ;
-1519 return ec ;
-1520 }
-1521
-1522 // 10.3. private key by encrypted PKCS#5 PEM DSA string
-1523 if ( param.indexOf ( "-END DSA PRIVATE KEY-" ) != - 1 &&
-1524 param.indexOf ( "4,ENCRYPTED" ) != - 1 ) {
-1525 var hKey = KEYUTIL.getDecryptedKeyHex ( param , passcode ) ;
-1526 var p = ASN1HEX.getVbyList ( hKey , 0 , [ 1 ] , "02" ) ;
-1527 var q = ASN1HEX.getVbyList ( hKey , 0 , [ 2 ] , "02" ) ;
-1528 var g = ASN1HEX.getVbyList ( hKey , 0 , [ 3 ] , "02" ) ;
-1529 var y = ASN1HEX.getVbyList ( hKey , 0 , [ 4 ] , "02" ) ;
-1530 var x = ASN1HEX.getVbyList ( hKey , 0 , [ 5 ] , "02" ) ;
-1531 var key = new KJUR.crypto.DSA ( ) ;
-1532 key.setPrivate ( new BigInteger ( p , 16 ) ,
-1533 new BigInteger ( q , 16 ) ,
-1534 new BigInteger ( g , 16 ) ,
-1535 new BigInteger ( y , 16 ) ,
-1536 new BigInteger ( x , 16 ) ) ;
-1537 return key ;
-1538 }
-1539
-1540 // 11. private key by encrypted PKCS#8 hexadecimal RSA/ECDSA string
-1541 if ( param.indexOf ( "-END ENCRYPTED PRIVATE KEY-" ) != - 1 ) {
-1542 return KEYUTIL.getKeyFromEncryptedPKCS8PEM ( param , passcode ) ;
-1543 }
-1544
-1545 throw "not supported argument" ;
-1546 } ;
-1547
-1548 /**
-1549 * @name generateKeypair
-1550 * @memberOf KEYUTIL
-1551 * @function
-1552 * @static
-1553 * @param {String} alg 'RSA' or 'EC'
-1554 * @param {Object} keylenOrCurve key length for RSA or curve name for EC
-1555 * @return {Array} associative array of keypair which has prvKeyObj and pubKeyObj parameters
-1556 * @since keyutil 1.0.1
-1557 * @description
-1558 * This method generates a key pair of public key algorithm.
-1559 * The result will be an associative array which has following
-1560 * parameters:
-1561 * <ul>
-1562 * <li>prvKeyObj - RSAKey or ECDSA object of private key</li>
-1563 * <li>pubKeyObj - RSAKey or ECDSA object of public key</li>
-1564 * </ul>
-1565 * NOTE1: As for RSA algoirthm, public exponent has fixed
-1566 * value '0x10001'.
-1567 * NOTE2: As for EC algorithm, supported names of curve are
-1568 * secp256r1, secp256k1 and secp384r1.
-1569 * NOTE3: DSA is not supported yet.
-1570 * @example
-1571 * var rsaKeypair = KEYUTIL.generateKeypair("RSA", 1024);
-1572 * var ecKeypair = KEYUTIL.generateKeypair("EC", "secp256r1");
-1573 *
-1574 */
-1575 KEYUTIL.generateKeypair = function ( alg , keylenOrCurve ) {
-1576 if ( alg == "RSA" ) {
-1577 var keylen = keylenOrCurve ;
-1578 var prvKey = new RSAKey ( ) ;
-1579 prvKey.generate ( keylen , '10001' ) ;
-1580 prvKey.isPrivate = true ;
-1581 prvKey.isPublic = true ;
-1582
-1583 var pubKey = new RSAKey ( ) ;
-1584 var hN = prvKey.n.toString ( 16 ) ;
-1585 var hE = prvKey.e.toString ( 16 ) ;
-1586 pubKey.setPublic ( hN , hE ) ;
-1587 pubKey.isPrivate = false ;
-1588 pubKey.isPublic = true ;
-1589
-1590 var result = { } ;
-1591 result.prvKeyObj = prvKey ;
-1592 result.pubKeyObj = pubKey ;
-1593 return result ;
-1594 } else if ( alg == "EC" ) {
-1595 var curve = keylenOrCurve ;
-1596 var ec = new KJUR.crypto.ECDSA ( { curve : curve } ) ;
-1597 var keypairHex = ec.generateKeyPairHex ( ) ;
-1598
-1599 var prvKey = new KJUR.crypto.ECDSA ( { curve : curve } ) ;
-1600 prvKey.setPrivateKeyHex ( keypairHex.ecprvhex ) ;
-1601 prvKey.isPrivate = true ;
-1602 prvKey.isPublic = false ;
-1603
-1604 var pubKey = new KJUR.crypto.ECDSA ( { curve : curve } ) ;
-1605 pubKey.setPublicKeyHex ( keypairHex.ecpubhex ) ;
-1606 pubKey.isPrivate = false ;
-1607 pubKey.isPublic = true ;
-1608
-1609 var result = { } ;
-1610 result.prvKeyObj = prvKey ;
-1611 result.pubKeyObj = pubKey ;
-1612 return result ;
-1613 } else {
-1614 throw "unknown algorithm: " + alg ;
-1615 }
-1616 } ;
-1617
-1618 /**
-1619 * get PEM formatted private or public key file from a RSA/ECDSA/DSA key object
-1620 * @name getPEM
-1621 * @memberOf KEYUTIL
-1622 * @function
-1623 * @static
-1624 * @param {Object} keyObjOrHex key object {@link RSAKey}, {@link KJUR.crypto.ECDSA} or {@link KJUR.crypto.DSA} to encode to
-1625 * @param {String} formatType (OPTION) output format type of "PKCS1PRV", "PKCS5PRV" or "PKCS8PRV" for private key
-1626 * @param {String} passwd (OPTION) password to protect private key
-1627 * @param {String} encAlg (OPTION) encryption algorithm for PKCS#5. currently supports DES-CBC, DES-EDE3-CBC and AES-{128,192,256}-CBC
-1628 * @since keyutil 1.0.4
-1629 * @description
-1630 * <dl>
-1631 * <dt><b>NOTE1:</b>
-1632 * <dd>
-1633 * PKCS#5 encrypted private key protection algorithm supports DES-CBC,
-1634 * DES-EDE3-CBC and AES-{128,192,256}-CBC
-1635 * <dt><b>NOTE2:</b>
-1636 * <dd>
-1637 * OpenSSL supports
-1638 * </dl>
-1639 * @example
-1640 * KEUUTIL.getPEM(publicKey) => generates PEM PKCS#8 public key
-1641 * KEUUTIL.getPEM(privateKey, "PKCS1PRV") => generates PEM PKCS#1 plain private key
-1642 * KEUUTIL.getPEM(privateKey, "PKCS5PRV", "pass") => generates PEM PKCS#5 encrypted private key
-1643 * with DES-EDE3-CBC (DEFAULT)
-1644 * KEUUTIL.getPEM(privateKey, "PKCS5PRV", "pass", "DES-CBC") => generates PEM PKCS#5 encrypted
-1645 * private key with DES-CBC
-1646 * KEUUTIL.getPEM(privateKey, "PKCS8PRV") => generates PEM PKCS#8 plain private key
-1647 * KEUUTIL.getPEM(privateKey, "PKCS8PRV", "pass") => generates PEM PKCS#8 encrypted private key
-1648 * with PBKDF2_HmacSHA1_3DES
-1649 */
-1650 KEYUTIL.getPEM = function ( keyObjOrHex , formatType , passwd , encAlg , hexType ) {
-1651 var ns1 = KJUR.asn1 ;
-1652 var ns2 = KJUR.crypto ;
-1653
-1654 function _rsaprv2asn1obj ( keyObjOrHex ) {
-1655 var asn1Obj = KJUR.asn1.ASN1Util.newObject ( {
-1656 "seq" : [
-1657 { "int" : 0 } ,
-1658 { "int" : { "bigint" : keyObjOrHex.n } } ,
-1659 { "int" : keyObjOrHex.e } ,
-1660 { "int" : { "bigint" : keyObjOrHex.d } } ,
-1661 { "int" : { "bigint" : keyObjOrHex.p } } ,
-1662 { "int" : { "bigint" : keyObjOrHex.q } } ,
-1663 { "int" : { "bigint" : keyObjOrHex.dmp1 } } ,
-1664 { "int" : { "bigint" : keyObjOrHex.dmq1 } } ,
-1665 { "int" : { "bigint" : keyObjOrHex.coeff } }
-1666 ]
-1667 } ) ;
-1668 return asn1Obj ;
-1669 } ;
-1670
-1671 function _ecdsaprv2asn1obj ( keyObjOrHex ) {
-1672 var asn1Obj2 = KJUR.asn1.ASN1Util.newObject ( {
-1673 "seq" : [
-1674 { "int" : 1 } ,
-1675 { "octstr" : { "hex" : keyObjOrHex.prvKeyHex } } ,
-1676 { "tag" : [ 'a0' , true , { 'oid' : { 'name' : keyObjOrHex.curveName } } ] } ,
-1677 { "tag" : [ 'a1' , true , { 'bitstr' : { 'hex' : '00' + keyObjOrHex.pubKeyHex } } ] }
-1678 ]
-1679 } ) ;
-1680 return asn1Obj2 ;
-1681 } ;
-1682
-1683 function _dsaprv2asn1obj ( keyObjOrHex ) {
-1684 var asn1Obj = KJUR.asn1.ASN1Util.newObject ( {
-1685 "seq" : [
-1686 { "int" : 0 } ,
-1687 { "int" : { "bigint" : keyObjOrHex.p } } ,
-1688 { "int" : { "bigint" : keyObjOrHex.q } } ,
-1689 { "int" : { "bigint" : keyObjOrHex.g } } ,
-1690 { "int" : { "bigint" : keyObjOrHex.y } } ,
-1691 { "int" : { "bigint" : keyObjOrHex.x } }
-1692 ]
-1693 } ) ;
-1694 return asn1Obj ;
-1695 } ;
-1696
-1697 // 1. public key
-1698
-1699 // x. PEM PKCS#8 public key of RSA/ECDSA/DSA public key object
-1700 if ( ( ( typeof RSAKey != "undefined" && keyObjOrHex instanceof RSAKey ) ||
-1701 ( typeof ns2.DSA != "undefined" && keyObjOrHex instanceof ns2.DSA ) ||
-1702 ( typeof ns2.ECDSA != "undefined" && keyObjOrHex instanceof ns2.ECDSA ) ) &&
-1703 keyObjOrHex.isPublic == true &&
-1704 ( formatType === undefined || formatType == "PKCS8PUB" ) ) {
-1705 var asn1Obj = new KJUR.asn1.x509.SubjectPublicKeyInfo ( keyObjOrHex ) ;
-1706 var asn1Hex = asn1Obj.getEncodedHex ( ) ;
-1707 return ns1.ASN1Util.getPEMStringFromHex ( asn1Hex , "PUBLIC KEY" ) ;
-1708 }
-1709
-1710 // 2. private
-1711
-1712 // x. PEM PKCS#1 plain private key of RSA private key object
-1713 if ( formatType == "PKCS1PRV" &&
-1714 typeof RSAKey != "undefined" &&
-1715 keyObjOrHex instanceof RSAKey &&
-1716 ( passwd === undefined || passwd == null ) &&
-1717 keyObjOrHex.isPrivate == true ) {
-1718
-1719 var asn1Obj = _rsaprv2asn1obj ( keyObjOrHex ) ;
-1720 var asn1Hex = asn1Obj.getEncodedHex ( ) ;
-1721 return ns1.ASN1Util.getPEMStringFromHex ( asn1Hex , "RSA PRIVATE KEY" ) ;
-1722 }
-1723
-1724 // x. PEM PKCS#1 plain private key of ECDSA private key object
-1725 if ( formatType == "PKCS1PRV" &&
-1726 typeof RSAKey != "undefined" &&
-1727 keyObjOrHex instanceof KJUR.crypto.ECDSA &&
-1728 ( passwd === undefined || passwd == null ) &&
-1729 keyObjOrHex.isPrivate == true ) {
-1730
-1731 var asn1Obj1 = new KJUR.asn1.DERObjectIdentifier ( { 'name' : keyObjOrHex.curveName } ) ;
-1732 var asn1Hex1 = asn1Obj1.getEncodedHex ( ) ;
-1733 var asn1Obj2 = _ecdsaprv2asn1obj ( keyObjOrHex ) ;
-1734 var asn1Hex2 = asn1Obj2.getEncodedHex ( ) ;
-1735
-1736 var s = "" ;
-1737 s + = ns1.ASN1Util.getPEMStringFromHex ( asn1Hex1 , "EC PARAMETERS" ) ;
-1738 s + = ns1.ASN1Util.getPEMStringFromHex ( asn1Hex2 , "EC PRIVATE KEY" ) ;
-1739 return s ;
-1740 }
-1741
-1742 // x. PEM PKCS#1 plain private key of DSA private key object
-1743 if ( formatType == "PKCS1PRV" &&
-1744 typeof KJUR.crypto.DSA != "undefined" &&
-1745 keyObjOrHex instanceof KJUR.crypto.DSA &&
-1746 ( passwd === undefined || passwd == null ) &&
-1747 keyObjOrHex.isPrivate == true ) {
-1748
-1749 var asn1Obj = _dsaprv2asn1obj ( keyObjOrHex ) ;
-1750 var asn1Hex = asn1Obj.getEncodedHex ( ) ;
-1751 return ns1.ASN1Util.getPEMStringFromHex ( asn1Hex , "DSA PRIVATE KEY" ) ;
-1752 }
-1753
-1754 // 3. private
-1755
-1756 // x. PEM PKCS#5 encrypted private key of RSA private key object
-1757 if ( formatType == "PKCS5PRV" &&
-1758 typeof RSAKey != "undefined" &&
-1759 keyObjOrHex instanceof RSAKey &&
-1760 ( passwd !== undefined && passwd != null ) &&
-1761 keyObjOrHex.isPrivate == true ) {
-1762
-1763 var asn1Obj = _rsaprv2asn1obj ( keyObjOrHex ) ;
-1764 var asn1Hex = asn1Obj.getEncodedHex ( ) ;
-1765
-1766 if ( encAlg === undefined ) encAlg = "DES-EDE3-CBC" ;
-1767 return this.getEncryptedPKCS5PEMFromPrvKeyHex ( "RSA" , asn1Hex , passwd , encAlg ) ;
-1768 }
-1769
-1770 // x. PEM PKCS#5 encrypted private key of ECDSA private key object
-1771 if ( formatType == "PKCS5PRV" &&
-1772 typeof KJUR.crypto.ECDSA != "undefined" &&
-1773 keyObjOrHex instanceof KJUR.crypto.ECDSA &&
-1774 ( passwd !== undefined && passwd != null ) &&
-1775 keyObjOrHex.isPrivate == true ) {
-1776
-1777 var asn1Obj = _ecdsaprv2asn1obj ( keyObjOrHex ) ;
-1778 var asn1Hex = asn1Obj.getEncodedHex ( ) ;
-1779
-1780 if ( encAlg === undefined ) encAlg = "DES-EDE3-CBC" ;
-1781 return this.getEncryptedPKCS5PEMFromPrvKeyHex ( "EC" , asn1Hex , passwd , encAlg ) ;
-1782 }
-1783
-1784 // x. PEM PKCS#5 encrypted private key of DSA private key object
-1785 if ( formatType == "PKCS5PRV" &&
-1786 typeof KJUR.crypto.DSA != "undefined" &&
-1787 keyObjOrHex instanceof KJUR.crypto.DSA &&
-1788 ( passwd !== undefined && passwd != null ) &&
-1789 keyObjOrHex.isPrivate == true ) {
-1790
-1791 var asn1Obj = _dsaprv2asn1obj ( keyObjOrHex ) ;
-1792 var asn1Hex = asn1Obj.getEncodedHex ( ) ;
-1793
-1794 if ( encAlg === undefined ) encAlg = "DES-EDE3-CBC" ;
-1795 return this.getEncryptedPKCS5PEMFromPrvKeyHex ( "DSA" , asn1Hex , passwd , encAlg ) ;
-1796 }
-1797
-1798 // x. ======================================================================
-1799
-1800 var _getEncryptedPKCS8 = function ( plainKeyHex , passcode ) {
-1801 var info = _getEencryptedPKCS8Info ( plainKeyHex , passcode ) ;
-1802 //alert("iv=" + info.encryptionSchemeIV);
-1803 //alert("info.ciphertext2[" + info.ciphertext.length + "=" + info.ciphertext);
-1804 var asn1Obj = new KJUR.asn1.ASN1Util.newObject ( {
-1805 "seq" : [
-1806 { "seq" : [
-1807 { "oid" : { "name" : "pkcs5PBES2" } } ,
-1808 { "seq" : [
-1809 { "seq" : [
-1810 { "oid" : { "name" : "pkcs5PBKDF2" } } ,
-1811 { "seq" : [
-1812 { "octstr" : { "hex" : info.pbkdf2Salt } } ,
-1813 { "int" : info.pbkdf2Iter }
-1814 ] }
-1815 ] } ,
-1816 { "seq" : [
-1817 { "oid" : { "name" : "des-EDE3-CBC" } } ,
-1818 { "octstr" : { "hex" : info.encryptionSchemeIV } }
-1819 ] }
-1820 ] }
-1821 ] } ,
-1822 { "octstr" : { "hex" : info.ciphertext } }
-1823 ]
-1824 } ) ;
-1825 return asn1Obj.getEncodedHex ( ) ;
-1826 } ;
-1827
-1828 var _getEencryptedPKCS8Info = function ( plainKeyHex , passcode ) {
-1829 var pbkdf2Iter = 100 ;
-1830 var pbkdf2SaltWS = CryptoJS.lib.WordArray.random ( 8 ) ;
-1831 var encryptionSchemeAlg = "DES-EDE3-CBC" ;
-1832 var encryptionSchemeIVWS = CryptoJS.lib.WordArray.random ( 8 ) ;
-1833 // PBKDF2 key
-1834 var pbkdf2KeyWS = CryptoJS.PBKDF2 ( passcode ,
-1835 pbkdf2SaltWS , { "keySize" : 192 / 32 ,
-1836 "iterations" : pbkdf2Iter } ) ;
-1837 // ENCRYPT
-1838 var plainKeyWS = CryptoJS.enc.Hex.parse ( plainKeyHex ) ;
-1839 var encryptedKeyHex =
-1840 CryptoJS.TripleDES.encrypt ( plainKeyWS , pbkdf2KeyWS , { "iv" : encryptionSchemeIVWS } ) + "" ;
-1841
-1842 //alert("encryptedKeyHex=" + encryptedKeyHex);
-1843
-1844 var info = { } ;
-1845 info.ciphertext = encryptedKeyHex ;
-1846 //alert("info.ciphertext=" + info.ciphertext);
-1847 info.pbkdf2Salt = CryptoJS.enc.Hex.stringify ( pbkdf2SaltWS ) ;
-1848 info.pbkdf2Iter = pbkdf2Iter ;
-1849 info.encryptionSchemeAlg = encryptionSchemeAlg ;
-1850 info.encryptionSchemeIV = CryptoJS.enc.Hex.stringify ( encryptionSchemeIVWS ) ;
-1851 return info ;
-1852 } ;
-1853
-1854 // x. PEM PKCS#8 plain private key of RSA private key object
-1855 if ( formatType == "PKCS8PRV" &&
-1856 typeof RSAKey != "undefined" &&
-1857 keyObjOrHex instanceof RSAKey &&
-1858 keyObjOrHex.isPrivate == true ) {
-1859
-1860 var keyObj = _rsaprv2asn1obj ( keyObjOrHex ) ;
-1861 var keyHex = keyObj.getEncodedHex ( ) ;
-1862
-1863 var asn1Obj = KJUR.asn1.ASN1Util.newObject ( {
-1864 "seq" : [
-1865 { "int" : 0 } ,
-1866 { "seq" : [ { "oid" : { "name" : "rsaEncryption" } } , { "null" : true } ] } ,
-1867 { "octstr" : { "hex" : keyHex } }
-1868 ]
-1869 } ) ;
-1870 var asn1Hex = asn1Obj.getEncodedHex ( ) ;
-1871
-1872 if ( passwd === undefined || passwd == null ) {
-1873 return ns1.ASN1Util.getPEMStringFromHex ( asn1Hex , "PRIVATE KEY" ) ;
-1874 } else {
-1875 var asn1Hex2 = _getEncryptedPKCS8 ( asn1Hex , passwd ) ;
-1876 return ns1.ASN1Util.getPEMStringFromHex ( asn1Hex2 , "ENCRYPTED PRIVATE KEY" ) ;
-1877 }
-1878 }
-1879
-1880 // x. PEM PKCS#8 plain private key of ECDSA private key object
-1881 if ( formatType == "PKCS8PRV" &&
-1882 typeof KJUR.crypto.ECDSA != "undefined" &&
-1883 keyObjOrHex instanceof KJUR.crypto.ECDSA &&
-1884 keyObjOrHex.isPrivate == true ) {
-1885
-1886 var keyObj = new KJUR.asn1.ASN1Util.newObject ( {
-1887 "seq" : [
-1888 { "int" : 1 } ,
-1889 { "octstr" : { "hex" : keyObjOrHex.prvKeyHex } } ,
-1890 { "tag" : [ 'a1' , true , { "bitstr" : { "hex" : "00" + keyObjOrHex.pubKeyHex } } ] }
-1891 ]
-1892 } ) ;
-1893 var keyHex = keyObj.getEncodedHex ( ) ;
-1894
-1895 var asn1Obj = KJUR.asn1.ASN1Util.newObject ( {
-1896 "seq" : [
-1897 { "int" : 0 } ,
-1898 { "seq" : [
-1899 { "oid" : { "name" : "ecPublicKey" } } ,
-1900 { "oid" : { "name" : keyObjOrHex.curveName } }
-1901 ] } ,
-1902 { "octstr" : { "hex" : keyHex } }
-1903 ]
-1904 } ) ;
-1905
-1906 var asn1Hex = asn1Obj.getEncodedHex ( ) ;
-1907 if ( passwd === undefined || passwd == null ) {
-1908 return ns1.ASN1Util.getPEMStringFromHex ( asn1Hex , "PRIVATE KEY" ) ;
-1909 } else {
-1910 var asn1Hex2 = _getEncryptedPKCS8 ( asn1Hex , passwd ) ;
-1911 return ns1.ASN1Util.getPEMStringFromHex ( asn1Hex2 , "ENCRYPTED PRIVATE KEY" ) ;
-1912 }
-1913 }
-1914
-1915 // x. PEM PKCS#8 plain private key of DSA private key object
-1916 if ( formatType == "PKCS8PRV" &&
-1917 typeof KJUR.crypto.DSA != "undefined" &&
-1918 keyObjOrHex instanceof KJUR.crypto.DSA &&
-1919 keyObjOrHex.isPrivate == true ) {
-1920
-1921 var keyObj = new KJUR.asn1.DERInteger ( { 'bigint' : keyObjOrHex.x } ) ;
-1922 var keyHex = keyObj.getEncodedHex ( ) ;
-1923
-1924 var asn1Obj = KJUR.asn1.ASN1Util.newObject ( {
-1925 "seq" : [
-1926 { "int" : 0 } ,
-1927 { "seq" : [
-1928 { "oid" : { "name" : "dsa" } } ,
-1929 { "seq" : [
-1930 { "int" : { "bigint" : keyObjOrHex.p } } ,
-1931 { "int" : { "bigint" : keyObjOrHex.q } } ,
-1932 { "int" : { "bigint" : keyObjOrHex.g } }
-1933 ] }
-1934 ] } ,
-1935 { "octstr" : { "hex" : keyHex } }
-1936 ]
-1937 } ) ;
-1938
-1939 var asn1Hex = asn1Obj.getEncodedHex ( ) ;
-1940 if ( passwd === undefined || passwd == null ) {
-1941 return ns1.ASN1Util.getPEMStringFromHex ( asn1Hex , "PRIVATE KEY" ) ;
-1942 } else {
-1943 var asn1Hex2 = _getEncryptedPKCS8 ( asn1Hex , passwd ) ;
-1944 return ns1.ASN1Util.getPEMStringFromHex ( asn1Hex2 , "ENCRYPTED PRIVATE KEY" ) ;
-1945 }
-1946 }
-1947
-1948 throw "unsupported object nor format" ;
-1949 } ;
-1950
-1951 // -- PUBLIC METHODS FOR CSR -------------------------------------------------------
-1952
-1953 /**
-1954 * get RSAKey/DSA/ECDSA public key object from PEM formatted PKCS#10 CSR string
-1955 * @name getKeyFromCSRPEM
-1956 * @memberOf KEYUTIL
-1957 * @function
-1958 * @param {String} csrPEM PEM formatted PKCS#10 CSR string
-1959 * @return {Object} RSAKey/DSA/ECDSA public key object
-1960 * @since keyutil 1.0.5
-1961 */
-1962 KEYUTIL.getKeyFromCSRPEM = function ( csrPEM ) {
-1963 var csrHex = KEYUTIL.getHexFromPEM ( csrPEM , "CERTIFICATE REQUEST" ) ;
-1964 var key = KEYUTIL.getKeyFromCSRHex ( csrHex ) ;
-1965 return key ;
-1966 } ;
-1967
-1968 /**
-1969 * get RSAKey/DSA/ECDSA public key object from hexadecimal string of PKCS#10 CSR
-1970 * @name getKeyFromCSRHex
-1971 * @memberOf KEYUTIL
-1972 * @function
-1973 * @param {String} csrHex hexadecimal string of PKCS#10 CSR
-1974 * @return {Object} RSAKey/DSA/ECDSA public key object
-1975 * @since keyutil 1.0.5
-1976 */
-1977 KEYUTIL.getKeyFromCSRHex = function ( csrHex ) {
-1978 var info = KEYUTIL.parseCSRHex ( csrHex ) ;
-1979 var key = KEYUTIL.getKey ( info.p8pubkeyhex , null , "pkcs8pub" ) ;
-1980 return key ;
-1981 } ;
-1982
-1983 /**
-1984 * parse hexadecimal string of PKCS#10 CSR (certificate signing request)
-1985 * @name parseCSRHex
-1986 * @memberOf KEYUTIL
-1987 * @function
-1988 * @param {String} csrHex hexadecimal string of PKCS#10 CSR
-1989 * @return {Array} associative array of parsed CSR
-1990 * @since keyutil 1.0.5
-1991 * @description
-1992 * Resulted associative array has following properties:
-1993 * <ul>
-1994 * <li>p8pubkeyhex - hexadecimal string of subject public key in PKCS#8</li>
-1995 * </ul>
-1996 */
-1997 KEYUTIL.parseCSRHex = function ( csrHex ) {
-1998 var result = { } ;
-1999 var h = csrHex ;
-2000
-2001 // 1. sequence
-2002 if ( h.substr ( 0 , 2 ) != "30" )
-2003 throw "malformed CSR(code:001)" ; // not sequence
-2004
-2005 var a1 = ASN1HEX.getPosArrayOfChildren_AtObj ( h , 0 ) ;
-2006 if ( a1.length < 1 )
-2007 throw "malformed CSR(code:002)" ; // short length
-2008
-2009 // 2. 2nd sequence
-2010 if ( h.substr ( a1 [ 0 ] , 2 ) != "30" )
-2011 throw "malformed CSR(code:003)" ; // not sequence
-2012
-2013 var a2 = ASN1HEX.getPosArrayOfChildren_AtObj ( h , a1 [ 0 ] ) ;
-2014 if ( a2.length < 3 )
-2015 throw "malformed CSR(code:004)" ; // 2nd seq short elem
-2016
-2017 result.p8pubkeyhex = ASN1HEX.getHexOfTLV_AtObj ( h , a2 [ 2 ] ) ;
-2018
-2019 return result ;
-2020 } ;
-2021
\ No newline at end of file
diff --git a/jwt/api/symbols/src/nodeutil-1.0.js.html b/jwt/api/symbols/src/nodeutil-1.0.js.html
deleted file mode 100644
index 4e3b602..0000000
--- a/jwt/api/symbols/src/nodeutil-1.0.js.html
+++ /dev/null
@@ -1,94 +0,0 @@
-
1 /*! nodeutil-1.0.0 (c) 2015 Kenji Urushima | kjur.github.com/jsrsasign/license
- 2 */
- 3 /*
- 4 * nodeutil.js - Utilities for Node
- 5 *
- 6 * version: 1.0.0 (2015 Nov 11)
- 7 *
- 8 * Copyright (c) 2015 Kenji Urushima (kenji.urushima@gmail.com)
- 9 *
- 10 * This software is licensed under the terms of the MIT License.
- 11 * http://kjur.github.com/jsrsasign/license/
- 12 *
- 13 * The above copyright and license notice shall be
- 14 * included in all copies or substantial portions of the Software.
- 15 */
- 16
- 17 /**
- 18 * @fileOverview
- 19 * @name nodeutil-1.0.js
- 20 * @author Kenji Urushima kenji.urushima@gmail.com
- 21 * @version 1.0.0 (2015-Nov-11)
- 22 * @since jsrsasign 5.0.2
- 23 * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a>
- 24 */
- 25
- 26 /**
- 27 * read file and return file contents as utf-8 string
- 28 * @param {String} utf8File file name to be read
- 29 * @return {String} utf-8 string of file contents
- 30 * @description
- 31 * This function only works in Node.js.
- 32 */
- 33 function readFileUTF8 ( utf8File ) {
- 34 return require ( 'fs' ) . readFileSync ( utf8File , 'utf8' ) ;
- 35 }
- 36
- 37 /**
- 38 * read binary file and return file contents as hexadecimal string
- 39 * @param {String} binFile file name to be read
- 40 * @return {String} hexadecimal string of file contents
- 41 * @description
- 42 * This function only works in Node.js.
- 43 */
- 44 function readFileHexByBin ( binFile ) {
- 45 var rs = require ( 'jsrsasign' ) ;
- 46 var fs = require ( 'fs' ) ;
- 47 return rs.rstrtohex ( fs.readFileSync ( binFile , 'binary' ) ) ;
- 48 }
- 49
- 50 /**
- 51 * read file and return file contents
- 52 * @param {String} binFile file name to be read
- 53 * @return {String} raw string of file contents
- 54 * @description
- 55 * This function only works in Node.js.
- 56 */
- 57 function readFile ( binFile ) {
- 58 var fs = require ( 'fs' ) ;
- 59 return fs.readFileSync ( binFile , 'binary' ) ;
- 60 }
- 61
- 62 /**
- 63 * save raw string to file
- 64 * @param {String} binFile file name to save contents.
- 65 * @param {String} rawString string contents to be saved.
- 66 * @description
- 67 * This function only works in Node.js.
- 68 */
- 69 function saveFile ( binFile , rawString ) {
- 70 var fs = require ( 'fs' ) ;
- 71 fs.writeFileSync ( binFile , rawString , 'binary' ) ;
- 72 }
- 73
- 74 /**
- 75 * save data represented by hexadecimal string to file
- 76 * @param {String} binFile file name to save contents.
- 77 * @param {String} hexString hexadecimal string to be saved.
- 78 * @description
- 79 * This function only works in Node.js.
- 80 */
- 81 function saveFileBinByHex ( binFile , hexString ) {
- 82 var fs = require ( 'fs' ) ;
- 83 var rs = require ( 'jsrsasign' ) ;
- 84 var rawString = rs.hextorstr ( hexString ) ;
- 85 fs.writeFileSync ( binFile , rawString , 'binary' ) ;
- 86 }
- 87
\ No newline at end of file
diff --git a/jwt/api/symbols/src/pkcs5pkey-1.0.js.html b/jwt/api/symbols/src/pkcs5pkey-1.0.js.html
deleted file mode 100644
index 041a86c..0000000
--- a/jwt/api/symbols/src/pkcs5pkey-1.0.js.html
+++ /dev/null
@@ -1,1142 +0,0 @@
-
1 /*! pkcs5pkey-1.0.6.js (c) 2013-2014 Kenji Urushima | kjur.github.com/jsrsasign/license
- 2 */
- 3 /*
- 4 * pkcs5pkey.js - reading passcode protected PKCS#5 PEM formatted RSA private key
- 5 *
- 6 * Copyright (c) 2013-2014 Kenji Urushima (kenji.urushima@gmail.com)
- 7 *
- 8 * This software is licensed under the terms of the MIT License.
- 9 * http://kjur.github.com/jsrsasign/license
- 10 *
- 11 * The above copyright and license notice shall be
- 12 * included in all copies or substantial portions of the Software.
- 13 */
- 14 /**
- 15 * @fileOverview
- 16 * @name pkcs5pkey-1.0.js
- 17 * @author Kenji Urushima kenji.urushima@gmail.com
- 18 * @version pkcs5pkey 1.0.6 (2014-Apr-16)
- 19 * @since jsrsasign 2.0.0
- 20 * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a>
- 21 */
- 22
- 23 /**
- 24 * @name PKCS5PKEY
- 25 * @class class for PKCS#5 and PKCS#8 private key
- 26 * @deprecated Since jsrsasign 4.1.3. Please use KEYUTIL class.
- 27 * @description
- 28 * <br/>
- 29 * {@link PKCS5PKEY} class has following features:
- 30 * <ul>
- 31 * <li>read and parse PEM formatted encrypted PKCS#5 private key
- 32 * <li>generate PEM formatted encrypted PKCS#5 private key
- 33 * <li>read and parse PEM formatted plain PKCS#8 private key
- 34 * <li>read and parse PEM formatted encrypted PKCS#8 private key by PBKDF2/HmacSHA1/3DES
- 35 * </ul>
- 36 * Currently supports only RSA private key and
- 37 * following symmetric key algorithms to protect private key.
- 38 * <ul>
- 39 * <li>DES-EDE3-CBC</li>
- 40 * <li>AES-256-CBC</li>
- 41 * <li>AES-192-CBC</li>
- 42 * <li>AES-128-CBC</li>
- 43 * </ul>
- 44 *
- 45 * <h5>METHOD SUMMARY</h5>
- 46 * <dl>
- 47 * <dt><b>PKCS8 PRIVATE KEY METHODS</b><dd>
- 48 * <ul>
- 49 * <li>{@link PKCS5PKEY.getRSAKeyFromPlainPKCS8PEM} - convert plain PKCS8 PEM to RSAKey object</li>
- 50 * <li>{@link PKCS5PKEY.getRSAKeyFromPlainPKCS8Hex} - convert plain PKCS8 hexadecimal data to RSAKey object</li>
- 51 * <li>{@link PKCS5PKEY.getRSAKeyFromEncryptedPKCS8PEM} - convert encrypted PKCS8 PEM to RSAKey object</li>
- 52 * <li>{@link PKCS5PKEY.getPlainPKCS8HexFromEncryptedPKCS8PEM} - convert encrypted PKCS8 PEM to plain PKCS8 Hex</li>
- 53 * </ul>
- 54 * <dt><b>PKCS5 PRIVATE KEY METHODS</b><dd>
- 55 * <ul>
- 56 * <li>{@link PKCS5PKEY.getRSAKeyFromEncryptedPKCS5PEM} - convert encrypted PKCS5 PEM to RSAKey object</li>
- 57 * <li>{@link PKCS5PKEY.getEncryptedPKCS5PEMFromRSAKey} - convert RSAKey object to encryped PKCS5 PEM</li>
- 58 * <li>{@link PKCS5PKEY.newEncryptedPKCS5PEM} - generate RSAKey and its encrypted PKCS5 PEM</li>
- 59 * </ul>
- 60 * <dt><b>PKCS8 PUBLIC KEY METHODS</b><dd>
- 61 * <ul>
- 62 * <li>{@link PKCS5PKEY.getKeyFromPublicPKCS8PEM} - convert encrypted PKCS8 PEM to RSAKey/ECDSA object</li>
- 63 * <li>{@link PKCS5PKEY.getKeyFromPublicPKCS8Hex} - convert encrypted PKCS8 Hex to RSAKey/ECDSA object</li>
- 64 * <li>{@link PKCS5PKEY.getRSAKeyFromPublicPKCS8PEM} - convert encrypted PKCS8 PEM to RSAKey object</li>
- 65 * <li>{@link PKCS5PKEY.getRSAKeyFromPublicPKCS8Hex} - convert encrypted PKCS8 Hex to RSAKey object</li>
- 66 * </ul>
- 67 * <dt><b>UTITILIY METHODS</b><dd>
- 68 * <ul>
- 69 * <li>{@link PKCS5PKEY.getHexFromPEM} - convert PEM string to hexadecimal data</li>
- 70 * <li>{@link PKCS5PKEY.getDecryptedKeyHexByKeyIV} - decrypt key by sharedKey and IV</li>
- 71 * </ul>
- 72 * </dl>
- 73 *
- 74 * @example
- 75 * Here is an example of PEM formatted encrypted PKCS#5 private key.
- 76 * -----BEGIN RSA PRIVATE KEY-----
- 77 * Proc-Type: 4,ENCRYPTED
- 78 * DEK-Info: AES-256-CBC,40555967F759530864FE022E257DE34E
- 79 *
- 80 * jV7uXajRw4cccDaliagcqiLOiQEUCe19l761pXRxzgQP+DH4rCi12T4puTdZyy6l
- 81 * ...(snip)...
- 82 * qxLS+BASmyGm4DME6m+kltZ12LXwPgNU6+d+XQ4NXSA=
- 83 *-----END RSA PRIVATE KEY-----
- 84 */
- 85 var PKCS5PKEY = function ( ) {
- 86 // *****************************************************************
- 87 // *** PRIVATE PROPERTIES AND METHODS *******************************
- 88 // *****************************************************************
- 89 // shared key decryption ------------------------------------------
- 90 var decryptAES = function ( dataHex , keyHex , ivHex ) {
- 91 return decryptGeneral ( CryptoJS.AES , dataHex , keyHex , ivHex ) ;
- 92 } ;
- 93
- 94 var decrypt3DES = function ( dataHex , keyHex , ivHex ) {
- 95 return decryptGeneral ( CryptoJS.TripleDES , dataHex , keyHex , ivHex ) ;
- 96 } ;
- 97
- 98 var decryptGeneral = function ( f , dataHex , keyHex , ivHex ) {
- 99 var data = CryptoJS.enc.Hex.parse ( dataHex ) ;
-100 var key = CryptoJS.enc.Hex.parse ( keyHex ) ;
-101 var iv = CryptoJS.enc.Hex.parse ( ivHex ) ;
-102 var encrypted = { } ;
-103 encrypted.key = key ;
-104 encrypted.iv = iv ;
-105 encrypted.ciphertext = data ;
-106 var decrypted = f.decrypt ( encrypted , key , { iv : iv } ) ;
-107 return CryptoJS.enc.Hex.stringify ( decrypted ) ;
-108 } ;
-109
-110 // shared key decryption ------------------------------------------
-111 var encryptAES = function ( dataHex , keyHex , ivHex ) {
-112 return encryptGeneral ( CryptoJS.AES , dataHex , keyHex , ivHex ) ;
-113 } ;
-114
-115 var encrypt3DES = function ( dataHex , keyHex , ivHex ) {
-116 return encryptGeneral ( CryptoJS.TripleDES , dataHex , keyHex , ivHex ) ;
-117 } ;
-118
-119 var encryptGeneral = function ( f , dataHex , keyHex , ivHex ) {
-120 var data = CryptoJS.enc.Hex.parse ( dataHex ) ;
-121 var key = CryptoJS.enc.Hex.parse ( keyHex ) ;
-122 var iv = CryptoJS.enc.Hex.parse ( ivHex ) ;
-123 var msg = { } ;
-124 var encryptedHex = f.encrypt ( data , key , { iv : iv } ) ;
-125 var encryptedWA = CryptoJS.enc.Hex.parse ( encryptedHex.toString ( ) ) ;
-126 var encryptedB64 = CryptoJS.enc.Base64.stringify ( encryptedWA ) ;
-127 return encryptedB64 ;
-128 } ;
-129
-130 // other methods and properties ----------------------------------------
-131 var ALGLIST = {
-132 'AES-256-CBC' : { 'proc' : decryptAES , 'eproc' : encryptAES , keylen : 32 , ivlen : 16 } ,
-133 'AES-192-CBC' : { 'proc' : decryptAES , 'eproc' : encryptAES , keylen : 24 , ivlen : 16 } ,
-134 'AES-128-CBC' : { 'proc' : decryptAES , 'eproc' : encryptAES , keylen : 16 , ivlen : 16 } ,
-135 'DES-EDE3-CBC' : { 'proc' : decrypt3DES , 'eproc' : encrypt3DES , keylen : 24 , ivlen : 8 }
-136 } ;
-137
-138 var getFuncByName = function ( algName ) {
-139 return ALGLIST [ algName ] [ 'proc' ] ;
-140 } ;
-141
-142 var _generateIvSaltHex = function ( numBytes ) {
-143 var wa = CryptoJS.lib.WordArray.random ( numBytes ) ;
-144 var hex = CryptoJS.enc.Hex.stringify ( wa ) ;
-145 return hex ;
-146 } ;
-147
-148 var _parsePKCS5PEM = function ( sPKCS5PEM ) {
-149 var info = { } ;
-150 if ( sPKCS5PEM.match ( new RegExp ( "DEK-Info: ([^,]+),([0-9A-Fa-f]+)" , "m" ) ) ) {
-151 info.cipher = RegExp.$1 ;
-152 info.ivsalt = RegExp.$2 ;
-153 }
-154 if ( sPKCS5PEM.match ( new RegExp ( "-----BEGIN ([A-Z]+) PRIVATE KEY-----" ) ) ) {
-155 info.type = RegExp.$1 ;
-156 }
-157 var i1 = - 1 ;
-158 var lenNEWLINE = 0 ;
-159 if ( sPKCS5PEM.indexOf ( "\r\n\r\n" ) != - 1 ) {
-160 i1 = sPKCS5PEM.indexOf ( "\r\n\r\n" ) ;
-161 lenNEWLINE = 2 ;
-162 }
-163 if ( sPKCS5PEM.indexOf ( "\n\n" ) != - 1 ) {
-164 i1 = sPKCS5PEM.indexOf ( "\n\n" ) ;
-165 lenNEWLINE = 1 ;
-166 }
-167 var i2 = sPKCS5PEM.indexOf ( "-----END" ) ;
-168 if ( i1 != - 1 && i2 != - 1 ) {
-169 var s = sPKCS5PEM.substring ( i1 + lenNEWLINE * 2 , i2 - lenNEWLINE ) ;
-170 s = s.replace ( /\s+/g , '' ) ;
-171 info.data = s ;
-172 }
-173 return info ;
-174 } ;
-175
-176 var _getKeyAndUnusedIvByPasscodeAndIvsalt = function ( algName , passcode , ivsaltHex ) {
-177 //alert("ivsaltHex(2) = " + ivsaltHex);
-178 var saltHex = ivsaltHex.substring ( 0 , 16 ) ;
-179 //alert("salt = " + saltHex);
-180
-181 var salt = CryptoJS.enc.Hex.parse ( saltHex ) ;
-182 var data = CryptoJS.enc.Utf8.parse ( passcode ) ;
-183 //alert("salt = " + salt);
-184 //alert("data = " + data);
-185
-186 var nRequiredBytes = ALGLIST [ algName ] [ 'keylen' ] + ALGLIST [ algName ] [ 'ivlen' ] ;
-187 var hHexValueJoined = '' ;
-188 var hLastValue = null ;
-189 //alert("nRequiredBytes = " + nRequiredBytes);
-190 for ( ; ; ) {
-191 var h = CryptoJS.algo.MD5.create ( ) ;
-192 if ( hLastValue != null ) {
-193 h.update ( hLastValue ) ;
-194 }
-195 h.update ( data ) ;
-196 h.update ( salt ) ;
-197 hLastValue = h.finalize ( ) ;
-198 hHexValueJoined = hHexValueJoined + CryptoJS.enc.Hex.stringify ( hLastValue ) ;
-199 //alert("joined = " + hHexValueJoined);
-200 if ( hHexValueJoined.length >= nRequiredBytes * 2 ) {
-201 break ;
-202 }
-203 }
-204 var result = { } ;
-205 result.keyhex = hHexValueJoined.substr ( 0 , ALGLIST [ algName ] [ 'keylen' ] * 2 ) ;
-206 result.ivhex = hHexValueJoined.substr ( ALGLIST [ algName ] [ 'keylen' ] * 2 , ALGLIST [ algName ] [ 'ivlen' ] * 2 ) ;
-207 return result ;
-208 } ;
-209
-210 /*
-211 * @param {String} privateKeyB64 base64 string of encrypted private key
-212 * @param {String} sharedKeyAlgName algorithm name of shared key encryption
-213 * @param {String} sharedKeyHex hexadecimal string of shared key to encrypt
-214 * @param {String} ivsaltHex hexadecimal string of IV and salt
-215 * @param {String} hexadecimal string of decrypted private key
-216 */
-217 var _decryptKeyB64 = function ( privateKeyB64 , sharedKeyAlgName , sharedKeyHex , ivsaltHex ) {
-218 var privateKeyWA = CryptoJS.enc.Base64.parse ( privateKeyB64 ) ;
-219 var privateKeyHex = CryptoJS.enc.Hex.stringify ( privateKeyWA ) ;
-220 var f = ALGLIST [ sharedKeyAlgName ] [ 'proc' ] ;
-221 var decryptedKeyHex = f ( privateKeyHex , sharedKeyHex , ivsaltHex ) ;
-222 return decryptedKeyHex ;
-223 } ;
-224
-225 /*
-226 * @param {String} privateKeyHex hexadecimal string of private key
-227 * @param {String} sharedKeyAlgName algorithm name of shared key encryption
-228 * @param {String} sharedKeyHex hexadecimal string of shared key to encrypt
-229 * @param {String} ivsaltHex hexadecimal string of IV and salt
-230 * @param {String} base64 string of encrypted private key
-231 */
-232 var _encryptKeyHex = function ( privateKeyHex , sharedKeyAlgName , sharedKeyHex , ivsaltHex ) {
-233 var f = ALGLIST [ sharedKeyAlgName ] [ 'eproc' ] ;
-234 var encryptedKeyB64 = f ( privateKeyHex , sharedKeyHex , ivsaltHex ) ;
-235 return encryptedKeyB64 ;
-236 } ;
-237
-238 // *****************************************************************
-239 // *** PUBLIC PROPERTIES AND METHODS *******************************
-240 // *****************************************************************
-241 return {
-242 // -- UTILITY METHODS ------------------------------------------
-243 /**
-244 * decrypt private key by shared key
-245 * @name version
-246 * @memberOf PKCS5PKEY
-247 * @property {String} version
-248 * @description version string of PKCS5PKEY class
-249 */
-250 version : "1.0.5" ,
-251
-252 /**
-253 * get hexacedimal string of PEM format
-254 * @name getHexFromPEM
-255 * @memberOf PKCS5PKEY
-256 * @function
-257 * @param {String} sPEM PEM formatted string
-258 * @param {String} sHead PEM header string without BEGIN/END
-259 * @return {String} hexadecimal string data of PEM contents
-260 * @since pkcs5pkey 1.0.5
-261 */
-262 getHexFromPEM : function ( sPEM , sHead ) {
-263 var s = sPEM ;
-264 if ( s.indexOf ( "BEGIN " + sHead ) == - 1 ) {
-265 throw "can't find PEM header: " + sHead ;
-266 }
-267 s = s.replace ( "-----BEGIN " + sHead + "-----" , "" ) ;
-268 s = s.replace ( "-----END " + sHead + "-----" , "" ) ;
-269 var sB64 = s.replace ( /\s+/g , '' ) ;
-270 var dataHex = b64tohex ( sB64 ) ;
-271 return dataHex ;
-272 } ,
-273
-274 /**
-275 * decrypt private key by shared key
-276 * @name getDecryptedKeyHexByKeyIV
-277 * @memberOf PKCS5PKEY
-278 * @function
-279 * @param {String} encryptedKeyHex hexadecimal string of encrypted private key
-280 * @param {String} algName name of symmetric key algorithm (ex. 'DES-EBE3-CBC')
-281 * @param {String} sharedKeyHex hexadecimal string of symmetric key
-282 * @param {String} ivHex hexadecimal string of initial vector(IV).
-283 * @return {String} hexadecimal string of decrypted privated key
-284 */
-285 getDecryptedKeyHexByKeyIV : function ( encryptedKeyHex , algName , sharedKeyHex , ivHex ) {
-286 var f1 = getFuncByName ( algName ) ;
-287 return f1 ( encryptedKeyHex , sharedKeyHex , ivHex ) ;
-288 } ,
-289
-290 /**
-291 * parse PEM formatted passcode protected PKCS#5 private key
-292 * @name parsePKCS5PEM
-293 * @memberOf PKCS5PKEY
-294 * @function
-295 * @param {String} sEncryptedPEM PEM formatted protected passcode protected PKCS#5 private key
-296 * @return {Hash} hash of key information
-297 * @description
-298 * Resulted hash has following attributes.
-299 * <ul>
-300 * <li>cipher - symmetric key algorithm name (ex. 'DES-EBE3-CBC', 'AES-256-CBC')</li>
-301 * <li>ivsalt - IV used for decrypt. Its heading 8 bytes will be used for passcode salt.</li>
-302 * <li>type - asymmetric key algorithm name of private key described in PEM header.</li>
-303 * <li>data - base64 encoded encrypted private key.</li>
-304 * </ul>
-305 *
-306 */
-307 parsePKCS5PEM : function ( sPKCS5PEM ) {
-308 return _parsePKCS5PEM ( sPKCS5PEM ) ;
-309 } ,
-310
-311 /**
-312 * the same function as OpenSSL EVP_BytsToKey to generate shared key and IV
-313 * @name getKeyAndUnusedIvByPasscodeAndIvsalt
-314 * @memberOf PKCS5PKEY
-315 * @function
-316 * @param {String} algName name of symmetric key algorithm (ex. 'DES-EBE3-CBC')
-317 * @param {String} passcode passcode to decrypt private key (ex. 'password')
-318 * @param {String} hexadecimal string of IV. heading 8 bytes will be used for passcode salt
-319 * @return {Hash} hash of key and unused IV (ex. {keyhex:2fe3..., ivhex:3fad..})
-320 */
-321 getKeyAndUnusedIvByPasscodeAndIvsalt : function ( algName , passcode , ivsaltHex ) {
-322 return _getKeyAndUnusedIvByPasscodeAndIvsalt ( algName , passcode , ivsaltHex ) ;
-323 } ,
-324
-325 decryptKeyB64 : function ( privateKeyB64 , sharedKeyAlgName , sharedKeyHex , ivsaltHex ) {
-326 return _decryptKeyB64 ( privateKeyB64 , sharedKeyAlgName , sharedKeyHex , ivsaltHex ) ;
-327 } ,
-328
-329 /**
-330 * decrypt PEM formatted protected PKCS#5 private key with passcode
-331 * @name getDecryptedKeyHex
-332 * @memberOf PKCS5PKEY
-333 * @function
-334 * @param {String} sEncryptedPEM PEM formatted protected passcode protected PKCS#5 private key
-335 * @param {String} passcode passcode to decrypt private key (ex. 'password')
-336 * @return {String} hexadecimal string of decrypted RSA priavte key
-337 */
-338 getDecryptedKeyHex : function ( sEncryptedPEM , passcode ) {
-339 // 1. parse pem
-340 var info = _parsePKCS5PEM ( sEncryptedPEM ) ;
-341 var publicKeyAlgName = info.type ;
-342 var sharedKeyAlgName = info.cipher ;
-343 var ivsaltHex = info.ivsalt ;
-344 var privateKeyB64 = info.data ;
-345 //alert("ivsaltHex = " + ivsaltHex);
-346
-347 // 2. generate shared key
-348 var sharedKeyInfo = _getKeyAndUnusedIvByPasscodeAndIvsalt ( sharedKeyAlgName , passcode , ivsaltHex ) ;
-349 var sharedKeyHex = sharedKeyInfo.keyhex ;
-350 //alert("sharedKeyHex = " + sharedKeyHex);
-351
-352 // 3. decrypt private key
-353 var decryptedKey = _decryptKeyB64 ( privateKeyB64 , sharedKeyAlgName , sharedKeyHex , ivsaltHex ) ;
-354 return decryptedKey ;
-355 } ,
-356
-357 /**
-358 * read PEM formatted encrypted PKCS#5 private key and returns RSAKey object
-359 * @name getRSAKeyFromEncryptedPKCS5PEM
-360 * @memberOf PKCS5PKEY
-361 * @function
-362 * @param {String} sEncryptedP5PEM PEM formatted encrypted PKCS#5 private key
-363 * @param {String} passcode passcode to decrypt private key
-364 * @return {RSAKey} loaded RSAKey object of RSA private key
-365 * @since pkcs5pkey 1.0.2
-366 */
-367 getRSAKeyFromEncryptedPKCS5PEM : function ( sEncryptedP5PEM , passcode ) {
-368 var hPKey = this.getDecryptedKeyHex ( sEncryptedP5PEM , passcode ) ;
-369 var rsaKey = new RSAKey ( ) ;
-370 rsaKey.readPrivateKeyFromASN1HexString ( hPKey ) ;
-371 return rsaKey ;
-372 } ,
-373
-374 /**
-375 * get PEM formatted encrypted PKCS#5 private key from hexadecimal string of plain private key
-376 * @name getEryptedPKCS5PEMFromPrvKeyHex
-377 * @memberOf PKCS5PKEY
-378 * @function
-379 * @param {String} hPrvKey hexadecimal string of plain private key
-380 * @param {String} passcode pass code to protect private key (ex. password)
-381 * @param {String} sharedKeyAlgName algorithm name to protect private key (ex. AES-256-CBC)
-382 * @param {String} ivsaltHex hexadecimal string of IV and salt
-383 * @return {String} string of PEM formatted encrypted PKCS#5 private key
-384 * @since pkcs5pkey 1.0.2
-385 * @description
-386 * <br/>
-387 * generate PEM formatted encrypted PKCS#5 private key by hexadecimal string encoded
-388 * ASN.1 object of plain RSA private key.
-389 * Following arguments can be omitted.
-390 * <ul>
-391 * <li>alg - AES-256-CBC will be used if omitted.</li>
-392 * <li>ivsaltHex - automatically generate IV and salt which length depends on algorithm</li>
-393 * </ul>
-394 * @example
-395 * var pem =
-396 * PKCS5PKEY.getEryptedPKCS5PEMFromPrvKeyHex(plainKeyHex, "password");
-397 * var pem2 =
-398 * PKCS5PKEY.getEryptedPKCS5PEMFromPrvKeyHex(plainKeyHex, "password", "AES-128-CBC");
-399 * var pem3 =
-400 * PKCS5PKEY.getEryptedPKCS5PEMFromPrvKeyHex(plainKeyHex, "password", "AES-128-CBC", "1f3d02...");
-401 */
-402 getEryptedPKCS5PEMFromPrvKeyHex : function ( hPrvKey , passcode , sharedKeyAlgName , ivsaltHex ) {
-403 var sPEM = "" ;
-404
-405 // 1. set sharedKeyAlgName if undefined (default AES-256-CBC)
-406 if ( typeof sharedKeyAlgName == "undefined" || sharedKeyAlgName == null ) {
-407 sharedKeyAlgName = "AES-256-CBC" ;
-408 }
-409 if ( typeof ALGLIST [ sharedKeyAlgName ] == "undefined" )
-410 throw "PKCS5PKEY unsupported algorithm: " + sharedKeyAlgName ;
-411
-412 // 2. set ivsaltHex if undefined
-413 if ( typeof ivsaltHex == "undefined" || ivsaltHex == null ) {
-414 var ivlen = ALGLIST [ sharedKeyAlgName ] [ 'ivlen' ] ;
-415 var randIV = _generateIvSaltHex ( ivlen ) ;
-416 ivsaltHex = randIV.toUpperCase ( ) ;
-417 }
-418
-419 // 3. get shared key
-420 //alert("ivsalthex=" + ivsaltHex);
-421 var sharedKeyInfo = _getKeyAndUnusedIvByPasscodeAndIvsalt ( sharedKeyAlgName , passcode , ivsaltHex ) ;
-422 var sharedKeyHex = sharedKeyInfo.keyhex ;
-423 // alert("sharedKeyHex = " + sharedKeyHex);
-424
-425 // 3. get encrypted Key in Base64
-426 var encryptedKeyB64 = _encryptKeyHex ( hPrvKey , sharedKeyAlgName , sharedKeyHex , ivsaltHex ) ;
-427
-428 var pemBody = encryptedKeyB64.replace ( /(.{64})/g , "$1\r\n" ) ;
-429 var sPEM = "-----BEGIN RSA PRIVATE KEY-----\r\n" ;
-430 sPEM + = "Proc-Type: 4,ENCRYPTED\r\n" ;
-431 sPEM + = "DEK-Info: " + sharedKeyAlgName + "," + ivsaltHex + "\r\n" ;
-432 sPEM + = "\r\n" ;
-433 sPEM + = pemBody ;
-434 sPEM + = "\r\n-----END RSA PRIVATE KEY-----\r\n" ;
-435
-436 return sPEM ;
-437 } ,
-438
-439 /**
-440 * get PEM formatted encrypted PKCS#5 private key from RSAKey object of private key
-441 * @name getEryptedPKCS5PEMFromRSAKey
-442 * @memberOf PKCS5PKEY
-443 * @function
-444 * @param {RSAKey} pKey RSAKey object of private key
-445 * @param {String} passcode pass code to protect private key (ex. password)
-446 * @param {String} alg algorithm name to protect private key (default AES-256-CBC)
-447 * @param {String} ivsaltHex hexadecimal string of IV and salt (default generated random IV)
-448 * @return {String} string of PEM formatted encrypted PKCS#5 private key
-449 * @since pkcs5pkey 1.0.2
-450 * @description
-451 * <br/>
-452 * generate PEM formatted encrypted PKCS#5 private key by
-453 * {@link RSAKey} object of RSA private key and passcode.
-454 * Following argument can be omitted.
-455 * <ul>
-456 * <li>alg - AES-256-CBC will be used if omitted.</li>
-457 * <li>ivsaltHex - automatically generate IV and salt which length depends on algorithm</li>
-458 * </ul>
-459 * @example
-460 * var pkey = new RSAKey();
-461 * pkey.generate(1024, '10001'); // generate 1024bit RSA private key with public exponent 'x010001'
-462 * var pem = PKCS5PKEY.getEryptedPKCS5PEMFromRSAKey(pkey, "password");
-463 */
-464 getEryptedPKCS5PEMFromRSAKey : function ( pKey , passcode , alg , ivsaltHex ) {
-465 var version = new KJUR.asn1.DERInteger ( { 'int' : 0 } ) ;
-466 var n = new KJUR.asn1.DERInteger ( { 'bigint' : pKey.n } ) ;
-467 var e = new KJUR.asn1.DERInteger ( { 'int' : pKey.e } ) ;
-468 var d = new KJUR.asn1.DERInteger ( { 'bigint' : pKey.d } ) ;
-469 var p = new KJUR.asn1.DERInteger ( { 'bigint' : pKey.p } ) ;
-470 var q = new KJUR.asn1.DERInteger ( { 'bigint' : pKey.q } ) ;
-471 var dmp1 = new KJUR.asn1.DERInteger ( { 'bigint' : pKey.dmp1 } ) ;
-472 var dmq1 = new KJUR.asn1.DERInteger ( { 'bigint' : pKey.dmq1 } ) ;
-473 var coeff = new KJUR.asn1.DERInteger ( { 'bigint' : pKey.coeff } ) ;
-474 var seq = new KJUR.asn1.DERSequence ( { 'array' : [ version , n , e , d , p , q , dmp1 , dmq1 , coeff ] } ) ;
-475 var hex = seq.getEncodedHex ( ) ;
-476 return this.getEryptedPKCS5PEMFromPrvKeyHex ( hex , passcode , alg , ivsaltHex ) ;
-477 } ,
-478
-479 /**
-480 * generate RSAKey and PEM formatted encrypted PKCS#5 private key
-481 * @name newEncryptedPKCS5PEM
-482 * @memberOf PKCS5PKEY
-483 * @function
-484 * @param {String} passcode pass code to protect private key (ex. password)
-485 * @param {Integer} keyLen key bit length of RSA key to be generated. (default 1024)
-486 * @param {String} hPublicExponent hexadecimal string of public exponent (default 10001)
-487 * @param {String} alg shared key algorithm to encrypt private key (default AES-258-CBC)
-488 * @return {String} string of PEM formatted encrypted PKCS#5 private key
-489 * @since pkcs5pkey 1.0.2
-490 * @example
-491 * var pem1 = PKCS5PKEY.newEncryptedPKCS5PEM("password"); // RSA1024bit/10001/AES-256-CBC
-492 * var pem2 = PKCS5PKEY.newEncryptedPKCS5PEM("password", 512); // RSA 512bit/10001/AES-256-CBC
-493 * var pem3 = PKCS5PKEY.newEncryptedPKCS5PEM("password", 512, '3'); // RSA 512bit/ 3/AES-256-CBC
-494 */
-495 newEncryptedPKCS5PEM : function ( passcode , keyLen , hPublicExponent , alg ) {
-496 if ( typeof keyLen == "undefined" || keyLen == null ) {
-497 keyLen = 1024 ;
-498 }
-499 if ( typeof hPublicExponent == "undefined" || hPublicExponent == null ) {
-500 hPublicExponent = '10001' ;
-501 }
-502 var pKey = new RSAKey ( ) ;
-503 pKey.generate ( keyLen , hPublicExponent ) ;
-504 var pem = null ;
-505 if ( typeof alg == "undefined" || alg == null ) {
-506 pem = this.getEncryptedPKCS5PEMFromRSAKey ( pkey , passcode ) ;
-507 } else {
-508 pem = this.getEncryptedPKCS5PEMFromRSAKey ( pkey , passcode , alg ) ;
-509 }
-510 return pem ;
-511 } ,
-512
-513 // === PKCS8 ===============================================================
-514
-515 /**
-516 * read PEM formatted unencrypted PKCS#8 private key and returns RSAKey object
-517 * @name getRSAKeyFromPlainPKCS8PEM
-518 * @memberOf PKCS5PKEY
-519 * @function
-520 * @param {String} pkcs8PEM PEM formatted unencrypted PKCS#8 private key
-521 * @return {RSAKey} loaded RSAKey object of RSA private key
-522 * @since pkcs5pkey 1.0.1
-523 */
-524 getRSAKeyFromPlainPKCS8PEM : function ( pkcs8PEM ) {
-525 if ( pkcs8PEM.match ( /ENCRYPTED/ ) )
-526 throw "pem shall be not ENCRYPTED" ;
-527 var prvKeyHex = this.getHexFromPEM ( pkcs8PEM , "PRIVATE KEY" ) ;
-528 var rsaKey = this.getRSAKeyFromPlainPKCS8Hex ( prvKeyHex ) ;
-529 return rsaKey ;
-530 } ,
-531
-532 /**
-533 * provide hexadecimal string of unencrypted PKCS#8 private key and returns RSAKey object
-534 * @name getRSAKeyFromPlainPKCS8Hex
-535 * @memberOf PKCS5PKEY
-536 * @function
-537 * @param {String} prvKeyHex hexadecimal string of unencrypted PKCS#8 private key
-538 * @return {RSAKey} loaded RSAKey object of RSA private key
-539 * @since pkcs5pkey 1.0.3
-540 */
-541 getRSAKeyFromPlainPKCS8Hex : function ( prvKeyHex ) {
-542 var a1 = ASN1HEX.getPosArrayOfChildren_AtObj ( prvKeyHex , 0 ) ;
-543 if ( a1.length != 3 )
-544 throw "outer DERSequence shall have 3 elements: " + a1.length ;
-545 var algIdTLV = ASN1HEX.getHexOfTLV_AtObj ( prvKeyHex , a1 [ 1 ] ) ;
-546 if ( algIdTLV != "300d06092a864886f70d0101010500" ) // AlgId rsaEncryption
-547 throw "PKCS8 AlgorithmIdentifier is not rsaEnc: " + algIdTLV ;
-548 var algIdTLV = ASN1HEX.getHexOfTLV_AtObj ( prvKeyHex , a1 [ 1 ] ) ;
-549 var octetStr = ASN1HEX.getHexOfTLV_AtObj ( prvKeyHex , a1 [ 2 ] ) ;
-550 var p5KeyHex = ASN1HEX.getHexOfV_AtObj ( octetStr , 0 ) ;
-551 //alert(p5KeyHex);
-552 var rsaKey = new RSAKey ( ) ;
-553 rsaKey.readPrivateKeyFromASN1HexString ( p5KeyHex ) ;
-554 return rsaKey ;
-555 } ,
-556
-557 /**
-558 * generate PBKDF2 key hexstring with specified passcode and information
-559 * @name parseHexOfEncryptedPKCS8
-560 * @memberOf PKCS5PKEY
-561 * @function
-562 * @param {String} passcode passcode to decrypto private key
-563 * @return {Array} info associative array of PKCS#8 parameters
-564 * @since pkcs5pkey 1.0.3
-565 * @description
-566 * The associative array which is returned by this method has following properties:
-567 * <ul>
-568 * <li>info.pbkdf2Salt - hexadecimal string of PBKDF2 salt</li>
-569 * <li>info.pkbdf2Iter - iteration count</li>
-570 * <li>info.ciphertext - hexadecimal string of encrypted private key</li>
-571 * <li>info.encryptionSchemeAlg - encryption algorithm name (currently TripleDES only)</li>
-572 * <li>info.encryptionSchemeIV - initial vector for encryption algorithm</li>
-573 * </ul>
-574 * Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
-575 * <ul>
-576 * <li>keyDerivationFunc = pkcs5PBKDF2 with HmacSHA1</li>
-577 * <li>encryptionScheme = des-EDE3-CBC(i.e. TripleDES</li>
-578 * </ul>
-579 * @example
-580 * // to convert plain PKCS#5 private key to encrypted PKCS#8 private
-581 * // key with PBKDF2 with TripleDES
-582 * % openssl pkcs8 -in plain_p5.pem -topk8 -v2 -des3 -out encrypted_p8.pem
-583 */
-584 parseHexOfEncryptedPKCS8 : function ( sHEX ) {
-585 var info = { } ;
-586
-587 var a0 = ASN1HEX.getPosArrayOfChildren_AtObj ( sHEX , 0 ) ;
-588 if ( a0.length != 2 )
-589 throw "malformed format: SEQUENCE(0).items != 2: " + a0.length ;
-590
-591 // 1. ciphertext
-592 info.ciphertext = ASN1HEX.getHexOfV_AtObj ( sHEX , a0 [ 1 ] ) ;
-593
-594 // 2. pkcs5PBES2
-595 var a0_0 = ASN1HEX.getPosArrayOfChildren_AtObj ( sHEX , a0 [ 0 ] ) ;
-596 if ( a0_0.length != 2 )
-597 throw "malformed format: SEQUENCE(0.0).items != 2: " + a0_0.length ;
-598
-599 // 2.1 check if pkcs5PBES2(1 2 840 113549 1 5 13)
-600 if ( ASN1HEX.getHexOfV_AtObj ( sHEX , a0_0 [ 0 ] ) != "2a864886f70d01050d" )
-601 throw "this only supports pkcs5PBES2" ;
-602
-603 // 2.2 pkcs5PBES2 param
-604 var a0_0_1 = ASN1HEX.getPosArrayOfChildren_AtObj ( sHEX , a0_0 [ 1 ] ) ;
-605 if ( a0_0.length != 2 )
-606 throw "malformed format: SEQUENCE(0.0.1).items != 2: " + a0_0_1.length ;
-607
-608 // 2.2.1 encryptionScheme
-609 var a0_0_1_1 = ASN1HEX.getPosArrayOfChildren_AtObj ( sHEX , a0_0_1 [ 1 ] ) ;
-610 if ( a0_0_1_1.length != 2 )
-611 throw "malformed format: SEQUENCE(0.0.1.1).items != 2: " + a0_0_1_1.length ;
-612 if ( ASN1HEX.getHexOfV_AtObj ( sHEX , a0_0_1_1 [ 0 ] ) != "2a864886f70d0307" )
-613 throw "this only supports TripleDES" ;
-614 info.encryptionSchemeAlg = "TripleDES" ;
-615
-616 // 2.2.1.1 IV of encryptionScheme
-617 info.encryptionSchemeIV = ASN1HEX.getHexOfV_AtObj ( sHEX , a0_0_1_1 [ 1 ] ) ;
-618
-619 // 2.2.2 keyDerivationFunc
-620 var a0_0_1_0 = ASN1HEX.getPosArrayOfChildren_AtObj ( sHEX , a0_0_1 [ 0 ] ) ;
-621 if ( a0_0_1_0.length != 2 )
-622 throw "malformed format: SEQUENCE(0.0.1.0).items != 2: " + a0_0_1_0.length ;
-623 if ( ASN1HEX.getHexOfV_AtObj ( sHEX , a0_0_1_0 [ 0 ] ) != "2a864886f70d01050c" )
-624 throw "this only supports pkcs5PBKDF2" ;
-625
-626 // 2.2.2.1 pkcs5PBKDF2 param
-627 var a0_0_1_0_1 = ASN1HEX.getPosArrayOfChildren_AtObj ( sHEX , a0_0_1_0 [ 1 ] ) ;
-628 if ( a0_0_1_0_1.length < 2 )
-629 throw "malformed format: SEQUENCE(0.0.1.0.1).items < 2: " + a0_0_1_0_1.length ;
-630
-631 // 2.2.2.1.1 PBKDF2 salt
-632 info.pbkdf2Salt = ASN1HEX.getHexOfV_AtObj ( sHEX , a0_0_1_0_1 [ 0 ] ) ;
-633
-634 // 2.2.2.1.2 PBKDF2 iter
-635 var iterNumHex = ASN1HEX.getHexOfV_AtObj ( sHEX , a0_0_1_0_1 [ 1 ] ) ;
-636 try {
-637 info.pbkdf2Iter = parseInt ( iterNumHex , 16 ) ;
-638 } catch ( ex ) {
-639 throw "malformed format pbkdf2Iter: " + iterNumHex ;
-640 }
-641
-642 return info ;
-643 } ,
-644
-645 /**
-646 * generate PBKDF2 key hexstring with specified passcode and information
-647 * @name getPBKDF2KeyHexFromParam
-648 * @memberOf PKCS5PKEY
-649 * @function
-650 * @param {Array} info result of {@link parseHexOfEncryptedPKCS8} which has preference of PKCS#8 file
-651 * @param {String} passcode passcode to decrypto private key
-652 * @return {String} hexadecimal string of PBKDF2 key
-653 * @since pkcs5pkey 1.0.3
-654 * @description
-655 * As for info, this uses following properties:
-656 * <ul>
-657 * <li>info.pbkdf2Salt - hexadecimal string of PBKDF2 salt</li>
-658 * <li>info.pkbdf2Iter - iteration count</li>
-659 * </ul>
-660 * Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
-661 * <ul>
-662 * <li>keyDerivationFunc = pkcs5PBKDF2 with HmacSHA1</li>
-663 * <li>encryptionScheme = des-EDE3-CBC(i.e. TripleDES</li>
-664 * </ul>
-665 * @example
-666 * // to convert plain PKCS#5 private key to encrypted PKCS#8 private
-667 * // key with PBKDF2 with TripleDES
-668 * % openssl pkcs8 -in plain_p5.pem -topk8 -v2 -des3 -out encrypted_p8.pem
-669 */
-670 getPBKDF2KeyHexFromParam : function ( info , passcode ) {
-671 var pbkdf2SaltWS = CryptoJS.enc.Hex.parse ( info.pbkdf2Salt ) ;
-672 var pbkdf2Iter = info.pbkdf2Iter ;
-673 var pbkdf2KeyWS = CryptoJS.PBKDF2 ( passcode ,
-674 pbkdf2SaltWS ,
-675 { keySize : 192 / 32 , iterations : pbkdf2Iter } ) ;
-676 var pbkdf2KeyHex = CryptoJS.enc.Hex.stringify ( pbkdf2KeyWS ) ;
-677 return pbkdf2KeyHex ;
-678 } ,
-679
-680 /**
-681 * read PEM formatted encrypted PKCS#8 private key and returns hexadecimal string of plain PKCS#8 private key
-682 * @name getPlainPKCS8HexFromEncryptedPKCS8PEM
-683 * @memberOf PKCS5PKEY
-684 * @function
-685 * @param {String} pkcs8PEM PEM formatted encrypted PKCS#8 private key
-686 * @param {String} passcode passcode to decrypto private key
-687 * @return {String} hexadecimal string of plain PKCS#8 private key
-688 * @since pkcs5pkey 1.0.3
-689 * @description
-690 * Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
-691 * <ul>
-692 * <li>keyDerivationFunc = pkcs5PBKDF2 with HmacSHA1</li>
-693 * <li>encryptionScheme = des-EDE3-CBC(i.e. TripleDES</li>
-694 * </ul>
-695 * @example
-696 * // to convert plain PKCS#5 private key to encrypted PKCS#8 private
-697 * // key with PBKDF2 with TripleDES
-698 * % openssl pkcs8 -in plain_p5.pem -topk8 -v2 -des3 -out encrypted_p8.pem
-699 */
-700 getPlainPKCS8HexFromEncryptedPKCS8PEM : function ( pkcs8PEM , passcode ) {
-701 // 1. derHex - PKCS#8 private key encrypted by PBKDF2
-702 var derHex = this.getHexFromPEM ( pkcs8PEM , "ENCRYPTED PRIVATE KEY" ) ;
-703 // 2. info - PKCS#5 PBES info
-704 var info = this.parseHexOfEncryptedPKCS8 ( derHex ) ;
-705 // 3. hKey - PBKDF2 key
-706 var pbkdf2KeyHex = PKCS5PKEY.getPBKDF2KeyHexFromParam ( info , passcode ) ;
-707 // 4. decrypt ciphertext by PBKDF2 key
-708 var encrypted = { } ;
-709 encrypted.ciphertext = CryptoJS.enc.Hex.parse ( info.ciphertext ) ;
-710 var pbkdf2KeyWS = CryptoJS.enc.Hex.parse ( pbkdf2KeyHex ) ;
-711 var des3IVWS = CryptoJS.enc.Hex.parse ( info.encryptionSchemeIV ) ;
-712 var decWS = CryptoJS.TripleDES.decrypt ( encrypted , pbkdf2KeyWS , { iv : des3IVWS } ) ;
-713 var decHex = CryptoJS.enc.Hex.stringify ( decWS ) ;
-714 return decHex ;
-715 } ,
-716
-717 /**
-718 * read PEM formatted encrypted PKCS#8 private key and returns RSAKey object
-719 * @name getRSAKeyFromEncryptedPKCS8PEM
-720 * @memberOf PKCS5PKEY
-721 * @function
-722 * @param {String} pkcs8PEM PEM formatted encrypted PKCS#8 private key
-723 * @param {String} passcode passcode to decrypto private key
-724 * @return {RSAKey} loaded RSAKey object of RSA private key
-725 * @since pkcs5pkey 1.0.3
-726 * @description
-727 * Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
-728 * <ul>
-729 * <li>keyDerivationFunc = pkcs5PBKDF2 with HmacSHA1</li>
-730 * <li>encryptionScheme = des-EDE3-CBC(i.e. TripleDES</li>
-731 * </ul>
-732 * @example
-733 * // to convert plain PKCS#5 private key to encrypted PKCS#8 private
-734 * // key with PBKDF2 with TripleDES
-735 * % openssl pkcs8 -in plain_p5.pem -topk8 -v2 -des3 -out encrypted_p8.pem
-736 */
-737 getRSAKeyFromEncryptedPKCS8PEM : function ( pkcs8PEM , passcode ) {
-738 var prvKeyHex = this.getPlainPKCS8HexFromEncryptedPKCS8PEM ( pkcs8PEM , passcode ) ;
-739 var rsaKey = this.getRSAKeyFromPlainPKCS8Hex ( prvKeyHex ) ;
-740 return rsaKey ;
-741 } ,
-742
-743 /**
-744 * get RSAKey/ECDSA private key object from encrypted PEM PKCS#8 private key
-745 * @name getKeyFromEncryptedPKCS8PEM
-746 * @memberOf PKCS5PKEY
-747 * @function
-748 * @param {String} pkcs8PEM string of PEM formatted PKCS#8 private key
-749 * @param {String} passcode passcode string to decrypt key
-750 * @return {Object} RSAKey or KJUR.crypto.ECDSA private key object
-751 * @since pkcs5pkey 1.0.5
-752 */
-753 getKeyFromEncryptedPKCS8PEM : function ( pkcs8PEM , passcode ) {
-754 var prvKeyHex = this.getPlainPKCS8HexFromEncryptedPKCS8PEM ( pkcs8PEM , passcode ) ;
-755 var key = this.getKeyFromPlainPrivatePKCS8Hex ( prvKeyHex ) ;
-756 return key ;
-757 } ,
-758
-759 /**
-760 * parse hexadecimal string of plain PKCS#8 private key
-761 * @name parsePlainPrivatePKCS8Hex
-762 * @memberOf PKCS5PKEY
-763 * @function
-764 * @param {String} pkcs8PrvHex hexadecimal string of PKCS#8 plain private key
-765 * @return {Array} associative array of parsed key
-766 * @since pkcs5pkey 1.0.5
-767 * @description
-768 * Resulted associative array has following properties:
-769 * <ul>
-770 * <li>algoid - hexadecimal string of OID of asymmetric key algorithm</li>
-771 * <li>algparam - hexadecimal string of OID of ECC curve name or null</li>
-772 * <li>keyidx - string starting index of key in pkcs8PrvHex</li>
-773 * </ul>
-774 */
-775 parsePlainPrivatePKCS8Hex : function ( pkcs8PrvHex ) {
-776 var result = { } ;
-777 result.algparam = null ;
-778
-779 // 1. sequence
-780 if ( pkcs8PrvHex.substr ( 0 , 2 ) != "30" )
-781 throw "malformed plain PKCS8 private key(code:001)" ; // not sequence
-782
-783 var a1 = ASN1HEX.getPosArrayOfChildren_AtObj ( pkcs8PrvHex , 0 ) ;
-784 if ( a1.length != 3 )
-785 throw "malformed plain PKCS8 private key(code:002)" ;
-786
-787 // 2. AlgID
-788 if ( pkcs8PrvHex.substr ( a1 [ 1 ] , 2 ) != "30" )
-789 throw "malformed PKCS8 private key(code:003)" ; // AlgId not sequence
-790
-791 var a2 = ASN1HEX.getPosArrayOfChildren_AtObj ( pkcs8PrvHex , a1 [ 1 ] ) ;
-792 if ( a2.length != 2 )
-793 throw "malformed PKCS8 private key(code:004)" ; // AlgId not have two elements
-794
-795 // 2.1. AlgID OID
-796 if ( pkcs8PrvHex.substr ( a2 [ 0 ] , 2 ) != "06" )
-797 throw "malformed PKCS8 private key(code:005)" ; // AlgId.oid is not OID
-798
-799 result.algoid = ASN1HEX.getHexOfV_AtObj ( pkcs8PrvHex , a2 [ 0 ] ) ;
-800
-801 // 2.2. AlgID param
-802 if ( pkcs8PrvHex.substr ( a2 [ 1 ] , 2 ) == "06" ) {
-803 result.algparam = ASN1HEX.getHexOfV_AtObj ( pkcs8PrvHex , a2 [ 1 ] ) ;
-804 }
-805
-806 // 3. Key index
-807 if ( pkcs8PrvHex.substr ( a1 [ 2 ] , 2 ) != "04" )
-808 throw "malformed PKCS8 private key(code:006)" ; // not octet string
-809
-810 result.keyidx = ASN1HEX.getStartPosOfV_AtObj ( pkcs8PrvHex , a1 [ 2 ] ) ;
-811
-812 return result ;
-813 } ,
-814
-815 /**
-816 * get RSAKey/ECDSA private key object from PEM plain PEM PKCS#8 private key
-817 * @name getKeyFromPlainPrivatePKCS8PEM
-818 * @memberOf PKCS5PKEY
-819 * @function
-820 * @param {String} pkcs8PEM string of plain PEM formatted PKCS#8 private key
-821 * @return {Object} RSAKey or KJUR.crypto.ECDSA private key object
-822 * @since pkcs5pkey 1.0.5
-823 */
-824 getKeyFromPlainPrivatePKCS8PEM : function ( prvKeyPEM ) {
-825 var prvKeyHex = this.getHexFromPEM ( prvKeyPEM , "PRIVATE KEY" ) ;
-826 var key = this.getKeyFromPlainPrivatePKCS8Hex ( prvKeyHex ) ;
-827 return key ;
-828 } ,
-829
-830 /**
-831 * get RSAKey/ECDSA private key object from HEX plain PEM PKCS#8 private key
-832 * @name getKeyFromPlainPrivatePKCS8Hex
-833 * @memberOf PKCS5PKEY
-834 * @function
-835 * @param {String} prvKeyHex hexadecimal string of plain PKCS#8 private key
-836 * @return {Object} RSAKey or KJUR.crypto.ECDSA private key object
-837 * @since pkcs5pkey 1.0.5
-838 */
-839 getKeyFromPlainPrivatePKCS8Hex : function ( prvKeyHex ) {
-840 var p8 = this.parsePlainPrivatePKCS8Hex ( prvKeyHex ) ;
-841
-842 if ( p8.algoid == "2a864886f70d010101" ) { // RSA
-843 this.parsePrivateRawRSAKeyHexAtObj ( prvKeyHex , p8 ) ;
-844 var k = p8.key ;
-845 var key = new RSAKey ( ) ;
-846 key.setPrivateEx ( k.n , k.e , k.d , k.p , k.q , k.dp , k.dq , k.co ) ;
-847 return key ;
-848 } else if ( p8.algoid == "2a8648ce3d0201" ) { // ECC
-849 this.parsePrivateRawECKeyHexAtObj ( prvKeyHex , p8 ) ;
-850 if ( KJUR.crypto.OID.oidhex2name [ p8.algparam ] === undefined )
-851 throw "KJUR.crypto.OID.oidhex2name undefined: " + p8.algparam ;
-852 var curveName = KJUR.crypto.OID.oidhex2name [ p8.algparam ] ;
-853 var key = new KJUR.crypto.ECDSA ( { 'curve' : curveName , 'prv' : p8.key } ) ;
-854 return key ;
-855 } else {
-856 throw "unsupported private key algorithm" ;
-857 }
-858 } ,
-859
-860 // === PKCS8 RSA Public Key ================================================
-861 /**
-862 * read PEM formatted PKCS#8 public key and returns RSAKey object
-863 * @name getRSAKeyFromPublicPKCS8PEM
-864 * @memberOf PKCS5PKEY
-865 * @function
-866 * @param {String} pkcs8PubPEM PEM formatted PKCS#8 public key
-867 * @return {RSAKey} loaded RSAKey object of RSA public key
-868 * @since pkcs5pkey 1.0.4
-869 */
-870 getRSAKeyFromPublicPKCS8PEM : function ( pkcs8PubPEM ) {
-871 var pubKeyHex = this.getHexFromPEM ( pkcs8PubPEM , "PUBLIC KEY" ) ;
-872 var rsaKey = this.getRSAKeyFromPublicPKCS8Hex ( pubKeyHex ) ;
-873 return rsaKey ;
-874 } ,
-875
-876 /**
-877 * get RSAKey/ECDSA public key object from PEM PKCS#8 public key
-878 * @name getKeyFromPublicPKCS8PEM
-879 * @memberOf PKCS5PKEY
-880 * @function
-881 * @param {String} pkcsPub8PEM string of PEM formatted PKCS#8 public key
-882 * @return {Object} RSAKey or KJUR.crypto.ECDSA private key object
-883 * @since pkcs5pkey 1.0.5
-884 */
-885 getKeyFromPublicPKCS8PEM : function ( pkcs8PubPEM ) {
-886 var pubKeyHex = this.getHexFromPEM ( pkcs8PubPEM , "PUBLIC KEY" ) ;
-887 var key = this.getKeyFromPublicPKCS8Hex ( pubKeyHex ) ;
-888 return key ;
-889 } ,
-890
-891 /**
-892 * get RSAKey/ECDSA public key object from hexadecimal string of PKCS#8 public key
-893 * @name getKeyFromPublicPKCS8Hex
-894 * @memberOf PKCS5PKEY
-895 * @function
-896 * @param {String} pkcsPub8Hex hexadecimal string of PKCS#8 public key
-897 * @return {Object} RSAKey or KJUR.crypto.ECDSA private key object
-898 * @since pkcs5pkey 1.0.5
-899 */
-900 getKeyFromPublicPKCS8Hex : function ( pkcs8PubHex ) {
-901 var p8 = this.parsePublicPKCS8Hex ( pkcs8PubHex ) ;
-902
-903 if ( p8.algoid == "2a864886f70d010101" ) { // RSA
-904 var aRSA = this.parsePublicRawRSAKeyHex ( p8.key ) ;
-905 var key = new RSAKey ( ) ;
-906 key.setPublic ( aRSA.n , aRSA.e ) ;
-907 return key ;
-908 } else if ( p8.algoid == "2a8648ce3d0201" ) { // ECC
-909 if ( KJUR.crypto.OID.oidhex2name [ p8.algparam ] === undefined )
-910 throw "KJUR.crypto.OID.oidhex2name undefined: " + p8.algparam ;
-911 var curveName = KJUR.crypto.OID.oidhex2name [ p8.algparam ] ;
-912 var key = new KJUR.crypto.ECDSA ( { 'curve' : curveName , 'pub' : p8.key } ) ;
-913 return key ;
-914 } else {
-915 throw "unsupported public key algorithm" ;
-916 }
-917 } ,
-918
-919 /**
-920 * parse hexadecimal string of plain PKCS#8 private key
-921 * @name parsePublicRawRSAKeyHex
-922 * @memberOf PKCS5PKEY
-923 * @function
-924 * @param {String} pubRawRSAHex hexadecimal string of ASN.1 encoded PKCS#8 public key
-925 * @return {Array} associative array of parsed key
-926 * @since pkcs5pkey 1.0.5
-927 * @description
-928 * Resulted associative array has following properties:
-929 * <ul>
-930 * <li>n - hexadecimal string of public key
-931 * <li>e - hexadecimal string of public exponent
-932 * </ul>
-933 */
-934 parsePublicRawRSAKeyHex : function ( pubRawRSAHex ) {
-935 var result = { } ;
-936
-937 // 1. Sequence
-938 if ( pubRawRSAHex.substr ( 0 , 2 ) != "30" )
-939 throw "malformed RSA key(code:001)" ; // not sequence
-940
-941 var a1 = ASN1HEX.getPosArrayOfChildren_AtObj ( pubRawRSAHex , 0 ) ;
-942 if ( a1.length != 2 )
-943 throw "malformed RSA key(code:002)" ; // not 2 items in seq
-944
-945 // 2. public key "N"
-946 if ( pubRawRSAHex.substr ( a1 [ 0 ] , 2 ) != "02" )
-947 throw "malformed RSA key(code:003)" ; // 1st item is not integer
-948
-949 result.n = ASN1HEX.getHexOfV_AtObj ( pubRawRSAHex , a1 [ 0 ] ) ;
-950
-951 // 3. public key "E"
-952 if ( pubRawRSAHex.substr ( a1 [ 1 ] , 2 ) != "02" )
-953 throw "malformed RSA key(code:004)" ; // 2nd item is not integer
-954
-955 result.e = ASN1HEX.getHexOfV_AtObj ( pubRawRSAHex , a1 [ 1 ] ) ;
-956
-957 return result ;
-958 } ,
-959
-960 /**
-961 * parse hexadecimal string of RSA private key
-962 * @name parsePrivateRawRSAKeyHexAtObj
-963 * @memberOf PKCS5PKEY
-964 * @function
-965 * @param {String} pkcs8PrvHex hexadecimal string of PKCS#8 private key concluding RSA private key
-966 * @return {Array} info associative array to add parsed RSA private key information
-967 * @since pkcs5pkey 1.0.5
-968 * @description
-969 * Following properties are added to associative array 'info'
-970 * <ul>
-971 * <li>n - hexadecimal string of public key
-972 * <li>e - hexadecimal string of public exponent
-973 * <li>d - hexadecimal string of private key
-974 * <li>p - hexadecimal string
-975 * <li>q - hexadecimal string
-976 * <li>dp - hexadecimal string
-977 * <li>dq - hexadecimal string
-978 * <li>co - hexadecimal string
-979 * </ul>
-980 */
-981 parsePrivateRawRSAKeyHexAtObj : function ( pkcs8PrvHex , info ) {
-982 var keyIdx = info.keyidx ;
-983
-984 // 1. sequence
-985 if ( pkcs8PrvHex.substr ( keyIdx , 2 ) != "30" )
-986 throw "malformed RSA private key(code:001)" ; // not sequence
-987
-988 var a1 = ASN1HEX.getPosArrayOfChildren_AtObj ( pkcs8PrvHex , keyIdx ) ;
-989 if ( a1.length != 9 )
-990 throw "malformed RSA private key(code:002)" ; // not sequence
-991
-992 // 2. RSA key
-993 info.key = { } ;
-994 info.key.n = ASN1HEX.getHexOfV_AtObj ( pkcs8PrvHex , a1 [ 1 ] ) ;
-995 info.key.e = ASN1HEX.getHexOfV_AtObj ( pkcs8PrvHex , a1 [ 2 ] ) ;
-996 info.key.d = ASN1HEX.getHexOfV_AtObj ( pkcs8PrvHex , a1 [ 3 ] ) ;
-997 info.key.p = ASN1HEX.getHexOfV_AtObj ( pkcs8PrvHex , a1 [ 4 ] ) ;
-998 info.key.q = ASN1HEX.getHexOfV_AtObj ( pkcs8PrvHex , a1 [ 5 ] ) ;
-999 info.key.dp = ASN1HEX.getHexOfV_AtObj ( pkcs8PrvHex , a1 [ 6 ] ) ;
-1000 info.key.dq = ASN1HEX.getHexOfV_AtObj ( pkcs8PrvHex , a1 [ 7 ] ) ;
-1001 info.key.co = ASN1HEX.getHexOfV_AtObj ( pkcs8PrvHex , a1 [ 8 ] ) ;
-1002 } ,
-1003
-1004 /**
-1005 * parse hexadecimal string of ECC private key
-1006 * @name parsePrivateRawECKeyHexAtObj
-1007 * @memberOf PKCS5PKEY
-1008 * @function
-1009 * @param {String} pkcs8PrvHex hexadecimal string of PKCS#8 private key concluding EC private key
-1010 * @return {Array} info associative array to add parsed ECC private key information
-1011 * @since pkcs5pkey 1.0.5
-1012 * @description
-1013 * Following properties are added to associative array 'info'
-1014 * <ul>
-1015 * <li>key - hexadecimal string of ECC private key
-1016 * </ul>
-1017 */
-1018 parsePrivateRawECKeyHexAtObj : function ( pkcs8PrvHex , info ) {
-1019 var keyIdx = info.keyidx ;
-1020
-1021 // 1. sequence
-1022 if ( pkcs8PrvHex.substr ( keyIdx , 2 ) != "30" )
-1023 throw "malformed ECC private key(code:001)" ; // not sequence
-1024
-1025 var a1 = ASN1HEX.getPosArrayOfChildren_AtObj ( pkcs8PrvHex , keyIdx ) ;
-1026 if ( a1.length != 3 )
-1027 throw "malformed ECC private key(code:002)" ; // not sequence
-1028
-1029 // 2. EC private key
-1030 if ( pkcs8PrvHex.substr ( a1 [ 1 ] , 2 ) != "04" )
-1031 throw "malformed ECC private key(code:003)" ; // not octetstring
-1032
-1033 info.key = ASN1HEX.getHexOfV_AtObj ( pkcs8PrvHex , a1 [ 1 ] ) ;
-1034 } ,
-1035
-1036 /**
-1037 * parse hexadecimal string of PKCS#8 public key
-1038 * @name parsePublicPKCS8Hex
-1039 * @memberOf PKCS5PKEY
-1040 * @function
-1041 * @param {String} pkcs8PubHex hexadecimal string of PKCS#8 public key
-1042 * @return {Hash} hash of key information
-1043 * @description
-1044 * Resulted hash has following attributes.
-1045 * <ul>
-1046 * <li>algoid - hexadecimal string of OID of asymmetric key algorithm</li>
-1047 * <li>algparam - hexadecimal string of OID of ECC curve name or null</li>
-1048 * <li>key - hexadecimal string of public key</li>
-1049 * </ul>
-1050 */
-1051 parsePublicPKCS8Hex : function ( pkcs8PubHex ) {
-1052 var result = { } ;
-1053 result.algparam = null ;
-1054
-1055 // 1. AlgID and Key bit string
-1056 var a1 = ASN1HEX.getPosArrayOfChildren_AtObj ( pkcs8PubHex , 0 ) ;
-1057 if ( a1.length != 2 )
-1058 throw "outer DERSequence shall have 2 elements: " + a1.length ;
-1059
-1060 // 2. AlgID
-1061 var idxAlgIdTLV = a1 [ 0 ] ;
-1062 if ( pkcs8PubHex.substr ( idxAlgIdTLV , 2 ) != "30" )
-1063 throw "malformed PKCS8 public key(code:001)" ; // AlgId not sequence
-1064
-1065 var a2 = ASN1HEX.getPosArrayOfChildren_AtObj ( pkcs8PubHex , idxAlgIdTLV ) ;
-1066 if ( a2.length != 2 )
-1067 throw "malformed PKCS8 public key(code:002)" ; // AlgId not have two elements
-1068
-1069 // 2.1. AlgID OID
-1070 if ( pkcs8PubHex.substr ( a2 [ 0 ] , 2 ) != "06" )
-1071 throw "malformed PKCS8 public key(code:003)" ; // AlgId.oid is not OID
-1072
-1073 result.algoid = ASN1HEX.getHexOfV_AtObj ( pkcs8PubHex , a2 [ 0 ] ) ;
-1074
-1075 // 2.2. AlgID param
-1076 if ( pkcs8PubHex.substr ( a2 [ 1 ] , 2 ) == "06" ) {
-1077 result.algparam = ASN1HEX.getHexOfV_AtObj ( pkcs8PubHex , a2 [ 1 ] ) ;
-1078 }
-1079
-1080 // 3. Key
-1081 if ( pkcs8PubHex.substr ( a1 [ 1 ] , 2 ) != "03" )
-1082 throw "malformed PKCS8 public key(code:004)" ; // Key is not bit string
-1083
-1084 result.key = ASN1HEX.getHexOfV_AtObj ( pkcs8PubHex , a1 [ 1 ] ) . substr ( 2 ) ;
-1085
-1086 // 4. return result assoc array
-1087 return result ;
-1088 } ,
-1089
-1090 /**
-1091 * provide hexadecimal string of unencrypted PKCS#8 private key and returns RSAKey object
-1092 * @name getRSAKeyFromPublicPKCS8Hex
-1093 * @memberOf PKCS5PKEY
-1094 * @function
-1095 * @param {String} pkcs8PubHex hexadecimal string of unencrypted PKCS#8 public key
-1096 * @return {RSAKey} loaded RSAKey object of RSA public key
-1097 * @since pkcs5pkey 1.0.4
-1098 */
-1099 getRSAKeyFromPublicPKCS8Hex : function ( pkcs8PubHex ) {
-1100 var a1 = ASN1HEX.getPosArrayOfChildren_AtObj ( pkcs8PubHex , 0 ) ;
-1101 if ( a1.length != 2 )
-1102 throw "outer DERSequence shall have 2 elements: " + a1.length ;
-1103
-1104 var algIdTLV = ASN1HEX.getHexOfTLV_AtObj ( pkcs8PubHex , a1 [ 0 ] ) ;
-1105 if ( algIdTLV != "300d06092a864886f70d0101010500" ) // AlgId rsaEncryption
-1106 throw "PKCS8 AlgorithmId is not rsaEncryption" ;
-1107
-1108 if ( pkcs8PubHex.substr ( a1 [ 1 ] , 2 ) != "03" )
-1109 throw "PKCS8 Public Key is not BITSTRING encapslated." ;
-1110
-1111 var idxPub = ASN1HEX.getStartPosOfV_AtObj ( pkcs8PubHex , a1 [ 1 ] ) + 2 ; // 2 for unused bit
-1112
-1113 if ( pkcs8PubHex.substr ( idxPub , 2 ) != "30" )
-1114 throw "PKCS8 Public Key is not SEQUENCE." ;
-1115
-1116 var a2 = ASN1HEX.getPosArrayOfChildren_AtObj ( pkcs8PubHex , idxPub ) ;
-1117 if ( a2.length != 2 )
-1118 throw "inner DERSequence shall have 2 elements: " + a2.length ;
-1119
-1120 if ( pkcs8PubHex.substr ( a2 [ 0 ] , 2 ) != "02" )
-1121 throw "N is not ASN.1 INTEGER" ;
-1122 if ( pkcs8PubHex.substr ( a2 [ 1 ] , 2 ) != "02" )
-1123 throw "E is not ASN.1 INTEGER" ;
-1124
-1125 var hN = ASN1HEX.getHexOfV_AtObj ( pkcs8PubHex , a2 [ 0 ] ) ;
-1126 var hE = ASN1HEX.getHexOfV_AtObj ( pkcs8PubHex , a2 [ 1 ] ) ;
-1127
-1128 var pubKey = new RSAKey ( ) ;
-1129 pubKey.setPublic ( hN , hE ) ;
-1130
-1131 return pubKey ;
-1132 } ,
-1133 } ;
-1134 } ( ) ;
-1135
\ No newline at end of file
diff --git a/jwt/api/symbols/src/rsapem-1.1.js.html b/jwt/api/symbols/src/rsapem-1.1.js.html
deleted file mode 100644
index 04fd7b4..0000000
--- a/jwt/api/symbols/src/rsapem-1.1.js.html
+++ /dev/null
@@ -1,110 +0,0 @@
-
1 /*! rsapem-1.1.js (c) 2012 Kenji Urushima | kjur.github.com/jsrsasign/license
- 2 */
- 3 //
- 4 // rsa-pem.js - adding function for reading/writing PKCS#1 PEM private key
- 5 // to RSAKey class.
- 6 //
- 7 // version: 1.1.1 (2013-Apr-12)
- 8 //
- 9 // Copyright (c) 2010-2013 Kenji Urushima (kenji.urushima@gmail.com)
- 10 //
- 11 // This software is licensed under the terms of the MIT License.
- 12 // http://kjur.github.com/jsrsasign/license/
- 13 //
- 14 // The above copyright and license notice shall be
- 15 // included in all copies or substantial portions of the Software.
- 16 //
- 17 //
- 18 // Depends on:
- 19 //
- 20 //
- 21 //
- 22 // _RSApem_pemToBase64(sPEM)
- 23 //
- 24 // removing PEM header, PEM footer and space characters including
- 25 // new lines from PEM formatted RSA private key string.
- 26 //
- 27
- 28 /**
- 29 * @fileOverview
- 30 * @name rsapem-1.1.js
- 31 * @author Kenji Urushima kenji.urushima@gmail.com
- 32 * @version 1.1
- 33 * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a>
- 34 */
- 35 function _rsapem_pemToBase64 ( sPEMPrivateKey ) {
- 36 var s = sPEMPrivateKey ;
- 37 s = s.replace ( "-----BEGIN RSA PRIVATE KEY-----" , "" ) ;
- 38 s = s.replace ( "-----END RSA PRIVATE KEY-----" , "" ) ;
- 39 s = s.replace ( /[ \n]+/g , "" ) ;
- 40 return s ;
- 41 }
- 42
- 43 function _rsapem_getPosArrayOfChildrenFromHex ( hPrivateKey ) {
- 44 var a = new Array ( ) ;
- 45 var v1 = ASN1HEX.getStartPosOfV_AtObj ( hPrivateKey , 0 ) ;
- 46 var n1 = ASN1HEX.getPosOfNextSibling_AtObj ( hPrivateKey , v1 ) ;
- 47 var e1 = ASN1HEX.getPosOfNextSibling_AtObj ( hPrivateKey , n1 ) ;
- 48 var d1 = ASN1HEX.getPosOfNextSibling_AtObj ( hPrivateKey , e1 ) ;
- 49 var p1 = ASN1HEX.getPosOfNextSibling_AtObj ( hPrivateKey , d1 ) ;
- 50 var q1 = ASN1HEX.getPosOfNextSibling_AtObj ( hPrivateKey , p1 ) ;
- 51 var dp1 = ASN1HEX.getPosOfNextSibling_AtObj ( hPrivateKey , q1 ) ;
- 52 var dq1 = ASN1HEX.getPosOfNextSibling_AtObj ( hPrivateKey , dp1 ) ;
- 53 var co1 = ASN1HEX.getPosOfNextSibling_AtObj ( hPrivateKey , dq1 ) ;
- 54 a.push ( v1 , n1 , e1 , d1 , p1 , q1 , dp1 , dq1 , co1 ) ;
- 55 return a ;
- 56 }
- 57
- 58 function _rsapem_getHexValueArrayOfChildrenFromHex ( hPrivateKey ) {
- 59 var posArray = _rsapem_getPosArrayOfChildrenFromHex ( hPrivateKey ) ;
- 60 var v = ASN1HEX.getHexOfV_AtObj ( hPrivateKey , posArray [ 0 ] ) ;
- 61 var n = ASN1HEX.getHexOfV_AtObj ( hPrivateKey , posArray [ 1 ] ) ;
- 62 var e = ASN1HEX.getHexOfV_AtObj ( hPrivateKey , posArray [ 2 ] ) ;
- 63 var d = ASN1HEX.getHexOfV_AtObj ( hPrivateKey , posArray [ 3 ] ) ;
- 64 var p = ASN1HEX.getHexOfV_AtObj ( hPrivateKey , posArray [ 4 ] ) ;
- 65 var q = ASN1HEX.getHexOfV_AtObj ( hPrivateKey , posArray [ 5 ] ) ;
- 66 var dp = ASN1HEX.getHexOfV_AtObj ( hPrivateKey , posArray [ 6 ] ) ;
- 67 var dq = ASN1HEX.getHexOfV_AtObj ( hPrivateKey , posArray [ 7 ] ) ;
- 68 var co = ASN1HEX.getHexOfV_AtObj ( hPrivateKey , posArray [ 8 ] ) ;
- 69 var a = new Array ( ) ;
- 70 a.push ( v , n , e , d , p , q , dp , dq , co ) ;
- 71 return a ;
- 72 }
- 73
- 74 /**
- 75 * read RSA private key from a ASN.1 hexadecimal string
- 76 * @name readPrivateKeyFromASN1HexString
- 77 * @memberOf RSAKey#
- 78 * @function
- 79 * @param {String} keyHex ASN.1 hexadecimal string of PKCS#1 private key.
- 80 * @since 1.1.1
- 81 */
- 82 function _rsapem_readPrivateKeyFromASN1HexString ( keyHex ) {
- 83 var a = _rsapem_getHexValueArrayOfChildrenFromHex ( keyHex ) ;
- 84 this.setPrivateEx ( a [ 1 ] , a [ 2 ] , a [ 3 ] , a [ 4 ] , a [ 5 ] , a [ 6 ] , a [ 7 ] , a [ 8 ] ) ;
- 85 }
- 86
- 87 /**
- 88 * read PKCS#1 private key from a string
- 89 * @name readPrivateKeyFromPEMString
- 90 * @memberOf RSAKey#
- 91 * @function
- 92 * @param {String} keyPEM string of PKCS#1 private key.
- 93 */
- 94 function _rsapem_readPrivateKeyFromPEMString ( keyPEM ) {
- 95 var keyB64 = _rsapem_pemToBase64 ( keyPEM ) ;
- 96 var keyHex = b64tohex ( keyB64 ) // depends base64.js
- 97 var a = _rsapem_getHexValueArrayOfChildrenFromHex ( keyHex ) ;
- 98 this.setPrivateEx ( a [ 1 ] , a [ 2 ] , a [ 3 ] , a [ 4 ] , a [ 5 ] , a [ 6 ] , a [ 7 ] , a [ 8 ] ) ;
- 99 }
-100
-101 RSAKey.prototype.readPrivateKeyFromPEMString = _rsapem_readPrivateKeyFromPEMString ;
-102 RSAKey.prototype.readPrivateKeyFromASN1HexString = _rsapem_readPrivateKeyFromASN1HexString ;
-103
\ No newline at end of file
diff --git a/jwt/api/symbols/src/rsasign-1.2.js.html b/jwt/api/symbols/src/rsasign-1.2.js.html
deleted file mode 100644
index 2e271d0..0000000
--- a/jwt/api/symbols/src/rsasign-1.2.js.html
+++ /dev/null
@@ -1,464 +0,0 @@
-
1 /*! rsasign-1.2.7.js (c) 2012 Kenji Urushima | kjur.github.com/jsrsasign/license
- 2 */
- 3 /*
- 4 * rsa-sign.js - adding signing functions to RSAKey class.
- 5 *
- 6 * version: 1.2.7 (2013 Aug 25)
- 7 *
- 8 * Copyright (c) 2010-2013 Kenji Urushima (kenji.urushima@gmail.com)
- 9 *
- 10 * This software is licensed under the terms of the MIT License.
- 11 * http://kjur.github.com/jsrsasign/license/
- 12 *
- 13 * The above copyright and license notice shall be
- 14 * included in all copies or substantial portions of the Software.
- 15 */
- 16
- 17 /**
- 18 * @fileOverview
- 19 * @name rsasign-1.2.js
- 20 * @author Kenji Urushima kenji.urushima@gmail.com
- 21 * @version rsasign 1.2.7
- 22 * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a>
- 23 */
- 24
- 25 var _RE_HEXDECONLY = new RegExp ( "" ) ;
- 26 _RE_HEXDECONLY.compile ( "[^0-9a-f]" , "gi" ) ;
- 27
- 28 // ========================================================================
- 29 // Signature Generation
- 30 // ========================================================================
- 31
- 32 function _rsasign_getHexPaddedDigestInfoForString ( s , keySize , hashAlg ) {
- 33 var hashFunc = function ( s ) { return KJUR.crypto.Util.hashString ( s , hashAlg ) ; } ;
- 34 var sHashHex = hashFunc ( s ) ;
- 35
- 36 return KJUR.crypto.Util.getPaddedDigestInfoHex ( sHashHex , hashAlg , keySize ) ;
- 37 }
- 38
- 39 function _zeroPaddingOfSignature ( hex , bitLength ) {
- 40 var s = "" ;
- 41 var nZero = bitLength / 4 - hex.length ;
- 42 for ( var i = 0 ; i < nZero ; i ++ ) {
- 43 s = s + "0" ;
- 44 }
- 45 return s + hex ;
- 46 }
- 47
- 48 /**
- 49 * sign for a message string with RSA private key.<br/>
- 50 * @name signString
- 51 * @memberOf RSAKey
- 52 * @function
- 53 * @param {String} s message string to be signed.
- 54 * @param {String} hashAlg hash algorithm name for signing.<br/>
- 55 * @return returns hexadecimal string of signature value.
- 56 */
- 57 function _rsasign_signString ( s , hashAlg ) {
- 58 var hashFunc = function ( s ) { return KJUR.crypto.Util.hashString ( s , hashAlg ) ; } ;
- 59 var sHashHex = hashFunc ( s ) ;
- 60
- 61 return this.signWithMessageHash ( sHashHex , hashAlg ) ;
- 62 }
- 63
- 64 /**
- 65 * sign hash value of message to be signed with RSA private key.<br/>
- 66 * @name signWithMessageHash
- 67 * @memberOf RSAKey
- 68 * @function
- 69 * @param {String} sHashHex hexadecimal string of hash value of message to be signed.
- 70 * @param {String} hashAlg hash algorithm name for signing.<br/>
- 71 * @return returns hexadecimal string of signature value.
- 72 * @since rsasign 1.2.6
- 73 */
- 74 function _rsasign_signWithMessageHash ( sHashHex , hashAlg ) {
- 75 var hPM = KJUR.crypto.Util.getPaddedDigestInfoHex ( sHashHex , hashAlg , this.n.bitLength ( ) ) ;
- 76 var biPaddedMessage = parseBigInt ( hPM , 16 ) ;
- 77 var biSign = this.doPrivate ( biPaddedMessage ) ;
- 78 var hexSign = biSign.toString ( 16 ) ;
- 79 return _zeroPaddingOfSignature ( hexSign , this.n.bitLength ( ) ) ;
- 80 }
- 81
- 82 function _rsasign_signStringWithSHA1 ( s ) {
- 83 return _rsasign_signString.call ( this , s , 'sha1' ) ;
- 84 }
- 85
- 86 function _rsasign_signStringWithSHA256 ( s ) {
- 87 return _rsasign_signString.call ( this , s , 'sha256' ) ;
- 88 }
- 89
- 90 // PKCS#1 (PSS) mask generation function
- 91 function pss_mgf1_str ( seed , len , hash ) {
- 92 var mask = '' , i = 0 ;
- 93
- 94 while ( mask.length < len ) {
- 95 mask + = hextorstr ( hash ( rstrtohex ( seed + String.fromCharCode.apply ( String , [
- 96 ( i & 0xff000000 ) >> 24 ,
- 97 ( i & 0x00ff0000 ) >> 16 ,
- 98 ( i & 0x0000ff00 ) >> 8 ,
- 99 i & 0x000000ff ] ) ) ) ) ;
-100 i + = 1 ;
-101 }
-102
-103 return mask ;
-104 }
-105
-106 /**
-107 * sign for a message string with RSA private key by PKCS#1 PSS signing.<br/>
-108 * @name signStringPSS
-109 * @memberOf RSAKey
-110 * @function
-111 * @param {String} s message string to be signed.
-112 * @param {String} hashAlg hash algorithm name for signing.
-113 * @param {Integer} sLen salt byte length from 0 to (keybytelen - hashbytelen - 2).
-114 * There are two special values:
-115 * <ul>
-116 * <li>-1: sets the salt length to the digest length</li>
-117 * <li>-2: sets the salt length to maximum permissible value
-118 * (i.e. keybytelen - hashbytelen - 2)</li>
-119 * </ul>
-120 * DEFAULT is -1. (NOTE: OpenSSL's default is -2.)
-121 * @return returns hexadecimal string of signature value.
-122 */
-123 function _rsasign_signStringPSS ( s , hashAlg , sLen ) {
-124 var hashFunc = function ( sHex ) { return KJUR.crypto.Util.hashHex ( sHex , hashAlg ) ; }
-125 var hHash = hashFunc ( rstrtohex ( s ) ) ;
-126
-127 if ( sLen === undefined ) sLen = - 1 ;
-128 return this.signWithMessageHashPSS ( hHash , hashAlg , sLen ) ;
-129 }
-130
-131 /**
-132 * sign hash value of message with RSA private key by PKCS#1 PSS signing.<br/>
-133 * @name signWithMessageHashPSS
-134 * @memberOf RSAKey
-135 * @function
-136 * @param {String} hHash hexadecimal hash value of message to be signed.
-137 * @param {String} hashAlg hash algorithm name for signing.
-138 * @param {Integer} sLen salt byte length from 0 to (keybytelen - hashbytelen - 2).
-139 * There are two special values:
-140 * <ul>
-141 * <li>-1: sets the salt length to the digest length</li>
-142 * <li>-2: sets the salt length to maximum permissible value
-143 * (i.e. keybytelen - hashbytelen - 2)</li>
-144 * </ul>
-145 * DEFAULT is -1. (NOTE: OpenSSL's default is -2.)
-146 * @return returns hexadecimal string of signature value.
-147 * @since rsasign 1.2.6
-148 */
-149 function _rsasign_signWithMessageHashPSS ( hHash , hashAlg , sLen ) {
-150 var mHash = hextorstr ( hHash ) ;
-151 var hLen = mHash.length ;
-152 var emBits = this.n.bitLength ( ) - 1 ;
-153 var emLen = Math.ceil ( emBits / 8 ) ;
-154 var i ;
-155 var hashFunc = function ( sHex ) { return KJUR.crypto.Util.hashHex ( sHex , hashAlg ) ; }
-156
-157 if ( sLen === - 1 || sLen === undefined ) {
-158 sLen = hLen ; // same as hash length
-159 } else if ( sLen === - 2 ) {
-160 sLen = emLen - hLen - 2 ; // maximum
-161 } else if ( sLen < - 2 ) {
-162 throw "invalid salt length" ;
-163 }
-164
-165 if ( emLen < ( hLen + sLen + 2 ) ) {
-166 throw "data too long" ;
-167 }
-168
-169 var salt = '' ;
-170
-171 if ( sLen > 0 ) {
-172 salt = new Array ( sLen ) ;
-173 new SecureRandom ( ) . nextBytes ( salt ) ;
-174 salt = String.fromCharCode.apply ( String , salt ) ;
-175 }
-176
-177 var H = hextorstr ( hashFunc ( rstrtohex ( '\x00\x00\x00\x00\x00\x00\x00\x00' + mHash + salt ) ) ) ;
-178 var PS = [ ] ;
-179
-180 for ( i = 0 ; i < emLen - sLen - hLen - 2 ; i + = 1 ) {
-181 PS [ i ] = 0x00 ;
-182 }
-183
-184 var DB = String.fromCharCode.apply ( String , PS ) + '\x01' + salt ;
-185 var dbMask = pss_mgf1_str ( H , DB.length , hashFunc ) ;
-186 var maskedDB = [ ] ;
-187
-188 for ( i = 0 ; i < DB.length ; i + = 1 ) {
-189 maskedDB [ i ] = DB.charCodeAt ( i ) ^ dbMask.charCodeAt ( i ) ;
-190 }
-191
-192 var mask = ( 0xff00 >> ( 8 * emLen - emBits ) ) & 0xff ;
-193 maskedDB [ 0 ] & = ~ mask ;
-194
-195 for ( i = 0 ; i < hLen ; i ++ ) {
-196 maskedDB.push ( H.charCodeAt ( i ) ) ;
-197 }
-198
-199 maskedDB.push ( 0xbc ) ;
-200
-201 return _zeroPaddingOfSignature ( this.doPrivate ( new BigInteger ( maskedDB ) ) . toString ( 16 ) ,
-202 this.n.bitLength ( ) ) ;
-203 }
-204
-205 // ========================================================================
-206 // Signature Verification
-207 // ========================================================================
-208
-209 function _rsasign_getDecryptSignatureBI ( biSig , hN , hE ) {
-210 var rsa = new RSAKey ( ) ;
-211 rsa.setPublic ( hN , hE ) ;
-212 var biDecryptedSig = rsa.doPublic ( biSig ) ;
-213 return biDecryptedSig ;
-214 }
-215
-216 function _rsasign_getHexDigestInfoFromSig ( biSig , hN , hE ) {
-217 var biDecryptedSig = _rsasign_getDecryptSignatureBI ( biSig , hN , hE ) ;
-218 var hDigestInfo = biDecryptedSig.toString ( 16 ) . replace ( /^1f+00/ , '' ) ;
-219 return hDigestInfo ;
-220 }
-221
-222 function _rsasign_getAlgNameAndHashFromHexDisgestInfo ( hDigestInfo ) {
-223 for ( var algName in KJUR.crypto.Util.DIGESTINFOHEAD ) {
-224 var head = KJUR.crypto.Util.DIGESTINFOHEAD [ algName ] ;
-225 var len = head.length ;
-226 if ( hDigestInfo.substring ( 0 , len ) == head ) {
-227 var a = [ algName , hDigestInfo.substring ( len ) ] ;
-228 return a ;
-229 }
-230 }
-231 return [ ] ;
-232 }
-233
-234 function _rsasign_verifySignatureWithArgs ( sMsg , biSig , hN , hE ) {
-235 var hDigestInfo = _rsasign_getHexDigestInfoFromSig ( biSig , hN , hE ) ;
-236 var digestInfoAry = _rsasign_getAlgNameAndHashFromHexDisgestInfo ( hDigestInfo ) ;
-237 if ( digestInfoAry.length == 0 ) return false ;
-238 var algName = digestInfoAry [ 0 ] ;
-239 var diHashValue = digestInfoAry [ 1 ] ;
-240 var ff = function ( s ) { return KJUR.crypto.Util.hashString ( s , algName ) ; } ;
-241 var msgHashValue = ff ( sMsg ) ;
-242 return ( diHashValue == msgHashValue ) ;
-243 }
-244
-245 function _rsasign_verifyHexSignatureForMessage ( hSig , sMsg ) {
-246 var biSig = parseBigInt ( hSig , 16 ) ;
-247 var result = _rsasign_verifySignatureWithArgs ( sMsg , biSig ,
-248 this.n.toString ( 16 ) ,
-249 this.e.toString ( 16 ) ) ;
-250 return result ;
-251 }
-252
-253 /**
-254 * verifies a sigature for a message string with RSA public key.<br/>
-255 * @name verifyString
-256 * @memberOf RSAKey#
-257 * @function
-258 * @param {String} sMsg message string to be verified.
-259 * @param {String} hSig hexadecimal string of siganture.<br/>
-260 * non-hexadecimal charactors including new lines will be ignored.
-261 * @return returns 1 if valid, otherwise 0
-262 */
-263 function _rsasign_verifyString ( sMsg , hSig ) {
-264 hSig = hSig.replace ( _RE_HEXDECONLY , '' ) ;
-265 hSig = hSig.replace ( /[ \n]+/g , "" ) ;
-266 var biSig = parseBigInt ( hSig , 16 ) ;
-267 if ( biSig.bitLength ( ) > this.n.bitLength ( ) ) return 0 ;
-268 var biDecryptedSig = this.doPublic ( biSig ) ;
-269 var hDigestInfo = biDecryptedSig.toString ( 16 ) . replace ( /^1f+00/ , '' ) ;
-270 var digestInfoAry = _rsasign_getAlgNameAndHashFromHexDisgestInfo ( hDigestInfo ) ;
-271
-272 if ( digestInfoAry.length == 0 ) return false ;
-273 var algName = digestInfoAry [ 0 ] ;
-274 var diHashValue = digestInfoAry [ 1 ] ;
-275 var ff = function ( s ) { return KJUR.crypto.Util.hashString ( s , algName ) ; } ;
-276 var msgHashValue = ff ( sMsg ) ;
-277 return ( diHashValue == msgHashValue ) ;
-278 }
-279
-280 /**
-281 * verifies a sigature for a message string with RSA public key.<br/>
-282 * @name verifyWithMessageHash
-283 * @memberOf RSAKey
-284 * @function
-285 * @param {String} sHashHex hexadecimal hash value of message to be verified.
-286 * @param {String} hSig hexadecimal string of siganture.<br/>
-287 * non-hexadecimal charactors including new lines will be ignored.
-288 * @return returns 1 if valid, otherwise 0
-289 * @since rsasign 1.2.6
-290 */
-291 function _rsasign_verifyWithMessageHash ( sHashHex , hSig ) {
-292 hSig = hSig.replace ( _RE_HEXDECONLY , '' ) ;
-293 hSig = hSig.replace ( /[ \n]+/g , "" ) ;
-294 var biSig = parseBigInt ( hSig , 16 ) ;
-295 if ( biSig.bitLength ( ) > this.n.bitLength ( ) ) return 0 ;
-296 var biDecryptedSig = this.doPublic ( biSig ) ;
-297 var hDigestInfo = biDecryptedSig.toString ( 16 ) . replace ( /^1f+00/ , '' ) ;
-298 var digestInfoAry = _rsasign_getAlgNameAndHashFromHexDisgestInfo ( hDigestInfo ) ;
-299
-300 if ( digestInfoAry.length == 0 ) return false ;
-301 var algName = digestInfoAry [ 0 ] ;
-302 var diHashValue = digestInfoAry [ 1 ] ;
-303 return ( diHashValue == sHashHex ) ;
-304 }
-305
-306 /**
-307 * verifies a sigature for a message string with RSA public key by PKCS#1 PSS sign.<br/>
-308 * @name verifyStringPSS
-309 * @memberOf RSAKey
-310 * @function
-311 * @param {String} sMsg message string to be verified.
-312 * @param {String} hSig hexadecimal string of signature value
-313 * @param {String} hashAlg hash algorithm name
-314 * @param {Integer} sLen salt byte length from 0 to (keybytelen - hashbytelen - 2).
-315 * There are two special values:
-316 * <ul>
-317 * <li>-1: sets the salt length to the digest length</li>
-318 * <li>-2: sets the salt length to maximum permissible value
-319 * (i.e. keybytelen - hashbytelen - 2)</li>
-320 * </ul>
-321 * DEFAULT is -1. (NOTE: OpenSSL's default is -2.)
-322 * @return returns true if valid, otherwise false
-323 */
-324 function _rsasign_verifyStringPSS ( sMsg , hSig , hashAlg , sLen ) {
-325 var hashFunc = function ( sHex ) { return KJUR.crypto.Util.hashHex ( sHex , hashAlg ) ; } ;
-326 var hHash = hashFunc ( rstrtohex ( sMsg ) ) ;
-327
-328 if ( sLen === undefined ) sLen = - 1 ;
-329 return this.verifyWithMessageHashPSS ( hHash , hSig , hashAlg , sLen ) ;
-330 }
-331
-332 /**
-333 * verifies a sigature for a hash value of message string with RSA public key by PKCS#1 PSS sign.<br/>
-334 * @name verifyWithMessageHashPSS
-335 * @memberOf RSAKey
-336 * @function
-337 * @param {String} hHash hexadecimal hash value of message string to be verified.
-338 * @param {String} hSig hexadecimal string of signature value
-339 * @param {String} hashAlg hash algorithm name
-340 * @param {Integer} sLen salt byte length from 0 to (keybytelen - hashbytelen - 2).
-341 * There are two special values:
-342 * <ul>
-343 * <li>-1: sets the salt length to the digest length</li>
-344 * <li>-2: sets the salt length to maximum permissible value
-345 * (i.e. keybytelen - hashbytelen - 2)</li>
-346 * </ul>
-347 * DEFAULT is -1 (NOTE: OpenSSL's default is -2.)
-348 * @return returns true if valid, otherwise false
-349 * @since rsasign 1.2.6
-350 */
-351 function _rsasign_verifyWithMessageHashPSS ( hHash , hSig , hashAlg , sLen ) {
-352 var biSig = new BigInteger ( hSig , 16 ) ;
-353
-354 if ( biSig.bitLength ( ) > this.n.bitLength ( ) ) {
-355 return false ;
-356 }
-357
-358 var hashFunc = function ( sHex ) { return KJUR.crypto.Util.hashHex ( sHex , hashAlg ) ; } ;
-359 var mHash = hextorstr ( hHash ) ;
-360 var hLen = mHash.length ;
-361 var emBits = this.n.bitLength ( ) - 1 ;
-362 var emLen = Math.ceil ( emBits / 8 ) ;
-363 var i ;
-364
-365 if ( sLen === - 1 || sLen === undefined ) {
-366 sLen = hLen ; // same as hash length
-367 } else if ( sLen === - 2 ) {
-368 sLen = emLen - hLen - 2 ; // recover
-369 } else if ( sLen < - 2 ) {
-370 throw "invalid salt length" ;
-371 }
-372
-373 if ( emLen < ( hLen + sLen + 2 ) ) {
-374 throw "data too long" ;
-375 }
-376
-377 var em = this.doPublic ( biSig ) . toByteArray ( ) ;
-378
-379 for ( i = 0 ; i < em.length ; i + = 1 ) {
-380 em [ i ] & = 0xff ;
-381 }
-382
-383 while ( em.length < emLen ) {
-384 em.unshift ( 0 ) ;
-385 }
-386
-387 if ( em [ emLen - 1 ] !== 0xbc ) {
-388 throw "encoded message does not end in 0xbc" ;
-389 }
-390
-391 em = String.fromCharCode.apply ( String , em ) ;
-392
-393 var maskedDB = em.substr ( 0 , emLen - hLen - 1 ) ;
-394 var H = em.substr ( maskedDB.length , hLen ) ;
-395
-396 var mask = ( 0xff00 >> ( 8 * emLen - emBits ) ) & 0xff ;
-397
-398 if ( ( maskedDB.charCodeAt ( 0 ) & mask ) !== 0 ) {
-399 throw "bits beyond keysize not zero" ;
-400 }
-401
-402 var dbMask = pss_mgf1_str ( H , maskedDB.length , hashFunc ) ;
-403 var DB = [ ] ;
-404
-405 for ( i = 0 ; i < maskedDB.length ; i + = 1 ) {
-406 DB [ i ] = maskedDB.charCodeAt ( i ) ^ dbMask.charCodeAt ( i ) ;
-407 }
-408
-409 DB [ 0 ] & = ~ mask ;
-410
-411 var checkLen = emLen - hLen - sLen - 2 ;
-412
-413 for ( i = 0 ; i < checkLen ; i + = 1 ) {
-414 if ( DB [ i ] !== 0x00 ) {
-415 throw "leftmost octets not zero" ;
-416 }
-417 }
-418
-419 if ( DB [ checkLen ] !== 0x01 ) {
-420 throw "0x01 marker not found" ;
-421 }
-422
-423 return H === hextorstr ( hashFunc ( rstrtohex ( '\x00\x00\x00\x00\x00\x00\x00\x00' + mHash +
-424 String.fromCharCode.apply ( String , DB.slice ( - sLen ) ) ) ) ) ;
-425 }
-426
-427 RSAKey.prototype.signWithMessageHash = _rsasign_signWithMessageHash ;
-428 RSAKey.prototype.signString = _rsasign_signString ;
-429 RSAKey.prototype.signStringWithSHA1 = _rsasign_signStringWithSHA1 ;
-430 RSAKey.prototype.signStringWithSHA256 = _rsasign_signStringWithSHA256 ;
-431 RSAKey.prototype.sign = _rsasign_signString ;
-432 RSAKey.prototype.signWithSHA1 = _rsasign_signStringWithSHA1 ;
-433 RSAKey.prototype.signWithSHA256 = _rsasign_signStringWithSHA256 ;
-434
-435 RSAKey.prototype.signWithMessageHashPSS = _rsasign_signWithMessageHashPSS ;
-436 RSAKey.prototype.signStringPSS = _rsasign_signStringPSS ;
-437 RSAKey.prototype.signPSS = _rsasign_signStringPSS ;
-438 RSAKey.SALT_LEN_HLEN = - 1 ;
-439 RSAKey.SALT_LEN_MAX = - 2 ;
-440
-441 RSAKey.prototype.verifyWithMessageHash = _rsasign_verifyWithMessageHash ;
-442 RSAKey.prototype.verifyString = _rsasign_verifyString ;
-443 RSAKey.prototype.verifyHexSignatureForMessage = _rsasign_verifyHexSignatureForMessage ;
-444 RSAKey.prototype.verify = _rsasign_verifyString ;
-445 RSAKey.prototype.verifyHexSignatureForByteArrayMessage = _rsasign_verifyHexSignatureForMessage ;
-446
-447 RSAKey.prototype.verifyWithMessageHashPSS = _rsasign_verifyWithMessageHashPSS ;
-448 RSAKey.prototype.verifyStringPSS = _rsasign_verifyStringPSS ;
-449 RSAKey.prototype.verifyPSS = _rsasign_verifyStringPSS ;
-450 RSAKey.SALT_LEN_RECOVER = - 2 ;
-451
-452 /**
-453 * @name RSAKey
-454 * @class key of RSA public key algorithm
-455 * @description Tom Wu's RSA Key class and extension
-456 */
-457
\ No newline at end of file
diff --git a/jwt/api/symbols/src/x509-1.1.js.html b/jwt/api/symbols/src/x509-1.1.js.html
deleted file mode 100644
index d46898d..0000000
--- a/jwt/api/symbols/src/x509-1.1.js.html
+++ /dev/null
@@ -1,1242 +0,0 @@
-
1 /*! x509-1.1.9.js (c) 2012-2016 Kenji Urushima | kjur.github.com/jsrsasign/license
- 2 */
- 3 /*
- 4 * x509.js - X509 class to read subject public key from certificate.
- 5 *
- 6 * Copyright (c) 2010-2016 Kenji Urushima (kenji.urushima@gmail.com)
- 7 *
- 8 * This software is licensed under the terms of the MIT License.
- 9 * http://kjur.github.com/jsrsasign/license
- 10 *
- 11 * The above copyright and license notice shall be
- 12 * included in all copies or substantial portions of the Software.
- 13 */
- 14
- 15 /**
- 16 * @fileOverview
- 17 * @name x509-1.1.js
- 18 * @author Kenji Urushima kenji.urushima@gmail.com
- 19 * @version x509 1.1.9 (2016-May-10)
- 20 * @since jsrsasign 1.x.x
- 21 * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a>
- 22 */
- 23
- 24 /*
- 25 * Depends:
- 26 * base64.js
- 27 * rsa.js
- 28 * asn1hex.js
- 29 */
- 30
- 31 /**
- 32 * hexadecimal X.509 certificate ASN.1 parser class.<br/>
- 33 * @class hexadecimal X.509 certificate ASN.1 parser class
- 34 * @property {RSAKey} subjectPublicKeyRSA Tom Wu's RSAKey object
- 35 * @property {String} subjectPublicKeyRSA_hN hexadecimal string for modulus of RSA public key
- 36 * @property {String} subjectPublicKeyRSA_hE hexadecimal string for public exponent of RSA public key
- 37 * @property {String} hex hexacedimal string for X.509 certificate.
- 38 * @author Kenji Urushima
- 39 * @version 1.0.1 (08 May 2012)
- 40 * @see <a href="http://kjur.github.com/jsrsasigns/">'jsrsasign'(RSA Sign JavaScript Library) home page http://kjur.github.com/jsrsasign/</a>
- 41 * @description
- 42 * X509 class provides following functionality:
- 43 * <ul>
- 44 * <li>parse X.509 certificate ASN.1 structure</li>
- 45 * <li>get basic fields, extensions, signature algorithms and signature values</li>
- 46 * <li>read PEM certificate</li>
- 47 * </ul>
- 48 *
- 49 * <ul>
- 50 * <li><b>TO GET FIELDS</b>
- 51 * <ul>
- 52 * <li>serial - {@link X509#getSerialNumberHex}</li>
- 53 * <li>issuer - {@link X509#getIssuerHex}</li>
- 54 * <li>issuer - {@link X509#getIssuerString}</li>
- 55 * <li>notBefore - {@link X509#getNotBefore}</li>
- 56 * <li>notAfter - {@link X509#getNotAfter}</li>
- 57 * <li>subject - {@link X509#getSubjectHex}</li>
- 58 * <li>subject - {@link X509#getSubjectString}</li>
- 59 * <li>subjectPublicKeyInfo - {@link X509.getSubjectPublicKeyPosFromCertHex}</li>
- 60 * <li>subjectPublicKeyInfo - {@link X509.getSubjectPublicKeyInfoPosFromCertHex}</li>
- 61 * <li>subjectPublicKeyInfo - {@link X509.getPublicKeyFromCertPEM}</li>
- 62 * <li>signature algorithm - {@link X509.getSignatureAlgorithmName}</li>
- 63 * <li>signature value - {@link X509.getSignatureValueHex}</li>
- 64 * </ul>
- 65 * </li>
- 66 * <li><b>TO GET EXTENSIONS</b>
- 67 * <ul>
- 68 * <li>basicConstraints - {@link X509.getExtBasicConstraints}</li>
- 69 * <li>keyUsage - {@link X509.getExtKeyUsageBin}</li>
- 70 * <li>keyUsage - {@link X509.getExtKeyUsageString}</li>
- 71 * <li>subjectKeyIdentifier - {@link X509.getExtSubjectKeyIdentifier}</li>
- 72 * <li>authorityKeyIdentifier - {@link X509.getExtAuthorityKeyIdentifier}</li>
- 73 * <li>extKeyUsage - {@link X509.getExtExtKeyUsageName}</li>
- 74 * <li>subjectAltName - {@link X509.getExtSubjectAltName}</li>
- 75 * <li>cRLDistributionPoints - {@link X509.getExtCRLDistributionPointsURI}</li>
- 76 * <li>authorityInfoAccess - {@link X509.getExtAIAInfo}</li>
- 77 * </ul>
- 78 * </li>
- 79 * <li><b>UTILITIES</b>
- 80 * <ul>
- 81 * <li>reading PEM certificate - {@link X509#readCertPEM}</li>
- 82 * <li>get all certificate information - {@link X509#getInfo}</li>
- 83 * <li>get Base64 from PEM certificate - {@link X509.pemToBase64}</li>
- 84 * <li>get hexadecimal string from PEM certificate - {@link X509.pemToHex}</li>
- 85 * </ul>
- 86 * </li>
- 87 * </ul>
- 88 */
- 89 function X509 ( ) {
- 90 this.subjectPublicKeyRSA = null ;
- 91 this.subjectPublicKeyRSA_hN = null ;
- 92 this.subjectPublicKeyRSA_hE = null ;
- 93 this.hex = null ;
- 94
- 95 // ===== get basic fields from hex =====================================
- 96
- 97 /**
- 98 * get hexadecimal string of serialNumber field of certificate.<br/>
- 99 * @name getSerialNumberHex
-100 * @memberOf X509#
-101 * @function
-102 * @return {String} hexadecimal string of certificate serial number
-103 * @example
-104 * var x = new X509();
-105 * x.readCertPEM(sCertPEM);
-106 * var sn = x.getSerialNumberHex(); // return string like "01ad..."
-107 */
-108 this.getSerialNumberHex = function ( ) {
-109 return ASN1HEX.getDecendantHexVByNthList ( this.hex , 0 , [ 0 , 1 ] ) ;
-110 } ;
-111
-112
-113 /**
-114 * get signature algorithm name in basic field
-115 * @name getSignatureAlgorithmField
-116 * @memberOf X509#
-117 * @function
-118 * @return {String} signature algorithm name (ex. SHA1withRSA, SHA256withECDSA)
-119 * @since x509 1.1.8
-120 * @description
-121 * This method will get a name of signature algorithm field of certificate:
-122 * @example
-123 * var x = new X509();
-124 * x.readCertPEM(sCertPEM);
-125 * algName = x.getSignatureAlgorithmField();
-126 */
-127 this.getSignatureAlgorithmField = function ( ) {
-128 var sigAlgOidHex = ASN1HEX.getDecendantHexVByNthList ( this.hex , 0 , [ 0 , 2 , 0 ] ) ;
-129 var sigAlgOidInt = KJUR.asn1.ASN1Util.oidHexToInt ( sigAlgOidHex ) ;
-130 var sigAlgName = KJUR.asn1.x509.OID.oid2name ( sigAlgOidInt ) ;
-131 return sigAlgName ;
-132 } ;
-133
-134 /**
-135 * get hexadecimal string of issuer field TLV of certificate.<br/>
-136 * @name getIssuerHex
-137 * @memberOf X509#
-138 * @function
-139 * @return {String} hexadecial string of issuer DN ASN.1
-140 * @example
-141 * var x = new X509();
-142 * x.readCertPEM(sCertPEM);
-143 * var issuer = x.getIssuerHex(); // return string like "3013..."
-144 */
-145 this.getIssuerHex = function ( ) {
-146 return ASN1HEX.getDecendantHexTLVByNthList ( this.hex , 0 , [ 0 , 3 ] ) ;
-147 } ;
-148
-149 /**
-150 * get string of issuer field of certificate.<br/>
-151 * @name getIssuerString
-152 * @memberOf X509#
-153 * @function
-154 * @return {String} issuer DN string
-155 * @example
-156 * var x = new X509();
-157 * x.readCertPEM(sCertPEM);
-158 * var issuer = x.getIssuerString(); // return string like "/C=US/O=TEST"
-159 */
-160 this.getIssuerString = function ( ) {
-161 return X509.hex2dn ( ASN1HEX.getDecendantHexTLVByNthList ( this.hex , 0 , [ 0 , 3 ] ) ) ;
-162 } ;
-163
-164 /**
-165 * get hexadecimal string of subject field of certificate.<br/>
-166 * @name getSubjectHex
-167 * @memberOf X509#
-168 * @function
-169 * @return {String} hexadecial string of subject DN ASN.1
-170 * @example
-171 * var x = new X509();
-172 * x.readCertPEM(sCertPEM);
-173 * var subject = x.getSubjectHex(); // return string like "3013..."
-174 */
-175 this.getSubjectHex = function ( ) {
-176 return ASN1HEX.getDecendantHexTLVByNthList ( this.hex , 0 , [ 0 , 5 ] ) ;
-177 } ;
-178
-179 /**
-180 * get string of subject field of certificate.<br/>
-181 * @name getSubjectString
-182 * @memberOf X509#
-183 * @function
-184 * @return {String} subject DN string
-185 * @example
-186 * var x = new X509();
-187 * x.readCertPEM(sCertPEM);
-188 * var subject = x.getSubjectString(); // return string like "/C=US/O=TEST"
-189 */
-190 this.getSubjectString = function ( ) {
-191 return X509.hex2dn ( ASN1HEX.getDecendantHexTLVByNthList ( this.hex , 0 , [ 0 , 5 ] ) ) ;
-192 } ;
-193
-194 /**
-195 * get notBefore field string of certificate.<br/>
-196 * @name getNotBefore
-197 * @memberOf X509#
-198 * @function
-199 * @return {String} not before time value (ex. "151231235959Z")
-200 * @example
-201 * var x = new X509();
-202 * x.readCertPEM(sCertPEM);
-203 * var notBefore = x.getNotBefore(); // return string like "151231235959Z"
-204 */
-205 this.getNotBefore = function ( ) {
-206 var s = ASN1HEX.getDecendantHexVByNthList ( this.hex , 0 , [ 0 , 4 , 0 ] ) ;
-207 s = s.replace ( /(..)/g , "%$1" ) ;
-208 s = decodeURIComponent ( s ) ;
-209 return s ;
-210 } ;
-211
-212 /**
-213 * get notAfter field string of certificate.<br/>
-214 * @name getNotAfter
-215 * @memberOf X509#
-216 * @function
-217 * @return {String} not after time value (ex. "151231235959Z")
-218 * @example
-219 * var x = new X509();
-220 * x.readCertPEM(sCertPEM);
-221 * var notAfter = x.getNotAfter(); // return string like "151231235959Z"
-222 */
-223 this.getNotAfter = function ( ) {
-224 var s = ASN1HEX.getDecendantHexVByNthList ( this.hex , 0 , [ 0 , 4 , 1 ] ) ;
-225 s = s.replace ( /(..)/g , "%$1" ) ;
-226 s = decodeURIComponent ( s ) ;
-227 return s ;
-228 } ;
-229
-230 // ===== read certificate public key ==========================
-231
-232 // ===== read certificate =====================================
-233 /**
-234 * read PEM formatted X.509 certificate from string.<br/>
-235 * @name readCertPEM
-236 * @memberOf X509#
-237 * @function
-238 * @param {String} sCertPEM string for PEM formatted X.509 certificate
-239 * @example
-240 * x = new X509();
-241 * x.readCertPEM(sCertPEM); // read certificate
-242 */
-243 this.readCertPEM = function ( sCertPEM ) {
-244 var hCert = X509.pemToHex ( sCertPEM ) ;
-245 var a = X509.getPublicKeyHexArrayFromCertHex ( hCert ) ;
-246 var rsa = new RSAKey ( ) ;
-247 rsa.setPublic ( a [ 0 ] , a [ 1 ] ) ;
-248 this.subjectPublicKeyRSA = rsa ;
-249 this.subjectPublicKeyRSA_hN = a [ 0 ] ;
-250 this.subjectPublicKeyRSA_hE = a [ 1 ] ;
-251 this.hex = hCert ;
-252 } ;
-253
-254 this.readCertPEMWithoutRSAInit = function ( sCertPEM ) {
-255 var hCert = X509.pemToHex ( sCertPEM ) ;
-256 var a = X509.getPublicKeyHexArrayFromCertHex ( hCert ) ;
-257 this.subjectPublicKeyRSA.setPublic ( a [ 0 ] , a [ 1 ] ) ;
-258 this.subjectPublicKeyRSA_hN = a [ 0 ] ;
-259 this.subjectPublicKeyRSA_hE = a [ 1 ] ;
-260 this.hex = hCert ;
-261 } ;
-262
-263 /**
-264 * get certificate information as string.<br/>
-265 * @name getInfo
-266 * @memberOf X509#
-267 * @function
-268 * @return {String} certificate information string
-269 * @since jsrsasign 5.0.10 x509 1.1.8
-270 * @example
-271 * x = new X509();
-272 * x.readCertPEM(certPEM);
-273 * console.log(x.getInfo());
-274 * // this shows as following
-275 * Basic Fields
-276 * serial number: 02ac5c266a0b409b8f0b79f2ae462577
-277 * signature algorithm: SHA1withRSA
-278 * issuer: /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance EV Root CA
-279 * notBefore: 061110000000Z
-280 * notAfter: 311110000000Z
-281 * subject: /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance EV Root CA
-282 * subject public key info:
-283 * key algorithm: RSA
-284 * n=c6cce573e6fbd4bb...
-285 * e=10001
-286 * X509v3 Extensions:
-287 * keyUsage CRITICAL:
-288 * digitalSignature,keyCertSign,cRLSign
-289 * basicConstraints CRITICAL:
-290 * cA=true
-291 * subjectKeyIdentifier :
-292 * b13ec36903f8bf4701d498261a0802ef63642bc3
-293 * authorityKeyIdentifier :
-294 * kid=b13ec36903f8bf4701d498261a0802ef63642bc3
-295 * signature algorithm: SHA1withRSA
-296 * signature: 1c1a0697dcd79c9f...
-297 */
-298 this.getInfo = function ( ) {
-299 var s = "Basic Fields\n" ;
-300 s + = " serial number: " + this.getSerialNumberHex ( ) + "\n" ;
-301 s + = " signature algorithm: " + this.getSignatureAlgorithmField ( ) + "\n" ;
-302 s + = " issuer: " + this.getIssuerString ( ) + "\n" ;
-303 s + = " notBefore: " + this.getNotBefore ( ) + "\n" ;
-304 s + = " notAfter: " + this.getNotAfter ( ) + "\n" ;
-305 s + = " subject: " + this.getSubjectString ( ) + "\n" ;
-306 s + = " subject public key info: " + "\n" ;
-307
-308 // subject public key info
-309 var pSPKI = X509.getSubjectPublicKeyInfoPosFromCertHex ( this.hex ) ;
-310 var hSPKI = ASN1HEX.getHexOfTLV_AtObj ( this.hex , pSPKI ) ;
-311 var keyObj = KEYUTIL.getKey ( hSPKI , null , "pkcs8pub" ) ;
-312 //s += " " + JSON.stringify(keyObj) + "\n";
-313 if ( keyObj instanceof RSAKey ) {
-314 s + = " key algorithm: RSA\n" ;
-315 s + = " n=" + keyObj.n.toString ( 16 ) . substr ( 0 , 16 ) + "...\n" ;
-316 s + = " e=" + keyObj.e.toString ( 16 ) + "\n" ;
-317 }
-318
-319 s + = "X509v3 Extensions:\n" ;
-320
-321 var aExt = X509.getV3ExtInfoListOfCertHex ( this.hex ) ;
-322 for ( var i = 0 ; i < aExt.length ; i ++ ) {
-323 var info = aExt [ i ] ;
-324
-325 // show extension name and critical flag
-326 var extName = KJUR.asn1.x509.OID.oid2name ( info [ "oid" ] ) ;
-327 if ( extName === '' ) extName = info [ "oid" ] ;
-328
-329 var critical = '' ;
-330 if ( info [ "critical" ] === true ) critical = "CRITICAL" ;
-331
-332 s + = " " + extName + " " + critical + ":\n" ;
-333
-334 // show extension value if supported
-335 if ( extName === "basicConstraints" ) {
-336 var bc = X509.getExtBasicConstraints ( this.hex ) ;
-337 if ( bc.cA === undefined ) {
-338 s + = " {}\n" ;
-339 } else {
-340 s + = " cA=true" ;
-341 if ( bc.pathLen !== undefined )
-342 s + = ", pathLen=" + bc.pathLen ;
-343 s + = "\n" ;
-344 }
-345 } else if ( extName === "keyUsage" ) {
-346 s + = " " + X509.getExtKeyUsageString ( this.hex ) + "\n" ;
-347 } else if ( extName === "subjectKeyIdentifier" ) {
-348 s + = " " + X509.getExtSubjectKeyIdentifier ( this.hex ) + "\n" ;
-349 } else if ( extName === "authorityKeyIdentifier" ) {
-350 var akid = X509.getExtAuthorityKeyIdentifier ( this.hex ) ;
-351 if ( akid.kid !== undefined )
-352 s + = " kid=" + akid.kid + "\n" ;
-353 } else if ( extName === "extKeyUsage" ) {
-354 var eku = X509.getExtExtKeyUsageName ( this.hex ) ;
-355 s + = " " + eku.join ( ", " ) + "\n" ;
-356 } else if ( extName === "subjectAltName" ) {
-357 var san = X509.getExtSubjectAltName ( this.hex ) ;
-358 s + = " " + san.join ( ", " ) + "\n" ;
-359 } else if ( extName === "cRLDistributionPoints" ) {
-360 var cdp = X509.getExtCRLDistributionPointsURI ( this.hex ) ;
-361 s + = " " + cdp + "\n" ;
-362 } else if ( extName === "authorityInfoAccess" ) {
-363 var aia = X509.getExtAIAInfo ( this.hex ) ;
-364 if ( aia.ocsp !== undefined )
-365 s + = " ocsp: " + aia.ocsp.join ( "," ) + "\n" ;
-366 if ( aia.caissuer !== undefined )
-367 s + = " caissuer: " + aia.caissuer.join ( "," ) + "\n" ;
-368 }
-369 }
-370
-371 s + = "signature algorithm: " + X509.getSignatureAlgorithmName ( this.hex ) + "\n" ;
-372 s + = "signature: " + X509.getSignatureValueHex ( this.hex ) . substr ( 0 , 16 ) + "...\n" ;
-373 return s ;
-374 } ;
-375 } ;
-376
-377 /**
-378 * get Base64 string from PEM certificate string
-379 * @name pemToBase64
-380 * @memberOf X509
-381 * @function
-382 * @param {String} sCertPEM PEM formatted RSA/ECDSA/DSA X.509 certificate
-383 * @return {String} Base64 string of PEM certificate
-384 * @example
-385 * b64 = X509.pemToBase64(certPEM);
-386 */
-387 X509.pemToBase64 = function ( sCertPEM ) {
-388 var s = sCertPEM ;
-389 s = s.replace ( "-----BEGIN CERTIFICATE-----" , "" ) ;
-390 s = s.replace ( "-----END CERTIFICATE-----" , "" ) ;
-391 s = s.replace ( /[ \n]+/g , "" ) ;
-392 return s ;
-393 } ;
-394
-395 /**
-396 * get a hexa decimal string from PEM certificate string
-397 * @name pemToHex
-398 * @memberOf X509
-399 * @function
-400 * @param {String} sCertPEM PEM formatted RSA/ECDSA/DSA X.509 certificate
-401 * @return {String} hexadecimal string of PEM certificate
-402 * @example
-403 * hex = X509.pemToHex(certPEM);
-404 */
-405 X509.pemToHex = function ( sCertPEM ) {
-406 var b64Cert = X509.pemToBase64 ( sCertPEM ) ;
-407 var hCert = b64tohex ( b64Cert ) ;
-408 return hCert ;
-409 } ;
-410
-411 // NOTE: Without BITSTRING encapsulation.
-412 X509.getSubjectPublicKeyPosFromCertHex = function ( hCert ) {
-413 var pInfo = X509.getSubjectPublicKeyInfoPosFromCertHex ( hCert ) ;
-414 if ( pInfo == - 1 ) return - 1 ;
-415 var a = ASN1HEX.getPosArrayOfChildren_AtObj ( hCert , pInfo ) ;
-416 if ( a.length != 2 ) return - 1 ;
-417 var pBitString = a [ 1 ] ;
-418 if ( hCert.substring ( pBitString , pBitString + 2 ) != '03' ) return - 1 ;
-419 var pBitStringV = ASN1HEX.getStartPosOfV_AtObj ( hCert , pBitString ) ;
-420
-421 if ( hCert.substring ( pBitStringV , pBitStringV + 2 ) != '00' ) return - 1 ;
-422 return pBitStringV + 2 ;
-423 } ;
-424
-425 // NOTE: privateKeyUsagePeriod field of X509v2 not supported.
-426 // NOTE: v1 and v3 supported
-427 X509.getSubjectPublicKeyInfoPosFromCertHex = function ( hCert ) {
-428 var pTbsCert = ASN1HEX.getStartPosOfV_AtObj ( hCert , 0 ) ;
-429 var a = ASN1HEX.getPosArrayOfChildren_AtObj ( hCert , pTbsCert ) ;
-430 if ( a.length < 1 ) return - 1 ;
-431 if ( hCert.substring ( a [ 0 ] , a [ 0 ] + 10 ) == "a003020102" ) { // v3
-432 if ( a.length < 6 ) return - 1 ;
-433 return a [ 6 ] ;
-434 } else {
-435 if ( a.length < 5 ) return - 1 ;
-436 return a [ 5 ] ;
-437 }
-438 } ;
-439
-440 X509.getPublicKeyHexArrayFromCertHex = function ( hCert ) {
-441 var p = X509.getSubjectPublicKeyPosFromCertHex ( hCert ) ;
-442 var a = ASN1HEX.getPosArrayOfChildren_AtObj ( hCert , p ) ;
-443 if ( a.length != 2 ) return [ ] ;
-444 var hN = ASN1HEX.getHexOfV_AtObj ( hCert , a [ 0 ] ) ;
-445 var hE = ASN1HEX.getHexOfV_AtObj ( hCert , a [ 1 ] ) ;
-446 if ( hN != null && hE != null ) {
-447 return [ hN , hE ] ;
-448 } else {
-449 return [ ] ;
-450 }
-451 } ;
-452
-453 X509.getHexTbsCertificateFromCert = function ( hCert ) {
-454 var pTbsCert = ASN1HEX.getStartPosOfV_AtObj ( hCert , 0 ) ;
-455 return pTbsCert ;
-456 } ;
-457
-458 X509.getPublicKeyHexArrayFromCertPEM = function ( sCertPEM ) {
-459 var hCert = X509.pemToHex ( sCertPEM ) ;
-460 var a = X509.getPublicKeyHexArrayFromCertHex ( hCert ) ;
-461 return a ;
-462 } ;
-463
-464 X509.hex2dn = function ( hDN ) {
-465 var s = "" ;
-466 var a = ASN1HEX.getPosArrayOfChildren_AtObj ( hDN , 0 ) ;
-467 for ( var i = 0 ; i < a.length ; i ++ ) {
-468 var hRDN = ASN1HEX.getHexOfTLV_AtObj ( hDN , a [ i ] ) ;
-469 s = s + "/" + X509.hex2rdn ( hRDN ) ;
-470 }
-471 return s ;
-472 } ;
-473
-474 X509.hex2rdn = function ( hRDN ) {
-475 var hType = ASN1HEX.getDecendantHexTLVByNthList ( hRDN , 0 , [ 0 , 0 ] ) ;
-476 var hValue = ASN1HEX.getDecendantHexVByNthList ( hRDN , 0 , [ 0 , 1 ] ) ;
-477 var type = "" ;
-478 try { type = X509.DN_ATTRHEX [ hType ] ; } catch ( ex ) { type = hType ; }
-479 hValue = hValue.replace ( /(..)/g , "%$1" ) ;
-480 var value = decodeURIComponent ( hValue ) ;
-481 return type + "=" + value ;
-482 } ;
-483
-484 X509.DN_ATTRHEX = {
-485 "0603550406" : "C" ,
-486 "060355040a" : "O" ,
-487 "060355040b" : "OU" ,
-488 "0603550403" : "CN" ,
-489 "0603550405" : "SN" ,
-490 "0603550408" : "ST" ,
-491 "0603550407" : "L" ,
-492 "0603550409" : "streetAddress" ,
-493 "060355040f" : "businessCategory" ,
-494 "0603550411" : "postalCode" ,
-495 "060b2b0601040182373c020102" : "jurisdictionOfIncorporationSP" ,
-496 "060b2b0601040182373c020103" : "jurisdictionOfIncorporationC" ,
-497 } ;
-498
-499 /**
-500 * get RSAKey/ECDSA public key object from PEM certificate string
-501 * @name getPublicKeyFromCertPEM
-502 * @memberOf X509
-503 * @function
-504 * @param {String} sCertPEM PEM formatted RSA/ECDSA/DSA X.509 certificate
-505 * @return returns RSAKey/KJUR.crypto.{ECDSA,DSA} object of public key
-506 * @since x509 1.1.1
-507 * @description
-508 * NOTE: DSA is also supported since x509 1.1.2.
-509 */
-510 X509.getPublicKeyFromCertPEM = function ( sCertPEM ) {
-511 var info = X509.getPublicKeyInfoPropOfCertPEM ( sCertPEM ) ;
-512
-513 if ( info.algoid == "2a864886f70d010101" ) { // RSA
-514 var aRSA = KEYUTIL.parsePublicRawRSAKeyHex ( info.keyhex ) ;
-515 var key = new RSAKey ( ) ;
-516 key.setPublic ( aRSA.n , aRSA.e ) ;
-517 return key ;
-518 } else if ( info.algoid == "2a8648ce3d0201" ) { // ECC
-519 var curveName = KJUR.crypto.OID.oidhex2name [ info.algparam ] ;
-520 var key = new KJUR.crypto.ECDSA ( { 'curve' : curveName , 'info' : info.keyhex } ) ;
-521 key.setPublicKeyHex ( info.keyhex ) ;
-522 return key ;
-523 } else if ( info.algoid == "2a8648ce380401" ) { // DSA 1.2.840.10040.4.1
-524 var p = ASN1HEX.getVbyList ( info.algparam , 0 , [ 0 ] , "02" ) ;
-525 var q = ASN1HEX.getVbyList ( info.algparam , 0 , [ 1 ] , "02" ) ;
-526 var g = ASN1HEX.getVbyList ( info.algparam , 0 , [ 2 ] , "02" ) ;
-527 var y = ASN1HEX.getHexOfV_AtObj ( info.keyhex , 0 ) ;
-528 y = y.substr ( 2 ) ;
-529 var key = new KJUR.crypto.DSA ( ) ;
-530 key.setPublic ( new BigInteger ( p , 16 ) ,
-531 new BigInteger ( q , 16 ) ,
-532 new BigInteger ( g , 16 ) ,
-533 new BigInteger ( y , 16 ) ) ;
-534 return key ;
-535 } else {
-536 throw "unsupported key" ;
-537 }
-538 } ;
-539
-540 /**
-541 * get public key information from PEM certificate
-542 * @name getPublicKeyInfoPropOfCertPEM
-543 * @memberOf X509
-544 * @function
-545 * @param {String} sCertPEM string of PEM formatted certificate
-546 * @return {Hash} hash of information for public key
-547 * @since x509 1.1.1
-548 * @description
-549 * Resulted associative array has following properties:<br/>
-550 * <ul>
-551 * <li>algoid - hexadecimal string of OID of asymmetric key algorithm</li>
-552 * <li>algparam - hexadecimal string of OID of ECC curve name or null</li>
-553 * <li>keyhex - hexadecimal string of key in the certificate</li>
-554 * </ul>
-555 * NOTE: X509v1 certificate is also supported since x509.js 1.1.9.
-556 */
-557 X509.getPublicKeyInfoPropOfCertPEM = function ( sCertPEM ) {
-558 var result = { } ;
-559 result.algparam = null ;
-560 var hCert = X509.pemToHex ( sCertPEM ) ;
-561
-562 // 1. Certificate ASN.1
-563 var a1 = ASN1HEX.getPosArrayOfChildren_AtObj ( hCert , 0 ) ;
-564 if ( a1.length != 3 )
-565 throw "malformed X.509 certificate PEM (code:001)" ; // not 3 item of seq Cert
-566
-567 // 2. tbsCertificate
-568 if ( hCert.substr ( a1 [ 0 ] , 2 ) != "30" )
-569 throw "malformed X.509 certificate PEM (code:002)" ; // tbsCert not seq
-570
-571 var a2 = ASN1HEX.getPosArrayOfChildren_AtObj ( hCert , a1 [ 0 ] ) ;
-572
-573 // 3. subjectPublicKeyInfo
-574 var idx_spi = 6 ; // subjectPublicKeyInfo index in tbsCert for v3 cert
-575 if ( hCert.substr ( a2 [ 0 ] , 2 ) !== "a0" ) idx_spi = 5 ;
-576
-577 if ( a2.length < idx_spi + 1 )
-578 throw "malformed X.509 certificate PEM (code:003)" ; // no subjPubKeyInfo
-579
-580 var a3 = ASN1HEX.getPosArrayOfChildren_AtObj ( hCert , a2 [ idx_spi ] ) ;
-581
-582 if ( a3.length != 2 )
-583 throw "malformed X.509 certificate PEM (code:004)" ; // not AlgId and PubKey
-584
-585 // 4. AlgId
-586 var a4 = ASN1HEX.getPosArrayOfChildren_AtObj ( hCert , a3 [ 0 ] ) ;
-587
-588 if ( a4.length != 2 )
-589 throw "malformed X.509 certificate PEM (code:005)" ; // not 2 item in AlgId
-590
-591 result.algoid = ASN1HEX.getHexOfV_AtObj ( hCert , a4 [ 0 ] ) ;
-592
-593 if ( hCert.substr ( a4 [ 1 ] , 2 ) == "06" ) { // EC
-594 result.algparam = ASN1HEX.getHexOfV_AtObj ( hCert , a4 [ 1 ] ) ;
-595 } else if ( hCert.substr ( a4 [ 1 ] , 2 ) == "30" ) { // DSA
-596 result.algparam = ASN1HEX.getHexOfTLV_AtObj ( hCert , a4 [ 1 ] ) ;
-597 }
-598
-599 // 5. Public Key Hex
-600 if ( hCert.substr ( a3 [ 1 ] , 2 ) != "03" )
-601 throw "malformed X.509 certificate PEM (code:006)" ; // not bitstring
-602
-603 var unusedBitAndKeyHex = ASN1HEX.getHexOfV_AtObj ( hCert , a3 [ 1 ] ) ;
-604 result.keyhex = unusedBitAndKeyHex.substr ( 2 ) ;
-605
-606 return result ;
-607 } ;
-608
-609 /**
-610 * get position of subjectPublicKeyInfo field from HEX certificate
-611 * @name getPublicKeyInfoPosOfCertHEX
-612 * @memberOf X509
-613 * @function
-614 * @param {String} hCert hexadecimal string of certificate
-615 * @return {Integer} position in hexadecimal string
-616 * @since x509 1.1.4
-617 * @description
-618 * get position for SubjectPublicKeyInfo field in the hexadecimal string of
-619 * certificate.
-620 */
-621 X509.getPublicKeyInfoPosOfCertHEX = function ( hCert ) {
-622 // 1. Certificate ASN.1
-623 var a1 = ASN1HEX.getPosArrayOfChildren_AtObj ( hCert , 0 ) ;
-624 if ( a1.length != 3 )
-625 throw "malformed X.509 certificate PEM (code:001)" ; // not 3 item of seq Cert
-626
-627 // 2. tbsCertificate
-628 if ( hCert.substr ( a1 [ 0 ] , 2 ) != "30" )
-629 throw "malformed X.509 certificate PEM (code:002)" ; // tbsCert not seq
-630
-631 var a2 = ASN1HEX.getPosArrayOfChildren_AtObj ( hCert , a1 [ 0 ] ) ;
-632
-633 // 3. subjectPublicKeyInfo
-634 if ( a2.length < 7 )
-635 throw "malformed X.509 certificate PEM (code:003)" ; // no subjPubKeyInfo
-636
-637 return a2 [ 6 ] ;
-638 } ;
-639
-640 /**
-641 * get array of X.509 V3 extension value information in hex string of certificate
-642 * @name getV3ExtInfoListOfCertHex
-643 * @memberOf X509
-644 * @function
-645 * @param {String} hCert hexadecimal string of X.509 certificate binary
-646 * @return {Array} array of result object by {@link X509.getV3ExtInfoListOfCertHex}
-647 * @since x509 1.1.5
-648 * @description
-649 * This method will get all extension information of a X.509 certificate.
-650 * Items of resulting array has following properties:
-651 * <ul>
-652 * <li>posTLV - index of ASN.1 TLV for the extension. same as 'pos' argument.</li>
-653 * <li>oid - dot noted string of extension oid (ex. 2.5.29.14)</li>
-654 * <li>critical - critical flag value for this extension</li>
-655 * <li>posV - index of ASN.1 TLV for the extension value.
-656 * This is a position of a content of ENCAPSULATED OCTET STRING.</li>
-657 * </ul>
-658 * @example
-659 * hCert = X509.pemToHex(certGithubPEM);
-660 * a = X509.getV3ExtInfoListOfCertHex(hCert);
-661 * // Then a will be an array of like following:
-662 * [{posTLV: 1952, oid: "2.5.29.35", critical: false, posV: 1968},
-663 * {posTLV: 1974, oid: "2.5.29.19", critical: true, posV: 1986}, ...]
-664 */
-665 X509.getV3ExtInfoListOfCertHex = function ( hCert ) {
-666 // 1. Certificate ASN.1
-667 var a1 = ASN1HEX.getPosArrayOfChildren_AtObj ( hCert , 0 ) ;
-668 if ( a1.length != 3 )
-669 throw "malformed X.509 certificate PEM (code:001)" ; // not 3 item of seq Cert
-670
-671 // 2. tbsCertificate
-672 if ( hCert.substr ( a1 [ 0 ] , 2 ) != "30" )
-673 throw "malformed X.509 certificate PEM (code:002)" ; // tbsCert not seq
-674
-675 var a2 = ASN1HEX.getPosArrayOfChildren_AtObj ( hCert , a1 [ 0 ] ) ;
-676
-677 // 3. v3Extension EXPLICIT Tag [3]
-678 // ver, seri, alg, iss, validity, subj, spki, (iui,) (sui,) ext
-679 if ( a2.length < 8 )
-680 throw "malformed X.509 certificate PEM (code:003)" ; // tbsCert num field too short
-681
-682 if ( hCert.substr ( a2 [ 7 ] , 2 ) != "a3" )
-683 throw "malformed X.509 certificate PEM (code:004)" ; // not [3] tag
-684
-685 var a3 = ASN1HEX.getPosArrayOfChildren_AtObj ( hCert , a2 [ 7 ] ) ;
-686 if ( a3.length != 1 )
-687 throw "malformed X.509 certificate PEM (code:005)" ; // [3]tag numChild!=1
-688
-689 // 4. v3Extension SEQUENCE
-690 if ( hCert.substr ( a3 [ 0 ] , 2 ) != "30" )
-691 throw "malformed X.509 certificate PEM (code:006)" ; // not SEQ
-692
-693 var a4 = ASN1HEX.getPosArrayOfChildren_AtObj ( hCert , a3 [ 0 ] ) ;
-694
-695 // 5. v3Extension item position
-696 var numExt = a4.length ;
-697 var aInfo = new Array ( numExt ) ;
-698 for ( var i = 0 ; i < numExt ; i ++ ) {
-699 aInfo [ i ] = X509.getV3ExtItemInfo_AtObj ( hCert , a4 [ i ] ) ;
-700 }
-701 return aInfo ;
-702 } ;
-703
-704 /**
-705 * get X.509 V3 extension value information at the specified position
-706 * @name getV3ExtItemInfo_AtObj
-707 * @memberOf X509
-708 * @function
-709 * @param {String} hCert hexadecimal string of X.509 certificate binary
-710 * @param {Integer} pos index of hexadecimal string for the extension
-711 * @return {Object} properties for the extension
-712 * @since x509 1.1.5
-713 * @description
-714 * This method will get some information of a X.509 V extension
-715 * which is referred by an index of hexadecimal string of X.509
-716 * certificate.
-717 * Resulting object has following properties:
-718 * <ul>
-719 * <li>posTLV - index of ASN.1 TLV for the extension. same as 'pos' argument.</li>
-720 * <li>oid - dot noted string of extension oid (ex. 2.5.29.14)</li>
-721 * <li>critical - critical flag value for this extension</li>
-722 * <li>posV - index of ASN.1 TLV for the extension value.
-723 * This is a position of a content of ENCAPSULATED OCTET STRING.</li>
-724 * </ul>
-725 * This method is used by {@link X509.getV3ExtInfoListOfCertHex} internally.
-726 */
-727 X509.getV3ExtItemInfo_AtObj = function ( hCert , pos ) {
-728 var info = { } ;
-729
-730 // posTLV - extension TLV
-731 info.posTLV = pos ;
-732
-733 var a = ASN1HEX.getPosArrayOfChildren_AtObj ( hCert , pos ) ;
-734 if ( a.length != 2 && a.length != 3 )
-735 throw "malformed X.509v3 Ext (code:001)" ; // oid,(critical,)val
-736
-737 // oid - extension OID
-738 if ( hCert.substr ( a [ 0 ] , 2 ) != "06" )
-739 throw "malformed X.509v3 Ext (code:002)" ; // not OID "06"
-740 var valueHex = ASN1HEX.getHexOfV_AtObj ( hCert , a [ 0 ] ) ;
-741 info.oid = ASN1HEX.hextooidstr ( valueHex ) ;
-742
-743 // critical - extension critical flag
-744 info.critical = false ; // critical false by default
-745 if ( a.length == 3 ) info.critical = true ;
-746
-747 // posV - content TLV position of encapsulated
-748 // octet string of V3 extension value.
-749 var posExtV = a [ a.length - 1 ] ;
-750 if ( hCert.substr ( posExtV , 2 ) != "04" )
-751 throw "malformed X.509v3 Ext (code:003)" ; // not EncapOctet "04"
-752 info.posV = ASN1HEX.getStartPosOfV_AtObj ( hCert , posExtV ) ;
-753
-754 return info ;
-755 } ;
-756
-757 /**
-758 * get X.509 V3 extension value ASN.1 TLV for specified oid or name
-759 * @name getHexOfTLV_V3ExtValue
-760 * @memberOf X509
-761 * @function
-762 * @param {String} hCert hexadecimal string of X.509 certificate binary
-763 * @param {String} oidOrName oid or name for extension (ex. 'keyUsage' or '2.5.29.15')
-764 * @return {String} hexadecimal string of extension ASN.1 TLV
-765 * @since x509 1.1.6
-766 * @description
-767 * This method will get X.509v3 extension value of ASN.1 TLV
-768 * which is specifyed by extension name or oid.
-769 * If there is no such extension in the certificate, it returns null.
-770 * @example
-771 * hExtValue = X509.getHexOfTLV_V3ExtValue(hCert, "keyUsage");
-772 * // hExtValue will be such like '030205a0'.
-773 */
-774 X509.getHexOfTLV_V3ExtValue = function ( hCert , oidOrName ) {
-775 var pos = X509.getPosOfTLV_V3ExtValue ( hCert , oidOrName ) ;
-776 if ( pos == - 1 ) return null ;
-777 return ASN1HEX.getHexOfTLV_AtObj ( hCert , pos ) ;
-778 } ;
-779
-780 /**
-781 * get X.509 V3 extension value ASN.1 V for specified oid or name
-782 * @name getHexOfV_V3ExtValue
-783 * @memberOf X509
-784 * @function
-785 * @param {String} hCert hexadecimal string of X.509 certificate binary
-786 * @param {String} oidOrName oid or name for extension (ex. 'keyUsage' or '2.5.29.15')
-787 * @return {String} hexadecimal string of extension ASN.1 TLV
-788 * @since x509 1.1.6
-789 * @description
-790 * This method will get X.509v3 extension value of ASN.1 value
-791 * which is specifyed by extension name or oid.
-792 * If there is no such extension in the certificate, it returns null.
-793 * Available extension names and oids are defined
-794 * in the {@link KJUR.asn1.x509.OID} class.
-795 * @example
-796 * hExtValue = X509.getHexOfV_V3ExtValue(hCert, "keyUsage");
-797 * // hExtValue will be such like '05a0'.
-798 */
-799 X509.getHexOfV_V3ExtValue = function ( hCert , oidOrName ) {
-800 var pos = X509.getPosOfTLV_V3ExtValue ( hCert , oidOrName ) ;
-801 if ( pos == - 1 ) return null ;
-802 return ASN1HEX.getHexOfV_AtObj ( hCert , pos ) ;
-803 } ;
-804
-805 /**
-806 * get index in the certificate hexa string for specified oid or name specified extension
-807 * @name getPosOfTLV_V3ExtValue
-808 * @memberOf X509
-809 * @function
-810 * @param {String} hCert hexadecimal string of X.509 certificate binary
-811 * @param {String} oidOrName oid or name for extension (ex. 'keyUsage' or '2.5.29.15')
-812 * @return {Integer} index in the hexadecimal string of certficate for specified extension
-813 * @since x509 1.1.6
-814 * @description
-815 * This method will get X.509v3 extension value of ASN.1 V(value)
-816 * which is specifyed by extension name or oid.
-817 * If there is no such extension in the certificate,
-818 * it returns -1.
-819 * Available extension names and oids are defined
-820 * in the {@link KJUR.asn1.x509.OID} class.
-821 * @example
-822 * idx = X509.getPosOfV_V3ExtValue(hCert, "keyUsage");
-823 * // The 'idx' will be index in the string for keyUsage value ASN.1 TLV.
-824 */
-825 X509.getPosOfTLV_V3ExtValue = function ( hCert , oidOrName ) {
-826 var oid = oidOrName ;
-827 if ( ! oidOrName.match ( /^[0-9.]+$/ ) ) oid = KJUR.asn1.x509.OID.name2oid ( oidOrName ) ;
-828 if ( oid == '' ) return - 1 ;
-829
-830 var infoList = X509.getV3ExtInfoListOfCertHex ( hCert ) ;
-831 for ( var i = 0 ; i < infoList.length ; i ++ ) {
-832 var info = infoList [ i ] ;
-833 if ( info.oid == oid ) return info.posV ;
-834 }
-835 return - 1 ;
-836 } ;
-837
-838 /* ======================================================================
-839 * Specific V3 Extensions
-840 * ====================================================================== */
-841
-842 /**
-843 * get BasicConstraints extension value as object in the certificate
-844 * @name getExtBasicConstraints
-845 * @memberOf X509
-846 * @function
-847 * @param {String} hCert hexadecimal string of X.509 certificate binary
-848 * @return {Object} associative array which may have "cA" and "pathLen" parameters
-849 * @since x509 1.1.7
-850 * @description
-851 * This method will get basic constraints extension value as object with following paramters.
-852 * <ul>
-853 * <li>cA - CA flag whether CA or not</li>
-854 * <li>pathLen - maximum intermediate certificate length</li>
-855 * </ul>
-856 * There are use cases for return values:
-857 * <ul>
-858 * <li>{cA:true, pathLen:3} - cA flag is true and pathLen is 3</li>
-859 * <li>{cA:true} - cA flag is true and no pathLen</li>
-860 * <li>{} - basic constraints has no value in case of end entity certificate</li>
-861 * <li>null - there is no basic constraints extension</li>
-862 * </ul>
-863 * @example
-864 * obj = X509.getExtBasicConstraints(hCert);
-865 */
-866 X509.getExtBasicConstraints = function ( hCert ) {
-867 var hBC = X509.getHexOfV_V3ExtValue ( hCert , "basicConstraints" ) ;
-868 if ( hBC === null ) return null ;
-869 if ( hBC === '' ) return { } ;
-870 if ( hBC === '0101ff' ) return { "cA" : true } ;
-871 if ( hBC.substr ( 0 , 8 ) === '0101ff02' ) {
-872 var pathLexHex = ASN1HEX.getHexOfV_AtObj ( hBC , 6 ) ;
-873 var pathLen = parseInt ( pathLexHex , 16 ) ;
-874 return { "cA" : true , "pathLen" : pathLen } ;
-875 }
-876 throw "unknown error" ;
-877 } ;
-878
-879 X509.KEYUSAGE_NAME = [
-880 "digitalSignature" ,
-881 "nonRepudiation" ,
-882 "keyEncipherment" ,
-883 "dataEncipherment" ,
-884 "keyAgreement" ,
-885 "keyCertSign" ,
-886 "cRLSign" ,
-887 "encipherOnly" ,
-888 "decipherOnly"
-889 ] ;
-890
-891 /**
-892 * get KeyUsage extension value as binary string in the certificate
-893 * @name getExtKeyUsageBin
-894 * @memberOf X509
-895 * @function
-896 * @param {String} hCert hexadecimal string of X.509 certificate binary
-897 * @return {String} binary string of key usage bits (ex. '101')
-898 * @since x509 1.1.6
-899 * @description
-900 * This method will get key usage extension value
-901 * as binary string such like '101'.
-902 * Key usage bits definition is in the RFC 5280.
-903 * If there is no key usage extension in the certificate,
-904 * it returns empty string (i.e. '').
-905 * @example
-906 * bKeyUsage = X509.getExtKeyUsageBin(hCert);
-907 * // bKeyUsage will be such like '101'.
-908 * // 1 - digitalSignature
-909 * // 0 - nonRepudiation
-910 * // 1 - keyEncipherment
-911 */
-912 X509.getExtKeyUsageBin = function ( hCert ) {
-913 var hKeyUsage = X509.getHexOfV_V3ExtValue ( hCert , "keyUsage" ) ;
-914 if ( hKeyUsage == '' ) return '' ;
-915 if ( hKeyUsage.length % 2 != 0 || hKeyUsage.length <= 2 )
-916 throw "malformed key usage value" ;
-917 var unusedBits = parseInt ( hKeyUsage.substr ( 0 , 2 ) ) ;
-918 var bKeyUsage = parseInt ( hKeyUsage.substr ( 2 ) , 16 ) . toString ( 2 ) ;
-919 return bKeyUsage.substr ( 0 , bKeyUsage.length - unusedBits ) ;
-920 } ;
-921
-922 /**
-923 * get KeyUsage extension value as names in the certificate
-924 * @name getExtKeyUsageString
-925 * @memberOf X509
-926 * @function
-927 * @param {String} hCert hexadecimal string of X.509 certificate binary
-928 * @return {String} comma separated string of key usage
-929 * @since x509 1.1.6
-930 * @description
-931 * This method will get key usage extension value
-932 * as comma separated string of usage names.
-933 * If there is no key usage extension in the certificate,
-934 * it returns empty string (i.e. '').
-935 * @example
-936 * sKeyUsage = X509.getExtKeyUsageString(hCert);
-937 * // sKeyUsage will be such like 'digitalSignature,keyEncipherment'.
-938 */
-939 X509.getExtKeyUsageString = function ( hCert ) {
-940 var bKeyUsage = X509.getExtKeyUsageBin ( hCert ) ;
-941 var a = new Array ( ) ;
-942 for ( var i = 0 ; i < bKeyUsage.length ; i ++ ) {
-943 if ( bKeyUsage.substr ( i , 1 ) == "1" ) a.push ( X509.KEYUSAGE_NAME [ i ] ) ;
-944 }
-945 return a.join ( "," ) ;
-946 } ;
-947
-948 /**
-949 * get subjectKeyIdentifier value as hexadecimal string in the certificate
-950 * @name getExtSubjectKeyIdentifier
-951 * @memberOf X509
-952 * @function
-953 * @param {String} hCert hexadecimal string of X.509 certificate binary
-954 * @return {String} hexadecimal string of subject key identifier or null
-955 * @since jsrsasign 5.0.10 x509 1.1.8
-956 * @description
-957 * This method will get subject key identifier extension value
-958 * as hexadecimal string.
-959 * If there is no its extension in the certificate,
-960 * it returns null.
-961 * @example
-962 * skid = X509.getExtSubjectKeyIdentifier(hCert);
-963 */
-964 X509.getExtSubjectKeyIdentifier = function ( hCert ) {
-965 var hSKID = X509.getHexOfV_V3ExtValue ( hCert , "subjectKeyIdentifier" ) ;
-966 return hSKID ;
-967 } ;
-968
-969 /**
-970 * get authorityKeyIdentifier value as JSON object in the certificate
-971 * @name getExtAuthorityKeyIdentifier
-972 * @memberOf X509
-973 * @function
-974 * @param {String} hCert hexadecimal string of X.509 certificate binary
-975 * @return {Object} JSON object of authority key identifier or null
-976 * @since jsrsasign 5.0.10 x509 1.1.8
-977 * @description
-978 * This method will get authority key identifier extension value
-979 * as JSON object.
-980 * If there is no its extension in the certificate,
-981 * it returns null.
-982 * <br>
-983 * NOTE: Currently this method only supports keyIdentifier so that
-984 * authorityCertIssuer and authorityCertSerialNumber will not
-985 * be return in the JSON object.
-986 * @example
-987 * akid = X509.getExtAuthorityKeyIdentifier(hCert);
-988 * // returns following JSON object
-989 * { kid: "1234abcd..." }
-990 */
-991 X509.getExtAuthorityKeyIdentifier = function ( hCert ) {
-992 var result = { } ;
-993 var hAKID = X509.getHexOfTLV_V3ExtValue ( hCert , "authorityKeyIdentifier" ) ;
-994 if ( hAKID === null ) return null ;
-995
-996 var a = ASN1HEX.getPosArrayOfChildren_AtObj ( hAKID , 0 ) ;
-997 for ( var i = 0 ; i < a.length ; i ++ ) {
-998 if ( hAKID.substr ( a [ i ] , 2 ) === "80" )
-999 result.kid = ASN1HEX.getHexOfV_AtObj ( hAKID , a [ i ] ) ;
-1000 }
-1001
-1002 return result ;
-1003 } ;
-1004
-1005 /**
-1006 * get extKeyUsage value as array of name string in the certificate
-1007 * @name getExtExtKeyUsageName
-1008 * @memberOf X509
-1009 * @function
-1010 * @param {String} hCert hexadecimal string of X.509 certificate binary
-1011 * @return {Object} array of extended key usage ID name or oid
-1012 * @since jsrsasign 5.0.10 x509 1.1.8
-1013 * @description
-1014 * This method will get extended key usage extension value
-1015 * as array of name or OID string.
-1016 * If there is no its extension in the certificate,
-1017 * it returns null.
-1018 * <br>
-1019 * NOTE: Supported extended key usage ID names are defined in
-1020 * name2oidList parameter in asn1x509.js file.
-1021 * @example
-1022 * eku = X509.getExtExtKeyUsageName(hCert);
-1023 * // returns following array:
-1024 * ["serverAuth", "clientAuth", "0.1.2.3.4.5"]
-1025 */
-1026 X509.getExtExtKeyUsageName = function ( hCert ) {
-1027 var result = new Array ( ) ;
-1028 var h = X509.getHexOfTLV_V3ExtValue ( hCert , "extKeyUsage" ) ;
-1029 if ( h === null ) return null ;
-1030
-1031 var a = ASN1HEX.getPosArrayOfChildren_AtObj ( h , 0 ) ;
-1032 for ( var i = 0 ; i < a.length ; i ++ ) {
-1033 var hex = ASN1HEX.getHexOfV_AtObj ( h , a [ i ] ) ;
-1034 var oid = KJUR.asn1.ASN1Util.oidHexToInt ( hex ) ;
-1035 var name = KJUR.asn1.x509.OID.oid2name ( oid ) ;
-1036 result.push ( name ) ;
-1037 }
-1038
-1039 return result ;
-1040 } ;
-1041
-1042 /**
-1043 * get subjectAltName value as array of string in the certificate
-1044 * @name getExtSubjectAltName
-1045 * @memberOf X509
-1046 * @function
-1047 * @param {String} hCert hexadecimal string of X.509 certificate binary
-1048 * @return {Object} array of alt names
-1049 * @since jsrsasign 5.0.10 x509 1.1.8
-1050 * @description
-1051 * This method will get subject alt name extension value
-1052 * as array of name.
-1053 * If there is no its extension in the certificate,
-1054 * it returns null.
-1055 * <br>
-1056 * NOTE: Currently this method supports only dNSName so that
-1057 * other name type such like iPAddress or generalName will not be returned.
-1058 * @example
-1059 * san = X509.getExtSubjectAltName(hCert);
-1060 * // returns following array:
-1061 * ["example.com", "example.org"]
-1062 */
-1063 X509.getExtSubjectAltName = function ( hCert ) {
-1064 var result = new Array ( ) ;
-1065 var h = X509.getHexOfTLV_V3ExtValue ( hCert , "subjectAltName" ) ;
-1066
-1067 var a = ASN1HEX.getPosArrayOfChildren_AtObj ( h , 0 ) ;
-1068 for ( var i = 0 ; i < a.length ; i ++ ) {
-1069 if ( h.substr ( a [ i ] , 2 ) === "82" ) {
-1070 var fqdn = hextoutf8 ( ASN1HEX.getHexOfV_AtObj ( h , a [ i ] ) ) ;
-1071 result.push ( fqdn ) ;
-1072 }
-1073 }
-1074
-1075 return result ;
-1076 } ;
-1077
-1078 /**
-1079 * get array of string for fullName URIs in cRLDistributionPoints(CDP) in the certificate
-1080 * @name getExtCRLDistributionPointsURI
-1081 * @memberOf X509
-1082 * @function
-1083 * @param {String} hCert hexadecimal string of X.509 certificate binary
-1084 * @return {Object} array of fullName URIs of CDP of the certificate
-1085 * @since jsrsasign 5.0.10 x509 1.1.8
-1086 * @description
-1087 * This method will get all fullName URIs of cRLDistributionPoints extension
-1088 * in the certificate as array of URI string.
-1089 * If there is no its extension in the certificate,
-1090 * it returns null.
-1091 * <br>
-1092 * NOTE: Currently this method supports only fullName URI so that
-1093 * other parameters will not be returned.
-1094 * @example
-1095 * cdpuri = X509.getExtCRLDistributionPointsURI(hCert);
-1096 * // returns following array:
-1097 * ["http://example.com/aaa.crl", "http://example.org/aaa.crl"]
-1098 */
-1099 X509.getExtCRLDistributionPointsURI = function ( hCert ) {
-1100 var result = new Array ( ) ;
-1101 var h = X509.getHexOfTLV_V3ExtValue ( hCert , "cRLDistributionPoints" ) ;
-1102
-1103 var a = ASN1HEX.getPosArrayOfChildren_AtObj ( h , 0 ) ;
-1104 for ( var i = 0 ; i < a.length ; i ++ ) {
-1105 var hDP = ASN1HEX.getHexOfTLV_AtObj ( h , a [ i ] ) ;
-1106
-1107 var a1 = ASN1HEX.getPosArrayOfChildren_AtObj ( hDP , 0 ) ;
-1108 for ( var j = 0 ; j < a1.length ; j ++ ) {
-1109 if ( hDP.substr ( a1 [ j ] , 2 ) === "a0" ) {
-1110 var hDPN = ASN1HEX.getHexOfV_AtObj ( hDP , a1 [ j ] ) ;
-1111 if ( hDPN.substr ( 0 , 2 ) === "a0" ) {
-1112 var hFullName = ASN1HEX.getHexOfV_AtObj ( hDPN , 0 ) ;
-1113 if ( hFullName.substr ( 0 , 2 ) === "86" ) {
-1114 var hURI = ASN1HEX.getHexOfV_AtObj ( hFullName , 0 ) ;
-1115 var uri = hextoutf8 ( hURI ) ;
-1116 result.push ( uri ) ;
-1117 }
-1118 }
-1119 }
-1120 }
-1121 }
-1122
-1123 return result ;
-1124 } ;
-1125
-1126 /**
-1127 * get AuthorityInfoAccess extension value in the certificate as associative array
-1128 * @name getExtAIAInfo
-1129 * @memberOf X509
-1130 * @function
-1131 * @param {String} hCert hexadecimal string of X.509 certificate binary
-1132 * @return {Object} associative array of AIA extension properties
-1133 * @since x509 1.1.6
-1134 * @description
-1135 * This method will get authority info access value
-1136 * as associate array which has following properties:
-1137 * <ul>
-1138 * <li>ocsp - array of string for OCSP responder URL</li>
-1139 * <li>caissuer - array of string for caIssuer value (i.e. CA certificates URL)</li>
-1140 * </ul>
-1141 * If there is no key usage extension in the certificate,
-1142 * it returns null;
-1143 * @example
-1144 * oAIA = X509.getExtAIAInfo(hCert);
-1145 * // result will be such like:
-1146 * // oAIA.ocsp = ["http://ocsp.foo.com"];
-1147 * // oAIA.caissuer = ["http://rep.foo.com/aaa.p8m"];
-1148 */
-1149 X509.getExtAIAInfo = function ( hCert ) {
-1150 var result = { } ;
-1151 result.ocsp = [ ] ;
-1152 result.caissuer = [ ] ;
-1153 var pos1 = X509.getPosOfTLV_V3ExtValue ( hCert , "authorityInfoAccess" ) ;
-1154 if ( pos1 == - 1 ) return null ;
-1155 if ( hCert.substr ( pos1 , 2 ) != "30" ) // extnValue SEQUENCE
-1156 throw "malformed AIA Extn Value" ;
-1157
-1158 var posAccDescList = ASN1HEX.getPosArrayOfChildren_AtObj ( hCert , pos1 ) ;
-1159 for ( var i = 0 ; i < posAccDescList.length ; i ++ ) {
-1160 var p = posAccDescList [ i ] ;
-1161 var posAccDescChild = ASN1HEX.getPosArrayOfChildren_AtObj ( hCert , p ) ;
-1162 if ( posAccDescChild.length != 2 )
-1163 throw "malformed AccessDescription of AIA Extn" ;
-1164 var pOID = posAccDescChild [ 0 ] ;
-1165 var pName = posAccDescChild [ 1 ] ;
-1166 if ( ASN1HEX.getHexOfV_AtObj ( hCert , pOID ) == "2b06010505073001" ) {
-1167 if ( hCert.substr ( pName , 2 ) == "86" ) {
-1168 result.ocsp.push ( hextoutf8 ( ASN1HEX.getHexOfV_AtObj ( hCert , pName ) ) ) ;
-1169 }
-1170 }
-1171 if ( ASN1HEX.getHexOfV_AtObj ( hCert , pOID ) == "2b06010505073002" ) {
-1172 if ( hCert.substr ( pName , 2 ) == "86" ) {
-1173 result.caissuer.push ( hextoutf8 ( ASN1HEX.getHexOfV_AtObj ( hCert , pName ) ) ) ;
-1174 }
-1175 }
-1176 }
-1177 return result ;
-1178 } ;
-1179
-1180 /**
-1181 * get signature algorithm name from hexadecimal certificate data
-1182 * @name getSignatureAlgorithmName
-1183 * @memberOf X509
-1184 * @function
-1185 * @param {String} hCert hexadecimal string of X.509 certificate binary
-1186 * @return {String} signature algorithm name (ex. SHA1withRSA, SHA256withECDSA)
-1187 * @since x509 1.1.7
-1188 * @description
-1189 * This method will get signature algorithm name of certificate:
-1190 * @example
-1191 * algName = X509.getSignatureAlgorithmName(hCert);
-1192 */
-1193 X509.getSignatureAlgorithmName = function ( hCert ) {
-1194 var sigAlgOidHex = ASN1HEX.getDecendantHexVByNthList ( hCert , 0 , [ 1 , 0 ] ) ;
-1195 var sigAlgOidInt = KJUR.asn1.ASN1Util.oidHexToInt ( sigAlgOidHex ) ;
-1196 var sigAlgName = KJUR.asn1.x509.OID.oid2name ( sigAlgOidInt ) ;
-1197 return sigAlgName ;
-1198 } ;
-1199
-1200 /**
-1201 * get signature value in hexadecimal string
-1202 * @name getSignatureValueHex
-1203 * @memberOf X509
-1204 * @function
-1205 * @param {String} hCert hexadecimal string of X.509 certificate binary
-1206 * @return {String} signature value hexadecimal string without BitString unused bits
-1207 * @since x509 1.1.7
-1208 * @description
-1209 * This method will get signature value of certificate:
-1210 * @example
-1211 * sigHex = X509.getSignatureValueHex(hCert);
-1212 */
-1213 X509.getSignatureValueHex = function ( hCert ) {
-1214 var h = ASN1HEX.getDecendantHexVByNthList ( hCert , 0 , [ 2 ] ) ;
-1215 if ( h.substr ( 0 , 2 ) !== "00" )
-1216 throw "can't get signature value" ;
-1217 return h.substr ( 2 ) ;
-1218 } ;
-1219
-1220 X509.getSerialNumberHex = function ( hCert ) {
-1221 return ASN1HEX.getDecendantHexVByNthList ( hCert , 0 , [ 0 , 1 ] ) ;
-1222 } ;
-1223
-1224 /*
-1225 X509.prototype.readCertPEM = _x509_readCertPEM;
-1226 X509.prototype.readCertPEMWithoutRSAInit = _x509_readCertPEMWithoutRSAInit;
-1227 X509.prototype.getSerialNumberHex = _x509_getSerialNumberHex;
-1228 X509.prototype.getIssuerHex = _x509_getIssuerHex;
-1229 X509.prototype.getSubjectHex = _x509_getSubjectHex;
-1230 X509.prototype.getIssuerString = _x509_getIssuerString;
-1231 X509.prototype.getSubjectString = _x509_getSubjectString;
-1232 X509.prototype.getNotBefore = _x509_getNotBefore;
-1233 X509.prototype.getNotAfter = _x509_getNotAfter;
-1234 */
-1235
\ No newline at end of file
diff --git a/jwt/asn1-1.0.js b/jwt/asn1-1.0.js
deleted file mode 100644
index 88e548c..0000000
--- a/jwt/asn1-1.0.js
+++ /dev/null
@@ -1,1553 +0,0 @@
-/*! asn1-1.0.9.js (c) 2013-2015 Kenji Urushima | kjur.github.com/jsrsasign/license
- */
-/*
- * asn1.js - ASN.1 DER encoder classes
- *
- * Copyright (c) 2013-2015 Kenji Urushima (kenji.urushima@gmail.com)
- *
- * This software is licensed under the terms of the MIT License.
- * http://kjur.github.com/jsrsasign/license
- *
- * The above copyright and license notice shall be
- * included in all copies or substantial portions of the Software.
- */
-
-/**
- * @fileOverview
- * @name asn1-1.0.js
- * @author Kenji Urushima kenji.urushima@gmail.com
- * @version asn1 1.0.9 (2015-Nov-26)
- * @since jsrsasign 2.1
- * @license
MIT License
- */
-
-/**
- * kjur's class library name space
- *
- * This name space provides following name spaces:
- *
- * {@link KJUR.asn1} - ASN.1 primitive hexadecimal encoder
- * {@link KJUR.asn1.x509} - ASN.1 structure for X.509 certificate and CRL
- * {@link KJUR.crypto} - Java Cryptographic Extension(JCE) style MessageDigest/Signature
- * class and utilities
- *
- *
- * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.
- * @name KJUR
- * @namespace kjur's class library name space
- */
-if (typeof KJUR == "undefined" || !KJUR) KJUR = {};
-
-/**
- * kjur's ASN.1 class library name space
- *
- * This is ITU-T X.690 ASN.1 DER encoder class library and
- * class structure and methods is very similar to
- * org.bouncycastle.asn1 package of
- * well known BouncyCaslte Cryptography Library.
- *
PROVIDING ASN.1 PRIMITIVES
- * Here are ASN.1 DER primitive classes.
- *
- * 0x01 {@link KJUR.asn1.DERBoolean}
- * 0x02 {@link KJUR.asn1.DERInteger}
- * 0x03 {@link KJUR.asn1.DERBitString}
- * 0x04 {@link KJUR.asn1.DEROctetString}
- * 0x05 {@link KJUR.asn1.DERNull}
- * 0x06 {@link KJUR.asn1.DERObjectIdentifier}
- * 0x0a {@link KJUR.asn1.DEREnumerated}
- * 0x0c {@link KJUR.asn1.DERUTF8String}
- * 0x12 {@link KJUR.asn1.DERNumericString}
- * 0x13 {@link KJUR.asn1.DERPrintableString}
- * 0x14 {@link KJUR.asn1.DERTeletexString}
- * 0x16 {@link KJUR.asn1.DERIA5String}
- * 0x17 {@link KJUR.asn1.DERUTCTime}
- * 0x18 {@link KJUR.asn1.DERGeneralizedTime}
- * 0x30 {@link KJUR.asn1.DERSequence}
- * 0x31 {@link KJUR.asn1.DERSet}
- *
- *
OTHER ASN.1 CLASSES
- *
- * {@link KJUR.asn1.ASN1Object}
- * {@link KJUR.asn1.DERAbstractString}
- * {@link KJUR.asn1.DERAbstractTime}
- * {@link KJUR.asn1.DERAbstractStructured}
- * {@link KJUR.asn1.DERTaggedObject}
- *
- *
SUB NAME SPACES
- *
- * {@link KJUR.asn1.cades} - CAdES long term signature format
- * {@link KJUR.asn1.cms} - Cryptographic Message Syntax
- * {@link KJUR.asn1.csr} - Certificate Signing Request (CSR/PKCS#10)
- * {@link KJUR.asn1.tsp} - RFC 3161 Timestamping Protocol Format
- * {@link KJUR.asn1.x509} - RFC 5280 X.509 certificate and CRL
- *
- *
- * NOTE: Please ignore method summary and document of this namespace.
- * This caused by a bug of jsdoc2.
- * @name KJUR.asn1
- * @namespace
- */
-if (typeof KJUR.asn1 == "undefined" || !KJUR.asn1) KJUR.asn1 = {};
-
-/**
- * ASN1 utilities class
- * @name KJUR.asn1.ASN1Util
- * @class ASN1 utilities class
- * @since asn1 1.0.2
- */
-KJUR.asn1.ASN1Util = new function() {
- this.integerToByteHex = function(i) {
- var h = i.toString(16);
- if ((h.length % 2) == 1) h = '0' + h;
- return h;
- };
- this.bigIntToMinTwosComplementsHex = function(bigIntegerValue) {
- var h = bigIntegerValue.toString(16);
- if (h.substr(0, 1) != '-') {
- if (h.length % 2 == 1) {
- h = '0' + h;
- } else {
- if (! h.match(/^[0-7]/)) {
- h = '00' + h;
- }
- }
- } else {
- var hPos = h.substr(1);
- var xorLen = hPos.length;
- if (xorLen % 2 == 1) {
- xorLen += 1;
- } else {
- if (! h.match(/^[0-7]/)) {
- xorLen += 2;
- }
- }
- var hMask = '';
- for (var i = 0; i < xorLen; i++) {
- hMask += 'f';
- }
- var biMask = new BigInteger(hMask, 16);
- var biNeg = biMask.xor(bigIntegerValue).add(BigInteger.ONE);
- h = biNeg.toString(16).replace(/^-/, '');
- }
- return h;
- };
- /**
- * get PEM string from hexadecimal data and header string
- * @name getPEMStringFromHex
- * @memberOf KJUR.asn1.ASN1Util
- * @function
- * @param {String} dataHex hexadecimal string of PEM body
- * @param {String} pemHeader PEM header string (ex. 'RSA PRIVATE KEY')
- * @return {String} PEM formatted string of input data
- * @description
- * @example
- * var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex('616161', 'RSA PRIVATE KEY');
- * // value of pem will be:
- * -----BEGIN PRIVATE KEY-----
- * YWFh
- * -----END PRIVATE KEY-----
- */
- this.getPEMStringFromHex = function(dataHex, pemHeader) {
- var ns1 = KJUR.asn1;
- var dataWA = CryptoJS.enc.Hex.parse(dataHex);
- var dataB64 = CryptoJS.enc.Base64.stringify(dataWA);
- var pemBody = dataB64.replace(/(.{64})/g, "$1\r\n");
- pemBody = pemBody.replace(/\r\n$/, '');
- return "-----BEGIN " + pemHeader + "-----\r\n" +
- pemBody +
- "\r\n-----END " + pemHeader + "-----\r\n";
- };
-
- /**
- * generate ASN1Object specifed by JSON parameters
- * @name newObject
- * @memberOf KJUR.asn1.ASN1Util
- * @function
- * @param {Array} param JSON parameter to generate ASN1Object
- * @return {KJUR.asn1.ASN1Object} generated object
- * @since asn1 1.0.3
- * @description
- * generate any ASN1Object specified by JSON param
- * including ASN.1 primitive or structured.
- * Generally 'param' can be described as follows:
- *
- * {TYPE-OF-ASNOBJ: ASN1OBJ-PARAMETER}
- *
- * 'TYPE-OF-ASN1OBJ' can be one of following symbols:
- *
- * 'bool' - DERBoolean
- * 'int' - DERInteger
- * 'bitstr' - DERBitString
- * 'octstr' - DEROctetString
- * 'null' - DERNull
- * 'oid' - DERObjectIdentifier
- * 'enum' - DEREnumerated
- * 'utf8str' - DERUTF8String
- * 'numstr' - DERNumericString
- * 'prnstr' - DERPrintableString
- * 'telstr' - DERTeletexString
- * 'ia5str' - DERIA5String
- * 'utctime' - DERUTCTime
- * 'gentime' - DERGeneralizedTime
- * 'seq' - DERSequence
- * 'set' - DERSet
- * 'tag' - DERTaggedObject
- *
- * @example
- * newObject({'prnstr': 'aaa'});
- * newObject({'seq': [{'int': 3}, {'prnstr': 'aaa'}]})
- * // ASN.1 Tagged Object
- * newObject({'tag': {'tag': 'a1',
- * 'explicit': true,
- * 'obj': {'seq': [{'int': 3}, {'prnstr': 'aaa'}]}}});
- * // more simple representation of ASN.1 Tagged Object
- * newObject({'tag': ['a1',
- * true,
- * {'seq': [
- * {'int': 3},
- * {'prnstr': 'aaa'}]}
- * ]});
- */
- this.newObject = function(param) {
- var ns1 = KJUR.asn1;
- var keys = Object.keys(param);
- if (keys.length != 1)
- throw "key of param shall be only one.";
- var key = keys[0];
-
- if (":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":" + key + ":") == -1)
- throw "undefined key: " + key;
-
- if (key == "bool") return new ns1.DERBoolean(param[key]);
- if (key == "int") return new ns1.DERInteger(param[key]);
- if (key == "bitstr") return new ns1.DERBitString(param[key]);
- if (key == "octstr") return new ns1.DEROctetString(param[key]);
- if (key == "null") return new ns1.DERNull(param[key]);
- if (key == "oid") return new ns1.DERObjectIdentifier(param[key]);
- if (key == "enum") return new ns1.DEREnumerated(param[key]);
- if (key == "utf8str") return new ns1.DERUTF8String(param[key]);
- if (key == "numstr") return new ns1.DERNumericString(param[key]);
- if (key == "prnstr") return new ns1.DERPrintableString(param[key]);
- if (key == "telstr") return new ns1.DERTeletexString(param[key]);
- if (key == "ia5str") return new ns1.DERIA5String(param[key]);
- if (key == "utctime") return new ns1.DERUTCTime(param[key]);
- if (key == "gentime") return new ns1.DERGeneralizedTime(param[key]);
-
- if (key == "seq") {
- var paramList = param[key];
- var a = [];
- for (var i = 0; i < paramList.length; i++) {
- var asn1Obj = ns1.ASN1Util.newObject(paramList[i]);
- a.push(asn1Obj);
- }
- return new ns1.DERSequence({'array': a});
- }
-
- if (key == "set") {
- var paramList = param[key];
- var a = [];
- for (var i = 0; i < paramList.length; i++) {
- var asn1Obj = ns1.ASN1Util.newObject(paramList[i]);
- a.push(asn1Obj);
- }
- return new ns1.DERSet({'array': a});
- }
-
- if (key == "tag") {
- var tagParam = param[key];
- if (Object.prototype.toString.call(tagParam) === '[object Array]' &&
- tagParam.length == 3) {
- var obj = ns1.ASN1Util.newObject(tagParam[2]);
- return new ns1.DERTaggedObject({tag: tagParam[0], explicit: tagParam[1], obj: obj});
- } else {
- var newParam = {};
- if (tagParam.explicit !== undefined)
- newParam.explicit = tagParam.explicit;
- if (tagParam.tag !== undefined)
- newParam.tag = tagParam.tag;
- if (tagParam.obj === undefined)
- throw "obj shall be specified for 'tag'.";
- newParam.obj = ns1.ASN1Util.newObject(tagParam.obj);
- return new ns1.DERTaggedObject(newParam);
- }
- }
- };
-
- /**
- * get encoded hexadecimal string of ASN1Object specifed by JSON parameters
- * @name jsonToASN1HEX
- * @memberOf KJUR.asn1.ASN1Util
- * @function
- * @param {Array} param JSON parameter to generate ASN1Object
- * @return hexadecimal string of ASN1Object
- * @since asn1 1.0.4
- * @description
- * As for ASN.1 object representation of JSON object,
- * please see {@link newObject}.
- * @example
- * jsonToASN1HEX({'prnstr': 'aaa'});
- */
- this.jsonToASN1HEX = function(param) {
- var asn1Obj = this.newObject(param);
- return asn1Obj.getEncodedHex();
- };
-};
-
-/**
- * get dot noted oid number string from hexadecimal value of OID
- * @name oidHexToInt
- * @memberOf KJUR.asn1.ASN1Util
- * @function
- * @param {String} hex hexadecimal value of object identifier
- * @return {String} dot noted string of object identifier
- * @since jsrsasign 4.8.3 asn1 1.0.7
- * @description
- * This static method converts from hexadecimal string representation of
- * ASN.1 value of object identifier to oid number string.
- * @example
- * KJUR.asn1.ASN1Util.oidHexToInt('550406') → "2.5.4.6"
- */
-KJUR.asn1.ASN1Util.oidHexToInt = function(hex) {
- var s = "";
- var i01 = parseInt(hex.substr(0, 2), 16);
- var i0 = Math.floor(i01 / 40);
- var i1 = i01 % 40;
- var s = i0 + "." + i1;
-
- var binbuf = "";
- for (var i = 2; i < hex.length; i += 2) {
- var value = parseInt(hex.substr(i, 2), 16);
- var bin = ("00000000" + value.toString(2)).slice(- 8);
- binbuf = binbuf + bin.substr(1, 7);
- if (bin.substr(0, 1) == "0") {
- var bi = new BigInteger(binbuf, 2);
- s = s + "." + bi.toString(10);
- binbuf = "";
- }
- };
-
- return s;
-};
-
-/**
- * get hexadecimal value of object identifier from dot noted oid value
- * @name oidIntToHex
- * @memberOf KJUR.asn1.ASN1Util
- * @function
- * @param {String} oidString dot noted string of object identifier
- * @return {String} hexadecimal value of object identifier
- * @since jsrsasign 4.8.3 asn1 1.0.7
- * @description
- * This static method converts from object identifier value string.
- * to hexadecimal string representation of it.
- * @example
- * KJUR.asn1.ASN1Util.oidIntToHex("2.5.4.6") → "550406"
- */
-KJUR.asn1.ASN1Util.oidIntToHex = function(oidString) {
- var itox = function(i) {
- var h = i.toString(16);
- if (h.length == 1) h = '0' + h;
- return h;
- };
-
- var roidtox = function(roid) {
- var h = '';
- var bi = new BigInteger(roid, 10);
- var b = bi.toString(2);
- var padLen = 7 - b.length % 7;
- if (padLen == 7) padLen = 0;
- var bPad = '';
- for (var i = 0; i < padLen; i++) bPad += '0';
- b = bPad + b;
- for (var i = 0; i < b.length - 1; i += 7) {
- var b8 = b.substr(i, 7);
- if (i != b.length - 7) b8 = '1' + b8;
- h += itox(parseInt(b8, 2));
- }
- return h;
- };
-
- if (! oidString.match(/^[0-9.]+$/)) {
- throw "malformed oid string: " + oidString;
- }
- var h = '';
- var a = oidString.split('.');
- var i0 = parseInt(a[0]) * 40 + parseInt(a[1]);
- h += itox(i0);
- a.splice(0, 2);
- for (var i = 0; i < a.length; i++) {
- h += roidtox(a[i]);
- }
- return h;
-};
-
-
-// ********************************************************************
-// Abstract ASN.1 Classes
-// ********************************************************************
-
-// ********************************************************************
-
-/**
- * base class for ASN.1 DER encoder object
- * @name KJUR.asn1.ASN1Object
- * @class base class for ASN.1 DER encoder object
- * @property {Boolean} isModified flag whether internal data was changed
- * @property {String} hTLV hexadecimal string of ASN.1 TLV
- * @property {String} hT hexadecimal string of ASN.1 TLV tag(T)
- * @property {String} hL hexadecimal string of ASN.1 TLV length(L)
- * @property {String} hV hexadecimal string of ASN.1 TLV value(V)
- * @description
- */
-KJUR.asn1.ASN1Object = function() {
- var isModified = true;
- var hTLV = null;
- var hT = '00';
- var hL = '00';
- var hV = '';
-
- /**
- * get hexadecimal ASN.1 TLV length(L) bytes from TLV value(V)
- * @name getLengthHexFromValue
- * @memberOf KJUR.asn1.ASN1Object
- * @function
- * @return {String} hexadecimal string of ASN.1 TLV length(L)
- */
- this.getLengthHexFromValue = function() {
- if (typeof this.hV == "undefined" || this.hV == null) {
- throw "this.hV is null or undefined.";
- }
- if (this.hV.length % 2 == 1) {
- throw "value hex must be even length: n=" + hV.length + ",v=" + this.hV;
- }
- var n = this.hV.length / 2;
- var hN = n.toString(16);
- if (hN.length % 2 == 1) {
- hN = "0" + hN;
- }
- if (n < 128) {
- return hN;
- } else {
- var hNlen = hN.length / 2;
- if (hNlen > 15) {
- throw "ASN.1 length too long to represent by 8x: n = " + n.toString(16);
- }
- var head = 128 + hNlen;
- return head.toString(16) + hN;
- }
- };
-
- /**
- * get hexadecimal string of ASN.1 TLV bytes
- * @name getEncodedHex
- * @memberOf KJUR.asn1.ASN1Object
- * @function
- * @return {String} hexadecimal string of ASN.1 TLV
- */
- this.getEncodedHex = function() {
- if (this.hTLV == null || this.isModified) {
- this.hV = this.getFreshValueHex();
- this.hL = this.getLengthHexFromValue();
- this.hTLV = this.hT + this.hL + this.hV;
- this.isModified = false;
- //alert("first time: " + this.hTLV);
- }
- return this.hTLV;
- };
-
- /**
- * get hexadecimal string of ASN.1 TLV value(V) bytes
- * @name getValueHex
- * @memberOf KJUR.asn1.ASN1Object
- * @function
- * @return {String} hexadecimal string of ASN.1 TLV value(V) bytes
- */
- this.getValueHex = function() {
- this.getEncodedHex();
- return this.hV;
- }
-
- this.getFreshValueHex = function() {
- return '';
- };
-};
-
-// == BEGIN DERAbstractString ================================================
-/**
- * base class for ASN.1 DER string classes
- * @name KJUR.asn1.DERAbstractString
- * @class base class for ASN.1 DER string classes
- * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})
- * @property {String} s internal string of value
- * @extends KJUR.asn1.ASN1Object
- * @description
- *
- * As for argument 'params' for constructor, you can specify one of
- * following properties:
- *
- * str - specify initial ASN.1 value(V) by a string
- * hex - specify initial ASN.1 value(V) by a hexadecimal string
- *
- * NOTE: 'params' can be omitted.
- */
-KJUR.asn1.DERAbstractString = function(params) {
- KJUR.asn1.DERAbstractString.superclass.constructor.call(this);
- var s = null;
- var hV = null;
-
- /**
- * get string value of this string object
- * @name getString
- * @memberOf KJUR.asn1.DERAbstractString
- * @function
- * @return {String} string value of this string object
- */
- this.getString = function() {
- return this.s;
- };
-
- /**
- * set value by a string
- * @name setString
- * @memberOf KJUR.asn1.DERAbstractString
- * @function
- * @param {String} newS value by a string to set
- */
- this.setString = function(newS) {
- this.hTLV = null;
- this.isModified = true;
- this.s = newS;
- this.hV = stohex(this.s);
- };
-
- /**
- * set value by a hexadecimal string
- * @name setStringHex
- * @memberOf KJUR.asn1.DERAbstractString
- * @function
- * @param {String} newHexString value by a hexadecimal string to set
- */
- this.setStringHex = function(newHexString) {
- this.hTLV = null;
- this.isModified = true;
- this.s = null;
- this.hV = newHexString;
- };
-
- this.getFreshValueHex = function() {
- return this.hV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params == "string") {
- this.setString(params);
- } else if (typeof params['str'] != "undefined") {
- this.setString(params['str']);
- } else if (typeof params['hex'] != "undefined") {
- this.setStringHex(params['hex']);
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object);
-// == END DERAbstractString ================================================
-
-// == BEGIN DERAbstractTime ==================================================
-/**
- * base class for ASN.1 DER Generalized/UTCTime class
- * @name KJUR.asn1.DERAbstractTime
- * @class base class for ASN.1 DER Generalized/UTCTime class
- * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'})
- * @extends KJUR.asn1.ASN1Object
- * @description
- * @see KJUR.asn1.ASN1Object - superclass
- */
-KJUR.asn1.DERAbstractTime = function(params) {
- KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);
- var s = null;
- var date = null;
-
- // --- PRIVATE METHODS --------------------
- this.localDateToUTC = function(d) {
- utc = d.getTime() + (d.getTimezoneOffset() * 60000);
- var utcDate = new Date(utc);
- return utcDate;
- };
-
- /*
- * format date string by Data object
- * @name formatDate
- * @memberOf KJUR.asn1.AbstractTime;
- * @param {Date} dateObject
- * @param {string} type 'utc' or 'gen'
- * @param {boolean} withMillis flag for with millisections or not
- * @description
- * 'withMillis' flag is supported from asn1 1.0.6.
- */
- this.formatDate = function(dateObject, type, withMillis) {
- var pad = this.zeroPadding;
- var d = this.localDateToUTC(dateObject);
- var year = String(d.getFullYear());
- if (type == 'utc') year = year.substr(2, 2);
- var month = pad(String(d.getMonth() + 1), 2);
- var day = pad(String(d.getDate()), 2);
- var hour = pad(String(d.getHours()), 2);
- var min = pad(String(d.getMinutes()), 2);
- var sec = pad(String(d.getSeconds()), 2);
- var s = year + month + day + hour + min + sec;
- if (withMillis === true) {
- var millis = d.getMilliseconds();
- if (millis != 0) {
- var sMillis = pad(String(millis), 3);
- sMillis = sMillis.replace(/[0]+$/, "");
- s = s + "." + sMillis;
- }
- }
- return s + "Z";
- };
-
- this.zeroPadding = function(s, len) {
- if (s.length >= len) return s;
- return new Array(len - s.length + 1).join('0') + s;
- };
-
- // --- PUBLIC METHODS --------------------
- /**
- * get string value of this string object
- * @name getString
- * @memberOf KJUR.asn1.DERAbstractTime
- * @function
- * @return {String} string value of this time object
- */
- this.getString = function() {
- return this.s;
- };
-
- /**
- * set value by a string
- * @name setString
- * @memberOf KJUR.asn1.DERAbstractTime
- * @function
- * @param {String} newS value by a string to set such like "130430235959Z"
- */
- this.setString = function(newS) {
- this.hTLV = null;
- this.isModified = true;
- this.s = newS;
- this.hV = stohex(newS);
- };
-
- /**
- * set value by a Date object
- * @name setByDateValue
- * @memberOf KJUR.asn1.DERAbstractTime
- * @function
- * @param {Integer} year year of date (ex. 2013)
- * @param {Integer} month month of date between 1 and 12 (ex. 12)
- * @param {Integer} day day of month
- * @param {Integer} hour hours of date
- * @param {Integer} min minutes of date
- * @param {Integer} sec seconds of date
- */
- this.setByDateValue = function(year, month, day, hour, min, sec) {
- var dateObject = new Date(Date.UTC(year, month - 1, day, hour, min, sec, 0));
- this.setByDate(dateObject);
- };
-
- this.getFreshValueHex = function() {
- return this.hV;
- };
-};
-YAHOO.lang.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object);
-// == END DERAbstractTime ==================================================
-
-// == BEGIN DERAbstractStructured ============================================
-/**
- * base class for ASN.1 DER structured class
- * @name KJUR.asn1.DERAbstractStructured
- * @class base class for ASN.1 DER structured class
- * @property {Array} asn1Array internal array of ASN1Object
- * @extends KJUR.asn1.ASN1Object
- * @description
- * @see KJUR.asn1.ASN1Object - superclass
- */
-KJUR.asn1.DERAbstractStructured = function(params) {
- KJUR.asn1.DERAbstractString.superclass.constructor.call(this);
- var asn1Array = null;
-
- /**
- * set value by array of ASN1Object
- * @name setByASN1ObjectArray
- * @memberOf KJUR.asn1.DERAbstractStructured
- * @function
- * @param {array} asn1ObjectArray array of ASN1Object to set
- */
- this.setByASN1ObjectArray = function(asn1ObjectArray) {
- this.hTLV = null;
- this.isModified = true;
- this.asn1Array = asn1ObjectArray;
- };
-
- /**
- * append an ASN1Object to internal array
- * @name appendASN1Object
- * @memberOf KJUR.asn1.DERAbstractStructured
- * @function
- * @param {ASN1Object} asn1Object to add
- */
- this.appendASN1Object = function(asn1Object) {
- this.hTLV = null;
- this.isModified = true;
- this.asn1Array.push(asn1Object);
- };
-
- this.asn1Array = new Array();
- if (typeof params != "undefined") {
- if (typeof params['array'] != "undefined") {
- this.asn1Array = params['array'];
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object);
-
-
-// ********************************************************************
-// ASN.1 Object Classes
-// ********************************************************************
-
-// ********************************************************************
-/**
- * class for ASN.1 DER Boolean
- * @name KJUR.asn1.DERBoolean
- * @class class for ASN.1 DER Boolean
- * @extends KJUR.asn1.ASN1Object
- * @description
- * @see KJUR.asn1.ASN1Object - superclass
- */
-KJUR.asn1.DERBoolean = function() {
- KJUR.asn1.DERBoolean.superclass.constructor.call(this);
- this.hT = "01";
- this.hTLV = "0101ff";
-};
-YAHOO.lang.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object);
-
-// ********************************************************************
-/**
- * class for ASN.1 DER Integer
- * @name KJUR.asn1.DERInteger
- * @class class for ASN.1 DER Integer
- * @extends KJUR.asn1.ASN1Object
- * @description
- *
- * As for argument 'params' for constructor, you can specify one of
- * following properties:
- *
- * int - specify initial ASN.1 value(V) by integer value
- * bigint - specify initial ASN.1 value(V) by BigInteger object
- * hex - specify initial ASN.1 value(V) by a hexadecimal string
- *
- * NOTE: 'params' can be omitted.
- */
-KJUR.asn1.DERInteger = function(params) {
- KJUR.asn1.DERInteger.superclass.constructor.call(this);
- this.hT = "02";
-
- /**
- * set value by Tom Wu's BigInteger object
- * @name setByBigInteger
- * @memberOf KJUR.asn1.DERInteger
- * @function
- * @param {BigInteger} bigIntegerValue to set
- */
- this.setByBigInteger = function(bigIntegerValue) {
- this.hTLV = null;
- this.isModified = true;
- this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue);
- };
-
- /**
- * set value by integer value
- * @name setByInteger
- * @memberOf KJUR.asn1.DERInteger
- * @function
- * @param {Integer} integer value to set
- */
- this.setByInteger = function(intValue) {
- var bi = new BigInteger(String(intValue), 10);
- this.setByBigInteger(bi);
- };
-
- /**
- * set value by integer value
- * @name setValueHex
- * @memberOf KJUR.asn1.DERInteger
- * @function
- * @param {String} hexadecimal string of integer value
- * @description
- *
- * NOTE: Value shall be represented by minimum octet length of
- * two's complement representation.
- * @example
- * new KJUR.asn1.DERInteger(123);
- * new KJUR.asn1.DERInteger({'int': 123});
- * new KJUR.asn1.DERInteger({'hex': '1fad'});
- */
- this.setValueHex = function(newHexString) {
- this.hV = newHexString;
- };
-
- this.getFreshValueHex = function() {
- return this.hV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params['bigint'] != "undefined") {
- this.setByBigInteger(params['bigint']);
- } else if (typeof params['int'] != "undefined") {
- this.setByInteger(params['int']);
- } else if (typeof params == "number") {
- this.setByInteger(params);
- } else if (typeof params['hex'] != "undefined") {
- this.setValueHex(params['hex']);
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object);
-
-// ********************************************************************
-/**
- * class for ASN.1 DER encoded BitString primitive
- * @name KJUR.asn1.DERBitString
- * @class class for ASN.1 DER encoded BitString primitive
- * @extends KJUR.asn1.ASN1Object
- * @description
- *
- * As for argument 'params' for constructor, you can specify one of
- * following properties:
- *
- * bin - specify binary string (ex. '10111')
- * array - specify array of boolean (ex. [true,false,true,true])
- * hex - specify hexadecimal string of ASN.1 value(V) including unused bits
- *
- * NOTE: 'params' can be omitted.
- */
-KJUR.asn1.DERBitString = function(params) {
- KJUR.asn1.DERBitString.superclass.constructor.call(this);
- this.hT = "03";
-
- /**
- * set ASN.1 value(V) by a hexadecimal string including unused bits
- * @name setHexValueIncludingUnusedBits
- * @memberOf KJUR.asn1.DERBitString
- * @function
- * @param {String} newHexStringIncludingUnusedBits
- */
- this.setHexValueIncludingUnusedBits = function(newHexStringIncludingUnusedBits) {
- this.hTLV = null;
- this.isModified = true;
- this.hV = newHexStringIncludingUnusedBits;
- };
-
- /**
- * set ASN.1 value(V) by unused bit and hexadecimal string of value
- * @name setUnusedBitsAndHexValue
- * @memberOf KJUR.asn1.DERBitString
- * @function
- * @param {Integer} unusedBits
- * @param {String} hValue
- */
- this.setUnusedBitsAndHexValue = function(unusedBits, hValue) {
- if (unusedBits < 0 || 7 < unusedBits) {
- throw "unused bits shall be from 0 to 7: u = " + unusedBits;
- }
- var hUnusedBits = "0" + unusedBits;
- this.hTLV = null;
- this.isModified = true;
- this.hV = hUnusedBits + hValue;
- };
-
- /**
- * set ASN.1 DER BitString by binary string
- * @name setByBinaryString
- * @memberOf KJUR.asn1.DERBitString
- * @function
- * @param {String} binaryString binary value string (i.e. '10111')
- * @description
- * Its unused bits will be calculated automatically by length of
- * 'binaryValue'.
- * NOTE: Trailing zeros '0' will be ignored.
- */
- this.setByBinaryString = function(binaryString) {
- binaryString = binaryString.replace(/0+$/, '');
- var unusedBits = 8 - binaryString.length % 8;
- if (unusedBits == 8) unusedBits = 0;
- for (var i = 0; i <= unusedBits; i++) {
- binaryString += '0';
- }
- var h = '';
- for (var i = 0; i < binaryString.length - 1; i += 8) {
- var b = binaryString.substr(i, 8);
- var x = parseInt(b, 2).toString(16);
- if (x.length == 1) x = '0' + x;
- h += x;
- }
- this.hTLV = null;
- this.isModified = true;
- this.hV = '0' + unusedBits + h;
- };
-
- /**
- * set ASN.1 TLV value(V) by an array of boolean
- * @name setByBooleanArray
- * @memberOf KJUR.asn1.DERBitString
- * @function
- * @param {array} booleanArray array of boolean (ex. [true, false, true])
- * @description
- * NOTE: Trailing falses will be ignored.
- */
- this.setByBooleanArray = function(booleanArray) {
- var s = '';
- for (var i = 0; i < booleanArray.length; i++) {
- if (booleanArray[i] == true) {
- s += '1';
- } else {
- s += '0';
- }
- }
- this.setByBinaryString(s);
- };
-
- /**
- * generate an array of false with specified length
- * @name newFalseArray
- * @memberOf KJUR.asn1.DERBitString
- * @function
- * @param {Integer} nLength length of array to generate
- * @return {array} array of boolean faluse
- * @description
- * This static method may be useful to initialize boolean array.
- */
- this.newFalseArray = function(nLength) {
- var a = new Array(nLength);
- for (var i = 0; i < nLength; i++) {
- a[i] = false;
- }
- return a;
- };
-
- this.getFreshValueHex = function() {
- return this.hV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params == "string" && params.toLowerCase().match(/^[0-9a-f]+$/)) {
- this.setHexValueIncludingUnusedBits(params);
- } else if (typeof params['hex'] != "undefined") {
- this.setHexValueIncludingUnusedBits(params['hex']);
- } else if (typeof params['bin'] != "undefined") {
- this.setByBinaryString(params['bin']);
- } else if (typeof params['array'] != "undefined") {
- this.setByBooleanArray(params['array']);
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object);
-
-// ********************************************************************
-/**
- * class for ASN.1 DER OctetString
- * @name KJUR.asn1.DEROctetString
- * @class class for ASN.1 DER OctetString
- * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})
- * @extends KJUR.asn1.DERAbstractString
- * @description
- * @see KJUR.asn1.DERAbstractString - superclass
- */
-KJUR.asn1.DEROctetString = function(params) {
- KJUR.asn1.DEROctetString.superclass.constructor.call(this, params);
- this.hT = "04";
-};
-YAHOO.lang.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString);
-
-// ********************************************************************
-/**
- * class for ASN.1 DER Null
- * @name KJUR.asn1.DERNull
- * @class class for ASN.1 DER Null
- * @extends KJUR.asn1.ASN1Object
- * @description
- * @see KJUR.asn1.ASN1Object - superclass
- */
-KJUR.asn1.DERNull = function() {
- KJUR.asn1.DERNull.superclass.constructor.call(this);
- this.hT = "05";
- this.hTLV = "0500";
-};
-YAHOO.lang.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object);
-
-// ********************************************************************
-/**
- * class for ASN.1 DER ObjectIdentifier
- * @name KJUR.asn1.DERObjectIdentifier
- * @class class for ASN.1 DER ObjectIdentifier
- * @param {Array} params associative array of parameters (ex. {'oid': '2.5.4.5'})
- * @extends KJUR.asn1.ASN1Object
- * @description
- *
- * As for argument 'params' for constructor, you can specify one of
- * following properties:
- *
- * oid - specify initial ASN.1 value(V) by a oid string (ex. 2.5.4.13)
- * hex - specify initial ASN.1 value(V) by a hexadecimal string
- *
- * NOTE: 'params' can be omitted.
- */
-KJUR.asn1.DERObjectIdentifier = function(params) {
- var itox = function(i) {
- var h = i.toString(16);
- if (h.length == 1) h = '0' + h;
- return h;
- };
- var roidtox = function(roid) {
- var h = '';
- var bi = new BigInteger(roid, 10);
- var b = bi.toString(2);
- var padLen = 7 - b.length % 7;
- if (padLen == 7) padLen = 0;
- var bPad = '';
- for (var i = 0; i < padLen; i++) bPad += '0';
- b = bPad + b;
- for (var i = 0; i < b.length - 1; i += 7) {
- var b8 = b.substr(i, 7);
- if (i != b.length - 7) b8 = '1' + b8;
- h += itox(parseInt(b8, 2));
- }
- return h;
- }
-
- KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this);
- this.hT = "06";
-
- /**
- * set value by a hexadecimal string
- * @name setValueHex
- * @memberOf KJUR.asn1.DERObjectIdentifier
- * @function
- * @param {String} newHexString hexadecimal value of OID bytes
- */
- this.setValueHex = function(newHexString) {
- this.hTLV = null;
- this.isModified = true;
- this.s = null;
- this.hV = newHexString;
- };
-
- /**
- * set value by a OID string
- * @name setValueOidString
- * @memberOf KJUR.asn1.DERObjectIdentifier
- * @function
- * @param {String} oidString OID string (ex. 2.5.4.13)
- */
- this.setValueOidString = function(oidString) {
- if (! oidString.match(/^[0-9.]+$/)) {
- throw "malformed oid string: " + oidString;
- }
- var h = '';
- var a = oidString.split('.');
- var i0 = parseInt(a[0]) * 40 + parseInt(a[1]);
- h += itox(i0);
- a.splice(0, 2);
- for (var i = 0; i < a.length; i++) {
- h += roidtox(a[i]);
- }
- this.hTLV = null;
- this.isModified = true;
- this.s = null;
- this.hV = h;
- };
-
- /**
- * set value by a OID name
- * @name setValueName
- * @memberOf KJUR.asn1.DERObjectIdentifier
- * @function
- * @param {String} oidName OID name (ex. 'serverAuth')
- * @since 1.0.1
- * @description
- * OID name shall be defined in 'KJUR.asn1.x509.OID.name2oidList'.
- * Otherwise raise error.
- */
- this.setValueName = function(oidName) {
- if (typeof KJUR.asn1.x509.OID.name2oidList[oidName] != "undefined") {
- var oid = KJUR.asn1.x509.OID.name2oidList[oidName];
- this.setValueOidString(oid);
- } else {
- throw "DERObjectIdentifier oidName undefined: " + oidName;
- }
- };
-
- this.getFreshValueHex = function() {
- return this.hV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params == "string" && params.match(/^[0-2].[0-9.]+$/)) {
- this.setValueOidString(params);
- } else if (KJUR.asn1.x509.OID.name2oidList[params] !== undefined) {
- this.setValueOidString(KJUR.asn1.x509.OID.name2oidList[params]);
- } else if (typeof params['oid'] != "undefined") {
- this.setValueOidString(params['oid']);
- } else if (typeof params['hex'] != "undefined") {
- this.setValueHex(params['hex']);
- } else if (typeof params['name'] != "undefined") {
- this.setValueName(params['name']);
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object);
-
-// ********************************************************************
-/**
- * class for ASN.1 DER Enumerated
- * @name KJUR.asn1.DEREnumerated
- * @class class for ASN.1 DER Enumerated
- * @extends KJUR.asn1.ASN1Object
- * @description
- *
- * As for argument 'params' for constructor, you can specify one of
- * following properties:
- *
- * int - specify initial ASN.1 value(V) by integer value
- * hex - specify initial ASN.1 value(V) by a hexadecimal string
- *
- * NOTE: 'params' can be omitted.
- */
-KJUR.asn1.DEREnumerated = function(params) {
- KJUR.asn1.DEREnumerated.superclass.constructor.call(this);
- this.hT = "0a";
-
- /**
- * set value by Tom Wu's BigInteger object
- * @name setByBigInteger
- * @memberOf KJUR.asn1.DEREnumerated
- * @function
- * @param {BigInteger} bigIntegerValue to set
- */
- this.setByBigInteger = function(bigIntegerValue) {
- this.hTLV = null;
- this.isModified = true;
- this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue);
- };
-
- /**
- * set value by integer value
- * @name setByInteger
- * @memberOf KJUR.asn1.DEREnumerated
- * @function
- * @param {Integer} integer value to set
- */
- this.setByInteger = function(intValue) {
- var bi = new BigInteger(String(intValue), 10);
- this.setByBigInteger(bi);
- };
-
- /**
- * set value by integer value
- * @name setValueHex
- * @memberOf KJUR.asn1.DEREnumerated
- * @function
- * @param {String} hexadecimal string of integer value
- * @description
- *
- * NOTE: Value shall be represented by minimum octet length of
- * two's complement representation.
- * @example
- * new KJUR.asn1.DEREnumerated(123);
- * new KJUR.asn1.DEREnumerated({'int': 123});
- * new KJUR.asn1.DEREnumerated({'hex': '1fad'});
- */
- this.setValueHex = function(newHexString) {
- this.hV = newHexString;
- };
-
- this.getFreshValueHex = function() {
- return this.hV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params['int'] != "undefined") {
- this.setByInteger(params['int']);
- } else if (typeof params == "number") {
- this.setByInteger(params);
- } else if (typeof params['hex'] != "undefined") {
- this.setValueHex(params['hex']);
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.DEREnumerated, KJUR.asn1.ASN1Object);
-
-// ********************************************************************
-/**
- * class for ASN.1 DER UTF8String
- * @name KJUR.asn1.DERUTF8String
- * @class class for ASN.1 DER UTF8String
- * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})
- * @extends KJUR.asn1.DERAbstractString
- * @description
- * @see KJUR.asn1.DERAbstractString - superclass
- */
-KJUR.asn1.DERUTF8String = function(params) {
- KJUR.asn1.DERUTF8String.superclass.constructor.call(this, params);
- this.hT = "0c";
-};
-YAHOO.lang.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString);
-
-// ********************************************************************
-/**
- * class for ASN.1 DER NumericString
- * @name KJUR.asn1.DERNumericString
- * @class class for ASN.1 DER NumericString
- * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})
- * @extends KJUR.asn1.DERAbstractString
- * @description
- * @see KJUR.asn1.DERAbstractString - superclass
- */
-KJUR.asn1.DERNumericString = function(params) {
- KJUR.asn1.DERNumericString.superclass.constructor.call(this, params);
- this.hT = "12";
-};
-YAHOO.lang.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString);
-
-// ********************************************************************
-/**
- * class for ASN.1 DER PrintableString
- * @name KJUR.asn1.DERPrintableString
- * @class class for ASN.1 DER PrintableString
- * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})
- * @extends KJUR.asn1.DERAbstractString
- * @description
- * @see KJUR.asn1.DERAbstractString - superclass
- */
-KJUR.asn1.DERPrintableString = function(params) {
- KJUR.asn1.DERPrintableString.superclass.constructor.call(this, params);
- this.hT = "13";
-};
-YAHOO.lang.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString);
-
-// ********************************************************************
-/**
- * class for ASN.1 DER TeletexString
- * @name KJUR.asn1.DERTeletexString
- * @class class for ASN.1 DER TeletexString
- * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})
- * @extends KJUR.asn1.DERAbstractString
- * @description
- * @see KJUR.asn1.DERAbstractString - superclass
- */
-KJUR.asn1.DERTeletexString = function(params) {
- KJUR.asn1.DERTeletexString.superclass.constructor.call(this, params);
- this.hT = "14";
-};
-YAHOO.lang.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString);
-
-// ********************************************************************
-/**
- * class for ASN.1 DER IA5String
- * @name KJUR.asn1.DERIA5String
- * @class class for ASN.1 DER IA5String
- * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})
- * @extends KJUR.asn1.DERAbstractString
- * @description
- * @see KJUR.asn1.DERAbstractString - superclass
- */
-KJUR.asn1.DERIA5String = function(params) {
- KJUR.asn1.DERIA5String.superclass.constructor.call(this, params);
- this.hT = "16";
-};
-YAHOO.lang.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString);
-
-// ********************************************************************
-/**
- * class for ASN.1 DER UTCTime
- * @name KJUR.asn1.DERUTCTime
- * @class class for ASN.1 DER UTCTime
- * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'})
- * @extends KJUR.asn1.DERAbstractTime
- * @description
- *
- * As for argument 'params' for constructor, you can specify one of
- * following properties:
- *
- * str - specify initial ASN.1 value(V) by a string (ex.'130430235959Z')
- * hex - specify initial ASN.1 value(V) by a hexadecimal string
- * date - specify Date object.
- *
- * NOTE: 'params' can be omitted.
- *
EXAMPLES
- * @example
- * var d1 = new KJUR.asn1.DERUTCTime();
- * d1.setString('130430125959Z');
- *
- * var d2 = new KJUR.asn1.DERUTCTime({'str': '130430125959Z'});
- * var d3 = new KJUR.asn1.DERUTCTime({'date': new Date(Date.UTC(2015, 0, 31, 0, 0, 0, 0))});
- * var d4 = new KJUR.asn1.DERUTCTime('130430125959Z');
- */
-KJUR.asn1.DERUTCTime = function(params) {
- KJUR.asn1.DERUTCTime.superclass.constructor.call(this, params);
- this.hT = "17";
-
- /**
- * set value by a Date object
- * @name setByDate
- * @memberOf KJUR.asn1.DERUTCTime
- * @function
- * @param {Date} dateObject Date object to set ASN.1 value(V)
- */
- this.setByDate = function(dateObject) {
- this.hTLV = null;
- this.isModified = true;
- this.date = dateObject;
- this.s = this.formatDate(this.date, 'utc');
- this.hV = stohex(this.s);
- };
-
- this.getFreshValueHex = function() {
- if (typeof this.date == "undefined" && typeof this.s == "undefined") {
- this.date = new Date();
- this.s = this.formatDate(this.date, 'utc');
- this.hV = stohex(this.s);
- }
- return this.hV;
- };
-
- if (params !== undefined) {
- if (params.str !== undefined) {
- this.setString(params.str);
- } else if (typeof params == "string" && params.match(/^[0-9]{12}Z$/)) {
- this.setString(params);
- } else if (params.hex !== undefined) {
- this.setStringHex(params.hex);
- } else if (params.date !== undefined) {
- this.setByDate(params.date);
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime);
-
-// ********************************************************************
-/**
- * class for ASN.1 DER GeneralizedTime
- * @name KJUR.asn1.DERGeneralizedTime
- * @class class for ASN.1 DER GeneralizedTime
- * @param {Array} params associative array of parameters (ex. {'str': '20130430235959Z'})
- * @property {Boolean} withMillis flag to show milliseconds or not
- * @extends KJUR.asn1.DERAbstractTime
- * @description
- *
- * As for argument 'params' for constructor, you can specify one of
- * following properties:
- *
- * str - specify initial ASN.1 value(V) by a string (ex.'20130430235959Z')
- * hex - specify initial ASN.1 value(V) by a hexadecimal string
- * date - specify Date object.
- * millis - specify flag to show milliseconds (from 1.0.6)
- *
- * NOTE1: 'params' can be omitted.
- * NOTE2: 'withMillis' property is supported from asn1 1.0.6.
- */
-KJUR.asn1.DERGeneralizedTime = function(params) {
- KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, params);
- this.hT = "18";
- this.withMillis = false;
-
- /**
- * set value by a Date object
- * @name setByDate
- * @memberOf KJUR.asn1.DERGeneralizedTime
- * @function
- * @param {Date} dateObject Date object to set ASN.1 value(V)
- * @example
- * When you specify UTC time, use 'Date.UTC' method like this:
- * var o = new DERUTCTime();
- * var date = new Date(Date.UTC(2015, 0, 31, 23, 59, 59, 0)); #2015JAN31 23:59:59
- * o.setByDate(date);
- */
- this.setByDate = function(dateObject) {
- this.hTLV = null;
- this.isModified = true;
- this.date = dateObject;
- this.s = this.formatDate(this.date, 'gen', this.withMillis);
- this.hV = stohex(this.s);
- };
-
- this.getFreshValueHex = function() {
- if (this.date === undefined && this.s === undefined) {
- this.date = new Date();
- this.s = this.formatDate(this.date, 'gen', this.withMillis);
- this.hV = stohex(this.s);
- }
- return this.hV;
- };
-
- if (params !== undefined) {
- if (params.str !== undefined) {
- this.setString(params.str);
- } else if (typeof params == "string" && params.match(/^[0-9]{14}Z$/)) {
- this.setString(params);
- } else if (params.hex !== undefined) {
- this.setStringHex(params.hex);
- } else if (params.date !== undefined) {
- this.setByDate(params.date);
- }
- if (params.millis === true) {
- this.withMillis = true;
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime);
-
-// ********************************************************************
-/**
- * class for ASN.1 DER Sequence
- * @name KJUR.asn1.DERSequence
- * @class class for ASN.1 DER Sequence
- * @extends KJUR.asn1.DERAbstractStructured
- * @description
- *
- * As for argument 'params' for constructor, you can specify one of
- * following properties:
- *
- * array - specify array of ASN1Object to set elements of content
- *
- * NOTE: 'params' can be omitted.
- */
-KJUR.asn1.DERSequence = function(params) {
- KJUR.asn1.DERSequence.superclass.constructor.call(this, params);
- this.hT = "30";
- this.getFreshValueHex = function() {
- var h = '';
- for (var i = 0; i < this.asn1Array.length; i++) {
- var asn1Obj = this.asn1Array[i];
- h += asn1Obj.getEncodedHex();
- }
- this.hV = h;
- return this.hV;
- };
-};
-YAHOO.lang.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured);
-
-// ********************************************************************
-/**
- * class for ASN.1 DER Set
- * @name KJUR.asn1.DERSet
- * @class class for ASN.1 DER Set
- * @extends KJUR.asn1.DERAbstractStructured
- * @description
- *
- * As for argument 'params' for constructor, you can specify one of
- * following properties:
- *
- * array - specify array of ASN1Object to set elements of content
- * sortflag - flag for sort (default: true). ASN.1 BER is not sorted in 'SET OF'.
- *
- * NOTE1: 'params' can be omitted.
- * NOTE2: sortflag is supported since 1.0.5.
- */
-KJUR.asn1.DERSet = function(params) {
- KJUR.asn1.DERSet.superclass.constructor.call(this, params);
- this.hT = "31";
- this.sortFlag = true; // item shall be sorted only in ASN.1 DER
- this.getFreshValueHex = function() {
- var a = new Array();
- for (var i = 0; i < this.asn1Array.length; i++) {
- var asn1Obj = this.asn1Array[i];
- a.push(asn1Obj.getEncodedHex());
- }
- if (this.sortFlag == true) a.sort();
- this.hV = a.join('');
- return this.hV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params.sortflag != "undefined" &&
- params.sortflag == false)
- this.sortFlag = false;
- }
-};
-YAHOO.lang.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured);
-
-// ********************************************************************
-/**
- * class for ASN.1 DER TaggedObject
- * @name KJUR.asn1.DERTaggedObject
- * @class class for ASN.1 DER TaggedObject
- * @extends KJUR.asn1.ASN1Object
- * @description
- *
- * Parameter 'tagNoNex' is ASN.1 tag(T) value for this object.
- * For example, if you find '[1]' tag in a ASN.1 dump,
- * 'tagNoHex' will be 'a1'.
- *
- * As for optional argument 'params' for constructor, you can specify *ANY* of
- * following properties:
- *
- * explicit - specify true if this is explicit tag otherwise false
- * (default is 'true').
- * tag - specify tag (default is 'a0' which means [0])
- * obj - specify ASN1Object which is tagged
- *
- * @example
- * d1 = new KJUR.asn1.DERUTF8String({'str':'a'});
- * d2 = new KJUR.asn1.DERTaggedObject({'obj': d1});
- * hex = d2.getEncodedHex();
- */
-KJUR.asn1.DERTaggedObject = function(params) {
- KJUR.asn1.DERTaggedObject.superclass.constructor.call(this);
- this.hT = "a0";
- this.hV = '';
- this.isExplicit = true;
- this.asn1Object = null;
-
- /**
- * set value by an ASN1Object
- * @name setString
- * @memberOf KJUR.asn1.DERTaggedObject
- * @function
- * @param {Boolean} isExplicitFlag flag for explicit/implicit tag
- * @param {Integer} tagNoHex hexadecimal string of ASN.1 tag
- * @param {ASN1Object} asn1Object ASN.1 to encapsulate
- */
- this.setASN1Object = function(isExplicitFlag, tagNoHex, asn1Object) {
- this.hT = tagNoHex;
- this.isExplicit = isExplicitFlag;
- this.asn1Object = asn1Object;
- if (this.isExplicit) {
- this.hV = this.asn1Object.getEncodedHex();
- this.hTLV = null;
- this.isModified = true;
- } else {
- this.hV = null;
- this.hTLV = asn1Object.getEncodedHex();
- this.hTLV = this.hTLV.replace(/^../, tagNoHex);
- this.isModified = false;
- }
- };
-
- this.getFreshValueHex = function() {
- return this.hV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params['tag'] != "undefined") {
- this.hT = params['tag'];
- }
- if (typeof params['explicit'] != "undefined") {
- this.isExplicit = params['explicit'];
- }
- if (typeof params['obj'] != "undefined") {
- this.asn1Object = params['obj'];
- this.setASN1Object(this.isExplicit, this.hT, this.asn1Object);
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object);
diff --git a/jwt/asn1cades-1.0.js b/jwt/asn1cades-1.0.js
deleted file mode 100755
index c180756..0000000
--- a/jwt/asn1cades-1.0.js
+++ /dev/null
@@ -1,775 +0,0 @@
-/*! asn1cades-1.0.0.js (c) 2013-2014 Kenji Urushima | kjur.github.com/jsrsasign/license
- */
-/*
- * asn1cades.js - ASN.1 DER encoder classes for RFC 5126 CAdES long term signature
- *
- * Copyright (c) 2014 Kenji Urushima (kenji.urushima@gmail.com)
- *
- * This software is licensed under the terms of the MIT License.
- * http://kjur.github.com/jsrsasign/license
- *
- * The above copyright and license notice shall be
- * included in all copies or substantial portions of the Software.
- */
-
-/**
- * @fileOverview
- * @name asn1cades-1.0.js
- * @author Kenji Urushima kenji.urushima@gmail.com
- * @version 1.0.0 (2014-May-28)
- * @since jsrsasign 4.7.0
- * @license
MIT License
- */
-
-/**
- * kjur's class library name space
- * // already documented in asn1-1.0.js
- * @name KJUR
- * @namespace kjur's class library name space
- */
-if (typeof KJUR == "undefined" || !KJUR) KJUR = {};
-
-/**
- * kjur's ASN.1 class library name space
- * // already documented in asn1-1.0.js
- * @name KJUR.asn1
- * @namespace
- */
-if (typeof KJUR.asn1 == "undefined" || !KJUR.asn1) KJUR.asn1 = {};
-
-/**
- * kjur's ASN.1 class for RFC 5126 CAdES long term signature
- *
- * This name space provides
- * RFC 5126
- * CAdES(CMS Advanced Electronic Signature) generator.
- *
- *
SUPPORTED FORMATS
- * Following CAdES formats is supported by this library.
- *
- * CAdES-BES - CAdES Basic Electronic Signature
- * CAdES-EPES - CAdES Explicit Policy-based Electronic Signature
- * CAdES-T - Electronic Signature with Time
- *
- *
- *
- *
PROVIDED ATTRIBUTE CLASSES
- *
- * {@link KJUR.asn1.cades.SignaturePolicyIdentifier} - for CAdES-EPES
- * {@link KJUR.asn1.cades.SignatureTimeStamp} - for CAdES-T
- * {@link KJUR.asn1.cades.CompleteCertificateRefs} - for CAdES-C(for future use)
- *
- * NOTE: Currntly CAdES-C is not supported since parser can't
- * handle unsigned attribute.
- *
- *
OTHER CLASSES
- *
- * {@link KJUR.asn1.cades.OtherHashAlgAndValue}
- * {@link KJUR.asn1.cades.OtherHash}
- * {@link KJUR.asn1.cades.OtherCertID}
- * {@link KJUR.asn1.cades.CAdESUtil} - utilities for CAdES
- *
- *
- *
GENERATE CAdES-BES
- * To generate CAdES-BES, {@link KJUR.asn.cades} namespace
- * classes are not required and already {@link KJUR.asn.cms} namespace
- * provides attributes for CAdES-BES.
- * Create {@link KJUR.asn1.cms.SignedData} with following
- * mandatory attribute in CAdES-BES:
- *
- * {@link KJUR.asn1.cms.ContentType}
- * {@link KJUR.asn1.cms.MessageDigest}
- * {@link KJUR.asn1.cms.SigningCertificate} or
- * {@link KJUR.asn1.cms.SigningCertificateV2}
- *
- * CMSUtil.newSignedData method is very useful to generate CAdES-BES.
- *
- * sd = KJUR.asn1.cms.CMSUtil.newSignedData({
- * content: {str: "aaa"},
- * certs: [certPEM],
- * signerInfos: [{
- * hashAlg: 'sha256',
- * sAttr: {SigningCertificateV2: {array: [certPEM]}},
- * signerCert: certPEM,
- * sigAlg: 'SHA256withRSA',
- * signerPrvKey: pkcs8PrvKeyPEM
- * }]
- * });
- * signedDataHex = sd.getContentInfoEncodedHex();
- *
- * NOTE: ContentType and MessageDigest signed attributes
- * are automatically added by default.
- *
- *
GENERATE CAdES-BES with multiple signers
- * If you need signature by multiple signers, you can
- * specify one or more items in 'signerInfos' property as below.
- *
- * sd = KJUR.asn1.cms.CMSUtil.newSignedData({
- * content: {str: "aaa"},
- * certs: [certPEM1, certPEM2],
- * signerInfos: [{
- * hashAlg: 'sha256',
- * sAttr: {SigningCertificateV2: {array: [certPEM1]}},
- * signerCert: certPEM1,
- * sigAlg: 'SHA256withRSA',
- * signerPrvKey: pkcs8PrvKeyPEM1
- * },{
- * hashAlg: 'sha1',
- * sAttr: {SigningCertificateV2: {array: [certPEM2]}},
- * signerCert: certPEM2,
- * sigAlg: 'SHA1withRSA',
- * signerPrvKey: pkcs8PrvKeyPEM2
- * }]
- * });
- * signedDataHex = sd.getContentInfoEncodedHex();
- *
- *
- *
GENERATE CAdES-EPES
- * When you need a CAdES-EPES signature,
- * you just need to add 'SignaturePolicyIdentifier'
- * attribute as below.
- *
- * sd = KJUR.asn1.cms.CMSUtil.newSignedData({
- * content: {str: "aaa"},
- * certs: [certPEM],
- * signerInfos: [{
- * hashAlg: 'sha256',
- * sAttr: {
- * SigningCertificateV2: {array: [certPEM]},
- * SignaturePolicyIdentifier: {
- * oid: '1.2.3.4.5',
- * hash: {alg: 'sha1', hash: 'b1b2b3b4b...'}
- * },
- * },
- * signerCert: certPEM,
- * sigAlg: 'SHA256withRSA',
- * signerPrvKey: pkcs8PrvKeyPEM
- * }]
- * });
- * signedDataHex = sd.getContentInfoEncodedHex();
- *
- *
- *
GENERATE CAdES-T
- * After a signed CAdES-BES or CAdES-EPES signature have been generated,
- * you can generate CAdES-T by adding SigningTimeStamp unsigned attribute.
- *
- * beshex = "30..."; // hex of CAdES-BES or EPES data
- * info = KJUR.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned(beshex);
- * // You can refer a hexadecimal string of signature value
- * // in the first signerInfo in the CAdES-BES/EPES with a variable:
- * // 'info.si[0].sigval'. You need to get RFC 3161 TimeStampToken
- * // from a trusted time stamp authority. Otherwise you can also
- * // get it by 'KJUR.asn1.tsp' module. We suppose that we could
- * // get proper time stamp.
- * tsthex0 = "30..."; // hex of TimeStampToken for signerInfo[0] sigval
- * si0 = info.obj.signerInfoList[0];
- * si0.addUnsigned(new KJUR.asn1.cades.SignatureTimeStamp({tst: tsthex0});
- * esthex = info.obj.getContentInfoEncodedHex(); // CAdES-T
- *
- *
- *
- *
SAMPLE CODES
- *
- *
- * @name KJUR.asn1.cades
- * @namespace
- */
-if (typeof KJUR.asn1.cades == "undefined" || !KJUR.asn1.cades) KJUR.asn1.cades = {};
-
-/**
- * class for RFC 5126 CAdES SignaturePolicyIdentifier attribute
- * @name KJUR.asn1.cades.SignaturePolicyIdentifier
- * @class class for RFC 5126 CAdES SignaturePolicyIdentifier attribute
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.cms.Attribute
- * @since jsrsasign 4.7.0 asn1cades 1.0.0
- * @description
- *
- * SignaturePolicyIdentifier ::= CHOICE {
- * signaturePolicyId SignaturePolicyId,
- * signaturePolicyImplied SignaturePolicyImplied } -- not used
- *
- * SignaturePolicyImplied ::= NULL
- * SignaturePolicyId ::= SEQUENCE {
- * sigPolicyId SigPolicyId,
- * sigPolicyHash SigPolicyHash,
- * sigPolicyQualifiers SEQUENCE SIZE (1..MAX) OF
- * SigPolicyQualifierInfo OPTIONAL }
- * SigPolicyId ::= OBJECT IDENTIFIER
- * SigPolicyHash ::= OtherHashAlgAndValue
- *
- * @example
- * var o = new KJUR.asn1.cades.SignaturePolicyIdentifier({
- * oid: '1.2.3.4.5',
- * hash: {alg: 'sha1', hash: 'a1a2a3a4...'}
- * });
- */
-/*
- * id-aa-ets-sigPolicyId OBJECT IDENTIFIER ::= { iso(1)
- * member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
- * smime(16) id-aa(2) 15 }
- *
- * signature-policy-identifier attribute values have ASN.1 type
- * SignaturePolicyIdentifier:
- *
- * SigPolicyQualifierInfo ::= SEQUENCE {
- * sigPolicyQualifierId SigPolicyQualifierId,
- * sigQualifier ANY DEFINED BY sigPolicyQualifierId }
- *
- * sigpolicyQualifierIds defined in the present document:
- * SigPolicyQualifierId ::= OBJECT IDENTIFIER
- * id-spq-ets-uri OBJECT IDENTIFIER ::= { iso(1)
- * member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
- * smime(16) id-spq(5) 1 }
- *
- * SPuri ::= IA5String
- *
- * id-spq-ets-unotice OBJECT IDENTIFIER ::= { iso(1)
- * member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
- * smime(16) id-spq(5) 2 }
- *
- * SPUserNotice ::= SEQUENCE {
- * noticeRef NoticeReference OPTIONAL,
- * explicitText DisplayText OPTIONAL}
- *
- * NoticeReference ::= SEQUENCE {
- * organization DisplayText,
- * noticeNumbers SEQUENCE OF INTEGER }
- *
- * DisplayText ::= CHOICE {
- * visibleString VisibleString (SIZE (1..200)),
- * bmpString BMPString (SIZE (1..200)),
- * utf8String UTF8String (SIZE (1..200)) }
- */
-KJUR.asn1.cades.SignaturePolicyIdentifier = function(params) {
- KJUR.asn1.cades.SignaturePolicyIdentifier.superclass.constructor.call(this);
- this.attrTypeOid = "1.2.840.113549.1.9.16.2.15";
- var nA = KJUR.asn1;
- var nC = KJUR.asn1.cades;
-
- if (typeof params != "undefined") {
- if (typeof params.oid == "string" &&
- typeof params.hash == "object") {
- var dOid = new nA.DERObjectIdentifier({oid: params.oid});
- var dHash = new nC.OtherHashAlgAndValue(params.hash);
- var seq = new nA.DERSequence({array: [dOid, dHash]});
- this.valueList = [seq];
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.cades.SignaturePolicyIdentifier,
- KJUR.asn1.cms.Attribute);
-
-/**
- * class for OtherHashAlgAndValue ASN.1 object
- * @name KJUR.asn1.cades.OtherHashAlgAndValue
- * @class class for OtherHashAlgAndValue ASN.1 object
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.ASN1Object
- * @since jsrsasign 4.7.0 asn1cades 1.0.0
- * @description
- *
- * OtherHashAlgAndValue ::= SEQUENCE {
- * hashAlgorithm AlgorithmIdentifier,
- * hashValue OtherHashValue }
- * OtherHashValue ::= OCTET STRING
- *
- */
-KJUR.asn1.cades.OtherHashAlgAndValue = function(params) {
- KJUR.asn1.cades.OtherHashAlgAndValue.superclass.constructor.call(this);
- var nA = KJUR.asn1;
- var nX = KJUR.asn1.x509;
- this.dAlg = null;
- this.dHash = null;
-
- this.getEncodedHex = function() {
- var seq = new nA.DERSequence({array: [this.dAlg, this.dHash]});
- this.hTLV = seq.getEncodedHex();
- return this.hTLV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params.alg == "string" &&
- typeof params.hash == "string") {
- this.dAlg = new nX.AlgorithmIdentifier({name: params.alg});
- this.dHash = new nA.DEROctetString({hex: params.hash});
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.cades.OtherHashAlgAndValue, KJUR.asn1.ASN1Object);
-
-/**
- * class for RFC 5126 CAdES SignatureTimeStamp attribute
- * @name KJUR.asn1.cades.SignatureTimeStamp
- * @class class for RFC 5126 CAdES SignatureTimeStamp attribute
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.cms.Attribute
- * @since jsrsasign 4.7.0 asn1cades 1.0.0
- * @description
- *
- * id-aa-signatureTimeStampToken OBJECT IDENTIFIER ::=
- * 1.2.840.113549.1.9.16.2.14
- * SignatureTimeStampToken ::= TimeStampToken
- *
- */
-KJUR.asn1.cades.SignatureTimeStamp = function(params) {
- KJUR.asn1.cades.SignatureTimeStamp.superclass.constructor.call(this);
- this.attrTypeOid = "1.2.840.113549.1.9.16.2.14";
- this.tstHex = null;
- var nA = KJUR.asn1;
-
- if (typeof params != "undefined") {
- if (typeof params.res != "undefined") {
- if (typeof params.res == "string" &&
- params.res.match(/^[0-9A-Fa-f]+$/)) {
- } else if (params.res instanceof KJUR.asn1.ASN1Object) {
- } else {
- throw "res param shall be ASN1Object or hex string";
- }
- }
- if (typeof params.tst != "undefined") {
- if (typeof params.tst == "string" &&
- params.tst.match(/^[0-9A-Fa-f]+$/)) {
- var d = new nA.ASN1Object();
- this.tstHex = params.tst;
- d.hTLV = this.tstHex;
- d.getEncodedHex();
- this.valueList = [d];
- } else if (params.tst instanceof KJUR.asn1.ASN1Object) {
- } else {
- throw "tst param shall be ASN1Object or hex string";
- }
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.cades.SignatureTimeStamp,
- KJUR.asn1.cms.Attribute);
-
-/**
- * class for RFC 5126 CAdES CompleteCertificateRefs attribute
- * @name KJUR.asn1.cades.CompleteCertificateRefs
- * @class class for RFC 5126 CAdES CompleteCertificateRefs attribute
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.cms.Attribute
- * @since jsrsasign 4.7.0 asn1cades 1.0.0
- * @description
- *
- * id-aa-ets-certificateRefs OBJECT IDENTIFIER =
- * 1.2.840.113549.1.9.16.2.21
- * CompleteCertificateRefs ::= SEQUENCE OF OtherCertID
- *
- * @example
- * o = new KJUR.asn1.cades.CompleteCertificateRefs([certPEM1,certPEM2]);
- */
-KJUR.asn1.cades.CompleteCertificateRefs = function(params) {
- KJUR.asn1.cades.CompleteCertificateRefs.superclass.constructor.call(this);
- this.attrTypeOid = "1.2.840.113549.1.9.16.2.21";
- var nA = KJUR.asn1;
- var nD = KJUR.asn1.cades;
-
- /**
- * set value by array
- * @name setByArray
- * @memberOf KJUR.asn1.cades.CompleteCertificateRefs
- * @function
- * @param {Array} a array of {@link KJUR.asn1.cades.OtherCertID} argument
- * @return unspecified
- * @description
- */
- this.setByArray = function(a) {
- this.valueList = [];
- for (var i = 0; i < a.length; i++) {
- var o = new nD.OtherCertID(a[i]);
- this.valueList.push(o);
- }
- };
-
- if (typeof params != "undefined") {
- if (typeof params == "object" &&
- typeof params.length == "number") {
- this.setByArray(params);
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.cades.CompleteCertificateRefs,
- KJUR.asn1.cms.Attribute);
-
-/**
- * class for OtherCertID ASN.1 object
- * @name KJUR.asn1.cades.OtherCertID
- * @class class for OtherCertID ASN.1 object
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.ASN1Object
- * @since jsrsasign 4.7.0 asn1cades 1.0.0
- * @description
- *
- * OtherCertID ::= SEQUENCE {
- * otherCertHash OtherHash,
- * issuerSerial IssuerSerial OPTIONAL }
- *
- * @example
- * o = new KJUR.asn1.cades.OtherCertID(certPEM);
- * o = new KJUR.asn1.cades.OtherCertID({cert:certPEM, hasis: false});
- */
-KJUR.asn1.cades.OtherCertID = function(params) {
- KJUR.asn1.cades.OtherCertID.superclass.constructor.call(this);
- var nA = KJUR.asn1;
- var nC = KJUR.asn1.cms;
- var nD = KJUR.asn1.cades;
- this.hasIssuerSerial = true;
- this.dOtherCertHash = null;
- this.dIssuerSerial = null;
-
- /**
- * set value by PEM string of certificate
- * @name setByCertPEM
- * @memberOf KJUR.asn1.cades.OtherCertID
- * @function
- * @param {String} certPEM PEM string of certificate
- * @return unspecified
- * @description
- * This method will set value by a PEM string of a certificate.
- * This will add IssuerAndSerialNumber by default
- * which depends on hasIssuerSerial flag.
- */
- this.setByCertPEM = function(certPEM) {
- this.dOtherCertHash = new nD.OtherHash(certPEM);
- if (this.hasIssuerSerial)
- this.dIssuerSerial = new nC.IssuerAndSerialNumber(certPEM);
- };
-
- this.getEncodedHex = function() {
- if (this.hTLV != null) return this.hTLV;
- if (this.dOtherCertHash == null)
- throw "otherCertHash not set";
- var a = [this.dOtherCertHash];
- if (this.dIssuerSerial != null)
- a.push(this.dIssuerSerial);
- var seq = new nA.DERSequence({array: a});
- this.hTLV = seq.getEncodedHex();
- return this.hTLV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params == "string" &&
- params.indexOf("-----BEGIN ") != -1) {
- this.setByCertPEM(params);
- }
- if (typeof params == "object") {
- if (params.hasis === false)
- this.hasIssuerSerial = false;
- if (typeof params.cert == "string")
- this.setByCertPEM(params.cert);
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.cades.OtherCertID, KJUR.asn1.ASN1Object);
-
-/**
- * class for OtherHash ASN.1 object
- * @name KJUR.asn1.cades.OtherHash
- * @class class for OtherHash ASN.1 object
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.ASN1Object
- * @since jsrsasign 4.7.0 asn1cades 1.0.0
- * @description
- *
- * OtherHash ::= CHOICE {
- * sha1Hash OtherHashValue, -- This contains a SHA-1 hash
- * otherHash OtherHashAlgAndValue}
- * OtherHashValue ::= OCTET STRING
- *
- * @example
- * o = new KJUR.asn1.cades.OtherHash("1234");
- * o = new KJUR.asn1.cades.OtherHash(certPEMStr); // default alg=sha256
- * o = new KJUR.asn1.cades.OtherHash({alg: 'sha256', hash: '1234'});
- * o = new KJUR.asn1.cades.OtherHash({alg: 'sha256', cert: certPEM});
- * o = new KJUR.asn1.cades.OtherHash({cert: certPEM});
- */
-KJUR.asn1.cades.OtherHash = function(params) {
- KJUR.asn1.cades.OtherHash.superclass.constructor.call(this);
- var nA = KJUR.asn1;
- var nD = KJUR.asn1.cades;
- this.alg = 'sha256';
- this.dOtherHash = null;
-
- /**
- * set value by PEM string of certificate
- * @name setByCertPEM
- * @memberOf KJUR.asn1.cades.OtherHash
- * @function
- * @param {String} certPEM PEM string of certificate
- * @return unspecified
- * @description
- * This method will set value by a PEM string of a certificate.
- * An algorithm used to hash certificate data will
- * be defined by 'alg' property and 'sha256' is default.
- */
- this.setByCertPEM = function(certPEM) {
- if (certPEM.indexOf("-----BEGIN ") == -1)
- throw "certPEM not to seem PEM format";
- var hex = X509.pemToHex(certPEM);
- var hash = KJUR.crypto.Util.hashHex(hex, this.alg);
- this.dOtherHash =
- new nD.OtherHashAlgAndValue({alg: this.alg, hash: hash});
- };
-
- this.getEncodedHex = function() {
- if (this.dOtherHash == null)
- throw "OtherHash not set";
- return this.dOtherHash.getEncodedHex();
- };
-
- if (typeof params != "undefined") {
- if (typeof params == "string") {
- if (params.indexOf("-----BEGIN ") != -1) {
- this.setByCertPEM(params);
- } else if (params.match(/^[0-9A-Fa-f]+$/)) {
- this.dOtherHash = new nA.DEROctetString({hex: params});
- } else {
- throw "unsupported string value for params";
- }
- } else if (typeof params == "object") {
- if (typeof params.cert == "string") {
- if (typeof params.alg == "string")
- this.alg = params.alg;
- this.setByCertPEM(params.cert);
- } else {
- this.dOtherHash = new nD.OtherHashAlgAndValue(params);
- }
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.cades.OtherHash, KJUR.asn1.ASN1Object);
-
-
-// == BEGIN UTILITIES =====================================================
-
-/**
- * CAdES utiliteis class
- * @name KJUR.asn1.cades.CAdESUtil
- * @class CAdES utilities class
- * @since jsrsasign 4.7.0 asn1cades 1.0.0
- */
-KJUR.asn1.cades.CAdESUtil = new function() {
-};
-/*
- *
- */
-KJUR.asn1.cades.CAdESUtil.addSigTS = function(dCMS, siIdx, sigTSHex) {
-};
-/**
- * parse CMS SignedData to add unsigned attributes
- * @name parseSignedDataForAddingUnsigned
- * @memberOf KJUR.asn1.cades.CAdESUtil
- * @function
- * @param {String} hex hexadecimal string of ContentInfo of CMS SignedData
- * @return {Object} associative array of parsed data
- * @description
- * This method will parse a hexadecimal string of
- * ContentInfo with CMS SignedData to add a attribute
- * to unsigned attributes field in a signerInfo field.
- * Parsed result will be an associative array which has
- * following properties:
- *
- * version - hex of CMSVersion ASN.1 TLV
- * algs - hex of DigestAlgorithms ASN.1 TLV
- * encapcontent - hex of EncapContentInfo ASN.1 TLV
- * certs - hex of Certificates ASN.1 TLV
- * revs - hex of RevocationInfoChoices ASN.1 TLV
- * si[] - array of SignerInfo properties
- * obj - parsed KJUR.asn1.cms.SignedData object
- *
- * @example
- * info = KJUR.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned(beshex);
- * sd = info.obj;
- */
-KJUR.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned = function(hex) {
- var nA = KJUR.asn1;
- var nC = KJUR.asn1.cms;
- var nU = KJUR.asn1.cades.CAdESUtil;
- var r = {};
-
- // 1. not oid signed-data then error
- if (ASN1HEX.getDecendantHexTLVByNthList(hex, 0, [0]) !=
- "06092a864886f70d010702")
- throw "hex is not CMS SignedData";
-
- var iSD = ASN1HEX.getDecendantIndexByNthList(hex, 0, [1, 0]);
- var aSDChildIdx = ASN1HEX.getPosArrayOfChildren_AtObj(hex, iSD);
- if (aSDChildIdx.length < 4)
- throw "num of SignedData elem shall be 4 at least";
-
- // 2. HEXs of SignedData children
- // 2.1. SignedData.CMSVersion
- var iVersion = aSDChildIdx.shift();
- r.version = ASN1HEX.getHexOfTLV_AtObj(hex, iVersion);
-
- // 2.2. SignedData.DigestAlgorithms
- var iAlgs = aSDChildIdx.shift();
- r.algs = ASN1HEX.getHexOfTLV_AtObj(hex, iAlgs);
-
- // 2.3. SignedData.EncapContentInfo
- var iEncapContent = aSDChildIdx.shift();
- r.encapcontent = ASN1HEX.getHexOfTLV_AtObj(hex, iEncapContent);
-
- // 2.4. [0]Certs
- r.certs = null;
- r.revs = null;
- r.si = [];
-
- var iNext = aSDChildIdx.shift();
- if (hex.substr(iNext, 2) == "a0") {
- r.certs = ASN1HEX.getHexOfTLV_AtObj(hex, iNext);
- iNext = aSDChildIdx.shift();
- }
-
- // 2.5. [1]Revs
- if (hex.substr(iNext, 2) == "a1") {
- r.revs = ASN1HEX.getHexOfTLV_AtObj(hex, iNext);
- iNext = aSDChildIdx.shift();
- }
-
- // 2.6. SignerInfos
- var iSignerInfos = iNext;
- if (hex.substr(iSignerInfos, 2) != "31")
- throw "Can't find signerInfos";
-
- var aSIIndex = ASN1HEX.getPosArrayOfChildren_AtObj(hex, iSignerInfos);
- //alert(aSIIndex.join("-"));
-
- for (var i = 0; i < aSIIndex.length; i++) {
- var iSI = aSIIndex[i];
- var pSI = nU.parseSignerInfoForAddingUnsigned(hex, iSI, i);
- r.si[i] = pSI;
- }
-
- // x. obj(SignedData)
- var tmp = null;
- r.obj = new nC.SignedData();
-
- tmp = new nA.ASN1Object();
- tmp.hTLV = r.version;
- r.obj.dCMSVersion = tmp;
-
- tmp = new nA.ASN1Object();
- tmp.hTLV = r.algs;
- r.obj.dDigestAlgs = tmp;
-
- tmp = new nA.ASN1Object();
- tmp.hTLV = r.encapcontent;
- r.obj.dEncapContentInfo = tmp;
-
- tmp = new nA.ASN1Object();
- tmp.hTLV = r.certs;
- r.obj.dCerts = tmp;
-
- r.obj.signerInfoList = [];
- for (var i = 0; i < r.si.length; i++) {
- r.obj.signerInfoList.push(r.si[i].obj);
- }
-
- return r;
-};
-
-/**
- * parse SignerInfo to add unsigned attributes
- * @name parseSignerInfoForAddingUnsigned
- * @memberOf KJUR.asn1.cades.CAdESUtil
- * @function
- * @param {String} hex hexadecimal string of SignerInfo
- * @return {Object} associative array of parsed data
- * @description
- * This method will parse a hexadecimal string of
- * SignerInfo to add a attribute
- * to unsigned attributes field in a signerInfo field.
- * Parsed result will be an associative array which has
- * following properties:
- *
- * version - hex TLV of version
- * si - hex TLV of SignerIdentifier
- * digalg - hex TLV of DigestAlgorithm
- * sattrs - hex TLV of SignedAttributes
- * sigalg - hex TLV of SignatureAlgorithm
- * sig - hex TLV of signature
- * sigval = hex V of signature
- * obj - parsed KJUR.asn1.cms.SignerInfo object
- *
- * NOTE: Parsing of unsigned attributes will be provided in the
- * future version. That's way this version provides support
- * for CAdES-T and not for CAdES-C.
- */
-KJUR.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned =
- function(hex, iSI, nth) {
- var nA = KJUR.asn1;
- var nC = KJUR.asn1.cms;
- var r = {};
- var aSIChildIdx = ASN1HEX.getPosArrayOfChildren_AtObj(hex, iSI);
- //alert(aSIChildIdx.join("="));
-
- if (aSIChildIdx.length != 6)
- throw "not supported items for SignerInfo (!=6)";
-
- // 1. SignerInfo.CMSVersion
- var iVersion = aSIChildIdx.shift();
- r.version = ASN1HEX.getHexOfTLV_AtObj(hex, iVersion);
-
- // 2. SignerIdentifier(IssuerAndSerialNumber)
- var iIdentifier = aSIChildIdx.shift();
- r.si = ASN1HEX.getHexOfTLV_AtObj(hex, iIdentifier);
-
- // 3. DigestAlgorithm
- var iDigestAlg = aSIChildIdx.shift();
- r.digalg = ASN1HEX.getHexOfTLV_AtObj(hex, iDigestAlg);
-
- // 4. SignedAttrs
- var iSignedAttrs = aSIChildIdx.shift();
- r.sattrs = ASN1HEX.getHexOfTLV_AtObj(hex, iSignedAttrs);
-
- // 5. SigAlg
- var iSigAlg = aSIChildIdx.shift();
- r.sigalg = ASN1HEX.getHexOfTLV_AtObj(hex, iSigAlg);
-
- // 6. Signature
- var iSig = aSIChildIdx.shift();
- r.sig = ASN1HEX.getHexOfTLV_AtObj(hex, iSig);
- r.sigval = ASN1HEX.getHexOfV_AtObj(hex, iSig);
-
- // 7. obj(SignerInfo)
- var tmp = null;
- r.obj = new nC.SignerInfo();
-
- tmp = new nA.ASN1Object();
- tmp.hTLV = r.version;
- r.obj.dCMSVersion = tmp;
-
- tmp = new nA.ASN1Object();
- tmp.hTLV = r.si;
- r.obj.dSignerIdentifier = tmp;
-
- tmp = new nA.ASN1Object();
- tmp.hTLV = r.digalg;
- r.obj.dDigestAlgorithm = tmp;
-
- tmp = new nA.ASN1Object();
- tmp.hTLV = r.sattrs;
- r.obj.dSignedAttrs = tmp;
-
- tmp = new nA.ASN1Object();
- tmp.hTLV = r.sigalg;
- r.obj.dSigAlg = tmp;
-
- tmp = new nA.ASN1Object();
- tmp.hTLV = r.sig;
- r.obj.dSig = tmp;
-
- r.obj.dUnsignedAttrs = new nC.AttributeList();
-
- return r;
-};
-
diff --git a/jwt/asn1cms-1.0.js b/jwt/asn1cms-1.0.js
deleted file mode 100755
index 7c3edf8..0000000
--- a/jwt/asn1cms-1.0.js
+++ /dev/null
@@ -1,984 +0,0 @@
-/*! asn1cms-1.0.2.js (c) 2013-2014 Kenji Urushima | kjur.github.com/jsrsasign/license
- */
-/*
- * asn1cms.js - ASN.1 DER encoder classes for Cryptographic Message Syntax(CMS)
- *
- * Copyright (c) 2014 Kenji Urushima (kenji.urushima@gmail.com)
- *
- * This software is licensed under the terms of the MIT License.
- * http://kjur.github.com/jsrsasign/license
- *
- * The above copyright and license notice shall be
- * included in all copies or substantial portions of the Software.
- */
-
-/**
- * @fileOverview
- * @name asn1cms-1.0.js
- * @author Kenji Urushima kenji.urushima@gmail.com
- * @version 1.0.2 (2014-Jun-07)
- * @since jsrsasign 4.2.4
- * @license
MIT License
- */
-
-/**
- * kjur's class library name space
- * // already documented in asn1-1.0.js
- * @name KJUR
- * @namespace kjur's class library name space
- */
-if (typeof KJUR == "undefined" || !KJUR) KJUR = {};
-
-/**
- * kjur's ASN.1 class library name space
- * // already documented in asn1-1.0.js
- * @name KJUR.asn1
- * @namespace
- */
-if (typeof KJUR.asn1 == "undefined" || !KJUR.asn1) KJUR.asn1 = {};
-
-/**
- * kjur's ASN.1 class for Cryptographic Message Syntax(CMS)
- *
- * This name space provides
- * RFC 5652
- * Cryptographic Message Syntax (CMS) SignedData generator.
- *
- *
FEATURES
- *
- * easily generate CMS SignedData
- * APIs are very similar to BouncyCastle library ASN.1 classes. So easy to learn.
- *
- *
- *
PROVIDED CLASSES
- *
- * {@link KJUR.asn1.cms.SignedData}
- * {@link KJUR.asn1.cms.SignerInfo}
- * {@link KJUR.asn1.cms.AttributeList}
- * {@link KJUR.asn1.cms.ContentInfo}
- * {@link KJUR.asn1.cms.EncapsulatedContentInfo}
- * {@link KJUR.asn1.cms.IssuerAndSerialNumber}
- * {@link KJUR.asn1.cms.CMSUtil}
- * {@link KJUR.asn1.cms.Attribute}
- * {@link KJUR.asn1.cms.ContentType}
- * {@link KJUR.asn1.cms.MessageDigest}
- * {@link KJUR.asn1.cms.SigningTime}
- * {@link KJUR.asn1.cms.SigningCertificate}
- * {@link KJUR.asn1.cms.SigningCertificateV2}
- *
- * NOTE: Please ignore method summary and document of this namespace.
- * This caused by a bug of jsdoc2.
- *
- * @name KJUR.asn1.cms
- * @namespace
- */
-if (typeof KJUR.asn1.cms == "undefined" || !KJUR.asn1.cms) KJUR.asn1.cms = {};
-
-/**
- * Attribute class for base of CMS attribute
- * @name KJUR.asn1.cms.Attribute
- * @class Attribute class for base of CMS attribute
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.ASN1Object
- * @since jsrsasign 4.2.4 asn1cms 1.0.0
- * @description
- *
- * Attributes ::= SET OF Attribute
- * Attribute ::= SEQUENCE {
- * type OBJECT IDENTIFIER,
- * values AttributeSetValue }
- * AttributeSetValue ::= SET OF ANY
- *
- */
-KJUR.asn1.cms.Attribute = function(params) {
- KJUR.asn1.cms.Attribute.superclass.constructor.call(this);
- var valueList = []; // array of values
-
- this.getEncodedHex = function() {
- var attrTypeASN1, attrValueASN1, seq;
- attrTypeASN1 = new KJUR.asn1.DERObjectIdentifier({"oid": this.attrTypeOid});
-
- attrValueASN1 = new KJUR.asn1.DERSet({"array": this.valueList});
- try {
- attrValueASN1.getEncodedHex();
- } catch (ex) {
- throw "fail valueSet.getEncodedHex in Attribute(1)/" + ex;
- }
-
- seq = new KJUR.asn1.DERSequence({"array": [attrTypeASN1, attrValueASN1]});
- try {
- this.hTLV = seq.getEncodedHex();
- } catch (ex) {
- throw "failed seq.getEncodedHex in Attribute(2)/" + ex;
- }
-
- return this.hTLV;
- };
-};
-YAHOO.lang.extend(KJUR.asn1.cms.Attribute, KJUR.asn1.ASN1Object);
-
-/**
- * class for CMS ContentType attribute
- * @name KJUR.asn1.cms.ContentType
- * @class class for CMS ContentType attribute
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.cms.Attribute
- * @since jsrsasign 4.2.4 asn1cms 1.0.0
- * @description
- *
- * Attribute ::= SEQUENCE {
- * type OBJECT IDENTIFIER,
- * values AttributeSetValue }
- * AttributeSetValue ::= SET OF ANY
- * ContentType ::= OBJECT IDENTIFIER
- *
- * @example
- * o = new KJUR.asn1.cms.ContentType({name: 'data'});
- * o = new KJUR.asn1.cms.ContentType({oid: '1.2.840.113549.1.9.16.1.4'});
- */
-KJUR.asn1.cms.ContentType = function(params) {
- KJUR.asn1.cms.ContentType.superclass.constructor.call(this);
- this.attrTypeOid = "1.2.840.113549.1.9.3";
- var contentTypeASN1 = null;
-
- if (typeof params != "undefined") {
- var contentTypeASN1 = new KJUR.asn1.DERObjectIdentifier(params);
- this.valueList = [contentTypeASN1];
- }
-};
-YAHOO.lang.extend(KJUR.asn1.cms.ContentType, KJUR.asn1.cms.Attribute);
-
-/**
- * class for CMS MessageDigest attribute
- * @name KJUR.asn1.cms.MessageDigest
- * @class class for CMS MessageDigest attribute
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.cms.Attribute
- * @since jsrsasign 4.2.4 asn1cms 1.0.0
- * @description
- *
- * Attribute ::= SEQUENCE {
- * type OBJECT IDENTIFIER,
- * values AttributeSetValue }
- * AttributeSetValue ::= SET OF ANY
- * MessageDigest ::= OCTET STRING
- *
- * @example
- * o = new KJUR.asn1.cms.MessageDigest({hex: 'a1a2a3a4...'});
- */
-KJUR.asn1.cms.MessageDigest = function(params) {
- KJUR.asn1.cms.MessageDigest.superclass.constructor.call(this);
- this.attrTypeOid = "1.2.840.113549.1.9.4";
-
- if (typeof params != "undefined") {
- if (params.eciObj instanceof KJUR.asn1.cms.EncapsulatedContentInfo &&
- typeof params.hashAlg == "string") {
- var dataHex = params.eciObj.eContentValueHex;
- var hashAlg = params.hashAlg;
- var hashValueHex = KJUR.crypto.Util.hashHex(dataHex, hashAlg);
- var dAttrValue1 = new KJUR.asn1.DEROctetString({hex: hashValueHex});
- dAttrValue1.getEncodedHex();
- this.valueList = [dAttrValue1];
- } else {
- var dAttrValue1 = new KJUR.asn1.DEROctetString(params);
- dAttrValue1.getEncodedHex();
- this.valueList = [dAttrValue1];
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.cms.MessageDigest, KJUR.asn1.cms.Attribute);
-
-/**
- * class for CMS SigningTime attribute
- * @name KJUR.asn1.cms.SigningTime
- * @class class for CMS SigningTime attribute
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.cms.Attribute
- * @since jsrsasign 4.2.4 asn1cms 1.0.0
- * @description
- *
- * Attribute ::= SEQUENCE {
- * type OBJECT IDENTIFIER,
- * values AttributeSetValue }
- * AttributeSetValue ::= SET OF ANY
- * SigningTime ::= Time
- * Time ::= CHOICE {
- * utcTime UTCTime,
- * generalTime GeneralizedTime }
- *
- * @example
- * o = new KJUR.asn1.cms.SigningTime(); // current time UTCTime by default
- * o = new KJUR.asn1.cms.SigningTime({type: 'gen'}); // current time GeneralizedTime
- * o = new KJUR.asn1.cms.SigningTime({str: '20140517093800Z'}); // specified GeneralizedTime
- * o = new KJUR.asn1.cms.SigningTime({str: '140517093800Z'}); // specified UTCTime
- */
-KJUR.asn1.cms.SigningTime = function(params) {
- KJUR.asn1.cms.SigningTime.superclass.constructor.call(this);
- this.attrTypeOid = "1.2.840.113549.1.9.5";
-
- if (typeof params != "undefined") {
- var asn1 = new KJUR.asn1.x509.Time(params);
- try {
- asn1.getEncodedHex();
- } catch (ex) {
- throw "SigningTime.getEncodedHex() failed/" + ex;
- }
- this.valueList = [asn1];
- }
-};
-YAHOO.lang.extend(KJUR.asn1.cms.SigningTime, KJUR.asn1.cms.Attribute);
-
-/**
- * class for CMS SigningCertificate attribute
- * @name KJUR.asn1.cms.SigningCertificate
- * @class class for CMS SigningCertificate attribute
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.cms.Attribute
- * @since jsrsasign 4.5.1 asn1cms 1.0.1
- * @description
- *
- * Attribute ::= SEQUENCE {
- * type OBJECT IDENTIFIER,
- * values AttributeSetValue }
- * AttributeSetValue ::= SET OF ANY
- * SigningCertificate ::= SEQUENCE {
- * certs SEQUENCE OF ESSCertID,
- * policies SEQUENCE OF PolicyInformation OPTIONAL }
- * ESSCertID ::= SEQUENCE {
- * certHash Hash,
- * issuerSerial IssuerSerial OPTIONAL }
- * IssuerSerial ::= SEQUENCE {
- * issuer GeneralNames,
- * serialNumber CertificateSerialNumber }
- *
- * @example
- * o = new KJUR.asn1.cms.SigningCertificate({array: [certPEM]});
- */
-KJUR.asn1.cms.SigningCertificate = function(params) {
- KJUR.asn1.cms.SigningCertificate.superclass.constructor.call(this);
- this.attrTypeOid = "1.2.840.113549.1.9.16.2.12";
- var nA = KJUR.asn1;
- var nC = KJUR.asn1.cms;
- var nY = KJUR.crypto;
-
- this.setCerts = function(listPEM) {
- var list = [];
- for (var i = 0; i < listPEM.length; i++) {
- var hex = KEYUTIL.getHexFromPEM(listPEM[i]);
- var certHashHex = nY.Util.hashHex(hex, 'sha1');
- var dCertHash = new nA.DEROctetString({hex: certHashHex});
- dCertHash.getEncodedHex();
- var dIssuerSerial =
- new nC.IssuerAndSerialNumber({cert: listPEM[i]});
- dIssuerSerial.getEncodedHex();
- var dESSCertID =
- new nA.DERSequence({array: [dCertHash, dIssuerSerial]});
- dESSCertID.getEncodedHex();
- list.push(dESSCertID);
- }
-
- var dValue = new nA.DERSequence({array: list});
- dValue.getEncodedHex();
- this.valueList = [dValue];
- };
-
- if (typeof params != "undefined") {
- if (typeof params.array == "object") {
- this.setCerts(params.array);
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.cms.SigningCertificate, KJUR.asn1.cms.Attribute);
-
-/**
- * class for CMS SigningCertificateV2 attribute
- * @name KJUR.asn1.cms.SigningCertificateV2
- * @class class for CMS SigningCertificateV2 attribute
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.cms.Attribute
- * @since jsrsasign 4.5.1 asn1cms 1.0.1
- * @description
- *
- * oid-signingCertificateV2 = 1.2.840.113549.1.9.16.2.47
- * Attribute ::= SEQUENCE {
- * type OBJECT IDENTIFIER,
- * values AttributeSetValue }
- * AttributeSetValue ::= SET OF ANY
- * SigningCertificateV2 ::= SEQUENCE {
- * certs SEQUENCE OF ESSCertIDv2,
- * policies SEQUENCE OF PolicyInformation OPTIONAL }
- * ESSCertIDv2 ::= SEQUENCE {
- * hashAlgorithm AlgorithmIdentifier
- * DEFAULT {algorithm id-sha256},
- * certHash Hash,
- * issuerSerial IssuerSerial OPTIONAL }
- * Hash ::= OCTET STRING
- * IssuerSerial ::= SEQUENCE {
- * issuer GeneralNames,
- * serialNumber CertificateSerialNumber }
- *
- * @example
- * // hash algorithm is sha256 by default:
- * o = new KJUR.asn1.cms.SigningCertificateV2({array: [certPEM]});
- * o = new KJUR.asn1.cms.SigningCertificateV2({array: [certPEM],
- * hashAlg: 'sha512'});
- */
-KJUR.asn1.cms.SigningCertificateV2 = function(params) {
- KJUR.asn1.cms.SigningCertificateV2.superclass.constructor.call(this);
- this.attrTypeOid = "1.2.840.113549.1.9.16.2.47";
- var nA = KJUR.asn1;
- var nX = KJUR.asn1.x509;
- var nC = KJUR.asn1.cms;
- var nY = KJUR.crypto;
-
- this.setCerts = function(listPEM, hashAlg) {
- var list = [];
- for (var i = 0; i < listPEM.length; i++) {
- var hex = KEYUTIL.getHexFromPEM(listPEM[i]);
-
- var a = [];
- if (hashAlg != "sha256")
- a.push(new nX.AlgorithmIdentifier({name: hashAlg}));
-
- var certHashHex = nY.Util.hashHex(hex, hashAlg);
- var dCertHash = new nA.DEROctetString({hex: certHashHex});
- dCertHash.getEncodedHex();
- a.push(dCertHash);
-
- var dIssuerSerial =
- new nC.IssuerAndSerialNumber({cert: listPEM[i]});
- dIssuerSerial.getEncodedHex();
- a.push(dIssuerSerial);
-
- var dESSCertIDv2 =
- new nA.DERSequence({array: a});
- dESSCertIDv2.getEncodedHex();
- list.push(dESSCertIDv2);
- }
-
- var dValue = new nA.DERSequence({array: list});
- dValue.getEncodedHex();
- this.valueList = [dValue];
- };
-
- if (typeof params != "undefined") {
- if (typeof params.array == "object") {
- var hashAlg = "sha256"; // sha2 default
- if (typeof params.hashAlg == "string")
- hashAlg = params.hashAlg;
- this.setCerts(params.array, hashAlg);
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.cms.SigningCertificateV2, KJUR.asn1.cms.Attribute);
-
-/**
- * class for IssuerAndSerialNumber ASN.1 structure for CMS
- * @name KJUR.asn1.cms.IssuerAndSerialNumber
- * @class class for CMS IssuerAndSerialNumber ASN.1 structure for CMS
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.ASN1Object
- * @since jsrsasign 4.2.4 asn1cms 1.0.0
- * @description
- *
- * IssuerAndSerialNumber ::= SEQUENCE {
- * issuer Name,
- * serialNumber CertificateSerialNumber }
- * CertificateSerialNumber ::= INTEGER
- *
- * @example
- * // specify by X500Name and DERInteger
- * o = new KJUR.asn1.cms.IssuerAndSerialNumber(
- * {issuer: {str: '/C=US/O=T1'}, serial {int: 3}});
- * // specify by PEM certificate
- * o = new KJUR.asn1.cms.IssuerAndSerialNumber({cert: certPEM});
- * o = new KJUR.asn1.cms.IssuerAndSerialNumber(certPEM); // since 1.0.3
- */
-KJUR.asn1.cms.IssuerAndSerialNumber = function(params) {
- KJUR.asn1.cms.IssuerAndSerialNumber.superclass.constructor.call(this);
- var dIssuer = null;
- var dSerial = null;
- var nA = KJUR.asn1;
- var nX = nA.x509;
-
- /*
- * @since asn1cms 1.0.1
- */
- this.setByCertPEM = function(certPEM) {
- var certHex = KEYUTIL.getHexFromPEM(certPEM);
- var x = new X509();
- x.hex = certHex;
- var issuerTLVHex = x.getIssuerHex();
- this.dIssuer = new nX.X500Name();
- this.dIssuer.hTLV = issuerTLVHex;
- var serialVHex = x.getSerialNumberHex();
- this.dSerial = new nA.DERInteger({hex: serialVHex});
- };
-
- this.getEncodedHex = function() {
- var seq = new KJUR.asn1.DERSequence({"array": [this.dIssuer,
- this.dSerial]});
- this.hTLV = seq.getEncodedHex();
- return this.hTLV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params == "string" &&
- params.indexOf("-----BEGIN ") != -1) {
- this.setByCertPEM(params);
- }
- if (params.issuer && params.serial) {
- if (params.issuer instanceof KJUR.asn1.x509.X500Name) {
- this.dIssuer = params.issuer;
- } else {
- this.dIssuer = new KJUR.asn1.x509.X500Name(params.issuer);
- }
- if (params.serial instanceof KJUR.asn1.DERInteger) {
- this.dSerial = params.serial;
- } else {
- this.dSerial = new KJUR.asn1.DERInteger(params.serial);
- }
- }
- if (typeof params.cert == "string") {
- this.setByCertPEM(params.cert);
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.cms.IssuerAndSerialNumber, KJUR.asn1.ASN1Object);
-
-/**
- * class for Attributes ASN.1 structure for CMS
- * @name KJUR.asn1.cms.AttributeList
- * @class class for Attributes ASN.1 structure for CMS
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.ASN1Object
- * @since jsrsasign 4.2.4 asn1cms 1.0.0
- * @description
- *
- * Attributes ::= SET OF Attribute
- * Attribute ::= SEQUENCE {
- * type OBJECT IDENTIFIER,
- * values AttributeSetValue }
- *
- * @example
- * // specify by X500Name and DERInteger
- * o = new KJUR.asn1.cms.AttributeList({sorted: false}); // ASN.1 BER unsorted SET OF
- * o = new KJUR.asn1.cms.AttributeList(); // ASN.1 DER sorted by default
- * o.clear(); // clear list of Attributes
- * n = o.length(); // get number of Attribute
- * o.add(new KJUR.asn1.cms.SigningTime()); // add SigningTime attribute
- * hex = o.getEncodedHex(); // get hex encoded ASN.1 data
- */
-KJUR.asn1.cms.AttributeList = function(params) {
- KJUR.asn1.cms.AttributeList.superclass.constructor.call(this);
- this.list = new Array();
- this.sortFlag = true;
-
- this.add = function(item) {
- if (item instanceof KJUR.asn1.cms.Attribute) {
- this.list.push(item);
- }
- };
-
- this.length = function() {
- return this.list.length;
- };
-
- this.clear = function() {
- this.list = new Array();
- this.hTLV = null;
- this.hV = null;
- };
-
- this.getEncodedHex = function() {
- if (typeof this.hTLV == "string") return this.hTLV;
- var set = new KJUR.asn1.DERSet({array: this.list,
- sortflag: this.sortFlag});
- this.hTLV = set.getEncodedHex();
- return this.hTLV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params.sortflag != "undefined" &&
- params.sortflag == false)
- this.sortFlag = false;
- }
-};
-YAHOO.lang.extend(KJUR.asn1.cms.AttributeList, KJUR.asn1.ASN1Object);
-
-/**
- * class for SignerInfo ASN.1 structure of CMS SignedData
- * @name KJUR.asn1.cms.SignerInfo
- * @class class for Attributes ASN.1 structure of CMS SigndData
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.ASN1Object
- * @since jsrsasign 4.2.4 asn1cms 1.0.0
- * @description
- *
- * SignerInfo ::= SEQUENCE {
- * version CMSVersion,
- * sid SignerIdentifier,
- * digestAlgorithm DigestAlgorithmIdentifier,
- * signedAttrs [0] IMPLICIT SignedAttributes OPTIONAL,
- * signatureAlgorithm SignatureAlgorithmIdentifier,
- * signature SignatureValue,
- * unsignedAttrs [1] IMPLICIT UnsignedAttributes OPTIONAL }
- *
- * @example
- * o = new KJUR.asn1.cms.SignerInfo();
- * o.setSignerIdentifier(certPEMstring);
- * o.dSignedAttrs.add(new KJUR.asn1.cms.ContentType({name: 'data'}));
- * o.dSignedAttrs.add(new KJUR.asn1.cms.MessageDigest({hex: 'a1b2...'}));
- * o.dSignedAttrs.add(new KJUR.asn1.cms.SigningTime());
- * o.sign(privteKeyParam, "SHA1withRSA");
- */
-KJUR.asn1.cms.SignerInfo = function(params) {
- KJUR.asn1.cms.SignerInfo.superclass.constructor.call(this);
- var nA = KJUR.asn1;
- var nC = KJUR.asn1.cms;
- var nX = KJUR.asn1.x509;
-
- this.dCMSVersion = new nA.DERInteger({'int': 1});
- this.dSignerIdentifier = null;
- this.dDigestAlgorithm = null;
- this.dSignedAttrs = new nC.AttributeList();
- this.dSigAlg = null;
- this.dSig = null;
- this.dUnsignedAttrs = new nC.AttributeList();
-
- this.setSignerIdentifier = function(params) {
- if (typeof params == "string" &&
- params.indexOf("CERTIFICATE") != -1 &&
- params.indexOf("BEGIN") != -1 &&
- params.indexOf("END") != -1) {
-
- var certPEM = params;
- this.dSignerIdentifier =
- new nC.IssuerAndSerialNumber({cert: params});
- }
- };
-
- /**
- * set ContentType/MessageDigest/DigestAlgorithms for SignerInfo/SignedData
- * @name setForContentAndHash
- * @memberOf KJUR.asn1.cms.SignerInfo
- * @param {Array} params JSON parameter to set content related field
- * @description
- * This method will specify following fields by a parameters:
- *
- * add ContentType signed attribute by encapContentInfo
- * add MessageDigest signed attribute by encapContentInfo and hashAlg
- * add a hash algorithm used in MessageDigest to digestAlgorithms field of SignedData
- * set a hash algorithm used in MessageDigest to digestAlgorithm field of SignerInfo
- *
- * Argument 'params' is an associative array having following elements:
- *
- * eciObj - {@link KJUR.asn1.cms.EncapsulatedContentInfo} object
- * sdObj - {@link KJUR.asn1.cms.SignedData} object (Option) to set DigestAlgorithms
- * hashAlg - string of hash algorithm name which is used for MessageDigest attribute
- *
- * some of elements can be omited.
- * @example
- * sd = new KJUR.asn1.cms.SignedData();
- * signerInfo.setForContentAndHash({sdObj: sd,
- * eciObj: sd.dEncapContentInfo,
- * hashAlg: 'sha256'});
- */
- this.setForContentAndHash = function(params) {
- if (typeof params != "undefined") {
- if (params.eciObj instanceof KJUR.asn1.cms.EncapsulatedContentInfo) {
- this.dSignedAttrs.add(new nC.ContentType({oid: '1.2.840.113549.1.7.1'}));
- this.dSignedAttrs.add(new nC.MessageDigest({eciObj: params.eciObj,
- hashAlg: params.hashAlg}));
- }
- if (typeof params.sdObj != "undefined" &&
- params.sdObj instanceof KJUR.asn1.cms.SignedData) {
- if (params.sdObj.digestAlgNameList.join(":").indexOf(params.hashAlg) == -1) {
- params.sdObj.digestAlgNameList.push(params.hashAlg);
- }
- }
- if (typeof params.hashAlg == "string") {
- this.dDigestAlgorithm = new nX.AlgorithmIdentifier({name: params.hashAlg});
- }
- }
- };
-
- this.sign = function(keyParam, sigAlg) {
- // set algorithm
- this.dSigAlg = new nX.AlgorithmIdentifier({name: sigAlg});
-
- // set signature
- var data = this.dSignedAttrs.getEncodedHex();
- var prvKey = KEYUTIL.getKey(keyParam);
- var sig = new KJUR.crypto.Signature({alg: sigAlg});
- sig.init(prvKey);
- sig.updateHex(data);
- var sigValHex = sig.sign();
- this.dSig = new nA.DEROctetString({hex: sigValHex});
- };
-
- /*
- * @since asn1cms 1.0.3
- */
- this.addUnsigned = function(attr) {
- this.hTLV = null;
- this.dUnsignedAttrs.hTLV = null;
- this.dUnsignedAttrs.add(attr);
- };
-
- this.getEncodedHex = function() {
- //alert("sattrs.hTLV=" + this.dSignedAttrs.hTLV);
- if (this.dSignedAttrs instanceof KJUR.asn1.cms.AttributeList &&
- this.dSignedAttrs.length() == 0) {
- throw "SignedAttrs length = 0 (empty)";
- }
- var sa = new nA.DERTaggedObject({obj: this.dSignedAttrs,
- tag: 'a0', explicit: false});
- var ua = null;;
- if (this.dUnsignedAttrs.length() > 0) {
- ua = new nA.DERTaggedObject({obj: this.dUnsignedAttrs,
- tag: 'a1', explicit: false});
- }
-
- var items = [
- this.dCMSVersion,
- this.dSignerIdentifier,
- this.dDigestAlgorithm,
- sa,
- this.dSigAlg,
- this.dSig,
- ];
- if (ua != null) items.push(ua);
-
- var seq = new nA.DERSequence({array: items});
- this.hTLV = seq.getEncodedHex();
- return this.hTLV;
- };
-};
-YAHOO.lang.extend(KJUR.asn1.cms.SignerInfo, KJUR.asn1.ASN1Object);
-
-/**
- * class for EncapsulatedContentInfo ASN.1 structure for CMS
- * @name KJUR.asn1.cms.EncapsulatedContentInfo
- * @class class for EncapsulatedContentInfo ASN.1 structure for CMS
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.ASN1Object
- * @since jsrsasign 4.2.4 asn1cms 1.0.0
- * @description
- *
- * EncapsulatedContentInfo ::= SEQUENCE {
- * eContentType ContentType,
- * eContent [0] EXPLICIT OCTET STRING OPTIONAL }
- * ContentType ::= OBJECT IDENTIFIER
- *
- * @example
- * o = new KJUR.asn1.cms.EncapsulatedContentInfo();
- * o.setContentType('1.2.3.4.5'); // specify eContentType by OID
- * o.setContentType('data'); // specify eContentType by name
- * o.setContentValueHex('a1a2a4...'); // specify eContent data by hex string
- * o.setContentValueStr('apple'); // specify eContent data by UTF-8 string
- * // for detached contents (i.e. data not concluded in eContent)
- * o.isDetached = true; // false as default
- */
-KJUR.asn1.cms.EncapsulatedContentInfo = function(params) {
- KJUR.asn1.cms.EncapsulatedContentInfo.superclass.constructor.call(this);
- var nA = KJUR.asn1;
- var nC = KJUR.asn1.cms;
- var nX = KJUR.asn1.x509;
- this.dEContentType = new nA.DERObjectIdentifier({name: 'data'});
- this.dEContent = null;
- this.isDetached = false;
- this.eContentValueHex = null;
-
- this.setContentType = function(nameOrOid) {
- if (nameOrOid.match(/^[0-2][.][0-9.]+$/)) {
- this.dEContentType = new nA.DERObjectIdentifier({oid: nameOrOid});
- } else {
- this.dEContentType = new nA.DERObjectIdentifier({name: nameOrOid});
- }
- };
-
- this.setContentValue = function(params) {
- if (typeof params != "undefined") {
- if (typeof params.hex == "string") {
- this.eContentValueHex = params.hex;
- } else if (typeof params.str == "string") {
- this.eContentValueHex = utf8tohex(params.str);
- }
- }
- };
-
- this.setContentValueHex = function(valueHex) {
- this.eContentValueHex = valueHex;
- };
-
- this.setContentValueStr = function(valueStr) {
- this.eContentValueHex = utf8tohex(valueStr);
- };
-
- this.getEncodedHex = function() {
- if (typeof this.eContentValueHex != "string") {
- throw "eContentValue not yet set";
- }
-
- var dValue = new nA.DEROctetString({hex: this.eContentValueHex});
- this.dEContent = new nA.DERTaggedObject({obj: dValue,
- tag: 'a0',
- explicit: true});
-
- var a = [this.dEContentType];
- if (! this.isDetached) a.push(this.dEContent);
- var seq = new nA.DERSequence({array: a});
- this.hTLV = seq.getEncodedHex();
- return this.hTLV;
- };
-};
-YAHOO.lang.extend(KJUR.asn1.cms.EncapsulatedContentInfo, KJUR.asn1.ASN1Object);
-
-// - type
-// - obj
-/**
- * class for ContentInfo ASN.1 structure for CMS
- * @name KJUR.asn1.cms.ContentInfo
- * @class class for ContentInfo ASN.1 structure for CMS
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.ASN1Object
- * @since jsrsasign 4.2.4 asn1cms 1.0.0
- * @description
- *
- * ContentInfo ::= SEQUENCE {
- * contentType ContentType,
- * content [0] EXPLICIT ANY DEFINED BY contentType }
- * ContentType ::= OBJECT IDENTIFIER
- *
- * @example
- * a = [new KJUR.asn1.DERInteger({int: 1}),
- * new KJUR.asn1.DERInteger({int: 2})];
- * seq = new KJUR.asn1.DERSequence({array: a});
- * o = new KJUR.asn1.cms.ContentInfo({type: 'data', obj: seq});
- */
-KJUR.asn1.cms.ContentInfo = function(params) {
- KJUR.asn1.cms.ContentInfo.superclass.constructor.call(this);
- var nA = KJUR.asn1;
- var nC = KJUR.asn1.cms;
- var nX = KJUR.asn1.x509;
-
- this.dContentType = null;
- this.dContent = null;
-
- this.setContentType = function(params) {
- if (typeof params == "string") {
- this.dContentType = nX.OID.name2obj(params);
- }
- };
-
- this.getEncodedHex = function() {
- var dContent0 = new nA.DERTaggedObject({obj: this.dContent, tag: 'a0', explicit: true});
- var seq = new nA.DERSequence({array: [this.dContentType, dContent0]});
- this.hTLV = seq.getEncodedHex();
- return this.hTLV;
- };
-
- if (typeof params != "undefined") {
- if (params.type) this.setContentType(params.type);
- if (params.obj && params.obj instanceof nA.ASN1Object) this.dContent = params.obj;
- }
-};
-YAHOO.lang.extend(KJUR.asn1.cms.ContentInfo, KJUR.asn1.ASN1Object);
-
-/**
- * class for SignerInfo ASN.1 structure of CMS SignedData
- * @name KJUR.asn1.cms.SignedData
- * @class class for Attributes ASN.1 structure of CMS SigndData
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.ASN1Object
- * @since jsrsasign 4.2.4 asn1cms 1.0.0
- *
- * @description
- *
- * SignedData ::= SEQUENCE {
- * version CMSVersion,
- * digestAlgorithms DigestAlgorithmIdentifiers,
- * encapContentInfo EncapsulatedContentInfo,
- * certificates [0] IMPLICIT CertificateSet OPTIONAL,
- * crls [1] IMPLICIT RevocationInfoChoices OPTIONAL,
- * signerInfos SignerInfos }
- * SignerInfos ::= SET OF SignerInfo
- * CertificateSet ::= SET OF CertificateChoices
- * DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier
- * CertificateSet ::= SET OF CertificateChoices
- * RevocationInfoChoices ::= SET OF RevocationInfoChoice
- *
- *
- * @example
- * sd = new KJUR.asn1.cms.SignedData();
- * sd.dEncapContentInfo.setContentValueStr("test string");
- * sd.signerInfoList[0].setForContentAndHash({sdObj: sd,
- * eciObj: sd.dEncapContentInfo,
- * hashAlg: 'sha256'});
- * sd.signerInfoList[0].dSignedAttrs.add(new KJUR.asn1.cms.SigningTime());
- * sd.signerInfoList[0].setSignerIdentifier(certPEM);
- * sd.signerInfoList[0].sign(prvP8PEM, "SHA256withRSA");
- * hex = sd.getContentInfoEncodedHex();
- */
-KJUR.asn1.cms.SignedData = function(params) {
- KJUR.asn1.cms.SignedData.superclass.constructor.call(this);
- var nA = KJUR.asn1;
- var nC = KJUR.asn1.cms;
- var nX = KJUR.asn1.x509;
-
- this.dCMSVersion = new nA.DERInteger({'int': 1});
- this.dDigestAlgs = null;
- this.digestAlgNameList = [];
- this.dEncapContentInfo = new nC.EncapsulatedContentInfo();
- this.dCerts = null;
- this.certificateList = [];
- this.crlList = [];
- this.signerInfoList = [new nC.SignerInfo()];
-
- this.addCertificatesByPEM = function(certPEM) {
- var hex = KEYUTIL.getHexFromPEM(certPEM);
- var o = new nA.ASN1Object();
- o.hTLV = hex;
- this.certificateList.push(o);
- };
-
- this.getEncodedHex = function() {
- if (typeof this.hTLV == "string") return this.hTLV;
-
- if (this.dDigestAlgs == null) {
- var digestAlgList = [];
- for (var i = 0; i < this.digestAlgNameList.length; i++) {
- var name = this.digestAlgNameList[i];
- var o = new nX.AlgorithmIdentifier({name: name});
- digestAlgList.push(o);
- }
- this.dDigestAlgs = new nA.DERSet({array: digestAlgList});
- }
-
- var a = [this.dCMSVersion,
- this.dDigestAlgs,
- this.dEncapContentInfo];
-
- if (this.dCerts == null) {
- if (this.certificateList.length > 0) {
- var o1 = new nA.DERSet({array: this.certificateList});
- this.dCerts
- = new nA.DERTaggedObject({obj: o1,
- tag: 'a0',
- explicit: false});
- }
- }
- if (this.dCerts != null) a.push(this.dCerts);
-
- var dSignerInfos = new nA.DERSet({array: this.signerInfoList});
- a.push(dSignerInfos);
-
- var seq = new nA.DERSequence({array: a});
- this.hTLV = seq.getEncodedHex();
- return this.hTLV;
- };
-
- this.getContentInfo = function() {
- this.getEncodedHex();
- var ci = new nC.ContentInfo({type: 'signed-data', obj: this});
- return ci;
- };
-
- this.getContentInfoEncodedHex = function() {
- var ci = this.getContentInfo();
- var ciHex = ci.getEncodedHex();
- return ciHex;
- };
-
- this.getPEM = function() {
- var hex = this.getContentInfoEncodedHex();
- var pem = nA.ASN1Util.getPEMStringFromHex(hex, "CMS");
- return pem;
- };
-};
-YAHOO.lang.extend(KJUR.asn1.cms.SignedData, KJUR.asn1.ASN1Object);
-
-/**
- * CMS utiliteis class
- * @name KJUR.asn1.cms.CMSUtil
- * @class CMS utilities class
- */
-KJUR.asn1.cms.CMSUtil = new function() {
-};
-/**
- * generate SignedData object specified by JSON parameters
- * @name newSignedData
- * @memberOf KJUR.asn1.cms.CMSUtil
- * @function
- * @param {Array} param JSON parameter to generate CMS SignedData
- * @return {KJUR.asn1.cms.SignedData} object just generated
- * @description
- * This method provides more easy way to genereate
- * CMS SignedData ASN.1 structure by JSON data.
- * @example
- * var sd = KJUR.asn1.cms.CMSUtil.newSignedData({
- * content: {str: "jsrsasign"},
- * certs: [certPEM],
- * signerInfos: [{
- * hashAlg: 'sha256',
- * sAttr: {
- * SigningTime: {}
- * SigningCertificateV2: {array: [certPEM]},
- * },
- * signerCert: certPEM,
- * sigAlg: 'SHA256withRSA',
- * signerPrvKey: prvPEM
- * }]
- * });
- */
-KJUR.asn1.cms.CMSUtil.newSignedData = function(param) {
- var nC = KJUR.asn1.cms;
- var nE = KJUR.asn1.cades;
- var sd = new nC.SignedData();
-
- sd.dEncapContentInfo.setContentValue(param.content);
-
- if (typeof param.certs == "object") {
- for (var i = 0; i < param.certs.length; i++) {
- sd.addCertificatesByPEM(param.certs[i]);
- }
- }
-
- sd.signerInfoList = [];
- for (var i = 0; i < param.signerInfos.length; i++) {
- var siParam = param.signerInfos[i];
- var si = new nC.SignerInfo();
- si.setSignerIdentifier(siParam.signerCert);
-
- si.setForContentAndHash({sdObj: sd,
- eciObj: sd.dEncapContentInfo,
- hashAlg: siParam.hashAlg});
-
- for (attrName in siParam.sAttr) {
- var attrParam = siParam.sAttr[attrName];
- if (attrName == "SigningTime") {
- var attr = new nC.SigningTime(attrParam);
- si.dSignedAttrs.add(attr);
- }
- if (attrName == "SigningCertificate") {
- var attr = new nC.SigningCertificate(attrParam);
- si.dSignedAttrs.add(attr);
- }
- if (attrName == "SigningCertificateV2") {
- var attr = new nC.SigningCertificateV2(attrParam);
- si.dSignedAttrs.add(attr);
- }
- if (attrName == "SignaturePolicyIdentifier") {
- var attr = new nE.SignaturePolicyIdentifier(attrParam);
- si.dSignedAttrs.add(attr);
- }
- }
-
- si.sign(siParam.signerPrvKey, siParam.sigAlg);
- sd.signerInfoList.push(si);
- }
-
- return sd;
-};
-
diff --git a/jwt/asn1csr-1.0.js b/jwt/asn1csr-1.0.js
deleted file mode 100644
index 34486c6..0000000
--- a/jwt/asn1csr-1.0.js
+++ /dev/null
@@ -1,310 +0,0 @@
-/*! asn1csr-1.0.0.js (c) 2015 Kenji Urushima | kjur.github.com/jsrsasign/license
- */
-/*
- * asn1csr.js - ASN.1 DER encoder classes for PKCS#10 CSR
- *
- * Copyright (c) 2015 Kenji Urushima (kenji.urushima@gmail.com)
- *
- * This software is licensed under the terms of the MIT License.
- * http://kjur.github.com/jsrsasign/license
- *
- * The above copyright and license notice shall be
- * included in all copies or substantial portions of the Software.
- */
-
-/**
- * @fileOverview
- * @name asn1csr-1.0.js
- * @author Kenji Urushima kenji.urushima@gmail.com
- * @version 1.0.0 (2015-Sep-12)
- * @since jsrsasign 4.8.7
- * @license
MIT License
- */
-
-/**
- * kjur's ASN.1 class for CSR/PKCS#10 name space
- *
- * This name space is a sub name space for {@link KJUR.asn1}.
- * This name space contains classes for
- * RFC 2986
- * certificate signing request(CSR/PKCS#10) and its utilities
- * to be issued your certificate from certification authorities.
- *
PROVIDING ASN.1 STRUCTURES
- *
- * {@link KJUR.asn1.csr.CertificationRequest}
- * {@link KJUR.asn1.csr.CertificationRequestInfo}
- *
- *
PROVIDING UTILITY CLASSES
- *
- * {@link KJUR.asn1.csr.CSRUtil}
- *
- * {@link KJUR.asn1.csr.CSRUtil.newCSRPEM} method is very useful to
- * get your certificate signing request (CSR/PKCS#10) file.
- *
- * @name KJUR.asn1.csr
- * @namespace
- */
-if (typeof KJUR.asn1.csr == "undefined" || !KJUR.asn1.csr) KJUR.asn1.csr = {};
-
-/**
- * ASN.1 CertificationRequest structure class
- * @name KJUR.asn1.csr.CertificationRequest
- * @class ASN.1 CertificationRequest structure class
- * @param {Array} params associative array of parameters (ex. {})
- * @extends KJUR.asn1.ASN1Object
- * @since jsrsasign 4.8.7 asn1csr 1.0.0
- * @description
- *
- * @example
- * csri = new KJUR.asn1.csr.CertificationRequestInfo();
- * csri.setSubjectByParam({'str': '/C=US/O=Test/CN=example.com'});
- * csri.setSubjectPublicKeyByGetKey(pubKeyObj);
- * csr = new KJUR.asn1.csr.CertificationRequest({'csrinfo': csri});
- * csr.sign("SHA256withRSA", prvKeyObj);
- * pem = csr.getPEMString();
- *
- * // -- DEFINITION OF ASN.1 SYNTAX --
- * // CertificationRequest ::= SEQUENCE {
- * // certificationRequestInfo CertificationRequestInfo,
- * // signatureAlgorithm AlgorithmIdentifier{{ SignatureAlgorithms }},
- * // signature BIT STRING }
- */
-KJUR.asn1.csr.CertificationRequest = function(params) {
- KJUR.asn1.csr.CertificationRequest.superclass.constructor.call(this);
- var asn1CSRInfo = null;
- var asn1SignatureAlg = null;
- var asn1Sig = null;
- var hexSig = null;
- var prvKey = null;
-
- /**
- * sign CertificationRequest and set signature value internally
- * @name sign
- * @memberOf KJUR.asn1.csr.CertificationRequest
- * @function
- * @description
- * This method self-signs CertificateRequestInfo with a subject's
- * private key and set signature value internally.
- *
- * @example
- * csr = new KJUR.asn1.csr.CertificationRequest({'csrinfo': csri});
- * csr.sign("SHA256withRSA", prvKeyObj);
- */
- this.sign = function(sigAlgName, prvKeyObj) {
- if (this.prvKey == null) this.prvKey = prvKeyObj;
-
- this.asn1SignatureAlg =
- new KJUR.asn1.x509.AlgorithmIdentifier({'name': sigAlgName});
-
- sig = new KJUR.crypto.Signature({'alg': sigAlgName});
- sig.initSign(this.prvKey);
- sig.updateHex(this.asn1CSRInfo.getEncodedHex());
- this.hexSig = sig.sign();
-
- this.asn1Sig = new KJUR.asn1.DERBitString({'hex': '00' + this.hexSig});
- var seq = new KJUR.asn1.DERSequence({'array': [this.asn1CSRInfo,
- this.asn1SignatureAlg,
- this.asn1Sig]});
- this.hTLV = seq.getEncodedHex();
- this.isModified = false;
- };
-
- /**
- * get PEM formatted certificate signing request (CSR/PKCS#10)
- * @name getPEMString
- * @memberOf KJUR.asn1.csr.CertificationRequest
- * @function
- * @return PEM formatted string of CSR/PKCS#10
- * @description
- * This method is to a get CSR PEM string after signed.
- *
- * @example
- * csr = new KJUR.asn1.csr.CertificationRequest({'csrinfo': csri});
- * csr.sign();
- * pem = csr.getPEMString();
- * // pem will be following:
- * // -----BEGIN CERTIFICATE REQUEST-----
- * // MII ...snip...
- * // -----END CERTIFICATE REQUEST-----
- */
- this.getPEMString = function() {
- var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex(this.getEncodedHex(),
- "CERTIFICATE REQUEST");
- return pem;
- };
-
- this.getEncodedHex = function() {
- if (this.isModified == false && this.hTLV != null) return this.hTLV;
- throw "not signed yet";
- };
-
- if (typeof params != "undefined") {
- if (typeof params['csrinfo'] != "undefined") {
- this.asn1CSRInfo = params['csrinfo'];
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.csr.CertificationRequest, KJUR.asn1.ASN1Object);
-
-/**
- * ASN.1 CertificationRequestInfo structure class
- * @name KJUR.asn1.csr.CertificationRequestInfo
- * @class ASN.1 CertificationRequestInfo structure class
- * @param {Array} params associative array of parameters (ex. {})
- * @extends KJUR.asn1.ASN1Object
- * @since jsrsasign 4.8.7 asn1csr 1.0.0
- * @description
- *
- * @example
- * csri = new KJUR.asn1.csr.CertificationRequestInfo();
- * csri.setSubjectByParam({'str': '/C=US/O=Test/CN=example.com'});
- * csri.setSubjectPublicKeyByGetKey(pubKeyObj);
- *
- * // -- DEFINITION OF ASN.1 SYNTAX --
- * // CertificationRequestInfo ::= SEQUENCE {
- * // version INTEGER { v1(0) } (v1,...),
- * // subject Name,
- * // subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }},
- * // attributes [0] Attributes{{ CRIAttributes }} }
- *
- */
-KJUR.asn1.csr.CertificationRequestInfo = function(params) {
- KJUR.asn1.csr.CertificationRequestInfo.superclass.constructor.call(this);
-
- this._initialize = function() {
- this.asn1Array = new Array();
-
- this.asn1Version = new KJUR.asn1.DERInteger({'int': 0});
- this.asn1Subject = null;
- this.asn1SubjPKey = null;
- this.extensionsArray = new Array();
- };
-
- /**
- * set subject name field by parameter
- * @name setSubjectByParam
- * @memberOf KJUR.asn1.csr.CertificationRequestInfo
- * @function
- * @param {Array} x500NameParam X500Name parameter
- * @description
- * @example
- * csri.setSubjectByParam({'str': '/C=US/CN=b'});
- * @see KJUR.asn1.x509.X500Name
- */
- this.setSubjectByParam = function(x500NameParam) {
- this.asn1Subject = new KJUR.asn1.x509.X500Name(x500NameParam);
- };
-
- /**
- * set subject public key info by RSA/ECDSA/DSA key parameter
- * @name setSubjectPublicKeyByGetKey
- * @memberOf KJUR.asn1.csr.CertificationRequestInfo
- * @function
- * @param {Object} keyParam public key parameter which passed to {@link KEYUTIL.getKey} argument
- * @description
- * @example
- * csri.setSubjectPublicKeyByGetKeyParam(certPEMString); // or
- * csri.setSubjectPublicKeyByGetKeyParam(pkcs8PublicKeyPEMString); // or
- * csir.setSubjectPublicKeyByGetKeyParam(kjurCryptoECDSAKeyObject); // et.al.
- * @see KJUR.asn1.x509.SubjectPublicKeyInfo
- * @see KEYUTIL.getKey
- */
- this.setSubjectPublicKeyByGetKey = function(keyParam) {
- var keyObj = KEYUTIL.getKey(keyParam);
- this.asn1SubjPKey = new KJUR.asn1.x509.SubjectPublicKeyInfo(keyObj);
- };
-
- this.getEncodedHex = function() {
- this.asn1Array = new Array();
-
- this.asn1Array.push(this.asn1Version);
- this.asn1Array.push(this.asn1Subject);
- this.asn1Array.push(this.asn1SubjPKey);
-
- var extSeq = new KJUR.asn1.DERSequence({"array": this.extensionsArray});
- var extTagObj = new KJUR.asn1.DERTaggedObject({'explicit': false,
- 'tag': 'a0',
- 'obj': extSeq});
- this.asn1Array.push(extTagObj);
-
- var o = new KJUR.asn1.DERSequence({"array": this.asn1Array});
- this.hTLV = o.getEncodedHex();
- this.isModified = false;
- return this.hTLV;
- };
-
- this._initialize();
-};
-YAHOO.lang.extend(KJUR.asn1.csr.CertificationRequestInfo, KJUR.asn1.ASN1Object);
-
-/**
- * Certification Request (CSR/PKCS#10) utilities class
- * @name KJUR.asn1.csr.CSRUtil
- * @class Certification Request (CSR/PKCS#10) utilities class
- */
-KJUR.asn1.csr.CSRUtil = new function() {
-};
-
-/**
- * generate a PEM format of CSR/PKCS#10 certificate signing request
- * @name newCSRPEM
- * @memberOf KJUR.asn1.csr.CSRUtil
- * @function
- * @param {Array} param parameter to generate CSR
- * @since jsrsasign 4.8.7 asn1csr 1.0.0
- * @description
- * This method can generate a CSR certificate signing
- * request by a simple JSON object which has following parameters:
- *
- * subject - parameter to be passed to {@link KJUR.asn1.x509.X500Name}
- * sbjpubkey - parameter to be passed to {@link KEYUTIL.getKey}
- * sigalg - signature algorithm name (ex. SHA256withRSA)
- * sbjprvkey - parameter to be passed to {@link KEYUTIL.getKey}
- *
- *
- * @example
- * // 1) by key object
- * pem = KJUR.asn1.csr.CSRUtil.newCSRPEM({
- * subject: {str: '/C=US/O=Test/CN=example.com'},
- * sbjpubkey: pubKeyObj,
- * sigalg: "SHA256withRSA",
- * sbjprvkey: prvKeyObj
- * });
- *
- * // 2) by private/public key PEM
- * pem = KJUR.asn1.csr.CSRUtil.newCSRPEM({
- * subject: {str: '/C=US/O=Test/CN=example.com'},
- * sbjpubkey: pubKeyPEM,
- * sigalg: "SHA256withRSA",
- * sbjprvkey: prvKeyPEM
- * });
- *
- * // 3) with generateKeypair
- * kp = KEYUTIL.generateKeypair("RSA", 2048);
- * pem = KJUR.asn1.csr.CSRUtil.newCSRPEM({
- * subject: {str: '/C=US/O=Test/CN=example.com'},
- * sbjpubkey: kp.pubKeyObj,
- * sigalg: "SHA256withRSA",
- * sbjprvkey: kp.prvKeyObj
- * });
- */
-KJUR.asn1.csr.CSRUtil.newCSRPEM = function(param) {
- var ns1 = KJUR.asn1.csr;
-
- if (param.subject === undefined) throw "parameter subject undefined";
- if (param.sbjpubkey === undefined) throw "parameter sbjpubkey undefined";
- if (param.sigalg === undefined) throw "parameter sigalg undefined";
- if (param.sbjprvkey === undefined) throw "parameter sbjpubkey undefined";
-
- var csri = new ns1.CertificationRequestInfo();
- csri.setSubjectByParam(param.subject);
- csri.setSubjectPublicKeyByGetKey(param.sbjpubkey);
-
- var csr = new ns1.CertificationRequest({'csrinfo': csri});
- var prvKey = KEYUTIL.getKey(param.sbjprvkey);
- csr.sign(param.sigalg, prvKey);
-
- var pem = csr.getPEMString();
- return pem;
-};
-
diff --git a/jwt/asn1hex-1.1.js b/jwt/asn1hex-1.1.js
deleted file mode 100644
index 6b665d2..0000000
--- a/jwt/asn1hex-1.1.js
+++ /dev/null
@@ -1,605 +0,0 @@
-/*! asn1hex-1.1.6.js (c) 2012-2016 Kenji Urushima | kjur.github.com/jsrsasign/license
- */
-/*
- * asn1hex.js - Hexadecimal represented ASN.1 string library
- *
- * Copyright (c) 2010-2016 Kenji Urushima (kenji.urushima@gmail.com)
- *
- * This software is licensed under the terms of the MIT License.
- * http://kjur.github.com/jsrsasign/license/
- *
- * The above copyright and license notice shall be
- * included in all copies or substantial portions of the Software.
- */
-
-/**
- * @fileOverview
- * @name asn1hex-1.1.js
- * @author Kenji Urushima kenji.urushima@gmail.com
- * @version asn1hex 1.1.6 (2015-Jun-11)
- * @license
MIT License
- */
-
-/*
- * MEMO:
- * f('3082025b02...', 2) ... 82025b ... 3bytes
- * f('020100', 2) ... 01 ... 1byte
- * f('0203001...', 2) ... 03 ... 1byte
- * f('02818003...', 2) ... 8180 ... 2bytes
- * f('3080....0000', 2) ... 80 ... -1
- *
- * Requirements:
- * - ASN.1 type octet length MUST be 1.
- * (i.e. ASN.1 primitives like SET, SEQUENCE, INTEGER, OCTETSTRING ...)
- */
-
-/**
- * ASN.1 DER encoded hexadecimal string utility class
- * @name ASN1HEX
- * @class ASN.1 DER encoded hexadecimal string utility class
- * @since jsrsasign 1.1
- * @description
- * This class provides a parser for hexadecimal string of
- * DER encoded ASN.1 binary data.
- * Here are major methods of this class.
- *
- * ACCESS BY POSITION
- *
- * {@link ASN1HEX.getHexOfTLV_AtObj} - get ASN.1 TLV at specified position
- * {@link ASN1HEX.getHexOfV_AtObj} - get ASN.1 V at specified position
- * {@link ASN1HEX.getHexOfL_AtObj} - get hexadecimal ASN.1 L at specified position
- * {@link ASN1HEX.getIntOfL_AtObj} - get integer ASN.1 L at specified position
- * {@link ASN1HEX.getStartPosOfV_AtObj} - get ASN.1 V position from its ASN.1 TLV position
- *
- *
- * ACCESS FOR CHILD ITEM
- *
- * {@link ASN1HEX.getNthChildIndex_AtObj} - get nth child index at specified position
- * {@link ASN1HEX.getPosArrayOfChildren_AtObj} - get indexes of children
- * {@link ASN1HEX.getPosOfNextSibling_AtObj} - get position of next sibling
- *
- *
- * ACCESS NESTED ASN.1 STRUCTURE
- *
- * {@link ASN1HEX.getDecendantHexTLVByNthList} - get ASN.1 TLV at specified list index
- * {@link ASN1HEX.getDecendantHexVByNthList} - get ASN.1 V at specified list index
- * {@link ASN1HEX.getDecendantIndexByNthList} - get index at specified list index
- *
- *
- * UTILITIES
- *
- * {@link ASN1HEX.dump} - dump ASN.1 structure
- * {@link ASN1HEX.isASN1HEX} - check whether ASN.1 hexadecimal string or not
- * {@link ASN1HEX.hextooidstr} - convert hexadecimal string of OID to dotted integer list
- *
- *
- *
- */
-var ASN1HEX = new function() {
- /**
- * get byte length for ASN.1 L(length) bytes
- * @name getByteLengthOfL_AtObj
- * @memberOf ASN1HEX
- * @function
- * @param {String} s hexadecimal string of ASN.1 DER encoded data
- * @param {Number} pos string index
- * @return byte length for ASN.1 L(length) bytes
- */
- this.getByteLengthOfL_AtObj = function(s, pos) {
- if (s.substring(pos + 2, pos + 3) != '8') return 1;
- var i = parseInt(s.substring(pos + 3, pos + 4));
- if (i == 0) return -1; // length octet '80' indefinite length
- if (0 < i && i < 10) return i + 1; // including '8?' octet;
- return -2; // malformed format
- };
-
- /**
- * get hexadecimal string for ASN.1 L(length) bytes
- * @name getHexOfL_AtObj
- * @memberOf ASN1HEX
- * @function
- * @param {String} s hexadecimal string of ASN.1 DER encoded data
- * @param {Number} pos string index
- * @return {String} hexadecimal string for ASN.1 L(length) bytes
- */
- this.getHexOfL_AtObj = function(s, pos) {
- var len = this.getByteLengthOfL_AtObj(s, pos);
- if (len < 1) return '';
- return s.substring(pos + 2, pos + 2 + len * 2);
- };
-
- // getting ASN.1 length value at the position 'idx' of
- // hexa decimal string 's'.
- //
- // f('3082025b02...', 0) ... 82025b ... ???
- // f('020100', 0) ... 01 ... 1
- // f('0203001...', 0) ... 03 ... 3
- // f('02818003...', 0) ... 8180 ... 128
- /**
- * get integer value of ASN.1 length for ASN.1 data
- * @name getIntOfL_AtObj
- * @memberOf ASN1HEX
- * @function
- * @param {String} s hexadecimal string of ASN.1 DER encoded data
- * @param {Number} pos string index
- * @return ASN.1 L(length) integer value
- */
- this.getIntOfL_AtObj = function(s, pos) {
- var hLength = this.getHexOfL_AtObj(s, pos);
- if (hLength == '') return -1;
- var bi;
- if (parseInt(hLength.substring(0, 1)) < 8) {
- bi = new BigInteger(hLength, 16);
- } else {
- bi = new BigInteger(hLength.substring(2), 16);
- }
- return bi.intValue();
- };
-
- /**
- * get ASN.1 value starting string position for ASN.1 object refered by index 'idx'.
- * @name getStartPosOfV_AtObj
- * @memberOf ASN1HEX
- * @function
- * @param {String} s hexadecimal string of ASN.1 DER encoded data
- * @param {Number} pos string index
- */
- this.getStartPosOfV_AtObj = function(s, pos) {
- var l_len = this.getByteLengthOfL_AtObj(s, pos);
- if (l_len < 0) return l_len;
- return pos + (l_len + 1) * 2;
- };
-
- /**
- * get hexadecimal string of ASN.1 V(value)
- * @name getHexOfV_AtObj
- * @memberOf ASN1HEX
- * @function
- * @param {String} s hexadecimal string of ASN.1 DER encoded data
- * @param {Number} pos string index
- * @return {String} hexadecimal string of ASN.1 value.
- */
- this.getHexOfV_AtObj = function(s, pos) {
- var pos1 = this.getStartPosOfV_AtObj(s, pos);
- var len = this.getIntOfL_AtObj(s, pos);
- return s.substring(pos1, pos1 + len * 2);
- };
-
- /**
- * get hexadecimal string of ASN.1 TLV at
- * @name getHexOfTLV_AtObj
- * @memberOf ASN1HEX
- * @function
- * @param {String} s hexadecimal string of ASN.1 DER encoded data
- * @param {Number} pos string index
- * @return {String} hexadecimal string of ASN.1 TLV.
- * @since 1.1
- */
- this.getHexOfTLV_AtObj = function(s, pos) {
- var hT = s.substr(pos, 2);
- var hL = this.getHexOfL_AtObj(s, pos);
- var hV = this.getHexOfV_AtObj(s, pos);
- return hT + hL + hV;
- };
-
- /**
- * get next sibling starting index for ASN.1 object string
- * @name getPosOfNextSibling_AtObj
- * @memberOf ASN1HEX
- * @function
- * @param {String} s hexadecimal string of ASN.1 DER encoded data
- * @param {Number} pos string index
- * @return next sibling starting index for ASN.1 object string
- */
- this.getPosOfNextSibling_AtObj = function(s, pos) {
- var pos1 = this.getStartPosOfV_AtObj(s, pos);
- var len = this.getIntOfL_AtObj(s, pos);
- return pos1 + len * 2;
- };
-
- /**
- * get array of indexes of child ASN.1 objects
- * @name getPosArrayOfChildren_AtObj
- * @memberOf ASN1HEX
- * @function
- * @param {String} s hexadecimal string of ASN.1 DER encoded data
- * @param {Number} start string index of ASN.1 object
- * @return {Array of Number} array of indexes for childen of ASN.1 objects
- */
- this.getPosArrayOfChildren_AtObj = function(h, pos) {
- var a = new Array();
- var p0 = this.getStartPosOfV_AtObj(h, pos);
- a.push(p0);
-
- var len = this.getIntOfL_AtObj(h, pos);
- var p = p0;
- var k = 0;
- while (1) {
- var pNext = this.getPosOfNextSibling_AtObj(h, p);
- if (pNext == null || (pNext - p0 >= (len * 2))) break;
- if (k >= 200) break;
-
- a.push(pNext);
- p = pNext;
-
- k++;
- }
-
- return a;
- };
-
- /**
- * get string index of nth child object of ASN.1 object refered by h, idx
- * @name getNthChildIndex_AtObj
- * @memberOf ASN1HEX
- * @function
- * @param {String} h hexadecimal string of ASN.1 DER encoded data
- * @param {Number} idx start string index of ASN.1 object
- * @param {Number} nth for child
- * @return {Number} string index of nth child.
- * @since 1.1
- */
- this.getNthChildIndex_AtObj = function(h, idx, nth) {
- var a = this.getPosArrayOfChildren_AtObj(h, idx);
- return a[nth];
- };
-
- // ========== decendant methods ==============================
- /**
- * get string index of nth child object of ASN.1 object refered by h, idx
- * @name getDecendantIndexByNthList
- * @memberOf ASN1HEX
- * @function
- * @param {String} h hexadecimal string of ASN.1 DER encoded data
- * @param {Number} currentIndex start string index of ASN.1 object
- * @param {Array of Number} nthList array list of nth
- * @return {Number} string index refered by nthList
- * @since 1.1
- * @example
- * The "nthList" is a index list of structured ASN.1 object
- * reference. Here is a sample structure and "nthList"s which
- * refers each objects.
- *
- * SQUENCE -
- * SEQUENCE - [0]
- * IA5STRING 000 - [0, 0]
- * UTF8STRING 001 - [0, 1]
- * SET - [1]
- * IA5STRING 010 - [1, 0]
- * UTF8STRING 011 - [1, 1]
- */
- this.getDecendantIndexByNthList = function(h, currentIndex, nthList) {
- if (nthList.length == 0) {
- return currentIndex;
- }
- var firstNth = nthList.shift();
- var a = this.getPosArrayOfChildren_AtObj(h, currentIndex);
- return this.getDecendantIndexByNthList(h, a[firstNth], nthList);
- };
-
- /**
- * get hexadecimal string of ASN.1 TLV refered by current index and nth index list.
- * @name getDecendantHexTLVByNthList
- * @memberOf ASN1HEX
- * @function
- * @param {String} h hexadecimal string of ASN.1 DER encoded data
- * @param {Number} currentIndex start string index of ASN.1 object
- * @param {Array of Number} nthList array list of nth
- * @return {Number} hexadecimal string of ASN.1 TLV refered by nthList
- * @since 1.1
- */
- this.getDecendantHexTLVByNthList = function(h, currentIndex, nthList) {
- var idx = this.getDecendantIndexByNthList(h, currentIndex, nthList);
- return this.getHexOfTLV_AtObj(h, idx);
- };
-
- /**
- * get hexadecimal string of ASN.1 V refered by current index and nth index list.
- * @name getDecendantHexVByNthList
- * @memberOf ASN1HEX
- * @function
- * @param {String} h hexadecimal string of ASN.1 DER encoded data
- * @param {Number} currentIndex start string index of ASN.1 object
- * @param {Array of Number} nthList array list of nth
- * @return {Number} hexadecimal string of ASN.1 V refered by nthList
- * @since 1.1
- */
- this.getDecendantHexVByNthList = function(h, currentIndex, nthList) {
- var idx = this.getDecendantIndexByNthList(h, currentIndex, nthList);
- return this.getHexOfV_AtObj(h, idx);
- };
-};
-
-/*
- * @since asn1hex 1.1.4
- */
-ASN1HEX.getVbyList = function(h, currentIndex, nthList, checkingTag) {
- var idx = this.getDecendantIndexByNthList(h, currentIndex, nthList);
- if (idx === undefined) {
- throw "can't find nthList object";
- }
- if (checkingTag !== undefined) {
- if (h.substr(idx, 2) != checkingTag) {
- throw "checking tag doesn't match: " +
- h.substr(idx,2) + "!=" + checkingTag;
- }
- }
- return this.getHexOfV_AtObj(h, idx);
-};
-
-/**
- * get OID string from hexadecimal encoded value
- * @name hextooidstr
- * @memberOf ASN1HEX
- * @function
- * @param {String} hex hexadecmal string of ASN.1 DER encoded OID value
- * @return {String} OID string (ex. '1.2.3.4.567')
- * @since asn1hex 1.1.5
- */
-ASN1HEX.hextooidstr = function(hex) {
- var zeroPadding = function(s, len) {
- if (s.length >= len) return s;
- return new Array(len - s.length + 1).join('0') + s;
- };
-
- var a = [];
-
- // a[0], a[1]
- var hex0 = hex.substr(0, 2);
- var i0 = parseInt(hex0, 16);
- a[0] = new String(Math.floor(i0 / 40));
- a[1] = new String(i0 % 40);
-
- // a[2]..a[n]
- var hex1 = hex.substr(2);
- var b = [];
- for (var i = 0; i < hex1.length / 2; i++) {
- b.push(parseInt(hex1.substr(i * 2, 2), 16));
- }
- var c = [];
- var cbin = "";
- for (var i = 0; i < b.length; i++) {
- if (b[i] & 0x80) {
- cbin = cbin + zeroPadding((b[i] & 0x7f).toString(2), 7);
- } else {
- cbin = cbin + zeroPadding((b[i] & 0x7f).toString(2), 7);
- c.push(new String(parseInt(cbin, 2)));
- cbin = "";
- }
- }
-
- var s = a.join(".");
- if (c.length > 0) s = s + "." + c.join(".");
- return s;
-};
-
-/**
- * get string of simple ASN.1 dump from hexadecimal ASN.1 data
- * @name dump
- * @memberOf ASN1HEX
- * @function
- * @param {String} hex hexadecmal string of ASN.1 data
- * @param {Array} associative array of flags for dump (OPTION)
- * @param {Number} idx string index for starting dump (OPTION)
- * @param {String} indent string (OPTION)
- * @return {String} string of simple ASN.1 dump
- * @since jsrsasign 4.8.3 asn1hex 1.1.6
- * @description
- * This method will get an ASN.1 dump from
- * hexadecmal string of ASN.1 DER encoded data.
- * Here are features:
- *
- * ommit long hexadecimal string
- * dump encapsulated OCTET STRING (good for X.509v3 extensions)
- * structured/primitive context specific tag support (i.e. [0], [3] ...)
- * automatic decode for implicit primitive context specific tag
- * (good for X.509v3 extension value)
- *
- * if hex starts '68747470'(i.e. http) it is decoded as utf8 encoded string.
- * if it is in 'subjectAltName' extension value and is '[2]'(dNSName) tag
- * value will be encoded as utf8 string
- * otherwise it shows as hexadecimal string
- *
- *
- *
- * @example
- * // ASN.1 INTEGER
- * ASN1HEX.dump('0203012345')
- * ↓
- * INTEGER 012345
- *
- * // ASN.1 Object Identifier
- * ASN1HEX.dump('06052b0e03021a')
- * ↓
- * ObjectIdentifier sha1 (1 3 14 3 2 26)
- *
- * // ASN.1 SEQUENCE
- * ASN1HEX.dump('3006020101020102')
- * ↓
- * SEQUENCE
- * INTEGER 01
- * INTEGER 02
- *
- * // ASN.1 DUMP FOR X.509 CERTIFICATE
- * ASN1HEX.dump(X509.pemToHex(certPEM))
- * ↓
- * SEQUENCE
- * SEQUENCE
- * [0]
- * INTEGER 02
- * INTEGER 0c009310d206dbe337553580118ddc87
- * SEQUENCE
- * ObjectIdentifier SHA256withRSA (1 2 840 113549 1 1 11)
- * NULL
- * SEQUENCE
- * SET
- * SEQUENCE
- * ObjectIdentifier countryName (2 5 4 6)
- * PrintableString 'US'
- * :
- */
-ASN1HEX.dump = function(hex, flags, idx, indent) {
- var _skipLongHex = function(hex, limitNumOctet) {
- if (hex.length <= limitNumOctet * 2) {
- return hex;
- } else {
- var s = hex.substr(0, limitNumOctet) +
- "..(total " + hex.length / 2 + "bytes).." +
- hex.substr(hex.length - limitNumOctet, limitNumOctet);
- return s;
- };
- };
-
- if (flags === undefined) flags = { "ommit_long_octet": 32 };
- if (idx === undefined) idx = 0;
- if (indent === undefined) indent = "";
- var skipLongHex = flags.ommit_long_octet;
-
- if (hex.substr(idx, 2) == "01") {
- var v = ASN1HEX.getHexOfV_AtObj(hex, idx);
- if (v == "00") {
- return indent + "BOOLEAN FALSE\n";
- } else {
- return indent + "BOOLEAN TRUE\n";
- }
- }
- if (hex.substr(idx, 2) == "02") {
- var v = ASN1HEX.getHexOfV_AtObj(hex, idx);
- return indent + "INTEGER " + _skipLongHex(v, skipLongHex) + "\n";
- }
- if (hex.substr(idx, 2) == "03") {
- var v = ASN1HEX.getHexOfV_AtObj(hex, idx);
- return indent + "BITSTRING " + _skipLongHex(v, skipLongHex) + "\n";
- }
- if (hex.substr(idx, 2) == "04") {
- var v = ASN1HEX.getHexOfV_AtObj(hex, idx);
- if (ASN1HEX.isASN1HEX(v)) {
- var s = indent + "OCTETSTRING, encapsulates\n";
- s = s + ASN1HEX.dump(v, flags, 0, indent + " ");
- return s;
- } else {
- return indent + "OCTETSTRING " + _skipLongHex(v, skipLongHex) + "\n";
- }
- }
- if (hex.substr(idx, 2) == "05") {
- return indent + "NULL\n";
- }
- if (hex.substr(idx, 2) == "06") {
- var hV = ASN1HEX.getHexOfV_AtObj(hex, idx);
- var oidDot = KJUR.asn1.ASN1Util.oidHexToInt(hV);
- var oidName = KJUR.asn1.x509.OID.oid2name(oidDot);
- var oidSpc = oidDot.replace(/\./g, ' ');
- if (oidName != '') {
- return indent + "ObjectIdentifier " + oidName + " (" + oidSpc + ")\n";
- } else {
- return indent + "ObjectIdentifier (" + oidSpc + ")\n";
- }
- }
- if (hex.substr(idx, 2) == "0c") {
- return indent + "UTF8String '" + hextoutf8(ASN1HEX.getHexOfV_AtObj(hex, idx)) + "'\n";
- }
- if (hex.substr(idx, 2) == "13") {
- return indent + "PrintableString '" + hextoutf8(ASN1HEX.getHexOfV_AtObj(hex, idx)) + "'\n";
- }
- if (hex.substr(idx, 2) == "14") {
- return indent + "TeletexString '" + hextoutf8(ASN1HEX.getHexOfV_AtObj(hex, idx)) + "'\n";
- }
- if (hex.substr(idx, 2) == "16") {
- return indent + "IA5String '" + hextoutf8(ASN1HEX.getHexOfV_AtObj(hex, idx)) + "'\n";
- }
- if (hex.substr(idx, 2) == "17") {
- return indent + "UTCTime " + hextoutf8(ASN1HEX.getHexOfV_AtObj(hex, idx)) + "\n";
- }
- if (hex.substr(idx, 2) == "18") {
- return indent + "GeneralizedTime " + hextoutf8(ASN1HEX.getHexOfV_AtObj(hex, idx)) + "\n";
- }
- if (hex.substr(idx, 2) == "30") {
- if (hex.substr(idx, 4) == "3000") {
- return indent + "SEQUENCE {}\n";
- }
-
- var s = indent + "SEQUENCE\n";
- var aIdx = ASN1HEX.getPosArrayOfChildren_AtObj(hex, idx);
-
- var flagsTemp = flags;
-
- if ((aIdx.length == 2 || aIdx.length == 3) &&
- hex.substr(aIdx[0], 2) == "06" &&
- hex.substr(aIdx[aIdx.length - 1], 2) == "04") { // supposed X.509v3 extension
- var oidHex = ASN1HEX.getHexOfV_AtObj(hex, aIdx[0]);
- var oidDot = KJUR.asn1.ASN1Util.oidHexToInt(oidHex);
- var oidName = KJUR.asn1.x509.OID.oid2name(oidDot);
-
- var flagsClone = JSON.parse(JSON.stringify(flags));
- flagsClone.x509ExtName = oidName;
- flagsTemp = flagsClone;
- }
-
- for (var i = 0; i < aIdx.length; i++) {
- s = s + ASN1HEX.dump(hex, flagsTemp, aIdx[i], indent + " ");
- }
- return s;
- }
- if (hex.substr(idx, 2) == "31") {
- var s = indent + "SET\n";
- var aIdx = ASN1HEX.getPosArrayOfChildren_AtObj(hex, idx);
- for (var i = 0; i < aIdx.length; i++) {
- s = s + ASN1HEX.dump(hex, flags, aIdx[i], indent + " ");
- }
- return s;
- }
- var tag = parseInt(hex.substr(idx, 2), 16);
- if ((tag & 128) != 0) { // context specific
- var tagNumber = tag & 31;
- if ((tag & 32) != 0) { // structured tag
- var s = indent + "[" + tagNumber + "]\n";
- var aIdx = ASN1HEX.getPosArrayOfChildren_AtObj(hex, idx);
- for (var i = 0; i < aIdx.length; i++) {
- s = s + ASN1HEX.dump(hex, flags, aIdx[i], indent + " ");
- }
- return s;
- } else { // primitive tag
- var v = ASN1HEX.getHexOfV_AtObj(hex, idx);
- if (v.substr(0, 8) == "68747470") { // http
- v = hextoutf8(v);
- }
- if (flags.x509ExtName === "subjectAltName" &&
- tagNumber == 2) {
- v = hextoutf8(v);
- }
-
- var s = indent + "[" + tagNumber + "] " + v + "\n";
- return s;
- }
- }
- return indent + "UNKNOWN(" + hex.substr(idx, 2) + ") " + ASN1HEX.getHexOfV_AtObj(hex, idx) + "\n";
-};
-
-/**
- * check wheather the string is ASN.1 hexadecimal string or not
- * @name isASN1HEX
- * @memberOf ASN1HEX
- * @function
- * @param {String} hex string to check whether it is hexadecmal string for ASN.1 DER or not
- * @return {Boolean} true if it is hexadecimal string of ASN.1 data otherwise false
- * @since jsrsasign 4.8.3 asn1hex 1.1.6
- * @description
- * This method checks wheather the argument 'hex' is a hexadecimal string of
- * ASN.1 data or not.
- * @example
- * ASN1HEX.isASN1HEX('0203012345') → true // PROPER ASN.1 INTEGER
- * ASN1HEX.isASN1HEX('0203012345ff') → false // TOO LONG VALUE
- * ASN1HEX.isASN1HEX('02030123') → false // TOO SHORT VALUE
- * ASN1HEX.isASN1HEX('fa3bcd') → false // WRONG FOR ASN.1
- */
-ASN1HEX.isASN1HEX = function(hex) {
- if (hex.length % 2 == 1) return false;
-
- var intL = ASN1HEX.getIntOfL_AtObj(hex, 0);
- var tV = hex.substr(0, 2);
- var lV = ASN1HEX.getHexOfL_AtObj(hex, 0);
- var hVLength = hex.length - tV.length - lV.length;
- if (hVLength == intL * 2) return true;
-
- return false;
-};
diff --git a/jwt/asn1tsp-1.0.js b/jwt/asn1tsp-1.0.js
deleted file mode 100755
index e2f2647..0000000
--- a/jwt/asn1tsp-1.0.js
+++ /dev/null
@@ -1,820 +0,0 @@
-/*! asn1tsp-1.0.1.js (c) 2014 Kenji Urushima | kjur.github.com/jsrsasign/license
- */
-/*
- * asn1tsp.js - ASN.1 DER encoder classes for RFC 3161 Time Stamp Protocol
- *
- * Copyright (c) 2014 Kenji Urushima (kenji.urushima@gmail.com)
- *
- * This software is licensed under the terms of the MIT License.
- * http://kjur.github.com/jsrsasign/license
- *
- * The above copyright and license notice shall be
- * included in all copies or substantial portions of the Software.
- */
-
-/**
- * @fileOverview
- * @name asn1tsp-1.0.js
- * @author Kenji Urushima kenji.urushima@gmail.com
- * @version 1.0.1 (2014-Jun-07)
- * @since jsrsasign 4.5.1
- * @license
MIT License
- */
-
-/*
- * kjur's class library name space
- * // already documented in asn1-1.0.js
- * @name KJUR
- * @namespace kjur's class library name space
- */
-if (typeof KJUR == "undefined" || !KJUR) KJUR = {};
-
-/*
- * kjur's ASN.1 class library name space
- * // already documented in asn1-1.0.js
- * @name KJUR.asn1
- * @namespace
- */
-if (typeof KJUR.asn1 == "undefined" || !KJUR.asn1) KJUR.asn1 = {};
-
-/**
- * kjur's ASN.1 class for RFC 3161 Time Stamp Protocol
- *
- * This name space provides
- * RFC 3161
- * Time-Stamp Protocol(TSP) data generator.
- *
- *
FEATURES
- *
- * easily generate CMS SignedData
- * APIs are very similar to BouncyCastle library ASN.1 classes. So easy to learn.
- *
- *
- *
PROVIDED CLASSES
- *
- * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.
- *
- * @name KJUR.asn1.tsp
- * @namespace
- */
-if (typeof KJUR.asn1.tsp == "undefined" || !KJUR.asn1.tsp) KJUR.asn1.tsp = {};
-
-/**
- * class for TSP Accuracy ASN.1 object
- * @name KJUR.asn1.tsp.Accuracy
- * @class class for TSP Accuracy ASN.1 object
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.ASN1Object
- * @since jsrsasign 4.6.0 asn1tsp 1.0.0
- * @description
- *
- * Accuracy ::= SEQUENCE {
- * seconds INTEGER OPTIONAL,
- * millis [0] INTEGER (1..999) OPTIONAL,
- * micros [1] INTEGER (1..999) OPTIONAL }
- *
- * @example
- * o = new KJUR.asn1.tsp.Accuracy({seconds: 1,
- * millis: 500,
- * micros: 500});
- */
-KJUR.asn1.tsp.Accuracy = function(params) {
- KJUR.asn1.tsp.Accuracy.superclass.constructor.call(this);
- var nA = KJUR.asn1;
- this.seconds = null;
- this.millis = null;
- this.micros = null;
-
- this.getEncodedHex = function() {
- var dSeconds = null;
- var dTagMillis = null;
- var dTagMicros = null;
-
- var a = [];
- if (this.seconds != null) {
- dSeconds = new nA.DERInteger({'int': this.seconds});
- a.push(dSeconds);
- }
- if (this.millis != null) {
- var dMillis = new nA.DERInteger({'int': this.millis});
- dTagMillis = new nA.DERTaggedObject({obj: dMillis,
- tag: '80',
- explicit: false});
- a.push(dTagMillis);
- }
- if (this.micros != null) {
- var dMicros = new nA.DERInteger({'int': this.micros});
- dTagMicros = new nA.DERTaggedObject({obj: dMicros,
- tag: '81',
- explicit: false});
- a.push(dTagMicros);
- }
- var seq = new nA.DERSequence({array: a});
- this.hTLV = seq.getEncodedHex();
- return this.hTLV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params.seconds == "number") this.seconds = params.seconds;
- if (typeof params.millis == "number") this.millis = params.millis;
- if (typeof params.micros == "number") this.micros = params.micros;
- }
-};
-YAHOO.lang.extend(KJUR.asn1.tsp.Accuracy, KJUR.asn1.ASN1Object);
-
-/**
- * class for TSP MessageImprint ASN.1 object
- * @name KJUR.asn1.tsp.MessageImprint
- * @class class for TSP MessageImprint ASN.1 object
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.ASN1Object
- * @since jsrsasign 4.6.0 asn1tsp 1.0.0
- * @description
- *
- * MessageImprint ::= SEQUENCE {
- * hashAlgorithm AlgorithmIdentifier,
- * hashedMessage OCTET STRING }
- *
- * @example
- * o = new KJUR.asn1.tsp.MessageImprint({hashAlg: 'sha1',
- * hashValue: '1f3dea...'});
- */
-KJUR.asn1.tsp.MessageImprint = function(params) {
- KJUR.asn1.tsp.MessageImprint.superclass.constructor.call(this);
- var nA = KJUR.asn1;
- var nX = KJUR.asn1.x509;
- this.dHashAlg = null;
- this.dHashValue = null;
-
- this.getEncodedHex = function() {
- if (typeof this.hTLV == "string") return this.hTLV;
- var seq =
- new nA.DERSequence({array: [this.dHashAlg, this.dHashValue]});
- return seq.getEncodedHex();
- };
-
- if (typeof params != "undefined") {
- if (typeof params.hashAlg == "string") {
- this.dHashAlg = new nX.AlgorithmIdentifier({name: params.hashAlg});
- }
- if (typeof params.hashValue == "string") {
- this.dHashValue = new nA.DEROctetString({hex: params.hashValue});
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.tsp.MessageImprint, KJUR.asn1.ASN1Object);
-
-/**
- * class for TSP TimeStampReq ASN.1 object
- * @name KJUR.asn1.tsp.TimeStampReq
- * @class class for TSP TimeStampReq ASN.1 object
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.ASN1Object
- * @since jsrsasign 4.6.0 asn1tsp 1.0.0
- * @description
- *
- * TimeStampReq ::= SEQUENCE {
- * version INTEGER { v1(1) },
- * messageImprint MessageImprint,
- * reqPolicy TSAPolicyId OPTIONAL,
- * nonce INTEGER OPTIONAL,
- * certReq BOOLEAN DEFAULT FALSE,
- * extensions [0] IMPLICIT Extensions OPTIONAL }
- *
- */
-KJUR.asn1.tsp.TimeStampReq = function(params) {
- KJUR.asn1.tsp.TimeStampReq.superclass.constructor.call(this);
- var nA = KJUR.asn1;
- var nT = KJUR.asn1.tsp;
- this.dVersion = new nA.DERInteger({'int': 1});
- this.dMessageImprint = null;
- this.dPolicy = null;
- this.dNonce = null;
- this.certReq = true;
-
- this.setMessageImprint = function(params) {
- if (params instanceof KJUR.asn1.tsp.MessageImprint) {
- this.dMessageImprint = params;
- return;
- }
- if (typeof params == "object") {
- this.dMessageImprint = new nT.MessageImprint(params);
- }
- };
-
- this.getEncodedHex = function() {
- if (this.dMessageImprint == null)
- throw "messageImprint shall be specified";
-
- var a = [this.dVersion, this.dMessageImprint];
- if (this.dPolicy != null) a.push(this.dPolicy);
- if (this.dNonce != null) a.push(this.dNonce);
- if (this.certReq) a.push(new nA.DERBoolean());
-
- var seq = new nA.DERSequence({array: a});
- this.hTLV = seq.getEncodedHex();
- return this.hTLV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params.mi == "object") {
- this.setMessageImprint(params.mi);
- }
- if (typeof params.policy == "object") {
- this.dPolicy = new nA.DERObjectIdentifier(params.policy);
- }
- if (typeof params.nonce == "object") {
- this.dNonce = new nA.DERInteger(params.nonce);
- }
- if (typeof params.certreq == "boolean") {
- this.certReq = params.certreq;
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.tsp.TimeStampReq, KJUR.asn1.ASN1Object);
-
-/**
- * class for TSP TSTInfo ASN.1 object
- * @name KJUR.asn1.tsp.TSTInfo
- * @class class for TSP TSTInfo ASN.1 object
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.ASN1Object
- * @since jsrsasign 4.6.0 asn1tsp 1.0.0
- * @description
- *
- * TSTInfo ::= SEQUENCE {
- * version INTEGER { v1(1) },
- * policy TSAPolicyId,
- * messageImprint MessageImprint,
- * serialNumber INTEGER, -- up to 160bit
- * genTime GeneralizedTime,
- * accuracy Accuracy OPTIONAL,
- * ordering BOOLEAN DEFAULT FALSE,
- * nonce INTEGER OPTIONAL,
- * tsa [0] GeneralName OPTIONAL,
- * extensions [1] IMPLICIT Extensions OPTIONAL }
- *
- * @example
- * o = new KJUR.asn1.tsp.TSTInfo({
- * policy: '1.2.3.4.5',
- * messageImprint: {hashAlg: 'sha256', hashMsgHex: '1abc...'},
- * genTime: {withMillis: true}, // OPTION
- * accuracy: {micros: 500}, // OPTION
- * ordering: true, // OPITON
- * nonce: {hex: '52fab1...'}, // OPTION
- * tsa: {str: '/C=US/O=TSA1'} // OPITON
- * });
- */
-KJUR.asn1.tsp.TSTInfo = function(params) {
- KJUR.asn1.tsp.TSTInfo.superclass.constructor.call(this);
- var nA = KJUR.asn1;
- var nX = KJUR.asn1.x509;
- var nT = KJUR.asn1.tsp;
-
- this.dVersion = new nA.DERInteger({'int': 1});
- this.dPolicy = null;
- this.dMessageImprint = null;
- this.dSerialNumber = null;
- this.dGenTime = null;
- this.dAccuracy = null;
- this.dOrdering = null;
- this.dNonce = null;
- this.dTsa = null;
-
- this.getEncodedHex = function() {
- var a = [this.dVersion];
-
- if (this.dPolicy == null) throw "policy shall be specified.";
- a.push(this.dPolicy);
-
- if (this.dMessageImprint == null)
- throw "messageImprint shall be specified.";
- a.push(this.dMessageImprint);
-
- if (this.dSerialNumber == null)
- throw "serialNumber shall be specified.";
- a.push(this.dSerialNumber);
-
- if (this.dGenTime == null)
- throw "genTime shall be specified.";
- a.push(this.dGenTime);
-
- if (this.dAccuracy != null) a.push(this.dAccuracy);
- if (this.dOrdering != null) a.push(this.dOrdering);
- if (this.dNonce != null) a.push(this.dNonce);
- if (this.dTsa != null) a.push(this.dTsa);
-
- var seq = new nA.DERSequence({array: a});
- this.hTLV = seq.getEncodedHex();
- return this.hTLV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params.policy == "string") {
- if (! params.policy.match(/^[0-9.]+$/))
- throw "policy shall be oid like 0.1.4.134";
- this.dPolicy = new nA.DERObjectIdentifier({oid: params.policy});
- }
- if (typeof params.messageImprint != "undefined") {
- this.dMessageImprint = new nT.MessageImprint(params.messageImprint);
- }
- if (typeof params.serialNumber != "undefined") {
- this.dSerialNumber = new nA.DERInteger(params.serialNumber);
- }
- if (typeof params.genTime != "undefined") {
- this.dGenTime = new nA.DERGeneralizedTime(params.genTime);
- }
- if (typeof params.accuracy != "undefind") {
- this.dAccuracy = new nT.Accuracy(params.accuracy);
- }
- if (typeof params.ordering != "undefined" &&
- params.ordering == true) {
- this.dOrdering = new nA.DERBoolean();
- }
- if (typeof params.nonce != "undefined") {
- this.dNonce = new nA.DERInteger(params.nonce);
- }
- if (typeof params.tsa != "undefined") {
- this.dTsa = new nX.X500Name(params.tsa);
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.tsp.TSTInfo, KJUR.asn1.ASN1Object);
-
-/**
- * class for TSP TimeStampResp ASN.1 object
- * @name KJUR.asn1.tsp.TimeStampResp
- * @class class for TSP TimeStampResp ASN.1 object
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.ASN1Object
- * @since jsrsasign 4.6.0 asn1tsp 1.0.0
- * @description
- *
- * TimeStampResp ::= SEQUENCE {
- * status PKIStatusInfo,
- * timeStampToken TimeStampToken OPTIONAL }
- *
- */
-KJUR.asn1.tsp.TimeStampResp = function(params) {
- KJUR.asn1.tsp.TimeStampResp.superclass.constructor.call(this);
- var nA = KJUR.asn1;
- var nT = KJUR.asn1.tsp;
- this.dStatus = null;
- this.dTST = null;
-
- this.getEncodedHex = function() {
- if (this.dStatus == null)
- throw "status shall be specified";
- var a = [this.dStatus];
- if (this.dTST != null) a.push(this.dTST);
- var seq = new nA.DERSequence({array: a});
- this.hTLV = seq.getEncodedHex();
- return this.hTLV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params.status == "object") {
- this.dStatus = new nT.PKIStatusInfo(params.status);
- }
- if (typeof params.tst != "undefined" &&
- params.tst instanceof KJUR.asn1.ASN1Object) {
- this.dTST = params.tst.getContentInfo();
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.tsp.TimeStampResp, KJUR.asn1.ASN1Object);
-
-// --- BEGIN OF RFC 2510 CMP -----------------------------------------------
-
-/**
- * class for TSP PKIStatusInfo ASN.1 object
- * @name KJUR.asn1.tsp.PKIStatusInfo
- * @class class for TSP PKIStatusInfo ASN.1 object
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.ASN1Object
- * @since jsrsasign 4.6.0 asn1tsp 1.0.0
- * @description
- *
- * PKIStatusInfo ::= SEQUENCE {
- * status PKIStatus,
- * statusString PKIFreeText OPTIONAL,
- * failInfo PKIFailureInfo OPTIONAL }
- *
- */
-KJUR.asn1.tsp.PKIStatusInfo = function(params) {
- KJUR.asn1.tsp.PKIStatusInfo.superclass.constructor.call(this);
- var nA = KJUR.asn1;
- var nT = KJUR.asn1.tsp;
- this.dStatus = null;
- this.dStatusString = null;
- this.dFailureInfo = null;
-
- this.getEncodedHex = function() {
- if (this.dStatus == null)
- throw "status shall be specified";
- var a = [this.dStatus];
- if (this.dStatusString != null) a.push(this.dStatusString);
- if (this.dFailureInfo != null) a.push(this.dFailureInfo);
- var seq = new nA.DERSequence({array: a});
- this.hTLV = seq.getEncodedHex();
- return this.hTLV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params.status == "object") { // param for int
- this.dStatus = new nT.PKIStatus(params.status);
- }
- if (typeof params.statstr == "object") { // array of str
- this.dStatusString =
- new nT.PKIFreeText({array: params.statstr});
- }
- if (typeof params.failinfo == "object") {
- this.dFailureInfo =
- new nT.PKIFailureInfo(params.failinfo); // param for bitstr
- }
- };
-};
-YAHOO.lang.extend(KJUR.asn1.tsp.PKIStatusInfo, KJUR.asn1.ASN1Object);
-
-/**
- * class for TSP PKIStatus ASN.1 object
- * @name KJUR.asn1.tsp.PKIStatus
- * @class class for TSP PKIStatus ASN.1 object
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.ASN1Object
- * @since jsrsasign 4.6.0 asn1tsp 1.0.0
- * @description
- *
- * PKIStatus ::= INTEGER {
- * granted (0),
- * grantedWithMods (1),
- * rejection (2),
- * waiting (3),
- * revocationWarning (4),
- * revocationNotification (5) }
- *
- */
-KJUR.asn1.tsp.PKIStatus = function(params) {
- KJUR.asn1.tsp.PKIStatus.superclass.constructor.call(this);
- var nA = KJUR.asn1;
- var nT = KJUR.asn1.tsp;
- var dStatus = null;
-
- this.getEncodedHex = function() {
- this.hTLV = this.dStatus.getEncodedHex();
- return this.hTLV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params.name != "undefined") {
- var list = nT.PKIStatus.valueList;
- if (typeof list[params.name] == "undefined")
- throw "name undefined: " + params.name;
- this.dStatus =
- new nA.DERInteger({'int': list[params.name]});
- } else {
- this.dStatus = new nA.DERInteger(params);
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.tsp.PKIStatus, KJUR.asn1.ASN1Object);
-
-KJUR.asn1.tsp.PKIStatus.valueList = {
- granted: 0,
- grantedWithMods: 1,
- rejection: 2,
- waiting: 3,
- revocationWarning: 4,
- revocationNotification: 5
-};
-
-/**
- * class for TSP PKIFreeText ASN.1 object
- * @name KJUR.asn1.tsp.PKIFreeText
- * @class class for TSP PKIFreeText ASN.1 object
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.ASN1Object
- * @since jsrsasign 4.6.0 asn1tsp 1.0.0
- * @description
- *
- * PKIFreeText ::= SEQUENCE {
- * SIZE (1..MAX) OF UTF8String }
- *
- */
-KJUR.asn1.tsp.PKIFreeText = function(params) {
- KJUR.asn1.tsp.PKIFreeText.superclass.constructor.call(this);
- var nA = KJUR.asn1;
- this.textList = [];
-
- this.getEncodedHex = function() {
- var a = [];
- for (var i = 0; i < this.textList.length; i++) {
- a.push(new nA.DERUTF8String({str: this.textList[i]}));
- }
- var seq = new nA.DERSequence({array: a});
- this.hTLV = seq.getEncodedHex();
- return this.hTLV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params.array == "object") {
- this.textList = params.array;
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.tsp.PKIFreeText, KJUR.asn1.ASN1Object);
-
-/**
- * class for TSP PKIFailureInfo ASN.1 object
- * @name KJUR.asn1.tsp.PKIFailureInfo
- * @class class for TSP PKIFailureInfo ASN.1 object
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.ASN1Object
- * @since jsrsasign 4.6.0 asn1tsp 1.0.0
- * @description
- *
- * PKIFailureInfo ::= BIT STRING {
- * badAlg (0),
- * badRequest (2),
- * badDataFormat (5),
- * timeNotAvailable (14),
- * unacceptedPolicy (15),
- * unacceptedExtension (16),
- * addInfoNotAvailable (17),
- * systemFailure (25) }
- *
- */
-KJUR.asn1.tsp.PKIFailureInfo = function(params) {
- KJUR.asn1.tsp.PKIFailureInfo.superclass.constructor.call(this);
- var nA = KJUR.asn1;
- var nT = KJUR.asn1.tsp;
- this.value = null;
-
- this.getEncodedHex = function() {
- if (this.value == null)
- throw "value shall be specified";
- var binValue = new Number(this.value).toString(2);
- var dValue = new nA.DERBitString();
- dValue.setByBinaryString(binValue);
- this.hTLV = dValue.getEncodedHex();
- return this.hTLV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params.name == "string") {
- var list = nT.PKIFailureInfo.valueList;
- if (typeof list[params.name] == "undefined")
- throw "name undefined: " + params.name;
- this.value = list[params.name];
- } else if (typeof params['int'] == "number") {
- this.value = params['int'];
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.tsp.PKIFailureInfo, KJUR.asn1.ASN1Object);
-
-KJUR.asn1.tsp.PKIFailureInfo.valueList = {
- badAlg: 0,
- badRequest: 2,
- badDataFormat: 5,
- timeNotAvailable: 14,
- unacceptedPolicy: 15,
- unacceptedExtension: 16,
- addInfoNotAvailable: 17,
- systemFailure: 25
-};
-
-// --- END OF RFC 2510 CMP -------------------------------------------
-
-/**
- * abstract class for TimeStampToken generator
- * @name KJUR.asn1.tsp.AbstractTSAAdapter
- * @class abstract class for TimeStampToken generator
- * @param {Array} params associative array of parameters
- * @since jsrsasign 4.7.0 asn1tsp 1.0.1
- * @description
- */
-KJUR.asn1.tsp.AbstractTSAAdapter = function(params) {
- this.getTSTHex = function(msgHex, hashAlg) {
- throw "not implemented yet";
- };
-};
-
-/**
- * class for simple TimeStampToken generator
- * @name KJUR.asn1.tsp.SimpleTSAAdapter
- * @class class for simple TimeStampToken generator
- * @param {Array} params associative array of parameters
- * @since jsrsasign 4.7.0 asn1tsp 1.0.1
- * @description
- */
-KJUR.asn1.tsp.SimpleTSAAdapter = function(initParams) {
- KJUR.asn1.tsp.SimpleTSAAdapter.superclass.constructor.call(this);
- this.params = null;
- this.serial = 0;
-
- this.getTSTHex = function(msgHex, hashAlg) {
- // messageImprint
- var hashHex = KJUR.crypto.Util.hashHex(msgHex, hashAlg);
- this.params.tstInfo.messageImprint =
- {hashAlg: hashAlg, hashValue: hashHex};
-
- // serial
- this.params.tstInfo.serialNumber = {'int': this.serial++};
-
- // nonce
- var nonceValue = Math.floor(Math.random() * 1000000000);
- this.params.tstInfo.nonce = {'int': nonceValue};
-
- var obj =
- KJUR.asn1.tsp.TSPUtil.newTimeStampToken(this.params);
- return obj.getContentInfoEncodedHex();
- };
-
- if (typeof initParams != "undefined") {
- this.params = initParams;
- }
-};
-YAHOO.lang.extend(KJUR.asn1.tsp.SimpleTSAAdapter,
- KJUR.asn1.tsp.AbstractTSAAdapter);
-
-/**
- * class for fixed TimeStampToken generator
- * @name KJUR.asn1.tsp.FixedTSAAdapter
- * @class class for fixed TimeStampToken generator
- * @param {Array} params associative array of parameters
- * @since jsrsasign 4.7.0 asn1tsp 1.0.1
- * @description
- * This class generates fixed TimeStampToken except messageImprint
- * for testing purpose.
- * General TSA generates TimeStampToken which varies following
- * fields:
- *
- * genTime
- * serialNumber
- * nonce
- *
- * Those values are provided by initial parameters.
- */
-KJUR.asn1.tsp.FixedTSAAdapter = function(initParams) {
- KJUR.asn1.tsp.FixedTSAAdapter.superclass.constructor.call(this);
- this.params = null;
-
- this.getTSTHex = function(msgHex, hashAlg) {
- // fixed serialNumber
- // fixed nonce
- var hashHex = KJUR.crypto.Util.hashHex(msgHex, hashAlg);
- this.params.tstInfo.messageImprint =
- {hashAlg: hashAlg, hashValue: hashHex};
- var obj =
- KJUR.asn1.tsp.TSPUtil.newTimeStampToken(this.params);
- return obj.getContentInfoEncodedHex();
- };
-
- if (typeof initParams != "undefined") {
- this.params = initParams;
- }
-};
-YAHOO.lang.extend(KJUR.asn1.tsp.FixedTSAAdapter,
- KJUR.asn1.tsp.AbstractTSAAdapter);
-
-// --- TSP utilities -------------------------------------------------
-
-/**
- * TSP utiliteis class
- * @name KJUR.asn1.tsp.TSPUtil
- * @class TSP utilities class
- */
-KJUR.asn1.tsp.TSPUtil = new function() {
-};
-/**
- * generate TimeStampToken ASN.1 object specified by JSON parameters
- * @name newTimeStampToken
- * @memberOf KJUR.asn1.tsp.TSPUtil
- * @function
- * @param {Array} param JSON parameter to generate TimeStampToken
- * @return {KJUR.asn1.cms.SignedData} object just generated
- * @description
- * @example
- */
-KJUR.asn1.tsp.TSPUtil.newTimeStampToken = function(param) {
- var nC = KJUR.asn1.cms;
- var nT = KJUR.asn1.tsp;
- var sd = new nC.SignedData();
-
- var dTSTInfo = new nT.TSTInfo(param.tstInfo);
- var tstInfoHex = dTSTInfo.getEncodedHex();
- sd.dEncapContentInfo.setContentValue({hex: tstInfoHex});
- sd.dEncapContentInfo.setContentType('tstinfo');
-
- if (typeof param.certs == "object") {
- for (var i = 0; i < param.certs.length; i++) {
- sd.addCertificatesByPEM(param.certs[i]);
- }
- }
-
- var si = sd.signerInfoList[0];
- si.setSignerIdentifier(param.signerCert);
- si.setForContentAndHash({sdObj: sd,
- eciObj: sd.dEncapContentInfo,
- hashAlg: param.hashAlg});
- var signingCertificate =
- new nC.SigningCertificate({array: [param.signerCert]});
- si.dSignedAttrs.add(signingCertificate);
-
- si.sign(param.signerPrvKey, param.sigAlg);
-
- return sd;
-};
-
-/**
- * parse hexadecimal string of TimeStampReq
- * @name parseTimeStampReq
- * @memberOf KJUR.asn1.tsp.TSPUtil
- * @function
- * @param {String} hexadecimal string of TimeStampReq
- * @return {Array} JSON object of parsed parameters
- * @description
- * This method parses a hexadecimal string of TimeStampReq
- * and returns parsed their fields:
- * @example
- * var json = KJUR.asn1.tsp.TSPUtil.parseTimeStampReq("302602...");
- * // resulted DUMP of above 'json':
- * {mi: {hashAlg: 'sha256', // MessageImprint hashAlg
- * hashValue: 'a1a2a3a4...'}, // MessageImprint hashValue
- * policy: '1.2.3.4.5', // tsaPolicy (OPTION)
- * nonce: '9abcf318...', // nonce (OPTION)
- * certreq: true} // certReq (OPTION)
- */
-KJUR.asn1.tsp.TSPUtil.parseTimeStampReq = function(reqHex) {
- var json = {};
- json.certreq = false;
-
- var idxList = ASN1HEX.getPosArrayOfChildren_AtObj(reqHex, 0);
-
- if (idxList.length < 2)
- throw "TimeStampReq must have at least 2 items";
-
- var miHex = ASN1HEX.getHexOfTLV_AtObj(reqHex, idxList[1]);
- json.mi = KJUR.asn1.tsp.TSPUtil.parseMessageImprint(miHex);
-
- for (var i = 2; i < idxList.length; i++) {
- var idx = idxList[i];
- var tag = reqHex.substr(idx, 2);
- if (tag == "06") { // case OID
- var policyHex = ASN1HEX.getHexOfV_AtObj(reqHex, idx);
- json.policy = ASN1HEX.hextooidstr(policyHex);
- }
- if (tag == "02") { // case INTEGER
- json.nonce = ASN1HEX.getHexOfV_AtObj(reqHex, idx);
- }
- if (tag == "01") { // case BOOLEAN
- json.certreq = true;
- }
- }
-
- return json;
-};
-
-/**
- * parse hexadecimal string of MessageImprint
- * @name parseMessageImprint
- * @memberOf KJUR.asn1.tsp.TSPUtil
- * @function
- * @param {String} hexadecimal string of MessageImprint
- * @return {Array} JSON object of parsed parameters
- * @description
- * This method parses a hexadecimal string of MessageImprint
- * and returns parsed their fields:
- * @example
- * var json = KJUR.asn1.tsp.TSPUtil.parseMessageImprint("302602...");
- * // resulted DUMP of above 'json':
- * {hashAlg: 'sha256', // MessageImprint hashAlg
- * hashValue: 'a1a2a3a4...'} // MessageImprint hashValue
- */
-KJUR.asn1.tsp.TSPUtil.parseMessageImprint = function(miHex) {
- var json = {};
-
- if (miHex.substr(0, 2) != "30")
- throw "head of messageImprint hex shall be '30'";
-
- var idxList = ASN1HEX.getPosArrayOfChildren_AtObj(miHex, 0);
- var hashAlgOidIdx =
- ASN1HEX.getDecendantIndexByNthList(miHex, 0, [0, 0]);
- var hashAlgHex = ASN1HEX.getHexOfV_AtObj(miHex, hashAlgOidIdx);
- var hashAlgOid = ASN1HEX.hextooidstr(hashAlgHex);
- var hashAlgName = KJUR.asn1.x509.OID.oid2name(hashAlgOid);
- if (hashAlgName == '')
- throw "hashAlg name undefined: " + hashAlgOid;
- var hashAlg = hashAlgName;
-
- var hashValueIdx =
- ASN1HEX.getDecendantIndexByNthList(miHex, 0, [1]);
-
- json.hashAlg = hashAlg;
- json.hashValue = ASN1HEX.getHexOfV_AtObj(miHex, hashValueIdx);
-
- return json;
-};
-
diff --git a/jwt/asn1x509-1.0.js b/jwt/asn1x509-1.0.js
deleted file mode 100644
index ba990f6..0000000
--- a/jwt/asn1x509-1.0.js
+++ /dev/null
@@ -1,2161 +0,0 @@
-/*! asn1x509-1.0.14.js (c) 2013-2015 Kenji Urushima | kjur.github.com/jsrsasign/license
- */
-/*
- * asn1x509.js - ASN.1 DER encoder classes for X.509 certificate
- *
- * Copyright (c) 2013-2015 Kenji Urushima (kenji.urushima@gmail.com)
- *
- * This software is licensed under the terms of the MIT License.
- * http://kjur.github.com/jsrsasign/license
- *
- * The above copyright and license notice shall be
- * included in all copies or substantial portions of the Software.
- */
-
-/**
- * @fileOverview
- * @name asn1x509-1.0.js
- * @author Kenji Urushima kenji.urushima@gmail.com
- * @version 1.0.14 (2016-May-10)
- * @since jsrsasign 2.1
- * @license
MIT License
- */
-
-/**
- * kjur's class library name space
- * // already documented in asn1-1.0.js
- * @name KJUR
- * @namespace kjur's class library name space
- */
-if (typeof KJUR == "undefined" || !KJUR) KJUR = {};
-
-/**
- * kjur's ASN.1 class library name space
- * // already documented in asn1-1.0.js
- * @name KJUR.asn1
- * @namespace
- */
-if (typeof KJUR.asn1 == "undefined" || !KJUR.asn1) KJUR.asn1 = {};
-
-/**
- * kjur's ASN.1 class for X.509 certificate library name space
- *
- *
FEATURES
- *
- * easily issue any kind of certificate
- * APIs are very similar to BouncyCastle library ASN.1 classes. So easy to learn.
- *
- *
- *
PROVIDED CLASSES
- *
- * {@link KJUR.asn1.x509.Certificate}
- * {@link KJUR.asn1.x509.TBSCertificate}
- * {@link KJUR.asn1.x509.Extension}
- * {@link KJUR.asn1.x509.X500Name}
- * {@link KJUR.asn1.x509.RDN}
- * {@link KJUR.asn1.x509.AttributeTypeAndValue}
- * {@link KJUR.asn1.x509.SubjectPublicKeyInfo}
- * {@link KJUR.asn1.x509.AlgorithmIdentifier}
- * {@link KJUR.asn1.x509.GeneralName}
- * {@link KJUR.asn1.x509.GeneralNames}
- * {@link KJUR.asn1.x509.DistributionPointName}
- * {@link KJUR.asn1.x509.DistributionPoint}
- * {@link KJUR.asn1.x509.CRL}
- * {@link KJUR.asn1.x509.TBSCertList}
- * {@link KJUR.asn1.x509.CRLEntry}
- * {@link KJUR.asn1.x509.OID}
- *
- *
SUPPORTED EXTENSIONS
- *
- * {@link KJUR.asn1.x509.BasicConstraints}
- * {@link KJUR.asn1.x509.KeyUsage}
- * {@link KJUR.asn1.x509.CRLDistributionPoints}
- * {@link KJUR.asn1.x509.ExtKeyUsage}
- * {@link KJUR.asn1.x509.AuthorityKeyIdentifier}
- *
- * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.
- * @name KJUR.asn1.x509
- * @namespace
- */
-if (typeof KJUR.asn1.x509 == "undefined" || !KJUR.asn1.x509) KJUR.asn1.x509 = {};
-
-// === BEGIN Certificate ===================================================
-
-/**
- * X.509 Certificate class to sign and generate hex encoded certificate
- * @name KJUR.asn1.x509.Certificate
- * @class X.509 Certificate class to sign and generate hex encoded certificate
- * @param {Array} params associative array of parameters (ex. {'tbscertobj': obj, 'prvkeyobj': key})
- * @extends KJUR.asn1.ASN1Object
- * @description
- *
- * As for argument 'params' for constructor, you can specify one of
- * following properties:
- *
- * tbscertobj - specify {@link KJUR.asn1.x509.TBSCertificate} object
- * prvkeyobj - specify {@link RSAKey}, {@link KJUR.crypto.ECDSA} or {@link KJUR.crypto.DSA} object for CA private key to sign the certificate
- * (DEPRECATED)rsaprvkey - specify {@link RSAKey} object CA private key
- * (DEPRECATED)rsaprvpem - specify PEM string of RSA CA private key
- *
- * NOTE1: 'params' can be omitted.
- * NOTE2: DSA/ECDSA is also supported for CA signging key from asn1x509 1.0.6.
- * @example
- * var caKey = KEYUTIL.getKey(caKeyPEM); // CA's private key
- * var cert = new KJUR.asn1x509.Certificate({'tbscertobj': tbs, 'prvkeyobj': caKey});
- * cert.sign(); // issue certificate by CA's private key
- * var certPEM = cert.getPEMString();
- *
- * // Certificate ::= SEQUENCE {
- * // tbsCertificate TBSCertificate,
- * // signatureAlgorithm AlgorithmIdentifier,
- * // signature BIT STRING }
- */
-KJUR.asn1.x509.Certificate = function(params) {
- KJUR.asn1.x509.Certificate.superclass.constructor.call(this);
- var asn1TBSCert = null;
- var asn1SignatureAlg = null;
- var asn1Sig = null;
- var hexSig = null;
- var prvKey = null;
- var rsaPrvKey = null; // DEPRECATED
-
-
- /**
- * set PKCS#5 encrypted RSA PEM private key as CA key
- * @name setRsaPrvKeyByPEMandPass
- * @memberOf KJUR.asn1.x509.Certificate
- * @function
- * @param {String} rsaPEM string of PKCS#5 encrypted RSA PEM private key
- * @param {String} passPEM passcode string to decrypt private key
- * @since 1.0.1
- * @description
- *
- *
EXAMPLES
- * @example
- * var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs});
- * cert.setRsaPrvKeyByPEMandPass("-----BEGIN RSA PRIVATE..(snip)", "password");
- */
- this.setRsaPrvKeyByPEMandPass = function(rsaPEM, passPEM) {
- var caKeyHex = PKCS5PKEY.getDecryptedKeyHex(rsaPEM, passPEM);
- var caKey = new RSAKey();
- caKey.readPrivateKeyFromASN1HexString(caKeyHex);
- this.prvKey = caKey;
- };
-
- /**
- * sign TBSCertificate and set signature value internally
- * @name sign
- * @memberOf KJUR.asn1.x509.Certificate
- * @function
- * @description
- * @example
- * var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs, 'rsaprvkey': prvKey});
- * cert.sign();
- */
- this.sign = function() {
- this.asn1SignatureAlg = this.asn1TBSCert.asn1SignatureAlg;
-
- sig = new KJUR.crypto.Signature({'alg': 'SHA1withRSA'});
- sig.init(this.prvKey);
- sig.updateHex(this.asn1TBSCert.getEncodedHex());
- this.hexSig = sig.sign();
-
- this.asn1Sig = new KJUR.asn1.DERBitString({'hex': '00' + this.hexSig});
-
- var seq = new KJUR.asn1.DERSequence({'array': [this.asn1TBSCert,
- this.asn1SignatureAlg,
- this.asn1Sig]});
- this.hTLV = seq.getEncodedHex();
- this.isModified = false;
- };
-
- /**
- * set signature value internally by hex string
- * @name setSignatureHex
- * @memberOf KJUR.asn1.x509.Certificate
- * @function
- * @since asn1x509 1.0.8
- * @description
- * @example
- * var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs});
- * cert.setSignatureHex('01020304');
- */
- this.setSignatureHex = function(sigHex) {
- this.asn1SignatureAlg = this.asn1TBSCert.asn1SignatureAlg;
- this.hexSig = sigHex;
- this.asn1Sig = new KJUR.asn1.DERBitString({'hex': '00' + this.hexSig});
-
- var seq = new KJUR.asn1.DERSequence({'array': [this.asn1TBSCert,
- this.asn1SignatureAlg,
- this.asn1Sig]});
- this.hTLV = seq.getEncodedHex();
- this.isModified = false;
- };
-
- this.getEncodedHex = function() {
- if (this.isModified == false && this.hTLV != null) return this.hTLV;
- throw "not signed yet";
- };
-
- /**
- * get PEM formatted certificate string after signed
- * @name getPEMString
- * @memberOf KJUR.asn1.x509.Certificate
- * @function
- * @return PEM formatted string of certificate
- * @description
- * @example
- * var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs, 'rsaprvkey': prvKey});
- * cert.sign();
- * var sPEM = cert.getPEMString();
- */
- this.getPEMString = function() {
- var hCert = this.getEncodedHex();
- var wCert = CryptoJS.enc.Hex.parse(hCert);
- var b64Cert = CryptoJS.enc.Base64.stringify(wCert);
- var pemBody = b64Cert.replace(/(.{64})/g, "$1\r\n");
- return "-----BEGIN CERTIFICATE-----\r\n" + pemBody + "\r\n-----END CERTIFICATE-----\r\n";
- };
-
- if (typeof params != "undefined") {
- if (typeof params['tbscertobj'] != "undefined") {
- this.asn1TBSCert = params['tbscertobj'];
- }
- if (typeof params['prvkeyobj'] != "undefined") {
- this.prvKey = params['prvkeyobj'];
- } else if (typeof params['rsaprvkey'] != "undefined") {
- this.prvKey = params['rsaprvkey'];
- } else if ((typeof params['rsaprvpem'] != "undefined") &&
- (typeof params['rsaprvpas'] != "undefined")) {
- this.setRsaPrvKeyByPEMandPass(params['rsaprvpem'], params['rsaprvpas']);
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.x509.Certificate, KJUR.asn1.ASN1Object);
-
-/**
- * ASN.1 TBSCertificate structure class
- * @name KJUR.asn1.x509.TBSCertificate
- * @class ASN.1 TBSCertificate structure class
- * @param {Array} params associative array of parameters (ex. {})
- * @extends KJUR.asn1.ASN1Object
- * @description
- *
- *
EXAMPLE
- * @example
- * var o = new KJUR.asn1.x509.TBSCertificate();
- * o.setSerialNumberByParam({'int': 4});
- * o.setSignatureAlgByParam({'name': 'SHA1withRSA'});
- * o.setIssuerByParam({'str': '/C=US/O=a'});
- * o.setNotBeforeByParam({'str': '130504235959Z'});
- * o.setNotAfterByParam({'str': '140504235959Z'});
- * o.setSubjectByParam({'str': '/C=US/CN=b'});
- * o.setSubjectPublicKeyByParam({'rsakey': rsaKey});
- * o.appendExtension(new KJUR.asn1.x509.BasicConstraints({'cA':true}));
- * o.appendExtension(new KJUR.asn1.x509.KeyUsage({'bin':'11'}));
- */
-KJUR.asn1.x509.TBSCertificate = function(params) {
- KJUR.asn1.x509.TBSCertificate.superclass.constructor.call(this);
-
- this._initialize = function() {
- this.asn1Array = new Array();
-
- this.asn1Version =
- new KJUR.asn1.DERTaggedObject({'obj': new KJUR.asn1.DERInteger({'int': 2})});
- this.asn1SerialNumber = null;
- this.asn1SignatureAlg = null;
- this.asn1Issuer = null;
- this.asn1NotBefore = null;
- this.asn1NotAfter = null;
- this.asn1Subject = null;
- this.asn1SubjPKey = null;
- this.extensionsArray = new Array();
- };
-
- /**
- * set serial number field by parameter
- * @name setSerialNumberByParam
- * @memberOf KJUR.asn1.x509.TBSCertificate
- * @function
- * @param {Array} intParam DERInteger param
- * @description
- * @example
- * tbsc.setSerialNumberByParam({'int': 3});
- */
- this.setSerialNumberByParam = function(intParam) {
- this.asn1SerialNumber = new KJUR.asn1.DERInteger(intParam);
- };
-
- /**
- * set signature algorithm field by parameter
- * @name setSignatureAlgByParam
- * @memberOf KJUR.asn1.x509.TBSCertificate
- * @function
- * @param {Array} algIdParam AlgorithmIdentifier parameter
- * @description
- * @example
- * tbsc.setSignatureAlgByParam({'name': 'SHA1withRSA'});
- */
- this.setSignatureAlgByParam = function(algIdParam) {
- this.asn1SignatureAlg = new KJUR.asn1.x509.AlgorithmIdentifier(algIdParam);
- };
-
- /**
- * set issuer name field by parameter
- * @name setIssuerByParam
- * @memberOf KJUR.asn1.x509.TBSCertificate
- * @function
- * @param {Array} x500NameParam X500Name parameter
- * @description
- * @example
- * tbsc.setIssuerParam({'str': '/C=US/CN=b'});
- * @see KJUR.asn1.x509.X500Name
- */
- this.setIssuerByParam = function(x500NameParam) {
- this.asn1Issuer = new KJUR.asn1.x509.X500Name(x500NameParam);
- };
-
- /**
- * set notBefore field by parameter
- * @name setNotBeforeByParam
- * @memberOf KJUR.asn1.x509.TBSCertificate
- * @function
- * @param {Array} timeParam Time parameter
- * @description
- * @example
- * tbsc.setNotBeforeByParam({'str': '130508235959Z'});
- * @see KJUR.asn1.x509.Time
- */
- this.setNotBeforeByParam = function(timeParam) {
- this.asn1NotBefore = new KJUR.asn1.x509.Time(timeParam);
- };
-
- /**
- * set notAfter field by parameter
- * @name setNotAfterByParam
- * @memberOf KJUR.asn1.x509.TBSCertificate
- * @function
- * @param {Array} timeParam Time parameter
- * @description
- * @example
- * tbsc.setNotAfterByParam({'str': '130508235959Z'});
- * @see KJUR.asn1.x509.Time
- */
- this.setNotAfterByParam = function(timeParam) {
- this.asn1NotAfter = new KJUR.asn1.x509.Time(timeParam);
- };
-
- /**
- * set subject name field by parameter
- * @name setSubjectByParam
- * @memberOf KJUR.asn1.x509.TBSCertificate
- * @function
- * @param {Array} x500NameParam X500Name parameter
- * @description
- * @example
- * tbsc.setSubjectParam({'str': '/C=US/CN=b'});
- * @see KJUR.asn1.x509.X500Name
- */
- this.setSubjectByParam = function(x500NameParam) {
- this.asn1Subject = new KJUR.asn1.x509.X500Name(x500NameParam);
- };
-
- /**
- * (DEPRECATED) set subject public key info field by RSA key parameter
- * @name setSubjectPublicKeyByParam
- * @memberOf KJUR.asn1.x509.TBSCertificate
- * @function
- * @param {Array} subjPKeyParam SubjectPublicKeyInfo parameter of RSA
- * @deprecated
- * @description
- * @example
- * tbsc.setSubjectPublicKeyByParam({'rsakey': pubKey});
- * @see KJUR.asn1.x509.SubjectPublicKeyInfo
- */
- this.setSubjectPublicKeyByParam = function(subjPKeyParam) {
- this.asn1SubjPKey = new KJUR.asn1.x509.SubjectPublicKeyInfo(subjPKeyParam);
- };
-
- /**
- * set subject public key info by RSA/ECDSA/DSA key parameter
- * @name setSubjectPublicKeyByGetKey
- * @memberOf KJUR.asn1.x509.TBSCertificate
- * @function
- * @param {Object} keyParam public key parameter which passed to {@link KEYUTIL.getKey} argument
- * @description
- * @example
- * tbsc.setSubjectPublicKeyByGetKeyParam(certPEMString); // or
- * tbsc.setSubjectPublicKeyByGetKeyParam(pkcs8PublicKeyPEMString); // or
- * tbsc.setSubjectPublicKeyByGetKeyParam(kjurCryptoECDSAKeyObject); // et.al.
- * @see KJUR.asn1.x509.SubjectPublicKeyInfo
- * @see KEYUTIL.getKey
- * @since asn1x509 1.0.6
- */
- this.setSubjectPublicKeyByGetKey = function(keyParam) {
- var keyObj = KEYUTIL.getKey(keyParam);
- this.asn1SubjPKey = new KJUR.asn1.x509.SubjectPublicKeyInfo(keyObj);
- };
-
- /**
- * append X.509v3 extension to this object
- * @name appendExtension
- * @memberOf KJUR.asn1.x509.TBSCertificate
- * @function
- * @param {Extension} extObj X.509v3 Extension object
- * @description
- * @example
- * tbsc.appendExtension(new KJUR.asn1.x509.BasicConstraints({'cA':true, 'critical': true}));
- * tbsc.appendExtension(new KJUR.asn1.x509.KeyUsage({'bin':'11'}));
- * @see KJUR.asn1.x509.Extension
- */
- this.appendExtension = function(extObj) {
- this.extensionsArray.push(extObj);
- };
-
- /**
- * append X.509v3 extension to this object by name and parameters
- * @name appendExtensionByName
- * @memberOf KJUR.asn1.x509.TBSCertificate
- * @function
- * @param {name} name name of X.509v3 Extension object
- * @param {Array} extParams parameters as argument of Extension constructor.
- * @description
- * @example
- * tbsc.appendExtensionByName('BasicConstraints', {'cA':true, 'critical': true});
- * tbsc.appendExtensionByName('KeyUsage', {'bin':'11'});
- * tbsc.appendExtensionByName('CRLDistributionPoints', {uri: 'http://aaa.com/a.crl'});
- * tbsc.appendExtensionByName('ExtKeyUsage', {array: [{name: 'clientAuth'}]});
- * tbsc.appendExtensionByName('AuthorityKeyIdentifier', {kid: '1234ab..'});
- * @see KJUR.asn1.x509.Extension
- */
- this.appendExtensionByName = function(name, extParams) {
- if (name.toLowerCase() == "basicconstraints") {
- var extObj = new KJUR.asn1.x509.BasicConstraints(extParams);
- this.appendExtension(extObj);
- } else if (name.toLowerCase() == "keyusage") {
- var extObj = new KJUR.asn1.x509.KeyUsage(extParams);
- this.appendExtension(extObj);
- } else if (name.toLowerCase() == "crldistributionpoints") {
- var extObj = new KJUR.asn1.x509.CRLDistributionPoints(extParams);
- this.appendExtension(extObj);
- } else if (name.toLowerCase() == "extkeyusage") {
- var extObj = new KJUR.asn1.x509.ExtKeyUsage(extParams);
- this.appendExtension(extObj);
- } else if (name.toLowerCase() == "authoritykeyidentifier") {
- var extObj = new KJUR.asn1.x509.AuthorityKeyIdentifier(extParams);
- this.appendExtension(extObj);
- } else {
- throw "unsupported extension name: " + name;
- }
- };
-
- this.getEncodedHex = function() {
- if (this.asn1NotBefore == null || this.asn1NotAfter == null)
- throw "notBefore and/or notAfter not set";
- var asn1Validity =
- new KJUR.asn1.DERSequence({'array':[this.asn1NotBefore, this.asn1NotAfter]});
-
- this.asn1Array = new Array();
-
- this.asn1Array.push(this.asn1Version);
- this.asn1Array.push(this.asn1SerialNumber);
- this.asn1Array.push(this.asn1SignatureAlg);
- this.asn1Array.push(this.asn1Issuer);
- this.asn1Array.push(asn1Validity);
- this.asn1Array.push(this.asn1Subject);
- this.asn1Array.push(this.asn1SubjPKey);
-
- if (this.extensionsArray.length > 0) {
- var extSeq = new KJUR.asn1.DERSequence({"array": this.extensionsArray});
- var extTagObj = new KJUR.asn1.DERTaggedObject({'explicit': true,
- 'tag': 'a3',
- 'obj': extSeq});
- this.asn1Array.push(extTagObj);
- }
-
- var o = new KJUR.asn1.DERSequence({"array": this.asn1Array});
- this.hTLV = o.getEncodedHex();
- this.isModified = false;
- return this.hTLV;
- };
-
- this._initialize();
-};
-YAHOO.lang.extend(KJUR.asn1.x509.TBSCertificate, KJUR.asn1.ASN1Object);
-
-// === END TBSCertificate ===================================================
-
-// === BEGIN X.509v3 Extensions Related =======================================
-
-/**
- * base Extension ASN.1 structure class
- * @name KJUR.asn1.x509.Extension
- * @class base Extension ASN.1 structure class
- * @param {Array} params associative array of parameters (ex. {'critical': true})
- * @extends KJUR.asn1.ASN1Object
- * @description
- * @example
- * // Extension ::= SEQUENCE {
- * // extnID OBJECT IDENTIFIER,
- * // critical BOOLEAN DEFAULT FALSE,
- * // extnValue OCTET STRING }
- */
-KJUR.asn1.x509.Extension = function(params) {
- KJUR.asn1.x509.Extension.superclass.constructor.call(this);
- var asn1ExtnValue = null;
-
- this.getEncodedHex = function() {
- var asn1Oid = new KJUR.asn1.DERObjectIdentifier({'oid': this.oid});
- var asn1EncapExtnValue =
- new KJUR.asn1.DEROctetString({'hex': this.getExtnValueHex()});
-
- var asn1Array = new Array();
- asn1Array.push(asn1Oid);
- if (this.critical) asn1Array.push(new KJUR.asn1.DERBoolean());
- asn1Array.push(asn1EncapExtnValue);
-
- var asn1Seq = new KJUR.asn1.DERSequence({'array': asn1Array});
- return asn1Seq.getEncodedHex();
- };
-
- this.critical = false;
- if (typeof params != "undefined") {
- if (typeof params['critical'] != "undefined") {
- this.critical = params['critical'];
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.x509.Extension, KJUR.asn1.ASN1Object);
-
-/**
- * KeyUsage ASN.1 structure class
- * @name KJUR.asn1.x509.KeyUsage
- * @class KeyUsage ASN.1 structure class
- * @param {Array} params associative array of parameters (ex. {'bin': '11', 'critical': true})
- * @extends KJUR.asn1.x509.Extension
- * @description
- * @example
- */
-KJUR.asn1.x509.KeyUsage = function(params) {
- KJUR.asn1.x509.KeyUsage.superclass.constructor.call(this, params);
-
- this.getExtnValueHex = function() {
- return this.asn1ExtnValue.getEncodedHex();
- };
-
- this.oid = "2.5.29.15";
- if (typeof params != "undefined") {
- if (typeof params['bin'] != "undefined") {
- this.asn1ExtnValue = new KJUR.asn1.DERBitString(params);
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.x509.KeyUsage, KJUR.asn1.x509.Extension);
-
-/**
- * BasicConstraints ASN.1 structure class
- * @name KJUR.asn1.x509.BasicConstraints
- * @class BasicConstraints ASN.1 structure class
- * @param {Array} params associative array of parameters (ex. {'cA': true, 'critical': true})
- * @extends KJUR.asn1.x509.Extension
- * @description
- * @example
- */
-KJUR.asn1.x509.BasicConstraints = function(params) {
- KJUR.asn1.x509.BasicConstraints.superclass.constructor.call(this, params);
- var cA = false;
- var pathLen = -1;
-
- this.getExtnValueHex = function() {
- var asn1Array = new Array();
- if (this.cA) asn1Array.push(new KJUR.asn1.DERBoolean());
- if (this.pathLen > -1)
- asn1Array.push(new KJUR.asn1.DERInteger({'int': this.pathLen}));
- var asn1Seq = new KJUR.asn1.DERSequence({'array': asn1Array});
- this.asn1ExtnValue = asn1Seq;
- return this.asn1ExtnValue.getEncodedHex();
- };
-
- this.oid = "2.5.29.19";
- this.cA = false;
- this.pathLen = -1;
- if (typeof params != "undefined") {
- if (typeof params['cA'] != "undefined") {
- this.cA = params['cA'];
- }
- if (typeof params['pathLen'] != "undefined") {
- this.pathLen = params['pathLen'];
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.x509.BasicConstraints, KJUR.asn1.x509.Extension);
-
-/**
- * CRLDistributionPoints ASN.1 structure class
- * @name KJUR.asn1.x509.CRLDistributionPoints
- * @class CRLDistributionPoints ASN.1 structure class
- * @param {Array} params associative array of parameters (ex. {'uri': 'http://a.com/', 'critical': true})
- * @extends KJUR.asn1.x509.Extension
- * @description
- * @example
- */
-KJUR.asn1.x509.CRLDistributionPoints = function(params) {
- KJUR.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this, params);
-
- this.getExtnValueHex = function() {
- return this.asn1ExtnValue.getEncodedHex();
- };
-
- this.setByDPArray = function(dpArray) {
- this.asn1ExtnValue = new KJUR.asn1.DERSequence({'array': dpArray});
- };
-
- this.setByOneURI = function(uri) {
- var gn1 = new KJUR.asn1.x509.GeneralNames([{'uri': uri}]);
- var dpn1 = new KJUR.asn1.x509.DistributionPointName(gn1);
- var dp1 = new KJUR.asn1.x509.DistributionPoint({'dpobj': dpn1});
- this.setByDPArray([dp1]);
- };
-
- this.oid = "2.5.29.31";
- if (typeof params != "undefined") {
- if (typeof params['array'] != "undefined") {
- this.setByDPArray(params['array']);
- } else if (typeof params['uri'] != "undefined") {
- this.setByOneURI(params['uri']);
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.x509.CRLDistributionPoints, KJUR.asn1.x509.Extension);
-
-/**
- * KeyUsage ASN.1 structure class
- * @name KJUR.asn1.x509.ExtKeyUsage
- * @class ExtKeyUsage ASN.1 structure class
- * @param {Array} params associative array of parameters
- * @extends KJUR.asn1.x509.Extension
- * @description
- * @example
- * var e1 =
- * new KJUR.asn1.x509.ExtKeyUsage({'critical': true,
- * 'array':
- * [{'oid': '2.5.29.37.0', // anyExtendedKeyUsage
- * 'name': 'clientAuth'}]});
- *
- * // id-ce-extKeyUsage OBJECT IDENTIFIER ::= { id-ce 37 }
- * // ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId
- * // KeyPurposeId ::= OBJECT IDENTIFIER
- */
-KJUR.asn1.x509.ExtKeyUsage = function(params) {
- KJUR.asn1.x509.ExtKeyUsage.superclass.constructor.call(this, params);
-
- this.setPurposeArray = function(purposeArray) {
- this.asn1ExtnValue = new KJUR.asn1.DERSequence();
- for (var i = 0; i < purposeArray.length; i++) {
- var o = new KJUR.asn1.DERObjectIdentifier(purposeArray[i]);
- this.asn1ExtnValue.appendASN1Object(o);
- }
- };
-
- this.getExtnValueHex = function() {
- return this.asn1ExtnValue.getEncodedHex();
- };
-
- this.oid = "2.5.29.37";
- if (typeof params != "undefined") {
- if (typeof params['array'] != "undefined") {
- this.setPurposeArray(params['array']);
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.x509.ExtKeyUsage, KJUR.asn1.x509.Extension);
-
-/**
- * AuthorityKeyIdentifier ASN.1 structure class
- * @name KJUR.asn1.x509.AuthorityKeyIdentifier
- * @class AuthorityKeyIdentifier ASN.1 structure class
- * @param {Array} params associative array of parameters (ex. {'uri': 'http://a.com/', 'critical': true})
- * @extends KJUR.asn1.x509.Extension
- * @since asn1x509 1.0.8
- * @description
- *
- * d-ce-authorityKeyIdentifier OBJECT IDENTIFIER ::= { id-ce 35 }
- * AuthorityKeyIdentifier ::= SEQUENCE {
- * keyIdentifier [0] KeyIdentifier OPTIONAL,
- * authorityCertIssuer [1] GeneralNames OPTIONAL,
- * authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL }
- * KeyIdentifier ::= OCTET STRING
- *
- * @example
- * var param = {'kid': {'hex': '89ab'},
- * 'issuer': {'str': '/C=US/CN=a'},
- * 'sn': {'hex': '1234'},
- * 'critical': true});
- * var e1 = new KJUR.asn1.x509.AuthorityKeyIdentifier(param);
- */
-KJUR.asn1.x509.AuthorityKeyIdentifier = function(params) {
- KJUR.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this, params);
- this.asn1KID = null;
- this.asn1CertIssuer = null;
- this.asn1CertSN = null;
-
- this.getExtnValueHex = function() {
- var a = new Array();
- if (this.asn1KID)
- a.push(new KJUR.asn1.DERTaggedObject({'explicit': false,
- 'tag': '80',
- 'obj': this.asn1KID}));
- if (this.asn1CertIssuer)
- a.push(new KJUR.asn1.DERTaggedObject({'explicit': false,
- 'tag': 'a1',
- 'obj': this.asn1CertIssuer}));
- if (this.asn1CertSN)
- a.push(new KJUR.asn1.DERTaggedObject({'explicit': false,
- 'tag': '82',
- 'obj': this.asn1CertSN}));
-
- var asn1Seq = new KJUR.asn1.DERSequence({'array': a});
- this.asn1ExtnValue = asn1Seq;
- return this.asn1ExtnValue.getEncodedHex();
- };
-
- /**
- * set keyIdentifier value by DERInteger parameter
- * @name setKIDByParam
- * @memberOf KJUR.asn1.x509.AuthorityKeyIdentifier
- * @function
- * @param {Array} param array of {@link KJUR.asn1.DERInteger} parameter
- * @since asn1x509 1.0.8
- * @description
- * NOTE: Automatic keyIdentifier value calculation by an issuer
- * public key will be supported in future version.
- */
- this.setKIDByParam = function(param) {
- this.asn1KID = new KJUR.asn1.DEROctetString(param);
- };
-
- /**
- * set authorityCertIssuer value by X500Name parameter
- * @name setCertIssuerByParam
- * @memberOf KJUR.asn1.x509.AuthorityKeyIdentifier
- * @function
- * @param {Array} param array of {@link KJUR.asn1.x509.X500Name} parameter
- * @since asn1x509 1.0.8
- * @description
- * NOTE: Automatic authorityCertIssuer name setting by an issuer
- * certificate will be supported in future version.
- */
- this.setCertIssuerByParam = function(param) {
- this.asn1CertIssuer = new KJUR.asn1.x509.X500Name(param);
- };
-
- /**
- * set authorityCertSerialNumber value by DERInteger parameter
- * @name setCertSerialNumberByParam
- * @memberOf KJUR.asn1.x509.AuthorityKeyIdentifier
- * @function
- * @param {Array} param array of {@link KJUR.asn1.DERInteger} parameter
- * @since asn1x509 1.0.8
- * @description
- * NOTE: Automatic authorityCertSerialNumber setting by an issuer
- * certificate will be supported in future version.
- */
- this.setCertSNByParam = function(param) {
- this.asn1CertSN = new KJUR.asn1.DERInteger(param);
- };
-
- this.oid = "2.5.29.35";
- if (typeof params != "undefined") {
- if (typeof params['kid'] != "undefined") {
- this.setKIDByParam(params['kid']);
- }
- if (typeof params['issuer'] != "undefined") {
- this.setCertIssuerByParam(params['issuer']);
- }
- if (typeof params['sn'] != "undefined") {
- this.setCertSNByParam(params['sn']);
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.x509.AuthorityKeyIdentifier, KJUR.asn1.x509.Extension);
-
-// === END X.509v3 Extensions Related =======================================
-
-// === BEGIN CRL Related ===================================================
-/**
- * X.509 CRL class to sign and generate hex encoded CRL
- * @name KJUR.asn1.x509.CRL
- * @class X.509 CRL class to sign and generate hex encoded certificate
- * @param {Array} params associative array of parameters (ex. {'tbsobj': obj, 'rsaprvkey': key})
- * @extends KJUR.asn1.ASN1Object
- * @since 1.0.3
- * @description
- *
- * As for argument 'params' for constructor, you can specify one of
- * following properties:
- *
- * tbsobj - specify {@link KJUR.asn1.x509.TBSCertList} object to be signed
- * rsaprvkey - specify {@link RSAKey} object CA private key
- *
- * NOTE: 'params' can be omitted.
- *
EXAMPLE
- * @example
- * var prvKey = new RSAKey(); // CA's private key
- * prvKey.readPrivateKeyFromASN1HexString("3080...");
- * var crl = new KJUR.asn1x509.CRL({'tbsobj': tbs, 'rsaprvkey': prvKey});
- * crl.sign(); // issue CRL by CA's private key
- * var hCRL = crl.getEncodedHex();
- *
- * // CertificateList ::= SEQUENCE {
- * // tbsCertList TBSCertList,
- * // signatureAlgorithm AlgorithmIdentifier,
- * // signatureValue BIT STRING }
- */
-KJUR.asn1.x509.CRL = function(params) {
- KJUR.asn1.x509.CRL.superclass.constructor.call(this);
-
- var asn1TBSCertList = null;
- var asn1SignatureAlg = null;
- var asn1Sig = null;
- var hexSig = null;
- var rsaPrvKey = null;
-
- /**
- * set PKCS#5 encrypted RSA PEM private key as CA key
- * @name setRsaPrvKeyByPEMandPass
- * @memberOf KJUR.asn1.x509.CRL
- * @function
- * @param {String} rsaPEM string of PKCS#5 encrypted RSA PEM private key
- * @param {String} passPEM passcode string to decrypt private key
- * @description
- *
- *
EXAMPLES
- * @example
- */
- this.setRsaPrvKeyByPEMandPass = function(rsaPEM, passPEM) {
- var caKeyHex = PKCS5PKEY.getDecryptedKeyHex(rsaPEM, passPEM);
- var caKey = new RSAKey();
- caKey.readPrivateKeyFromASN1HexString(caKeyHex);
- this.rsaPrvKey = caKey;
- };
-
- /**
- * sign TBSCertList and set signature value internally
- * @name sign
- * @memberOf KJUR.asn1.x509.CRL
- * @function
- * @description
- * @example
- * var cert = new KJUR.asn1.x509.CRL({'tbsobj': tbs, 'rsaprvkey': prvKey});
- * cert.sign();
- */
- this.sign = function() {
- this.asn1SignatureAlg = this.asn1TBSCertList.asn1SignatureAlg;
-
- sig = new KJUR.crypto.Signature({'alg': 'SHA1withRSA', 'prov': 'cryptojs/jsrsa'});
- sig.initSign(this.rsaPrvKey);
- sig.updateHex(this.asn1TBSCertList.getEncodedHex());
- this.hexSig = sig.sign();
-
- this.asn1Sig = new KJUR.asn1.DERBitString({'hex': '00' + this.hexSig});
-
- var seq = new KJUR.asn1.DERSequence({'array': [this.asn1TBSCertList,
- this.asn1SignatureAlg,
- this.asn1Sig]});
- this.hTLV = seq.getEncodedHex();
- this.isModified = false;
- };
-
- this.getEncodedHex = function() {
- if (this.isModified == false && this.hTLV != null) return this.hTLV;
- throw "not signed yet";
- };
-
- /**
- * get PEM formatted CRL string after signed
- * @name getPEMString
- * @memberOf KJUR.asn1.x509.CRL
- * @function
- * @return PEM formatted string of certificate
- * @description
- * @example
- * var cert = new KJUR.asn1.x509.CRL({'tbsobj': tbs, 'rsaprvkey': prvKey});
- * cert.sign();
- * var sPEM = cert.getPEMString();
- */
- this.getPEMString = function() {
- var hCert = this.getEncodedHex();
- var wCert = CryptoJS.enc.Hex.parse(hCert);
- var b64Cert = CryptoJS.enc.Base64.stringify(wCert);
- var pemBody = b64Cert.replace(/(.{64})/g, "$1\r\n");
- return "-----BEGIN X509 CRL-----\r\n" + pemBody + "\r\n-----END X509 CRL-----\r\n";
- };
-
- if (typeof params != "undefined") {
- if (typeof params['tbsobj'] != "undefined") {
- this.asn1TBSCertList = params['tbsobj'];
- }
- if (typeof params['rsaprvkey'] != "undefined") {
- this.rsaPrvKey = params['rsaprvkey'];
- }
- if ((typeof params['rsaprvpem'] != "undefined") &&
- (typeof params['rsaprvpas'] != "undefined")) {
- this.setRsaPrvKeyByPEMandPass(params['rsaprvpem'], params['rsaprvpas']);
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.x509.CRL, KJUR.asn1.ASN1Object);
-
-/**
- * ASN.1 TBSCertList structure class for CRL
- * @name KJUR.asn1.x509.TBSCertList
- * @class ASN.1 TBSCertList structure class for CRL
- * @param {Array} params associative array of parameters (ex. {})
- * @extends KJUR.asn1.ASN1Object
- * @since 1.0.3
- * @description
- *
- *
EXAMPLE
- * @example
- * var o = new KJUR.asn1.x509.TBSCertList();
- * o.setSignatureAlgByParam({'name': 'SHA1withRSA'});
- * o.setIssuerByParam({'str': '/C=US/O=a'});
- * o.setNotThisUpdateByParam({'str': '130504235959Z'});
- * o.setNotNextUpdateByParam({'str': '140504235959Z'});
- * o.addRevokedCert({'int': 4}, {'str':'130514235959Z'}));
- * o.addRevokedCert({'hex': '0f34dd'}, {'str':'130514235959Z'}));
- *
- * // TBSCertList ::= SEQUENCE {
- * // version Version OPTIONAL,
- * // -- if present, MUST be v2
- * // signature AlgorithmIdentifier,
- * // issuer Name,
- * // thisUpdate Time,
- * // nextUpdate Time OPTIONAL,
- * // revokedCertificates SEQUENCE OF SEQUENCE {
- * // userCertificate CertificateSerialNumber,
- * // revocationDate Time,
- * // crlEntryExtensions Extensions OPTIONAL
- * // -- if present, version MUST be v2
- * // } OPTIONAL,
- * // crlExtensions [0] EXPLICIT Extensions OPTIONAL
- */
-KJUR.asn1.x509.TBSCertList = function(params) {
- KJUR.asn1.x509.TBSCertList.superclass.constructor.call(this);
- var aRevokedCert = null;
-
- /**
- * set signature algorithm field by parameter
- * @name setSignatureAlgByParam
- * @memberOf KJUR.asn1.x509.TBSCertList
- * @function
- * @param {Array} algIdParam AlgorithmIdentifier parameter
- * @description
- * @example
- * tbsc.setSignatureAlgByParam({'name': 'SHA1withRSA'});
- */
- this.setSignatureAlgByParam = function(algIdParam) {
- this.asn1SignatureAlg = new KJUR.asn1.x509.AlgorithmIdentifier(algIdParam);
- };
-
- /**
- * set issuer name field by parameter
- * @name setIssuerByParam
- * @memberOf KJUR.asn1.x509.TBSCertList
- * @function
- * @param {Array} x500NameParam X500Name parameter
- * @description
- * @example
- * tbsc.setIssuerParam({'str': '/C=US/CN=b'});
- * @see KJUR.asn1.x509.X500Name
- */
- this.setIssuerByParam = function(x500NameParam) {
- this.asn1Issuer = new KJUR.asn1.x509.X500Name(x500NameParam);
- };
-
- /**
- * set thisUpdate field by parameter
- * @name setThisUpdateByParam
- * @memberOf KJUR.asn1.x509.TBSCertList
- * @function
- * @param {Array} timeParam Time parameter
- * @description
- * @example
- * tbsc.setThisUpdateByParam({'str': '130508235959Z'});
- * @see KJUR.asn1.x509.Time
- */
- this.setThisUpdateByParam = function(timeParam) {
- this.asn1ThisUpdate = new KJUR.asn1.x509.Time(timeParam);
- };
-
- /**
- * set nextUpdate field by parameter
- * @name setNextUpdateByParam
- * @memberOf KJUR.asn1.x509.TBSCertList
- * @function
- * @param {Array} timeParam Time parameter
- * @description
- * @example
- * tbsc.setNextUpdateByParam({'str': '130508235959Z'});
- * @see KJUR.asn1.x509.Time
- */
- this.setNextUpdateByParam = function(timeParam) {
- this.asn1NextUpdate = new KJUR.asn1.x509.Time(timeParam);
- };
-
- /**
- * add revoked certficate by parameter
- * @name addRevokedCert
- * @memberOf KJUR.asn1.x509.TBSCertList
- * @function
- * @param {Array} snParam DERInteger parameter for certificate serial number
- * @param {Array} timeParam Time parameter for revocation date
- * @description
- * @example
- * tbsc.addRevokedCert({'int': 3}, {'str': '130508235959Z'});
- * @see KJUR.asn1.x509.Time
- */
- this.addRevokedCert = function(snParam, timeParam) {
- var param = {};
- if (snParam != undefined && snParam != null) param['sn'] = snParam;
- if (timeParam != undefined && timeParam != null) param['time'] = timeParam;
- var o = new KJUR.asn1.x509.CRLEntry(param);
- this.aRevokedCert.push(o);
- };
-
- this.getEncodedHex = function() {
- this.asn1Array = new Array();
-
- if (this.asn1Version != null) this.asn1Array.push(this.asn1Version);
- this.asn1Array.push(this.asn1SignatureAlg);
- this.asn1Array.push(this.asn1Issuer);
- this.asn1Array.push(this.asn1ThisUpdate);
- if (this.asn1NextUpdate != null) this.asn1Array.push(this.asn1NextUpdate);
-
- if (this.aRevokedCert.length > 0) {
- var seq = new KJUR.asn1.DERSequence({'array': this.aRevokedCert});
- this.asn1Array.push(seq);
- }
-
- var o = new KJUR.asn1.DERSequence({"array": this.asn1Array});
- this.hTLV = o.getEncodedHex();
- this.isModified = false;
- return this.hTLV;
- };
-
- this._initialize = function() {
- this.asn1Version = null;
- this.asn1SignatureAlg = null;
- this.asn1Issuer = null;
- this.asn1ThisUpdate = null;
- this.asn1NextUpdate = null;
- this.aRevokedCert = new Array();
- };
-
- this._initialize();
-};
-YAHOO.lang.extend(KJUR.asn1.x509.TBSCertList, KJUR.asn1.ASN1Object);
-
-/**
- * ASN.1 CRLEntry structure class for CRL
- * @name KJUR.asn1.x509.CRLEntry
- * @class ASN.1 CRLEntry structure class for CRL
- * @param {Array} params associative array of parameters (ex. {})
- * @extends KJUR.asn1.ASN1Object
- * @since 1.0.3
- * @description
- * @example
- * var e = new KJUR.asn1.x509.CRLEntry({'time': {'str': '130514235959Z'}, 'sn': {'int': 234}});
- *
- * // revokedCertificates SEQUENCE OF SEQUENCE {
- * // userCertificate CertificateSerialNumber,
- * // revocationDate Time,
- * // crlEntryExtensions Extensions OPTIONAL
- * // -- if present, version MUST be v2 }
- */
-KJUR.asn1.x509.CRLEntry = function(params) {
- KJUR.asn1.x509.CRLEntry.superclass.constructor.call(this);
- var sn = null;
- var time = null;
-
- /**
- * set DERInteger parameter for serial number of revoked certificate
- * @name setCertSerial
- * @memberOf KJUR.asn1.x509.CRLEntry
- * @function
- * @param {Array} intParam DERInteger parameter for certificate serial number
- * @description
- * @example
- * entry.setCertSerial({'int': 3});
- */
- this.setCertSerial = function(intParam) {
- this.sn = new KJUR.asn1.DERInteger(intParam);
- };
-
- /**
- * set Time parameter for revocation date
- * @name setRevocationDate
- * @memberOf KJUR.asn1.x509.CRLEntry
- * @function
- * @param {Array} timeParam Time parameter for revocation date
- * @description
- * @example
- * entry.setRevocationDate({'str': '130508235959Z'});
- */
- this.setRevocationDate = function(timeParam) {
- this.time = new KJUR.asn1.x509.Time(timeParam);
- };
-
- this.getEncodedHex = function() {
- var o = new KJUR.asn1.DERSequence({"array": [this.sn, this.time]});
- this.TLV = o.getEncodedHex();
- return this.TLV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params['time'] != "undefined") {
- this.setRevocationDate(params['time']);
- }
- if (typeof params['sn'] != "undefined") {
- this.setCertSerial(params['sn']);
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.x509.CRLEntry, KJUR.asn1.ASN1Object);
-
-// === END CRL Related ===================================================
-
-// === BEGIN X500Name Related =================================================
-/**
- * X500Name ASN.1 structure class
- * @name KJUR.asn1.x509.X500Name
- * @class X500Name ASN.1 structure class
- * @param {Array} params associative array of parameters (ex. {'str': '/C=US/O=a'})
- * @extends KJUR.asn1.ASN1Object
- * @description
- * @example
- * // 1. construct with string
- * o = new KJUR.asn1.x509.X500Name({str: "/C=US/O=aaa/OU=bbb/CN=foo@example.com"});
- * // 2. construct by object
- * o = new KJUR.asn1.x509.X500Name({C: "US", O: "aaa", CN: "http://example.com/"});
- */
-KJUR.asn1.x509.X500Name = function(params) {
- KJUR.asn1.x509.X500Name.superclass.constructor.call(this);
- this.asn1Array = new Array();
-
- /**
- * set DN by string
- * @name setByString
- * @memberOf KJUR.asn1.x509.X500Name
- * @function
- * @param {Array} dnStr distinguished name by string (ex. /C=US/O=aaa)
- * @description
- * @example
- * name = new KJUR.asn1.x509.X500Name();
- * name.setByString("/C=US/O=aaa/OU=bbb/CN=foo@example.com");
- */
- this.setByString = function(dnStr) {
- var a = dnStr.split('/');
- a.shift();
- for (var i = 0; i < a.length; i++) {
- this.asn1Array.push(new KJUR.asn1.x509.RDN({'str':a[i]}));
- }
- };
-
- /**
- * set DN by associative array
- * @name setByObject
- * @memberOf KJUR.asn1.x509.X500Name
- * @function
- * @param {Array} dnObj associative array of DN (ex. {C: "US", O: "aaa"})
- * @since jsrsasign 4.9. asn1x509 1.0.13
- * @description
- * @example
- * name = new KJUR.asn1.x509.X500Name();
- * name.setByObject({C: "US", O: "aaa", CN="http://example.com/"1});
- */
- this.setByObject = function(dnObj) {
- // Get all the dnObject attributes and stuff them in the ASN.1 array.
- for (var x in dnObj) {
- if (dnObj.hasOwnProperty(x)) {
- var newRDN = new KJUR.asn1.x509.RDN(
- {'str': x + '=' + dnObj[x]});
- // Initialize or push into the ANS1 array.
- this.asn1Array ? this.asn1Array.push(newRDN)
- : this.asn1Array = [newRDN];
- }
- }
- };
-
- this.getEncodedHex = function() {
- if (typeof this.hTLV == "string") return this.hTLV;
- var o = new KJUR.asn1.DERSequence({"array": this.asn1Array});
- this.hTLV = o.getEncodedHex();
- return this.hTLV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params['str'] != "undefined") {
- this.setByString(params['str']);
- // If params is an object, then set the ASN1 array just using the object
- // attributes. This is nice for fields that have lots of special
- // characters (i.e. CN: 'http://www.github.com/kjur//').
- } else if (typeof params === "object") {
- this.setByObject(params);
- }
-
- if (typeof params.certissuer != "undefined") {
- var x = new X509();
- x.hex = X509.pemToHex(params.certissuer);
- this.hTLV = x.getIssuerHex();
- }
- if (typeof params.certsubject != "undefined") {
- var x = new X509();
- x.hex = X509.pemToHex(params.certsubject);
- this.hTLV = x.getSubjectHex();
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.x509.X500Name, KJUR.asn1.ASN1Object);
-
-/**
- * RDN (Relative Distinguish Name) ASN.1 structure class
- * @name KJUR.asn1.x509.RDN
- * @class RDN (Relative Distinguish Name) ASN.1 structure class
- * @param {Array} params associative array of parameters (ex. {'str': 'C=US'})
- * @extends KJUR.asn1.ASN1Object
- * @description
- * @example
- */
-KJUR.asn1.x509.RDN = function(params) {
- KJUR.asn1.x509.RDN.superclass.constructor.call(this);
- this.asn1Array = new Array();
-
- this.addByString = function(rdnStr) {
- this.asn1Array.push(new KJUR.asn1.x509.AttributeTypeAndValue({'str':rdnStr}));
- };
-
- this.getEncodedHex = function() {
- var o = new KJUR.asn1.DERSet({"array": this.asn1Array});
- this.TLV = o.getEncodedHex();
- return this.TLV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params['str'] != "undefined") {
- this.addByString(params['str']);
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.x509.RDN, KJUR.asn1.ASN1Object);
-
-/**
- * AttributeTypeAndValue ASN.1 structure class
- * @name KJUR.asn1.x509.AttributeTypeAndValue
- * @class AttributeTypeAndValue ASN.1 structure class
- * @param {Array} params associative array of parameters (ex. {'str': 'C=US'})
- * @extends KJUR.asn1.ASN1Object
- * @description
- * @example
- */
-KJUR.asn1.x509.AttributeTypeAndValue = function(params) {
- KJUR.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this);
- var typeObj = null;
- var valueObj = null;
- var defaultDSType = "utf8";
-
- this.setByString = function(attrTypeAndValueStr) {
- if (attrTypeAndValueStr.match(/^([^=]+)=(.+)$/)) {
- this.setByAttrTypeAndValueStr(RegExp.$1, RegExp.$2);
- } else {
- throw "malformed attrTypeAndValueStr: " + attrTypeAndValueStr;
- }
- };
-
- this.setByAttrTypeAndValueStr = function(shortAttrType, valueStr) {
- this.typeObj = KJUR.asn1.x509.OID.atype2obj(shortAttrType);
- var dsType = defaultDSType;
- if (shortAttrType == "C") dsType = "prn";
- this.valueObj = this.getValueObj(dsType, valueStr);
- };
-
- this.getValueObj = function(dsType, valueStr) {
- if (dsType == "utf8") return new KJUR.asn1.DERUTF8String({"str": valueStr});
- if (dsType == "prn") return new KJUR.asn1.DERPrintableString({"str": valueStr});
- if (dsType == "tel") return new KJUR.asn1.DERTeletexString({"str": valueStr});
- if (dsType == "ia5") return new KJUR.asn1.DERIA5String({"str": valueStr});
- throw "unsupported directory string type: type=" + dsType + " value=" + valueStr;
- };
-
- this.getEncodedHex = function() {
- var o = new KJUR.asn1.DERSequence({"array": [this.typeObj, this.valueObj]});
- this.TLV = o.getEncodedHex();
- return this.TLV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params['str'] != "undefined") {
- this.setByString(params['str']);
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.x509.AttributeTypeAndValue, KJUR.asn1.ASN1Object);
-
-// === END X500Name Related =================================================
-
-// === BEGIN Other ASN1 structure class ======================================
-
-/**
- * SubjectPublicKeyInfo ASN.1 structure class
- * @name KJUR.asn1.x509.SubjectPublicKeyInfo
- * @class SubjectPublicKeyInfo ASN.1 structure class
- * @param {Object} params parameter for subject public key
- * @extends KJUR.asn1.ASN1Object
- * @description
- *
- * As for argument 'params' for constructor, you can specify one of
- * following properties:
- *
- * {@link RSAKey} object
- * {@link KJUR.crypto.ECDSA} object
- * {@link KJUR.crypto.DSA} object
- * (DEPRECATED)rsakey - specify {@link RSAKey} object of subject public key
- * (DEPRECATED)rsapem - specify a string of PEM public key of RSA key
- *
- * NOTE1: 'params' can be omitted.
- * NOTE2: DSA/ECDSA key object is also supported since asn1x509 1.0.6.
- *
EXAMPLE
- * @example
- * var spki = new KJUR.asn1.x509.SubjectPublicKeyInfo(RSAKey_object);
- * var spki = new KJUR.asn1.x509.SubjectPublicKeyInfo(KJURcryptoECDSA_object);
- * var spki = new KJUR.asn1.x509.SubjectPublicKeyInfo(KJURcryptoDSA_object);
- */
-KJUR.asn1.x509.SubjectPublicKeyInfo = function(params) {
- KJUR.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);
- var asn1AlgId = null;
- var asn1SubjPKey = null;
- var rsaKey = null;
-
- /**
- * (DEPRECATED) set RSAKey object as subject public key
- * @name setRSAKey
- * @memberOf KJUR.asn1.x509.SubjectPublicKeyInfo
- * @function
- * @param {RSAKey} rsaKey {@link RSAKey} object for RSA public key
- * @description
- * @deprecated
- * @example
- * spki.setRSAKey(rsaKey);
- */
- this.setRSAKey = function(rsaKey) {
- if (! RSAKey.prototype.isPrototypeOf(rsaKey))
- throw "argument is not RSAKey instance";
- this.rsaKey = rsaKey;
- var asn1RsaN = new KJUR.asn1.DERInteger({'bigint': rsaKey.n});
- var asn1RsaE = new KJUR.asn1.DERInteger({'int': rsaKey.e});
- var asn1RsaPub = new KJUR.asn1.DERSequence({'array': [asn1RsaN, asn1RsaE]});
- var rsaKeyHex = asn1RsaPub.getEncodedHex();
- this.asn1AlgId = new KJUR.asn1.x509.AlgorithmIdentifier({'name':'rsaEncryption'});
- this.asn1SubjPKey = new KJUR.asn1.DERBitString({'hex':'00'+rsaKeyHex});
- };
-
- /**
- * (DEPRECATED) set a PEM formatted RSA public key string as RSA public key
- * @name setRSAPEM
- * @memberOf KJUR.asn1.x509.SubjectPublicKeyInfo
- * @function
- * @param {String} rsaPubPEM PEM formatted RSA public key string
- * @deprecated
- * @description
- * @example
- * spki.setRSAPEM(rsaPubPEM);
- */
- this.setRSAPEM = function(rsaPubPEM) {
- if (rsaPubPEM.match(/-----BEGIN PUBLIC KEY-----/)) {
- var s = rsaPubPEM;
- s = s.replace(/^-----[^-]+-----/, '');
- s = s.replace(/-----[^-]+-----\s*$/, '');
- var rsaB64 = s.replace(/\s+/g, '');
- var rsaWA = CryptoJS.enc.Base64.parse(rsaB64);
- var rsaP8Hex = CryptoJS.enc.Hex.stringify(rsaWA);
- var a = _rsapem_getHexValueArrayOfChildrenFromHex(rsaP8Hex);
- var hBitStrVal = a[1];
- var rsaHex = hBitStrVal.substr(2);
- var a3 = _rsapem_getHexValueArrayOfChildrenFromHex(rsaHex);
- var rsaKey = new RSAKey();
- rsaKey.setPublic(a3[0], a3[1]);
- this.setRSAKey(rsaKey);
- } else {
- throw "key not supported";
- }
- };
-
- /*
- * @since asn1x509 1.0.7
- */
- this.getASN1Object = function() {
- if (this.asn1AlgId == null || this.asn1SubjPKey == null)
- throw "algId and/or subjPubKey not set";
- var o = new KJUR.asn1.DERSequence({'array':
- [this.asn1AlgId, this.asn1SubjPKey]});
- return o;
- };
-
- this.getEncodedHex = function() {
- var o = this.getASN1Object();
- this.hTLV = o.getEncodedHex();
- return this.hTLV;
- };
-
- this._setRSAKey = function(key) {
- var asn1RsaPub = KJUR.asn1.ASN1Util.newObject({
- 'seq': [{'int': {'bigint': key.n}}, {'int': {'int': key.e}}]
- });
- var rsaKeyHex = asn1RsaPub.getEncodedHex();
- this.asn1AlgId = new KJUR.asn1.x509.AlgorithmIdentifier({'name':'rsaEncryption'});
- this.asn1SubjPKey = new KJUR.asn1.DERBitString({'hex':'00'+rsaKeyHex});
- };
-
- this._setEC = function(key) {
- var asn1Params = new KJUR.asn1.DERObjectIdentifier({'name': key.curveName});
- this.asn1AlgId =
- new KJUR.asn1.x509.AlgorithmIdentifier({'name': 'ecPublicKey',
- 'asn1params': asn1Params});
- this.asn1SubjPKey = new KJUR.asn1.DERBitString({'hex': '00' + key.pubKeyHex});
- };
-
- this._setDSA = function(key) {
- var asn1Params = new KJUR.asn1.ASN1Util.newObject({
- 'seq': [{'int': {'bigint': key.p}},
- {'int': {'bigint': key.q}},
- {'int': {'bigint': key.g}}]
- });
- this.asn1AlgId =
- new KJUR.asn1.x509.AlgorithmIdentifier({'name': 'dsa',
- 'asn1params': asn1Params});
- var pubInt = new KJUR.asn1.DERInteger({'bigint': key.y});
- this.asn1SubjPKey = new KJUR.asn1.DERBitString({'hex': '00' + pubInt.getEncodedHex()});
- };
-
- if (typeof params != "undefined") {
- if (typeof RSAKey != 'undefined' && params instanceof RSAKey) {
- this._setRSAKey(params);
- } else if (typeof KJUR.crypto.ECDSA != 'undefined' &&
- params instanceof KJUR.crypto.ECDSA) {
- this._setEC(params);
- } else if (typeof KJUR.crypto.DSA != 'undefined' &&
- params instanceof KJUR.crypto.DSA) {
- this._setDSA(params);
- } else if (typeof params['rsakey'] != "undefined") {
- this.setRSAKey(params['rsakey']);
- } else if (typeof params['rsapem'] != "undefined") {
- this.setRSAPEM(params['rsapem']);
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.x509.SubjectPublicKeyInfo, KJUR.asn1.ASN1Object);
-
-/**
- * Time ASN.1 structure class
- * @name KJUR.asn1.x509.Time
- * @class Time ASN.1 structure class
- * @param {Array} params associative array of parameters (ex. {'str': '130508235959Z'})
- * @extends KJUR.asn1.ASN1Object
- * @description
- *
- *
EXAMPLES
- * @example
- * var t1 = new KJUR.asn1.x509.Time{'str': '130508235959Z'} // UTCTime by default
- * var t2 = new KJUR.asn1.x509.Time{'type': 'gen', 'str': '20130508235959Z'} // GeneralizedTime
- */
-KJUR.asn1.x509.Time = function(params) {
- KJUR.asn1.x509.Time.superclass.constructor.call(this);
- var type = null;
- var timeParams = null;
-
- this.setTimeParams = function(timeParams) {
- this.timeParams = timeParams;
- }
-
- this.getEncodedHex = function() {
- var o = null;
-
- if (this.timeParams != null) {
- if (this.type == "utc") {
- o = new KJUR.asn1.DERUTCTime(this.timeParams);
- } else {
- o = new KJUR.asn1.DERGeneralizedTime(this.timeParams);
- }
- } else {
- if (this.type == "utc") {
- o = new KJUR.asn1.DERUTCTime();
- } else {
- o = new KJUR.asn1.DERGeneralizedTime();
- }
- }
- this.TLV = o.getEncodedHex();
- return this.TLV;
- };
-
- this.type = "utc";
- if (typeof params != "undefined") {
- if (typeof params.type != "undefined") {
- this.type = params.type;
- } else {
- if (typeof params.str != "undefined") {
- if (params.str.match(/^[0-9]{12}Z$/)) this.type = "utc";
- if (params.str.match(/^[0-9]{14}Z$/)) this.type = "gen";
- }
- }
- this.timeParams = params;
- }
-};
-YAHOO.lang.extend(KJUR.asn1.x509.Time, KJUR.asn1.ASN1Object);
-
-/**
- * AlgorithmIdentifier ASN.1 structure class
- * @name KJUR.asn1.x509.AlgorithmIdentifier
- * @class AlgorithmIdentifier ASN.1 structure class
- * @param {Array} params associative array of parameters (ex. {'name': 'SHA1withRSA'})
- * @extends KJUR.asn1.ASN1Object
- * @description
- * @example
- */
-KJUR.asn1.x509.AlgorithmIdentifier = function(params) {
- KJUR.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this);
- var nameAlg = null;
- var asn1Alg = null;
- var asn1Params = null;
- var paramEmpty = false;
-
- this.getEncodedHex = function() {
- if (this.nameAlg == null && this.asn1Alg == null) {
- throw "algorithm not specified";
- }
- if (this.nameAlg != null && this.asn1Alg == null) {
- this.asn1Alg = KJUR.asn1.x509.OID.name2obj(this.nameAlg);
- }
- var a = [this.asn1Alg];
- if (! this.paramEmpty) a.push(this.asn1Params);
- var o = new KJUR.asn1.DERSequence({'array': a});
- this.hTLV = o.getEncodedHex();
- return this.hTLV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params['name'] != "undefined") {
- this.nameAlg = params['name'];
- }
- if (typeof params['asn1params'] != "undefined") {
- this.asn1Params = params['asn1params'];
- }
- if (typeof params['paramempty'] != "undefined") {
- this.paramEmpty = params['paramempty'];
- }
- }
- if (this.asn1Params == null) {
- this.asn1Params = new KJUR.asn1.DERNull();
- }
-};
-YAHOO.lang.extend(KJUR.asn1.x509.AlgorithmIdentifier, KJUR.asn1.ASN1Object);
-
-/**
- * GeneralName ASN.1 structure class
- * @name KJUR.asn1.x509.GeneralName
- * @class GeneralName ASN.1 structure class
- * @description
- *
- * As for argument 'params' for constructor, you can specify one of
- * following properties:
- *
- * rfc822 - rfc822Name[1] (ex. user1@foo.com)
- * dns - dNSName[2] (ex. foo.com)
- * uri - uniformResourceIdentifier[6] (ex. http://foo.com/)
- * certissuer - directoryName[4] (PEM or hex string of cert)
- * certsubj - directoryName[4] (PEM or hex string of cert)
- *
- * NOTE1: certissuer and certsubj is supported since asn1x509 1.0.10.
- *
- * Here is definition of the ASN.1 syntax:
- *
- * -- NOTE: under the CHOICE, it will always be explicit.
- * GeneralName ::= CHOICE {
- * otherName [0] OtherName,
- * rfc822Name [1] IA5String,
- * dNSName [2] IA5String,
- * x400Address [3] ORAddress,
- * directoryName [4] Name,
- * ediPartyName [5] EDIPartyName,
- * uniformResourceIdentifier [6] IA5String,
- * iPAddress [7] OCTET STRING,
- * registeredID [8] OBJECT IDENTIFIER }
- *
- *
- *
- *
- * @example
- * gn = new KJUR.asn1.x509.GeneralName({rfc822: 'test@aaa.com'});
- * gn = new KJUR.asn1.x509.GeneralName({dns: 'aaa.com'});
- * gn = new KJUR.asn1.x509.GeneralName({uri: 'http://aaa.com/'});
- * gn = new KJUR.asn1.x509.GeneralName({certissuer: certPEM});
- * gn = new KJUR.asn1.x509.GeneralName({certsubj: certPEM});
- */
-KJUR.asn1.x509.GeneralName = function(params) {
- KJUR.asn1.x509.GeneralName.superclass.constructor.call(this);
- var asn1Obj = null;
- var type = null;
- var pTag = {rfc822: '81', dns: '82', dn: 'a4', uri: '86'};
- this.explicit = false;
-
- this.setByParam = function(params) {
- var str = null;
- var v = null;
-
- if (typeof params == "undefined") return;
-
- if (typeof params.rfc822 != "undefined") {
- this.type = 'rfc822';
- v = new KJUR.asn1.DERIA5String({'str': params[this.type]});
- }
- if (typeof params.dns != "undefined") {
- this.type = 'dns';
- v = new KJUR.asn1.DERIA5String({'str': params[this.type]});
- }
- if (typeof params.uri != "undefined") {
- this.type = 'uri';
- v = new KJUR.asn1.DERIA5String({'str': params[this.type]});
- }
- if (typeof params.certissuer != "undefined") {
- this.type = 'dn';
- this.explicit = true;
- var certStr = params.certissuer;
- var certHex = null;
- if (certStr.match(/^[0-9A-Fa-f]+$/)) {
- certHex == certStr;
- }
- if (certStr.indexOf("-----BEGIN ") != -1) {
- certHex = X509.pemToHex(certStr);
- }
- if (certHex == null) throw "certissuer param not cert";
- var x = new X509();
- x.hex = certHex;
- var dnHex = x.getIssuerHex();
- v = new KJUR.asn1.ASN1Object();
- v.hTLV = dnHex;
- }
- if (typeof params.certsubj != "undefined") {
- this.type = 'dn';
- this.explicit = true;
- var certStr = params.certsubj;
- var certHex = null;
- if (certStr.match(/^[0-9A-Fa-f]+$/)) {
- certHex == certStr;
- }
- if (certStr.indexOf("-----BEGIN ") != -1) {
- certHex = X509.pemToHex(certStr);
- }
- if (certHex == null) throw "certsubj param not cert";
- var x = new X509();
- x.hex = certHex;
- var dnHex = x.getSubjectHex();
- v = new KJUR.asn1.ASN1Object();
- v.hTLV = dnHex;
- }
-
- if (this.type == null)
- throw "unsupported type in params=" + params;
- this.asn1Obj = new KJUR.asn1.DERTaggedObject({'explicit': this.explicit,
- 'tag': pTag[this.type],
- 'obj': v});
- };
-
- this.getEncodedHex = function() {
- return this.asn1Obj.getEncodedHex();
- }
-
- if (typeof params != "undefined") {
- this.setByParam(params);
- }
-
-};
-YAHOO.lang.extend(KJUR.asn1.x509.GeneralName, KJUR.asn1.ASN1Object);
-
-/**
- * GeneralNames ASN.1 structure class
- * @name KJUR.asn1.x509.GeneralNames
- * @class GeneralNames ASN.1 structure class
- * @description
- *
- *
EXAMPLE AND ASN.1 SYNTAX
- * @example
- * var gns = new KJUR.asn1.x509.GeneralNames([{'uri': 'http://aaa.com/'}, {'uri': 'http://bbb.com/'}]);
- *
- * GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
- */
-KJUR.asn1.x509.GeneralNames = function(paramsArray) {
- KJUR.asn1.x509.GeneralNames.superclass.constructor.call(this);
- var asn1Array = null;
-
- /**
- * set a array of {@link KJUR.asn1.x509.GeneralName} parameters
- * @name setByParamArray
- * @memberOf KJUR.asn1.x509.GeneralNames
- * @function
- * @param {Array} paramsArray Array of {@link KJUR.asn1.x509.GeneralNames}
- * @description
- *
- *
EXAMPLES
- * @example
- * var gns = new KJUR.asn1.x509.GeneralNames();
- * gns.setByParamArray([{'uri': 'http://aaa.com/'}, {'uri': 'http://bbb.com/'}]);
- */
- this.setByParamArray = function(paramsArray) {
- for (var i = 0; i < paramsArray.length; i++) {
- var o = new KJUR.asn1.x509.GeneralName(paramsArray[i]);
- this.asn1Array.push(o);
- }
- };
-
- this.getEncodedHex = function() {
- var o = new KJUR.asn1.DERSequence({'array': this.asn1Array});
- return o.getEncodedHex();
- };
-
- this.asn1Array = new Array();
- if (typeof paramsArray != "undefined") {
- this.setByParamArray(paramsArray);
- }
-};
-YAHOO.lang.extend(KJUR.asn1.x509.GeneralNames, KJUR.asn1.ASN1Object);
-
-/**
- * DistributionPointName ASN.1 structure class
- * @name KJUR.asn1.x509.DistributionPointName
- * @class DistributionPointName ASN.1 structure class
- * @description
- * @example
- */
-KJUR.asn1.x509.DistributionPointName = function(gnOrRdn) {
- KJUR.asn1.x509.DistributionPointName.superclass.constructor.call(this);
- var asn1Obj = null;
- var type = null;
- var tag = null;
- var asn1V = null;
-
- this.getEncodedHex = function() {
- if (this.type != "full")
- throw "currently type shall be 'full': " + this.type;
- this.asn1Obj = new KJUR.asn1.DERTaggedObject({'explicit': false,
- 'tag': this.tag,
- 'obj': this.asn1V});
- this.hTLV = this.asn1Obj.getEncodedHex();
- return this.hTLV;
- };
-
- if (typeof gnOrRdn != "undefined") {
- if (KJUR.asn1.x509.GeneralNames.prototype.isPrototypeOf(gnOrRdn)) {
- this.type = "full";
- this.tag = "a0";
- this.asn1V = gnOrRdn;
- } else {
- throw "This class supports GeneralNames only as argument";
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.x509.DistributionPointName, KJUR.asn1.ASN1Object);
-
-/**
- * DistributionPoint ASN.1 structure class
- * @name KJUR.asn1.x509.DistributionPoint
- * @class DistributionPoint ASN.1 structure class
- * @description
- * @example
- */
-KJUR.asn1.x509.DistributionPoint = function(params) {
- KJUR.asn1.x509.DistributionPoint.superclass.constructor.call(this);
- var asn1DP = null;
-
- this.getEncodedHex = function() {
- var seq = new KJUR.asn1.DERSequence();
- if (this.asn1DP != null) {
- var o1 = new KJUR.asn1.DERTaggedObject({'explicit': true,
- 'tag': 'a0',
- 'obj': this.asn1DP});
- seq.appendASN1Object(o1);
- }
- this.hTLV = seq.getEncodedHex();
- return this.hTLV;
- };
-
- if (typeof params != "undefined") {
- if (typeof params['dpobj'] != "undefined") {
- this.asn1DP = params['dpobj'];
- }
- }
-};
-YAHOO.lang.extend(KJUR.asn1.x509.DistributionPoint, KJUR.asn1.ASN1Object);
-
-/**
- * static object for OID
- * @name KJUR.asn1.x509.OID
- * @class static object for OID
- * @property {Assoc Array} atype2oidList for short attribyte type name and oid (i.e. 'C' and '2.5.4.6')
- * @property {Assoc Array} name2oidList for oid name and oid (i.e. 'keyUsage' and '2.5.29.15')
- * @property {Assoc Array} objCache for caching name and DERObjectIdentifier object
- * @description
- *
- * atype2oidList
- * currently supports 'C', 'O', 'OU', 'ST', 'L' and 'CN' only.
- * name2oidList
- * currently supports 'SHA1withRSA', 'rsaEncryption' and some extension OIDs
- *
- * @example
- */
-KJUR.asn1.x509.OID = new function(params) {
- this.atype2oidList = {
- 'C': '2.5.4.6',
- 'O': '2.5.4.10',
- 'OU': '2.5.4.11',
- 'ST': '2.5.4.8',
- 'L': '2.5.4.7',
- 'CN': '2.5.4.3',
- 'SN': '2.5.4.4',
- 'DN': '2.5.4.49',
- 'DC': '0.9.2342.19200300.100.1.25',
- };
- this.name2oidList = {
- 'sha1': '1.3.14.3.2.26',
- 'sha256': '2.16.840.1.101.3.4.2.1',
- 'sha384': '2.16.840.1.101.3.4.2.2',
- 'sha512': '2.16.840.1.101.3.4.2.3',
- 'sha224': '2.16.840.1.101.3.4.2.4',
- 'md5': '1.2.840.113549.2.5',
- 'md2': '1.3.14.7.2.2.1',
- 'ripemd160': '1.3.36.3.2.1',
-
- 'MD2withRSA': '1.2.840.113549.1.1.2',
- 'MD4withRSA': '1.2.840.113549.1.1.3',
- 'MD5withRSA': '1.2.840.113549.1.1.4',
- 'SHA1withRSA': '1.2.840.113549.1.1.5',
- 'SHA224withRSA': '1.2.840.113549.1.1.14',
- 'SHA256withRSA': '1.2.840.113549.1.1.11',
- 'SHA384withRSA': '1.2.840.113549.1.1.12',
- 'SHA512withRSA': '1.2.840.113549.1.1.13',
-
- 'SHA1withECDSA': '1.2.840.10045.4.1',
- 'SHA224withECDSA': '1.2.840.10045.4.3.1',
- 'SHA256withECDSA': '1.2.840.10045.4.3.2',
- 'SHA384withECDSA': '1.2.840.10045.4.3.3',
- 'SHA512withECDSA': '1.2.840.10045.4.3.4',
-
- 'dsa': '1.2.840.10040.4.1',
- 'SHA1withDSA': '1.2.840.10040.4.3',
- 'SHA224withDSA': '2.16.840.1.101.3.4.3.1',
- 'SHA256withDSA': '2.16.840.1.101.3.4.3.2',
-
- 'rsaEncryption': '1.2.840.113549.1.1.1',
-
- 'countryName': '2.5.4.6',
- 'organization': '2.5.4.10',
- 'organizationalUnit': '2.5.4.11',
- 'stateOrProvinceName': '2.5.4.8',
- 'locality': '2.5.4.7',
- 'commonName': '2.5.4.3',
-
- 'subjectKeyIdentifier': '2.5.29.14',
- 'keyUsage': '2.5.29.15',
- 'subjectAltName': '2.5.29.17',
- 'basicConstraints': '2.5.29.19',
- 'nameConstraints': '2.5.29.30',
- 'cRLDistributionPoints':'2.5.29.31',
- 'certificatePolicies': '2.5.29.32',
- 'authorityKeyIdentifier':'2.5.29.35',
- 'policyConstraints': '2.5.29.36',
- 'extKeyUsage': '2.5.29.37',
- 'authorityInfoAccess': '1.3.6.1.5.5.7.1.1',
-
- 'anyExtendedKeyUsage': '2.5.29.37.0',
- 'serverAuth': '1.3.6.1.5.5.7.3.1',
- 'clientAuth': '1.3.6.1.5.5.7.3.2',
- 'codeSigning': '1.3.6.1.5.5.7.3.3',
- 'emailProtection': '1.3.6.1.5.5.7.3.4',
- 'timeStamping': '1.3.6.1.5.5.7.3.8',
- 'ocspSigning': '1.3.6.1.5.5.7.3.9',
-
- 'ecPublicKey': '1.2.840.10045.2.1',
- 'secp256r1': '1.2.840.10045.3.1.7',
- 'secp256k1': '1.3.132.0.10',
- 'secp384r1': '1.3.132.0.34',
-
- 'pkcs5PBES2': '1.2.840.113549.1.5.13',
- 'pkcs5PBKDF2': '1.2.840.113549.1.5.12',
-
- 'des-EDE3-CBC': '1.2.840.113549.3.7',
-
- 'data': '1.2.840.113549.1.7.1', // CMS data
- 'signed-data': '1.2.840.113549.1.7.2', // CMS signed-data
- 'enveloped-data': '1.2.840.113549.1.7.3', // CMS enveloped-data
- 'digested-data': '1.2.840.113549.1.7.5', // CMS digested-data
- 'encrypted-data': '1.2.840.113549.1.7.6', // CMS encrypted-data
- 'authenticated-data': '1.2.840.113549.1.9.16.1.2', // CMS authenticated-data
- 'tstinfo': '1.2.840.113549.1.9.16.1.4', // RFC3161 TSTInfo
- };
-
- this.objCache = {};
-
- /**
- * get DERObjectIdentifier by registered OID name
- * @name name2obj
- * @memberOf KJUR.asn1.x509.OID
- * @function
- * @param {String} name OID
- * @description
- * @example
- * var asn1ObjOID = OID.name2obj('SHA1withRSA');
- */
- this.name2obj = function(name) {
- if (typeof this.objCache[name] != "undefined")
- return this.objCache[name];
- if (typeof this.name2oidList[name] == "undefined")
- throw "Name of ObjectIdentifier not defined: " + name;
- var oid = this.name2oidList[name];
- var obj = new KJUR.asn1.DERObjectIdentifier({'oid': oid});
- this.objCache[name] = obj;
- return obj;
- };
-
- /**
- * get DERObjectIdentifier by registered attribyte type name such like 'C' or 'CN'
- * @name atype2obj
- * @memberOf KJUR.asn1.x509.OID
- * @function
- * @param {String} atype short attribute type name such like 'C' or 'CN'
- * @description
- * @example
- * var asn1ObjOID = OID.atype2obj('CN');
- */
- this.atype2obj = function(atype) {
- if (typeof this.objCache[atype] != "undefined")
- return this.objCache[atype];
- if (typeof this.atype2oidList[atype] == "undefined")
- throw "AttributeType name undefined: " + atype;
- var oid = this.atype2oidList[atype];
- var obj = new KJUR.asn1.DERObjectIdentifier({'oid': oid});
- this.objCache[atype] = obj;
- return obj;
- };
-};
-
-/*
- * convert OID to name
- * @name oid2name
- * @memberOf KJUR.asn1.x509.OID
- * @function
- * @param {String} dot noted Object Identifer string (ex. 1.2.3.4)
- * @return {String} OID name
- * @description
- * This static method converts OID string to its name.
- * If OID is undefined then it returns empty string (i.e. '').
- * @example
- * name = KJUR.asn1.x509.OID.oid2name("1.3.6.1.5.5.7.1.1");
- * // name will be 'authorityInfoAccess'.
- * @since asn1x509 1.0.9
- */
-KJUR.asn1.x509.OID.oid2name = function(oid) {
- var list = KJUR.asn1.x509.OID.name2oidList;
- for (var name in list) {
- if (list[name] == oid) return name;
- }
- return '';
-};
-
-/*
- * convert name to OID
- * @name name2oid
- * @memberOf KJUR.asn1.x509.OID
- * @function
- * @param {String} OID name
- * @return {String} dot noted Object Identifer string (ex. 1.2.3.4)
- * @description
- * This static method converts from OID name to OID string.
- * If OID is undefined then it returns empty string (i.e. '').
- * @example
- * name = KJUR.asn1.x509.OID.name2oid("authorityInfoAccess");
- * // name will be '1.3.6.1.5.5.7.1.1'.
- * @since asn1x509 1.0.11
- */
-KJUR.asn1.x509.OID.name2oid = function(name) {
- var list = KJUR.asn1.x509.OID.name2oidList;
- if (list[name] === undefined) return '';
- return list[name];
-};
-
-/**
- * X.509 certificate and CRL utilities class
- * @name KJUR.asn1.x509.X509Util
- * @class X.509 certificate and CRL utilities class
- */
-KJUR.asn1.x509.X509Util = new function() {
- /**
- * get PKCS#8 PEM public key string from RSAKey object
- * @name getPKCS8PubKeyPEMfromRSAKey
- * @memberOf KJUR.asn1.x509.X509Util
- * @function
- * @param {RSAKey} rsaKey RSA public key of {@link RSAKey} object
- * @description
- * @example
- * var pem = KJUR.asn1.x509.X509Util.getPKCS8PubKeyPEMfromRSAKey(pubKey);
- */
- this.getPKCS8PubKeyPEMfromRSAKey = function(rsaKey) {
- var pem = null;
- var hN = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(rsaKey.n);
- var hE = KJUR.asn1.ASN1Util.integerToByteHex(rsaKey.e);
- var iN = new KJUR.asn1.DERInteger({hex: hN});
- var iE = new KJUR.asn1.DERInteger({hex: hE});
- var asn1PubKey = new KJUR.asn1.DERSequence({array: [iN, iE]});
- var hPubKey = asn1PubKey.getEncodedHex();
- var o1 = new KJUR.asn1.x509.AlgorithmIdentifier({name: 'rsaEncryption'});
- var o2 = new KJUR.asn1.DERBitString({hex: '00' + hPubKey});
- var seq = new KJUR.asn1.DERSequence({array: [o1, o2]});
- var hP8 = seq.getEncodedHex();
- var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex(hP8, "PUBLIC KEY");
- return pem;
- };
-};
-/**
- * issue a certificate in PEM format
- * @name newCertPEM
- * @memberOf KJUR.asn1.x509.X509Util
- * @function
- * @param {Array} param parameter to issue a certificate
- * @since asn1x509 1.0.6
- * @description
- * This method can issue a certificate by a simple
- * JSON object.
- * Signature value will be provided by signing with
- * private key using 'cakey' parameter or
- * hexa decimal signature value by 'sighex' parameter.
- *
- * NOTE: When using DSA or ECDSA CA signing key,
- * use 'paramempty' in 'sigalg' to ommit parameter field
- * of AlgorithmIdentifer. In case of RSA, parameter
- * NULL will be specified by default.
- *
- * @example
- * var certPEM = KJUR.asn1.x509.X509Util.newCertPEM(
- * { serial: {int: 4},
- * sigalg: {name: 'SHA1withECDSA', paramempty: true},
- * issuer: {str: '/C=US/O=a'},
- * notbefore: {'str': '130504235959Z'},
- * notafter: {'str': '140504235959Z'},
- * subject: {str: '/C=US/O=b'},
- * sbjpubkey: pubKeyPEM,
- * ext: [
- * {basicConstraints: {cA: true, critical: true}},
- * {keyUsage: {bin: '11'}},
- * ],
- * cakey: [prvkey, pass]}
- * );
- * // -- or --
- * var certPEM = KJUR.asn1.x509.X509Util.newCertPEM(
- * { serial: {int: 1},
- * sigalg: {name: 'SHA1withRSA', paramempty: true},
- * issuer: {str: '/C=US/O=T1'},
- * notbefore: {'str': '130504235959Z'},
- * notafter: {'str': '140504235959Z'},
- * subject: {str: '/C=US/O=T1'},
- * sbjpubkey: pubKeyObj,
- * sighex: '0102030405..'}
- * );
- * // for the issuer and subject field, another
- * // representation is also available
- * var certPEM = KJUR.asn1.x509.X509Util.newCertPEM(
- * { serial: {int: 1},
- * sigalg: {name: 'SHA1withRSA', paramempty: true},
- * issuer: {C: "US", O: "T1"},
- * notbefore: {'str': '130504235959Z'},
- * notafter: {'str': '140504235959Z'},
- * subject: {C: "US", O: "T1", CN: "http://example.com/"},
- * sbjpubkey: pubKeyObj,
- * sighex: '0102030405..'}
- * );
- */
-KJUR.asn1.x509.X509Util.newCertPEM = function(param) {
- var ns1 = KJUR.asn1.x509;
- var o = new ns1.TBSCertificate();
-
- if (param.serial !== undefined)
- o.setSerialNumberByParam(param.serial);
- else
- throw "serial number undefined.";
-
- if (typeof param.sigalg.name == 'string')
- o.setSignatureAlgByParam(param.sigalg);
- else
- throw "unproper signature algorithm name";
-
- if (param.issuer !== undefined)
- o.setIssuerByParam(param.issuer);
- else
- throw "issuer name undefined.";
-
- if (param.notbefore !== undefined)
- o.setNotBeforeByParam(param.notbefore);
- else
- throw "notbefore undefined.";
-
- if (param.notafter !== undefined)
- o.setNotAfterByParam(param.notafter);
- else
- throw "notafter undefined.";
-
- if (param.subject !== undefined)
- o.setSubjectByParam(param.subject);
- else
- throw "subject name undefined.";
-
- if (param.sbjpubkey !== undefined)
- o.setSubjectPublicKeyByGetKey(param.sbjpubkey);
- else
- throw "subject public key undefined.";
-
- if (param.ext !== undefined && param.ext.length !== undefined) {
- for (var i = 0; i < param.ext.length; i++) {
- for (key in param.ext[i]) {
- o.appendExtensionByName(key, param.ext[i][key]);
- }
- }
- }
-
- // set signature
- if (param.cakey === undefined && param.sighex === undefined)
- throw "param cakey and sighex undefined.";
-
- var caKey = null;
- var cert = null;
-
- if (param.cakey) {
- caKey = KEYUTIL.getKey.apply(null, param.cakey);
- cert = new ns1.Certificate({'tbscertobj': o, 'prvkeyobj': caKey});
- cert.sign();
- }
-
- if (param.sighex) {
- cert = new ns1.Certificate({'tbscertobj': o});
- cert.setSignatureHex(param.sighex);
- }
-
- return cert.getPEMString();
-};
-
-/*
- org.bouncycastle.asn1.x500
- AttributeTypeAndValue
- DirectoryString
- RDN
- X500Name
- X500NameBuilder
-
- org.bouncycastleasn1.x509
- TBSCertificate
-*/
diff --git a/jwt/base64x-1.1.js b/jwt/base64x-1.1.js
deleted file mode 100644
index 72d9f4b..0000000
--- a/jwt/base64x-1.1.js
+++ /dev/null
@@ -1,463 +0,0 @@
-/*! base64x-1.1.6 (c) 2012-2015 Kenji Urushima | kjur.github.com/jsrsasign/license
- */
-/*
- * base64x.js - Base64url and supplementary functions for Tom Wu's base64.js library
- *
- * version: 1.1.6 (2015-Nov-11)
- *
- * Copyright (c) 2012-2015 Kenji Urushima (kenji.urushima@gmail.com)
- *
- * This software is licensed under the terms of the MIT License.
- * http://kjur.github.com/jsjws/license/
- *
- * The above copyright and license notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * DEPENDS ON:
- * - base64.js - Tom Wu's Base64 library
- */
-
-/**
- * @fileOverview
- * @name base64x-1.1.js
- * @author Kenji Urushima kenji.urushima@gmail.com
- * @version asn1 1.1.6 (2015-Nov-11)
- * @since jsrsasign 2.1
- * @license
MIT License
- */
-
-/**
- * Base64URL and supplementary functions for Tom Wu's base64.js library.
- * This class is just provide information about global functions
- * defined in 'base64x.js'. The 'base64x.js' script file provides
- * global functions for converting following data each other.
- *
- * (ASCII) String
- * UTF8 String including CJK, Latin and other characters
- * byte array
- * hexadecimal encoded String
- * Full URIComponent encoded String (such like "%69%94")
- * Base64 encoded String
- * Base64URL encoded String
- *
- * All functions in 'base64x.js' are defined in {@link _global_} and not
- * in this class.
- *
- * @class Base64URL and supplementary functions for Tom Wu's base64.js library
- * @author Kenji Urushima
- * @version 1.1 (07 May 2012)
- * @requires base64.js
- * @see
'jwjws'(JWS JavaScript Library) home page http://kjur.github.com/jsjws/
- * @see
'jwrsasign'(RSA Sign JavaScript Library) home page http://kjur.github.com/jsrsasign/
- */
-function Base64x() {
-}
-
-// ==== string / byte array ================================
-/**
- * convert a string to an array of character codes
- * @param {String} s
- * @return {Array of Numbers}
- */
-function stoBA(s) {
- var a = new Array();
- for (var i = 0; i < s.length; i++) {
- a[i] = s.charCodeAt(i);
- }
- return a;
-}
-
-/**
- * convert an array of character codes to a string
- * @param {Array of Numbers} a array of character codes
- * @return {String} s
- */
-function BAtos(a) {
- var s = "";
- for (var i = 0; i < a.length; i++) {
- s = s + String.fromCharCode(a[i]);
- }
- return s;
-}
-
-// ==== byte array / hex ================================
-/**
- * convert an array of bytes(Number) to hexadecimal string.
- * @param {Array of Numbers} a array of bytes
- * @return {String} hexadecimal string
- */
-function BAtohex(a) {
- var s = "";
- for (var i = 0; i < a.length; i++) {
- var hex1 = a[i].toString(16);
- if (hex1.length == 1) hex1 = "0" + hex1;
- s = s + hex1;
- }
- return s;
-}
-
-// ==== string / hex ================================
-/**
- * convert a ASCII string to a hexadecimal string of ASCII codes.
- * NOTE: This can't be used for non ASCII characters.
- * @param {s} s ASCII string
- * @return {String} hexadecimal string
- */
-function stohex(s) {
- return BAtohex(stoBA(s));
-}
-
-// ==== string / base64 ================================
-/**
- * convert a ASCII string to a Base64 encoded string.
- * NOTE: This can't be used for non ASCII characters.
- * @param {s} s ASCII string
- * @return {String} Base64 encoded string
- */
-function stob64(s) {
- return hex2b64(stohex(s));
-}
-
-// ==== string / base64url ================================
-/**
- * convert a ASCII string to a Base64URL encoded string.
- * NOTE: This can't be used for non ASCII characters.
- * @param {s} s ASCII string
- * @return {String} Base64URL encoded string
- */
-function stob64u(s) {
- return b64tob64u(hex2b64(stohex(s)));
-}
-
-/**
- * convert a Base64URL encoded string to a ASCII string.
- * NOTE: This can't be used for Base64URL encoded non ASCII characters.
- * @param {s} s Base64URL encoded string
- * @return {String} ASCII string
- */
-function b64utos(s) {
- return BAtos(b64toBA(b64utob64(s)));
-}
-
-// ==== base64 / base64url ================================
-/**
- * convert a Base64 encoded string to a Base64URL encoded string.
- * Example: "ab+c3f/==" → "ab-c3f_"
- * @param {String} s Base64 encoded string
- * @return {String} Base64URL encoded string
- */
-function b64tob64u(s) {
- s = s.replace(/\=/g, "");
- s = s.replace(/\+/g, "-");
- s = s.replace(/\//g, "_");
- return s;
-}
-
-/**
- * convert a Base64URL encoded string to a Base64 encoded string.
- * Example: "ab-c3f_" → "ab+c3f/=="
- * @param {String} s Base64URL encoded string
- * @return {String} Base64 encoded string
- */
-function b64utob64(s) {
- if (s.length % 4 == 2) s = s + "==";
- else if (s.length % 4 == 3) s = s + "=";
- s = s.replace(/-/g, "+");
- s = s.replace(/_/g, "/");
- return s;
-}
-
-// ==== hex / base64url ================================
-/**
- * convert a hexadecimal string to a Base64URL encoded string.
- * @param {String} s hexadecimal string
- * @return {String} Base64URL encoded string
- * @description
- * convert a hexadecimal string to a Base64URL encoded string.
- * NOTE: If leading "0" is omitted and odd number length for
- * hexadecimal leading "0" is automatically added.
- */
-function hextob64u(s) {
- if (s.length % 2 == 1) s = "0" + s;
- return b64tob64u(hex2b64(s));
-}
-
-/**
- * convert a Base64URL encoded string to a hexadecimal string.
- * @param {String} s Base64URL encoded string
- * @return {String} hexadecimal string
- */
-function b64utohex(s) {
- return b64tohex(b64utob64(s));
-}
-
-var utf8tob64u, b64utoutf8;
-
-if (typeof Buffer === 'function')
-{
- utf8tob64u = function (s)
- {
- return b64tob64u(new Buffer(s, 'utf8').toString('base64'));
- };
-
- b64utoutf8 = function (s)
- {
- return new Buffer(b64utob64(s), 'base64').toString('utf8');
- };
-}
-else
-{
-// ==== utf8 / base64url ================================
-/**
- * convert a UTF-8 encoded string including CJK or Latin to a Base64URL encoded string.
- * @param {String} s UTF-8 encoded string
- * @return {String} Base64URL encoded string
- * @since 1.1
- */
- utf8tob64u = function (s)
- {
- return hextob64u(uricmptohex(encodeURIComponentAll(s)));
- };
-
-/**
- * convert a Base64URL encoded string to a UTF-8 encoded string including CJK or Latin.
- * @param {String} s Base64URL encoded string
- * @return {String} UTF-8 encoded string
- * @since 1.1
- */
- b64utoutf8 = function (s)
- {
- return decodeURIComponent(hextouricmp(b64utohex(s)));
- };
-}
-
-// ==== utf8 / base64url ================================
-/**
- * convert a UTF-8 encoded string including CJK or Latin to a Base64 encoded string.
- * @param {String} s UTF-8 encoded string
- * @return {String} Base64 encoded string
- * @since 1.1.1
- */
-function utf8tob64(s) {
- return hex2b64(uricmptohex(encodeURIComponentAll(s)));
-}
-
-/**
- * convert a Base64 encoded string to a UTF-8 encoded string including CJK or Latin.
- * @param {String} s Base64 encoded string
- * @return {String} UTF-8 encoded string
- * @since 1.1.1
- */
-function b64toutf8(s) {
- return decodeURIComponent(hextouricmp(b64tohex(s)));
-}
-
-// ==== utf8 / hex ================================
-/**
- * convert a UTF-8 encoded string including CJK or Latin to a hexadecimal encoded string.
- * @param {String} s UTF-8 encoded string
- * @return {String} hexadecimal encoded string
- * @since 1.1.1
- */
-function utf8tohex(s) {
- return uricmptohex(encodeURIComponentAll(s));
-}
-
-/**
- * convert a hexadecimal encoded string to a UTF-8 encoded string including CJK or Latin.
- * Note that when input is improper hexadecimal string as UTF-8 string, this function returns
- * 'null'.
- * @param {String} s hexadecimal encoded string
- * @return {String} UTF-8 encoded string or null
- * @since 1.1.1
- */
-function hextoutf8(s) {
- return decodeURIComponent(hextouricmp(s));
-}
-
-/**
- * convert a hexadecimal encoded string to raw string including non printable characters.
- * @param {String} s hexadecimal encoded string
- * @return {String} raw string
- * @since 1.1.2
- * @example
- * hextorstr("610061") → "a\x00a"
- */
-function hextorstr(sHex) {
- var s = "";
- for (var i = 0; i < sHex.length - 1; i += 2) {
- s += String.fromCharCode(parseInt(sHex.substr(i, 2), 16));
- }
- return s;
-}
-
-/**
- * convert a raw string including non printable characters to hexadecimal encoded string.
- * @param {String} s raw string
- * @return {String} hexadecimal encoded string
- * @since 1.1.2
- * @example
- * rstrtohex("a\x00a") → "610061"
- */
-function rstrtohex(s) {
- var result = "";
- for (var i = 0; i < s.length; i++) {
- result += ("0" + s.charCodeAt(i).toString(16)).slice(-2);
- }
- return result;
-}
-
-// ==== hex / b64nl =======================================
-
-/*
- * since base64x 1.1.3
- */
-function hextob64(s) {
- return hex2b64(s);
-}
-
-/*
- * since base64x 1.1.3
- */
-function hextob64nl(s) {
- var b64 = hextob64(s);
- var b64nl = b64.replace(/(.{64})/g, "$1\r\n");
- b64nl = b64nl.replace(/\r\n$/, '');
- return b64nl;
-}
-
-/*
- * since base64x 1.1.3
- */
-function b64nltohex(s) {
- var b64 = s.replace(/[^0-9A-Za-z\/+=]*/g, '');
- var hex = b64tohex(b64);
- return hex;
-}
-
-// ==== URIComponent / hex ================================
-/**
- * convert a URLComponent string such like "%67%68" to a hexadecimal string.
- * @param {String} s URIComponent string such like "%67%68"
- * @return {String} hexadecimal string
- * @since 1.1
- */
-function uricmptohex(s) {
- return s.replace(/%/g, "");
-}
-
-/**
- * convert a hexadecimal string to a URLComponent string such like "%67%68".
- * @param {String} s hexadecimal string
- * @return {String} URIComponent string such like "%67%68"
- * @since 1.1
- */
-function hextouricmp(s) {
- return s.replace(/(..)/g, "%$1");
-}
-
-// ==== URIComponent ================================
-/**
- * convert UTFa hexadecimal string to a URLComponent string such like "%67%68".
- * Note that these "
0-9A-Za-z!'()*-._~
" characters will not
- * converted to "%xx" format by builtin 'encodeURIComponent()' function.
- * However this 'encodeURIComponentAll()' function will convert
- * all of characters into "%xx" format.
- * @param {String} s hexadecimal string
- * @return {String} URIComponent string such like "%67%68"
- * @since 1.1
- */
-function encodeURIComponentAll(u8) {
- var s = encodeURIComponent(u8);
- var s2 = "";
- for (var i = 0; i < s.length; i++) {
- if (s[i] == "%") {
- s2 = s2 + s.substr(i, 3);
- i = i + 2;
- } else {
- s2 = s2 + "%" + stohex(s[i]);
- }
- }
- return s2;
-}
-
-// ==== new lines ================================
-/**
- * convert all DOS new line("\r\n") to UNIX new line("\n") in
- * a String "s".
- * @param {String} s string
- * @return {String} converted string
- */
-function newline_toUnix(s) {
- s = s.replace(/\r\n/mg, "\n");
- return s;
-}
-
-/**
- * convert all UNIX new line("\r\n") to DOS new line("\n") in
- * a String "s".
- * @param {String} s string
- * @return {String} converted string
- */
-function newline_toDos(s) {
- s = s.replace(/\r\n/mg, "\n");
- s = s.replace(/\n/mg, "\r\n");
- return s;
-}
-
-// ==== others ================================
-
-/**
- * convert string of integer array to hexadecimal string.
- * @param {String} s string of integer array
- * @return {String} hexadecimal string
- * @since base64x 1.1.6 jsrsasign 5.0.2
- * @throws "malformed integer array string: *" for wrong input
- * @description
- * This function converts a string of JavaScript integer array to
- * a hexadecimal string. Each integer value shall be in a range
- * from 0 to 255 otherwise it raise exception. Input string can
- * have extra space or newline string so that they will be ignored.
- *
- * @example
- * intarystrtohex(" [123, 34, 101, 34, 58] ")
- * -> 7b2265223a (i.e. `{"e":` as string)
- */
-function intarystrtohex(s) {
- s = s.replace(/^\s*\[\s*/, '');
- s = s.replace(/\s*\]\s*$/, '');
- s = s.replace(/\s*/g, '');
- try {
- var hex = s.split(/,/).map(function(element, index, array) {
- var i = parseInt(element);
- if (i < 0 || 255 < i) throw "integer not in range 0-255";
- var hI = ("00" + i.toString(16)).slice(-2);
- return hI;
- }).join('');
- return hex;
- } catch(ex) {
- throw "malformed integer array string: " + ex;
- }
-}
-
-/**
- * find index of string where two string differs
- * @param {String} s1 string to compare
- * @param {String} s2 string to compare
- * @return {Number} string index of where character differs. Return -1 if same.
- * @since jsrsasign 4.9.0 base64x 1.1.5
- * @example
- * strdiffidx("abcdefg", "abcd4fg") -> 4
- * strdiffidx("abcdefg", "abcdefg") -> -1
- * strdiffidx("abcdefg", "abcdef") -> 6
- * strdiffidx("abcdefgh", "abcdef") -> 6
- */
-var strdiffidx = function(s1, s2) {
- var n = s1.length;
- if (s1.length > s2.length) n = s2.length;
- for (var i = 0; i < n; i++) {
- if (s1.charCodeAt(i) != s2.charCodeAt(i)) return i;
- }
- if (s1.length != s2.length) return n;
- return -1; // same
-};
diff --git a/jwt/bower.json b/jwt/bower.json
deleted file mode 100644
index 04f8be3..0000000
--- a/jwt/bower.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "name": "kjur-jsrsasign",
- "version": "5.0.12",
- "main": "jsrsasign-latest-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 CMS SignedData, TimeStamp, CAdES, JWS and JWT in pure JavaScript.",
- "license": "MIT",
- "ignore": [
- ".jshintrc"
- ],
- "dependencies": {
- },
- "devDependencies": {
- }
-}
diff --git a/jwt/crypto-1.1.js b/jwt/crypto-1.1.js
deleted file mode 100644
index fcb1348..0000000
--- a/jwt/crypto-1.1.js
+++ /dev/null
@@ -1,1229 +0,0 @@
-/*! crypto-1.1.8.js (c) 2013-2016 Kenji Urushima | kjur.github.com/jsrsasign/license
- */
-/*
- * crypto.js - Cryptographic Algorithm Provider class
- *
- * Copyright (c) 2013-2016 Kenji Urushima (kenji.urushima@gmail.com)
- *
- * This software is licensed under the terms of the MIT License.
- * http://kjur.github.com/jsrsasign/license
- *
- * The above copyright and license notice shall be
- * included in all copies or substantial portions of the Software.
- */
-
-/**
- * @fileOverview
- * @name crypto-1.1.js
- * @author Kenji Urushima kenji.urushima@gmail.com
- * @version 1.1.8 (2016-Feb-28)
- * @since jsrsasign 2.2
- * @license
MIT License
- */
-
-/**
- * kjur's class library name space
- * @name KJUR
- * @namespace kjur's class library name space
- */
-if (typeof KJUR == "undefined" || !KJUR) KJUR = {};
-/**
- * kjur's cryptographic algorithm provider library name space
- *
- * This namespace privides following crytpgrahic classes.
- *
- * {@link KJUR.crypto.MessageDigest} - Java JCE(cryptograhic extension) style MessageDigest class
- * {@link KJUR.crypto.Signature} - Java JCE(cryptograhic extension) style Signature class
- * {@link KJUR.crypto.Util} - cryptographic utility functions and properties
- *
- * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.
- *
- * @name KJUR.crypto
- * @namespace
- */
-if (typeof KJUR.crypto == "undefined" || !KJUR.crypto) KJUR.crypto = {};
-
-/**
- * static object for cryptographic function utilities
- * @name KJUR.crypto.Util
- * @class static object for cryptographic function utilities
- * @property {Array} DIGESTINFOHEAD PKCS#1 DigestInfo heading hexadecimal bytes for each hash algorithms
- * @property {Array} DEFAULTPROVIDER associative array of default provider name for each hash and signature algorithms
- * @description
- */
-KJUR.crypto.Util = new function() {
- this.DIGESTINFOHEAD = {
- 'sha1': "3021300906052b0e03021a05000414",
- 'sha224': "302d300d06096086480165030402040500041c",
- 'sha256': "3031300d060960864801650304020105000420",
- 'sha384': "3041300d060960864801650304020205000430",
- 'sha512': "3051300d060960864801650304020305000440",
- 'md2': "3020300c06082a864886f70d020205000410",
- 'md5': "3020300c06082a864886f70d020505000410",
- 'ripemd160': "3021300906052b2403020105000414",
- };
-
- /*
- * @since crypto 1.1.1
- */
- this.DEFAULTPROVIDER = {
- 'md5': 'cryptojs',
- 'sha1': 'cryptojs',
- 'sha224': 'cryptojs',
- 'sha256': 'cryptojs',
- 'sha384': 'cryptojs',
- 'sha512': 'cryptojs',
- 'ripemd160': 'cryptojs',
- 'hmacmd5': 'cryptojs',
- 'hmacsha1': 'cryptojs',
- 'hmacsha224': 'cryptojs',
- 'hmacsha256': 'cryptojs',
- 'hmacsha384': 'cryptojs',
- 'hmacsha512': 'cryptojs',
- 'hmacripemd160': 'cryptojs',
-
- 'MD5withRSA': 'cryptojs/jsrsa',
- 'SHA1withRSA': 'cryptojs/jsrsa',
- 'SHA224withRSA': 'cryptojs/jsrsa',
- 'SHA256withRSA': 'cryptojs/jsrsa',
- 'SHA384withRSA': 'cryptojs/jsrsa',
- 'SHA512withRSA': 'cryptojs/jsrsa',
- 'RIPEMD160withRSA': 'cryptojs/jsrsa',
-
- 'MD5withECDSA': 'cryptojs/jsrsa',
- 'SHA1withECDSA': 'cryptojs/jsrsa',
- 'SHA224withECDSA': 'cryptojs/jsrsa',
- 'SHA256withECDSA': 'cryptojs/jsrsa',
- 'SHA384withECDSA': 'cryptojs/jsrsa',
- 'SHA512withECDSA': 'cryptojs/jsrsa',
- 'RIPEMD160withECDSA': 'cryptojs/jsrsa',
-
- 'SHA1withDSA': 'cryptojs/jsrsa',
- 'SHA224withDSA': 'cryptojs/jsrsa',
- 'SHA256withDSA': 'cryptojs/jsrsa',
-
- 'MD5withRSAandMGF1': 'cryptojs/jsrsa',
- 'SHA1withRSAandMGF1': 'cryptojs/jsrsa',
- 'SHA224withRSAandMGF1': 'cryptojs/jsrsa',
- 'SHA256withRSAandMGF1': 'cryptojs/jsrsa',
- 'SHA384withRSAandMGF1': 'cryptojs/jsrsa',
- 'SHA512withRSAandMGF1': 'cryptojs/jsrsa',
- 'RIPEMD160withRSAandMGF1': 'cryptojs/jsrsa',
- };
-
- /*
- * @since crypto 1.1.2
- */
- this.CRYPTOJSMESSAGEDIGESTNAME = {
- 'md5': CryptoJS.algo.MD5,
- 'sha1': CryptoJS.algo.SHA1,
- 'sha224': CryptoJS.algo.SHA224,
- 'sha256': CryptoJS.algo.SHA256,
- 'sha384': CryptoJS.algo.SHA384,
- 'sha512': CryptoJS.algo.SHA512,
- 'ripemd160': CryptoJS.algo.RIPEMD160
- };
-
- /**
- * get hexadecimal DigestInfo
- * @name getDigestInfoHex
- * @memberOf KJUR.crypto.Util
- * @function
- * @param {String} hHash hexadecimal hash value
- * @param {String} alg hash algorithm name (ex. 'sha1')
- * @return {String} hexadecimal string DigestInfo ASN.1 structure
- */
- this.getDigestInfoHex = function(hHash, alg) {
- if (typeof this.DIGESTINFOHEAD[alg] == "undefined")
- throw "alg not supported in Util.DIGESTINFOHEAD: " + alg;
- return this.DIGESTINFOHEAD[alg] + hHash;
- };
-
- /**
- * get PKCS#1 padded hexadecimal DigestInfo
- * @name getPaddedDigestInfoHex
- * @memberOf KJUR.crypto.Util
- * @function
- * @param {String} hHash hexadecimal hash value of message to be signed
- * @param {String} alg hash algorithm name (ex. 'sha1')
- * @param {Integer} keySize key bit length (ex. 1024)
- * @return {String} hexadecimal string of PKCS#1 padded DigestInfo
- */
- this.getPaddedDigestInfoHex = function(hHash, alg, keySize) {
- var hDigestInfo = this.getDigestInfoHex(hHash, alg);
- var pmStrLen = keySize / 4; // minimum PM length
-
- if (hDigestInfo.length + 22 > pmStrLen) // len(0001+ff(*8)+00+hDigestInfo)=22
- throw "key is too short for SigAlg: keylen=" + keySize + "," + alg;
-
- var hHead = "0001";
- var hTail = "00" + hDigestInfo;
- var hMid = "";
- var fLen = pmStrLen - hHead.length - hTail.length;
- for (var i = 0; i < fLen; i += 2) {
- hMid += "ff";
- }
- var hPaddedMessage = hHead + hMid + hTail;
- return hPaddedMessage;
- };
-
- /**
- * get hexadecimal hash of string with specified algorithm
- * @name hashString
- * @memberOf KJUR.crypto.Util
- * @function
- * @param {String} s input string to be hashed
- * @param {String} alg hash algorithm name
- * @return {String} hexadecimal string of hash value
- * @since 1.1.1
- */
- this.hashString = function(s, alg) {
- var md = new KJUR.crypto.MessageDigest({'alg': alg});
- return md.digestString(s);
- };
-
- /**
- * get hexadecimal hash of hexadecimal string with specified algorithm
- * @name hashHex
- * @memberOf KJUR.crypto.Util
- * @function
- * @param {String} sHex input hexadecimal string to be hashed
- * @param {String} alg hash algorithm name
- * @return {String} hexadecimal string of hash value
- * @since 1.1.1
- */
- this.hashHex = function(sHex, alg) {
- var md = new KJUR.crypto.MessageDigest({'alg': alg});
- return md.digestHex(sHex);
- };
-
- /**
- * get hexadecimal SHA1 hash of string
- * @name sha1
- * @memberOf KJUR.crypto.Util
- * @function
- * @param {String} s input string to be hashed
- * @return {String} hexadecimal string of hash value
- * @since 1.0.3
- */
- this.sha1 = function(s) {
- var md = new KJUR.crypto.MessageDigest({'alg':'sha1', 'prov':'cryptojs'});
- return md.digestString(s);
- };
-
- /**
- * get hexadecimal SHA256 hash of string
- * @name sha256
- * @memberOf KJUR.crypto.Util
- * @function
- * @param {String} s input string to be hashed
- * @return {String} hexadecimal string of hash value
- * @since 1.0.3
- */
- this.sha256 = function(s) {
- var md = new KJUR.crypto.MessageDigest({'alg':'sha256', 'prov':'cryptojs'});
- return md.digestString(s);
- };
-
- this.sha256Hex = function(s) {
- var md = new KJUR.crypto.MessageDigest({'alg':'sha256', 'prov':'cryptojs'});
- return md.digestHex(s);
- };
-
- /**
- * get hexadecimal SHA512 hash of string
- * @name sha512
- * @memberOf KJUR.crypto.Util
- * @function
- * @param {String} s input string to be hashed
- * @return {String} hexadecimal string of hash value
- * @since 1.0.3
- */
- this.sha512 = function(s) {
- var md = new KJUR.crypto.MessageDigest({'alg':'sha512', 'prov':'cryptojs'});
- return md.digestString(s);
- };
-
- this.sha512Hex = function(s) {
- var md = new KJUR.crypto.MessageDigest({'alg':'sha512', 'prov':'cryptojs'});
- return md.digestHex(s);
- };
-
- /**
- * get hexadecimal MD5 hash of string
- * @name md5
- * @memberOf KJUR.crypto.Util
- * @function
- * @param {String} s input string to be hashed
- * @return {String} hexadecimal string of hash value
- * @since 1.0.3
- */
- this.md5 = function(s) {
- var md = new KJUR.crypto.MessageDigest({'alg':'md5', 'prov':'cryptojs'});
- return md.digestString(s);
- };
-
- /**
- * get hexadecimal RIPEMD160 hash of string
- * @name ripemd160
- * @memberOf KJUR.crypto.Util
- * @function
- * @param {String} s input string to be hashed
- * @return {String} hexadecimal string of hash value
- * @since 1.0.3
- */
- this.ripemd160 = function(s) {
- var md = new KJUR.crypto.MessageDigest({'alg':'ripemd160', 'prov':'cryptojs'});
- return md.digestString(s);
- };
-
- /*
- * @since 1.1.2
- */
- this.getCryptoJSMDByName = function(s) {
-
- };
-};
-
-/**
- * MessageDigest class which is very similar to java.security.MessageDigest class
- * @name KJUR.crypto.MessageDigest
- * @class MessageDigest class which is very similar to java.security.MessageDigest class
- * @param {Array} params parameters for constructor
- * @description
- *
- * Currently this supports following algorithm and providers combination:
- *
- * md5 - cryptojs
- * sha1 - cryptojs
- * sha224 - cryptojs
- * sha256 - cryptojs
- * sha384 - cryptojs
- * sha512 - cryptojs
- * ripemd160 - cryptojs
- * sha256 - sjcl (NEW from crypto.js 1.0.4)
- *
- * @example
- * // CryptoJS provider sample
- * var md = new KJUR.crypto.MessageDigest({alg: "sha1", prov: "cryptojs"});
- * md.updateString('aaa')
- * var mdHex = md.digest()
- *
- * // SJCL(Stanford JavaScript Crypto Library) provider sample
- * var md = new KJUR.crypto.MessageDigest({alg: "sha256", prov: "sjcl"}); // sjcl supports sha256 only
- * md.updateString('aaa')
- * var mdHex = md.digest()
- */
-KJUR.crypto.MessageDigest = function(params) {
- var md = null;
- var algName = null;
- var provName = null;
-
- /**
- * set hash algorithm and provider
- * @name setAlgAndProvider
- * @memberOf KJUR.crypto.MessageDigest
- * @function
- * @param {String} alg hash algorithm name
- * @param {String} prov provider name
- * @description
- * @example
- * // for SHA1
- * md.setAlgAndProvider('sha1', 'cryptojs');
- * // for RIPEMD160
- * md.setAlgAndProvider('ripemd160', 'cryptojs');
- */
- this.setAlgAndProvider = function(alg, prov) {
- if (alg != null && prov === undefined) prov = KJUR.crypto.Util.DEFAULTPROVIDER[alg];
-
- // for cryptojs
- if (':md5:sha1:sha224:sha256:sha384:sha512:ripemd160:'.indexOf(alg) != -1 &&
- prov == 'cryptojs') {
- try {
- this.md = KJUR.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[alg].create();
- } catch (ex) {
- throw "setAlgAndProvider hash alg set fail alg=" + alg + "/" + ex;
- }
- this.updateString = function(str) {
- this.md.update(str);
- };
- this.updateHex = function(hex) {
- var wHex = CryptoJS.enc.Hex.parse(hex);
- this.md.update(wHex);
- };
- this.digest = function() {
- var hash = this.md.finalize();
- return hash.toString(CryptoJS.enc.Hex);
- };
- this.digestString = function(str) {
- this.updateString(str);
- return this.digest();
- };
- this.digestHex = function(hex) {
- this.updateHex(hex);
- return this.digest();
- };
- }
- if (':sha256:'.indexOf(alg) != -1 &&
- prov == 'sjcl') {
- try {
- this.md = new sjcl.hash.sha256();
- } catch (ex) {
- throw "setAlgAndProvider hash alg set fail alg=" + alg + "/" + ex;
- }
- this.updateString = function(str) {
- this.md.update(str);
- };
- this.updateHex = function(hex) {
- var baHex = sjcl.codec.hex.toBits(hex);
- this.md.update(baHex);
- };
- this.digest = function() {
- var hash = this.md.finalize();
- return sjcl.codec.hex.fromBits(hash);
- };
- this.digestString = function(str) {
- this.updateString(str);
- return this.digest();
- };
- this.digestHex = function(hex) {
- this.updateHex(hex);
- return this.digest();
- };
- }
- };
-
- /**
- * update digest by specified string
- * @name updateString
- * @memberOf KJUR.crypto.MessageDigest
- * @function
- * @param {String} str string to update
- * @description
- * @example
- * md.updateString('New York');
- */
- this.updateString = function(str) {
- throw "updateString(str) not supported for this alg/prov: " + this.algName + "/" + this.provName;
- };
-
- /**
- * update digest by specified hexadecimal string
- * @name updateHex
- * @memberOf KJUR.crypto.MessageDigest
- * @function
- * @param {String} hex hexadecimal string to update
- * @description
- * @example
- * md.updateHex('0afe36');
- */
- this.updateHex = function(hex) {
- throw "updateHex(hex) not supported for this alg/prov: " + this.algName + "/" + this.provName;
- };
-
- /**
- * completes hash calculation and returns hash result
- * @name digest
- * @memberOf KJUR.crypto.MessageDigest
- * @function
- * @description
- * @example
- * md.digest()
- */
- this.digest = function() {
- throw "digest() not supported for this alg/prov: " + this.algName + "/" + this.provName;
- };
-
- /**
- * performs final update on the digest using string, then completes the digest computation
- * @name digestString
- * @memberOf KJUR.crypto.MessageDigest
- * @function
- * @param {String} str string to final update
- * @description
- * @example
- * md.digestString('aaa')
- */
- this.digestString = function(str) {
- throw "digestString(str) not supported for this alg/prov: " + this.algName + "/" + this.provName;
- };
-
- /**
- * performs final update on the digest using hexadecimal string, then completes the digest computation
- * @name digestHex
- * @memberOf KJUR.crypto.MessageDigest
- * @function
- * @param {String} hex hexadecimal string to final update
- * @description
- * @example
- * md.digestHex('0f2abd')
- */
- this.digestHex = function(hex) {
- throw "digestHex(hex) not supported for this alg/prov: " + this.algName + "/" + this.provName;
- };
-
- if (params !== undefined) {
- if (params['alg'] !== undefined) {
- this.algName = params['alg'];
- if (params['prov'] === undefined)
- this.provName = KJUR.crypto.Util.DEFAULTPROVIDER[this.algName];
- this.setAlgAndProvider(this.algName, this.provName);
- }
- }
-};
-
-/**
- * Mac(Message Authentication Code) class which is very similar to java.security.Mac class
- * @name KJUR.crypto.Mac
- * @class Mac class which is very similar to java.security.Mac class
- * @param {Array} params parameters for constructor
- * @description
- *
- * Currently this supports following algorithm and providers combination:
- *
- * hmacmd5 - cryptojs
- * hmacsha1 - cryptojs
- * hmacsha224 - cryptojs
- * hmacsha256 - cryptojs
- * hmacsha384 - cryptojs
- * hmacsha512 - cryptojs
- *
- * NOTE: HmacSHA224 and HmacSHA384 issue was fixed since jsrsasign 4.1.4.
- * Please use 'ext/cryptojs-312-core-fix*.js' instead of 'core.js' of original CryptoJS
- * to avoid those issue.
- *
- * NOTE2: Hmac signature bug was fixed in jsrsasign 4.9.0 by providing CryptoJS
- * bug workaround.
- *
- * Please see {@link KJUR.crypto.Mac.setPassword}, how to provide password
- * in various ways in detail.
- * @example
- * var mac = new KJUR.crypto.Mac({alg: "HmacSHA1", "pass": "pass"});
- * mac.updateString('aaa')
- * var macHex = md.doFinal()
- *
- * // other password representation
- * var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": {"hex": "6161"}});
- * var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": {"utf8": "aa"}});
- * var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": {"rstr": "\x61\x61"}});
- * var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": {"b64": "Mi02/+...a=="}});
- * var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": {"b64u": "Mi02_-...a"}});
- */
-KJUR.crypto.Mac = function(params) {
- var mac = null;
- var pass = null;
- var algName = null;
- var provName = null;
- var algProv = null;
-
- this.setAlgAndProvider = function(alg, prov) {
- alg = alg.toLowerCase();
-
- if (alg == null) alg = "hmacsha1";
-
- alg = alg.toLowerCase();
- if (alg.substr(0, 4) != "hmac") {
- throw "setAlgAndProvider unsupported HMAC alg: " + alg;
- }
-
- if (prov === undefined) prov = KJUR.crypto.Util.DEFAULTPROVIDER[alg];
- this.algProv = alg + "/" + prov;
-
- var hashAlg = alg.substr(4);
-
- // for cryptojs
- if (':md5:sha1:sha224:sha256:sha384:sha512:ripemd160:'.indexOf(hashAlg) != -1 &&
- prov == 'cryptojs') {
- try {
- var mdObj = KJUR.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[hashAlg];
- this.mac = CryptoJS.algo.HMAC.create(mdObj, this.pass);
- } catch (ex) {
- throw "setAlgAndProvider hash alg set fail hashAlg=" + hashAlg + "/" + ex;
- }
- this.updateString = function(str) {
- this.mac.update(str);
- };
- this.updateHex = function(hex) {
- var wHex = CryptoJS.enc.Hex.parse(hex);
- this.mac.update(wHex);
- };
- this.doFinal = function() {
- var hash = this.mac.finalize();
- return hash.toString(CryptoJS.enc.Hex);
- };
- this.doFinalString = function(str) {
- this.updateString(str);
- return this.doFinal();
- };
- this.doFinalHex = function(hex) {
- this.updateHex(hex);
- return this.doFinal();
- };
- }
- };
-
- /**
- * update digest by specified string
- * @name updateString
- * @memberOf KJUR.crypto.Mac
- * @function
- * @param {String} str string to update
- * @description
- * @example
- * md.updateString('New York');
- */
- this.updateString = function(str) {
- throw "updateString(str) not supported for this alg/prov: " + this.algProv;
- };
-
- /**
- * update digest by specified hexadecimal string
- * @name updateHex
- * @memberOf KJUR.crypto.Mac
- * @function
- * @param {String} hex hexadecimal string to update
- * @description
- * @example
- * md.updateHex('0afe36');
- */
- this.updateHex = function(hex) {
- throw "updateHex(hex) not supported for this alg/prov: " + this.algProv;
- };
-
- /**
- * completes hash calculation and returns hash result
- * @name doFinal
- * @memberOf KJUR.crypto.Mac
- * @function
- * @description
- * @example
- * md.digest()
- */
- this.doFinal = function() {
- throw "digest() not supported for this alg/prov: " + this.algProv;
- };
-
- /**
- * performs final update on the digest using string, then completes the digest computation
- * @name doFinalString
- * @memberOf KJUR.crypto.Mac
- * @function
- * @param {String} str string to final update
- * @description
- * @example
- * md.digestString('aaa')
- */
- this.doFinalString = function(str) {
- throw "digestString(str) not supported for this alg/prov: " + this.algProv;
- };
-
- /**
- * performs final update on the digest using hexadecimal string,
- * then completes the digest computation
- * @name doFinalHex
- * @memberOf KJUR.crypto.Mac
- * @function
- * @param {String} hex hexadecimal string to final update
- * @description
- * @example
- * md.digestHex('0f2abd')
- */
- this.doFinalHex = function(hex) {
- throw "digestHex(hex) not supported for this alg/prov: " + this.algProv;
- };
-
- /**
- * set password for Mac
- * @name setPassword
- * @memberOf KJUR.crypto.Mac
- * @function
- * @param {Object} pass password for Mac
- * @since crypto 1.1.7 jsrsasign 4.9.0
- * @description
- * This method will set password for (H)Mac internally.
- * Argument 'pass' can be specified as following:
- *
- * even length string of 0..9, a..f or A-F: implicitly specified as hexadecimal string
- * not above string: implicitly specified as raw string
- * {rstr: "\x65\x70"}: explicitly specified as raw string
- * {hex: "6570"}: explicitly specified as hexacedimal string
- * {utf8: "秘密"}: explicitly specified as UTF8 string
- * {b64: "Mi78..=="}: explicitly specified as Base64 string
- * {b64u: "Mi7-_"}: explicitly specified as Base64URL string
- *
- * It is *STRONGLY RECOMMENDED* that explicit representation of password argument
- * to avoid ambiguity. For example string "6161" can mean a string "6161" or
- * a hexadecimal string of "aa" (i.e. \x61\x61).
- * @example
- * mac = KJUR.crypto.Mac({'alg': 'hmacsha256'});
- * // set password by implicit raw string
- * mac.setPassword("\x65\x70\xb9\x0b");
- * mac.setPassword("password");
- * // set password by implicit hexadecimal string
- * mac.setPassword("6570b90b");
- * mac.setPassword("6570B90B");
- * // set password by explicit raw string
- * mac.setPassword({"rstr": "\x65\x70\xb9\x0b"});
- * // set password by explicit hexadecimal string
- * mac.setPassword({"hex": "6570b90b"});
- * // set password by explicit utf8 string
- * mac.setPassword({"utf8": "passwordパスワード");
- * // set password by explicit Base64 string
- * mac.setPassword({"b64": "Mb+c3f/=="});
- * // set password by explicit Base64URL string
- * mac.setPassword({"b64u": "Mb-c3f_"});
- */
- this.setPassword = function(pass) {
- // internal this.pass shall be CryptoJS DWord Object for CryptoJS bug
- // work around. CrytoJS HMac password can be passed by
- // raw string as described in the manual however it doesn't
- // work properly in some case. If password was passed
- // by CryptoJS DWord which is not described in the manual
- // it seems to work. (fixed since crypto 1.1.7)
-
- if (typeof pass == 'string') {
- var hPass = pass;
- if (pass.length % 2 == 1 || ! pass.match(/^[0-9A-Fa-f]+$/)) { // raw str
- hPass = rstrtohex(pass);
- }
- this.pass = CryptoJS.enc.Hex.parse(hPass);
- return;
- }
-
- if (typeof pass != 'object')
- throw "KJUR.crypto.Mac unsupported password type: " + pass;
-
- var hPass = null;
- if (pass.hex !== undefined) {
- if (pass.hex.length % 2 != 0 || ! pass.hex.match(/^[0-9A-Fa-f]+$/))
- throw "Mac: wrong hex password: " + pass.hex;
- hPass = pass.hex;
- }
- if (pass.utf8 !== undefined) hPass = utf8tohex(pass.utf8);
- if (pass.rstr !== undefined) hPass = rstrtohex(pass.rstr);
- if (pass.b64 !== undefined) hPass = b64tohex(pass.b64);
- if (pass.b64u !== undefined) hPass = b64utohex(pass.b64u);
-
- if (hPass == null)
- throw "KJUR.crypto.Mac unsupported password type: " + pass;
-
- this.pass = CryptoJS.enc.Hex.parse(hPass);
- };
-
- if (params !== undefined) {
- if (params.pass !== undefined) {
- this.setPassword(params.pass);
- }
- if (params.alg !== undefined) {
- this.algName = params.alg;
- if (params['prov'] === undefined)
- this.provName = KJUR.crypto.Util.DEFAULTPROVIDER[this.algName];
- this.setAlgAndProvider(this.algName, this.provName);
- }
- }
-};
-
-/**
- * Signature class which is very similar to java.security.Signature class
- * @name KJUR.crypto.Signature
- * @class Signature class which is very similar to java.security.Signature class
- * @param {Array} params parameters for constructor
- * @property {String} state Current state of this signature object whether 'SIGN', 'VERIFY' or null
- * @description
- *
- * As for params of constructor's argument, it can be specify following attributes:
- *
- * alg - signature algorithm name (ex. {MD5,SHA1,SHA224,SHA256,SHA384,SHA512,RIPEMD160}with{RSA,ECDSA,DSA})
- * provider - currently 'cryptojs/jsrsa' only
- *
- *
SUPPORTED ALGORITHMS AND PROVIDERS
- * This Signature class supports following signature algorithm and provider names:
- *
- * MD5withRSA - cryptojs/jsrsa
- * SHA1withRSA - cryptojs/jsrsa
- * SHA224withRSA - cryptojs/jsrsa
- * SHA256withRSA - cryptojs/jsrsa
- * SHA384withRSA - cryptojs/jsrsa
- * SHA512withRSA - cryptojs/jsrsa
- * RIPEMD160withRSA - cryptojs/jsrsa
- * MD5withECDSA - cryptojs/jsrsa
- * SHA1withECDSA - cryptojs/jsrsa
- * SHA224withECDSA - cryptojs/jsrsa
- * SHA256withECDSA - cryptojs/jsrsa
- * SHA384withECDSA - cryptojs/jsrsa
- * SHA512withECDSA - cryptojs/jsrsa
- * RIPEMD160withECDSA - cryptojs/jsrsa
- * MD5withRSAandMGF1 - cryptojs/jsrsa
- * SHA1withRSAandMGF1 - cryptojs/jsrsa
- * SHA224withRSAandMGF1 - cryptojs/jsrsa
- * SHA256withRSAandMGF1 - cryptojs/jsrsa
- * SHA384withRSAandMGF1 - cryptojs/jsrsa
- * SHA512withRSAandMGF1 - cryptojs/jsrsa
- * RIPEMD160withRSAandMGF1 - cryptojs/jsrsa
- * SHA1withDSA - cryptojs/jsrsa
- * SHA224withDSA - cryptojs/jsrsa
- * SHA256withDSA - cryptojs/jsrsa
- *
- * Here are supported elliptic cryptographic curve names and their aliases for ECDSA:
- *
- * secp256k1
- * secp256r1, NIST P-256, P-256, prime256v1
- * secp384r1, NIST P-384, P-384
- *
- * NOTE1: DSA signing algorithm is also supported since crypto 1.1.5.
- *
EXAMPLES
- * @example
- * // RSA signature generation
- * var sig = new KJUR.crypto.Signature({"alg": "SHA1withRSA"});
- * sig.init(prvKeyPEM);
- * sig.updateString('aaa');
- * var hSigVal = sig.sign();
- *
- * // DSA signature validation
- * var sig2 = new KJUR.crypto.Signature({"alg": "SHA1withDSA"});
- * sig2.init(certPEM);
- * sig.updateString('aaa');
- * var isValid = sig2.verify(hSigVal);
- *
- * // ECDSA signing
- * var sig = new KJUR.crypto.Signature({'alg':'SHA1withECDSA'});
- * sig.init(prvKeyPEM);
- * sig.updateString('aaa');
- * var sigValueHex = sig.sign();
- *
- * // ECDSA verifying
- * var sig2 = new KJUR.crypto.Signature({'alg':'SHA1withECDSA'});
- * sig.init(certPEM);
- * sig.updateString('aaa');
- * var isValid = sig.verify(sigValueHex);
- */
-KJUR.crypto.Signature = function(params) {
- var prvKey = null; // RSAKey/KJUR.crypto.{ECDSA,DSA} object for signing
- var pubKey = null; // RSAKey/KJUR.crypto.{ECDSA,DSA} object for verifying
-
- var md = null; // KJUR.crypto.MessageDigest object
- var sig = null;
- var algName = null;
- var provName = null;
- var algProvName = null;
- var mdAlgName = null;
- var pubkeyAlgName = null; // rsa,ecdsa,rsaandmgf1(=rsapss)
- var state = null;
- var pssSaltLen = -1;
- var initParams = null;
-
- var sHashHex = null; // hex hash value for hex
- var hDigestInfo = null;
- var hPaddedDigestInfo = null;
- var hSign = null;
-
- this._setAlgNames = function() {
- if (this.algName.match(/^(.+)with(.+)$/)) {
- this.mdAlgName = RegExp.$1.toLowerCase();
- this.pubkeyAlgName = RegExp.$2.toLowerCase();
- }
- };
-
- this._zeroPaddingOfSignature = function(hex, bitLength) {
- var s = "";
- var nZero = bitLength / 4 - hex.length;
- for (var i = 0; i < nZero; i++) {
- s = s + "0";
- }
- return s + hex;
- };
-
- /**
- * set signature algorithm and provider
- * @name setAlgAndProvider
- * @memberOf KJUR.crypto.Signature
- * @function
- * @param {String} alg signature algorithm name
- * @param {String} prov provider name
- * @description
- * @example
- * md.setAlgAndProvider('SHA1withRSA', 'cryptojs/jsrsa');
- */
- this.setAlgAndProvider = function(alg, prov) {
- this._setAlgNames();
- if (prov != 'cryptojs/jsrsa')
- throw "provider not supported: " + prov;
-
- if (':md5:sha1:sha224:sha256:sha384:sha512:ripemd160:'.indexOf(this.mdAlgName) != -1) {
- try {
- this.md = new KJUR.crypto.MessageDigest({'alg':this.mdAlgName});
- } catch (ex) {
- throw "setAlgAndProvider hash alg set fail alg=" +
- this.mdAlgName + "/" + ex;
- }
-
- this.init = function(keyparam, pass) {
- var keyObj = null;
- try {
- if (pass === undefined) {
- keyObj = KEYUTIL.getKey(keyparam);
- } else {
- keyObj = KEYUTIL.getKey(keyparam, pass);
- }
- } catch (ex) {
- throw "init failed:" + ex;
- }
-
- if (keyObj.isPrivate === true) {
- this.prvKey = keyObj;
- this.state = "SIGN";
- } else if (keyObj.isPublic === true) {
- this.pubKey = keyObj;
- this.state = "VERIFY";
- } else {
- throw "init failed.:" + keyObj;
- }
- };
-
- this.initSign = function(params) {
- if (typeof params['ecprvhex'] == 'string' &&
- typeof params['eccurvename'] == 'string') {
- this.ecprvhex = params['ecprvhex'];
- this.eccurvename = params['eccurvename'];
- } else {
- this.prvKey = params;
- }
- this.state = "SIGN";
- };
-
- this.initVerifyByPublicKey = function(params) {
- if (typeof params['ecpubhex'] == 'string' &&
- typeof params['eccurvename'] == 'string') {
- this.ecpubhex = params['ecpubhex'];
- this.eccurvename = params['eccurvename'];
- } else if (params instanceof KJUR.crypto.ECDSA) {
- this.pubKey = params;
- } else if (params instanceof RSAKey) {
- this.pubKey = params;
- }
- this.state = "VERIFY";
- };
-
- this.initVerifyByCertificatePEM = function(certPEM) {
- var x509 = new X509();
- x509.readCertPEM(certPEM);
- this.pubKey = x509.subjectPublicKeyRSA;
- this.state = "VERIFY";
- };
-
- this.updateString = function(str) {
- this.md.updateString(str);
- };
-
- this.updateHex = function(hex) {
- this.md.updateHex(hex);
- };
-
- this.sign = function() {
- this.sHashHex = this.md.digest();
- if (typeof this.ecprvhex != "undefined" &&
- typeof this.eccurvename != "undefined") {
- var ec = new KJUR.crypto.ECDSA({'curve': this.eccurvename});
- this.hSign = ec.signHex(this.sHashHex, this.ecprvhex);
- } else if (this.prvKey instanceof RSAKey &&
- this.pubkeyAlgName == "rsaandmgf1") {
- this.hSign = this.prvKey.signWithMessageHashPSS(this.sHashHex,
- this.mdAlgName,
- this.pssSaltLen);
- } else if (this.prvKey instanceof RSAKey &&
- this.pubkeyAlgName == "rsa") {
- this.hSign = this.prvKey.signWithMessageHash(this.sHashHex,
- this.mdAlgName);
- } else if (this.prvKey instanceof KJUR.crypto.ECDSA) {
- this.hSign = this.prvKey.signWithMessageHash(this.sHashHex);
- } else if (this.prvKey instanceof KJUR.crypto.DSA) {
- this.hSign = this.prvKey.signWithMessageHash(this.sHashHex);
- } else {
- throw "Signature: unsupported public key alg: " + this.pubkeyAlgName;
- }
- return this.hSign;
- };
- this.signString = function(str) {
- this.updateString(str);
- return this.sign();
- };
- this.signHex = function(hex) {
- this.updateHex(hex);
- return this.sign();
- };
- this.verify = function(hSigVal) {
- this.sHashHex = this.md.digest();
- if (typeof this.ecpubhex != "undefined" &&
- typeof this.eccurvename != "undefined") {
- var ec = new KJUR.crypto.ECDSA({curve: this.eccurvename});
- return ec.verifyHex(this.sHashHex, hSigVal, this.ecpubhex);
- } else if (this.pubKey instanceof RSAKey &&
- this.pubkeyAlgName == "rsaandmgf1") {
- return this.pubKey.verifyWithMessageHashPSS(this.sHashHex, hSigVal,
- this.mdAlgName,
- this.pssSaltLen);
- } else if (this.pubKey instanceof RSAKey &&
- this.pubkeyAlgName == "rsa") {
- return this.pubKey.verifyWithMessageHash(this.sHashHex, hSigVal);
- } else if (this.pubKey instanceof KJUR.crypto.ECDSA) {
- return this.pubKey.verifyWithMessageHash(this.sHashHex, hSigVal);
- } else if (this.pubKey instanceof KJUR.crypto.DSA) {
- return this.pubKey.verifyWithMessageHash(this.sHashHex, hSigVal);
- } else {
- throw "Signature: unsupported public key alg: " + this.pubkeyAlgName;
- }
- };
- }
- };
-
- /**
- * Initialize this object for signing or verifying depends on key
- * @name init
- * @memberOf KJUR.crypto.Signature
- * @function
- * @param {Object} key specifying public or private key as plain/encrypted PKCS#5/8 PEM file, certificate PEM or {@link RSAKey}, {@link KJUR.crypto.DSA} or {@link KJUR.crypto.ECDSA} object
- * @param {String} pass (OPTION) passcode for encrypted private key
- * @since crypto 1.1.3
- * @description
- * This method is very useful initialize method for Signature class since
- * you just specify key then this method will automatically initialize it
- * using {@link KEYUTIL.getKey} method.
- * As for 'key', following argument type are supported:
- *
signing
- *
- * PEM formatted PKCS#8 encrypted RSA/ECDSA private key concluding "BEGIN ENCRYPTED PRIVATE KEY"
- * PEM formatted PKCS#5 encrypted RSA/DSA private key concluding "BEGIN RSA/DSA PRIVATE KEY" and ",ENCRYPTED"
- * PEM formatted PKCS#8 plain RSA/ECDSA private key concluding "BEGIN PRIVATE KEY"
- * PEM formatted PKCS#5 plain RSA/DSA private key concluding "BEGIN RSA/DSA PRIVATE KEY" without ",ENCRYPTED"
- * RSAKey object of private key
- * KJUR.crypto.ECDSA object of private key
- * KJUR.crypto.DSA object of private key
- *
- *
verification
- *
- * PEM formatted PKCS#8 RSA/EC/DSA public key concluding "BEGIN PUBLIC KEY"
- * PEM formatted X.509 certificate with RSA/EC/DSA public key concluding
- * "BEGIN CERTIFICATE", "BEGIN X509 CERTIFICATE" or "BEGIN TRUSTED CERTIFICATE".
- * RSAKey object of public key
- * KJUR.crypto.ECDSA object of public key
- * KJUR.crypto.DSA object of public key
- *
- * @example
- * sig.init(sCertPEM)
- */
- this.init = function(key, pass) {
- throw "init(key, pass) not supported for this alg:prov=" +
- this.algProvName;
- };
-
- /**
- * Initialize this object for verifying with a public key
- * @name initVerifyByPublicKey
- * @memberOf KJUR.crypto.Signature
- * @function
- * @param {Object} param RSAKey object of public key or associative array for ECDSA
- * @since 1.0.2
- * @deprecated from crypto 1.1.5. please use init() method instead.
- * @description
- * Public key information will be provided as 'param' parameter and the value will be
- * following:
- *
- * {@link RSAKey} object for RSA verification
- * associative array for ECDSA verification
- * (ex. {'ecpubhex': '041f..', 'eccurvename': 'secp256r1'}
)
- *
- *
- * @example
- * sig.initVerifyByPublicKey(rsaPrvKey)
- */
- this.initVerifyByPublicKey = function(rsaPubKey) {
- throw "initVerifyByPublicKey(rsaPubKeyy) not supported for this alg:prov=" +
- this.algProvName;
- };
-
- /**
- * Initialize this object for verifying with a certficate
- * @name initVerifyByCertificatePEM
- * @memberOf KJUR.crypto.Signature
- * @function
- * @param {String} certPEM PEM formatted string of certificate
- * @since 1.0.2
- * @deprecated from crypto 1.1.5. please use init() method instead.
- * @description
- * @example
- * sig.initVerifyByCertificatePEM(certPEM)
- */
- this.initVerifyByCertificatePEM = function(certPEM) {
- throw "initVerifyByCertificatePEM(certPEM) not supported for this alg:prov=" +
- this.algProvName;
- };
-
- /**
- * Initialize this object for signing
- * @name initSign
- * @memberOf KJUR.crypto.Signature
- * @function
- * @param {Object} param RSAKey object of public key or associative array for ECDSA
- * @deprecated from crypto 1.1.5. please use init() method instead.
- * @description
- * Private key information will be provided as 'param' parameter and the value will be
- * following:
- *
- * {@link RSAKey} object for RSA signing
- * associative array for ECDSA signing
- * (ex. {'ecprvhex': '1d3f..', 'eccurvename': 'secp256r1'}
)
- *
- * @example
- * sig.initSign(prvKey)
- */
- this.initSign = function(prvKey) {
- throw "initSign(prvKey) not supported for this alg:prov=" + this.algProvName;
- };
-
- /**
- * Updates the data to be signed or verified by a string
- * @name updateString
- * @memberOf KJUR.crypto.Signature
- * @function
- * @param {String} str string to use for the update
- * @description
- * @example
- * sig.updateString('aaa')
- */
- this.updateString = function(str) {
- throw "updateString(str) not supported for this alg:prov=" + this.algProvName;
- };
-
- /**
- * Updates the data to be signed or verified by a hexadecimal string
- * @name updateHex
- * @memberOf KJUR.crypto.Signature
- * @function
- * @param {String} hex hexadecimal string to use for the update
- * @description
- * @example
- * sig.updateHex('1f2f3f')
- */
- this.updateHex = function(hex) {
- throw "updateHex(hex) not supported for this alg:prov=" + this.algProvName;
- };
-
- /**
- * Returns the signature bytes of all data updates as a hexadecimal string
- * @name sign
- * @memberOf KJUR.crypto.Signature
- * @function
- * @return the signature bytes as a hexadecimal string
- * @description
- * @example
- * var hSigValue = sig.sign()
- */
- this.sign = function() {
- throw "sign() not supported for this alg:prov=" + this.algProvName;
- };
-
- /**
- * performs final update on the sign using string, then returns the signature bytes of all data updates as a hexadecimal string
- * @name signString
- * @memberOf KJUR.crypto.Signature
- * @function
- * @param {String} str string to final update
- * @return the signature bytes of a hexadecimal string
- * @description
- * @example
- * var hSigValue = sig.signString('aaa')
- */
- this.signString = function(str) {
- throw "digestString(str) not supported for this alg:prov=" + this.algProvName;
- };
-
- /**
- * performs final update on the sign using hexadecimal string, then returns the signature bytes of all data updates as a hexadecimal string
- * @name signHex
- * @memberOf KJUR.crypto.Signature
- * @function
- * @param {String} hex hexadecimal string to final update
- * @return the signature bytes of a hexadecimal string
- * @description
- * @example
- * var hSigValue = sig.signHex('1fdc33')
- */
- this.signHex = function(hex) {
- throw "digestHex(hex) not supported for this alg:prov=" + this.algProvName;
- };
-
- /**
- * verifies the passed-in signature.
- * @name verify
- * @memberOf KJUR.crypto.Signature
- * @function
- * @param {String} str string to final update
- * @return {Boolean} true if the signature was verified, otherwise false
- * @description
- * @example
- * var isValid = sig.verify('1fbcefdca4823a7(snip)')
- */
- this.verify = function(hSigVal) {
- throw "verify(hSigVal) not supported for this alg:prov=" + this.algProvName;
- };
-
- this.initParams = params;
-
- if (params !== undefined) {
- if (params['alg'] !== undefined) {
- this.algName = params['alg'];
- if (params['prov'] === undefined) {
- this.provName = KJUR.crypto.Util.DEFAULTPROVIDER[this.algName];
- } else {
- this.provName = params['prov'];
- }
- this.algProvName = this.algName + ":" + this.provName;
- this.setAlgAndProvider(this.algName, this.provName);
- this._setAlgNames();
- }
-
- if (params['psssaltlen'] !== undefined) this.pssSaltLen = params['psssaltlen'];
-
- if (params['prvkeypem'] !== undefined) {
- if (params['prvkeypas'] !== undefined) {
- throw "both prvkeypem and prvkeypas parameters not supported";
- } else {
- try {
- var prvKey = new RSAKey();
- prvKey.readPrivateKeyFromPEMString(params['prvkeypem']);
- this.initSign(prvKey);
- } catch (ex) {
- throw "fatal error to load pem private key: " + ex;
- }
- }
- }
- }
-};
-
-/**
- * static object for cryptographic function utilities
- * @name KJUR.crypto.OID
- * @class static object for cryptography related OIDs
- * @property {Array} oidhex2name key value of hexadecimal OID and its name
- * (ex. '2a8648ce3d030107' and 'secp256r1')
- * @since crypto 1.1.3
- * @description
- */
-
-
-KJUR.crypto.OID = new function() {
- this.oidhex2name = {
- '2a864886f70d010101': 'rsaEncryption',
- '2a8648ce3d0201': 'ecPublicKey',
- '2a8648ce380401': 'dsa',
- '2a8648ce3d030107': 'secp256r1',
- '2b8104001f': 'secp192k1',
- '2b81040021': 'secp224r1',
- '2b8104000a': 'secp256k1',
- '2b81040023': 'secp521r1',
- '2b81040022': 'secp384r1',
- '2a8648ce380403': 'SHA1withDSA', // 1.2.840.10040.4.3
- '608648016503040301': 'SHA224withDSA', // 2.16.840.1.101.3.4.3.1
- '608648016503040302': 'SHA256withDSA', // 2.16.840.1.101.3.4.3.2
- };
-};
diff --git a/jwt/dsa-modified-1.0.js b/jwt/dsa-modified-1.0.js
deleted file mode 100644
index 094da09..0000000
--- a/jwt/dsa-modified-1.0.js
+++ /dev/null
@@ -1,381 +0,0 @@
-/*! dsa-modified-1.0.1.js (c) Recurity Labs GmbH, Kenji Urushimma | github.com/openpgpjs/openpgpjs/blob/master/LICENSE
- */
-/*
- * dsa-modified.js - modified DSA class of OpenPGP-JS
- *
- * Copyright (c) 2011-2013 Recurity Labs GmbH (github.com/openpgpjs)
- * Kenji Urushima (kenji.urushima@gmail.com)
- * LICENSE
- * https://github.com/openpgpjs/openpgpjs/blob/master/LICENSE
- */
-
-/**
- * @fileOverview
- * @name dsa-modified-1.0.js
- * @author Recurity Labs GmbH (github.com/openpgpjs) and Kenji Urushima (kenji.urushima@gmail.com)
- * @version 1.0.1 (2013-Oct-06)
- * @since jsrsasign 4.1.6
- * @license
LGPL License
- */
-
-if (typeof KJUR == "undefined" || !KJUR) KJUR = {};
-if (typeof KJUR.crypto == "undefined" || !KJUR.crypto) KJUR.crypto = {};
-
-/**
- * class for DSA signing and verification
- * @name KJUR.crypto.DSA
- * @class class for DSA signing and verifcation
- * @description
- *
- * CAUTION: Most of the case, you don't need to use this class.
- * Please use {@link KJUR.crypto.Signature} class instead.
- *
- *
- * This class was originally developped by Recurity Labs GmbH for OpenPGP JavaScript library.
- * (See {@link https://github.com/openpgpjs/openpgpjs/blob/master/src/ciphers/asymmetric/dsa.js})
- *
- */
-/* https://github.com/openpgpjs/openpgpjs/blob/master/src/ciphers/asymmetric/dsa.js */
-KJUR.crypto.DSA = function() {
- this.p = null;
- this.q = null;
- this.g = null;
- this.y = null;
- this.x = null;
- this.type = "DSA";
-
- //===========================
- // PUBLIC METHODS
- //===========================
-
- /**
- * set DSA private key by key specs
- * @name setPrivate
- * @memberOf KJUR.crypto.DSA
- * @function
- * @param {BigInteger} p prime P
- * @param {BigInteger} q sub prime Q
- * @param {BigInteger} g base G
- * @param {BigInteger} y public key Y
- * @param {BigInteger} x private key X
- * @since dsa-modified 1.0.0
- */
- this.setPrivate = function(p, q, g, y, x) {
- this.isPrivate = true;
- this.p = p;
- this.q = q;
- this.g = g;
- this.y = y;
- this.x = x;
- };
-
- /**
- * set DSA public key by key specs
- * @name setPublic
- * @memberOf KJUR.crypto.DSA
- * @function
- * @param {BigInteger} p prime P
- * @param {BigInteger} q sub prime Q
- * @param {BigInteger} g base G
- * @param {BigInteger} y public key Y
- * @since dsa-modified 1.0.0
- */
- this.setPublic = function(p, q, g, y) {
- this.isPublic = true;
- this.p = p;
- this.q = q;
- this.g = g;
- this.y = y;
- this.x = null;
- };
-
- /**
- * sign to hashed message by this DSA private key object
- * @name signWithMessageHash
- * @memberOf KJUR.crypto.DSA
- * @function
- * @param {String} sHashHex hexadecimal string of hashed message
- * @return {String} hexadecimal string of ASN.1 encoded DSA signature value
- * @since dsa-modified 1.0.0
- */
- this.signWithMessageHash = function(sHashHex) {
- var p = this.p;
- var q = this.q;
- var g = this.g;
- var y = this.y;
- var x = this.x;
-
- // 1. trim message hash
- var hashHex = sHashHex.substr(0, q.bitLength() / 4);
- var hash = new BigInteger(sHashHex, 16);
-
- var k = getRandomBigIntegerInRange(BigInteger.ONE.add(BigInteger.ONE),
- q.subtract(BigInteger.ONE));
- var s1 = (g.modPow(k,p)).mod(q);
- var s2 = (k.modInverse(q).multiply(hash.add(x.multiply(s1)))).mod(q);
-
- var result = KJUR.asn1.ASN1Util.jsonToASN1HEX({
- 'seq': [{'int': {'bigint': s1}}, {'int': {'bigint': s2}}]
- });
- return result;
- };
-
- /**
- * verify signature by this DSA public key object
- * @name verifyWithMessageHash
- * @memberOf KJUR.crypto.DSA
- * @function
- * @param {String} sHashHex hexadecimal string of hashed message
- * @param {String} hSigVal hexadecimal string of ASN.1 encoded DSA signature value
- * @return {Boolean} true if the signature is valid otherwise false.
- * @since dsa-modified 1.0.0
- */
- this.verifyWithMessageHash = function(sHashHex, hSigVal) {
- var p = this.p;
- var q = this.q;
- var g = this.g;
- var y = this.y;
-
- // 1. parse ASN.1 signature
- var s1s2 = this.parseASN1Signature(hSigVal);
- var s1 = s1s2[0];
- var s2 = s1s2[1];
-
- // 2. trim message hash
- var sHashHex = sHashHex.substr(0, q.bitLength() / 4);
- var hash = new BigInteger(sHashHex, 16);
-
- if (BigInteger.ZERO.compareTo(s1) > 0 ||
- s1.compareTo(q) > 0 ||
- BigInteger.ZERO.compareTo(s2) > 0 ||
- s2.compareTo(q) > 0) {
- throw "invalid DSA signature";
- }
- var w = s2.modInverse(q);
- var u1 = hash.multiply(w).mod(q);
- var u2 = s1.multiply(w).mod(q);
- var dopublic = g.modPow(u1,p).multiply(y.modPow(u2,p)).mod(p).mod(q);
- return dopublic.compareTo(s1) == 0;
- };
-
- /**
- * parse hexadecimal ASN.1 DSA signature value
- * @name parseASN1Signature
- * @memberOf KJUR.crypto.DSA
- * @function
- * @param {String} hSigVal hexadecimal string of ASN.1 encoded DSA signature value
- * @return {Array} array [s1, s2] of DSA signature value. Both s1 and s2 are BigInteger.
- * @since dsa-modified 1.0.0
- */
- this.parseASN1Signature = function(hSigVal) {
- try {
- var s1 = new BigInteger(ASN1HEX.getVbyList(hSigVal, 0, [0], "02"), 16);
- var s2 = new BigInteger(ASN1HEX.getVbyList(hSigVal, 0, [1], "02"), 16);
- return [s1, s2];
- } catch (ex) {
- throw "malformed DSA signature";
- }
- }
-
- // s1 = ((g**s) mod p) mod q
- // s1 = ((s**-1)*(sha-1(m)+(s1*x) mod q)
- function sign(hashalgo, m, g, p, q, x) {
- // If the output size of the chosen hash is larger than the number of
- // bits of q, the hash result is truncated to fit by taking the number
- // of leftmost bits equal to the number of bits of q. This (possibly
- // truncated) hash function result is treated as a number and used
- // directly in the DSA signature algorithm.
-
- var hashHex = KJUR.crypto.Util.hashString(m, hashalgo.toLowerCase());
- var hashHex = hashHex.substr(0, q.bitLength() / 4);
- var hash = new BigInteger(hashHex, 16);
-
- var k = getRandomBigIntegerInRange(BigInteger.ONE.add(BigInteger.ONE),
- q.subtract(BigInteger.ONE));
- var s1 = (g.modPow(k,p)).mod(q);
- var s2 = (k.modInverse(q).multiply(hash.add(x.multiply(s1)))).mod(q);
- var result = new Array();
- result[0] = s1;
- result[1] = s2;
- return result;
- }
-
- function select_hash_algorithm(q) {
- var usersetting = openpgp.config.config.prefer_hash_algorithm;
- /*
- * 1024-bit key, 160-bit q, SHA-1, SHA-224, SHA-256, SHA-384, or SHA-512 hash
- * 2048-bit key, 224-bit q, SHA-224, SHA-256, SHA-384, or SHA-512 hash
- * 2048-bit key, 256-bit q, SHA-256, SHA-384, or SHA-512 hash
- * 3072-bit key, 256-bit q, SHA-256, SHA-384, or SHA-512 hash
- */
- switch (Math.round(q.bitLength() / 8)) {
- case 20: // 1024 bit
- if (usersetting != 2 &&
- usersetting > 11 &&
- usersetting != 10 &&
- usersetting < 8)
- return 2; // prefer sha1
- return usersetting;
- case 28: // 2048 bit
- if (usersetting > 11 &&
- usersetting < 8)
- return 11;
- return usersetting;
- case 32: // 4096 bit // prefer sha224
- if (usersetting > 10 &&
- usersetting < 8)
- return 8; // prefer sha256
- return usersetting;
- default:
- util.print_debug("DSA select hash algorithm: returning null for an unknown length of q");
- return null;
-
- }
- }
- this.select_hash_algorithm = select_hash_algorithm;
-
- function verify(hashalgo, s1,s2,m,p,q,g,y) {
- var hashHex = KJUR.crypto.Util.hashString(m, hashalgo.toLowerCase());
- var hashHex = hashHex.substr(0, q.bitLength() / 4);
- var hash = new BigInteger(hashHex, 16);
-
- if (BigInteger.ZERO.compareTo(s1) > 0 ||
- s1.compareTo(q) > 0 ||
- BigInteger.ZERO.compareTo(s2) > 0 ||
- s2.compareTo(q) > 0) {
- util.print_error("invalid DSA Signature");
- return null;
- }
- var w = s2.modInverse(q);
- var u1 = hash.multiply(w).mod(q);
- var u2 = s1.multiply(w).mod(q);
- var dopublic = g.modPow(u1,p).multiply(y.modPow(u2,p)).mod(p).mod(q);
- return dopublic.compareTo(s1) == 0;
- }
-
- /*
- * unused code. This can be used as a start to write a key generator
- * function.
- */
- function generateKey(bitcount) {
- var qi = new BigInteger(bitcount, primeCenterie);
- var pi = generateP(q, 512);
- var gi = generateG(p, q, bitcount);
- var xi;
- do {
- xi = new BigInteger(q.bitCount(), rand);
- } while (x.compareTo(BigInteger.ZERO) != 1 && x.compareTo(q) != -1);
- var yi = g.modPow(x, p);
- return {x: xi, q: qi, p: pi, g: gi, y: yi};
- }
-
- function generateP(q, bitlength, randomfn) {
- if (bitlength % 64 != 0) {
- return false;
- }
- var pTemp;
- var pTemp2;
- do {
- pTemp = randomfn(bitcount, true);
- pTemp2 = pTemp.subtract(BigInteger.ONE);
- pTemp = pTemp.subtract(pTemp2.remainder(q));
- } while (!pTemp.isProbablePrime(primeCenterie) || pTemp.bitLength() != l);
- return pTemp;
- }
-
- function generateG(p, q, bitlength, randomfn) {
- var aux = p.subtract(BigInteger.ONE);
- var pow = aux.divide(q);
- var gTemp;
- do {
- gTemp = randomfn(bitlength);
- } while (gTemp.compareTo(aux) != -1 && gTemp.compareTo(BigInteger.ONE) != 1);
- return gTemp.modPow(pow, p);
- }
-
- function generateK(q, bitlength, randomfn) {
- var tempK;
- do {
- tempK = randomfn(bitlength, false);
- } while (tempK.compareTo(q) != -1 && tempK.compareTo(BigInteger.ZERO) != 1);
- return tempK;
- }
-
- function generateR(q,p) {
- k = generateK(q);
- var r = g.modPow(k, p).mod(q);
- return r;
- }
-
- function generateS(hashfn,k,r,m,q,x) {
- var hash = hashfn(m);
- s = (k.modInverse(q).multiply(hash.add(x.multiply(r)))).mod(q);
- return s;
- }
- this.sign = sign;
- this.verify = verify;
- // this.generate = generateKey;
-
- //
- // METHODS FROM
- // https://github.com/openpgpjs/openpgpjs/blob/master/src/ciphers/openpgp.crypto.js
- //
- function getRandomBigIntegerInRange(min, max) {
- if (max.compareTo(min) <= 0)
- return;
- var range = max.subtract(min);
- var r = getRandomBigInteger(range.bitLength());
- while (r > range) {
- r = getRandomBigInteger(range.bitLength());
- }
- return min.add(r);
- }
-
- function getRandomBigInteger(bits) {
- if (bits < 0)
- return null;
- var numBytes = Math.floor((bits+7)/8);
-
- var randomBits = getRandomBytes(numBytes);
- if (bits % 8 > 0) {
- randomBits = String.fromCharCode((Math.pow(2,bits % 8)-1) &
- randomBits.charCodeAt(0)) +
- randomBits.substring(1);
- }
- return new BigInteger(hexstrdump(randomBits), 16);
- }
-
- function getRandomBytes(length) {
- var result = '';
- for (var i = 0; i < length; i++) {
- result += String.fromCharCode(getSecureRandomOctet());
- }
- return result;
- }
-
- function getSecureRandomOctet() {
- var buf = new Uint32Array(1);
- window.crypto.getRandomValues(buf);
- return buf[0] & 0xFF;
- }
-
- // https://github.com/openpgpjs/openpgpjs/blob/master/src/util/util.js
- function hexstrdump(str) {
- if (str == null)
- return "";
- var r=[];
- var e=str.length;
- var c=0;
- var h;
- while(c
MIT License
- */
-
-if (typeof KJUR == "undefined" || !KJUR) KJUR = {};
-if (typeof KJUR.crypto == "undefined" || !KJUR.crypto) KJUR.crypto = {};
-
-/**
- * class for EC key generation, ECDSA signing and verifcation
- * @name KJUR.crypto.ECDSA
- * @class class for EC key generation, ECDSA signing and verifcation
- * @description
- *
- * CAUTION: Most of the case, you don't need to use this class except
- * for generating an EC key pair. Please use {@link KJUR.crypto.Signature} class instead.
- *
- *
- * This class was originally developped by Stefan Thomas for Bitcoin JavaScript library.
- * (See {@link https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/src/ecdsa.js})
- * Currently this class supports following named curves and their aliases.
- *
- * secp256r1, NIST P-256, P-256, prime256v1 (*)
- * secp256k1 (*)
- * secp384r1, NIST P-384, P-384 (*)
- *
- *
- */
-KJUR.crypto.ECDSA = function(params) {
- var curveName = "secp256r1"; // curve name default
- var ecparams = null;
- var prvKeyHex = null;
- var pubKeyHex = null;
-
- var rng = new SecureRandom();
-
- var P_OVER_FOUR = null;
-
- this.type = "EC";
-
- function implShamirsTrick(P, k, Q, l) {
- var m = Math.max(k.bitLength(), l.bitLength());
- var Z = P.add2D(Q);
- var R = P.curve.getInfinity();
-
- for (var i = m - 1; i >= 0; --i) {
- R = R.twice2D();
-
- R.z = BigInteger.ONE;
-
- if (k.testBit(i)) {
- if (l.testBit(i)) {
- R = R.add2D(Z);
- } else {
- R = R.add2D(P);
- }
- } else {
- if (l.testBit(i)) {
- R = R.add2D(Q);
- }
- }
- }
-
- return R;
- };
-
- //===========================
- // PUBLIC METHODS
- //===========================
- this.getBigRandom = function (limit) {
- return new BigInteger(limit.bitLength(), rng)
- .mod(limit.subtract(BigInteger.ONE))
- .add(BigInteger.ONE)
- ;
- };
-
- this.setNamedCurve = function(curveName) {
- this.ecparams = KJUR.crypto.ECParameterDB.getByName(curveName);
- this.prvKeyHex = null;
- this.pubKeyHex = null;
- this.curveName = curveName;
- }
-
- this.setPrivateKeyHex = function(prvKeyHex) {
- this.isPrivate = true;
- this.prvKeyHex = prvKeyHex;
- }
-
- this.setPublicKeyHex = function(pubKeyHex) {
- this.isPublic = true;
- this.pubKeyHex = pubKeyHex;
- }
-
- /**
- * generate a EC key pair
- * @name generateKeyPairHex
- * @memberOf KJUR.crypto.ECDSA
- * @function
- * @return {Array} associative array of hexadecimal string of private and public key
- * @since ecdsa-modified 1.0.1
- * @example
- * var ec = new KJUR.crypto.ECDSA({'curve': 'secp256r1'});
- * var keypair = ec.generateKeyPairHex();
- * var pubhex = keypair.ecpubhex; // hexadecimal string of EC private key (=d)
- * var prvhex = keypair.ecprvhex; // hexadecimal string of EC public key
- */
- this.generateKeyPairHex = function() {
- var biN = this.ecparams['n'];
- var biPrv = this.getBigRandom(biN);
- var epPub = this.ecparams['G'].multiply(biPrv);
- var biX = epPub.getX().toBigInteger();
- var biY = epPub.getY().toBigInteger();
-
- var charlen = this.ecparams['keylen'] / 4;
- var hPrv = ("0000000000" + biPrv.toString(16)).slice(- charlen);
- var hX = ("0000000000" + biX.toString(16)).slice(- charlen);
- var hY = ("0000000000" + biY.toString(16)).slice(- charlen);
- var hPub = "04" + hX + hY;
-
- this.setPrivateKeyHex(hPrv);
- this.setPublicKeyHex(hPub);
- return {'ecprvhex': hPrv, 'ecpubhex': hPub};
- };
-
- this.signWithMessageHash = function(hashHex) {
- return this.signHex(hashHex, this.prvKeyHex);
- };
-
- /**
- * signing to message hash
- * @name signHex
- * @memberOf KJUR.crypto.ECDSA
- * @function
- * @param {String} hashHex hexadecimal string of hash value of signing message
- * @param {String} privHex hexadecimal string of EC private key
- * @return {String} hexadecimal string of ECDSA signature
- * @since ecdsa-modified 1.0.1
- * @example
- * var ec = new KJUR.crypto.ECDSA({'curve': 'secp256r1'});
- * var sigValue = ec.signHex(hash, prvKey);
- */
- this.signHex = function (hashHex, privHex) {
- var d = new BigInteger(privHex, 16);
- var n = this.ecparams['n'];
- var e = new BigInteger(hashHex, 16);
-
- do {
- var k = this.getBigRandom(n);
- var G = this.ecparams['G'];
- var Q = G.multiply(k);
- var r = Q.getX().toBigInteger().mod(n);
- } while (r.compareTo(BigInteger.ZERO) <= 0);
-
- var s = k.modInverse(n).multiply(e.add(d.multiply(r))).mod(n);
-
- return KJUR.crypto.ECDSA.biRSSigToASN1Sig(r, s);
- };
-
- this.sign = function (hash, priv) {
- var d = priv;
- var n = this.ecparams['n'];
- var e = BigInteger.fromByteArrayUnsigned(hash);
-
- do {
- var k = this.getBigRandom(n);
- var G = this.ecparams['G'];
- var Q = G.multiply(k);
- var r = Q.getX().toBigInteger().mod(n);
- } while (r.compareTo(BigInteger.ZERO) <= 0);
-
- var s = k.modInverse(n).multiply(e.add(d.multiply(r))).mod(n);
- return this.serializeSig(r, s);
- };
-
- this.verifyWithMessageHash = function(hashHex, sigHex) {
- return this.verifyHex(hashHex, sigHex, this.pubKeyHex);
- };
-
- /**
- * verifying signature with message hash and public key
- * @name verifyHex
- * @memberOf KJUR.crypto.ECDSA
- * @function
- * @param {String} hashHex hexadecimal string of hash value of signing message
- * @param {String} sigHex hexadecimal string of signature value
- * @param {String} pubkeyHex hexadecimal string of public key
- * @return {Boolean} true if the signature is valid, otherwise false
- * @since ecdsa-modified 1.0.1
- * @example
- * var ec = new KJUR.crypto.ECDSA({'curve': 'secp256r1'});
- * var result = ec.verifyHex(msgHashHex, sigHex, pubkeyHex);
- */
- this.verifyHex = function(hashHex, sigHex, pubkeyHex) {
- var r,s;
-
- var obj = KJUR.crypto.ECDSA.parseSigHex(sigHex);
- r = obj.r;
- s = obj.s;
-
- var Q;
- Q = ECPointFp.decodeFromHex(this.ecparams['curve'], pubkeyHex);
- var e = new BigInteger(hashHex, 16);
-
- return this.verifyRaw(e, r, s, Q);
- };
-
- this.verify = function (hash, sig, pubkey) {
- var r,s;
- if (Bitcoin.Util.isArray(sig)) {
- var obj = this.parseSig(sig);
- r = obj.r;
- s = obj.s;
- } else if ("object" === typeof sig && sig.r && sig.s) {
- r = sig.r;
- s = sig.s;
- } else {
- throw "Invalid value for signature";
- }
-
- var Q;
- if (pubkey instanceof ECPointFp) {
- Q = pubkey;
- } else if (Bitcoin.Util.isArray(pubkey)) {
- Q = ECPointFp.decodeFrom(this.ecparams['curve'], pubkey);
- } else {
- throw "Invalid format for pubkey value, must be byte array or ECPointFp";
- }
- var e = BigInteger.fromByteArrayUnsigned(hash);
-
- return this.verifyRaw(e, r, s, Q);
- };
-
- this.verifyRaw = function (e, r, s, Q) {
- var n = this.ecparams['n'];
- var G = this.ecparams['G'];
-
- if (r.compareTo(BigInteger.ONE) < 0 ||
- r.compareTo(n) >= 0)
- return false;
-
- if (s.compareTo(BigInteger.ONE) < 0 ||
- s.compareTo(n) >= 0)
- return false;
-
- var c = s.modInverse(n);
-
- var u1 = e.multiply(c).mod(n);
- var u2 = r.multiply(c).mod(n);
-
- // TODO(!!!): For some reason Shamir's trick isn't working with
- // signed message verification!? Probably an implementation
- // error!
- //var point = implShamirsTrick(G, u1, Q, u2);
- var point = G.multiply(u1).add(Q.multiply(u2));
-
- var v = point.getX().toBigInteger().mod(n);
-
- return v.equals(r);
- };
-
- /**
- * Serialize a signature into DER format.
- *
- * Takes two BigIntegers representing r and s and returns a byte array.
- */
- this.serializeSig = function (r, s) {
- var rBa = r.toByteArraySigned();
- var sBa = s.toByteArraySigned();
-
- var sequence = [];
- sequence.push(0x02); // INTEGER
- sequence.push(rBa.length);
- sequence = sequence.concat(rBa);
-
- sequence.push(0x02); // INTEGER
- sequence.push(sBa.length);
- sequence = sequence.concat(sBa);
-
- sequence.unshift(sequence.length);
- sequence.unshift(0x30); // SEQUENCE
- return sequence;
- };
-
- /**
- * Parses a byte array containing a DER-encoded signature.
- *
- * This function will return an object of the form:
- *
- * {
- * r: BigInteger,
- * s: BigInteger
- * }
- */
- this.parseSig = function (sig) {
- var cursor;
- if (sig[0] != 0x30)
- throw new Error("Signature not a valid DERSequence");
-
- cursor = 2;
- if (sig[cursor] != 0x02)
- throw new Error("First element in signature must be a DERInteger");;
- var rBa = sig.slice(cursor+2, cursor+2+sig[cursor+1]);
-
- cursor += 2+sig[cursor+1];
- if (sig[cursor] != 0x02)
- throw new Error("Second element in signature must be a DERInteger");
- var sBa = sig.slice(cursor+2, cursor+2+sig[cursor+1]);
-
- cursor += 2+sig[cursor+1];
-
- //if (cursor != sig.length)
- // throw new Error("Extra bytes in signature");
-
- var r = BigInteger.fromByteArrayUnsigned(rBa);
- var s = BigInteger.fromByteArrayUnsigned(sBa);
-
- return {r: r, s: s};
- };
-
- this.parseSigCompact = function (sig) {
- if (sig.length !== 65) {
- throw "Signature has the wrong length";
- }
-
- // Signature is prefixed with a type byte storing three bits of
- // information.
- var i = sig[0] - 27;
- if (i < 0 || i > 7) {
- throw "Invalid signature type";
- }
-
- var n = this.ecparams['n'];
- var r = BigInteger.fromByteArrayUnsigned(sig.slice(1, 33)).mod(n);
- var s = BigInteger.fromByteArrayUnsigned(sig.slice(33, 65)).mod(n);
-
- return {r: r, s: s, i: i};
- };
-
- /*
- * Recover a public key from a signature.
- *
- * See SEC 1: Elliptic Curve Cryptography, section 4.1.6, "Public
- * Key Recovery Operation".
- *
- * http://www.secg.org/download/aid-780/sec1-v2.pdf
- */
- /*
- recoverPubKey: function (r, s, hash, i) {
- // The recovery parameter i has two bits.
- i = i & 3;
-
- // The less significant bit specifies whether the y coordinate
- // of the compressed point is even or not.
- var isYEven = i & 1;
-
- // The more significant bit specifies whether we should use the
- // first or second candidate key.
- var isSecondKey = i >> 1;
-
- var n = this.ecparams['n'];
- var G = this.ecparams['G'];
- var curve = this.ecparams['curve'];
- var p = curve.getQ();
- var a = curve.getA().toBigInteger();
- var b = curve.getB().toBigInteger();
-
- // We precalculate (p + 1) / 4 where p is if the field order
- if (!P_OVER_FOUR) {
- P_OVER_FOUR = p.add(BigInteger.ONE).divide(BigInteger.valueOf(4));
- }
-
- // 1.1 Compute x
- var x = isSecondKey ? r.add(n) : r;
-
- // 1.3 Convert x to point
- var alpha = x.multiply(x).multiply(x).add(a.multiply(x)).add(b).mod(p);
- var beta = alpha.modPow(P_OVER_FOUR, p);
-
- var xorOdd = beta.isEven() ? (i % 2) : ((i+1) % 2);
- // If beta is even, but y isn't or vice versa, then convert it,
- // otherwise we're done and y == beta.
- var y = (beta.isEven() ? !isYEven : isYEven) ? beta : p.subtract(beta);
-
- // 1.4 Check that nR is at infinity
- var R = new ECPointFp(curve,
- curve.fromBigInteger(x),
- curve.fromBigInteger(y));
- R.validate();
-
- // 1.5 Compute e from M
- var e = BigInteger.fromByteArrayUnsigned(hash);
- var eNeg = BigInteger.ZERO.subtract(e).mod(n);
-
- // 1.6 Compute Q = r^-1 (sR - eG)
- var rInv = r.modInverse(n);
- var Q = implShamirsTrick(R, s, G, eNeg).multiply(rInv);
-
- Q.validate();
- if (!this.verifyRaw(e, r, s, Q)) {
- throw "Pubkey recovery unsuccessful";
- }
-
- var pubKey = new Bitcoin.ECKey();
- pubKey.pub = Q;
- return pubKey;
- },
- */
-
- /*
- * Calculate pubkey extraction parameter.
- *
- * When extracting a pubkey from a signature, we have to
- * distinguish four different cases. Rather than putting this
- * burden on the verifier, Bitcoin includes a 2-bit value with the
- * signature.
- *
- * This function simply tries all four cases and returns the value
- * that resulted in a successful pubkey recovery.
- */
- /*
- calcPubkeyRecoveryParam: function (address, r, s, hash) {
- for (var i = 0; i < 4; i++) {
- try {
- var pubkey = Bitcoin.ECDSA.recoverPubKey(r, s, hash, i);
- if (pubkey.getBitcoinAddress().toString() == address) {
- return i;
- }
- } catch (e) {}
- }
- throw "Unable to find valid recovery factor";
- }
- */
-
- if (params !== undefined) {
- if (params['curve'] !== undefined) {
- this.curveName = params['curve'];
- }
- }
- if (this.curveName === undefined) this.curveName = curveName;
- this.setNamedCurve(this.curveName);
- if (params !== undefined) {
- if (params['prv'] !== undefined) this.setPrivateKeyHex(params['prv']);
- if (params['pub'] !== undefined) this.setPublicKeyHex(params['pub']);
- }
-};
-
-/**
- * parse ASN.1 DER encoded ECDSA signature
- * @name parseSigHex
- * @memberOf KJUR.crypto.ECDSA
- * @function
- * @static
- * @param {String} sigHex hexadecimal string of ECDSA signature value
- * @return {Array} associative array of signature field r and s of BigInteger
- * @since ecdsa-modified 1.0.1
- * @example
- * var ec = new KJUR.crypto.ECDSA({'curve': 'secp256r1'});
- * var sig = ec.parseSigHex('30...');
- * var biR = sig.r; // BigInteger object for 'r' field of signature.
- * var biS = sig.s; // BigInteger object for 's' field of signature.
- */
-KJUR.crypto.ECDSA.parseSigHex = function(sigHex) {
- var p = KJUR.crypto.ECDSA.parseSigHexInHexRS(sigHex);
- var biR = new BigInteger(p.r, 16);
- var biS = new BigInteger(p.s, 16);
-
- return {'r': biR, 's': biS};
-};
-
-/**
- * parse ASN.1 DER encoded ECDSA signature
- * @name parseSigHexInHexRS
- * @memberOf KJUR.crypto.ECDSA
- * @function
- * @static
- * @param {String} sigHex hexadecimal string of ECDSA signature value
- * @return {Array} associative array of signature field r and s in hexadecimal
- * @since ecdsa-modified 1.0.3
- * @example
- * var ec = new KJUR.crypto.ECDSA({'curve': 'secp256r1'});
- * var sig = ec.parseSigHexInHexRS('30...');
- * var hR = sig.r; // hexadecimal string for 'r' field of signature.
- * var hS = sig.s; // hexadecimal string for 's' field of signature.
- */
-KJUR.crypto.ECDSA.parseSigHexInHexRS = function(sigHex) {
- // 1. ASN.1 Sequence Check
- if (sigHex.substr(0, 2) != "30")
- throw "signature is not a ASN.1 sequence";
-
- // 2. Items of ASN.1 Sequence Check
- var a = ASN1HEX.getPosArrayOfChildren_AtObj(sigHex, 0);
- if (a.length != 2)
- throw "number of signature ASN.1 sequence elements seem wrong";
-
- // 3. Integer check
- var iTLV1 = a[0];
- var iTLV2 = a[1];
- if (sigHex.substr(iTLV1, 2) != "02")
- throw "1st item of sequene of signature is not ASN.1 integer";
- if (sigHex.substr(iTLV2, 2) != "02")
- throw "2nd item of sequene of signature is not ASN.1 integer";
-
- // 4. getting value
- var hR = ASN1HEX.getHexOfV_AtObj(sigHex, iTLV1);
- var hS = ASN1HEX.getHexOfV_AtObj(sigHex, iTLV2);
-
- return {'r': hR, 's': hS};
-};
-
-/**
- * convert hexadecimal ASN.1 encoded signature to concatinated signature
- * @name asn1SigToConcatSig
- * @memberOf KJUR.crypto.ECDSA
- * @function
- * @static
- * @param {String} asn1Hex hexadecimal string of ASN.1 encoded ECDSA signature value
- * @return {String} r-s concatinated format of ECDSA signature value
- * @since ecdsa-modified 1.0.3
- */
-KJUR.crypto.ECDSA.asn1SigToConcatSig = function(asn1Sig) {
- var pSig = KJUR.crypto.ECDSA.parseSigHexInHexRS(asn1Sig);
- var hR = pSig.r;
- var hS = pSig.s;
-
- if (hR.substr(0, 2) == "00" && (((hR.length / 2) * 8) % (16 * 8)) == 8)
- hR = hR.substr(2);
-
- if (hS.substr(0, 2) == "00" && (((hS.length / 2) * 8) % (16 * 8)) == 8)
- hS = hS.substr(2);
-
- if ((((hR.length / 2) * 8) % (16 * 8)) != 0)
- throw "unknown ECDSA sig r length error";
-
- if ((((hS.length / 2) * 8) % (16 * 8)) != 0)
- throw "unknown ECDSA sig s length error";
-
- return hR + hS;
-};
-
-/**
- * convert hexadecimal concatinated signature to ASN.1 encoded signature
- * @name concatSigToASN1Sig
- * @memberOf KJUR.crypto.ECDSA
- * @function
- * @static
- * @param {String} concatSig r-s concatinated format of ECDSA signature value
- * @return {String} hexadecimal string of ASN.1 encoded ECDSA signature value
- * @since ecdsa-modified 1.0.3
- */
-KJUR.crypto.ECDSA.concatSigToASN1Sig = function(concatSig) {
- if ((((concatSig.length / 2) * 8) % (16 * 8)) != 0)
- throw "unknown ECDSA concatinated r-s sig length error";
-
- var hR = concatSig.substr(0, concatSig.length / 2);
- var hS = concatSig.substr(concatSig.length / 2);
- return KJUR.crypto.ECDSA.hexRSSigToASN1Sig(hR, hS);
-};
-
-/**
- * convert hexadecimal R and S value of signature to ASN.1 encoded signature
- * @name hexRSSigToASN1Sig
- * @memberOf KJUR.crypto.ECDSA
- * @function
- * @static
- * @param {String} hR hexadecimal string of R field of ECDSA signature value
- * @param {String} hS hexadecimal string of S field of ECDSA signature value
- * @return {String} hexadecimal string of ASN.1 encoded ECDSA signature value
- * @since ecdsa-modified 1.0.3
- */
-KJUR.crypto.ECDSA.hexRSSigToASN1Sig = function(hR, hS) {
- var biR = new BigInteger(hR, 16);
- var biS = new BigInteger(hS, 16);
- return KJUR.crypto.ECDSA.biRSSigToASN1Sig(biR, biS);
-};
-
-/**
- * convert R and S BigInteger object of signature to ASN.1 encoded signature
- * @name biRSSigToASN1Sig
- * @memberOf KJUR.crypto.ECDSA
- * @function
- * @static
- * @param {BigInteger} biR BigInteger object of R field of ECDSA signature value
- * @param {BigInteger} biS BIgInteger object of S field of ECDSA signature value
- * @return {String} hexadecimal string of ASN.1 encoded ECDSA signature value
- * @since ecdsa-modified 1.0.3
- */
-KJUR.crypto.ECDSA.biRSSigToASN1Sig = function(biR, biS) {
- var derR = new KJUR.asn1.DERInteger({'bigint': biR});
- var derS = new KJUR.asn1.DERInteger({'bigint': biS});
- var derSeq = new KJUR.asn1.DERSequence({'array': [derR, derS]});
- return derSeq.getEncodedHex();
-};
-
diff --git a/jwt/ecparam-1.0.js b/jwt/ecparam-1.0.js
deleted file mode 100644
index a2d2e5c..0000000
--- a/jwt/ecparam-1.0.js
+++ /dev/null
@@ -1,248 +0,0 @@
-/*! ecparam-1.0.0.js (c) 2013 Kenji Urushima | kjur.github.com/jsrsasign/license
- */
-/*
- * ecparam.js - Elliptic Curve Cryptography Curve Parameter Definition class
- *
- * Copyright (c) 2013 Kenji Urushima (kenji.urushima@gmail.com)
- *
- * This software is licensed under the terms of the MIT License.
- * http://kjur.github.com/jsrsasign/license
- *
- * The above copyright and license notice shall be
- * included in all copies or substantial portions of the Software.
- */
-
-/**
- * @fileOverview
- * @name ecparam-1.1.js
- * @author Kenji Urushima kenji.urushima@gmail.com
- * @version 1.0.0 (2013-Jul-17)
- * @since jsrsasign 4.0
- * @license MIT License
- */
-
-if (typeof KJUR == "undefined" || !KJUR) KJUR = {};
-if (typeof KJUR.crypto == "undefined" || !KJUR.crypto) KJUR.crypto = {};
-
-/**
- * static object for elliptic curve names and parameters
- * @name KJUR.crypto.ECParameterDB
- * @class static object for elliptic curve names and parameters
- * @description
- * This class provides parameters for named elliptic curves.
- * Currently it supoprts following curve names and aliases however
- * the name marked (*) are available for {@link KJUR.crypto.ECDSA} and
- * {@link KJUR.crypto.Signature} classes.
- *
- * secp128r1
- * secp160r1
- * secp160k1
- * secp192r1
- * secp192k1
- * secp224r1
- * secp256r1, NIST P-256, P-256, prime256v1 (*)
- * secp256k1 (*)
- * secp384r1, NIST P-384, P-384 (*)
- * secp521r1, NIST P-521, P-521
- *
- * You can register new curves by using 'register' method.
- */
-KJUR.crypto.ECParameterDB = new function() {
- var db = {};
- var aliasDB = {};
-
- function hex2bi(hex) {
- return new BigInteger(hex, 16);
- }
-
- /**
- * get curve inforamtion associative array for curve name or alias
- * @name getByName
- * @memberOf KJUR.crypto.ECParameterDB
- * @function
- * @param {String} nameOrAlias curve name or alias name
- * @return {Array} associative array of curve parameters
- * @example
- * var param = KJUR.crypto.ECParameterDB.getByName('prime256v1');
- * var keylen = param['keylen'];
- * var n = param['n'];
- */
- this.getByName = function(nameOrAlias) {
- var name = nameOrAlias;
- if (typeof aliasDB[name] != "undefined") {
- name = aliasDB[nameOrAlias];
- }
- if (typeof db[name] != "undefined") {
- return db[name];
- }
- throw "unregistered EC curve name: " + name;
- };
-
- /**
- * register new curve
- * @name regist
- * @memberOf KJUR.crypto.ECParameterDB
- * @function
- * @param {String} name name of curve
- * @param {Integer} keylen key length
- * @param {String} pHex hexadecimal value of p
- * @param {String} aHex hexadecimal value of a
- * @param {String} bHex hexadecimal value of b
- * @param {String} nHex hexadecimal value of n
- * @param {String} hHex hexadecimal value of h
- * @param {String} gxHex hexadecimal value of Gx
- * @param {String} gyHex hexadecimal value of Gy
- * @param {Array} aliasList array of string for curve names aliases
- * @param {String} oid Object Identifier for the curve
- * @param {String} info information string for the curve
- */
- this.regist = function(name, keylen, pHex, aHex, bHex, nHex, hHex, gxHex, gyHex, aliasList, oid, info) {
- db[name] = {};
- var p = hex2bi(pHex);
- var a = hex2bi(aHex);
- var b = hex2bi(bHex);
- var n = hex2bi(nHex);
- var h = hex2bi(hHex);
- var curve = new ECCurveFp(p, a, b);
- var G = curve.decodePointHex("04" + gxHex + gyHex);
- db[name]['name'] = name;
- db[name]['keylen'] = keylen;
- db[name]['curve'] = curve;
- db[name]['G'] = G;
- db[name]['n'] = n;
- db[name]['h'] = h;
- db[name]['oid'] = oid;
- db[name]['info'] = info;
-
- for (var i = 0; i < aliasList.length; i++) {
- aliasDB[aliasList[i]] = name;
- }
- };
-};
-
-KJUR.crypto.ECParameterDB.regist(
- "secp128r1", // name / p = 2^128 - 2^97 - 1
- 128,
- "FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF", // p
- "FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC", // a
- "E87579C11079F43DD824993C2CEE5ED3", // b
- "FFFFFFFE0000000075A30D1B9038A115", // n
- "1", // h
- "161FF7528B899B2D0C28607CA52C5B86", // gx
- "CF5AC8395BAFEB13C02DA292DDED7A83", // gy
- [], // alias
- "", // oid (underconstruction)
- "secp128r1 : SECG curve over a 128 bit prime field"); // info
-
-KJUR.crypto.ECParameterDB.regist(
- "secp160k1", // name / p = 2^160 - 2^32 - 2^14 - 2^12 - 2^9 - 2^8 - 2^7 - 2^3 - 2^2 - 1
- 160,
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73", // p
- "0", // a
- "7", // b
- "0100000000000000000001B8FA16DFAB9ACA16B6B3", // n
- "1", // h
- "3B4C382CE37AA192A4019E763036F4F5DD4D7EBB", // gx
- "938CF935318FDCED6BC28286531733C3F03C4FEE", // gy
- [], // alias
- "", // oid
- "secp160k1 : SECG curve over a 160 bit prime field"); // info
-
-KJUR.crypto.ECParameterDB.regist(
- "secp160r1", // name / p = 2^160 - 2^31 - 1
- 160,
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF", // p
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC", // a
- "1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45", // b
- "0100000000000000000001F4C8F927AED3CA752257", // n
- "1", // h
- "4A96B5688EF573284664698968C38BB913CBFC82", // gx
- "23A628553168947D59DCC912042351377AC5FB32", // gy
- [], // alias
- "", // oid
- "secp160r1 : SECG curve over a 160 bit prime field"); // info
-
-KJUR.crypto.ECParameterDB.regist(
- "secp192k1", // name / p = 2^192 - 2^32 - 2^12 - 2^8 - 2^7 - 2^6 - 2^3 - 1
- 192,
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37", // p
- "0", // a
- "3", // b
- "FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D", // n
- "1", // h
- "DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D", // gx
- "9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D", // gy
- []); // alias
-
-KJUR.crypto.ECParameterDB.regist(
- "secp192r1", // name / p = 2^192 - 2^64 - 1
- 192,
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF", // p
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC", // a
- "64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1", // b
- "FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831", // n
- "1", // h
- "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012", // gx
- "07192B95FFC8DA78631011ED6B24CDD573F977A11E794811", // gy
- []); // alias
-
-KJUR.crypto.ECParameterDB.regist(
- "secp224r1", // name / p = 2^224 - 2^96 + 1
- 224,
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001", // p
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE", // a
- "B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4", // b
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D", // n
- "1", // h
- "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21", // gx
- "BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34", // gy
- []); // alias
-
-KJUR.crypto.ECParameterDB.regist(
- "secp256k1", // name / p = 2^256 - 2^32 - 2^9 - 2^8 - 2^7 - 2^6 - 2^4 - 1
- 256,
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F", // p
- "0", // a
- "7", // b
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", // n
- "1", // h
- "79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798", // gx
- "483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8", // gy
- []); // alias
-
-KJUR.crypto.ECParameterDB.regist(
- "secp256r1", // name / p = 2^224 (2^32 - 1) + 2^192 + 2^96 - 1
- 256,
- "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF", // p
- "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC", // a
- "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B", // b
- "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551", // n
- "1", // h
- "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296", // gx
- "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5", // gy
- ["NIST P-256", "P-256", "prime256v1"]); // alias
-
-KJUR.crypto.ECParameterDB.regist(
- "secp384r1", // name
- 384,
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF", // p
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC", // a
- "B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF", // b
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973", // n
- "1", // h
- "AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7", // gx
- "3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f", // gy
- ["NIST P-384", "P-384"]); // alias
-
-KJUR.crypto.ECParameterDB.regist(
- "secp521r1", // name
- 521,
- "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", // p
- "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC", // a
- "051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00", // b
- "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409", // n
- "1", // h
- "C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66", // gx
- "011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650", // gy
- ["NIST P-521", "P-521"]); // alias
-
diff --git a/jwt/ext/THIRDPARTY_LICENSE.bitcoin.txt b/jwt/ext/THIRDPARTY_LICENSE.bitcoin.txt
deleted file mode 100755
index fb34b8c..0000000
--- a/jwt/ext/THIRDPARTY_LICENSE.bitcoin.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-https://github.com/bitcoinjs/bitcoinjs-lib
-
-LICENCE:
- MIT License
-
-FILES:
- - ../ecdsa-modified.js (modified version of bitcoin-lib/ecdsa.js)
- - ec-patch.js (part of bitcoin-lib/ecdsa.js)
-
-Copyright (c) 2011 Stefan Thomas
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/jwt/ext/THIRDPARTY_LICENSE.cryptojs.txt b/jwt/ext/THIRDPARTY_LICENSE.cryptojs.txt
deleted file mode 100755
index 61d6088..0000000
--- a/jwt/ext/THIRDPARTY_LICENSE.cryptojs.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-https://code.google.com/p/crypto-js/wiki/License
-
-LICENSE:
- NEW BSD License
-
-FILES:
- ext/cryptojs-312-core-fix.js
- ext/cryptojs-312-core-fix-min.js
- ext/jsrsasign-*-all-min.js
-
-Copyright (c) 2009-2013 Jeff Mott
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/jwt/ext/THIRDPARTY_LICENSE.jsonsans.txt b/jwt/ext/THIRDPARTY_LICENSE.jsonsans.txt
deleted file mode 100755
index f792394..0000000
--- a/jwt/ext/THIRDPARTY_LICENSE.jsonsans.txt
+++ /dev/null
@@ -1,98 +0,0 @@
-
- The 'RSA-Sign JavaScript Library' (jsrsasig) THRID PARTY LICENSE:
-
- Apr 30, 2012
-
-This document contains third party licensing information for
-the 'RSA-Sign JavaScript Library'. Where applicable,
-the text has not been edited from its original content or spelling.
-
-*********************************************************
-For Tom Wu's jsbn library - BigInteger and RSA
-
-base64.js - String encoder for Base64 and Hex
-jsbn.js - basic BigInteger class
-jsbn2.js - BigInteger class extension
-rsa.js - RSAKey class for RSA public key encryption.
-rsa2.js - RSA class extension for RSA private key decryption.
-
-http://www-cs-students.stanford.edu/~tjw/jsbn/LICENSE
-
-*********************************************************
-
-Licensing
----------
-
-This software is covered under the following copyright:
-
-/*
- * Copyright (c) 2003-2005 Tom Wu
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
- * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
- *
- * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
- * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF
- * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT
- * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * In addition, the following condition applies:
- *
- * All redistributions must retain an intact copy of this copyright notice
- * and disclaimer.
- */
-
-Address all questions regarding this license to:
-
- Tom Wu
- tjw@cs.Stanford.EDU
-
-
-*********************************************************
-For Paul Johnston's Hash Algorithm JavaScript
-
-sha256.js - SHA256 hash algorithm
-sha512.js - SHA512 hash algorithm
-
-http://pajhome.org.uk/site/legal.html#bsdlicense
-
-*********************************************************
-
-The BSD License
-
-Copyright (c) 1998 - 2009, Paul Johnston & Contributors
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
-Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
-Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*********************************************************
-
-json-sans-eval - A fast and secure JSON parser in JavaScript
-
-json-sans-eval.js - Apache License, Version 2.0
-
-http://code.google.com/p/json-sans-eval/
-http://www.apache.org/licenses/LICENSE-2.0
-
-*********************************************************
-
diff --git a/jwt/ext/THIRDPARTY_LICENSE.pgp.txt b/jwt/ext/THIRDPARTY_LICENSE.pgp.txt
deleted file mode 100755
index 823c27b..0000000
--- a/jwt/ext/THIRDPARTY_LICENSE.pgp.txt
+++ /dev/null
@@ -1,513 +0,0 @@
-https://github.com/openpgpjs/openpgpjs/blob/master/LICENSE
-
-LICENCE:
- LGPL License
-
-FILES
- - ../dsa-modified-1.0.js
- - a part of ../jsrsasign-x.x.x-all-min.js
-
-Software License Agreement (LGPL License)
-
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- , 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
diff --git a/jwt/ext/THIRDPARTY_LICENSE.pjhash.txt b/jwt/ext/THIRDPARTY_LICENSE.pjhash.txt
deleted file mode 100644
index 6cb3c34..0000000
--- a/jwt/ext/THIRDPARTY_LICENSE.pjhash.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-
-*********************************************************
-For Paul Johnston's Hash Algorithm JavaScript
-
-sha1.js - SHA1 hash algorithm
-sha256.js - SHA256 hash algorithm
-sha512.js - SHA512 hash algorithm
-md5.js - MD5 hash algorithm
-ripemd160.js - RIPEMD-160 hash algorithm
-
-http://pajhome.org.uk/site/legal.html#bsdlicense
-
-*********************************************************
-
-The BSD License
-
-Copyright (c) 1998 - 2009, Paul Johnston & Contributors
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
-Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
-Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
diff --git a/jwt/ext/THIRDPARTY_LICENSE.tomwu.txt b/jwt/ext/THIRDPARTY_LICENSE.tomwu.txt
deleted file mode 100755
index 1e62fde..0000000
--- a/jwt/ext/THIRDPARTY_LICENSE.tomwu.txt
+++ /dev/null
@@ -1,65 +0,0 @@
-
- The 'RSA-Sign JavaScript Library' (jsrsasig) THRID PARTY LICENSE:
-
- Apr 30, 2012
-
-This document contains third party licensing information for
-the 'RSA-Sign JavaScript Library'. Where applicable,
-the text has not been edited from its original content or spelling.
-
-*********************************************************
-For Tom Wu's jsbn library - BigInteger and RSA
-
-base64.js - String encoder for Base64 and Hex
-jsbn.js - basic BigInteger class
-jsbn2.js - BigInteger class extension
-prng4.js - Random number generator
-rng.js - Random number generator
-rsa.js - RSAKey class for RSA public key encryption.
-rsa2.js - RSA class extension for RSA private key decryption.
-
-http://www-cs-students.stanford.edu/~tjw/jsbn/LICENSE
-
-*********************************************************
-
-Licensing
----------
-
-This software is covered under the following copyright:
-
-/*
- * Copyright (c) 2003-2005 Tom Wu
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
- * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
- *
- * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
- * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF
- * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT
- * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * In addition, the following condition applies:
- *
- * All redistributions must retain an intact copy of this copyright notice
- * and disclaimer.
- */
-
-Address all questions regarding this license to:
-
- Tom Wu
- tjw@cs.Stanford.EDU
-
diff --git a/jwt/ext/THIRDPARTY_LICENSE.yui.txt b/jwt/ext/THIRDPARTY_LICENSE.yui.txt
deleted file mode 100755
index bc6e335..0000000
--- a/jwt/ext/THIRDPARTY_LICENSE.yui.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-http://yuilibrary.com/license/
-
-LICENCE:
- BSD License
-
-FILES
- - a part of ../jsrsasign-x.x.x-all-min.js
-
-Software License Agreement (BSD License)
-
-Copyright c 2013 Yahoo! Inc. All rights reserved.
-
-Redistribution and use of this software in source and binary forms,
-with or without modification, are permitted provided that the
-following conditions are met:
-
-- Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
-- Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-- Neither the name of Yahoo! Inc. nor the names of YUI's contributors
- may be used to endorse or promote products derived from this
- software without specific prior written permission of Yahoo! Inc.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/jwt/ext/base64-min.js b/jwt/ext/base64-min.js
deleted file mode 100755
index 008b8bf..0000000
--- a/jwt/ext/base64-min.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
- */
-var b64map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var b64pad="=";function hex2b64(d){var b;var e;var a="";for(b=0;b+3<=d.length;b+=3){e=parseInt(d.substring(b,b+3),16);a+=b64map.charAt(e>>6)+b64map.charAt(e&63)}if(b+1==d.length){e=parseInt(d.substring(b,b+1),16);a+=b64map.charAt(e<<2)}else{if(b+2==d.length){e=parseInt(d.substring(b,b+2),16);a+=b64map.charAt(e>>2)+b64map.charAt((e&3)<<4)}}if(b64pad){while((a.length&3)>0){a+=b64pad}}return a}function b64tohex(f){var d="";var e;var b=0;var c;var a;for(e=0;e>2);c=a&3;b=1}else{if(b==1){d+=int2char((c<<2)|(a>>4));c=a&15;b=2}else{if(b==2){d+=int2char(c);d+=int2char(a>>2);c=a&3;b=3}else{d+=int2char((c<<2)|(a>>4));d+=int2char(a&15);b=0}}}}if(b==1){d+=int2char(c<<2)}return d}function b64toBA(e){var d=b64tohex(e);var c;var b=new Array();for(c=0;2*c> 6) + b64map.charAt(c & 63);
- }
- if(i+1 == h.length) {
- c = parseInt(h.substring(i,i+1),16);
- ret += b64map.charAt(c << 2);
- }
- else if(i+2 == h.length) {
- c = parseInt(h.substring(i,i+2),16);
- ret += b64map.charAt(c >> 2) + b64map.charAt((c & 3) << 4);
- }
- if (b64pad) while((ret.length & 3) > 0) ret += b64pad;
- return ret;
-}
-
-// convert a base64 string to hex
-function b64tohex(s) {
- var ret = ""
- var i;
- var k = 0; // b64 state, 0-3
- var slop;
- var v;
- for(i = 0; i < s.length; ++i) {
- if(s.charAt(i) == b64pad) break;
- v = b64map.indexOf(s.charAt(i));
- if(v < 0) continue;
- if(k == 0) {
- ret += int2char(v >> 2);
- slop = v & 3;
- k = 1;
- }
- else if(k == 1) {
- ret += int2char((slop << 2) | (v >> 4));
- slop = v & 0xf;
- k = 2;
- }
- else if(k == 2) {
- ret += int2char(slop);
- ret += int2char(v >> 2);
- slop = v & 3;
- k = 3;
- }
- else {
- ret += int2char((slop << 2) | (v >> 4));
- ret += int2char(v & 0xf);
- k = 0;
- }
- }
- if(k == 1)
- ret += int2char(slop << 2);
- return ret;
-}
-
-// convert a base64 string to a byte/number array
-function b64toBA(s) {
- //piggyback on b64tohex for now, optimize later
- var h = b64tohex(s);
- var i;
- var a = new Array();
- for(i = 0; 2*i < h.length; ++i) {
- a[i] = parseInt(h.substring(2*i,2*i+2),16);
- }
- return a;
-}
diff --git a/jwt/ext/cryptojs-312-core-fix-min.js b/jwt/ext/cryptojs-312-core-fix-min.js
deleted file mode 100755
index a17d96b..0000000
--- a/jwt/ext/cryptojs-312-core-fix-min.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/*! CryptoJS v3.1.2 core-fix.js
- * code.google.com/p/crypto-js
- * (c) 2009-2013 by Jeff Mott. All rights reserved.
- * code.google.com/p/crypto-js/wiki/License
- * THIS IS FIX of 'core.js' to fix Hmac issue.
- * https://code.google.com/p/crypto-js/issues/detail?id=84
- * https://crypto-js.googlecode.com/svn-history/r667/branches/3.x/src/core.js
- */
-var CryptoJS=CryptoJS||(function(e,g){var a={};var b=a.lib={};var j=b.Base=(function(){function n(){}return{extend:function(p){n.prototype=this;var o=new n();if(p){o.mixIn(p)}if(!o.hasOwnProperty("init")){o.init=function(){o.$super.init.apply(this,arguments)}}o.init.prototype=o;o.$super=this;return o},create:function(){var o=this.extend();o.init.apply(o,arguments);return o},init:function(){},mixIn:function(p){for(var o in p){if(p.hasOwnProperty(o)){this[o]=p[o]}}if(p.hasOwnProperty("toString")){this.toString=p.toString}},clone:function(){return this.init.prototype.extend(this)}}}());var l=b.WordArray=j.extend({init:function(o,n){o=this.words=o||[];if(n!=g){this.sigBytes=n}else{this.sigBytes=o.length*4}},toString:function(n){return(n||h).stringify(this)},concat:function(t){var q=this.words;var p=t.words;var n=this.sigBytes;var s=t.sigBytes;this.clamp();if(n%4){for(var r=0;r>>2]>>>(24-(r%4)*8))&255;q[(n+r)>>>2]|=o<<(24-((n+r)%4)*8)}}else{for(var r=0;r>>2]=p[r>>>2]}}this.sigBytes+=s;return this},clamp:function(){var o=this.words;var n=this.sigBytes;o[n>>>2]&=4294967295<<(32-(n%4)*8);o.length=e.ceil(n/4)},clone:function(){var n=j.clone.call(this);n.words=this.words.slice(0);return n},random:function(p){var o=[];for(var n=0;n >>2]>>>(24-(n%4)*8))&255;q.push((s>>>4).toString(16));q.push((s&15).toString(16))}return q.join("")},parse:function(p){var n=p.length;var q=[];for(var o=0;o>>3]|=parseInt(p.substr(o,2),16)<<(24-(o%8)*4)}return new l.init(q,n/2)}};var d=m.Latin1={stringify:function(q){var r=q.words;var p=q.sigBytes;var n=[];for(var o=0;o>>2]>>>(24-(o%4)*8))&255;n.push(String.fromCharCode(s))}return n.join("")},parse:function(p){var n=p.length;var q=[];for(var o=0;o>>2]|=(p.charCodeAt(o)&255)<<(24-(o%4)*8)}return new l.init(q,n)}};var c=m.Utf8={stringify:function(n){try{return decodeURIComponent(escape(d.stringify(n)))}catch(o){throw new Error("Malformed UTF-8 data")}},parse:function(n){return d.parse(unescape(encodeURIComponent(n)))}};var i=b.BufferedBlockAlgorithm=j.extend({reset:function(){this._data=new l.init();this._nDataBytes=0},_append:function(n){if(typeof n=="string"){n=c.parse(n)}this._data.concat(n);this._nDataBytes+=n.sigBytes},_process:function(w){var q=this._data;var x=q.words;var n=q.sigBytes;var t=this.blockSize;var v=t*4;var u=n/v;if(w){u=e.ceil(u)}else{u=e.max((u|0)-this._minBufferSize,0)}var s=u*t;var r=e.min(s*4,n);if(s){for(var p=0;p>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
- thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);
- }
- } else {
- // Copy one word at a time
- for (var i = 0; i < thatSigBytes; i += 4) {
- thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];
- }
- }
- this.sigBytes += thatSigBytes;
-
- // Chainable
- return this;
- },
-
- /**
- * Removes insignificant bits.
- *
- * @example
- *
- * wordArray.clamp();
- */
- clamp: function () {
- // Shortcuts
- var words = this.words;
- var sigBytes = this.sigBytes;
-
- // Clamp
- words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);
- words.length = Math.ceil(sigBytes / 4);
- },
-
- /**
- * Creates a copy of this word array.
- *
- * @return {WordArray} The clone.
- *
- * @example
- *
- * var clone = wordArray.clone();
- */
- clone: function () {
- var clone = Base.clone.call(this);
- clone.words = this.words.slice(0);
-
- return clone;
- },
-
- /**
- * Creates a word array filled with random bytes.
- *
- * @param {number} nBytes The number of random bytes to generate.
- *
- * @return {WordArray} The random word array.
- *
- * @static
- *
- * @example
- *
- * var wordArray = CryptoJS.lib.WordArray.random(16);
- */
- random: function (nBytes) {
- var words = [];
- for (var i = 0; i < nBytes; i += 4) {
- words.push((Math.random() * 0x100000000) | 0);
- }
-
- return new WordArray.init(words, nBytes);
- }
- });
-
- /**
- * Encoder namespace.
- */
- var C_enc = C.enc = {};
-
- /**
- * Hex encoding strategy.
- */
- var Hex = C_enc.Hex = {
- /**
- * Converts a word array to a hex string.
- *
- * @param {WordArray} wordArray The word array.
- *
- * @return {string} The hex string.
- *
- * @static
- *
- * @example
- *
- * var hexString = CryptoJS.enc.Hex.stringify(wordArray);
- */
- stringify: function (wordArray) {
- // Shortcuts
- var words = wordArray.words;
- var sigBytes = wordArray.sigBytes;
-
- // Convert
- var hexChars = [];
- for (var i = 0; i < sigBytes; i++) {
- var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
- hexChars.push((bite >>> 4).toString(16));
- hexChars.push((bite & 0x0f).toString(16));
- }
-
- return hexChars.join('');
- },
-
- /**
- * Converts a hex string to a word array.
- *
- * @param {string} hexStr The hex string.
- *
- * @return {WordArray} The word array.
- *
- * @static
- *
- * @example
- *
- * var wordArray = CryptoJS.enc.Hex.parse(hexString);
- */
- parse: function (hexStr) {
- // Shortcut
- var hexStrLength = hexStr.length;
-
- // Convert
- var words = [];
- for (var i = 0; i < hexStrLength; i += 2) {
- words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);
- }
-
- return new WordArray.init(words, hexStrLength / 2);
- }
- };
-
- /**
- * Latin1 encoding strategy.
- */
- var Latin1 = C_enc.Latin1 = {
- /**
- * Converts a word array to a Latin1 string.
- *
- * @param {WordArray} wordArray The word array.
- *
- * @return {string} The Latin1 string.
- *
- * @static
- *
- * @example
- *
- * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
- */
- stringify: function (wordArray) {
- // Shortcuts
- var words = wordArray.words;
- var sigBytes = wordArray.sigBytes;
-
- // Convert
- var latin1Chars = [];
- for (var i = 0; i < sigBytes; i++) {
- var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
- latin1Chars.push(String.fromCharCode(bite));
- }
-
- return latin1Chars.join('');
- },
-
- /**
- * Converts a Latin1 string to a word array.
- *
- * @param {string} latin1Str The Latin1 string.
- *
- * @return {WordArray} The word array.
- *
- * @static
- *
- * @example
- *
- * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
- */
- parse: function (latin1Str) {
- // Shortcut
- var latin1StrLength = latin1Str.length;
-
- // Convert
- var words = [];
- for (var i = 0; i < latin1StrLength; i++) {
- words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);
- }
-
- return new WordArray.init(words, latin1StrLength);
- }
- };
-
- /**
- * UTF-8 encoding strategy.
- */
- var Utf8 = C_enc.Utf8 = {
- /**
- * Converts a word array to a UTF-8 string.
- *
- * @param {WordArray} wordArray The word array.
- *
- * @return {string} The UTF-8 string.
- *
- * @static
- *
- * @example
- *
- * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
- */
- stringify: function (wordArray) {
- try {
- return decodeURIComponent(escape(Latin1.stringify(wordArray)));
- } catch (e) {
- throw new Error('Malformed UTF-8 data');
- }
- },
-
- /**
- * Converts a UTF-8 string to a word array.
- *
- * @param {string} utf8Str The UTF-8 string.
- *
- * @return {WordArray} The word array.
- *
- * @static
- *
- * @example
- *
- * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
- */
- parse: function (utf8Str) {
- return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
- }
- };
-
- /**
- * Abstract buffered block algorithm template.
- *
- * The property blockSize must be implemented in a concrete subtype.
- *
- * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
- */
- var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
- /**
- * Resets this block algorithm's data buffer to its initial state.
- *
- * @example
- *
- * bufferedBlockAlgorithm.reset();
- */
- reset: function () {
- // Initial values
- this._data = new WordArray.init();
- this._nDataBytes = 0;
- },
-
- /**
- * Adds new data to this block algorithm's buffer.
- *
- * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
- *
- * @example
- *
- * bufferedBlockAlgorithm._append('data');
- * bufferedBlockAlgorithm._append(wordArray);
- */
- _append: function (data) {
- // Convert string to WordArray, else assume WordArray already
- if (typeof data == 'string') {
- data = Utf8.parse(data);
- }
-
- // Append
- this._data.concat(data);
- this._nDataBytes += data.sigBytes;
- },
-
- /**
- * Processes available data blocks.
- *
- * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
- *
- * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
- *
- * @return {WordArray} The processed data.
- *
- * @example
- *
- * var processedData = bufferedBlockAlgorithm._process();
- * var processedData = bufferedBlockAlgorithm._process(!!'flush');
- */
- _process: function (doFlush) {
- // Shortcuts
- var data = this._data;
- var dataWords = data.words;
- var dataSigBytes = data.sigBytes;
- var blockSize = this.blockSize;
- var blockSizeBytes = blockSize * 4;
-
- // Count blocks ready
- var nBlocksReady = dataSigBytes / blockSizeBytes;
- if (doFlush) {
- // Round up to include partial blocks
- nBlocksReady = Math.ceil(nBlocksReady);
- } else {
- // Round down to include only full blocks,
- // less the number of blocks that must remain in the buffer
- nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
- }
-
- // Count words ready
- var nWordsReady = nBlocksReady * blockSize;
-
- // Count bytes ready
- var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);
-
- // Process blocks
- if (nWordsReady) {
- for (var offset = 0; offset < nWordsReady; offset += blockSize) {
- // Perform concrete-algorithm logic
- this._doProcessBlock(dataWords, offset);
- }
-
- // Remove processed words
- var processedWords = dataWords.splice(0, nWordsReady);
- data.sigBytes -= nBytesReady;
- }
-
- // Return processed words
- return new WordArray.init(processedWords, nBytesReady);
- },
-
- /**
- * Creates a copy of this object.
- *
- * @return {Object} The clone.
- *
- * @example
- *
- * var clone = bufferedBlockAlgorithm.clone();
- */
- clone: function () {
- var clone = Base.clone.call(this);
- clone._data = this._data.clone();
-
- return clone;
- },
-
- _minBufferSize: 0
- });
-
- /**
- * Abstract hasher template.
- *
- * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)
- */
- var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
- /**
- * Configuration options.
- */
- cfg: Base.extend(),
-
- /**
- * Initializes a newly created hasher.
- *
- * @param {Object} cfg (Optional) The configuration options to use for this hash computation.
- *
- * @example
- *
- * var hasher = CryptoJS.algo.SHA256.create();
- */
- init: function (cfg) {
- // Apply config defaults
- this.cfg = this.cfg.extend(cfg);
-
- // Set initial values
- this.reset();
- },
-
- /**
- * Resets this hasher to its initial state.
- *
- * @example
- *
- * hasher.reset();
- */
- reset: function () {
- // Reset data buffer
- BufferedBlockAlgorithm.reset.call(this);
-
- // Perform concrete-hasher logic
- this._doReset();
- },
-
- /**
- * Updates this hasher with a message.
- *
- * @param {WordArray|string} messageUpdate The message to append.
- *
- * @return {Hasher} This hasher.
- *
- * @example
- *
- * hasher.update('message');
- * hasher.update(wordArray);
- */
- update: function (messageUpdate) {
- // Append
- this._append(messageUpdate);
-
- // Update the hash
- this._process();
-
- // Chainable
- return this;
- },
-
- /**
- * Finalizes the hash computation.
- * Note that the finalize operation is effectively a destructive, read-once operation.
- *
- * @param {WordArray|string} messageUpdate (Optional) A final message update.
- *
- * @return {WordArray} The hash.
- *
- * @example
- *
- * var hash = hasher.finalize();
- * var hash = hasher.finalize('message');
- * var hash = hasher.finalize(wordArray);
- */
- finalize: function (messageUpdate) {
- // Final message update
- if (messageUpdate) {
- this._append(messageUpdate);
- }
-
- // Perform concrete-hasher logic
- var hash = this._doFinalize();
-
- return hash;
- },
-
- blockSize: 512/32,
-
- /**
- * Creates a shortcut function to a hasher's object interface.
- *
- * @param {Hasher} hasher The hasher to create a helper for.
- *
- * @return {Function} The shortcut function.
- *
- * @static
- *
- * @example
- *
- * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
- */
- _createHelper: function (hasher) {
- return function (message, cfg) {
- return new hasher.init(cfg).finalize(message);
- };
- },
-
- /**
- * Creates a shortcut function to the HMAC's object interface.
- *
- * @param {Hasher} hasher The hasher to use in this HMAC helper.
- *
- * @return {Function} The shortcut function.
- *
- * @static
- *
- * @example
- *
- * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
- */
- _createHmacHelper: function (hasher) {
- return function (message, key) {
- return new C_algo.HMAC.init(hasher, key).finalize(message);
- };
- }
- });
-
- /**
- * Algorithm namespace.
- */
- var C_algo = C.algo = {};
-
- return C;
-}(Math));
diff --git a/jwt/ext/ec-min.js b/jwt/ext/ec-min.js
deleted file mode 100755
index 8fe1154..0000000
--- a/jwt/ext/ec-min.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
- */
-function ECFieldElementFp(b,a){this.x=a;this.q=b}function feFpEquals(a){if(a==this){return true}return(this.q.equals(a.q)&&this.x.equals(a.x))}function feFpToBigInteger(){return this.x}function feFpNegate(){return new ECFieldElementFp(this.q,this.x.negate().mod(this.q))}function feFpAdd(a){return new ECFieldElementFp(this.q,this.x.add(a.toBigInteger()).mod(this.q))}function feFpSubtract(a){return new ECFieldElementFp(this.q,this.x.subtract(a.toBigInteger()).mod(this.q))}function feFpMultiply(a){return new ECFieldElementFp(this.q,this.x.multiply(a.toBigInteger()).mod(this.q))}function feFpSquare(){return new ECFieldElementFp(this.q,this.x.square().mod(this.q))}function feFpDivide(a){return new ECFieldElementFp(this.q,this.x.multiply(a.toBigInteger().modInverse(this.q)).mod(this.q))}ECFieldElementFp.prototype.equals=feFpEquals;ECFieldElementFp.prototype.toBigInteger=feFpToBigInteger;ECFieldElementFp.prototype.negate=feFpNegate;ECFieldElementFp.prototype.add=feFpAdd;ECFieldElementFp.prototype.subtract=feFpSubtract;ECFieldElementFp.prototype.multiply=feFpMultiply;ECFieldElementFp.prototype.square=feFpSquare;ECFieldElementFp.prototype.divide=feFpDivide;function ECPointFp(c,a,d,b){this.curve=c;this.x=a;this.y=d;if(b==null){this.z=BigInteger.ONE}else{this.z=b}this.zinv=null}function pointFpGetX(){if(this.zinv==null){this.zinv=this.z.modInverse(this.curve.q)}return this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function pointFpGetY(){if(this.zinv==null){this.zinv=this.z.modInverse(this.curve.q)}return this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function pointFpEquals(a){if(a==this){return true}if(this.isInfinity()){return a.isInfinity()}if(a.isInfinity()){return this.isInfinity()}var c,b;c=a.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(a.z)).mod(this.curve.q);if(!c.equals(BigInteger.ZERO)){return false}b=a.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(a.z)).mod(this.curve.q);return b.equals(BigInteger.ZERO)}function pointFpIsInfinity(){if((this.x==null)&&(this.y==null)){return true}return this.z.equals(BigInteger.ZERO)&&!this.y.toBigInteger().equals(BigInteger.ZERO)}function pointFpNegate(){return new ECPointFp(this.curve,this.x,this.y.negate(),this.z)}function pointFpAdd(l){if(this.isInfinity()){return l}if(l.isInfinity()){return this}var p=l.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(l.z)).mod(this.curve.q);var o=l.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(l.z)).mod(this.curve.q);if(BigInteger.ZERO.equals(o)){if(BigInteger.ZERO.equals(p)){return this.twice()}return this.curve.getInfinity()}var j=new BigInteger("3");var e=this.x.toBigInteger();var n=this.y.toBigInteger();var c=l.x.toBigInteger();var k=l.y.toBigInteger();var m=o.square();var i=m.multiply(o);var d=e.multiply(m);var g=p.square().multiply(this.z);var a=g.subtract(d.shiftLeft(1)).multiply(l.z).subtract(i).multiply(o).mod(this.curve.q);var h=d.multiply(j).multiply(p).subtract(n.multiply(i)).subtract(g.multiply(p)).multiply(l.z).add(p.multiply(i)).mod(this.curve.q);var f=i.multiply(this.z).multiply(l.z).mod(this.curve.q);return new ECPointFp(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(h),f)}function pointFpTwice(){if(this.isInfinity()){return this}if(this.y.toBigInteger().signum()==0){return this.curve.getInfinity()}var g=new BigInteger("3");var c=this.x.toBigInteger();var h=this.y.toBigInteger();var e=h.multiply(this.z);var j=e.multiply(h).mod(this.curve.q);var i=this.curve.a.toBigInteger();var k=c.square().multiply(g);if(!BigInteger.ZERO.equals(i)){k=k.add(this.z.square().multiply(i))}k=k.mod(this.curve.q);var b=k.square().subtract(c.shiftLeft(3).multiply(j)).shiftLeft(1).multiply(e).mod(this.curve.q);var f=k.multiply(g).multiply(c).subtract(j.shiftLeft(1)).shiftLeft(2).multiply(j).subtract(k.square().multiply(k)).mod(this.curve.q);var d=e.square().multiply(e).shiftLeft(3).mod(this.curve.q);return new ECPointFp(this.curve,this.curve.fromBigInteger(b),this.curve.fromBigInteger(f),d)}function pointFpMultiply(b){if(this.isInfinity()){return this}if(b.signum()==0){return this.curve.getInfinity()}var g=b;var f=g.multiply(new BigInteger("3"));var l=this.negate();var d=this;var c;for(c=f.bitLength()-2;c>0;--c){d=d.twice();var a=f.testBit(c);var j=g.testBit(c);if(a!=j){d=d.add(a?this:l)}}return d}function pointFpMultiplyTwo(c,a,b){var d;if(c.bitLength()>b.bitLength()){d=c.bitLength()-1}else{d=b.bitLength()-1}var f=this.curve.getInfinity();var e=this.add(a);while(d>=0){f=f.twice();if(c.testBit(d)){if(b.testBit(d)){f=f.add(e)}else{f=f.add(this)}}else{if(b.testBit(d)){f=f.add(a)}}--d}return f}ECPointFp.prototype.getX=pointFpGetX;ECPointFp.prototype.getY=pointFpGetY;ECPointFp.prototype.equals=pointFpEquals;ECPointFp.prototype.isInfinity=pointFpIsInfinity;ECPointFp.prototype.negate=pointFpNegate;ECPointFp.prototype.add=pointFpAdd;ECPointFp.prototype.twice=pointFpTwice;ECPointFp.prototype.multiply=pointFpMultiply;ECPointFp.prototype.multiplyTwo=pointFpMultiplyTwo;function ECCurveFp(e,d,c){this.q=e;this.a=this.fromBigInteger(d);this.b=this.fromBigInteger(c);this.infinity=new ECPointFp(this,null,null)}function curveFpGetQ(){return this.q}function curveFpGetA(){return this.a}function curveFpGetB(){return this.b}function curveFpEquals(a){if(a==this){return true}return(this.q.equals(a.q)&&this.a.equals(a.a)&&this.b.equals(a.b))}function curveFpGetInfinity(){return this.infinity}function curveFpFromBigInteger(a){return new ECFieldElementFp(this.q,a)}function curveFpDecodePointHex(d){switch(parseInt(d.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var a=(d.length-2)/2;var c=d.substr(2,a);var b=d.substr(a+2,a);return new ECPointFp(this,this.fromBigInteger(new BigInteger(c,16)),this.fromBigInteger(new BigInteger(b,16)));default:return null}}ECCurveFp.prototype.getQ=curveFpGetQ;ECCurveFp.prototype.getA=curveFpGetA;ECCurveFp.prototype.getB=curveFpGetB;ECCurveFp.prototype.equals=curveFpEquals;ECCurveFp.prototype.getInfinity=curveFpGetInfinity;ECCurveFp.prototype.fromBigInteger=curveFpFromBigInteger;ECCurveFp.prototype.decodePointHex=curveFpDecodePointHex;
\ No newline at end of file
diff --git a/jwt/ext/ec-patch-min.js b/jwt/ext/ec-patch-min.js
deleted file mode 100755
index 834a5fd..0000000
--- a/jwt/ext/ec-patch-min.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib
- */
-ECFieldElementFp.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)};ECPointFp.prototype.getEncoded=function(c){var d=function(h,f){var g=h.toByteArrayUnsigned();if(fg.length){g.unshift(0)}}return g};var a=this.getX().toBigInteger();var e=this.getY().toBigInteger();var b=d(a,32);if(c){if(e.isEven()){b.unshift(2)}else{b.unshift(3)}}else{b.unshift(4);b=b.concat(d(e,32))}return b};ECPointFp.decodeFrom=function(g,c){var f=c[0];var e=c.length-1;var d=c.slice(1,1+e/2);var b=c.slice(1+e/2,1+e);d.unshift(0);b.unshift(0);var a=new BigInteger(d);var h=new BigInteger(b);return new ECPointFp(g,g.fromBigInteger(a),g.fromBigInteger(h))};ECPointFp.decodeFromHex=function(g,c){var f=c.substr(0,2);var e=c.length-2;var d=c.substr(2,e/2);var b=c.substr(2+e/2,e/2);var a=new BigInteger(d,16);var h=new BigInteger(b,16);return new ECPointFp(g,g.fromBigInteger(a),g.fromBigInteger(h))};ECPointFp.prototype.add2D=function(c){if(this.isInfinity()){return c}if(c.isInfinity()){return this}if(this.x.equals(c.x)){if(this.y.equals(c.y)){return this.twice()}return this.curve.getInfinity()}var g=c.x.subtract(this.x);var e=c.y.subtract(this.y);var a=e.divide(g);var d=a.square().subtract(this.x).subtract(c.x);var f=a.multiply(this.x.subtract(d)).subtract(this.y);return new ECPointFp(this.curve,d,f)};ECPointFp.prototype.twice2D=function(){if(this.isInfinity()){return this}if(this.y.toBigInteger().signum()==0){return this.curve.getInfinity()}var b=this.curve.fromBigInteger(BigInteger.valueOf(2));var e=this.curve.fromBigInteger(BigInteger.valueOf(3));var a=this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(b));var c=a.square().subtract(this.x.multiply(b));var d=a.multiply(this.x.subtract(c)).subtract(this.y);return new ECPointFp(this.curve,c,d)};ECPointFp.prototype.multiply2D=function(b){if(this.isInfinity()){return this}if(b.signum()==0){return this.curve.getInfinity()}var g=b;var f=g.multiply(new BigInteger("3"));var l=this.negate();var d=this;var c;for(c=f.bitLength()-2;c>0;--c){d=d.twice();var a=f.testBit(c);var j=g.testBit(c);if(a!=j){d=d.add2D(a?this:l)}}return d};ECPointFp.prototype.isOnCurve=function(){var d=this.getX().toBigInteger();var i=this.getY().toBigInteger();var f=this.curve.getA().toBigInteger();var c=this.curve.getB().toBigInteger();var h=this.curve.getQ();var e=i.multiply(i).mod(h);var g=d.multiply(d).multiply(d).add(f.multiply(d)).add(c).mod(h);return e.equals(g)};ECPointFp.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"};ECPointFp.prototype.validate=function(){var c=this.curve.getQ();if(this.isInfinity()){throw new Error("Point is at infinity.")}var a=this.getX().toBigInteger();var b=this.getY().toBigInteger();if(a.compareTo(BigInteger.ONE)<0||a.compareTo(c.subtract(BigInteger.ONE))>0){throw new Error("x coordinate out of bounds")}if(b.compareTo(BigInteger.ONE)<0||b.compareTo(c.subtract(BigInteger.ONE))>0){throw new Error("y coordinate out of bounds")}if(!this.isOnCurve()){throw new Error("Point is not on the curve.")}if(this.multiply(c).isInfinity()){throw new Error("Point is not a scalar multiple of G.")}return true};
\ No newline at end of file
diff --git a/jwt/ext/ec-patch.js b/jwt/ext/ec-patch.js
deleted file mode 100755
index 221f657..0000000
--- a/jwt/ext/ec-patch.js
+++ /dev/null
@@ -1,209 +0,0 @@
-/*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib
- */
-/*
- * splitted from bitcoin-lib/ecdsa.js
- *
- * version 1.0.0 is the original of bitcoin-lib/ecdsa.js
- */
-ECFieldElementFp.prototype.getByteLength = function () {
- return Math.floor((this.toBigInteger().bitLength() + 7) / 8);
-};
-
-ECPointFp.prototype.getEncoded = function (compressed) {
- var integerToBytes = function(i, len) {
- var bytes = i.toByteArrayUnsigned();
-
- if (len < bytes.length) {
- bytes = bytes.slice(bytes.length-len);
- } else while (len > bytes.length) {
- bytes.unshift(0);
- }
- return bytes;
- };
-
- var x = this.getX().toBigInteger();
- var y = this.getY().toBigInteger();
-
- // Get value as a 32-byte Buffer
- // Fixed length based on a patch by bitaddress.org and Casascius
- var enc = integerToBytes(x, 32);
-
- if (compressed) {
- if (y.isEven()) {
- // Compressed even pubkey
- // M = 02 || X
- enc.unshift(0x02);
- } else {
- // Compressed uneven pubkey
- // M = 03 || X
- enc.unshift(0x03);
- }
- } else {
- // Uncompressed pubkey
- // M = 04 || X || Y
- enc.unshift(0x04);
- enc = enc.concat(integerToBytes(y, 32));
- }
- return enc;
-};
-
-ECPointFp.decodeFrom = function (curve, enc) {
- var type = enc[0];
- var dataLen = enc.length-1;
-
- // Extract x and y as byte arrays
- var xBa = enc.slice(1, 1 + dataLen/2);
- var yBa = enc.slice(1 + dataLen/2, 1 + dataLen);
-
- // Prepend zero byte to prevent interpretation as negative integer
- xBa.unshift(0);
- yBa.unshift(0);
-
- // Convert to BigIntegers
- var x = new BigInteger(xBa);
- var y = new BigInteger(yBa);
-
- // Return point
- return new ECPointFp(curve, curve.fromBigInteger(x), curve.fromBigInteger(y));
-};
-
-/*
- * @since ec-patch.js 1.0.1
- */
-ECPointFp.decodeFromHex = function (curve, encHex) {
- var type = encHex.substr(0, 2); // shall be "04"
- var dataLen = encHex.length - 2;
-
- // Extract x and y as byte arrays
- var xHex = encHex.substr(2, dataLen / 2);
- var yHex = encHex.substr(2 + dataLen / 2, dataLen / 2);
-
- // Convert to BigIntegers
- var x = new BigInteger(xHex, 16);
- var y = new BigInteger(yHex, 16);
-
- // Return point
- return new ECPointFp(curve, curve.fromBigInteger(x), curve.fromBigInteger(y));
-};
-
-ECPointFp.prototype.add2D = function (b) {
- if(this.isInfinity()) return b;
- if(b.isInfinity()) return this;
-
- if (this.x.equals(b.x)) {
- if (this.y.equals(b.y)) {
- // this = b, i.e. this must be doubled
- return this.twice();
- }
- // this = -b, i.e. the result is the point at infinity
- return this.curve.getInfinity();
- }
-
- var x_x = b.x.subtract(this.x);
- var y_y = b.y.subtract(this.y);
- var gamma = y_y.divide(x_x);
-
- var x3 = gamma.square().subtract(this.x).subtract(b.x);
- var y3 = gamma.multiply(this.x.subtract(x3)).subtract(this.y);
-
- return new ECPointFp(this.curve, x3, y3);
-};
-
-ECPointFp.prototype.twice2D = function () {
- if (this.isInfinity()) return this;
- if (this.y.toBigInteger().signum() == 0) {
- // if y1 == 0, then (x1, y1) == (x1, -y1)
- // and hence this = -this and thus 2(x1, y1) == infinity
- return this.curve.getInfinity();
- }
-
- var TWO = this.curve.fromBigInteger(BigInteger.valueOf(2));
- var THREE = this.curve.fromBigInteger(BigInteger.valueOf(3));
- var gamma = this.x.square().multiply(THREE).add(this.curve.a).divide(this.y.multiply(TWO));
-
- var x3 = gamma.square().subtract(this.x.multiply(TWO));
- var y3 = gamma.multiply(this.x.subtract(x3)).subtract(this.y);
-
- return new ECPointFp(this.curve, x3, y3);
-};
-
-ECPointFp.prototype.multiply2D = function (k) {
- if(this.isInfinity()) return this;
- if(k.signum() == 0) return this.curve.getInfinity();
-
- var e = k;
- var h = e.multiply(new BigInteger("3"));
-
- var neg = this.negate();
- var R = this;
-
- var i;
- for (i = h.bitLength() - 2; i > 0; --i) {
- R = R.twice();
-
- var hBit = h.testBit(i);
- var eBit = e.testBit(i);
-
- if (hBit != eBit) {
- R = R.add2D(hBit ? this : neg);
- }
- }
-
- return R;
-};
-
-ECPointFp.prototype.isOnCurve = function () {
- var x = this.getX().toBigInteger();
- var y = this.getY().toBigInteger();
- var a = this.curve.getA().toBigInteger();
- var b = this.curve.getB().toBigInteger();
- var n = this.curve.getQ();
- var lhs = y.multiply(y).mod(n);
- var rhs = x.multiply(x).multiply(x)
- .add(a.multiply(x)).add(b).mod(n);
- return lhs.equals(rhs);
-};
-
-ECPointFp.prototype.toString = function () {
- return '('+this.getX().toBigInteger().toString()+','+
- this.getY().toBigInteger().toString()+')';
-};
-
-/**
- * Validate an elliptic curve point.
- *
- * See SEC 1, section 3.2.2.1: Elliptic Curve Public Key Validation Primitive
- */
-ECPointFp.prototype.validate = function () {
- var n = this.curve.getQ();
-
- // Check Q != O
- if (this.isInfinity()) {
- throw new Error("Point is at infinity.");
- }
-
- // Check coordinate bounds
- var x = this.getX().toBigInteger();
- var y = this.getY().toBigInteger();
- if (x.compareTo(BigInteger.ONE) < 0 ||
- x.compareTo(n.subtract(BigInteger.ONE)) > 0) {
- throw new Error('x coordinate out of bounds');
- }
- if (y.compareTo(BigInteger.ONE) < 0 ||
- y.compareTo(n.subtract(BigInteger.ONE)) > 0) {
- throw new Error('y coordinate out of bounds');
- }
-
- // Check y^2 = x^3 + ax + b (mod n)
- if (!this.isOnCurve()) {
- throw new Error("Point is not on the curve.");
- }
-
- // Check nQ = 0 (Q is a scalar multiple of G)
- if (this.multiply(n).isInfinity()) {
- // TODO: This check doesn't work - fix.
- throw new Error("Point is not a scalar multiple of G.");
- }
-
- return true;
-};
diff --git a/jwt/ext/ec.js b/jwt/ext/ec.js
deleted file mode 100755
index 71aedee..0000000
--- a/jwt/ext/ec.js
+++ /dev/null
@@ -1,318 +0,0 @@
-/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
- */
-// Basic Javascript Elliptic Curve implementation
-// Ported loosely from BouncyCastle's Java EC code
-// Only Fp curves implemented for now
-
-// Requires jsbn.js and jsbn2.js
-
-// ----------------
-// ECFieldElementFp
-
-// constructor
-function ECFieldElementFp(q,x) {
- this.x = x;
- // TODO if(x.compareTo(q) >= 0) error
- this.q = q;
-}
-
-function feFpEquals(other) {
- if(other == this) return true;
- return (this.q.equals(other.q) && this.x.equals(other.x));
-}
-
-function feFpToBigInteger() {
- return this.x;
-}
-
-function feFpNegate() {
- return new ECFieldElementFp(this.q, this.x.negate().mod(this.q));
-}
-
-function feFpAdd(b) {
- return new ECFieldElementFp(this.q, this.x.add(b.toBigInteger()).mod(this.q));
-}
-
-function feFpSubtract(b) {
- return new ECFieldElementFp(this.q, this.x.subtract(b.toBigInteger()).mod(this.q));
-}
-
-function feFpMultiply(b) {
- return new ECFieldElementFp(this.q, this.x.multiply(b.toBigInteger()).mod(this.q));
-}
-
-function feFpSquare() {
- return new ECFieldElementFp(this.q, this.x.square().mod(this.q));
-}
-
-function feFpDivide(b) {
- return new ECFieldElementFp(this.q, this.x.multiply(b.toBigInteger().modInverse(this.q)).mod(this.q));
-}
-
-ECFieldElementFp.prototype.equals = feFpEquals;
-ECFieldElementFp.prototype.toBigInteger = feFpToBigInteger;
-ECFieldElementFp.prototype.negate = feFpNegate;
-ECFieldElementFp.prototype.add = feFpAdd;
-ECFieldElementFp.prototype.subtract = feFpSubtract;
-ECFieldElementFp.prototype.multiply = feFpMultiply;
-ECFieldElementFp.prototype.square = feFpSquare;
-ECFieldElementFp.prototype.divide = feFpDivide;
-
-// ----------------
-// ECPointFp
-
-// constructor
-function ECPointFp(curve,x,y,z) {
- this.curve = curve;
- this.x = x;
- this.y = y;
- // Projective coordinates: either zinv == null or z * zinv == 1
- // z and zinv are just BigIntegers, not fieldElements
- if(z == null) {
- this.z = BigInteger.ONE;
- }
- else {
- this.z = z;
- }
- this.zinv = null;
- //TODO: compression flag
-}
-
-function pointFpGetX() {
- if(this.zinv == null) {
- this.zinv = this.z.modInverse(this.curve.q);
- }
- return this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q));
-}
-
-function pointFpGetY() {
- if(this.zinv == null) {
- this.zinv = this.z.modInverse(this.curve.q);
- }
- return this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q));
-}
-
-function pointFpEquals(other) {
- if(other == this) return true;
- if(this.isInfinity()) return other.isInfinity();
- if(other.isInfinity()) return this.isInfinity();
- var u, v;
- // u = Y2 * Z1 - Y1 * Z2
- u = other.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(other.z)).mod(this.curve.q);
- if(!u.equals(BigInteger.ZERO)) return false;
- // v = X2 * Z1 - X1 * Z2
- v = other.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(other.z)).mod(this.curve.q);
- return v.equals(BigInteger.ZERO);
-}
-
-function pointFpIsInfinity() {
- if((this.x == null) && (this.y == null)) return true;
- return this.z.equals(BigInteger.ZERO) && !this.y.toBigInteger().equals(BigInteger.ZERO);
-}
-
-function pointFpNegate() {
- return new ECPointFp(this.curve, this.x, this.y.negate(), this.z);
-}
-
-function pointFpAdd(b) {
- if(this.isInfinity()) return b;
- if(b.isInfinity()) return this;
-
- // u = Y2 * Z1 - Y1 * Z2
- var u = b.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(b.z)).mod(this.curve.q);
- // v = X2 * Z1 - X1 * Z2
- var v = b.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(b.z)).mod(this.curve.q);
-
- if(BigInteger.ZERO.equals(v)) {
- if(BigInteger.ZERO.equals(u)) {
- return this.twice(); // this == b, so double
- }
- return this.curve.getInfinity(); // this = -b, so infinity
- }
-
- var THREE = new BigInteger("3");
- var x1 = this.x.toBigInteger();
- var y1 = this.y.toBigInteger();
- var x2 = b.x.toBigInteger();
- var y2 = b.y.toBigInteger();
-
- var v2 = v.square();
- var v3 = v2.multiply(v);
- var x1v2 = x1.multiply(v2);
- var zu2 = u.square().multiply(this.z);
-
- // x3 = v * (z2 * (z1 * u^2 - 2 * x1 * v^2) - v^3)
- var x3 = zu2.subtract(x1v2.shiftLeft(1)).multiply(b.z).subtract(v3).multiply(v).mod(this.curve.q);
- // y3 = z2 * (3 * x1 * u * v^2 - y1 * v^3 - z1 * u^3) + u * v^3
- var y3 = x1v2.multiply(THREE).multiply(u).subtract(y1.multiply(v3)).subtract(zu2.multiply(u)).multiply(b.z).add(u.multiply(v3)).mod(this.curve.q);
- // z3 = v^3 * z1 * z2
- var z3 = v3.multiply(this.z).multiply(b.z).mod(this.curve.q);
-
- return new ECPointFp(this.curve, this.curve.fromBigInteger(x3), this.curve.fromBigInteger(y3), z3);
-}
-
-function pointFpTwice() {
- if(this.isInfinity()) return this;
- if(this.y.toBigInteger().signum() == 0) return this.curve.getInfinity();
-
- // TODO: optimized handling of constants
- var THREE = new BigInteger("3");
- var x1 = this.x.toBigInteger();
- var y1 = this.y.toBigInteger();
-
- var y1z1 = y1.multiply(this.z);
- var y1sqz1 = y1z1.multiply(y1).mod(this.curve.q);
- var a = this.curve.a.toBigInteger();
-
- // w = 3 * x1^2 + a * z1^2
- var w = x1.square().multiply(THREE);
- if(!BigInteger.ZERO.equals(a)) {
- w = w.add(this.z.square().multiply(a));
- }
- w = w.mod(this.curve.q);
- // x3 = 2 * y1 * z1 * (w^2 - 8 * x1 * y1^2 * z1)
- var x3 = w.square().subtract(x1.shiftLeft(3).multiply(y1sqz1)).shiftLeft(1).multiply(y1z1).mod(this.curve.q);
- // y3 = 4 * y1^2 * z1 * (3 * w * x1 - 2 * y1^2 * z1) - w^3
- var y3 = w.multiply(THREE).multiply(x1).subtract(y1sqz1.shiftLeft(1)).shiftLeft(2).multiply(y1sqz1).subtract(w.square().multiply(w)).mod(this.curve.q);
- // z3 = 8 * (y1 * z1)^3
- var z3 = y1z1.square().multiply(y1z1).shiftLeft(3).mod(this.curve.q);
-
- return new ECPointFp(this.curve, this.curve.fromBigInteger(x3), this.curve.fromBigInteger(y3), z3);
-}
-
-// Simple NAF (Non-Adjacent Form) multiplication algorithm
-// TODO: modularize the multiplication algorithm
-function pointFpMultiply(k) {
- if(this.isInfinity()) return this;
- if(k.signum() == 0) return this.curve.getInfinity();
-
- var e = k;
- var h = e.multiply(new BigInteger("3"));
-
- var neg = this.negate();
- var R = this;
-
- var i;
- for(i = h.bitLength() - 2; i > 0; --i) {
- R = R.twice();
-
- var hBit = h.testBit(i);
- var eBit = e.testBit(i);
-
- if (hBit != eBit) {
- R = R.add(hBit ? this : neg);
- }
- }
-
- return R;
-}
-
-// Compute this*j + x*k (simultaneous multiplication)
-function pointFpMultiplyTwo(j,x,k) {
- var i;
- if(j.bitLength() > k.bitLength())
- i = j.bitLength() - 1;
- else
- i = k.bitLength() - 1;
-
- var R = this.curve.getInfinity();
- var both = this.add(x);
- while(i >= 0) {
- R = R.twice();
- if(j.testBit(i)) {
- if(k.testBit(i)) {
- R = R.add(both);
- }
- else {
- R = R.add(this);
- }
- }
- else {
- if(k.testBit(i)) {
- R = R.add(x);
- }
- }
- --i;
- }
-
- return R;
-}
-
-ECPointFp.prototype.getX = pointFpGetX;
-ECPointFp.prototype.getY = pointFpGetY;
-ECPointFp.prototype.equals = pointFpEquals;
-ECPointFp.prototype.isInfinity = pointFpIsInfinity;
-ECPointFp.prototype.negate = pointFpNegate;
-ECPointFp.prototype.add = pointFpAdd;
-ECPointFp.prototype.twice = pointFpTwice;
-ECPointFp.prototype.multiply = pointFpMultiply;
-ECPointFp.prototype.multiplyTwo = pointFpMultiplyTwo;
-
-// ----------------
-// ECCurveFp
-
-// constructor
-function ECCurveFp(q,a,b) {
- this.q = q;
- this.a = this.fromBigInteger(a);
- this.b = this.fromBigInteger(b);
- this.infinity = new ECPointFp(this, null, null);
-}
-
-function curveFpGetQ() {
- return this.q;
-}
-
-function curveFpGetA() {
- return this.a;
-}
-
-function curveFpGetB() {
- return this.b;
-}
-
-function curveFpEquals(other) {
- if(other == this) return true;
- return(this.q.equals(other.q) && this.a.equals(other.a) && this.b.equals(other.b));
-}
-
-function curveFpGetInfinity() {
- return this.infinity;
-}
-
-function curveFpFromBigInteger(x) {
- return new ECFieldElementFp(this.q, x);
-}
-
-// for now, work with hex strings because they're easier in JS
-function curveFpDecodePointHex(s) {
- switch(parseInt(s.substr(0,2), 16)) { // first byte
- case 0:
- return this.infinity;
- case 2:
- case 3:
- // point compression not supported yet
- return null;
- case 4:
- case 6:
- case 7:
- var len = (s.length - 2) / 2;
- var xHex = s.substr(2, len);
- var yHex = s.substr(len+2, len);
-
- return new ECPointFp(this,
- this.fromBigInteger(new BigInteger(xHex, 16)),
- this.fromBigInteger(new BigInteger(yHex, 16)));
-
- default: // unsupported
- return null;
- }
-}
-
-ECCurveFp.prototype.getQ = curveFpGetQ;
-ECCurveFp.prototype.getA = curveFpGetA;
-ECCurveFp.prototype.getB = curveFpGetB;
-ECCurveFp.prototype.equals = curveFpEquals;
-ECCurveFp.prototype.getInfinity = curveFpGetInfinity;
-ECCurveFp.prototype.fromBigInteger = curveFpFromBigInteger;
-ECCurveFp.prototype.decodePointHex = curveFpDecodePointHex;
diff --git a/jwt/ext/jsbn-min.js b/jwt/ext/jsbn-min.js
deleted file mode 100755
index ae21a79..0000000
--- a/jwt/ext/jsbn-min.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
- */
-var dbits;var canary=244837814094590;var j_lm=((canary&16777215)==15715070);function BigInteger(e,d,f){if(e!=null){if("number"==typeof e){this.fromNumber(e,d,f)}else{if(d==null&&"string"!=typeof e){this.fromString(e,256)}else{this.fromString(e,d)}}}}function nbi(){return new BigInteger(null)}function am1(f,a,b,e,h,g){while(--g>=0){var d=a*this[f++]+b[e]+h;h=Math.floor(d/67108864);b[e++]=d&67108863}return h}function am2(f,q,r,e,o,a){var k=q&32767,p=q>>15;while(--a>=0){var d=this[f]&32767;var g=this[f++]>>15;var b=p*d+g*k;d=k*d+((b&32767)<<15)+r[e]+(o&1073741823);o=(d>>>30)+(b>>>15)+p*g+(o>>>30);r[e++]=d&1073741823}return o}function am3(f,q,r,e,o,a){var k=q&16383,p=q>>14;while(--a>=0){var d=this[f]&16383;var g=this[f++]>>14;var b=p*d+g*k;d=k*d+((b&16383)<<14)+r[e]+o;o=(d>>28)+(b>>14)+p*g;r[e++]=d&268435455}return o}if(j_lm&&(navigator.appName=="Microsoft Internet Explorer")){BigInteger.prototype.am=am2;dbits=30}else{if(j_lm&&(navigator.appName!="Netscape")){BigInteger.prototype.am=am1;dbits=26}else{BigInteger.prototype.am=am3;dbits=28}}BigInteger.prototype.DB=dbits;BigInteger.prototype.DM=((1<=0;--a){b[a]=this[a]}b.t=this.t;b.s=this.s}function bnpFromInt(a){this.t=1;this.s=(a<0)?-1:0;if(a>0){this[0]=a}else{if(a<-1){this[0]=a+this.DV}else{this.t=0}}}function nbv(a){var b=nbi();b.fromInt(a);return b}function bnpFromString(h,c){var e;if(c==16){e=4}else{if(c==8){e=3}else{if(c==256){e=8}else{if(c==2){e=1}else{if(c==32){e=5}else{if(c==4){e=2}else{this.fromRadix(h,c);return}}}}}}this.t=0;this.s=0;var g=h.length,d=false,f=0;while(--g>=0){var a=(e==8)?h[g]&255:intAt(h,g);if(a<0){if(h.charAt(g)=="-"){d=true}continue}d=false;if(f==0){this[this.t++]=a}else{if(f+e>this.DB){this[this.t-1]|=(a&((1<<(this.DB-f))-1))<>(this.DB-f))}else{this[this.t-1]|=a<=this.DB){f-=this.DB}}if(e==8&&(h[0]&128)!=0){this.s=-1;if(f>0){this[this.t-1]|=((1<<(this.DB-f))-1)<0&&this[this.t-1]==a){--this.t}}function bnToString(c){if(this.s<0){return"-"+this.negate().toString(c)}var e;if(c==16){e=4}else{if(c==8){e=3}else{if(c==2){e=1}else{if(c==32){e=5}else{if(c==4){e=2}else{return this.toRadix(c)}}}}}var g=(1<0){if(j>j)>0){a=true;h=int2char(l)}while(f>=0){if(j>(j+=this.DB-e)}else{l=(this[f]>>(j-=e))&g;if(j<=0){j+=this.DB;--f}}if(l>0){a=true}if(a){h+=int2char(l)}}}return a?h:"0"}function bnNegate(){var a=nbi();BigInteger.ZERO.subTo(this,a);return a}function bnAbs(){return(this.s<0)?this.negate():this}function bnCompareTo(b){var d=this.s-b.s;if(d!=0){return d}var c=this.t;d=c-b.t;if(d!=0){return(this.s<0)?-d:d}while(--c>=0){if((d=this[c]-b[c])!=0){return d}}return 0}function nbits(a){var c=1,b;if((b=a>>>16)!=0){a=b;c+=16}if((b=a>>8)!=0){a=b;c+=8}if((b=a>>4)!=0){a=b;c+=4}if((b=a>>2)!=0){a=b;c+=2}if((b=a>>1)!=0){a=b;c+=1}return c}function bnBitLength(){if(this.t<=0){return 0}return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM))}function bnpDLShiftTo(c,b){var a;for(a=this.t-1;a>=0;--a){b[a+c]=this[a]}for(a=c-1;a>=0;--a){b[a]=0}b.t=this.t+c;b.s=this.s}function bnpDRShiftTo(c,b){for(var a=c;a=0;--d){e[d+f+1]=(this[d]>>a)|h;h=(this[d]&g)<=0;--d){e[d]=0}e[f]=h;e.t=this.t+f+1;e.s=this.s;e.clamp()}function bnpRShiftTo(g,d){d.s=this.s;var e=Math.floor(g/this.DB);if(e>=this.t){d.t=0;return}var b=g%this.DB;var a=this.DB-b;var f=(1<>b;for(var c=e+1;c>b}if(b>0){d[this.t-e-1]|=(this.s&f)<>=this.DB}if(d.t>=this.DB}g+=this.s}else{g+=this.s;while(e>=this.DB}g-=d.s}f.s=(g<0)?-1:0;if(g<-1){f[e++]=this.DV+g}else{if(g>0){f[e++]=g}}f.t=e;f.clamp()}function bnpMultiplyTo(c,e){var b=this.abs(),f=c.abs();var d=b.t;e.t=d+f.t;while(--d>=0){e[d]=0}for(d=0;d=0){d[b]=0}for(b=0;b=a.DV){d[b+a.t]-=a.DV;d[b+a.t+1]=1}}if(d.t>0){d[d.t-1]+=a.am(b,a[b],d,2*b,0,1)}d.s=0;d.clamp()}function bnpDivRemTo(n,h,g){var w=n.abs();if(w.t<=0){return}var k=this.abs();if(k.t0){w.lShiftTo(v,d);k.lShiftTo(v,g)}else{w.copyTo(d);k.copyTo(g)}var p=d.t;var b=d[p-1];if(b==0){return}var o=b*(1<1)?d[p-2]>>this.F2:0);var A=this.FV/o,z=(1<=0){g[g.t++]=1;g.subTo(f,g)}BigInteger.ONE.dlShiftTo(p,f);f.subTo(d,d);while(d.t=0){var c=(g[--u]==b)?this.DM:Math.floor(g[u]*A+(g[u-1]+x)*z);if((g[u]+=d.am(0,c,g,s,0,p))0){g.rShiftTo(v,g)}if(a<0){BigInteger.ZERO.subTo(g,g)}}function bnMod(b){var c=nbi();this.abs().divRemTo(b,null,c);if(this.s<0&&c.compareTo(BigInteger.ZERO)>0){b.subTo(c,c)}return c}function Classic(a){this.m=a}function cConvert(a){if(a.s<0||a.compareTo(this.m)>=0){return a.mod(this.m)}else{return a}}function cRevert(a){return a}function cReduce(a){a.divRemTo(this.m,null,a)}function cMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}function cSqrTo(a,b){a.squareTo(b);this.reduce(b)}Classic.prototype.convert=cConvert;Classic.prototype.revert=cRevert;Classic.prototype.reduce=cReduce;Classic.prototype.mulTo=cMulTo;Classic.prototype.sqrTo=cSqrTo;function bnpInvDigit(){if(this.t<1){return 0}var a=this[0];if((a&1)==0){return 0}var b=a&3;b=(b*(2-(a&15)*b))&15;b=(b*(2-(a&255)*b))&255;b=(b*(2-(((a&65535)*b)&65535)))&65535;b=(b*(2-a*b%this.DV))%this.DV;return(b>0)?this.DV-b:-b}function Montgomery(a){this.m=a;this.mp=a.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<(a.DB-15))-1;this.mt2=2*a.t}function montConvert(a){var b=nbi();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);if(a.s<0&&b.compareTo(BigInteger.ZERO)>0){this.m.subTo(b,b)}return b}function montRevert(a){var b=nbi();a.copyTo(b);this.reduce(b);return b}function montReduce(a){while(a.t<=this.mt2){a[a.t++]=0}for(var c=0;c>15)*this.mpl)&this.um)<<15))&a.DM;b=c+this.m.t;a[b]+=this.m.am(0,d,a,c,0,this.m.t);while(a[b]>=a.DV){a[b]-=a.DV;a[++b]++}}a.clamp();a.drShiftTo(this.m.t,a);if(a.compareTo(this.m)>=0){a.subTo(this.m,a)}}function montSqrTo(a,b){a.squareTo(b);this.reduce(b)}function montMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}Montgomery.prototype.convert=montConvert;Montgomery.prototype.revert=montRevert;Montgomery.prototype.reduce=montReduce;Montgomery.prototype.mulTo=montMulTo;Montgomery.prototype.sqrTo=montSqrTo;function bnpIsEven(){return((this.t>0)?(this[0]&1):this.s)==0}function bnpExp(h,j){if(h>4294967295||h<1){return BigInteger.ONE}var f=nbi(),a=nbi(),d=j.convert(this),c=nbits(h)-1;d.copyTo(f);while(--c>=0){j.sqrTo(f,a);if((h&(1<0){j.mulTo(a,d,f)}else{var b=f;f=a;a=b}}return j.revert(f)}function bnModPowInt(b,a){var c;if(b<256||a.isEven()){c=new Classic(a)}else{c=new Montgomery(a)}return this.exp(b,c)}BigInteger.prototype.copyTo=bnpCopyTo;BigInteger.prototype.fromInt=bnpFromInt;BigInteger.prototype.fromString=bnpFromString;BigInteger.prototype.clamp=bnpClamp;BigInteger.prototype.dlShiftTo=bnpDLShiftTo;BigInteger.prototype.drShiftTo=bnpDRShiftTo;BigInteger.prototype.lShiftTo=bnpLShiftTo;BigInteger.prototype.rShiftTo=bnpRShiftTo;BigInteger.prototype.subTo=bnpSubTo;BigInteger.prototype.multiplyTo=bnpMultiplyTo;BigInteger.prototype.squareTo=bnpSquareTo;BigInteger.prototype.divRemTo=bnpDivRemTo;BigInteger.prototype.invDigit=bnpInvDigit;BigInteger.prototype.isEven=bnpIsEven;BigInteger.prototype.exp=bnpExp;BigInteger.prototype.toString=bnToString;BigInteger.prototype.negate=bnNegate;BigInteger.prototype.abs=bnAbs;BigInteger.prototype.compareTo=bnCompareTo;BigInteger.prototype.bitLength=bnBitLength;BigInteger.prototype.mod=bnMod;BigInteger.prototype.modPowInt=bnModPowInt;BigInteger.ZERO=nbv(0);BigInteger.ONE=nbv(1);
\ No newline at end of file
diff --git a/jwt/ext/jsbn.js b/jwt/ext/jsbn.js
deleted file mode 100644
index cc8ed54..0000000
--- a/jwt/ext/jsbn.js
+++ /dev/null
@@ -1,561 +0,0 @@
-/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
- */
-// Copyright (c) 2005 Tom Wu
-// All Rights Reserved.
-// See "LICENSE" for details.
-
-// Basic JavaScript BN library - subset useful for RSA encryption.
-
-// Bits per digit
-var dbits;
-
-// JavaScript engine analysis
-var canary = 0xdeadbeefcafe;
-var j_lm = ((canary&0xffffff)==0xefcafe);
-
-// (public) Constructor
-function BigInteger(a,b,c) {
- if(a != null)
- if("number" == typeof a) this.fromNumber(a,b,c);
- else if(b == null && "string" != typeof a) this.fromString(a,256);
- else this.fromString(a,b);
-}
-
-// return new, unset BigInteger
-function nbi() { return new BigInteger(null); }
-
-// am: Compute w_j += (x*this_i), propagate carries,
-// c is initial carry, returns final carry.
-// c < 3*dvalue, x < 2*dvalue, this_i < dvalue
-// We need to select the fastest one that works in this environment.
-
-// am1: use a single mult and divide to get the high bits,
-// max digit bits should be 26 because
-// max internal value = 2*dvalue^2-2*dvalue (< 2^53)
-function am1(i,x,w,j,c,n) {
- while(--n >= 0) {
- var v = x*this[i++]+w[j]+c;
- c = Math.floor(v/0x4000000);
- w[j++] = v&0x3ffffff;
- }
- return c;
-}
-// am2 avoids a big mult-and-extract completely.
-// Max digit bits should be <= 30 because we do bitwise ops
-// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)
-function am2(i,x,w,j,c,n) {
- var xl = x&0x7fff, xh = x>>15;
- while(--n >= 0) {
- var l = this[i]&0x7fff;
- var h = this[i++]>>15;
- var m = xh*l+h*xl;
- l = xl*l+((m&0x7fff)<<15)+w[j]+(c&0x3fffffff);
- c = (l>>>30)+(m>>>15)+xh*h+(c>>>30);
- w[j++] = l&0x3fffffff;
- }
- return c;
-}
-// Alternately, set max digit bits to 28 since some
-// browsers slow down when dealing with 32-bit numbers.
-function am3(i,x,w,j,c,n) {
- var xl = x&0x3fff, xh = x>>14;
- while(--n >= 0) {
- var l = this[i]&0x3fff;
- var h = this[i++]>>14;
- var m = xh*l+h*xl;
- l = xl*l+((m&0x3fff)<<14)+w[j]+c;
- c = (l>>28)+(m>>14)+xh*h;
- w[j++] = l&0xfffffff;
- }
- return c;
-}
-if(j_lm && (navigator.appName == "Microsoft Internet Explorer")) {
- BigInteger.prototype.am = am2;
- dbits = 30;
-}
-else if(j_lm && (navigator.appName != "Netscape")) {
- BigInteger.prototype.am = am1;
- dbits = 26;
-}
-else { // Mozilla/Netscape seems to prefer am3
- BigInteger.prototype.am = am3;
- dbits = 28;
-}
-
-BigInteger.prototype.DB = dbits;
-BigInteger.prototype.DM = ((1<= 0; --i) r[i] = this[i];
- r.t = this.t;
- r.s = this.s;
-}
-
-// (protected) set from integer value x, -DV <= x < DV
-function bnpFromInt(x) {
- this.t = 1;
- this.s = (x<0)?-1:0;
- if(x > 0) this[0] = x;
- else if(x < -1) this[0] = x+this.DV;
- else this.t = 0;
-}
-
-// return bigint initialized to value
-function nbv(i) { var r = nbi(); r.fromInt(i); return r; }
-
-// (protected) set from string and radix
-function bnpFromString(s,b) {
- var k;
- if(b == 16) k = 4;
- else if(b == 8) k = 3;
- else if(b == 256) k = 8; // byte array
- else if(b == 2) k = 1;
- else if(b == 32) k = 5;
- else if(b == 4) k = 2;
- else { this.fromRadix(s,b); return; }
- this.t = 0;
- this.s = 0;
- var i = s.length, mi = false, sh = 0;
- while(--i >= 0) {
- var x = (k==8)?s[i]&0xff:intAt(s,i);
- if(x < 0) {
- if(s.charAt(i) == "-") mi = true;
- continue;
- }
- mi = false;
- if(sh == 0)
- this[this.t++] = x;
- else if(sh+k > this.DB) {
- this[this.t-1] |= (x&((1<<(this.DB-sh))-1))<>(this.DB-sh));
- }
- else
- this[this.t-1] |= x<= this.DB) sh -= this.DB;
- }
- if(k == 8 && (s[0]&0x80) != 0) {
- this.s = -1;
- if(sh > 0) this[this.t-1] |= ((1<<(this.DB-sh))-1)< 0 && this[this.t-1] == c) --this.t;
-}
-
-// (public) return string representation in given radix
-function bnToString(b) {
- if(this.s < 0) return "-"+this.negate().toString(b);
- var k;
- if(b == 16) k = 4;
- else if(b == 8) k = 3;
- else if(b == 2) k = 1;
- else if(b == 32) k = 5;
- else if(b == 4) k = 2;
- else return this.toRadix(b);
- var km = (1< 0) {
- if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }
- while(i >= 0) {
- if(p < k) {
- d = (this[i]&((1<>(p+=this.DB-k);
- }
- else {
- d = (this[i]>>(p-=k))&km;
- if(p <= 0) { p += this.DB; --i; }
- }
- if(d > 0) m = true;
- if(m) r += int2char(d);
- }
- }
- return m?r:"0";
-}
-
-// (public) -this
-function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; }
-
-// (public) |this|
-function bnAbs() { return (this.s<0)?this.negate():this; }
-
-// (public) return + if this > a, - if this < a, 0 if equal
-function bnCompareTo(a) {
- var r = this.s-a.s;
- if(r != 0) return r;
- var i = this.t;
- r = i-a.t;
- if(r != 0) return (this.s<0)?-r:r;
- while(--i >= 0) if((r=this[i]-a[i]) != 0) return r;
- return 0;
-}
-
-// returns bit length of the integer x
-function nbits(x) {
- var r = 1, t;
- if((t=x>>>16) != 0) { x = t; r += 16; }
- if((t=x>>8) != 0) { x = t; r += 8; }
- if((t=x>>4) != 0) { x = t; r += 4; }
- if((t=x>>2) != 0) { x = t; r += 2; }
- if((t=x>>1) != 0) { x = t; r += 1; }
- return r;
-}
-
-// (public) return the number of bits in "this"
-function bnBitLength() {
- if(this.t <= 0) return 0;
- return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM));
-}
-
-// (protected) r = this << n*DB
-function bnpDLShiftTo(n,r) {
- var i;
- for(i = this.t-1; i >= 0; --i) r[i+n] = this[i];
- for(i = n-1; i >= 0; --i) r[i] = 0;
- r.t = this.t+n;
- r.s = this.s;
-}
-
-// (protected) r = this >> n*DB
-function bnpDRShiftTo(n,r) {
- for(var i = n; i < this.t; ++i) r[i-n] = this[i];
- r.t = Math.max(this.t-n,0);
- r.s = this.s;
-}
-
-// (protected) r = this << n
-function bnpLShiftTo(n,r) {
- var bs = n%this.DB;
- var cbs = this.DB-bs;
- var bm = (1<= 0; --i) {
- r[i+ds+1] = (this[i]>>cbs)|c;
- c = (this[i]&bm)<= 0; --i) r[i] = 0;
- r[ds] = c;
- r.t = this.t+ds+1;
- r.s = this.s;
- r.clamp();
-}
-
-// (protected) r = this >> n
-function bnpRShiftTo(n,r) {
- r.s = this.s;
- var ds = Math.floor(n/this.DB);
- if(ds >= this.t) { r.t = 0; return; }
- var bs = n%this.DB;
- var cbs = this.DB-bs;
- var bm = (1<>bs;
- for(var i = ds+1; i < this.t; ++i) {
- r[i-ds-1] |= (this[i]&bm)<>bs;
- }
- if(bs > 0) r[this.t-ds-1] |= (this.s&bm)<>= this.DB;
- }
- if(a.t < this.t) {
- c -= a.s;
- while(i < this.t) {
- c += this[i];
- r[i++] = c&this.DM;
- c >>= this.DB;
- }
- c += this.s;
- }
- else {
- c += this.s;
- while(i < a.t) {
- c -= a[i];
- r[i++] = c&this.DM;
- c >>= this.DB;
- }
- c -= a.s;
- }
- r.s = (c<0)?-1:0;
- if(c < -1) r[i++] = this.DV+c;
- else if(c > 0) r[i++] = c;
- r.t = i;
- r.clamp();
-}
-
-// (protected) r = this * a, r != this,a (HAC 14.12)
-// "this" should be the larger one if appropriate.
-function bnpMultiplyTo(a,r) {
- var x = this.abs(), y = a.abs();
- var i = x.t;
- r.t = i+y.t;
- while(--i >= 0) r[i] = 0;
- for(i = 0; i < y.t; ++i) r[i+x.t] = x.am(0,y[i],r,i,0,x.t);
- r.s = 0;
- r.clamp();
- if(this.s != a.s) BigInteger.ZERO.subTo(r,r);
-}
-
-// (protected) r = this^2, r != this (HAC 14.16)
-function bnpSquareTo(r) {
- var x = this.abs();
- var i = r.t = 2*x.t;
- while(--i >= 0) r[i] = 0;
- for(i = 0; i < x.t-1; ++i) {
- var c = x.am(i,x[i],r,2*i,0,1);
- if((r[i+x.t]+=x.am(i+1,2*x[i],r,2*i+1,c,x.t-i-1)) >= x.DV) {
- r[i+x.t] -= x.DV;
- r[i+x.t+1] = 1;
- }
- }
- if(r.t > 0) r[r.t-1] += x.am(i,x[i],r,2*i,0,1);
- r.s = 0;
- r.clamp();
-}
-
-// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)
-// r != q, this != m. q or r may be null.
-function bnpDivRemTo(m,q,r) {
- var pm = m.abs();
- if(pm.t <= 0) return;
- var pt = this.abs();
- if(pt.t < pm.t) {
- if(q != null) q.fromInt(0);
- if(r != null) this.copyTo(r);
- return;
- }
- if(r == null) r = nbi();
- var y = nbi(), ts = this.s, ms = m.s;
- var nsh = this.DB-nbits(pm[pm.t-1]); // normalize modulus
- if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); }
- else { pm.copyTo(y); pt.copyTo(r); }
- var ys = y.t;
- var y0 = y[ys-1];
- if(y0 == 0) return;
- var yt = y0*(1<1)?y[ys-2]>>this.F2:0);
- var d1 = this.FV/yt, d2 = (1<= 0) {
- r[r.t++] = 1;
- r.subTo(t,r);
- }
- BigInteger.ONE.dlShiftTo(ys,t);
- t.subTo(y,y); // "negative" y so we can replace sub with am later
- while(y.t < ys) y[y.t++] = 0;
- while(--j >= 0) {
- // Estimate quotient digit
- var qd = (r[--i]==y0)?this.DM:Math.floor(r[i]*d1+(r[i-1]+e)*d2);
- if((r[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out
- y.dlShiftTo(j,t);
- r.subTo(t,r);
- while(r[i] < --qd) r.subTo(t,r);
- }
- }
- if(q != null) {
- r.drShiftTo(ys,q);
- if(ts != ms) BigInteger.ZERO.subTo(q,q);
- }
- r.t = ys;
- r.clamp();
- if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder
- if(ts < 0) BigInteger.ZERO.subTo(r,r);
-}
-
-// (public) this mod a
-function bnMod(a) {
- var r = nbi();
- this.abs().divRemTo(a,null,r);
- if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r);
- return r;
-}
-
-// Modular reduction using "classic" algorithm
-function Classic(m) { this.m = m; }
-function cConvert(x) {
- if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m);
- else return x;
-}
-function cRevert(x) { return x; }
-function cReduce(x) { x.divRemTo(this.m,null,x); }
-function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
-function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
-
-Classic.prototype.convert = cConvert;
-Classic.prototype.revert = cRevert;
-Classic.prototype.reduce = cReduce;
-Classic.prototype.mulTo = cMulTo;
-Classic.prototype.sqrTo = cSqrTo;
-
-// (protected) return "-1/this % 2^DB"; useful for Mont. reduction
-// justification:
-// xy == 1 (mod m)
-// xy = 1+km
-// xy(2-xy) = (1+km)(1-km)
-// x[y(2-xy)] = 1-k^2m^2
-// x[y(2-xy)] == 1 (mod m^2)
-// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2
-// should reduce x and y(2-xy) by m^2 at each step to keep size bounded.
-// JS multiply "overflows" differently from C/C++, so care is needed here.
-function bnpInvDigit() {
- if(this.t < 1) return 0;
- var x = this[0];
- if((x&1) == 0) return 0;
- var y = x&3; // y == 1/x mod 2^2
- y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4
- y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8
- y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16
- // last step - calculate inverse mod DV directly;
- // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints
- y = (y*(2-x*y%this.DV))%this.DV; // y == 1/x mod 2^dbits
- // we really want the negative inverse, and -DV < y < DV
- return (y>0)?this.DV-y:-y;
-}
-
-// Montgomery reduction
-function Montgomery(m) {
- this.m = m;
- this.mp = m.invDigit();
- this.mpl = this.mp&0x7fff;
- this.mph = this.mp>>15;
- this.um = (1<<(m.DB-15))-1;
- this.mt2 = 2*m.t;
-}
-
-// xR mod m
-function montConvert(x) {
- var r = nbi();
- x.abs().dlShiftTo(this.m.t,r);
- r.divRemTo(this.m,null,r);
- if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r);
- return r;
-}
-
-// x/R mod m
-function montRevert(x) {
- var r = nbi();
- x.copyTo(r);
- this.reduce(r);
- return r;
-}
-
-// x = x/R mod m (HAC 14.32)
-function montReduce(x) {
- while(x.t <= this.mt2) // pad x so am has enough room later
- x[x.t++] = 0;
- for(var i = 0; i < this.m.t; ++i) {
- // faster way of calculating u0 = x[i]*mp mod DV
- var j = x[i]&0x7fff;
- var u0 = (j*this.mpl+(((j*this.mph+(x[i]>>15)*this.mpl)&this.um)<<15))&x.DM;
- // use am to combine the multiply-shift-add into one call
- j = i+this.m.t;
- x[j] += this.m.am(0,u0,x,i,0,this.m.t);
- // propagate carry
- while(x[j] >= x.DV) { x[j] -= x.DV; x[++j]++; }
- }
- x.clamp();
- x.drShiftTo(this.m.t,x);
- if(x.compareTo(this.m) >= 0) x.subTo(this.m,x);
-}
-
-// r = "x^2/R mod m"; x != r
-function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
-
-// r = "xy/R mod m"; x,y != r
-function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
-
-Montgomery.prototype.convert = montConvert;
-Montgomery.prototype.revert = montRevert;
-Montgomery.prototype.reduce = montReduce;
-Montgomery.prototype.mulTo = montMulTo;
-Montgomery.prototype.sqrTo = montSqrTo;
-
-// (protected) true iff this is even
-function bnpIsEven() { return ((this.t>0)?(this[0]&1):this.s) == 0; }
-
-// (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
-function bnpExp(e,z) {
- if(e > 0xffffffff || e < 1) return BigInteger.ONE;
- var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1;
- g.copyTo(r);
- while(--i >= 0) {
- z.sqrTo(r,r2);
- if((e&(1< 0) z.mulTo(r2,g,r);
- else { var t = r; r = r2; r2 = t; }
- }
- return z.revert(r);
-}
-
-// (public) this^e % m, 0 <= e < 2^32
-function bnModPowInt(e,m) {
- var z;
- if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m);
- return this.exp(e,z);
-}
-
-// protected
-BigInteger.prototype.copyTo = bnpCopyTo;
-BigInteger.prototype.fromInt = bnpFromInt;
-BigInteger.prototype.fromString = bnpFromString;
-BigInteger.prototype.clamp = bnpClamp;
-BigInteger.prototype.dlShiftTo = bnpDLShiftTo;
-BigInteger.prototype.drShiftTo = bnpDRShiftTo;
-BigInteger.prototype.lShiftTo = bnpLShiftTo;
-BigInteger.prototype.rShiftTo = bnpRShiftTo;
-BigInteger.prototype.subTo = bnpSubTo;
-BigInteger.prototype.multiplyTo = bnpMultiplyTo;
-BigInteger.prototype.squareTo = bnpSquareTo;
-BigInteger.prototype.divRemTo = bnpDivRemTo;
-BigInteger.prototype.invDigit = bnpInvDigit;
-BigInteger.prototype.isEven = bnpIsEven;
-BigInteger.prototype.exp = bnpExp;
-
-// public
-BigInteger.prototype.toString = bnToString;
-BigInteger.prototype.negate = bnNegate;
-BigInteger.prototype.abs = bnAbs;
-BigInteger.prototype.compareTo = bnCompareTo;
-BigInteger.prototype.bitLength = bnBitLength;
-BigInteger.prototype.mod = bnMod;
-BigInteger.prototype.modPowInt = bnModPowInt;
-
-// "constants"
-BigInteger.ZERO = nbv(0);
-BigInteger.ONE = nbv(1);
diff --git a/jwt/ext/jsbn2-min.js b/jwt/ext/jsbn2-min.js
deleted file mode 100755
index 86a687e..0000000
--- a/jwt/ext/jsbn2-min.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
- */
-function bnClone(){var a=nbi();this.copyTo(a);return a}function bnIntValue(){if(this.s<0){if(this.t==1){return this[0]-this.DV}else{if(this.t==0){return -1}}}else{if(this.t==1){return this[0]}else{if(this.t==0){return 0}}}return((this[1]&((1<<(32-this.DB))-1))<>24}function bnShortValue(){return(this.t==0)?this.s:(this[0]<<16)>>16}function bnpChunkSize(a){return Math.floor(Math.LN2*this.DB/Math.log(a))}function bnSigNum(){if(this.s<0){return -1}else{if(this.t<=0||(this.t==1&&this[0]<=0)){return 0}else{return 1}}}function bnpToRadix(c){if(c==null){c=10}if(this.signum()==0||c<2||c>36){return"0"}var f=this.chunkSize(c);var e=Math.pow(c,f);var i=nbv(e),j=nbi(),h=nbi(),g="";this.divRemTo(i,j,h);while(j.signum()>0){g=(e+h.intValue()).toString(c).substr(1)+g;j.divRemTo(i,j,h)}return h.intValue().toString(c)+g}function bnpFromRadix(m,h){this.fromInt(0);if(h==null){h=10}var f=this.chunkSize(h);var g=Math.pow(h,f),e=false,a=0,l=0;for(var c=0;c=f){this.dMultiply(g);this.dAddOffset(l,0);a=0;l=0}}if(a>0){this.dMultiply(Math.pow(h,a));this.dAddOffset(l,0)}if(e){BigInteger.ZERO.subTo(this,this)}}function bnpFromNumber(f,e,h){if("number"==typeof e){if(f<2){this.fromInt(1)}else{this.fromNumber(f,h);if(!this.testBit(f-1)){this.bitwiseTo(BigInteger.ONE.shiftLeft(f-1),op_or,this)}if(this.isEven()){this.dAddOffset(1,0)}while(!this.isProbablePrime(e)){this.dAddOffset(2,0);if(this.bitLength()>f){this.subTo(BigInteger.ONE.shiftLeft(f-1),this)}}}}else{var d=new Array(),g=f&7;d.length=(f>>3)+1;e.nextBytes(d);if(g>0){d[0]&=((1<0){if(e>e)!=(this.s&this.DM)>>e){c[a++]=f|(this.s<<(this.DB-e))}while(b>=0){if(e<8){f=(this[b]&((1<>(e+=this.DB-8)}else{f=(this[b]>>(e-=8))&255;if(e<=0){e+=this.DB;--b}}if((f&128)!=0){f|=-256}if(a==0&&(this.s&128)!=(f&128)){++a}if(a>0||f!=this.s){c[a++]=f}}}return c}function bnEquals(b){return(this.compareTo(b)==0)}function bnMin(b){return(this.compareTo(b)<0)?this:b}function bnMax(b){return(this.compareTo(b)>0)?this:b}function bnpBitwiseTo(c,h,e){var d,g,b=Math.min(c.t,this.t);for(d=0;d>=16;b+=16}if((a&255)==0){a>>=8;b+=8}if((a&15)==0){a>>=4;b+=4}if((a&3)==0){a>>=2;b+=2}if((a&1)==0){++b}return b}function bnGetLowestSetBit(){for(var a=0;a=this.t){return(this.s!=0)}return((this[a]&(1<<(b%this.DB)))!=0)}function bnpChangeBit(c,b){var a=BigInteger.ONE.shiftLeft(c);this.bitwiseTo(a,b,a);return a}function bnSetBit(a){return this.changeBit(a,op_or)}function bnClearBit(a){return this.changeBit(a,op_andnot)}function bnFlipBit(a){return this.changeBit(a,op_xor)}function bnpAddTo(d,f){var e=0,g=0,b=Math.min(d.t,this.t);while(e>=this.DB}if(d.t>=this.DB}g+=this.s}else{g+=this.s;while(e>=this.DB}g+=d.s}f.s=(g<0)?-1:0;if(g>0){f[e++]=g}else{if(g<-1){f[e++]=this.DV+g}}f.t=e;f.clamp()}function bnAdd(b){var c=nbi();this.addTo(b,c);return c}function bnSubtract(b){var c=nbi();this.subTo(b,c);return c}function bnMultiply(b){var c=nbi();this.multiplyTo(b,c);return c}function bnSquare(){var a=nbi();this.squareTo(a);return a}function bnDivide(b){var c=nbi();this.divRemTo(b,c,null);return c}function bnRemainder(b){var c=nbi();this.divRemTo(b,null,c);return c}function bnDivideAndRemainder(b){var d=nbi(),c=nbi();this.divRemTo(b,d,c);return new Array(d,c)}function bnpDMultiply(a){this[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()}function bnpDAddOffset(b,a){if(b==0){return}while(this.t<=a){this[this.t++]=0}this[a]+=b;while(this[a]>=this.DV){this[a]-=this.DV;if(++a>=this.t){this[this.t++]=0}++this[a]}}function NullExp(){}function nNop(a){return a}function nMulTo(a,c,b){a.multiplyTo(c,b)}function nSqrTo(a,b){a.squareTo(b)}NullExp.prototype.convert=nNop;NullExp.prototype.revert=nNop;NullExp.prototype.mulTo=nMulTo;NullExp.prototype.sqrTo=nSqrTo;function bnPow(a){return this.exp(a,new NullExp())}function bnpMultiplyLowerTo(b,f,e){var d=Math.min(this.t+b.t,f);e.s=0;e.t=d;while(d>0){e[--d]=0}var c;for(c=e.t-this.t;d=0){d[c]=0}for(c=Math.max(e-this.t,0);c2*this.m.t){return a.mod(this.m)}else{if(a.compareTo(this.m)<0){return a}else{var b=nbi();a.copyTo(b);this.reduce(b);return b}}}function barrettRevert(a){return a}function barrettReduce(a){a.drShiftTo(this.m.t-1,this.r2);if(a.t>this.m.t+1){a.t=this.m.t+1;a.clamp()}this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);while(a.compareTo(this.r2)<0){a.dAddOffset(1,this.m.t+1)}a.subTo(this.r2,a);while(a.compareTo(this.m)>=0){a.subTo(this.m,a)}}function barrettSqrTo(a,b){a.squareTo(b);this.reduce(b)}function barrettMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}Barrett.prototype.convert=barrettConvert;Barrett.prototype.revert=barrettRevert;Barrett.prototype.reduce=barrettReduce;Barrett.prototype.mulTo=barrettMulTo;Barrett.prototype.sqrTo=barrettSqrTo;function bnModPow(q,f){var o=q.bitLength(),h,b=nbv(1),v;if(o<=0){return b}else{if(o<18){h=1}else{if(o<48){h=3}else{if(o<144){h=4}else{if(o<768){h=5}else{h=6}}}}}if(o<8){v=new Classic(f)}else{if(f.isEven()){v=new Barrett(f)}else{v=new Montgomery(f)}}var p=new Array(),d=3,s=h-1,a=(1<1){var A=nbi();v.sqrTo(p[1],A);while(d<=a){p[d]=nbi();v.mulTo(A,p[d-2],p[d]);d+=2}}var l=q.t-1,x,u=true,c=nbi(),y;o=nbits(q[l])-1;while(l>=0){if(o>=s){x=(q[l]>>(o-s))&a}else{x=(q[l]&((1<<(o+1))-1))<<(s-o);if(l>0){x|=q[l-1]>>(this.DB+o-s)}}d=h;while((x&1)==0){x>>=1;--d}if((o-=d)<0){o+=this.DB;--l}if(u){p[x].copyTo(b);u=false}else{while(d>1){v.sqrTo(b,c);v.sqrTo(c,b);d-=2}if(d>0){v.sqrTo(b,c)}else{y=b;b=c;c=y}v.mulTo(c,p[x],b)}while(l>=0&&(q[l]&(1<0){b.rShiftTo(f,b);h.rShiftTo(f,h)}while(b.signum()>0){if((d=b.getLowestSetBit())>0){b.rShiftTo(d,b)}if((d=h.getLowestSetBit())>0){h.rShiftTo(d,h)}if(b.compareTo(h)>=0){b.subTo(h,b);b.rShiftTo(1,b)}else{h.subTo(b,h);h.rShiftTo(1,h)}}if(f>0){h.lShiftTo(f,h)}return h}function bnpModInt(e){if(e<=0){return 0}var c=this.DV%e,b=(this.s<0)?e-1:0;if(this.t>0){if(c==0){b=this[0]%e}else{for(var a=this.t-1;a>=0;--a){b=(c*b+this[a])%e}}}return b}function bnModInverse(f){var j=f.isEven();if((this.isEven()&&j)||f.signum()==0){return BigInteger.ZERO}var i=f.clone(),h=this.clone();var g=nbv(1),e=nbv(0),l=nbv(0),k=nbv(1);while(i.signum()!=0){while(i.isEven()){i.rShiftTo(1,i);if(j){if(!g.isEven()||!e.isEven()){g.addTo(this,g);e.subTo(f,e)}g.rShiftTo(1,g)}else{if(!e.isEven()){e.subTo(f,e)}}e.rShiftTo(1,e)}while(h.isEven()){h.rShiftTo(1,h);if(j){if(!l.isEven()||!k.isEven()){l.addTo(this,l);k.subTo(f,k)}l.rShiftTo(1,l)}else{if(!k.isEven()){k.subTo(f,k)}}k.rShiftTo(1,k)}if(i.compareTo(h)>=0){i.subTo(h,i);if(j){g.subTo(l,g)}e.subTo(k,e)}else{h.subTo(i,h);if(j){l.subTo(g,l)}k.subTo(e,k)}}if(h.compareTo(BigInteger.ONE)!=0){return BigInteger.ZERO}if(k.compareTo(f)>=0){return k.subtract(f)}if(k.signum()<0){k.addTo(f,k)}else{return k}if(k.signum()<0){return k.add(f)}else{return k}}var lowprimes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997];var lplim=(1<<26)/lowprimes[lowprimes.length-1];function bnIsProbablePrime(e){var d,b=this.abs();if(b.t==1&&b[0]<=lowprimes[lowprimes.length-1]){for(d=0;d>1;if(f>lowprimes.length){f=lowprimes.length}var b=nbi();for(var e=0;e>24; }
-
-// (public) return value as short (assumes DB>=16)
-function bnShortValue() { return (this.t==0)?this.s:(this[0]<<16)>>16; }
-
-// (protected) return x s.t. r^x < DV
-function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); }
-
-// (public) 0 if this == 0, 1 if this > 0
-function bnSigNum() {
- if(this.s < 0) return -1;
- else if(this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0;
- else return 1;
-}
-
-// (protected) convert to radix string
-function bnpToRadix(b) {
- if(b == null) b = 10;
- if(this.signum() == 0 || b < 2 || b > 36) return "0";
- var cs = this.chunkSize(b);
- var a = Math.pow(b,cs);
- var d = nbv(a), y = nbi(), z = nbi(), r = "";
- this.divRemTo(d,y,z);
- while(y.signum() > 0) {
- r = (a+z.intValue()).toString(b).substr(1) + r;
- y.divRemTo(d,y,z);
- }
- return z.intValue().toString(b) + r;
-}
-
-// (protected) convert from radix string
-function bnpFromRadix(s,b) {
- this.fromInt(0);
- if(b == null) b = 10;
- var cs = this.chunkSize(b);
- var d = Math.pow(b,cs), mi = false, j = 0, w = 0;
- for(var i = 0; i < s.length; ++i) {
- var x = intAt(s,i);
- if(x < 0) {
- if(s.charAt(i) == "-" && this.signum() == 0) mi = true;
- continue;
- }
- w = b*w+x;
- if(++j >= cs) {
- this.dMultiply(d);
- this.dAddOffset(w,0);
- j = 0;
- w = 0;
- }
- }
- if(j > 0) {
- this.dMultiply(Math.pow(b,j));
- this.dAddOffset(w,0);
- }
- if(mi) BigInteger.ZERO.subTo(this,this);
-}
-
-// (protected) alternate constructor
-function bnpFromNumber(a,b,c) {
- if("number" == typeof b) {
- // new BigInteger(int,int,RNG)
- if(a < 2) this.fromInt(1);
- else {
- this.fromNumber(a,c);
- if(!this.testBit(a-1)) // force MSB set
- this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this);
- if(this.isEven()) this.dAddOffset(1,0); // force odd
- while(!this.isProbablePrime(b)) {
- this.dAddOffset(2,0);
- if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this);
- }
- }
- }
- else {
- // new BigInteger(int,RNG)
- var x = new Array(), t = a&7;
- x.length = (a>>3)+1;
- b.nextBytes(x);
- if(t > 0) x[0] &= ((1< 0) {
- if(p < this.DB && (d = this[i]>>p) != (this.s&this.DM)>>p)
- r[k++] = d|(this.s<<(this.DB-p));
- while(i >= 0) {
- if(p < 8) {
- d = (this[i]&((1<>(p+=this.DB-8);
- }
- else {
- d = (this[i]>>(p-=8))&0xff;
- if(p <= 0) { p += this.DB; --i; }
- }
- if((d&0x80) != 0) d |= -256;
- if(k == 0 && (this.s&0x80) != (d&0x80)) ++k;
- if(k > 0 || d != this.s) r[k++] = d;
- }
- }
- return r;
-}
-
-function bnEquals(a) { return(this.compareTo(a)==0); }
-function bnMin(a) { return(this.compareTo(a)<0)?this:a; }
-function bnMax(a) { return(this.compareTo(a)>0)?this:a; }
-
-// (protected) r = this op a (bitwise)
-function bnpBitwiseTo(a,op,r) {
- var i, f, m = Math.min(a.t,this.t);
- for(i = 0; i < m; ++i) r[i] = op(this[i],a[i]);
- if(a.t < this.t) {
- f = a.s&this.DM;
- for(i = m; i < this.t; ++i) r[i] = op(this[i],f);
- r.t = this.t;
- }
- else {
- f = this.s&this.DM;
- for(i = m; i < a.t; ++i) r[i] = op(f,a[i]);
- r.t = a.t;
- }
- r.s = op(this.s,a.s);
- r.clamp();
-}
-
-// (public) this & a
-function op_and(x,y) { return x&y; }
-function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; }
-
-// (public) this | a
-function op_or(x,y) { return x|y; }
-function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; }
-
-// (public) this ^ a
-function op_xor(x,y) { return x^y; }
-function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; }
-
-// (public) this & ~a
-function op_andnot(x,y) { return x&~y; }
-function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; }
-
-// (public) ~this
-function bnNot() {
- var r = nbi();
- for(var i = 0; i < this.t; ++i) r[i] = this.DM&~this[i];
- r.t = this.t;
- r.s = ~this.s;
- return r;
-}
-
-// (public) this << n
-function bnShiftLeft(n) {
- var r = nbi();
- if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r);
- return r;
-}
-
-// (public) this >> n
-function bnShiftRight(n) {
- var r = nbi();
- if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r);
- return r;
-}
-
-// return index of lowest 1-bit in x, x < 2^31
-function lbit(x) {
- if(x == 0) return -1;
- var r = 0;
- if((x&0xffff) == 0) { x >>= 16; r += 16; }
- if((x&0xff) == 0) { x >>= 8; r += 8; }
- if((x&0xf) == 0) { x >>= 4; r += 4; }
- if((x&3) == 0) { x >>= 2; r += 2; }
- if((x&1) == 0) ++r;
- return r;
-}
-
-// (public) returns index of lowest 1-bit (or -1 if none)
-function bnGetLowestSetBit() {
- for(var i = 0; i < this.t; ++i)
- if(this[i] != 0) return i*this.DB+lbit(this[i]);
- if(this.s < 0) return this.t*this.DB;
- return -1;
-}
-
-// return number of 1 bits in x
-function cbit(x) {
- var r = 0;
- while(x != 0) { x &= x-1; ++r; }
- return r;
-}
-
-// (public) return number of set bits
-function bnBitCount() {
- var r = 0, x = this.s&this.DM;
- for(var i = 0; i < this.t; ++i) r += cbit(this[i]^x);
- return r;
-}
-
-// (public) true iff nth bit is set
-function bnTestBit(n) {
- var j = Math.floor(n/this.DB);
- if(j >= this.t) return(this.s!=0);
- return((this[j]&(1<<(n%this.DB)))!=0);
-}
-
-// (protected) this op (1<>= this.DB;
- }
- if(a.t < this.t) {
- c += a.s;
- while(i < this.t) {
- c += this[i];
- r[i++] = c&this.DM;
- c >>= this.DB;
- }
- c += this.s;
- }
- else {
- c += this.s;
- while(i < a.t) {
- c += a[i];
- r[i++] = c&this.DM;
- c >>= this.DB;
- }
- c += a.s;
- }
- r.s = (c<0)?-1:0;
- if(c > 0) r[i++] = c;
- else if(c < -1) r[i++] = this.DV+c;
- r.t = i;
- r.clamp();
-}
-
-// (public) this + a
-function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; }
-
-// (public) this - a
-function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; }
-
-// (public) this * a
-function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; }
-
-// (public) this^2
-function bnSquare() { var r = nbi(); this.squareTo(r); return r; }
-
-// (public) this / a
-function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }
-
-// (public) this % a
-function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; }
-
-// (public) [this/a,this%a]
-function bnDivideAndRemainder(a) {
- var q = nbi(), r = nbi();
- this.divRemTo(a,q,r);
- return new Array(q,r);
-}
-
-// (protected) this *= n, this >= 0, 1 < n < DV
-function bnpDMultiply(n) {
- this[this.t] = this.am(0,n-1,this,0,0,this.t);
- ++this.t;
- this.clamp();
-}
-
-// (protected) this += n << w words, this >= 0
-function bnpDAddOffset(n,w) {
- if(n == 0) return;
- while(this.t <= w) this[this.t++] = 0;
- this[w] += n;
- while(this[w] >= this.DV) {
- this[w] -= this.DV;
- if(++w >= this.t) this[this.t++] = 0;
- ++this[w];
- }
-}
-
-// A "null" reducer
-function NullExp() {}
-function nNop(x) { return x; }
-function nMulTo(x,y,r) { x.multiplyTo(y,r); }
-function nSqrTo(x,r) { x.squareTo(r); }
-
-NullExp.prototype.convert = nNop;
-NullExp.prototype.revert = nNop;
-NullExp.prototype.mulTo = nMulTo;
-NullExp.prototype.sqrTo = nSqrTo;
-
-// (public) this^e
-function bnPow(e) { return this.exp(e,new NullExp()); }
-
-// (protected) r = lower n words of "this * a", a.t <= n
-// "this" should be the larger one if appropriate.
-function bnpMultiplyLowerTo(a,n,r) {
- var i = Math.min(this.t+a.t,n);
- r.s = 0; // assumes a,this >= 0
- r.t = i;
- while(i > 0) r[--i] = 0;
- var j;
- for(j = r.t-this.t; i < j; ++i) r[i+this.t] = this.am(0,a[i],r,i,0,this.t);
- for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a[i],r,i,0,n-i);
- r.clamp();
-}
-
-// (protected) r = "this * a" without lower n words, n > 0
-// "this" should be the larger one if appropriate.
-function bnpMultiplyUpperTo(a,n,r) {
- --n;
- var i = r.t = this.t+a.t-n;
- r.s = 0; // assumes a,this >= 0
- while(--i >= 0) r[i] = 0;
- for(i = Math.max(n-this.t,0); i < a.t; ++i)
- r[this.t+i-n] = this.am(n-i,a[i],r,0,0,this.t+i-n);
- r.clamp();
- r.drShiftTo(1,r);
-}
-
-// Barrett modular reduction
-function Barrett(m) {
- // setup Barrett
- this.r2 = nbi();
- this.q3 = nbi();
- BigInteger.ONE.dlShiftTo(2*m.t,this.r2);
- this.mu = this.r2.divide(m);
- this.m = m;
-}
-
-function barrettConvert(x) {
- if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m);
- else if(x.compareTo(this.m) < 0) return x;
- else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; }
-}
-
-function barrettRevert(x) { return x; }
-
-// x = x mod m (HAC 14.42)
-function barrettReduce(x) {
- x.drShiftTo(this.m.t-1,this.r2);
- if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); }
- this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);
- this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);
- while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1);
- x.subTo(this.r2,x);
- while(x.compareTo(this.m) >= 0) x.subTo(this.m,x);
-}
-
-// r = x^2 mod m; x != r
-function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
-
-// r = x*y mod m; x,y != r
-function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
-
-Barrett.prototype.convert = barrettConvert;
-Barrett.prototype.revert = barrettRevert;
-Barrett.prototype.reduce = barrettReduce;
-Barrett.prototype.mulTo = barrettMulTo;
-Barrett.prototype.sqrTo = barrettSqrTo;
-
-// (public) this^e % m (HAC 14.85)
-function bnModPow(e,m) {
- var i = e.bitLength(), k, r = nbv(1), z;
- if(i <= 0) return r;
- else if(i < 18) k = 1;
- else if(i < 48) k = 3;
- else if(i < 144) k = 4;
- else if(i < 768) k = 5;
- else k = 6;
- if(i < 8)
- z = new Classic(m);
- else if(m.isEven())
- z = new Barrett(m);
- else
- z = new Montgomery(m);
-
- // precomputation
- var g = new Array(), n = 3, k1 = k-1, km = (1< 1) {
- var g2 = nbi();
- z.sqrTo(g[1],g2);
- while(n <= km) {
- g[n] = nbi();
- z.mulTo(g2,g[n-2],g[n]);
- n += 2;
- }
- }
-
- var j = e.t-1, w, is1 = true, r2 = nbi(), t;
- i = nbits(e[j])-1;
- while(j >= 0) {
- if(i >= k1) w = (e[j]>>(i-k1))&km;
- else {
- w = (e[j]&((1<<(i+1))-1))<<(k1-i);
- if(j > 0) w |= e[j-1]>>(this.DB+i-k1);
- }
-
- n = k;
- while((w&1) == 0) { w >>= 1; --n; }
- if((i -= n) < 0) { i += this.DB; --j; }
- if(is1) { // ret == 1, don't bother squaring or multiplying it
- g[w].copyTo(r);
- is1 = false;
- }
- else {
- while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; }
- if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; }
- z.mulTo(r2,g[w],r);
- }
-
- while(j >= 0 && (e[j]&(1< 0) {
- x.rShiftTo(g,x);
- y.rShiftTo(g,y);
- }
- while(x.signum() > 0) {
- if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x);
- if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y);
- if(x.compareTo(y) >= 0) {
- x.subTo(y,x);
- x.rShiftTo(1,x);
- }
- else {
- y.subTo(x,y);
- y.rShiftTo(1,y);
- }
- }
- if(g > 0) y.lShiftTo(g,y);
- return y;
-}
-
-// (protected) this % n, n < 2^26
-function bnpModInt(n) {
- if(n <= 0) return 0;
- var d = this.DV%n, r = (this.s<0)?n-1:0;
- if(this.t > 0)
- if(d == 0) r = this[0]%n;
- else for(var i = this.t-1; i >= 0; --i) r = (d*r+this[i])%n;
- return r;
-}
-
-// (public) 1/this % m (HAC 14.61)
-function bnModInverse(m) {
- var ac = m.isEven();
- if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO;
- var u = m.clone(), v = this.clone();
- var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1);
- while(u.signum() != 0) {
- while(u.isEven()) {
- u.rShiftTo(1,u);
- if(ac) {
- if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); }
- a.rShiftTo(1,a);
- }
- else if(!b.isEven()) b.subTo(m,b);
- b.rShiftTo(1,b);
- }
- while(v.isEven()) {
- v.rShiftTo(1,v);
- if(ac) {
- if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); }
- c.rShiftTo(1,c);
- }
- else if(!d.isEven()) d.subTo(m,d);
- d.rShiftTo(1,d);
- }
- if(u.compareTo(v) >= 0) {
- u.subTo(v,u);
- if(ac) a.subTo(c,a);
- b.subTo(d,b);
- }
- else {
- v.subTo(u,v);
- if(ac) c.subTo(a,c);
- d.subTo(b,d);
- }
- }
- if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO;
- if(d.compareTo(m) >= 0) return d.subtract(m);
- if(d.signum() < 0) d.addTo(m,d); else return d;
- if(d.signum() < 0) return d.add(m); else return d;
-}
-
-var lowprimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997];
-var lplim = (1<<26)/lowprimes[lowprimes.length-1];
-
-// (public) test primality with certainty >= 1-.5^t
-function bnIsProbablePrime(t) {
- var i, x = this.abs();
- if(x.t == 1 && x[0] <= lowprimes[lowprimes.length-1]) {
- for(i = 0; i < lowprimes.length; ++i)
- if(x[0] == lowprimes[i]) return true;
- return false;
- }
- if(x.isEven()) return false;
- i = 1;
- while(i < lowprimes.length) {
- var m = lowprimes[i], j = i+1;
- while(j < lowprimes.length && m < lplim) m *= lowprimes[j++];
- m = x.modInt(m);
- while(i < j) if(m%lowprimes[i++] == 0) return false;
- }
- return x.millerRabin(t);
-}
-
-// (protected) true if probably prime (HAC 4.24, Miller-Rabin)
-function bnpMillerRabin(t) {
- var n1 = this.subtract(BigInteger.ONE);
- var k = n1.getLowestSetBit();
- if(k <= 0) return false;
- var r = n1.shiftRight(k);
- t = (t+1)>>1;
- if(t > lowprimes.length) t = lowprimes.length;
- var a = nbi();
- for(var i = 0; i < t; ++i) {
- //Pick bases at random, instead of starting at 2
- a.fromInt(lowprimes[Math.floor(Math.random()*lowprimes.length)]);
- var y = a.modPow(r,this);
- if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {
- var j = 1;
- while(j++ < k && y.compareTo(n1) != 0) {
- y = y.modPowInt(2,this);
- if(y.compareTo(BigInteger.ONE) == 0) return false;
- }
- if(y.compareTo(n1) != 0) return false;
- }
- }
- return true;
-}
-
-// protected
-BigInteger.prototype.chunkSize = bnpChunkSize;
-BigInteger.prototype.toRadix = bnpToRadix;
-BigInteger.prototype.fromRadix = bnpFromRadix;
-BigInteger.prototype.fromNumber = bnpFromNumber;
-BigInteger.prototype.bitwiseTo = bnpBitwiseTo;
-BigInteger.prototype.changeBit = bnpChangeBit;
-BigInteger.prototype.addTo = bnpAddTo;
-BigInteger.prototype.dMultiply = bnpDMultiply;
-BigInteger.prototype.dAddOffset = bnpDAddOffset;
-BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo;
-BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo;
-BigInteger.prototype.modInt = bnpModInt;
-BigInteger.prototype.millerRabin = bnpMillerRabin;
-
-// public
-BigInteger.prototype.clone = bnClone;
-BigInteger.prototype.intValue = bnIntValue;
-BigInteger.prototype.byteValue = bnByteValue;
-BigInteger.prototype.shortValue = bnShortValue;
-BigInteger.prototype.signum = bnSigNum;
-BigInteger.prototype.toByteArray = bnToByteArray;
-BigInteger.prototype.equals = bnEquals;
-BigInteger.prototype.min = bnMin;
-BigInteger.prototype.max = bnMax;
-BigInteger.prototype.and = bnAnd;
-BigInteger.prototype.or = bnOr;
-BigInteger.prototype.xor = bnXor;
-BigInteger.prototype.andNot = bnAndNot;
-BigInteger.prototype.not = bnNot;
-BigInteger.prototype.shiftLeft = bnShiftLeft;
-BigInteger.prototype.shiftRight = bnShiftRight;
-BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit;
-BigInteger.prototype.bitCount = bnBitCount;
-BigInteger.prototype.testBit = bnTestBit;
-BigInteger.prototype.setBit = bnSetBit;
-BigInteger.prototype.clearBit = bnClearBit;
-BigInteger.prototype.flipBit = bnFlipBit;
-BigInteger.prototype.add = bnAdd;
-BigInteger.prototype.subtract = bnSubtract;
-BigInteger.prototype.multiply = bnMultiply;
-BigInteger.prototype.divide = bnDivide;
-BigInteger.prototype.remainder = bnRemainder;
-BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder;
-BigInteger.prototype.modPow = bnModPow;
-BigInteger.prototype.modInverse = bnModInverse;
-BigInteger.prototype.pow = bnPow;
-BigInteger.prototype.gcd = bnGCD;
-BigInteger.prototype.isProbablePrime = bnIsProbablePrime;
-
-// JSBN-specific extension
-BigInteger.prototype.square = bnSquare;
-
-// BigInteger interfaces not implemented in jsbn:
-
-// BigInteger(int signum, byte[] magnitude)
-// double doubleValue()
-// float floatValue()
-// int hashCode()
-// long longValue()
-// static BigInteger valueOf(long val)
diff --git a/jwt/ext/json-sans-eval-min.js b/jwt/ext/json-sans-eval-min.js
deleted file mode 100755
index 23f7a9c..0000000
--- a/jwt/ext/json-sans-eval-min.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval
- */
-var jsonParse=(function(){var e="(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)";var j='(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))';var i='(?:"'+j+'*")';var d=new RegExp("(?:false|true|null|[\\{\\}\\[\\]]|"+e+"|"+i+")","g");var k=new RegExp("\\\\(?:([^u])|u(.{4}))","g");var g={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function h(l,m,n){return m?g[m]:String.fromCharCode(parseInt(n,16))}var c=new String("");var a="\\";var f={"{":Object,"[":Array};var b=Object.hasOwnProperty;return function(u,q){var p=u.match(d);var x;var v=p[0];var l=false;if("{"===v){x={}}else{if("["===v){x=[]}else{x=[];l=true}}var t;var r=[x];for(var o=1-l,m=p.length;o=0;){delete D[n[A]]}}}return q.call(C,B,D)};x=s({"":x},"")}return x}})();
\ No newline at end of file
diff --git a/jwt/ext/json-sans-eval.js b/jwt/ext/json-sans-eval.js
deleted file mode 100755
index dd5df4b..0000000
--- a/jwt/ext/json-sans-eval.js
+++ /dev/null
@@ -1,240 +0,0 @@
-/*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval
- */
-// This source code is free for use in the public domain.
-// NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
-
-// http://code.google.com/p/json-sans-eval/
-
-/**
- * Parses a string of well-formed JSON text.
- *
- * If the input is not well-formed, then behavior is undefined, but it is
- * deterministic and is guaranteed not to modify any object other than its
- * return value.
- *
- * This does not use `eval` so is less likely to have obscure security bugs than
- * json2.js.
- * It is optimized for speed, so is much faster than json_parse.js.
- *
- * This library should be used whenever security is a concern (when JSON may
- * come from an untrusted source), speed is a concern, and erroring on malformed
- * JSON is *not* a concern.
- *
- * Pros Cons
- * +-----------------------+-----------------------+
- * json_sans_eval.js | Fast, secure | Not validating |
- * +-----------------------+-----------------------+
- * json_parse.js | Validating, secure | Slow |
- * +-----------------------+-----------------------+
- * json2.js | Fast, some validation | Potentially insecure |
- * +-----------------------+-----------------------+
- *
- * json2.js is very fast, but potentially insecure since it calls `eval` to
- * parse JSON data, so an attacker might be able to supply strange JS that
- * looks like JSON, but that executes arbitrary javascript.
- * If you do have to use json2.js with untrusted data, make sure you keep
- * your version of json2.js up to date so that you get patches as they're
- * released.
- *
- * @param {string} json per RFC 4627
- * @param {function (this:Object, string, *):*} opt_reviver optional function
- * that reworks JSON objects post-parse per Chapter 15.12 of EcmaScript3.1.
- * If supplied, the function is called with a string key, and a value.
- * The value is the property of 'this'. The reviver should return
- * the value to use in its place. So if dates were serialized as
- * {@code { "type": "Date", "time": 1234 }}, then a reviver might look like
- * {@code
- * function (key, value) {
- * if (value && typeof value === 'object' && 'Date' === value.type) {
- * return new Date(value.time);
- * } else {
- * return value;
- * }
- * }}.
- * If the reviver returns {@code undefined} then the property named by key
- * will be deleted from its container.
- * {@code this} is bound to the object containing the specified property.
- * @return {Object|Array}
- * @author Mike Samuel
- */
-var jsonParse = (function () {
- var number
- = '(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)';
- var oneChar = '(?:[^\\0-\\x08\\x0a-\\x1f\"\\\\]'
- + '|\\\\(?:[\"/\\\\bfnrt]|u[0-9A-Fa-f]{4}))';
- var string = '(?:\"' + oneChar + '*\")';
-
- // Will match a value in a well-formed JSON file.
- // If the input is not well-formed, may match strangely, but not in an unsafe
- // way.
- // Since this only matches value tokens, it does not match whitespace, colons,
- // or commas.
- var jsonToken = new RegExp(
- '(?:false|true|null|[\\{\\}\\[\\]]'
- + '|' + number
- + '|' + string
- + ')', 'g');
-
- // Matches escape sequences in a string literal
- var escapeSequence = new RegExp('\\\\(?:([^u])|u(.{4}))', 'g');
-
- // Decodes escape sequences in object literals
- var escapes = {
- '"': '"',
- '/': '/',
- '\\': '\\',
- 'b': '\b',
- 'f': '\f',
- 'n': '\n',
- 'r': '\r',
- 't': '\t'
- };
- function unescapeOne(_, ch, hex) {
- return ch ? escapes[ch] : String.fromCharCode(parseInt(hex, 16));
- }
-
- // A non-falsy value that coerces to the empty string when used as a key.
- var EMPTY_STRING = new String('');
- var SLASH = '\\';
-
- // Constructor to use based on an open token.
- var firstTokenCtors = { '{': Object, '[': Array };
-
- var hop = Object.hasOwnProperty;
-
- return function (json, opt_reviver) {
- // Split into tokens
- var toks = json.match(jsonToken);
- // Construct the object to return
- var result;
- var tok = toks[0];
- var topLevelPrimitive = false;
- if ('{' === tok) {
- result = {};
- } else if ('[' === tok) {
- result = [];
- } else {
- // The RFC only allows arrays or objects at the top level, but the JSON.parse
- // defined by the EcmaScript 5 draft does allow strings, booleans, numbers, and null
- // at the top level.
- result = [];
- topLevelPrimitive = true;
- }
-
- // If undefined, the key in an object key/value record to use for the next
- // value parsed.
- var key;
- // Loop over remaining tokens maintaining a stack of uncompleted objects and
- // arrays.
- var stack = [result];
- for (var i = 1 - topLevelPrimitive, n = toks.length; i < n; ++i) {
- tok = toks[i];
-
- var cont;
- switch (tok.charCodeAt(0)) {
- default: // sign or digit
- cont = stack[0];
- cont[key || cont.length] = +(tok);
- key = void 0;
- break;
- case 0x22: // '"'
- tok = tok.substring(1, tok.length - 1);
- if (tok.indexOf(SLASH) !== -1) {
- tok = tok.replace(escapeSequence, unescapeOne);
- }
- cont = stack[0];
- if (!key) {
- if (cont instanceof Array) {
- key = cont.length;
- } else {
- key = tok || EMPTY_STRING; // Use as key for next value seen.
- break;
- }
- }
- cont[key] = tok;
- key = void 0;
- break;
- case 0x5b: // '['
- cont = stack[0];
- stack.unshift(cont[key || cont.length] = []);
- key = void 0;
- break;
- case 0x5d: // ']'
- stack.shift();
- break;
- case 0x66: // 'f'
- cont = stack[0];
- cont[key || cont.length] = false;
- key = void 0;
- break;
- case 0x6e: // 'n'
- cont = stack[0];
- cont[key || cont.length] = null;
- key = void 0;
- break;
- case 0x74: // 't'
- cont = stack[0];
- cont[key || cont.length] = true;
- key = void 0;
- break;
- case 0x7b: // '{'
- cont = stack[0];
- stack.unshift(cont[key || cont.length] = {});
- key = void 0;
- break;
- case 0x7d: // '}'
- stack.shift();
- break;
- }
- }
- // Fail if we've got an uncompleted object.
- if (topLevelPrimitive) {
- if (stack.length !== 1) { throw new Error(); }
- result = result[0];
- } else {
- if (stack.length) { throw new Error(); }
- }
-
- if (opt_reviver) {
- // Based on walk as implemented in http://www.json.org/json2.js
- var walk = function (holder, key) {
- var value = holder[key];
- if (value && typeof value === 'object') {
- var toDelete = null;
- for (var k in value) {
- if (hop.call(value, k) && value !== holder) {
- // Recurse to properties first. This has the effect of causing
- // the reviver to be called on the object graph depth-first.
-
- // Since 'this' is bound to the holder of the property, the
- // reviver can access sibling properties of k including ones
- // that have not yet been revived.
-
- // The value returned by the reviver is used in place of the
- // current value of property k.
- // If it returns undefined then the property is deleted.
- var v = walk(value, k);
- if (v !== void 0) {
- value[k] = v;
- } else {
- // Deleting properties inside the loop has vaguely defined
- // semantics in ES3 and ES3.1.
- if (!toDelete) { toDelete = []; }
- toDelete.push(k);
- }
- }
- }
- if (toDelete) {
- for (var i = toDelete.length; --i >= 0;) {
- delete value[toDelete[i]];
- }
- }
- }
- return opt_reviver.call(holder, key, value);
- };
- result = walk({ '': result }, '');
- }
-
- return result;
- };
-})();
diff --git a/jwt/ext/md5.js b/jwt/ext/md5.js
deleted file mode 100644
index 24d190e..0000000
--- a/jwt/ext/md5.js
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
- * Digest Algorithm, as defined in RFC 1321.
- * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
- * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
- * Distributed under the BSD License
- * See http://pajhome.org.uk/crypt/md5 for more info.
- */
-
-/*
- * Configurable variables. You may need to tweak these to be compatible with
- * the server-side, but the defaults work in most cases.
- */
-var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */
-var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */
-
-/*
- * These are the functions you'll usually want to call
- * They take string arguments and return either hex or base-64 encoded strings
- */
-function hex_md5(s) { return rstr2hex(rstr_md5(str2rstr_utf8(s))); }
-function b64_md5(s) { return rstr2b64(rstr_md5(str2rstr_utf8(s))); }
-function any_md5(s, e) { return rstr2any(rstr_md5(str2rstr_utf8(s)), e); }
-function hex_hmac_md5(k, d)
- { return rstr2hex(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d))); }
-function b64_hmac_md5(k, d)
- { return rstr2b64(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d))); }
-function any_hmac_md5(k, d, e)
- { return rstr2any(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d)), e); }
-
-/*
- * Perform a simple self-test to see if the VM is working
- */
-function md5_vm_test()
-{
- return hex_md5("abc").toLowerCase() == "900150983cd24fb0d6963f7d28e17f72";
-}
-
-/*
- * Calculate the MD5 of a raw string
- */
-function rstr_md5(s)
-{
- return binl2rstr(binl_md5(rstr2binl(s), s.length * 8));
-}
-
-/*
- * Calculate the HMAC-MD5, of a key and some data (raw strings)
- */
-function rstr_hmac_md5(key, data)
-{
- var bkey = rstr2binl(key);
- if(bkey.length > 16) bkey = binl_md5(bkey, key.length * 8);
-
- var ipad = Array(16), opad = Array(16);
- for(var i = 0; i < 16; i++)
- {
- ipad[i] = bkey[i] ^ 0x36363636;
- opad[i] = bkey[i] ^ 0x5C5C5C5C;
- }
-
- var hash = binl_md5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);
- return binl2rstr(binl_md5(opad.concat(hash), 512 + 128));
-}
-
-/*
- * Convert a raw string to a hex string
- */
-function rstr2hex(input)
-{
- try { hexcase } catch(e) { hexcase=0; }
- var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
- var output = "";
- var x;
- for(var i = 0; i < input.length; i++)
- {
- x = input.charCodeAt(i);
- output += hex_tab.charAt((x >>> 4) & 0x0F)
- + hex_tab.charAt( x & 0x0F);
- }
- return output;
-}
-
-/*
- * Convert a raw string to a base-64 string
- */
-function rstr2b64(input)
-{
- try { b64pad } catch(e) { b64pad=''; }
- var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- var output = "";
- var len = input.length;
- for(var i = 0; i < len; i += 3)
- {
- var triplet = (input.charCodeAt(i) << 16)
- | (i + 1 < len ? input.charCodeAt(i+1) << 8 : 0)
- | (i + 2 < len ? input.charCodeAt(i+2) : 0);
- for(var j = 0; j < 4; j++)
- {
- if(i * 8 + j * 6 > input.length * 8) output += b64pad;
- else output += tab.charAt((triplet >>> 6*(3-j)) & 0x3F);
- }
- }
- return output;
-}
-
-/*
- * Convert a raw string to an arbitrary string encoding
- */
-function rstr2any(input, encoding)
-{
- var divisor = encoding.length;
- var i, j, q, x, quotient;
-
- /* Convert to an array of 16-bit big-endian values, forming the dividend */
- var dividend = Array(Math.ceil(input.length / 2));
- for(i = 0; i < dividend.length; i++)
- {
- dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1);
- }
-
- /*
- * Repeatedly perform a long division. The binary array forms the dividend,
- * the length of the encoding is the divisor. Once computed, the quotient
- * forms the dividend for the next step. All remainders are stored for later
- * use.
- */
- var full_length = Math.ceil(input.length * 8 /
- (Math.log(encoding.length) / Math.log(2)));
- var remainders = Array(full_length);
- for(j = 0; j < full_length; j++)
- {
- quotient = Array();
- x = 0;
- for(i = 0; i < dividend.length; i++)
- {
- x = (x << 16) + dividend[i];
- q = Math.floor(x / divisor);
- x -= q * divisor;
- if(quotient.length > 0 || q > 0)
- quotient[quotient.length] = q;
- }
- remainders[j] = x;
- dividend = quotient;
- }
-
- /* Convert the remainders to the output string */
- var output = "";
- for(i = remainders.length - 1; i >= 0; i--)
- output += encoding.charAt(remainders[i]);
-
- return output;
-}
-
-/*
- * Encode a string as utf-8.
- * For efficiency, this assumes the input is valid utf-16.
- */
-function str2rstr_utf8(input)
-{
- var output = "";
- var i = -1;
- var x, y;
-
- while(++i < input.length)
- {
- /* Decode utf-16 surrogate pairs */
- x = input.charCodeAt(i);
- y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0;
- if(0xD800 <= x && x <= 0xDBFF && 0xDC00 <= y && y <= 0xDFFF)
- {
- x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF);
- i++;
- }
-
- /* Encode output as utf-8 */
- if(x <= 0x7F)
- output += String.fromCharCode(x);
- else if(x <= 0x7FF)
- output += String.fromCharCode(0xC0 | ((x >>> 6 ) & 0x1F),
- 0x80 | ( x & 0x3F));
- else if(x <= 0xFFFF)
- output += String.fromCharCode(0xE0 | ((x >>> 12) & 0x0F),
- 0x80 | ((x >>> 6 ) & 0x3F),
- 0x80 | ( x & 0x3F));
- else if(x <= 0x1FFFFF)
- output += String.fromCharCode(0xF0 | ((x >>> 18) & 0x07),
- 0x80 | ((x >>> 12) & 0x3F),
- 0x80 | ((x >>> 6 ) & 0x3F),
- 0x80 | ( x & 0x3F));
- }
- return output;
-}
-
-/*
- * Encode a string as utf-16
- */
-function str2rstr_utf16le(input)
-{
- var output = "";
- for(var i = 0; i < input.length; i++)
- output += String.fromCharCode( input.charCodeAt(i) & 0xFF,
- (input.charCodeAt(i) >>> 8) & 0xFF);
- return output;
-}
-
-function str2rstr_utf16be(input)
-{
- var output = "";
- for(var i = 0; i < input.length; i++)
- output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF,
- input.charCodeAt(i) & 0xFF);
- return output;
-}
-
-/*
- * Convert a raw string to an array of little-endian words
- * Characters >255 have their high-byte silently ignored.
- */
-function rstr2binl(input)
-{
- var output = Array(input.length >> 2);
- for(var i = 0; i < output.length; i++)
- output[i] = 0;
- for(var i = 0; i < input.length * 8; i += 8)
- output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (i%32);
- return output;
-}
-
-/*
- * Convert an array of little-endian words to a string
- */
-function binl2rstr(input)
-{
- var output = "";
- for(var i = 0; i < input.length * 32; i += 8)
- output += String.fromCharCode((input[i>>5] >>> (i % 32)) & 0xFF);
- return output;
-}
-
-/*
- * Calculate the MD5 of an array of little-endian words, and a bit length.
- */
-function binl_md5(x, len)
-{
- /* append padding */
- x[len >> 5] |= 0x80 << ((len) % 32);
- x[(((len + 64) >>> 9) << 4) + 14] = len;
-
- var a = 1732584193;
- var b = -271733879;
- var c = -1732584194;
- var d = 271733878;
-
- for(var i = 0; i < x.length; i += 16)
- {
- var olda = a;
- var oldb = b;
- var oldc = c;
- var oldd = d;
-
- a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
- d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
- c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819);
- b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
- a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
- d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426);
- c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
- b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
- a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416);
- d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
- c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
- b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
- a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682);
- d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
- c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
- b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329);
-
- a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
- d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
- c = md5_gg(c, d, a, b, x[i+11], 14, 643717713);
- b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
- a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
- d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083);
- c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
- b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
- a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438);
- d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
- c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
- b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501);
- a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
- d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
- c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473);
- b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
-
- a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
- d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
- c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562);
- b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
- a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
- d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353);
- c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
- b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
- a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174);
- d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
- c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
- b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189);
- a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
- d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
- c = md5_hh(c, d, a, b, x[i+15], 16, 530742520);
- b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
-
- a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
- d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415);
- c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
- b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
- a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571);
- d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
- c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
- b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
- a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359);
- d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
- c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
- b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649);
- a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
- d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
- c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259);
- b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
-
- a = safe_add(a, olda);
- b = safe_add(b, oldb);
- c = safe_add(c, oldc);
- d = safe_add(d, oldd);
- }
- return Array(a, b, c, d);
-}
-
-/*
- * These functions implement the four basic operations the algorithm uses.
- */
-function md5_cmn(q, a, b, x, s, t)
-{
- return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
-}
-function md5_ff(a, b, c, d, x, s, t)
-{
- return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
-}
-function md5_gg(a, b, c, d, x, s, t)
-{
- return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
-}
-function md5_hh(a, b, c, d, x, s, t)
-{
- return md5_cmn(b ^ c ^ d, a, b, x, s, t);
-}
-function md5_ii(a, b, c, d, x, s, t)
-{
- return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
-}
-
-/*
- * Add integers, wrapping at 2^32. This uses 16-bit operations internally
- * to work around bugs in some JS interpreters.
- */
-function safe_add(x, y)
-{
- var lsw = (x & 0xFFFF) + (y & 0xFFFF);
- var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
- return (msw << 16) | (lsw & 0xFFFF);
-}
-
-/*
- * Bitwise rotate a 32-bit number to the left.
- */
-function bit_rol(num, cnt)
-{
- return (num << cnt) | (num >>> (32 - cnt));
-}
diff --git a/jwt/ext/prng4-min.js b/jwt/ext/prng4-min.js
deleted file mode 100755
index 9726509..0000000
--- a/jwt/ext/prng4-min.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
- */
-function Arcfour(){this.i=0;this.j=0;this.S=new Array()}function ARC4init(d){var c,a,b;for(c=0;c<256;++c){this.S[c]=c}a=0;for(c=0;c<256;++c){a=(a+this.S[c]+d[c%d.length])&255;b=this.S[c];this.S[c]=this.S[a];this.S[a]=b}this.i=0;this.j=0}function ARC4next(){var a;this.i=(this.i+1)&255;this.j=(this.j+this.S[this.i])&255;a=this.S[this.i];this.S[this.i]=this.S[this.j];this.S[this.j]=a;return this.S[(a+this.S[this.i])&255]}Arcfour.prototype.init=ARC4init;Arcfour.prototype.next=ARC4next;function prng_newstate(){return new Arcfour()}var rng_psize=256;
\ No newline at end of file
diff --git a/jwt/ext/prng4.js b/jwt/ext/prng4.js
deleted file mode 100644
index 9c4fd68..0000000
--- a/jwt/ext/prng4.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
- */
-// prng4.js - uses Arcfour as a PRNG
-
-function Arcfour() {
- this.i = 0;
- this.j = 0;
- this.S = new Array();
-}
-
-// Initialize arcfour context from key, an array of ints, each from [0..255]
-function ARC4init(key) {
- var i, j, t;
- for(i = 0; i < 256; ++i)
- this.S[i] = i;
- j = 0;
- for(i = 0; i < 256; ++i) {
- j = (j + this.S[i] + key[i % key.length]) & 255;
- t = this.S[i];
- this.S[i] = this.S[j];
- this.S[j] = t;
- }
- this.i = 0;
- this.j = 0;
-}
-
-function ARC4next() {
- var t;
- this.i = (this.i + 1) & 255;
- this.j = (this.j + this.S[this.i]) & 255;
- t = this.S[this.i];
- this.S[this.i] = this.S[this.j];
- this.S[this.j] = t;
- return this.S[(t + this.S[this.i]) & 255];
-}
-
-Arcfour.prototype.init = ARC4init;
-Arcfour.prototype.next = ARC4next;
-
-// Plug in your RNG constructor here
-function prng_newstate() {
- return new Arcfour();
-}
-
-// Pool size must be a multiple of 4 and greater than 32.
-// An array of bytes the size of the pool will be passed to init()
-var rng_psize = 256;
diff --git a/jwt/ext/ripemd160.js b/jwt/ext/ripemd160.js
deleted file mode 100644
index 7f60532..0000000
--- a/jwt/ext/ripemd160.js
+++ /dev/null
@@ -1,359 +0,0 @@
-/*
- * A JavaScript implementation of the RIPEMD-160 Algorithm
- * Version 2.2 Copyright Jeremy Lin, Paul Johnston 2000 - 2009.
- * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
- * Distributed under the BSD License
- * See http://pajhome.org.uk/crypt/md5 for details.
- * Also http://www.ocf.berkeley.edu/~jjlin/jsotp/
- */
-
-/*
- * Configurable variables. You may need to tweak these to be compatible with
- * the server-side, but the defaults work in most cases.
- */
-var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */
-var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */
-
-/*
- * These are the functions you'll usually want to call
- * They take string arguments and return either hex or base-64 encoded strings
- */
-function hex_rmd160(s) { return rstr2hex(rstr_rmd160(str2rstr_utf8(s))); }
-function b64_rmd160(s) { return rstr2b64(rstr_rmd160(str2rstr_utf8(s))); }
-function any_rmd160(s, e) { return rstr2any(rstr_rmd160(str2rstr_utf8(s)), e); }
-function hex_hmac_rmd160(k, d)
- { return rstr2hex(rstr_hmac_rmd160(str2rstr_utf8(k), str2rstr_utf8(d))); }
-function b64_hmac_rmd160(k, d)
- { return rstr2b64(rstr_hmac_rmd160(str2rstr_utf8(k), str2rstr_utf8(d))); }
-function any_hmac_rmd160(k, d, e)
- { return rstr2any(rstr_hmac_rmd160(str2rstr_utf8(k), str2rstr_utf8(d)), e); }
-
-/*
- * Perform a simple self-test to see if the VM is working
- */
-function rmd160_vm_test()
-{
- return hex_rmd160("abc").toLowerCase() == "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc";
-}
-
-/*
- * Calculate the rmd160 of a raw string
- */
-function rstr_rmd160(s)
-{
- return binl2rstr(binl_rmd160(rstr2binl(s), s.length * 8));
-}
-
-/*
- * Calculate the HMAC-rmd160 of a key and some data (raw strings)
- */
-function rstr_hmac_rmd160(key, data)
-{
- var bkey = rstr2binl(key);
- if(bkey.length > 16) bkey = binl_rmd160(bkey, key.length * 8);
-
- var ipad = Array(16), opad = Array(16);
- for(var i = 0; i < 16; i++)
- {
- ipad[i] = bkey[i] ^ 0x36363636;
- opad[i] = bkey[i] ^ 0x5C5C5C5C;
- }
-
- var hash = binl_rmd160(ipad.concat(rstr2binl(data)), 512 + data.length * 8);
- return binl2rstr(binl_rmd160(opad.concat(hash), 512 + 160));
-}
-
-/*
- * Convert a raw string to a hex string
- */
-function rstr2hex(input)
-{
- try { hexcase } catch(e) { hexcase=0; }
- var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
- var output = "";
- var x;
- for(var i = 0; i < input.length; i++)
- {
- x = input.charCodeAt(i);
- output += hex_tab.charAt((x >>> 4) & 0x0F)
- + hex_tab.charAt( x & 0x0F);
- }
- return output;
-}
-
-/*
- * Convert a raw string to a base-64 string
- */
-function rstr2b64(input)
-{
- try { b64pad } catch(e) { b64pad=''; }
- var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- var output = "";
- var len = input.length;
- for(var i = 0; i < len; i += 3)
- {
- var triplet = (input.charCodeAt(i) << 16)
- | (i + 1 < len ? input.charCodeAt(i+1) << 8 : 0)
- | (i + 2 < len ? input.charCodeAt(i+2) : 0);
- for(var j = 0; j < 4; j++)
- {
- if(i * 8 + j * 6 > input.length * 8) output += b64pad;
- else output += tab.charAt((triplet >>> 6*(3-j)) & 0x3F);
- }
- }
- return output;
-}
-
-/*
- * Convert a raw string to an arbitrary string encoding
- */
-function rstr2any(input, encoding)
-{
- var divisor = encoding.length;
- var remainders = Array();
- var i, q, x, quotient;
-
- /* Convert to an array of 16-bit big-endian values, forming the dividend */
- var dividend = Array(Math.ceil(input.length / 2));
- for(i = 0; i < dividend.length; i++)
- {
- dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1);
- }
-
- /*
- * Repeatedly perform a long division. The binary array forms the dividend,
- * the length of the encoding is the divisor. Once computed, the quotient
- * forms the dividend for the next step. We stop when the dividend is zero.
- * All remainders are stored for later use.
- */
- while(dividend.length > 0)
- {
- quotient = Array();
- x = 0;
- for(i = 0; i < dividend.length; i++)
- {
- x = (x << 16) + dividend[i];
- q = Math.floor(x / divisor);
- x -= q * divisor;
- if(quotient.length > 0 || q > 0)
- quotient[quotient.length] = q;
- }
- remainders[remainders.length] = x;
- dividend = quotient;
- }
-
- /* Convert the remainders to the output string */
- var output = "";
- for(i = remainders.length - 1; i >= 0; i--)
- output += encoding.charAt(remainders[i]);
-
- /* Append leading zero equivalents */
- var full_length = Math.ceil(input.length * 8 /
- (Math.log(encoding.length) / Math.log(2)))
- for(i = output.length; i < full_length; i++)
- output = encoding[0] + output;
-
- return output;
-}
-
-/*
- * Encode a string as utf-8.
- * For efficiency, this assumes the input is valid utf-16.
- */
-function str2rstr_utf8(input)
-{
- var output = "";
- var i = -1;
- var x, y;
-
- while(++i < input.length)
- {
- /* Decode utf-16 surrogate pairs */
- x = input.charCodeAt(i);
- y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0;
- if(0xD800 <= x && x <= 0xDBFF && 0xDC00 <= y && y <= 0xDFFF)
- {
- x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF);
- i++;
- }
-
- /* Encode output as utf-8 */
- if(x <= 0x7F)
- output += String.fromCharCode(x);
- else if(x <= 0x7FF)
- output += String.fromCharCode(0xC0 | ((x >>> 6 ) & 0x1F),
- 0x80 | ( x & 0x3F));
- else if(x <= 0xFFFF)
- output += String.fromCharCode(0xE0 | ((x >>> 12) & 0x0F),
- 0x80 | ((x >>> 6 ) & 0x3F),
- 0x80 | ( x & 0x3F));
- else if(x <= 0x1FFFFF)
- output += String.fromCharCode(0xF0 | ((x >>> 18) & 0x07),
- 0x80 | ((x >>> 12) & 0x3F),
- 0x80 | ((x >>> 6 ) & 0x3F),
- 0x80 | ( x & 0x3F));
- }
- return output;
-}
-
-/*
- * Encode a string as utf-16
- */
-function str2rstr_utf16le(input)
-{
- var output = "";
- for(var i = 0; i < input.length; i++)
- output += String.fromCharCode( input.charCodeAt(i) & 0xFF,
- (input.charCodeAt(i) >>> 8) & 0xFF);
- return output;
-}
-
-function str2rstr_utf16be(input)
-{
- var output = "";
- for(var i = 0; i < input.length; i++)
- output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF,
- input.charCodeAt(i) & 0xFF);
- return output;
-}
-
-/*
- * Convert a raw string to an array of little-endian words
- * Characters >255 have their high-byte silently ignored.
- */
-function rstr2binl(input)
-{
- var output = Array(input.length >> 2);
- for(var i = 0; i < output.length; i++)
- output[i] = 0;
- for(var i = 0; i < input.length * 8; i += 8)
- output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (i%32);
- return output;
-}
-
-/*
- * Convert an array of little-endian words to a string
- */
-function binl2rstr(input)
-{
- var output = "";
- for(var i = 0; i < input.length * 32; i += 8)
- output += String.fromCharCode((input[i>>5] >>> (i % 32)) & 0xFF);
- return output;
-}
-
-/*
- * Calculate the RIPE-MD160 of an array of little-endian words, and a bit length.
- */
-function binl_rmd160(x, len)
-{
- /* append padding */
- x[len >> 5] |= 0x80 << (len % 32);
- x[(((len + 64) >>> 9) << 4) + 14] = len;
-
- var h0 = 0x67452301;
- var h1 = 0xefcdab89;
- var h2 = 0x98badcfe;
- var h3 = 0x10325476;
- var h4 = 0xc3d2e1f0;
-
- for (var i = 0; i < x.length; i += 16) {
- var T;
- var A1 = h0, B1 = h1, C1 = h2, D1 = h3, E1 = h4;
- var A2 = h0, B2 = h1, C2 = h2, D2 = h3, E2 = h4;
- for (var j = 0; j <= 79; ++j) {
- T = safe_add(A1, rmd160_f(j, B1, C1, D1));
- T = safe_add(T, x[i + rmd160_r1[j]]);
- T = safe_add(T, rmd160_K1(j));
- T = safe_add(bit_rol(T, rmd160_s1[j]), E1);
- A1 = E1; E1 = D1; D1 = bit_rol(C1, 10); C1 = B1; B1 = T;
- T = safe_add(A2, rmd160_f(79-j, B2, C2, D2));
- T = safe_add(T, x[i + rmd160_r2[j]]);
- T = safe_add(T, rmd160_K2(j));
- T = safe_add(bit_rol(T, rmd160_s2[j]), E2);
- A2 = E2; E2 = D2; D2 = bit_rol(C2, 10); C2 = B2; B2 = T;
- }
- T = safe_add(h1, safe_add(C1, D2));
- h1 = safe_add(h2, safe_add(D1, E2));
- h2 = safe_add(h3, safe_add(E1, A2));
- h3 = safe_add(h4, safe_add(A1, B2));
- h4 = safe_add(h0, safe_add(B1, C2));
- h0 = T;
- }
- return [h0, h1, h2, h3, h4];
-}
-
-function rmd160_f(j, x, y, z)
-{
- return ( 0 <= j && j <= 15) ? (x ^ y ^ z) :
- (16 <= j && j <= 31) ? (x & y) | (~x & z) :
- (32 <= j && j <= 47) ? (x | ~y) ^ z :
- (48 <= j && j <= 63) ? (x & z) | (y & ~z) :
- (64 <= j && j <= 79) ? x ^ (y | ~z) :
- "rmd160_f: j out of range";
-}
-function rmd160_K1(j)
-{
- return ( 0 <= j && j <= 15) ? 0x00000000 :
- (16 <= j && j <= 31) ? 0x5a827999 :
- (32 <= j && j <= 47) ? 0x6ed9eba1 :
- (48 <= j && j <= 63) ? 0x8f1bbcdc :
- (64 <= j && j <= 79) ? 0xa953fd4e :
- "rmd160_K1: j out of range";
-}
-function rmd160_K2(j)
-{
- return ( 0 <= j && j <= 15) ? 0x50a28be6 :
- (16 <= j && j <= 31) ? 0x5c4dd124 :
- (32 <= j && j <= 47) ? 0x6d703ef3 :
- (48 <= j && j <= 63) ? 0x7a6d76e9 :
- (64 <= j && j <= 79) ? 0x00000000 :
- "rmd160_K2: j out of range";
-}
-var rmd160_r1 = [
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
- 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
- 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
- 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
-];
-var rmd160_r2 = [
- 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
- 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
- 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
- 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
- 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
-];
-var rmd160_s1 = [
- 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
- 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
- 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
- 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
- 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
-];
-var rmd160_s2 = [
- 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
- 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
- 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
- 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
- 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
-];
-
-/*
- * Add integers, wrapping at 2^32. This uses 16-bit operations internally
- * to work around bugs in some JS interpreters.
- */
-function safe_add(x, y)
-{
- var lsw = (x & 0xFFFF) + (y & 0xFFFF);
- var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
- return (msw << 16) | (lsw & 0xFFFF);
-}
-
-/*
- * Bitwise rotate a 32-bit number to the left.
- */
-function bit_rol(num, cnt)
-{
- return (num << cnt) | (num >>> (32 - cnt));
-}
diff --git a/jwt/ext/rng-min.js b/jwt/ext/rng-min.js
deleted file mode 100644
index b760f9b..0000000
--- a/jwt/ext/rng-min.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
- */
-var rng_state;var rng_pool;var rng_pptr;function rng_seed_int(a){rng_pool[rng_pptr++]^=a&255;rng_pool[rng_pptr++]^=(a>>8)&255;rng_pool[rng_pptr++]^=(a>>16)&255;rng_pool[rng_pptr++]^=(a>>24)&255;if(rng_pptr>=rng_psize){rng_pptr-=rng_psize}}function rng_seed_time(){rng_seed_int(new Date().getTime())}if(rng_pool==null){rng_pool=new Array();rng_pptr=0;var t;if(window.crypto&&window.crypto.getRandomValues){var ua=new Uint8Array(32);window.crypto.getRandomValues(ua);for(t=0;t<32;++t){rng_pool[rng_pptr++]=ua[t]}}if(navigator.appName=="Netscape"&&navigator.appVersion<"5"&&window.crypto){var z=window.crypto.random(32);for(t=0;t>>8;rng_pool[rng_pptr++]=t&255}rng_pptr=0;rng_seed_time()}function rng_get_byte(){if(rng_state==null){rng_seed_time();rng_state=prng_newstate();rng_state.init(rng_pool);for(rng_pptr=0;rng_pptr
-// in your main HTML document.
-
-var rng_state;
-var rng_pool;
-var rng_pptr;
-
-// Mix in a 32-bit integer into the pool
-function rng_seed_int(x) {
- rng_pool[rng_pptr++] ^= x & 255;
- rng_pool[rng_pptr++] ^= (x >> 8) & 255;
- rng_pool[rng_pptr++] ^= (x >> 16) & 255;
- rng_pool[rng_pptr++] ^= (x >> 24) & 255;
- if(rng_pptr >= rng_psize) rng_pptr -= rng_psize;
-}
-
-// Mix in the current time (w/milliseconds) into the pool
-function rng_seed_time() {
- rng_seed_int(new Date().getTime());
-}
-
-// Initialize the pool with junk if needed.
-if(rng_pool == null) {
- rng_pool = new Array();
- rng_pptr = 0;
- var t;
- if(window.crypto && window.crypto.getRandomValues) {
- // Use webcrypto if available
- var ua = new Uint8Array(32);
- window.crypto.getRandomValues(ua);
- for(t = 0; t < 32; ++t)
- rng_pool[rng_pptr++] = ua[t];
- }
- if(navigator.appName == "Netscape" && navigator.appVersion < "5" && window.crypto) {
- // Extract entropy (256 bits) from NS4 RNG if available
- var z = window.crypto.random(32);
- for(t = 0; t < z.length; ++t)
- rng_pool[rng_pptr++] = z.charCodeAt(t) & 255;
- }
- while(rng_pptr < rng_psize) { // extract some randomness from Math.random()
- t = Math.floor(65536 * Math.random());
- rng_pool[rng_pptr++] = t >>> 8;
- rng_pool[rng_pptr++] = t & 255;
- }
- rng_pptr = 0;
- rng_seed_time();
- //rng_seed_int(window.screenX);
- //rng_seed_int(window.screenY);
-}
-
-function rng_get_byte() {
- if(rng_state == null) {
- rng_seed_time();
- rng_state = prng_newstate();
- rng_state.init(rng_pool);
- for(rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr)
- rng_pool[rng_pptr] = 0;
- rng_pptr = 0;
- //rng_pool = null;
- }
- // TODO: allow reseeding after first request
- return rng_state.next();
-}
-
-function rng_get_bytes(ba) {
- var i;
- for(i = 0; i < ba.length; ++i) ba[i] = rng_get_byte();
-}
-
-function SecureRandom() {}
-
-SecureRandom.prototype.nextBytes = rng_get_bytes;
diff --git a/jwt/ext/rsa-min.js b/jwt/ext/rsa-min.js
deleted file mode 100755
index bc4d6f8..0000000
--- a/jwt/ext/rsa-min.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
- */
-function parseBigInt(b,a){return new BigInteger(b,a)}function linebrk(c,d){var a="";var b=0;while(b+d=0&&h>0){var f=e.charCodeAt(d--);if(f<128){g[--h]=f}else{if((f>127)&&(f<2048)){g[--h]=(f&63)|128;g[--h]=(f>>6)|192}else{g[--h]=(f&63)|128;g[--h]=((f>>6)&63)|128;g[--h]=(f>>12)|224}}}g[--h]=0;var b=new SecureRandom();var a=new Array();while(h>2){a[0]=0;while(a[0]==0){b.nextBytes(a)}g[--h]=a[0]}g[--h]=2;g[--h]=0;return new BigInteger(g)}function oaep_mgf1_arr(c,a,e){var b="",d=0;while(b.length>24,(d&16711680)>>16,(d&65280)>>8,d&255])));d+=1}return b}var SHA1_SIZE=20;function oaep_pad(l,a,c){if(l.length+2*SHA1_SIZE+2>a){throw"Message too long for RSA"}var h="",d;for(d=0;d0&&a.length>0){this.n=parseBigInt(b,16);this.e=parseInt(a,16)}else{alert("Invalid RSA public key")}}}function RSADoPublic(a){return a.modPowInt(this.e,this.n)}function RSAEncrypt(d){var a=pkcs1pad2(d,(this.n.bitLength()+7)>>3);if(a==null){return null}var e=this.doPublic(a);if(e==null){return null}var b=e.toString(16);if((b.length&1)==0){return b}else{return"0"+b}}function RSAEncryptOAEP(e,d){var a=oaep_pad(e,(this.n.bitLength()+7)>>3,d);if(a==null){return null}var f=this.doPublic(a);if(f==null){return null}var b=f.toString(16);if((b.length&1)==0){return b}else{return"0"+b}}RSAKey.prototype.doPublic=RSADoPublic;RSAKey.prototype.setPublic=RSASetPublic;RSAKey.prototype.encrypt=RSAEncrypt;RSAKey.prototype.encryptOAEP=RSAEncryptOAEP;RSAKey.prototype.type="RSA";
\ No newline at end of file
diff --git a/jwt/ext/rsa.js b/jwt/ext/rsa.js
deleted file mode 100644
index ee2f726..0000000
--- a/jwt/ext/rsa.js
+++ /dev/null
@@ -1,195 +0,0 @@
-/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
- */
-// Depends on jsbn.js and rng.js
-
-// Version 1.1: support utf-8 encoding in pkcs1pad2
-
-// convert a (hex) string to a bignum object
-function parseBigInt(str,r) {
- return new BigInteger(str,r);
-}
-
-function linebrk(s,n) {
- var ret = "";
- var i = 0;
- while(i + n < s.length) {
- ret += s.substring(i,i+n) + "\n";
- i += n;
- }
- return ret + s.substring(i,s.length);
-}
-
-function byte2Hex(b) {
- if(b < 0x10)
- return "0" + b.toString(16);
- else
- return b.toString(16);
-}
-
-// PKCS#1 (type 2, random) pad input string s to n bytes, and return a bigint
-function pkcs1pad2(s,n) {
- if(n < s.length + 11) { // TODO: fix for utf-8
- alert("Message too long for RSA");
- return null;
- }
- var ba = new Array();
- var i = s.length - 1;
- while(i >= 0 && n > 0) {
- var c = s.charCodeAt(i--);
- if(c < 128) { // encode using utf-8
- ba[--n] = c;
- }
- else if((c > 127) && (c < 2048)) {
- ba[--n] = (c & 63) | 128;
- ba[--n] = (c >> 6) | 192;
- }
- else {
- ba[--n] = (c & 63) | 128;
- ba[--n] = ((c >> 6) & 63) | 128;
- ba[--n] = (c >> 12) | 224;
- }
- }
- ba[--n] = 0;
- var rng = new SecureRandom();
- var x = new Array();
- while(n > 2) { // random non-zero pad
- x[0] = 0;
- while(x[0] == 0) rng.nextBytes(x);
- ba[--n] = x[0];
- }
- ba[--n] = 2;
- ba[--n] = 0;
- return new BigInteger(ba);
-}
-
-// PKCS#1 (OAEP) mask generation function
-function oaep_mgf1_arr(seed, len, hash)
-{
- var mask = '', i = 0;
-
- while (mask.length < len)
- {
- mask += hash(String.fromCharCode.apply(String, seed.concat([
- (i & 0xff000000) >> 24,
- (i & 0x00ff0000) >> 16,
- (i & 0x0000ff00) >> 8,
- i & 0x000000ff])));
- i += 1;
- }
-
- return mask;
-}
-
-// PKCS#1 (OAEP) pad input string s to n bytes, and return a bigint
-function oaep_pad(s, n, hash, hashLen)
-{
- if (!hash)
- {
- hash = rstr_sha1;
- hashLen = 20;
- }
-
- if (s.length + 2 * hashLen + 2 > n)
- {
- throw "Message too long for RSA";
- }
-
- var PS = '', i;
-
- for (i = 0; i < n - s.length - 2 * hashLen - 2; i += 1)
- {
- PS += '\x00';
- }
-
- var DB = hash('') + PS + '\x01' + s;
- var seed = new Array(hashLen);
- new SecureRandom().nextBytes(seed);
-
- var dbMask = oaep_mgf1_arr(seed, DB.length, hash);
- var maskedDB = [];
-
- for (i = 0; i < DB.length; i += 1)
- {
- maskedDB[i] = DB.charCodeAt(i) ^ dbMask.charCodeAt(i);
- }
-
- var seedMask = oaep_mgf1_arr(maskedDB, seed.length, hash);
- var maskedSeed = [0];
-
- for (i = 0; i < seed.length; i += 1)
- {
- maskedSeed[i + 1] = seed[i] ^ seedMask.charCodeAt(i);
- }
-
- return new BigInteger(maskedSeed.concat(maskedDB));
-}
-
-// "empty" RSA key constructor
-function RSAKey() {
- this.n = null;
- this.e = 0;
- this.d = null;
- this.p = null;
- this.q = null;
- this.dmp1 = null;
- this.dmq1 = null;
- this.coeff = null;
-}
-
-// Set the public key fields N and e from hex strings
-function RSASetPublic(N,E) {
- this.isPublic = true;
- if (typeof N !== "string")
- {
- this.n = N;
- this.e = E;
- }
- else if(N != null && E != null && N.length > 0 && E.length > 0) {
- this.n = parseBigInt(N,16);
- this.e = parseInt(E,16);
- }
- else
- alert("Invalid RSA public key");
-}
-
-// Perform raw public operation on "x": return x^e (mod n)
-function RSADoPublic(x) {
- return x.modPowInt(this.e, this.n);
-}
-
-// Return the PKCS#1 RSA encryption of "text" as an even-length hex string
-function RSAEncrypt(text) {
- var m = pkcs1pad2(text,(this.n.bitLength()+7)>>3);
- if(m == null) return null;
- var c = this.doPublic(m);
- if(c == null) return null;
- var h = c.toString(16);
- if((h.length & 1) == 0) return h; else return "0" + h;
-}
-
-// Return the PKCS#1 OAEP RSA encryption of "text" as an even-length hex string
-function RSAEncryptOAEP(text, hash, hashLen) {
- var m = oaep_pad(text, (this.n.bitLength()+7)>>3, hash, hashLen);
- if(m == null) return null;
- var c = this.doPublic(m);
- if(c == null) return null;
- var h = c.toString(16);
- if((h.length & 1) == 0) return h; else return "0" + h;
-}
-
-// Return the PKCS#1 RSA encryption of "text" as a Base64-encoded string
-//function RSAEncryptB64(text) {
-// var h = this.encrypt(text);
-// if(h) return hex2b64(h); else return null;
-//}
-
-// protected
-RSAKey.prototype.doPublic = RSADoPublic;
-
-// public
-RSAKey.prototype.setPublic = RSASetPublic;
-RSAKey.prototype.encrypt = RSAEncrypt;
-RSAKey.prototype.encryptOAEP = RSAEncryptOAEP;
-//RSAKey.prototype.encrypt_b64 = RSAEncryptB64;
-
-RSAKey.prototype.type = "RSA";
diff --git a/jwt/ext/rsa2-min.js b/jwt/ext/rsa2-min.js
deleted file mode 100755
index dd4bb11..0000000
--- a/jwt/ext/rsa2-min.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
- */
-function pkcs1unpad2(g,j){var a=g.toByteArray();var f=0;while(f=a.length){return null}}var e="";while(++f191)&&(h<224)){e+=String.fromCharCode(((h&31)<<6)|(a[f+1]&63));++f}else{e+=String.fromCharCode(((h&15)<<12)|((a[f+1]&63)<<6)|(a[f+2]&63));f+=2}}}return e}function oaep_mgf1_str(c,a,e){var b="",d=0;while(b.length>24,(d&16711680)>>16,(d&65280)>>8,d&255]));d+=1}return b}var SHA1_SIZE=20;function oaep_unpad(l,b,e){l=l.toByteArray();var f;for(f=0;f0&&a.length>0){this.n=parseBigInt(c,16);this.e=parseInt(a,16);this.d=parseBigInt(b,16)}else{alert("Invalid RSA private key")}}}function RSASetPrivateEx(g,d,e,c,b,a,h,f){this.isPrivate=true;if(g==null){throw"RSASetPrivateEx N == null"}if(d==null){throw"RSASetPrivateEx E == null"}if(g.length==0){throw"RSASetPrivateEx N.length == 0"}if(d.length==0){throw"RSASetPrivateEx E.length == 0"}if(g!=null&&d!=null&&g.length>0&&d.length>0){this.n=parseBigInt(g,16);this.e=parseInt(d,16);this.d=parseBigInt(e,16);this.p=parseBigInt(c,16);this.q=parseBigInt(b,16);this.dmp1=parseBigInt(a,16);this.dmq1=parseBigInt(h,16);this.coeff=parseBigInt(f,16)}else{alert("Invalid RSA private key in RSASetPrivateEx")}}function RSAGenerate(b,i){var a=new SecureRandom();var f=b>>1;this.e=parseInt(i,16);var c=new BigInteger(i,16);for(;;){for(;;){this.p=new BigInteger(b-f,1,a);if(this.p.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE)==0&&this.p.isProbablePrime(10)){break}}for(;;){this.q=new BigInteger(f,1,a);if(this.q.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE)==0&&this.q.isProbablePrime(10)){break}}if(this.p.compareTo(this.q)<=0){var h=this.p;this.p=this.q;this.q=h}var g=this.p.subtract(BigInteger.ONE);var d=this.q.subtract(BigInteger.ONE);var e=g.multiply(d);if(e.gcd(c).compareTo(BigInteger.ONE)==0){this.n=this.p.multiply(this.q);this.d=c.modInverse(e);this.dmp1=this.d.mod(g);this.dmq1=this.d.mod(d);this.coeff=this.q.modInverse(this.p);break}}}function RSADoPrivate(a){if(this.p==null||this.q==null){return a.modPow(this.d,this.n)}var c=a.mod(this.p).modPow(this.dmp1,this.p);var b=a.mod(this.q).modPow(this.dmq1,this.q);while(c.compareTo(b)<0){c=c.add(this.p)}return c.subtract(b).multiply(this.coeff).mod(this.p).multiply(this.q).add(b)}function RSADecrypt(b){var d=parseBigInt(b,16);var a=this.doPrivate(d);if(a==null){return null}return pkcs1unpad2(a,(this.n.bitLength()+7)>>3)}function RSADecryptOAEP(d,b){var e=parseBigInt(d,16);var a=this.doPrivate(e);if(a==null){return null}return oaep_unpad(a,(this.n.bitLength()+7)>>3,b)}RSAKey.prototype.doPrivate=RSADoPrivate;RSAKey.prototype.setPrivate=RSASetPrivate;RSAKey.prototype.setPrivateEx=RSASetPrivateEx;RSAKey.prototype.generate=RSAGenerate;RSAKey.prototype.decrypt=RSADecrypt;RSAKey.prototype.decryptOAEP=RSADecryptOAEP;
\ No newline at end of file
diff --git a/jwt/ext/rsa2.js b/jwt/ext/rsa2.js
deleted file mode 100644
index 3619e3d..0000000
--- a/jwt/ext/rsa2.js
+++ /dev/null
@@ -1,251 +0,0 @@
-/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
- */
-// Depends on rsa.js and jsbn2.js
-
-// Version 1.1: support utf-8 decoding in pkcs1unpad2
-
-// Undo PKCS#1 (type 2, random) padding and, if valid, return the plaintext
-function pkcs1unpad2(d,n) {
- var b = d.toByteArray();
- var i = 0;
- while(i < b.length && b[i] == 0) ++i;
- if(b.length-i != n-1 || b[i] != 2)
- return null;
- ++i;
- while(b[i] != 0)
- if(++i >= b.length) return null;
- var ret = "";
- while(++i < b.length) {
- var c = b[i] & 255;
- if(c < 128) { // utf-8 decode
- ret += String.fromCharCode(c);
- }
- else if((c > 191) && (c < 224)) {
- ret += String.fromCharCode(((c & 31) << 6) | (b[i+1] & 63));
- ++i;
- }
- else {
- ret += String.fromCharCode(((c & 15) << 12) | ((b[i+1] & 63) << 6) | (b[i+2] & 63));
- i += 2;
- }
- }
- return ret;
-}
-
-// PKCS#1 (OAEP) mask generation function
-function oaep_mgf1_str(seed, len, hash)
-{
- var mask = '', i = 0;
-
- while (mask.length < len)
- {
- mask += hash(seed + String.fromCharCode.apply(String, [
- (i & 0xff000000) >> 24,
- (i & 0x00ff0000) >> 16,
- (i & 0x0000ff00) >> 8,
- i & 0x000000ff]));
- i += 1;
- }
-
- return mask;
-}
-
-// Undo PKCS#1 (OAEP) padding and, if valid, return the plaintext
-function oaep_unpad(d, n, hash, hashLen)
-{
- if (!hash)
- {
- hash = rstr_sha1;
- hashLen = 20;
- }
-
- d = d.toByteArray();
-
- var i;
-
- for (i = 0; i < d.length; i += 1)
- {
- d[i] &= 0xff;
- }
-
- while (d.length < n)
- {
- d.unshift(0);
- }
-
- d = String.fromCharCode.apply(String, d);
-
- if (d.length < 2 * hashLen + 2)
- {
- throw "Cipher too short";
- }
-
- var maskedSeed = d.substr(1, hashLen)
- var maskedDB = d.substr(hashLen + 1);
-
- var seedMask = oaep_mgf1_str(maskedDB, hashLen, hash);
- var seed = [], i;
-
- for (i = 0; i < maskedSeed.length; i += 1)
- {
- seed[i] = maskedSeed.charCodeAt(i) ^ seedMask.charCodeAt(i);
- }
-
- var dbMask = oaep_mgf1_str(String.fromCharCode.apply(String, seed),
- d.length - hashLen, hash);
-
- var DB = [];
-
- for (i = 0; i < maskedDB.length; i += 1)
- {
- DB[i] = maskedDB.charCodeAt(i) ^ dbMask.charCodeAt(i);
- }
-
- DB = String.fromCharCode.apply(String, DB);
-
- if (DB.substr(0, hashLen) !== hash(''))
- {
- throw "Hash mismatch";
- }
-
- DB = DB.substr(hashLen);
-
- var first_one = DB.indexOf('\x01');
- var last_zero = (first_one != -1) ? DB.substr(0, first_one).lastIndexOf('\x00') : -1;
-
- if (last_zero + 1 != first_one)
- {
- throw "Malformed data";
- }
-
- return DB.substr(first_one + 1);
-}
-
-// Set the private key fields N, e, and d from hex strings
-function RSASetPrivate(N,E,D) {
- this.isPrivate = true;
- if (typeof N !== "string")
- {
- this.n = N;
- this.e = E;
- this.d = D;
- }
- else if(N != null && E != null && N.length > 0 && E.length > 0) {
- this.n = parseBigInt(N,16);
- this.e = parseInt(E,16);
- this.d = parseBigInt(D,16);
- }
- else
- alert("Invalid RSA private key");
-}
-
-// Set the private key fields N, e, d and CRT params from hex strings
-function RSASetPrivateEx(N,E,D,P,Q,DP,DQ,C) {
- this.isPrivate = true;
- if (N == null) throw "RSASetPrivateEx N == null";
- if (E == null) throw "RSASetPrivateEx E == null";
- if (N.length == 0) throw "RSASetPrivateEx N.length == 0";
- if (E.length == 0) throw "RSASetPrivateEx E.length == 0";
-
- if (N != null && E != null && N.length > 0 && E.length > 0) {
- this.n = parseBigInt(N,16);
- this.e = parseInt(E,16);
- this.d = parseBigInt(D,16);
- this.p = parseBigInt(P,16);
- this.q = parseBigInt(Q,16);
- this.dmp1 = parseBigInt(DP,16);
- this.dmq1 = parseBigInt(DQ,16);
- this.coeff = parseBigInt(C,16);
- } else {
- alert("Invalid RSA private key in RSASetPrivateEx");
- }
-}
-
-// Generate a new random private key B bits long, using public expt E
-function RSAGenerate(B,E) {
- var rng = new SecureRandom();
- var qs = B>>1;
- this.e = parseInt(E,16);
- var ee = new BigInteger(E,16);
- for(;;) {
- for(;;) {
- this.p = new BigInteger(B-qs,1,rng);
- if(this.p.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.p.isProbablePrime(10)) break;
- }
- for(;;) {
- this.q = new BigInteger(qs,1,rng);
- if(this.q.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.q.isProbablePrime(10)) break;
- }
- if(this.p.compareTo(this.q) <= 0) {
- var t = this.p;
- this.p = this.q;
- this.q = t;
- }
- var p1 = this.p.subtract(BigInteger.ONE); // p1 = p - 1
- var q1 = this.q.subtract(BigInteger.ONE); // q1 = q - 1
- var phi = p1.multiply(q1);
- if(phi.gcd(ee).compareTo(BigInteger.ONE) == 0) {
- this.n = this.p.multiply(this.q); // this.n = p * q
- this.d = ee.modInverse(phi); // this.d =
- this.dmp1 = this.d.mod(p1); // this.dmp1 = d mod (p - 1)
- this.dmq1 = this.d.mod(q1); // this.dmq1 = d mod (q - 1)
- this.coeff = this.q.modInverse(this.p); // this.coeff = (q ^ -1) mod p
- break;
- }
- }
- this.isPrivate = true;
-}
-
-// Perform raw private operation on "x": return x^d (mod n)
-function RSADoPrivate(x) {
- if(this.p == null || this.q == null)
- return x.modPow(this.d, this.n);
-
- // TODO: re-calculate any missing CRT params
- var xp = x.mod(this.p).modPow(this.dmp1, this.p); // xp=cp?
- var xq = x.mod(this.q).modPow(this.dmq1, this.q); // xq=cq?
-
- while(xp.compareTo(xq) < 0)
- xp = xp.add(this.p);
- // NOTE:
- // xp.subtract(xq) => cp -cq
- // xp.subtract(xq).multiply(this.coeff).mod(this.p) => (cp - cq) * u mod p = h
- // xp.subtract(xq).multiply(this.coeff).mod(this.p).multiply(this.q).add(xq) => cq + (h * q) = M
- return xp.subtract(xq).multiply(this.coeff).mod(this.p).multiply(this.q).add(xq);
-}
-
-// Return the PKCS#1 RSA decryption of "ctext".
-// "ctext" is an even-length hex string and the output is a plain string.
-function RSADecrypt(ctext) {
- var c = parseBigInt(ctext, 16);
- var m = this.doPrivate(c);
- if(m == null) return null;
- return pkcs1unpad2(m, (this.n.bitLength()+7)>>3);
-}
-
-// Return the PKCS#1 OAEP RSA decryption of "ctext".
-// "ctext" is an even-length hex string and the output is a plain string.
-function RSADecryptOAEP(ctext, hash, hashLen) {
- var c = parseBigInt(ctext, 16);
- var m = this.doPrivate(c);
- if(m == null) return null;
- return oaep_unpad(m, (this.n.bitLength()+7)>>3, hash, hashLen);
-}
-
-// Return the PKCS#1 RSA decryption of "ctext".
-// "ctext" is a Base64-encoded string and the output is a plain string.
-//function RSAB64Decrypt(ctext) {
-// var h = b64tohex(ctext);
-// if(h) return this.decrypt(h); else return null;
-//}
-
-// protected
-RSAKey.prototype.doPrivate = RSADoPrivate;
-
-// public
-RSAKey.prototype.setPrivate = RSASetPrivate;
-RSAKey.prototype.setPrivateEx = RSASetPrivateEx;
-RSAKey.prototype.generate = RSAGenerate;
-RSAKey.prototype.decrypt = RSADecrypt;
-RSAKey.prototype.decryptOAEP = RSADecryptOAEP;
-//RSAKey.prototype.b64_decrypt = RSAB64Decrypt;
diff --git a/jwt/ext/sha1.js b/jwt/ext/sha1.js
deleted file mode 100644
index b6b685d..0000000
--- a/jwt/ext/sha1.js
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
- * in FIPS 180-1
- * Version 2.2 Copyright Paul Johnston 2000 - 2009.
- * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
- * Distributed under the BSD License
- * See http://pajhome.org.uk/crypt/md5 for details.
- */
-
-/*
- * Configurable variables. You may need to tweak these to be compatible with
- * the server-side, but the defaults work in most cases.
- */
-var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */
-var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */
-
-/*
- * These are the functions you'll usually want to call
- * They take string arguments and return either hex or base-64 encoded strings
- */
-function hex_sha1(s) { return rstr2hex(rstr_sha1(str2rstr_utf8(s))); }
-function b64_sha1(s) { return rstr2b64(rstr_sha1(str2rstr_utf8(s))); }
-function any_sha1(s, e) { return rstr2any(rstr_sha1(str2rstr_utf8(s)), e); }
-function hex_hmac_sha1(k, d)
- { return rstr2hex(rstr_hmac_sha1(str2rstr_utf8(k), str2rstr_utf8(d))); }
-function b64_hmac_sha1(k, d)
- { return rstr2b64(rstr_hmac_sha1(str2rstr_utf8(k), str2rstr_utf8(d))); }
-function any_hmac_sha1(k, d, e)
- { return rstr2any(rstr_hmac_sha1(str2rstr_utf8(k), str2rstr_utf8(d)), e); }
-
-/*
- * Perform a simple self-test to see if the VM is working
- */
-function sha1_vm_test()
-{
- return hex_sha1("abc").toLowerCase() == "a9993e364706816aba3e25717850c26c9cd0d89d";
-}
-
-/*
- * Calculate the SHA1 of a raw string
- */
-function rstr_sha1(s)
-{
- return binb2rstr(binb_sha1(rstr2binb(s), s.length * 8));
-}
-
-/*
- * Calculate the HMAC-SHA1 of a key and some data (raw strings)
- */
-function rstr_hmac_sha1(key, data)
-{
- var bkey = rstr2binb(key);
- if(bkey.length > 16) bkey = binb_sha1(bkey, key.length * 8);
-
- var ipad = Array(16), opad = Array(16);
- for(var i = 0; i < 16; i++)
- {
- ipad[i] = bkey[i] ^ 0x36363636;
- opad[i] = bkey[i] ^ 0x5C5C5C5C;
- }
-
- var hash = binb_sha1(ipad.concat(rstr2binb(data)), 512 + data.length * 8);
- return binb2rstr(binb_sha1(opad.concat(hash), 512 + 160));
-}
-
-/*
- * Convert a raw string to a hex string
- */
-function rstr2hex(input)
-{
- try { hexcase } catch(e) { hexcase=0; }
- var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
- var output = "";
- var x;
- for(var i = 0; i < input.length; i++)
- {
- x = input.charCodeAt(i);
- output += hex_tab.charAt((x >>> 4) & 0x0F)
- + hex_tab.charAt( x & 0x0F);
- }
- return output;
-}
-
-/*
- * Convert a raw string to a base-64 string
- */
-function rstr2b64(input)
-{
- try { b64pad } catch(e) { b64pad=''; }
- var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- var output = "";
- var len = input.length;
- for(var i = 0; i < len; i += 3)
- {
- var triplet = (input.charCodeAt(i) << 16)
- | (i + 1 < len ? input.charCodeAt(i+1) << 8 : 0)
- | (i + 2 < len ? input.charCodeAt(i+2) : 0);
- for(var j = 0; j < 4; j++)
- {
- if(i * 8 + j * 6 > input.length * 8) output += b64pad;
- else output += tab.charAt((triplet >>> 6*(3-j)) & 0x3F);
- }
- }
- return output;
-}
-
-/*
- * Convert a raw string to an arbitrary string encoding
- */
-function rstr2any(input, encoding)
-{
- var divisor = encoding.length;
- var remainders = Array();
- var i, q, x, quotient;
-
- /* Convert to an array of 16-bit big-endian values, forming the dividend */
- var dividend = Array(Math.ceil(input.length / 2));
- for(i = 0; i < dividend.length; i++)
- {
- dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1);
- }
-
- /*
- * Repeatedly perform a long division. The binary array forms the dividend,
- * the length of the encoding is the divisor. Once computed, the quotient
- * forms the dividend for the next step. We stop when the dividend is zero.
- * All remainders are stored for later use.
- */
- while(dividend.length > 0)
- {
- quotient = Array();
- x = 0;
- for(i = 0; i < dividend.length; i++)
- {
- x = (x << 16) + dividend[i];
- q = Math.floor(x / divisor);
- x -= q * divisor;
- if(quotient.length > 0 || q > 0)
- quotient[quotient.length] = q;
- }
- remainders[remainders.length] = x;
- dividend = quotient;
- }
-
- /* Convert the remainders to the output string */
- var output = "";
- for(i = remainders.length - 1; i >= 0; i--)
- output += encoding.charAt(remainders[i]);
-
- /* Append leading zero equivalents */
- var full_length = Math.ceil(input.length * 8 /
- (Math.log(encoding.length) / Math.log(2)))
- for(i = output.length; i < full_length; i++)
- output = encoding[0] + output;
-
- return output;
-}
-
-/*
- * Encode a string as utf-8.
- * For efficiency, this assumes the input is valid utf-16.
- */
-function str2rstr_utf8(input)
-{
- var output = "";
- var i = -1;
- var x, y;
-
- while(++i < input.length)
- {
- /* Decode utf-16 surrogate pairs */
- x = input.charCodeAt(i);
- y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0;
- if(0xD800 <= x && x <= 0xDBFF && 0xDC00 <= y && y <= 0xDFFF)
- {
- x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF);
- i++;
- }
-
- /* Encode output as utf-8 */
- if(x <= 0x7F)
- output += String.fromCharCode(x);
- else if(x <= 0x7FF)
- output += String.fromCharCode(0xC0 | ((x >>> 6 ) & 0x1F),
- 0x80 | ( x & 0x3F));
- else if(x <= 0xFFFF)
- output += String.fromCharCode(0xE0 | ((x >>> 12) & 0x0F),
- 0x80 | ((x >>> 6 ) & 0x3F),
- 0x80 | ( x & 0x3F));
- else if(x <= 0x1FFFFF)
- output += String.fromCharCode(0xF0 | ((x >>> 18) & 0x07),
- 0x80 | ((x >>> 12) & 0x3F),
- 0x80 | ((x >>> 6 ) & 0x3F),
- 0x80 | ( x & 0x3F));
- }
- return output;
-}
-
-/*
- * Encode a string as utf-16
- */
-function str2rstr_utf16le(input)
-{
- var output = "";
- for(var i = 0; i < input.length; i++)
- output += String.fromCharCode( input.charCodeAt(i) & 0xFF,
- (input.charCodeAt(i) >>> 8) & 0xFF);
- return output;
-}
-
-function str2rstr_utf16be(input)
-{
- var output = "";
- for(var i = 0; i < input.length; i++)
- output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF,
- input.charCodeAt(i) & 0xFF);
- return output;
-}
-
-/*
- * Convert a raw string to an array of big-endian words
- * Characters >255 have their high-byte silently ignored.
- */
-function rstr2binb(input)
-{
- var output = Array(input.length >> 2);
- for(var i = 0; i < output.length; i++)
- output[i] = 0;
- for(var i = 0; i < input.length * 8; i += 8)
- output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (24 - i % 32);
- return output;
-}
-
-/*
- * Convert an array of big-endian words to a string
- */
-function binb2rstr(input)
-{
- var output = "";
- for(var i = 0; i < input.length * 32; i += 8)
- output += String.fromCharCode((input[i>>5] >>> (24 - i % 32)) & 0xFF);
- return output;
-}
-
-/*
- * Calculate the SHA-1 of an array of big-endian words, and a bit length
- */
-function binb_sha1(x, len)
-{
- /* append padding */
- x[len >> 5] |= 0x80 << (24 - len % 32);
- x[((len + 64 >> 9) << 4) + 15] = len;
-
- var w = Array(80);
- var a = 1732584193;
- var b = -271733879;
- var c = -1732584194;
- var d = 271733878;
- var e = -1009589776;
-
- for(var i = 0; i < x.length; i += 16)
- {
- var olda = a;
- var oldb = b;
- var oldc = c;
- var oldd = d;
- var olde = e;
-
- for(var j = 0; j < 80; j++)
- {
- if(j < 16) w[j] = x[i + j];
- else w[j] = bit_rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1);
- var t = safe_add(safe_add(bit_rol(a, 5), sha1_ft(j, b, c, d)),
- safe_add(safe_add(e, w[j]), sha1_kt(j)));
- e = d;
- d = c;
- c = bit_rol(b, 30);
- b = a;
- a = t;
- }
-
- a = safe_add(a, olda);
- b = safe_add(b, oldb);
- c = safe_add(c, oldc);
- d = safe_add(d, oldd);
- e = safe_add(e, olde);
- }
- return Array(a, b, c, d, e);
-
-}
-
-/*
- * Perform the appropriate triplet combination function for the current
- * iteration
- */
-function sha1_ft(t, b, c, d)
-{
- if(t < 20) return (b & c) | ((~b) & d);
- if(t < 40) return b ^ c ^ d;
- if(t < 60) return (b & c) | (b & d) | (c & d);
- return b ^ c ^ d;
-}
-
-/*
- * Determine the appropriate additive constant for the current iteration
- */
-function sha1_kt(t)
-{
- return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 :
- (t < 60) ? -1894007588 : -899497514;
-}
-
-/*
- * Add integers, wrapping at 2^32. This uses 16-bit operations internally
- * to work around bugs in some JS interpreters.
- */
-function safe_add(x, y)
-{
- var lsw = (x & 0xFFFF) + (y & 0xFFFF);
- var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
- return (msw << 16) | (lsw & 0xFFFF);
-}
-
-/*
- * Bitwise rotate a 32-bit number to the left.
- */
-function bit_rol(num, cnt)
-{
- return (num << cnt) | (num >>> (32 - cnt));
-}
diff --git a/jwt/ext/sha256.js b/jwt/ext/sha256.js
deleted file mode 100644
index b767a6e..0000000
--- a/jwt/ext/sha256.js
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
- * in FIPS 180-2
- * Version 2.2 Copyright Angel Marin, Paul Johnston 2000 - 2009.
- * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
- * Distributed under the BSD License
- * See http://pajhome.org.uk/crypt/md5 for details.
- * Also http://anmar.eu.org/projects/jssha2/
- */
-
-/*
- * Configurable variables. You may need to tweak these to be compatible with
- * the server-side, but the defaults work in most cases.
- */
-var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */
-var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */
-
-/*
- * These are the functions you'll usually want to call
- * They take string arguments and return either hex or base-64 encoded strings
- */
-function hex_sha256(s) { return rstr2hex(rstr_sha256(str2rstr_utf8(s))); }
-function b64_sha256(s) { return rstr2b64(rstr_sha256(str2rstr_utf8(s))); }
-function any_sha256(s, e) { return rstr2any(rstr_sha256(str2rstr_utf8(s)), e); }
-function hex_hmac_sha256(k, d)
- { return rstr2hex(rstr_hmac_sha256(str2rstr_utf8(k), str2rstr_utf8(d))); }
-function b64_hmac_sha256(k, d)
- { return rstr2b64(rstr_hmac_sha256(str2rstr_utf8(k), str2rstr_utf8(d))); }
-function any_hmac_sha256(k, d, e)
- { return rstr2any(rstr_hmac_sha256(str2rstr_utf8(k), str2rstr_utf8(d)), e); }
-
-/*
- * Perform a simple self-test to see if the VM is working
- */
-function sha256_vm_test()
-{
- return hex_sha256("abc").toLowerCase() ==
- "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad";
-}
-
-/*
- * Calculate the sha256 of a raw string
- */
-function rstr_sha256(s)
-{
- return binb2rstr(binb_sha256(rstr2binb(s), s.length * 8));
-}
-
-/*
- * Calculate the HMAC-sha256 of a key and some data (raw strings)
- */
-function rstr_hmac_sha256(key, data)
-{
- var bkey = rstr2binb(key);
- if(bkey.length > 16) bkey = binb_sha256(bkey, key.length * 8);
-
- var ipad = Array(16), opad = Array(16);
- for(var i = 0; i < 16; i++)
- {
- ipad[i] = bkey[i] ^ 0x36363636;
- opad[i] = bkey[i] ^ 0x5C5C5C5C;
- }
-
- var hash = binb_sha256(ipad.concat(rstr2binb(data)), 512 + data.length * 8);
- return binb2rstr(binb_sha256(opad.concat(hash), 512 + 256));
-}
-
-/*
- * Convert a raw string to a hex string
- */
-function rstr2hex(input)
-{
- try { hexcase } catch(e) { hexcase=0; }
- var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
- var output = "";
- var x;
- for(var i = 0; i < input.length; i++)
- {
- x = input.charCodeAt(i);
- output += hex_tab.charAt((x >>> 4) & 0x0F)
- + hex_tab.charAt( x & 0x0F);
- }
- return output;
-}
-
-/*
- * Convert a raw string to a base-64 string
- */
-function rstr2b64(input)
-{
- try { b64pad } catch(e) { b64pad=''; }
- var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- var output = "";
- var len = input.length;
- for(var i = 0; i < len; i += 3)
- {
- var triplet = (input.charCodeAt(i) << 16)
- | (i + 1 < len ? input.charCodeAt(i+1) << 8 : 0)
- | (i + 2 < len ? input.charCodeAt(i+2) : 0);
- for(var j = 0; j < 4; j++)
- {
- if(i * 8 + j * 6 > input.length * 8) output += b64pad;
- else output += tab.charAt((triplet >>> 6*(3-j)) & 0x3F);
- }
- }
- return output;
-}
-
-/*
- * Convert a raw string to an arbitrary string encoding
- */
-function rstr2any(input, encoding)
-{
- var divisor = encoding.length;
- var remainders = Array();
- var i, q, x, quotient;
-
- /* Convert to an array of 16-bit big-endian values, forming the dividend */
- var dividend = Array(Math.ceil(input.length / 2));
- for(i = 0; i < dividend.length; i++)
- {
- dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1);
- }
-
- /*
- * Repeatedly perform a long division. The binary array forms the dividend,
- * the length of the encoding is the divisor. Once computed, the quotient
- * forms the dividend for the next step. We stop when the dividend is zero.
- * All remainders are stored for later use.
- */
- while(dividend.length > 0)
- {
- quotient = Array();
- x = 0;
- for(i = 0; i < dividend.length; i++)
- {
- x = (x << 16) + dividend[i];
- q = Math.floor(x / divisor);
- x -= q * divisor;
- if(quotient.length > 0 || q > 0)
- quotient[quotient.length] = q;
- }
- remainders[remainders.length] = x;
- dividend = quotient;
- }
-
- /* Convert the remainders to the output string */
- var output = "";
- for(i = remainders.length - 1; i >= 0; i--)
- output += encoding.charAt(remainders[i]);
-
- /* Append leading zero equivalents */
- var full_length = Math.ceil(input.length * 8 /
- (Math.log(encoding.length) / Math.log(2)))
- for(i = output.length; i < full_length; i++)
- output = encoding[0] + output;
-
- return output;
-}
-
-/*
- * Encode a string as utf-8.
- * For efficiency, this assumes the input is valid utf-16.
- */
-function str2rstr_utf8(input)
-{
- var output = "";
- var i = -1;
- var x, y;
-
- while(++i < input.length)
- {
- /* Decode utf-16 surrogate pairs */
- x = input.charCodeAt(i);
- y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0;
- if(0xD800 <= x && x <= 0xDBFF && 0xDC00 <= y && y <= 0xDFFF)
- {
- x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF);
- i++;
- }
-
- /* Encode output as utf-8 */
- if(x <= 0x7F)
- output += String.fromCharCode(x);
- else if(x <= 0x7FF)
- output += String.fromCharCode(0xC0 | ((x >>> 6 ) & 0x1F),
- 0x80 | ( x & 0x3F));
- else if(x <= 0xFFFF)
- output += String.fromCharCode(0xE0 | ((x >>> 12) & 0x0F),
- 0x80 | ((x >>> 6 ) & 0x3F),
- 0x80 | ( x & 0x3F));
- else if(x <= 0x1FFFFF)
- output += String.fromCharCode(0xF0 | ((x >>> 18) & 0x07),
- 0x80 | ((x >>> 12) & 0x3F),
- 0x80 | ((x >>> 6 ) & 0x3F),
- 0x80 | ( x & 0x3F));
- }
- return output;
-}
-
-/*
- * Encode a string as utf-16
- */
-function str2rstr_utf16le(input)
-{
- var output = "";
- for(var i = 0; i < input.length; i++)
- output += String.fromCharCode( input.charCodeAt(i) & 0xFF,
- (input.charCodeAt(i) >>> 8) & 0xFF);
- return output;
-}
-
-function str2rstr_utf16be(input)
-{
- var output = "";
- for(var i = 0; i < input.length; i++)
- output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF,
- input.charCodeAt(i) & 0xFF);
- return output;
-}
-
-/*
- * Convert a raw string to an array of big-endian words
- * Characters >255 have their high-byte silently ignored.
- */
-function rstr2binb(input)
-{
- var output = Array(input.length >> 2);
- for(var i = 0; i < output.length; i++)
- output[i] = 0;
- for(var i = 0; i < input.length * 8; i += 8)
- output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (24 - i % 32);
- return output;
-}
-
-/*
- * Convert an array of big-endian words to a string
- */
-function binb2rstr(input)
-{
- var output = "";
- for(var i = 0; i < input.length * 32; i += 8)
- output += String.fromCharCode((input[i>>5] >>> (24 - i % 32)) & 0xFF);
- return output;
-}
-
-/*
- * Main sha256 function, with its support functions
- */
-function sha256_S (X, n) {return ( X >>> n ) | (X << (32 - n));}
-function sha256_R (X, n) {return ( X >>> n );}
-function sha256_Ch(x, y, z) {return ((x & y) ^ ((~x) & z));}
-function sha256_Maj(x, y, z) {return ((x & y) ^ (x & z) ^ (y & z));}
-function sha256_Sigma0256(x) {return (sha256_S(x, 2) ^ sha256_S(x, 13) ^ sha256_S(x, 22));}
-function sha256_Sigma1256(x) {return (sha256_S(x, 6) ^ sha256_S(x, 11) ^ sha256_S(x, 25));}
-function sha256_Gamma0256(x) {return (sha256_S(x, 7) ^ sha256_S(x, 18) ^ sha256_R(x, 3));}
-function sha256_Gamma1256(x) {return (sha256_S(x, 17) ^ sha256_S(x, 19) ^ sha256_R(x, 10));}
-function sha256_Sigma0512(x) {return (sha256_S(x, 28) ^ sha256_S(x, 34) ^ sha256_S(x, 39));}
-function sha256_Sigma1512(x) {return (sha256_S(x, 14) ^ sha256_S(x, 18) ^ sha256_S(x, 41));}
-function sha256_Gamma0512(x) {return (sha256_S(x, 1) ^ sha256_S(x, 8) ^ sha256_R(x, 7));}
-function sha256_Gamma1512(x) {return (sha256_S(x, 19) ^ sha256_S(x, 61) ^ sha256_R(x, 6));}
-
-var sha256_K = new Array
-(
- 1116352408, 1899447441, -1245643825, -373957723, 961987163, 1508970993,
- -1841331548, -1424204075, -670586216, 310598401, 607225278, 1426881987,
- 1925078388, -2132889090, -1680079193, -1046744716, -459576895, -272742522,
- 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986,
- -1740746414, -1473132947, -1341970488, -1084653625, -958395405, -710438585,
- 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291,
- 1695183700, 1986661051, -2117940946, -1838011259, -1564481375, -1474664885,
- -1035236496, -949202525, -778901479, -694614492, -200395387, 275423344,
- 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218,
- 1537002063, 1747873779, 1955562222, 2024104815, -2067236844, -1933114872,
- -1866530822, -1538233109, -1090935817, -965641998
-);
-
-function binb_sha256(m, l)
-{
- var HASH = new Array(1779033703, -1150833019, 1013904242, -1521486534,
- 1359893119, -1694144372, 528734635, 1541459225);
- var W = new Array(64);
- var a, b, c, d, e, f, g, h;
- var i, j, T1, T2;
-
- /* append padding */
- m[l >> 5] |= 0x80 << (24 - l % 32);
- m[((l + 64 >> 9) << 4) + 15] = l;
-
- for(i = 0; i < m.length; i += 16)
- {
- a = HASH[0];
- b = HASH[1];
- c = HASH[2];
- d = HASH[3];
- e = HASH[4];
- f = HASH[5];
- g = HASH[6];
- h = HASH[7];
-
- for(j = 0; j < 64; j++)
- {
- if (j < 16) W[j] = m[j + i];
- else W[j] = safe_add(safe_add(safe_add(sha256_Gamma1256(W[j - 2]), W[j - 7]),
- sha256_Gamma0256(W[j - 15])), W[j - 16]);
-
- T1 = safe_add(safe_add(safe_add(safe_add(h, sha256_Sigma1256(e)), sha256_Ch(e, f, g)),
- sha256_K[j]), W[j]);
- T2 = safe_add(sha256_Sigma0256(a), sha256_Maj(a, b, c));
- h = g;
- g = f;
- f = e;
- e = safe_add(d, T1);
- d = c;
- c = b;
- b = a;
- a = safe_add(T1, T2);
- }
-
- HASH[0] = safe_add(a, HASH[0]);
- HASH[1] = safe_add(b, HASH[1]);
- HASH[2] = safe_add(c, HASH[2]);
- HASH[3] = safe_add(d, HASH[3]);
- HASH[4] = safe_add(e, HASH[4]);
- HASH[5] = safe_add(f, HASH[5]);
- HASH[6] = safe_add(g, HASH[6]);
- HASH[7] = safe_add(h, HASH[7]);
- }
- return HASH;
-}
-
-function safe_add (x, y)
-{
- var lsw = (x & 0xFFFF) + (y & 0xFFFF);
- var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
- return (msw << 16) | (lsw & 0xFFFF);
-}
diff --git a/jwt/ext/sha512.js b/jwt/ext/sha512.js
deleted file mode 100644
index 9fefd17..0000000
--- a/jwt/ext/sha512.js
+++ /dev/null
@@ -1,496 +0,0 @@
-/*
- * A JavaScript implementation of the Secure Hash Algorithm, SHA-512, as defined
- * in FIPS 180-2
- * Version 2.2 Copyright Anonymous Contributor, Paul Johnston 2000 - 2009.
- * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
- * Distributed under the BSD License
- * See http://pajhome.org.uk/crypt/md5 for details.
- */
-
-/*
- * Configurable variables. You may need to tweak these to be compatible with
- * the server-side, but the defaults work in most cases.
- */
-var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */
-var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */
-
-/*
- * These are the functions you'll usually want to call
- * They take string arguments and return either hex or base-64 encoded strings
- */
-function hex_sha512(s) { return rstr2hex(rstr_sha512(str2rstr_utf8(s))); }
-function b64_sha512(s) { return rstr2b64(rstr_sha512(str2rstr_utf8(s))); }
-function any_sha512(s, e) { return rstr2any(rstr_sha512(str2rstr_utf8(s)), e);}
-function hex_hmac_sha512(k, d)
- { return rstr2hex(rstr_hmac_sha512(str2rstr_utf8(k), str2rstr_utf8(d))); }
-function b64_hmac_sha512(k, d)
- { return rstr2b64(rstr_hmac_sha512(str2rstr_utf8(k), str2rstr_utf8(d))); }
-function any_hmac_sha512(k, d, e)
- { return rstr2any(rstr_hmac_sha512(str2rstr_utf8(k), str2rstr_utf8(d)), e);}
-
-/*
- * Perform a simple self-test to see if the VM is working
- */
-function sha512_vm_test()
-{
- return hex_sha512("abc").toLowerCase() ==
- "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a" +
- "2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f";
-}
-
-/*
- * Calculate the SHA-512 of a raw string
- */
-function rstr_sha512(s)
-{
- return binb2rstr(binb_sha512(rstr2binb(s), s.length * 8));
-}
-
-/*
- * Calculate the HMAC-SHA-512 of a key and some data (raw strings)
- */
-function rstr_hmac_sha512(key, data)
-{
- var bkey = rstr2binb(key);
- if(bkey.length > 32) bkey = binb_sha512(bkey, key.length * 8);
-
- var ipad = Array(32), opad = Array(32);
- for(var i = 0; i < 32; i++)
- {
- ipad[i] = bkey[i] ^ 0x36363636;
- opad[i] = bkey[i] ^ 0x5C5C5C5C;
- }
-
- var hash = binb_sha512(ipad.concat(rstr2binb(data)), 1024 + data.length * 8);
- return binb2rstr(binb_sha512(opad.concat(hash), 1024 + 512));
-}
-
-/*
- * Convert a raw string to a hex string
- */
-function rstr2hex(input)
-{
- try { hexcase } catch(e) { hexcase=0; }
- var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
- var output = "";
- var x;
- for(var i = 0; i < input.length; i++)
- {
- x = input.charCodeAt(i);
- output += hex_tab.charAt((x >>> 4) & 0x0F)
- + hex_tab.charAt( x & 0x0F);
- }
- return output;
-}
-
-/*
- * Convert a raw string to a base-64 string
- */
-function rstr2b64(input)
-{
- try { b64pad } catch(e) { b64pad=''; }
- var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- var output = "";
- var len = input.length;
- for(var i = 0; i < len; i += 3)
- {
- var triplet = (input.charCodeAt(i) << 16)
- | (i + 1 < len ? input.charCodeAt(i+1) << 8 : 0)
- | (i + 2 < len ? input.charCodeAt(i+2) : 0);
- for(var j = 0; j < 4; j++)
- {
- if(i * 8 + j * 6 > input.length * 8) output += b64pad;
- else output += tab.charAt((triplet >>> 6*(3-j)) & 0x3F);
- }
- }
- return output;
-}
-
-/*
- * Convert a raw string to an arbitrary string encoding
- */
-function rstr2any(input, encoding)
-{
- var divisor = encoding.length;
- var i, j, q, x, quotient;
-
- /* Convert to an array of 16-bit big-endian values, forming the dividend */
- var dividend = Array(Math.ceil(input.length / 2));
- for(i = 0; i < dividend.length; i++)
- {
- dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1);
- }
-
- /*
- * Repeatedly perform a long division. The binary array forms the dividend,
- * the length of the encoding is the divisor. Once computed, the quotient
- * forms the dividend for the next step. All remainders are stored for later
- * use.
- */
- var full_length = Math.ceil(input.length * 8 /
- (Math.log(encoding.length) / Math.log(2)));
- var remainders = Array(full_length);
- for(j = 0; j < full_length; j++)
- {
- quotient = Array();
- x = 0;
- for(i = 0; i < dividend.length; i++)
- {
- x = (x << 16) + dividend[i];
- q = Math.floor(x / divisor);
- x -= q * divisor;
- if(quotient.length > 0 || q > 0)
- quotient[quotient.length] = q;
- }
- remainders[j] = x;
- dividend = quotient;
- }
-
- /* Convert the remainders to the output string */
- var output = "";
- for(i = remainders.length - 1; i >= 0; i--)
- output += encoding.charAt(remainders[i]);
-
- return output;
-}
-
-/*
- * Encode a string as utf-8.
- * For efficiency, this assumes the input is valid utf-16.
- */
-function str2rstr_utf8(input)
-{
- var output = "";
- var i = -1;
- var x, y;
-
- while(++i < input.length)
- {
- /* Decode utf-16 surrogate pairs */
- x = input.charCodeAt(i);
- y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0;
- if(0xD800 <= x && x <= 0xDBFF && 0xDC00 <= y && y <= 0xDFFF)
- {
- x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF);
- i++;
- }
-
- /* Encode output as utf-8 */
- if(x <= 0x7F)
- output += String.fromCharCode(x);
- else if(x <= 0x7FF)
- output += String.fromCharCode(0xC0 | ((x >>> 6 ) & 0x1F),
- 0x80 | ( x & 0x3F));
- else if(x <= 0xFFFF)
- output += String.fromCharCode(0xE0 | ((x >>> 12) & 0x0F),
- 0x80 | ((x >>> 6 ) & 0x3F),
- 0x80 | ( x & 0x3F));
- else if(x <= 0x1FFFFF)
- output += String.fromCharCode(0xF0 | ((x >>> 18) & 0x07),
- 0x80 | ((x >>> 12) & 0x3F),
- 0x80 | ((x >>> 6 ) & 0x3F),
- 0x80 | ( x & 0x3F));
- }
- return output;
-}
-
-/*
- * Encode a string as utf-16
- */
-function str2rstr_utf16le(input)
-{
- var output = "";
- for(var i = 0; i < input.length; i++)
- output += String.fromCharCode( input.charCodeAt(i) & 0xFF,
- (input.charCodeAt(i) >>> 8) & 0xFF);
- return output;
-}
-
-function str2rstr_utf16be(input)
-{
- var output = "";
- for(var i = 0; i < input.length; i++)
- output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF,
- input.charCodeAt(i) & 0xFF);
- return output;
-}
-
-/*
- * Convert a raw string to an array of big-endian words
- * Characters >255 have their high-byte silently ignored.
- */
-function rstr2binb(input)
-{
- var output = Array(input.length >> 2);
- for(var i = 0; i < output.length; i++)
- output[i] = 0;
- for(var i = 0; i < input.length * 8; i += 8)
- output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (24 - i % 32);
- return output;
-}
-
-/*
- * Convert an array of big-endian words to a string
- */
-function binb2rstr(input)
-{
- var output = "";
- for(var i = 0; i < input.length * 32; i += 8)
- output += String.fromCharCode((input[i>>5] >>> (24 - i % 32)) & 0xFF);
- return output;
-}
-
-/*
- * Calculate the SHA-512 of an array of big-endian dwords, and a bit length
- */
-var sha512_k;
-function binb_sha512(x, len)
-{
- if(sha512_k == undefined)
- {
- //SHA512 constants
- sha512_k = new Array(
-new int64(0x428a2f98, -685199838), new int64(0x71374491, 0x23ef65cd),
-new int64(-1245643825, -330482897), new int64(-373957723, -2121671748),
-new int64(0x3956c25b, -213338824), new int64(0x59f111f1, -1241133031),
-new int64(-1841331548, -1357295717), new int64(-1424204075, -630357736),
-new int64(-670586216, -1560083902), new int64(0x12835b01, 0x45706fbe),
-new int64(0x243185be, 0x4ee4b28c), new int64(0x550c7dc3, -704662302),
-new int64(0x72be5d74, -226784913), new int64(-2132889090, 0x3b1696b1),
-new int64(-1680079193, 0x25c71235), new int64(-1046744716, -815192428),
-new int64(-459576895, -1628353838), new int64(-272742522, 0x384f25e3),
-new int64(0xfc19dc6, -1953704523), new int64(0x240ca1cc, 0x77ac9c65),
-new int64(0x2de92c6f, 0x592b0275), new int64(0x4a7484aa, 0x6ea6e483),
-new int64(0x5cb0a9dc, -1119749164), new int64(0x76f988da, -2096016459),
-new int64(-1740746414, -295247957), new int64(-1473132947, 0x2db43210),
-new int64(-1341970488, -1728372417), new int64(-1084653625, -1091629340),
-new int64(-958395405, 0x3da88fc2), new int64(-710438585, -1828018395),
-new int64(0x6ca6351, -536640913), new int64(0x14292967, 0xa0e6e70),
-new int64(0x27b70a85, 0x46d22ffc), new int64(0x2e1b2138, 0x5c26c926),
-new int64(0x4d2c6dfc, 0x5ac42aed), new int64(0x53380d13, -1651133473),
-new int64(0x650a7354, -1951439906), new int64(0x766a0abb, 0x3c77b2a8),
-new int64(-2117940946, 0x47edaee6), new int64(-1838011259, 0x1482353b),
-new int64(-1564481375, 0x4cf10364), new int64(-1474664885, -1136513023),
-new int64(-1035236496, -789014639), new int64(-949202525, 0x654be30),
-new int64(-778901479, -688958952), new int64(-694614492, 0x5565a910),
-new int64(-200395387, 0x5771202a), new int64(0x106aa070, 0x32bbd1b8),
-new int64(0x19a4c116, -1194143544), new int64(0x1e376c08, 0x5141ab53),
-new int64(0x2748774c, -544281703), new int64(0x34b0bcb5, -509917016),
-new int64(0x391c0cb3, -976659869), new int64(0x4ed8aa4a, -482243893),
-new int64(0x5b9cca4f, 0x7763e373), new int64(0x682e6ff3, -692930397),
-new int64(0x748f82ee, 0x5defb2fc), new int64(0x78a5636f, 0x43172f60),
-new int64(-2067236844, -1578062990), new int64(-1933114872, 0x1a6439ec),
-new int64(-1866530822, 0x23631e28), new int64(-1538233109, -561857047),
-new int64(-1090935817, -1295615723), new int64(-965641998, -479046869),
-new int64(-903397682, -366583396), new int64(-779700025, 0x21c0c207),
-new int64(-354779690, -840897762), new int64(-176337025, -294727304),
-new int64(0x6f067aa, 0x72176fba), new int64(0xa637dc5, -1563912026),
-new int64(0x113f9804, -1090974290), new int64(0x1b710b35, 0x131c471b),
-new int64(0x28db77f5, 0x23047d84), new int64(0x32caab7b, 0x40c72493),
-new int64(0x3c9ebe0a, 0x15c9bebc), new int64(0x431d67c4, -1676669620),
-new int64(0x4cc5d4be, -885112138), new int64(0x597f299c, -60457430),
-new int64(0x5fcb6fab, 0x3ad6faec), new int64(0x6c44198c, 0x4a475817));
- }
-
- //Initial hash values
- var H = new Array(
-new int64(0x6a09e667, -205731576),
-new int64(-1150833019, -2067093701),
-new int64(0x3c6ef372, -23791573),
-new int64(-1521486534, 0x5f1d36f1),
-new int64(0x510e527f, -1377402159),
-new int64(-1694144372, 0x2b3e6c1f),
-new int64(0x1f83d9ab, -79577749),
-new int64(0x5be0cd19, 0x137e2179));
-
- var T1 = new int64(0, 0),
- T2 = new int64(0, 0),
- a = new int64(0,0),
- b = new int64(0,0),
- c = new int64(0,0),
- d = new int64(0,0),
- e = new int64(0,0),
- f = new int64(0,0),
- g = new int64(0,0),
- h = new int64(0,0),
- //Temporary variables not specified by the document
- s0 = new int64(0, 0),
- s1 = new int64(0, 0),
- Ch = new int64(0, 0),
- Maj = new int64(0, 0),
- r1 = new int64(0, 0),
- r2 = new int64(0, 0),
- r3 = new int64(0, 0);
- var j, i;
- var W = new Array(80);
- for(i=0; i<80; i++)
- W[i] = new int64(0, 0);
-
- // append padding to the source string. The format is described in the FIPS.
- x[len >> 5] |= 0x80 << (24 - (len & 0x1f));
- x[((len + 128 >> 10)<< 5) + 31] = len;
-
- for(i = 0; i=32
-//The function revrrot() is for that
-function int64rrot(dst, x, shift)
-{
- dst.l = (x.l >>> shift) | (x.h << (32-shift));
- dst.h = (x.h >>> shift) | (x.l << (32-shift));
-}
-
-//Reverses the dwords of the source and then rotates right by shift.
-//This is equivalent to rotation by 32+shift
-function int64revrrot(dst, x, shift)
-{
- dst.l = (x.h >>> shift) | (x.l << (32-shift));
- dst.h = (x.l >>> shift) | (x.h << (32-shift));
-}
-
-//Bitwise-shifts right a 64-bit number by shift
-//Won't handle shift>=32, but it's never needed in SHA512
-function int64shr(dst, x, shift)
-{
- dst.l = (x.l >>> shift) | (x.h << (32-shift));
- dst.h = (x.h >>> shift);
-}
-
-//Adds two 64-bit numbers
-//Like the original implementation, does not rely on 32-bit operations
-function int64add(dst, x, y)
-{
- var w0 = (x.l & 0xffff) + (y.l & 0xffff);
- var w1 = (x.l >>> 16) + (y.l >>> 16) + (w0 >>> 16);
- var w2 = (x.h & 0xffff) + (y.h & 0xffff) + (w1 >>> 16);
- var w3 = (x.h >>> 16) + (y.h >>> 16) + (w2 >>> 16);
- dst.l = (w0 & 0xffff) | (w1 << 16);
- dst.h = (w2 & 0xffff) | (w3 << 16);
-}
-
-//Same, except with 4 addends. Works faster than adding them one by one.
-function int64add4(dst, a, b, c, d)
-{
- var w0 = (a.l & 0xffff) + (b.l & 0xffff) + (c.l & 0xffff) + (d.l & 0xffff);
- var w1 = (a.l >>> 16) + (b.l >>> 16) + (c.l >>> 16) + (d.l >>> 16) + (w0 >>> 16);
- var w2 = (a.h & 0xffff) + (b.h & 0xffff) + (c.h & 0xffff) + (d.h & 0xffff) + (w1 >>> 16);
- var w3 = (a.h >>> 16) + (b.h >>> 16) + (c.h >>> 16) + (d.h >>> 16) + (w2 >>> 16);
- dst.l = (w0 & 0xffff) | (w1 << 16);
- dst.h = (w2 & 0xffff) | (w3 << 16);
-}
-
-//Same, except with 5 addends
-function int64add5(dst, a, b, c, d, e)
-{
- var w0 = (a.l & 0xffff) + (b.l & 0xffff) + (c.l & 0xffff) + (d.l & 0xffff) + (e.l & 0xffff);
- var w1 = (a.l >>> 16) + (b.l >>> 16) + (c.l >>> 16) + (d.l >>> 16) + (e.l >>> 16) + (w0 >>> 16);
- var w2 = (a.h & 0xffff) + (b.h & 0xffff) + (c.h & 0xffff) + (d.h & 0xffff) + (e.h & 0xffff) + (w1 >>> 16);
- var w3 = (a.h >>> 16) + (b.h >>> 16) + (c.h >>> 16) + (d.h >>> 16) + (e.h >>> 16) + (w2 >>> 16);
- dst.l = (w0 & 0xffff) | (w1 << 16);
- dst.h = (w2 & 0xffff) | (w3 << 16);
-}
diff --git a/jwt/ext/x64-core-min.js b/jwt/ext/x64-core-min.js
deleted file mode 100644
index 72dfa1f..0000000
--- a/jwt/ext/x64-core-min.js
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
-CryptoJS v3.1.2 x64-core-min.js
-code.google.com/p/crypto-js
-(c) 2009-2013 by Jeff Mott. All rights reserved.
-code.google.com/p/crypto-js/wiki/License
-*/
-(function(g){var a=CryptoJS,f=a.lib,e=f.Base,h=f.WordArray,a=a.x64={};a.Word=e.extend({init:function(b,c){this.high=b;this.low=c}});a.WordArray=e.extend({init:function(b,c){b=this.words=b||[];this.sigBytes=c!=g?c:8*b.length},toX32:function(){for(var b=this.words,c=b.length,a=[],d=0;d>> (32 - n));
- // var low = this.low << n;
- // } else {
- // var high = this.low << (n - 32);
- // var low = 0;
- // }
-
- // return X64Word.create(high, low);
- // },
-
- /**
- * Shifts this word n bits to the right.
- *
- * @param {number} n The number of bits to shift.
- *
- * @return {X64Word} A new x64-Word object after shifting.
- *
- * @example
- *
- * var shifted = x64Word.shiftR(7);
- */
- // shiftR: function (n) {
- // if (n < 32) {
- // var low = (this.low >>> n) | (this.high << (32 - n));
- // var high = this.high >>> n;
- // } else {
- // var low = this.high >>> (n - 32);
- // var high = 0;
- // }
-
- // return X64Word.create(high, low);
- // },
-
- /**
- * Rotates this word n bits to the left.
- *
- * @param {number} n The number of bits to rotate.
- *
- * @return {X64Word} A new x64-Word object after rotating.
- *
- * @example
- *
- * var rotated = x64Word.rotL(25);
- */
- // rotL: function (n) {
- // return this.shiftL(n).or(this.shiftR(64 - n));
- // },
-
- /**
- * Rotates this word n bits to the right.
- *
- * @param {number} n The number of bits to rotate.
- *
- * @return {X64Word} A new x64-Word object after rotating.
- *
- * @example
- *
- * var rotated = x64Word.rotR(7);
- */
- // rotR: function (n) {
- // return this.shiftR(n).or(this.shiftL(64 - n));
- // },
-
- /**
- * Adds this word with the passed word.
- *
- * @param {X64Word} word The x64-Word to add with this word.
- *
- * @return {X64Word} A new x64-Word object after adding.
- *
- * @example
- *
- * var added = x64Word.add(anotherX64Word);
- */
- // add: function (word) {
- // var low = (this.low + word.low) | 0;
- // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0;
- // var high = (this.high + word.high + carry) | 0;
-
- // return X64Word.create(high, low);
- // }
- });
-
- /**
- * An array of 64-bit words.
- *
- * @property {Array} words The array of CryptoJS.x64.Word objects.
- * @property {number} sigBytes The number of significant bytes in this word array.
- */
- var X64WordArray = C_x64.WordArray = Base.extend({
- /**
- * Initializes a newly created word array.
- *
- * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects.
- * @param {number} sigBytes (Optional) The number of significant bytes in the words.
- *
- * @example
- *
- * var wordArray = CryptoJS.x64.WordArray.create();
- *
- * var wordArray = CryptoJS.x64.WordArray.create([
- * CryptoJS.x64.Word.create(0x00010203, 0x04050607),
- * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
- * ]);
- *
- * var wordArray = CryptoJS.x64.WordArray.create([
- * CryptoJS.x64.Word.create(0x00010203, 0x04050607),
- * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
- * ], 10);
- */
- init: function (words, sigBytes) {
- words = this.words = words || [];
-
- if (sigBytes != undefined) {
- this.sigBytes = sigBytes;
- } else {
- this.sigBytes = words.length * 8;
- }
- },
-
- /**
- * Converts this 64-bit word array to a 32-bit word array.
- *
- * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array.
- *
- * @example
- *
- * var x32WordArray = x64WordArray.toX32();
- */
- toX32: function () {
- // Shortcuts
- var x64Words = this.words;
- var x64WordsLength = x64Words.length;
-
- // Convert
- var x32Words = [];
- for (var i = 0; i < x64WordsLength; i++) {
- var x64Word = x64Words[i];
- x32Words.push(x64Word.high);
- x32Words.push(x64Word.low);
- }
-
- return X32WordArray.create(x32Words, this.sigBytes);
- },
-
- /**
- * Creates a copy of this word array.
- *
- * @return {X64WordArray} The clone.
- *
- * @example
- *
- * var clone = x64WordArray.clone();
- */
- clone: function () {
- var clone = Base.clone.call(this);
-
- // Clone "words" array
- var words = clone.words = this.words.slice(0);
-
- // Clone each X64Word object
- var wordsLength = words.length;
- for (var i = 0; i < wordsLength; i++) {
- words[i] = words[i].clone();
- }
-
- return clone;
- }
- });
-}());
diff --git a/jwt/ext/yahoo-min.js b/jwt/ext/yahoo-min.js
deleted file mode 100755
index e792fbe..0000000
--- a/jwt/ext/yahoo-min.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
-yahoo-min.js
-Copyright (c) 2011, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.com/yui/license.html
-version: 2.9.0
-*/
-if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={};}YAHOO.namespace=function(){var b=arguments,g=null,e,c,f;for(e=0;e":">",'"':""","'":"'","/":"/","`":"`"},d=["toString","valueOf"],e={isArray:function(j){return a.toString.apply(j)===c;},isBoolean:function(j){return typeof j==="boolean";},isFunction:function(j){return(typeof j==="function")||a.toString.apply(j)===h;},isNull:function(j){return j===null;},isNumber:function(j){return typeof j==="number"&&isFinite(j);},isObject:function(j){return(j&&(typeof j==="object"||f.isFunction(j)))||false;},isString:function(j){return typeof j==="string";},isUndefined:function(j){return typeof j==="undefined";},_IEEnumFix:(YAHOO.env.ua.ie)?function(l,k){var j,n,m;for(j=0;j"'\/`]/g,function(k){return g[k];});},extend:function(m,n,l){if(!n||!m){throw new Error("extend failed, please check that "+"all dependencies are included.");}var k=function(){},j;k.prototype=n.prototype;m.prototype=new k();m.prototype.constructor=m;m.superclass=n.prototype;if(n.prototype.constructor==a.constructor){n.prototype.constructor=n;}if(l){for(j in l){if(f.hasOwnProperty(l,j)){m.prototype[j]=l[j];}}f._IEEnumFix(m.prototype,l);}},augmentObject:function(n,m){if(!m||!n){throw new Error("Absorb failed, verify dependencies.");}var j=arguments,l,o,k=j[2];if(k&&k!==true){for(l=2;l ";if(!f.isObject(j)){return j+"";}else{if(j instanceof Date||("nodeType" in j&&"tagName" in j)){return j;}else{if(f.isFunction(j)){return k;}}}p=(f.isNumber(p))?p:3;if(f.isArray(j)){r.push("[");for(l=0,n=j.length;l0)?f.dump(j[l],p-1):t);}else{r.push(j[l]);}r.push(q);}if(r.length>1){r.pop();}r.push("]");}else{r.push("{");for(l in j){if(f.hasOwnProperty(j,l)){r.push(l+m);if(f.isObject(j[l])){r.push((p>0)?f.dump(j[l],p-1):t);}else{r.push(j[l]);}r.push(q);}}if(r.length>1){r.pop();}r.push("}");}return r.join("");},substitute:function(x,y,E,l){var D,C,B,G,t,u,F=[],p,z=x.length,A="dump",r=" ",q="{",m="}",n,w;for(;;){D=x.lastIndexOf(q,z);if(D<0){break;}C=x.indexOf(m,D);if(D+1>C){break;}p=x.substring(D+1,C);G=p;u=null;B=G.indexOf(r);if(B>-1){u=G.substring(B+1);G=G.substring(0,B);}t=y[G];if(E){t=E(G,t,u);}if(f.isObject(t)){if(f.isArray(t)){t=f.dump(t,parseInt(u,10));}else{u=u||"";n=u.indexOf(A);if(n>-1){u=u.substring(4);}w=t.toString();if(w===i||n>-1){t=f.dump(t,parseInt(u,10));}else{t=w;}}}else{if(!f.isString(t)&&!f.isNumber(t)){t="~-"+F.length+"-~";F[F.length]=p;}}x=x.substring(0,D)+t+x.substring(C+1);if(l===false){z=D-1;}}for(D=F.length-1;D>=0;D=D-1){x=x.replace(new RegExp("~-"+D+"-~"),"{"+F[D]+"}","g");}return x;},trim:function(j){try{return j.replace(/^\s+|\s+$/g,"");}catch(k){return j;
-}},merge:function(){var n={},k=arguments,j=k.length,m;for(m=0;m
- * YAHOO.env.getVersion for the description of the version data structure.
- * @property listener
- * @type Function
- * @static
- * @default undefined
- */
-
-/**
- * Set to true if the library will be dynamically loaded after window.onload.
- * Defaults to false
- * @property injecting
- * @type boolean
- * @static
- * @default undefined
- */
-
-/**
- * Instructs the yuiloader component to dynamically load yui components and
- * their dependencies. See the yuiloader documentation for more information
- * about dynamic loading
- * @property load
- * @static
- * @default undefined
- * @see yuiloader
- */
-
-/**
- * Forces the use of the supplied locale where applicable in the library
- * @property locale
- * @type string
- * @static
- * @default undefined
- */
-
-if (typeof YAHOO == "undefined" || !YAHOO) {
- /**
- * The YAHOO global namespace object. If YAHOO is already defined, the
- * existing YAHOO object will not be overwritten so that defined
- * namespaces are preserved.
- * @class YAHOO
- * @static
- */
- var YAHOO = {};
-}
-
-/**
- * Returns the namespace specified and creates it if it doesn't exist
- *
- * YAHOO.namespace("property.package");
- * YAHOO.namespace("YAHOO.property.package");
- *
- * Either of the above would create YAHOO.property, then
- * YAHOO.property.package
- *
- * Be careful when naming packages. Reserved words may work in some browsers
- * and not others. For instance, the following will fail in Safari:
- *
- * YAHOO.namespace("really.long.nested.namespace");
- *
- * This fails because "long" is a future reserved word in ECMAScript
- *
- * For implementation code that uses YUI, do not create your components
- * in the namespaces defined by YUI (
- * YAHOO.util
,
- * YAHOO.widget
,
- * YAHOO.lang
,
- * YAHOO.tool
,
- * YAHOO.example
,
- * YAHOO.env
) -- create your own namespace (e.g., 'companyname').
- *
- * @method namespace
- * @static
- * @param {String*} arguments 1-n namespaces to create
- * @return {Object} A reference to the last namespace object created
- */
-YAHOO.namespace = function() {
- var a=arguments, o=null, i, j, d;
- for (i=0; i
- * name: The name of the module
- * version: The version in use
- * build: The build number in use
- * versions: All versions that were registered
- * builds: All builds that were registered.
- * mainClass: An object that was was stamped with the
- * current version and build. If
- * mainClass.VERSION != version or mainClass.BUILD != build,
- * multiple versions of pieces of the library have been
- * loaded, potentially causing issues.
- *
- *
- * @method getVersion
- * @static
- * @param {String} name the name of the module (event, slider, etc)
- * @return {Object} The version info
- */
-YAHOO.env.getVersion = function(name) {
- return YAHOO.env.modules[name] || null;
-};
-
-/**
- * Do not fork for a browser if it can be avoided. Use feature detection when
- * you can. Use the user agent as a last resort. YAHOO.env.ua stores a version
- * number for the browser engine, 0 otherwise. This value may or may not map
- * to the version number of the browser using the engine. The value is
- * presented as a float so that it can easily be used for boolean evaluation
- * as well as for looking for a particular range of versions. Because of this,
- * some of the granularity of the version info may be lost (e.g., Gecko 1.8.0.9
- * reports 1.8).
- * @class YAHOO.env.ua
- * @static
- */
-
-/**
- * parses a user agent string (or looks for one in navigator to parse if
- * not supplied).
- * @method parseUA
- * @since 2.9.0
- * @static
- */
-YAHOO.env.parseUA = function(agent) {
-
- var numberify = function(s) {
- var c = 0;
- return parseFloat(s.replace(/\./g, function() {
- return (c++ == 1) ? '' : '.';
- }));
- },
-
- nav = navigator,
-
- o = {
-
- /**
- * Internet Explorer version number or 0. Example: 6
- * @property ie
- * @type float
- * @static
- */
- ie: 0,
-
- /**
- * Opera version number or 0. Example: 9.2
- * @property opera
- * @type float
- * @static
- */
- opera: 0,
-
- /**
- * Gecko engine revision number. Will evaluate to 1 if Gecko
- * is detected but the revision could not be found. Other browsers
- * will be 0. Example: 1.8
- *
- * Firefox 1.0.0.4: 1.7.8 <-- Reports 1.7
- * Firefox 1.5.0.9: 1.8.0.9 <-- 1.8
- * Firefox 2.0.0.3: 1.8.1.3 <-- 1.81
- * Firefox 3.0 <-- 1.9
- * Firefox 3.5 <-- 1.91
- *
- * @property gecko
- * @type float
- * @static
- */
- gecko: 0,
-
- /**
- * AppleWebKit version. KHTML browsers that are not WebKit browsers
- * will evaluate to 1, other browsers 0. Example: 418.9
- *
- * Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the
- * latest available for Mac OSX 10.3.
- * Safari 2.0.2: 416 <-- hasOwnProperty introduced
- * Safari 2.0.4: 418 <-- preventDefault fixed
- * Safari 2.0.4 (419.3): 418.9.1 <-- One version of Safari may run
- * different versions of webkit
- * Safari 2.0.4 (419.3): 419 <-- Tiger installations that have been
- * updated, but not updated
- * to the latest patch.
- * Webkit 212 nightly: 522+ <-- Safari 3.0 precursor (with native
- * SVG and many major issues fixed).
- * Safari 3.0.4 (523.12) 523.12 <-- First Tiger release - automatic
- * update from 2.x via the 10.4.11 OS patch.
- * Webkit nightly 1/2008:525+ <-- Supports DOMContentLoaded event.
- * yahoo.com user agent hack removed.
- *
- * http://en.wikipedia.org/wiki/Safari_version_history
- * @property webkit
- * @type float
- * @static
- */
- webkit: 0,
-
- /**
- * Chrome will be detected as webkit, but this property will also
- * be populated with the Chrome version number
- * @property chrome
- * @type float
- * @static
- */
- chrome: 0,
-
- /**
- * The mobile property will be set to a string containing any relevant
- * user agent information when a modern mobile browser is detected.
- * Currently limited to Safari on the iPhone/iPod Touch, Nokia N-series
- * devices with the WebKit-based browser, and Opera Mini.
- * @property mobile
- * @type string
- * @static
- */
- mobile: null,
-
- /**
- * Adobe AIR version number or 0. Only populated if webkit is detected.
- * Example: 1.0
- * @property air
- * @type float
- */
- air: 0,
- /**
- * Detects Apple iPad's OS version
- * @property ipad
- * @type float
- * @static
- */
- ipad: 0,
- /**
- * Detects Apple iPhone's OS version
- * @property iphone
- * @type float
- * @static
- */
- iphone: 0,
- /**
- * Detects Apples iPod's OS version
- * @property ipod
- * @type float
- * @static
- */
- ipod: 0,
- /**
- * General truthy check for iPad, iPhone or iPod
- * @property ios
- * @type float
- * @static
- */
- ios: null,
- /**
- * Detects Googles Android OS version
- * @property android
- * @type float
- * @static
- */
- android: 0,
- /**
- * Detects Palms WebOS version
- * @property webos
- * @type float
- * @static
- */
- webos: 0,
-
- /**
- * Google Caja version number or 0.
- * @property caja
- * @type float
- */
- caja: nav && nav.cajaVersion,
-
- /**
- * Set to true if the page appears to be in SSL
- * @property secure
- * @type boolean
- * @static
- */
- secure: false,
-
- /**
- * The operating system. Currently only detecting windows or macintosh
- * @property os
- * @type string
- * @static
- */
- os: null
-
- },
-
- ua = agent || (navigator && navigator.userAgent),
-
- loc = window && window.location,
-
- href = loc && loc.href,
-
- m;
-
- o.secure = href && (href.toLowerCase().indexOf("https") === 0);
-
- if (ua) {
-
- if ((/windows|win32/i).test(ua)) {
- o.os = 'windows';
- } else if ((/macintosh/i).test(ua)) {
- o.os = 'macintosh';
- } else if ((/rhino/i).test(ua)) {
- o.os = 'rhino';
- }
-
- // Modern KHTML browsers should qualify as Safari X-Grade
- if ((/KHTML/).test(ua)) {
- o.webkit = 1;
- }
- // Modern WebKit browsers are at least X-Grade
- m = ua.match(/AppleWebKit\/([^\s]*)/);
- if (m && m[1]) {
- o.webkit = numberify(m[1]);
-
- // Mobile browser check
- if (/ Mobile\//.test(ua)) {
- o.mobile = 'Apple'; // iPhone or iPod Touch
-
- m = ua.match(/OS ([^\s]*)/);
- if (m && m[1]) {
- m = numberify(m[1].replace('_', '.'));
- }
- o.ios = m;
- o.ipad = o.ipod = o.iphone = 0;
-
- m = ua.match(/iPad|iPod|iPhone/);
- if (m && m[0]) {
- o[m[0].toLowerCase()] = o.ios;
- }
- } else {
- m = ua.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/);
- if (m) {
- // Nokia N-series, Android, webOS, ex: NokiaN95
- o.mobile = m[0];
- }
- if (/webOS/.test(ua)) {
- o.mobile = 'WebOS';
- m = ua.match(/webOS\/([^\s]*);/);
- if (m && m[1]) {
- o.webos = numberify(m[1]);
- }
- }
- if (/ Android/.test(ua)) {
- o.mobile = 'Android';
- m = ua.match(/Android ([^\s]*);/);
- if (m && m[1]) {
- o.android = numberify(m[1]);
- }
-
- }
- }
-
- m = ua.match(/Chrome\/([^\s]*)/);
- if (m && m[1]) {
- o.chrome = numberify(m[1]); // Chrome
- } else {
- m = ua.match(/AdobeAIR\/([^\s]*)/);
- if (m) {
- o.air = m[0]; // Adobe AIR 1.0 or better
- }
- }
- }
-
- if (!o.webkit) { // not webkit
-// @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr)
- m = ua.match(/Opera[\s\/]([^\s]*)/);
- if (m && m[1]) {
- o.opera = numberify(m[1]);
- m = ua.match(/Version\/([^\s]*)/);
- if (m && m[1]) {
- o.opera = numberify(m[1]); // opera 10+
- }
- m = ua.match(/Opera Mini[^;]*/);
- if (m) {
- o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316
- }
- } else { // not opera or webkit
- m = ua.match(/MSIE\s([^;]*)/);
- if (m && m[1]) {
- o.ie = numberify(m[1]);
- } else { // not opera, webkit, or ie
- m = ua.match(/Gecko\/([^\s]*)/);
- if (m) {
- o.gecko = 1; // Gecko detected, look for revision
- m = ua.match(/rv:([^\s\)]*)/);
- if (m && m[1]) {
- o.gecko = numberify(m[1]);
- }
- }
- }
- }
- }
- }
-
- return o;
-};
-
-YAHOO.env.ua = YAHOO.env.parseUA();
-
-/*
- * Initializes the global by creating the default namespaces and applying
- * any new configuration information that is detected. This is the setup
- * for env.
- * @method init
- * @static
- * @private
- */
-(function() {
- YAHOO.namespace("util", "widget", "example");
- /*global YAHOO_config*/
- if ("undefined" !== typeof YAHOO_config) {
- var l=YAHOO_config.listener, ls=YAHOO.env.listeners,unique=true, i;
- if (l) {
- // if YAHOO is loaded multiple times we need to check to see if
- // this is a new config object. If it is, add the new component
- // load listener to the stack
- for (i=0; i': '>',
- '"': '"',
- "'": ''',
- '/': '/',
- '`': '`'
- },
-
- // ADD = ["toString", "valueOf", "hasOwnProperty"],
- ADD = ["toString", "valueOf"],
-
- OB = {
-
- /**
- * Determines wheather or not the provided object is an array.
- * @method isArray
- * @param {any} o The object being testing
- * @return {boolean} the result
- */
- isArray: function(o) {
- return OP.toString.apply(o) === ARRAY_TOSTRING;
- },
-
- /**
- * Determines whether or not the provided object is a boolean
- * @method isBoolean
- * @param {any} o The object being testing
- * @return {boolean} the result
- */
- isBoolean: function(o) {
- return typeof o === 'boolean';
- },
-
- /**
- * Determines whether or not the provided object is a function.
- * Note: Internet Explorer thinks certain functions are objects:
- *
- * var obj = document.createElement("object");
- * YAHOO.lang.isFunction(obj.getAttribute) // reports false in IE
- *
- * var input = document.createElement("input"); // append to body
- * YAHOO.lang.isFunction(input.focus) // reports false in IE
- *
- * You will have to implement additional tests if these functions
- * matter to you.
- *
- * @method isFunction
- * @param {any} o The object being testing
- * @return {boolean} the result
- */
- isFunction: function(o) {
- return (typeof o === 'function') || OP.toString.apply(o) === FUNCTION_TOSTRING;
- },
-
- /**
- * Determines whether or not the provided object is null
- * @method isNull
- * @param {any} o The object being testing
- * @return {boolean} the result
- */
- isNull: function(o) {
- return o === null;
- },
-
- /**
- * Determines whether or not the provided object is a legal number
- * @method isNumber
- * @param {any} o The object being testing
- * @return {boolean} the result
- */
- isNumber: function(o) {
- return typeof o === 'number' && isFinite(o);
- },
-
- /**
- * Determines whether or not the provided object is of type object
- * or function
- * @method isObject
- * @param {any} o The object being testing
- * @return {boolean} the result
- */
- isObject: function(o) {
-return (o && (typeof o === 'object' || L.isFunction(o))) || false;
- },
-
- /**
- * Determines whether or not the provided object is a string
- * @method isString
- * @param {any} o The object being testing
- * @return {boolean} the result
- */
- isString: function(o) {
- return typeof o === 'string';
- },
-
- /**
- * Determines whether or not the provided object is undefined
- * @method isUndefined
- * @param {any} o The object being testing
- * @return {boolean} the result
- */
- isUndefined: function(o) {
- return typeof o === 'undefined';
- },
-
-
- /**
- * IE will not enumerate native functions in a derived object even if the
- * function was overridden. This is a workaround for specific functions
- * we care about on the Object prototype.
- * @property _IEEnumFix
- * @param {Function} r the object to receive the augmentation
- * @param {Function} s the object that supplies the properties to augment
- * @static
- * @private
- */
- _IEEnumFix: (YAHOO.env.ua.ie) ? function(r, s) {
- var i, fname, f;
- for (i=0;i
- * Returns a copy of the specified string with special HTML characters
- * escaped. The following characters will be converted to their
- * corresponding character entities:
- * & < > " ' / `
- *
- *
- *
- * This implementation is based on the
- * OWASP
- * HTML escaping recommendations . In addition to the characters
- * in the OWASP recommendation, we also escape the `
- * character, since IE interprets it as an attribute delimiter when used in
- * innerHTML.
- *
- *
- * @method escapeHTML
- * @param {String} html String to escape.
- * @return {String} Escaped string.
- * @static
- * @since 2.9.0
- */
- escapeHTML: function (html) {
- return html.replace(/[&<>"'\/`]/g, function (match) {
- return HTML_CHARS[match];
- });
- },
-
- /**
- * Utility to set up the prototype, constructor and superclass properties to
- * support an inheritance strategy that can chain constructors and methods.
- * Static members will not be inherited.
- *
- * @method extend
- * @static
- * @param {Function} subc the object to modify
- * @param {Function} superc the object to inherit
- * @param {Object} overrides additional properties/methods to add to the
- * subclass prototype. These will override the
- * matching items obtained from the superclass
- * if present.
- */
- extend: function(subc, superc, overrides) {
- if (!superc||!subc) {
- throw new Error("extend failed, please check that " +
- "all dependencies are included.");
- }
- var F = function() {}, i;
- F.prototype=superc.prototype;
- subc.prototype=new F();
- subc.prototype.constructor=subc;
- subc.superclass=superc.prototype;
- if (superc.prototype.constructor == OP.constructor) {
- superc.prototype.constructor=superc;
- }
-
- if (overrides) {
- for (i in overrides) {
- if (L.hasOwnProperty(overrides, i)) {
- subc.prototype[i]=overrides[i];
- }
- }
-
- L._IEEnumFix(subc.prototype, overrides);
- }
- },
-
- /**
- * Applies all properties in the supplier to the receiver if the
- * receiver does not have these properties yet. Optionally, one or
- * more methods/properties can be specified (as additional
- * parameters). This option will overwrite the property if receiver
- * has it already. If true is passed as the third parameter, all
- * properties will be applied and _will_ overwrite properties in
- * the receiver.
- *
- * @method augmentObject
- * @static
- * @since 2.3.0
- * @param {Function} r the object to receive the augmentation
- * @param {Function} s the object that supplies the properties to augment
- * @param {String*|boolean} arguments zero or more properties methods
- * to augment the receiver with. If none specified, everything
- * in the supplier will be used unless it would
- * overwrite an existing property in the receiver. If true
- * is specified as the third parameter, all properties will
- * be applied and will overwrite an existing property in
- * the receiver
- */
- augmentObject: function(r, s) {
- if (!s||!r) {
- throw new Error("Absorb failed, verify dependencies.");
- }
- var a=arguments, i, p, overrideList=a[2];
- if (overrideList && overrideList!==true) { // only absorb the specified properties
- for (i=2; i 0) ? L.dump(o[i], d-1) : OBJ);
- } else {
- s.push(o[i]);
- }
- s.push(COMMA);
- }
- if (s.length > 1) {
- s.pop();
- }
- s.push("]");
- // objects {k1 => v1, k2 => v2}
- } else {
- s.push("{");
- for (i in o) {
- if (L.hasOwnProperty(o, i)) {
- s.push(i + ARROW);
- if (L.isObject(o[i])) {
- s.push((d > 0) ? L.dump(o[i], d-1) : OBJ);
- } else {
- s.push(o[i]);
- }
- s.push(COMMA);
- }
- }
- if (s.length > 1) {
- s.pop();
- }
- s.push("}");
- }
-
- return s.join("");
- },
-
- /**
- * Does variable substitution on a string. It scans through the string
- * looking for expressions enclosed in { } braces. If an expression
- * is found, it is used a key on the object. If there is a space in
- * the key, the first word is used for the key and the rest is provided
- * to an optional function to be used to programatically determine the
- * value (the extra information might be used for this decision). If
- * the value for the key in the object, or what is returned from the
- * function has a string value, number value, or object value, it is
- * substituted for the bracket expression and it repeats. If this
- * value is an object, it uses the Object's toString() if this has
- * been overridden, otherwise it does a shallow dump of the key/value
- * pairs.
- *
- * By specifying the recurse option, the string is rescanned after
- * every replacement, allowing for nested template substitutions.
- * The side effect of this option is that curly braces in the
- * replacement content must be encoded.
- *
- * @method substitute
- * @since 2.3.0
- * @param s {String} The string that will be modified.
- * @param o {Object} An object containing the replacement values
- * @param f {Function} An optional function that can be used to
- * process each match. It receives the key,
- * value, and any extra metadata included with
- * the key inside of the braces.
- * @param recurse {boolean} default true - if not false, the replaced
- * string will be rescanned so that nested substitutions are possible.
- * @return {String} the substituted string
- */
- substitute: function (s, o, f, recurse) {
- var i, j, k, key, v, meta, saved=[], token, lidx=s.length,
- DUMP='dump', SPACE=' ', LBRACE='{', RBRACE='}',
- dump, objstr;
-
- for (;;) {
- i = s.lastIndexOf(LBRACE, lidx);
- if (i < 0) {
- break;
- }
- j = s.indexOf(RBRACE, i);
- if (i + 1 > j) {
- break;
- }
-
- //Extract key and meta info
- token = s.substring(i + 1, j);
- key = token;
- meta = null;
- k = key.indexOf(SPACE);
- if (k > -1) {
- meta = key.substring(k + 1);
- key = key.substring(0, k);
- }
-
- // lookup the value
- v = o[key];
-
- // if a substitution function was provided, execute it
- if (f) {
- v = f(key, v, meta);
- }
-
- if (L.isObject(v)) {
- if (L.isArray(v)) {
- v = L.dump(v, parseInt(meta, 10));
- } else {
- meta = meta || "";
-
- // look for the keyword 'dump', if found force obj dump
- dump = meta.indexOf(DUMP);
- if (dump > -1) {
- meta = meta.substring(4);
- }
-
- objstr = v.toString();
-
- // use the toString if it is not the Object toString
- // and the 'dump' meta info was not found
- if (objstr === OBJECT_TOSTRING || dump > -1) {
- v = L.dump(v, parseInt(meta, 10));
- } else {
- v = objstr;
- }
- }
- } else if (!L.isString(v) && !L.isNumber(v)) {
- // This {block} has no replace string. Save it for later.
- v = "~-" + saved.length + "-~";
- saved[saved.length] = token;
-
- // break;
- }
-
- s = s.substring(0, i) + v + s.substring(j + 1);
-
- if (recurse === false) {
- lidx = i-1;
- }
-
- }
-
- // restore saved {block}s
- for (i=saved.length-1; i>=0; i=i-1) {
- s = s.replace(new RegExp("~-" + i + "-~"), "{" + saved[i] + "}", "g");
- }
-
- return s;
- },
-
-
- /**
- * Returns a string without any leading or trailing whitespace. If
- * the input is not a string, the input will be returned untouched.
- * @method trim
- * @since 2.3.0
- * @param s {string} the string to trim
- * @return {string} the trimmed string
- */
- trim: function(s){
- try {
- return s.replace(/^\s+|\s+$/g, "");
- } catch(e) {
- return s;
- }
- },
-
- /**
- * Returns a new object containing all of the properties of
- * all the supplied objects. The properties from later objects
- * will overwrite those in earlier objects.
- * @method merge
- * @since 2.3.0
- * @param arguments {Object*} the objects to merge
- * @return the new merged object
- */
- merge: function() {
- var o={}, a=arguments, l=a.length, i;
- for (i=0; i
- * var A = function() {};
- * A.prototype.foo = 'foo';
- * var a = new A();
- * a.foo = 'foo';
- * alert(a.hasOwnProperty('foo')); // true
- * alert(YAHOO.lang.hasOwnProperty(a, 'foo')); // false when using fallback
- *
- * @method hasOwnProperty
- * @param {any} o The object being testing
- * @param prop {string} the name of the property to test
- * @return {boolean} the result
- */
-L.hasOwnProperty = (OP.hasOwnProperty) ?
- function(o, prop) {
- return o && o.hasOwnProperty && o.hasOwnProperty(prop);
- } : function(o, prop) {
- return !L.isUndefined(o[prop]) &&
- o.constructor.prototype[prop] !== o[prop];
- };
-
-// new lang wins
-OB.augmentObject(L, OB, true);
-
-/*
- * An alias for YAHOO.lang
- * @class YAHOO.util.Lang
- */
-YAHOO.util.Lang = L;
-
-/**
- * Same as YAHOO.lang.augmentObject, except it only applies prototype
- * properties. This is an alias for augmentProto.
- * @see YAHOO.lang.augmentObject
- * @method augment
- * @static
- * @param {Function} r the object to receive the augmentation
- * @param {Function} s the object that supplies the properties to augment
- * @param {String*|boolean} arguments zero or more properties methods to
- * augment the receiver with. If none specified, everything
- * in the supplier will be used unless it would
- * overwrite an existing property in the receiver. if true
- * is specified as the third parameter, all properties will
- * be applied and will overwrite an existing property in
- * the receiver
- */
-L.augment = L.augmentProto;
-
-/**
- * An alias for YAHOO.lang.augment
- * @for YAHOO
- * @method augment
- * @static
- * @param {Function} r the object to receive the augmentation
- * @param {Function} s the object that supplies the properties to augment
- * @param {String*} arguments zero or more properties methods to
- * augment the receiver with. If none specified, everything
- * in the supplier will be used unless it would
- * overwrite an existing property in the receiver
- */
-YAHOO.augment = L.augmentProto;
-
-/**
- * An alias for YAHOO.lang.extend
- * @method extend
- * @static
- * @param {Function} subc the object to modify
- * @param {Function} superc the object to inherit
- * @param {Object} overrides additional properties/methods to add to the
- * subclass prototype. These will override the
- * matching items obtained from the superclass if present.
- */
-YAHOO.extend = L.extend;
-
-})();
-YAHOO.register("yahoo", YAHOO, {version: "2.9.0", build: "2800"});
diff --git a/jwt/index.html b/jwt/index.html
deleted file mode 100755
index 31aa213..0000000
--- a/jwt/index.html
+++ /dev/null
@@ -1,255 +0,0 @@
-
-
-
-
-
-
-
-
-jsrsasign - cryptography library in JavaScript
-
-
-
-
-
-
-
-
-
-
-
-
-FEATURES
-The 'jsrsasign' library provides following features in pure JavaScript.
-
-
-NEWS
-
-2016-Feb-28 :
-
-Release 5.0.6 is now available.
-Now jsrsasign can be used in strict mode (--use_strict) of Node.JS.
-
-2015-Nov-23 :
-
-Release 5.0.4 is now available.
-There is no library and npm update but
-sample Node scirpts
- are added. Especially I hope jwtverify tool is very useful for JOSE guys :).
-
-2015-Nov-11 :
-
-Release 5.0.2 is now available.
-RFC 7638 JWK thumbprint
-supported.
-Some file read/save functions added for Node.js
-in nodeutil.js .
-
-2015-Oct-14 :
-
-Release 5.0.0 is now available.
-
-Mac class some issue fix and extra features for Mac passwords.
-It is also affects to JWS class .
-KEYUTIL.getKey supports
-RSA JWK without P/Q/DP/DQ/COEFF.
-NOTICE: Release 4.10.0 was declined because of semver violation.
-
-2015-Sep-15 :
-Keypair and CSR generator demonstration page is available.
-
-2015-Sep-13 :
-Release 4.9.0 is now available.
-Certificate signing request (CSR/PKCS#10) support is added.
-
-
-Old news is here .
-
-
-
-
-
-
-DOWNLOAD
-
-
-Use git to clonse the official jsrsasign repository
-git clone git://github.com/kjur/jsrsasign.git otherwise
-bower install jsrsasign
-
-
-Alternatively, you can download a zip file for the
-latest development version
-or a previous releases .
-
-
-See 'ChangeLog.txt' in detail.
-
-
-
-The 'jsrsasign'(RSA-Sign JavaScript Library) JavaScript API
-document is available here .
-
-
-The 'jsrsasign'(RSA-Sign JavaScript Library) is licensed under the terms of
-the MIT license reproduced which is simple and easy to understand and places
-almost no restrictions.
-
-
-PROGRAMMING TUTORIALS
-
-
-You can see the list of QUnit unit tests here
-and I hope they help you understand 'jsrsasign' library and APIs.
-
-
-
-PROJECTS THAT USE JSRSASIGN
-
-
-
-jwcrypto
-
-JavaScript implementation of JWS, JWT and JWC. The jycrypto is also used by
-Mozilla BrowserID/Persona .
-(used here)
-
-
-jwt-js
-
- JSON Web Tokens implemented in pure JavaScript.
-(used here)
-
-
-npm node-bignumber
-
-A pure javascript implementation of BigIntegers and RSA crypto for Node.js
-(used here)
-
-
-npm bignumber-jt
-
-A pure javascript implementation of BigIntegers and RSA crypto.
-(used here)
-
-
-NDN.JS
-
-a JavaScript client library for Named Data Networking of Univ. of Memphis.
-(used here)
-
-
-cryptio
-
-An easy-to-use encryption system utilizing RSA and AES for javascript.
-(used here)
-
-
-jspackcrx
-
-Package Chrome extension files using pure JavaScript.
-(used here)
-
-
-xml-signer
-
-xmldsig signatures in a browser
-(used here)
-
-
-
-
-DEPENDENCY
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/jwt/index_alg.html b/jwt/index_alg.html
deleted file mode 100755
index e0b9d01..0000000
--- a/jwt/index_alg.html
+++ /dev/null
@@ -1,134 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-jsjws - supported algorithm table
-
-
-
-
-
-
-
-
-
-
-
-for jsrsasign 4.2.0: LAST UPDATE: 2013-Oct-07
-
-Here is the list of supported algortihms in jsrsasign.
-
-
-
-
-Function
-Algorithm
-Note
-
-
-
-Signature algorithm
-RSA, RSAPSS, ECDSA, DSA
-
-based on
-Tom Wu's Lib(RSA) ,
-David Halls's contribution(RSAPSS) ,
-BitCoinJS(ECDSA) and
-OpenPGP.js(DSA).
-
-
-
-
-Message authentication code
-Hmac{MD5,SHA1,SHA224,SHA256,SHA384,SHA512}
-
-based on CryptoJS
-
-
-
-
-Message digest
-MD5,SHA{1,224,256,384,512},RIPEMD160
-
-based on CryptoJS and
-SJCL
-
-
-
-
-Named curves of elliptic curve cryptography
-secp256r1,secp256k1,secp384r1
-
-based on BitCoinJS and
-Tom Wu's Lib
-
-
-
-
-key protection algorithm for PKCS#8 encrypted private key
-PBKDF2/HmacSHA1/3DES
-
-based on CryptoJS
-
-
-
-
-key protection algorithm for PKCS#5 encrypted private key
-DES-CBC, DES-EDE3-CBC, AES-{128,192,256}-CBC
-based on CryptoJS
-
-
-
-
-Back to TOP .
-
-
-
-
-
-
-
-
-
-
-
diff --git a/jwt/index_jws.html b/jwt/index_jws.html
deleted file mode 100755
index c4b1495..0000000
--- a/jwt/index_jws.html
+++ /dev/null
@@ -1,261 +0,0 @@
-
-
-
-
-
-
-
-
-jsjws: pure JavaScript JSON Web Signature library (now a part of jsrsasign)
-
-
-
-
-
-
-
-
-
-
-
-
-JSON Web Signature(JWS) is a specification for signing JSON data structure
-defined in OpenID community
-[1]
-and IETF
-[2]
-and one of
-basic component for OpenID ABC or OpenID Connect .
-The 'jsjws'(JSON Web Signature JavaScript Library) is a pure open source free JavaScript
-implementation of it.
-Furthermore, 'jsjws' provides JSON Web Signature JSON Serialization (JWS-JS)
-[3]
-which is a kind of parallel or independent signature format by multiple signers.
-
-FEATURES
-
-sign and verify a JSON Web Token(JWT) and Signature(JWS) with RSA/RSAPSS/ECDSA algorithm
-implemented by pure JavaScript
-work on any modern browsers including smart phones
-supports all algorithms except ES512 (i.e. jsjws now supports
- HS256, HS384, HS512, RS256, RS384, RS512, ES256, ES384, PS256, PS384, PS512)
-powerful and easy 'sign' and 'verify' method.
-used with naked key, X.509 certificate and PKCS#5/PKCS#8 encrypted/plain private/public key
-supports UTF-8 characters including CJK, Latin and non-ASCII in JWS Header and Payload
-sign and verify a JSON Web Signature JSON Serialization (JWS-JS)
-
-
-
-NEWS
-
-2015-May-29 :
-
-Now jsjws is merged into jsrsasign 4.8.0 .
-There is no further update at github jsjws repository .
-Please watch jsrsasign.
-
- 2015-Apr-26 :
-
-3.2.2 released. Bugfix release for safe JSON strings and samples..
-
- 2015-Apr-19 :
-
-3.2.0 released. Mitigation for some signature replacement attacks in JWS.verify .
-Great thanks to Alberto Pose for suggestions.
-
- 2015-Apr-04 :
-
-3.1.0 released. alg=none support have been removed in the verify method to resolve the same issue . Thank you kindly, Adriano Raiano, David Halls, Alberto Pose and JPCERT/CC.
-
- 2013-Oct-07 :
-Node.js npm module of jsrsasign is now registered in the repository. It also includes this 'jsjws' .
-
- 2013-Sep-24
-
-3.0.2 released. Now supports HS384 (HmacSHA384) signature
-by CryptoJS patch.
-
- 2013-Sep-04
-
-The jsjws page for iPhone and Android is now available.
-JWT siging/verifying demo for smart phone
-is also available.
-
- 2013-Aug-29
-
-Document "Algorithm Support Matrix for JWT/JWS Implementations" added.
- 2013-Aug-28
-
-
- 2013-Aug-27 :
-Release 3.0.0
-
-provides powerful and easy signing
-and verifying method.
-add ECDSA and HMAC support
-add PKCS#5 and PKCS#8 encrypted/plain private key support
-QUnit unit tests added
-
- 2013-Jul-23 :
-Release 2.0.1 to fix RSAPSS signatures.
- 2013-Jul-21 :
-Release 2.0 is now available to support PS{256,512} (i.e. SHA256/512withRSAPSS) signature algorithm.
- 2012-May-21 :
-Release 1.2 is now available to add JWS-JS parallel signature support.
- 2012-May-07 :
-Release 1.1 is available. Following features are added.
-
-UTF-8 string support in JWS Header and Payload
-sign JWS with PEM formatted PKCS# RSA private key without passcode
-verify JWS with PEM formatted X.509 certificate
-
-
-
-
-
-
-DEMO
-
-
-DOWNLOAD
-
-
-See 'ChangeLog.txt' in detail.
-
-
-The 'jsjws'(JSON Web Signature JavaScript Library) JavaScript API
-document is available here .
-
-
-The 'jsjws'(JSON Web Signature JavaScript Library) is licensed under the terms of
-the MIT license reproduced which is simple and easy to understand and places
-almost no restrictions.
-
-
-MY RELATED PROJECT
-
-
-RELATED LINKS
-
-
-INCLUDED THIRD-PARTY LIBRARIES
-
-
-WHAT IS JWS?
-
-JSON Web Signature(JWS) is a simple signature format for signing small JSON data
-and will be used to exchange an authentication data for
-OpenID Connect .
-Any JWS data is represented in a printable text since it consists of
-Base64URL encoded characters and period('.').
-Following figure shows how JWS signature will be generated.
-
-
-
-See following pages for detail.
-
-
-
-WHAT IS JWS-JS?
-
-JSON Web Signature JSON Serialization (JWS-JS) is a signature format to
-sign a data by a number of signers independently.
-This way of signing is called parallel or independent signature in general.
-Following figure shows how JWS-JS signature will be generated.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/jwt/index_jws_gen.png b/jwt/index_jws_gen.png
deleted file mode 100755
index 284f947..0000000
Binary files a/jwt/index_jws_gen.png and /dev/null differ
diff --git a/jwt/index_jws_genjs.png b/jwt/index_jws_genjs.png
deleted file mode 100755
index cc7bf18..0000000
Binary files a/jwt/index_jws_genjs.png and /dev/null differ
diff --git a/jwt/index_jwsmat.html b/jwt/index_jwsmat.html
deleted file mode 100755
index 7ec8e5e..0000000
--- a/jwt/index_jwsmat.html
+++ /dev/null
@@ -1,430 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-jsjws - Algorithm Support Matrix of JWT/JWS implementations
-
-
-
-
-
-
-
-
-
-
-
-LAST UPDATE: 2014-Jun-06
-
-There are many implementations of JWT/JWS and
-below shows which algorithms are supported.
-If you know any aother implementation or find a mistake in the table
-please let me know.
-
-
-
-
-impl
-language
-HS256
-HS384
-HS512
-RS256
-RS384
-RS512
-ES256
-ES384
-ES512
-PS256
-PS384
-PS512
-none
-Crypto Lib
-
-
-
-jsjws
-JavaScript
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-—
-✔
-✔
-✔
-—
-
-Tom Wu's RSA ,
-jsrsasign ,
-CryptoJS ,
-sjcl
-
-
-
-
-node-jsjws
-JavaScript
-—
-—
-—
-✔
-✔
-✔
-—
-—
-—
-✔
-✔
-✔
-—
-
-Tom Wu's RSA ,
-jsrsasign ,
-CryptoJS ,
-sjcl
-
-
-
-
-jwt-node
-JavaScript
-✔
-—
-—
-✔
-—
-—
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-
-Tom Wu's RSA ,
-jsrsasign
-
-
-
-
-jwt-js
-JavaScript
-—
-—
-—
-✔
-—
-—
-—
-—
-—
-—
-—
-—
-—
-
-Tom Wu's RSA ,
-jsrsasign
-
-
-
-
-jwcrypto
-JavaScript
-—
-—
-—
-✔
-—
-—
-—
-—
-—
-—
-—
-—
-—
-
-Tom Wu's RSA ,
-jsrsasign ,
-sjcl
-
-
-
-
-green-jwt
-JavaScript
-✔
-✔
-✔
-✔
-✔
-✔
-—
-—
-—
-—
-—
-—
-✔
-
-node-crypto
-
-
-
-
-jose.4.j
-Java
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-
-Default JCE
-
-
-
-
-Nimbus JWT
-Java
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-—
-—
-—
-—
-
-BouncyCastle
-
-
-
-
-json-jwt
-Ruby
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-—
-—
-—
-—
-Ruby(OpenSSL)
-
-
-
-jws
-Python
-✔
-✔
-✔
-✔
-—
-—
-✔
-✔
-✔
-—
-—
-—
-—
-hashlib, ecdsa, Crypto.PublicKey.RSA module
-
-
-
-pyjwkest
-Python
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-—
-—
-—
-—
-—
-✔
-
-M2Crypto
-
-
-
-
-php Akita JOSE
-PHP
-✔
-✔
-✔
-✔
-✔
-✔
-—
-—
-—
-—
-—
-—
-✔
-?
-
-
-
-p5 JSON WebToken
-Perl
-✔
-✔
-✔
-✔
-✔
-✔
-—
-—
-—
-—
-—
-—
-—
-Digest::SHA, Crypt::OpenSSL::RSA module
-
-
-
-jwt for .NET
-C#
-✔
-✔
-✔
-—
-—
-—
-—
-—
-—
-—
-—
-—
-—
-CNG,CAPI
-
-
-
-mod_auth_openidc
-C
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-—
-OpenSSL
-
-
-
-JOSE JWT .NET
-PHP
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-✔
-
-
-
-
-
-Back to TOP .
-
-
-
-
-
-
-
-
-
-
-
diff --git a/jwt/index_jwsut.html b/jwt/index_jwsut.html
deleted file mode 100755
index 77f9d66..0000000
--- a/jwt/index_jwsut.html
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
-
-
-
-
-jsjws Unit Tests
-
-
-
-
-
-
-
-
-
-
-
-Unit Tests
-Unit tests for jsrsasign are done using QUnit framework.
-This may be useful for examples to learn 'jsjws' library.
-
-
-Back to TOP .
-
-
-
-
-
-
-
-
-
-
-
diff --git a/jwt/index_oldnews.html b/jwt/index_oldnews.html
deleted file mode 100755
index 8b38b47..0000000
--- a/jwt/index_oldnews.html
+++ /dev/null
@@ -1,294 +0,0 @@
-
-
-
-
-
-
-
-
-
- jsrsasign Old News
-
-
-
-
-
-
-
-
-
-
-
-Old News
-
-
-
-2015-Jun-11 :
-Release 4.8.3 is now available.
-ASN1HEX.dump() ASN.1 dump functionality is added.
-ASN.1 dump tool is also available.
-
-2015-Jun-06 :
-Release 4.8.2 is now available.
-Small fix in
-KEYUTIL.getKey and
-npm jsrsasign officially released.
-
-2015-Jun-03 :
-Release 4.8.1 is now available.
-KEYUTIL.getKey method
-now supports RFC 7517 JSON Web Key(JWK) loading for RSA/ECC private/public key.
-
-2015-Jun-01 :
-Release 4.8.0 is now available. Now jsjws is
-marged into jsrsasign and is a part of jsrsasign.
-Full JSON Web Token(JWT) validation functionality and its demo is added. Bower support is also available.
-
-2015-May-22 :
-Release 4.7.2 is now available. Parsing X.509v3 extension methods added in X509 class.
-
- 2015-May-14 :
-Release 4.7.1 is now available. This is a small update. Please see ChangeLog.
-
- 2014-Jun-08 :
-Release 4.7.0 is now available.
-
-RFC 5126 CAdES Long Term Signature support
-Demo for CAdES BES/EPES/T is here .
-
-
-2014-May-26 :
-Release 4.6.0 is now available.
-
-RFC 3161 Time Stamp support
-Demo for time stamp request
-and response are available.
-
-
-2014-May-18 :
-Release 4.5.0 is now available.
-
-RFC 5652 CMS SignedData generation
-simple CMS SignedData generator tool
-
-
-
- 2014-Apr-19 :
-Release 4.2.2 is now available.
-
-PKCS#10 CSR(certificate signing request) support in keyutil.js
-AuthorityKeyIdentifier v3 extension support in asn1x509.js
-Fake certificate converter tool from CSR for factorable.net key check
-
-
- 2013-Oct-12 :
-Release 4.2.1 is now available.
-
-Add generic PEM private/public key exporting method KEYUTIL.getPEM and it provides support to export to PEM PKCS#8 encrypted private key.
-
-
- 2013-Oct-07 :
-Node.js npm module of jsrsasign is now registered in the repository. It also includes 'jsjws' .
-
- 2013-Oct-06 :
-Release 4.2.0 is now available.
-
-DSA/ECDSA algorithms is now supported most of class and methods like Signature, KEYUTIL, KJUR.asn1.x509 DSA
-KJUR.asn1.x509.X509Util.newCertPEM method to provide easy issuance of a certificate by JSON data.
-
-
- 2013-Oct-02 :
-Release 4.1.6 is now available.
-
-DSA signature algorithm support (However Signature and KEYUTIL class don't support yet)
-KEYUTIL.generateKeypair method added
-ASN1Util.jsonToASN1HEX method added
-HmacSHA384 support
-
-
- 2013-Sep-23 :
-Release 4.1.3 is now available.
-
-ASNUtil.newObject update for tagged object
-PKCS5PKEY class was moved to KEYUTIL class and KEYUTIL class has more generic getKey() method.
-
-
- 2013-Sep-12 :
-Release 4.1.2 is now available.
-
-
- 2013-Aug-25 :
-Release 4.1.0 is now available.
-
-RSAPSS support in Signature class.
-add useful init() method for Signature class
-add ECDSA support and getKey methods to PKCS5PKEY class
-
-
- 2013-Aug-17 :
-Release 4.0.5 is now available.
-
-Message authentication code (MAC) class added.
-
-
- 2013-Jul-23 :
-Release 4.0.2 is now available.
-
-RSAPSS signing and validation fix by Davegithub.com/davedoesdev)
-
-
- 2013-Jul-18 :
-Release 4.0.0 is now available.
-
-ECC key generation and ECDSA signing and verification support
-Currently supports secp256r1, secp256k1 and secp384r1 curves
-You can specify other curves such like secp192r1 or NIST P-521 however
-it can't be signed nor verified properly with other curves.
-I appreciate if you fix the bugs.
-
-
- 2013-May-29 :
-Release 3.1.3 is now available.
-
-
- 2013-May-27 :
-Release 3.1.2 is now available.
-
-add some methods to 'pkcs5pkey.js' to load encrypted PKCS#8 PEM private key.
-
-
- 2013-May-20 :
-Release 3.1.1 is now available.
-
-add some methods to 'pkcs5pkey.js' to generate encrypted PKCS#5 PEM private key.
-
-
- 2013-May-16 :
-Release 3.1.0 is now available.
-
-CRL class added to issue CRL.
-
-
- 2013-May-13 :
-Release 3.0.5 is now available.
-
-method getRSAKeyFromPlainPKCS8PEM added to PKCS5PKEY class to load
-unencrypted PEM formatted PKCS#8 private key.
-
-
- 2013-May-13 :
-Release 3.0.4 is now available.
-
-hash algorithm script rsasign-1.2.js uses was changed from Paul Johnstons's to CryptJS.
-static hash method md5,sha1,sha256,sha512,ripemd160 added to KJUR.crypto.Util
-
-
- 2013-May-12 :
-Release 3.0.3 is now available.
-
-ExtKeyUsage class added to asn1x509.js.
-
-
- 2013-May-12 :
-Release 3.0.2 is now available.
-
-Signature class now supports signature verification.
-
-
- 2013-May-12 :
-Release 3.0.1 is now available.
-
-MessageDigest/Signature class now supports MD5, SHA224, SHA256, SHA384, SHA512, RIPEMD160
-algorithms
-QUnit unit test codes also be published. This may be useful
-for examples.
-
-
- 2013-May-10 :
-Release 3.0.0 is now available.
-
-New feature: ASN.1 encoder class, MessageDigest, Signature class like Java JCE, certificate issuance.
-Merged contribution by David Halls. Thank you Dave!. Now jsrsasign supports PKCS#1 PSS and OAEP
-'JavaScript Certification Authority' sample tool added.
-
-
- 2013-Apr-14 :
-Release 2.0.0 is now available.
-
-Now support reading passcode encrypted PKCS#5 RSA private key in pkcs5pkey.js. See
- PKCS#5 sample .
-
-
- 2013-Apr-14 :
-Release 1.3.1 is now available.
-
-add readPrivateKeyFromASN1HexString method to rsapem-1.1.js
-
-
- 2012-May-11 :
-Release 1.3 is now available.
-
-enhanced X509 class support for getting basic certificate fields.
-enhanced ASN1HEX class to refer decendant ASN.1 data
-API document added.
-
-
- 2012-May-03 :
-Release 1.2.1 is released. Minified scripts are added.
-
- 2012-Apr-30 :
-Release 1.2 is available for fixing critical zero padding bug and supporting some other hash functions.
-
-
-
-Old News Summary
-
-Release 3.0.0: May 10, 2013 - ASN.1 encoder, MessageDigest and Signature class like Java JCE, PKCS#1 PSS and OAEP support
-Release 2.0.0: Apr 14, 2013 - encrypted PKCS#5 private key support
-Release 1.3.1: Apr 14, 2013 - add readPrivateKeyFromASN1HexString method to rsapem-1.1.js
-Release 1.3: Mar 11, 2012 - X509 and ASN1HEX class enhancement
-Release 1.2.1: Mar 3, 2012 - minified scripts (*.min.js) added
-Release 1.2: Apr 30, 2012 - Critical zero padding bug fix and some other hash support
-Release 1.1: Sep 25, 2010 - Web contents update
-Release 1.0: Jun 03, 2010 - Initial release at
-old site
-(www9.atwiki.jp/kurushima/pub/jsrsa/)
- .
-
-
-
-Back to TOP .
-
-
-
-
-
-
-
-
-
-
-
diff --git a/jwt/jsrsasign-latest-all-min.js b/jwt/jsrsasign-latest-all-min.js
deleted file mode 100644
index 258c702..0000000
--- a/jwt/jsrsasign-latest-all-min.js
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * jsrsasign 5.0.12 (c) 2010-2016 Kenji Urushima | kjur.github.com/jsrsasign/license
- */
-
-/*
-yahoo-min.js
-Copyright (c) 2011, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.com/yui/license.html
-version: 2.9.0
-*/
-if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={};}YAHOO.namespace=function(){var b=arguments,g=null,e,c,f;for(e=0;e":">",'"':""","'":"'","/":"/","`":"`"},d=["toString","valueOf"],e={isArray:function(j){return a.toString.apply(j)===c;},isBoolean:function(j){return typeof j==="boolean";},isFunction:function(j){return(typeof j==="function")||a.toString.apply(j)===h;},isNull:function(j){return j===null;},isNumber:function(j){return typeof j==="number"&&isFinite(j);},isObject:function(j){return(j&&(typeof j==="object"||f.isFunction(j)))||false;},isString:function(j){return typeof j==="string";},isUndefined:function(j){return typeof j==="undefined";},_IEEnumFix:(YAHOO.env.ua.ie)?function(l,k){var j,n,m;for(j=0;j"'\/`]/g,function(k){return g[k];});},extend:function(m,n,l){if(!n||!m){throw new Error("extend failed, please check that "+"all dependencies are included.");}var k=function(){},j;k.prototype=n.prototype;m.prototype=new k();m.prototype.constructor=m;m.superclass=n.prototype;if(n.prototype.constructor==a.constructor){n.prototype.constructor=n;}if(l){for(j in l){if(f.hasOwnProperty(l,j)){m.prototype[j]=l[j];}}f._IEEnumFix(m.prototype,l);}},augmentObject:function(n,m){if(!m||!n){throw new Error("Absorb failed, verify dependencies.");}var j=arguments,l,o,k=j[2];if(k&&k!==true){for(l=2;l ";if(!f.isObject(j)){return j+"";}else{if(j instanceof Date||("nodeType" in j&&"tagName" in j)){return j;}else{if(f.isFunction(j)){return k;}}}p=(f.isNumber(p))?p:3;if(f.isArray(j)){r.push("[");for(l=0,n=j.length;l0)?f.dump(j[l],p-1):t);}else{r.push(j[l]);}r.push(q);}if(r.length>1){r.pop();}r.push("]");}else{r.push("{");for(l in j){if(f.hasOwnProperty(j,l)){r.push(l+m);if(f.isObject(j[l])){r.push((p>0)?f.dump(j[l],p-1):t);}else{r.push(j[l]);}r.push(q);}}if(r.length>1){r.pop();}r.push("}");}return r.join("");},substitute:function(x,y,E,l){var D,C,B,G,t,u,F=[],p,z=x.length,A="dump",r=" ",q="{",m="}",n,w;for(;;){D=x.lastIndexOf(q,z);if(D<0){break;}C=x.indexOf(m,D);if(D+1>C){break;}p=x.substring(D+1,C);G=p;u=null;B=G.indexOf(r);if(B>-1){u=G.substring(B+1);G=G.substring(0,B);}t=y[G];if(E){t=E(G,t,u);}if(f.isObject(t)){if(f.isArray(t)){t=f.dump(t,parseInt(u,10));}else{u=u||"";n=u.indexOf(A);if(n>-1){u=u.substring(4);}w=t.toString();if(w===i||n>-1){t=f.dump(t,parseInt(u,10));}else{t=w;}}}else{if(!f.isString(t)&&!f.isNumber(t)){t="~-"+F.length+"-~";F[F.length]=p;}}x=x.substring(0,D)+t+x.substring(C+1);if(l===false){z=D-1;}}for(D=F.length-1;D>=0;D=D-1){x=x.replace(new RegExp("~-"+D+"-~"),"{"+F[D]+"}","g");}return x;},trim:function(j){try{return j.replace(/^\s+|\s+$/g,"");}catch(k){return j;
-}},merge:function(){var n={},k=arguments,j=k.length,m;for(m=0;m>>2]>>>(24-(r%4)*8))&255;q[(n+r)>>>2]|=o<<(24-((n+r)%4)*8)}}else{for(var r=0;r>>2]=p[r>>>2]}}this.sigBytes+=s;return this},clamp:function(){var o=this.words;var n=this.sigBytes;o[n>>>2]&=4294967295<<(32-(n%4)*8);o.length=e.ceil(n/4)},clone:function(){var n=j.clone.call(this);n.words=this.words.slice(0);return n},random:function(p){var o=[];for(var n=0;n >>2]>>>(24-(n%4)*8))&255;q.push((s>>>4).toString(16));q.push((s&15).toString(16))}return q.join("")},parse:function(p){var n=p.length;var q=[];for(var o=0;o>>3]|=parseInt(p.substr(o,2),16)<<(24-(o%8)*4)}return new l.init(q,n/2)}};var d=m.Latin1={stringify:function(q){var r=q.words;var p=q.sigBytes;var n=[];for(var o=0;o>>2]>>>(24-(o%4)*8))&255;n.push(String.fromCharCode(s))}return n.join("")},parse:function(p){var n=p.length;var q=[];for(var o=0;o>>2]|=(p.charCodeAt(o)&255)<<(24-(o%4)*8)}return new l.init(q,n)}};var c=m.Utf8={stringify:function(n){try{return decodeURIComponent(escape(d.stringify(n)))}catch(o){throw new Error("Malformed UTF-8 data")}},parse:function(n){return d.parse(unescape(encodeURIComponent(n)))}};var i=b.BufferedBlockAlgorithm=j.extend({reset:function(){this._data=new l.init();this._nDataBytes=0},_append:function(n){if(typeof n=="string"){n=c.parse(n)}this._data.concat(n);this._nDataBytes+=n.sigBytes},_process:function(w){var q=this._data;var x=q.words;var n=q.sigBytes;var t=this.blockSize;var v=t*4;var u=n/v;if(w){u=e.ceil(u)}else{u=e.max((u|0)-this._minBufferSize,0)}var s=u*t;var r=e.min(s*4,n);if(s){for(var p=0;p>>2]&255}};f.BlockCipher=n.extend({cfg:n.cfg.extend({mode:m,padding:h}),reset:function(){n.reset.call(this);var a=this.cfg,b=a.iv,a=a.mode;if(this._xformMode==this._ENC_XFORM_MODE)var c=a.createEncryptor;else c=a.createDecryptor,this._minBufferSize=1;
-this._mode=c.call(a,this,b&&b.words)},_doProcessBlock:function(a,b){this._mode.processBlock(a,b)},_doFinalize:function(){var a=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){a.pad(this._data,this.blockSize);var b=this._process(!0)}else b=this._process(!0),a.unpad(b);return b},blockSize:4});var p=f.CipherParams=k.extend({init:function(a){this.mixIn(a)},toString:function(a){return(a||this.formatter).stringify(this)}}),m=(g.format={}).OpenSSL={stringify:function(a){var b=a.ciphertext;a=a.salt;
-return(a?l.create([1398893684,1701076831]).concat(a).concat(b):b).toString(r)},parse:function(a){a=r.parse(a);var b=a.words;if(1398893684==b[0]&&1701076831==b[1]){var c=l.create(b.slice(2,4));b.splice(0,4);a.sigBytes-=16}return p.create({ciphertext:a,salt:c})}},j=f.SerializableCipher=k.extend({cfg:k.extend({format:m}),encrypt:function(a,b,c,d){d=this.cfg.extend(d);var e=a.createEncryptor(c,d);b=e.finalize(b);e=e.cfg;return p.create({ciphertext:b,key:c,iv:e.iv,algorithm:a,mode:e.mode,padding:e.padding,
-blockSize:a.blockSize,formatter:d.format})},decrypt:function(a,b,c,d){d=this.cfg.extend(d);b=this._parse(b,d.format);return a.createDecryptor(c,d).finalize(b.ciphertext)},_parse:function(a,b){return"string"==typeof a?b.parse(a,this):a}}),g=(g.kdf={}).OpenSSL={execute:function(a,b,c,d){d||(d=l.random(8));a=v.create({keySize:b+c}).compute(a,d);c=l.create(a.words.slice(b),4*c);a.sigBytes=4*b;return p.create({key:a,iv:c,salt:d})}},s=f.PasswordBasedCipher=j.extend({cfg:j.cfg.extend({kdf:g}),encrypt:function(a,
-b,c,d){d=this.cfg.extend(d);c=d.kdf.execute(c,a.keySize,a.ivSize);d.iv=c.iv;a=j.encrypt.call(this,a,b,c.key,d);a.mixIn(c);return a},decrypt:function(a,b,c,d){d=this.cfg.extend(d);b=this._parse(b,d.format);c=d.kdf.execute(c,a.keySize,a.ivSize,b.salt);d.iv=c.iv;return j.decrypt.call(this,a,b,c.key,d)}})}();
-
-/*
-CryptoJS v3.1.2 aes-min.js
-code.google.com/p/crypto-js
-(c) 2009-2013 by Jeff Mott. All rights reserved.
-code.google.com/p/crypto-js/wiki/License
-*/
-(function(){for(var q=CryptoJS,x=q.lib.BlockCipher,r=q.algo,j=[],y=[],z=[],A=[],B=[],C=[],s=[],u=[],v=[],w=[],g=[],k=0;256>k;k++)g[k]=128>k?k<<1:k<<1^283;for(var n=0,l=0,k=0;256>k;k++){var f=l^l<<1^l<<2^l<<3^l<<4,f=f>>>8^f&255^99;j[n]=f;y[f]=n;var t=g[n],D=g[t],E=g[D],b=257*g[f]^16843008*f;z[n]=b<<24|b>>>8;A[n]=b<<16|b>>>16;B[n]=b<<8|b>>>24;C[n]=b;b=16843009*E^65537*D^257*t^16843008*n;s[f]=b<<24|b>>>8;u[f]=b<<16|b>>>16;v[f]=b<<8|b>>>24;w[f]=b;n?(n=t^g[g[g[E^t]]],l^=g[g[l]]):n=l=1}var F=[0,1,2,4,8,
-16,32,64,128,27,54],r=r.AES=x.extend({_doReset:function(){for(var c=this._key,e=c.words,a=c.sigBytes/4,c=4*((this._nRounds=a+6)+1),b=this._keySchedule=[],h=0;h>>24]<<24|j[d>>>16&255]<<16|j[d>>>8&255]<<8|j[d&255]):(d=d<<8|d>>>24,d=j[d>>>24]<<24|j[d>>>16&255]<<16|j[d>>>8&255]<<8|j[d&255],d^=F[h/a|0]<<24);b[h]=b[h-a]^d}e=this._invKeySchedule=[];for(a=0;aa||4>=h?d:s[j[d>>>24]]^u[j[d>>>16&255]]^v[j[d>>>
-8&255]]^w[j[d&255]]},encryptBlock:function(c,e){this._doCryptBlock(c,e,this._keySchedule,z,A,B,C,j)},decryptBlock:function(c,e){var a=c[e+1];c[e+1]=c[e+3];c[e+3]=a;this._doCryptBlock(c,e,this._invKeySchedule,s,u,v,w,y);a=c[e+1];c[e+1]=c[e+3];c[e+3]=a},_doCryptBlock:function(c,e,a,b,h,d,j,m){for(var n=this._nRounds,f=c[e]^a[0],g=c[e+1]^a[1],k=c[e+2]^a[2],p=c[e+3]^a[3],l=4,t=1;t>>24]^h[g>>>16&255]^d[k>>>8&255]^j[p&255]^a[l++],r=b[g>>>24]^h[k>>>16&255]^d[p>>>8&255]^j[f&255]^a[l++],s=
-b[k>>>24]^h[p>>>16&255]^d[f>>>8&255]^j[g&255]^a[l++],p=b[p>>>24]^h[f>>>16&255]^d[g>>>8&255]^j[k&255]^a[l++],f=q,g=r,k=s;q=(m[f>>>24]<<24|m[g>>>16&255]<<16|m[k>>>8&255]<<8|m[p&255])^a[l++];r=(m[g>>>24]<<24|m[k>>>16&255]<<16|m[p>>>8&255]<<8|m[f&255])^a[l++];s=(m[k>>>24]<<24|m[p>>>16&255]<<16|m[f>>>8&255]<<8|m[g&255])^a[l++];p=(m[p>>>24]<<24|m[f>>>16&255]<<16|m[g>>>8&255]<<8|m[k&255])^a[l++];c[e]=q;c[e+1]=r;c[e+2]=s;c[e+3]=p},keySize:8});q.AES=x._createHelper(r)})();
-
-/*
-CryptoJS v3.1.2 tripledes-min.js
-code.google.com/p/crypto-js
-(c) 2009-2013 by Jeff Mott. All rights reserved.
-code.google.com/p/crypto-js/wiki/License
-*/
-(function(){function j(b,c){var a=(this._lBlock>>>b^this._rBlock)&c;this._rBlock^=a;this._lBlock^=a<>>b^this._lBlock)&c;this._lBlock^=a;this._rBlock^=a<a;a++){var f=q[a]-1;c[a]=b[f>>>5]>>>31-f%32&1}b=this._subKeys=[];for(f=0;16>f;f++){for(var d=b[f]=[],e=r[f],a=0;24>a;a++)d[a/6|0]|=c[(p[a]-1+e)%28]<<31-a%6,d[4+(a/6|0)]|=c[28+(p[a+24]-1+e)%28]<<31-a%6;d[0]=d[0]<<1|d[0]>>>31;for(a=1;7>a;a++)d[a]>>>=
-4*(a-1)+3;d[7]=d[7]<<5|d[7]>>>27}c=this._invSubKeys=[];for(a=0;16>a;a++)c[a]=b[15-a]},encryptBlock:function(b,c){this._doCryptBlock(b,c,this._subKeys)},decryptBlock:function(b,c){this._doCryptBlock(b,c,this._invSubKeys)},_doCryptBlock:function(b,c,a){this._lBlock=b[c];this._rBlock=b[c+1];j.call(this,4,252645135);j.call(this,16,65535);l.call(this,2,858993459);l.call(this,8,16711935);j.call(this,1,1431655765);for(var f=0;16>f;f++){for(var d=a[f],e=this._lBlock,h=this._rBlock,g=0,k=0;8>k;k++)g|=s[k][((h^
-d[k])&t[k])>>>0];this._lBlock=h;this._rBlock=e^g}a=this._lBlock;this._lBlock=this._rBlock;this._rBlock=a;j.call(this,1,1431655765);l.call(this,8,16711935);l.call(this,2,858993459);j.call(this,16,65535);j.call(this,4,252645135);b[c]=this._lBlock;b[c+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});h.DES=e._createHelper(m);g=g.TripleDES=e.extend({_doReset:function(){var b=this._key.words;this._des1=m.createEncryptor(n.create(b.slice(0,2)));this._des2=m.createEncryptor(n.create(b.slice(2,4)));this._des3=
-m.createEncryptor(n.create(b.slice(4,6)))},encryptBlock:function(b,c){this._des1.encryptBlock(b,c);this._des2.decryptBlock(b,c);this._des3.encryptBlock(b,c)},decryptBlock:function(b,c){this._des3.decryptBlock(b,c);this._des2.encryptBlock(b,c);this._des1.decryptBlock(b,c)},keySize:6,ivSize:2,blockSize:2});h.TripleDES=e._createHelper(g)})();
-
-/*
-CryptoJS v3.1.2 enc-base64-min.js
-code.google.com/p/crypto-js
-(c) 2009-2013 by Jeff Mott. All rights reserved.
-code.google.com/p/crypto-js/wiki/License
-*/
-(function(){var h=CryptoJS,j=h.lib.WordArray;h.enc.Base64={stringify:function(b){var e=b.words,f=b.sigBytes,c=this._map;b.clamp();b=[];for(var a=0;a>>2]>>>24-8*(a%4)&255)<<16|(e[a+1>>>2]>>>24-8*((a+1)%4)&255)<<8|e[a+2>>>2]>>>24-8*((a+2)%4)&255,g=0;4>g&&a+0.75*g>>6*(3-g)&63));if(e=c.charAt(64))for(;b.length%4;)b.push(e);return b.join("")},parse:function(b){var e=b.length,f=this._map,c=f.charAt(64);c&&(c=b.indexOf(c),-1!=c&&(e=c));for(var c=[],a=0,d=0;d<
-e;d++)if(d%4){var g=f.indexOf(b.charAt(d-1))<<2*(d%4),h=f.indexOf(b.charAt(d))>>>6-2*(d%4);c[a>>>2]|=(g|h)<<24-8*(a%4);a++}return j.create(c,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})();
-
-/*
-CryptoJS v3.1.2 md5-min.js
-code.google.com/p/crypto-js
-(c) 2009-2013 by Jeff Mott. All rights reserved.
-code.google.com/p/crypto-js/wiki/License
-*/
-(function(E){function h(a,f,g,j,p,h,k){a=a+(f&g|~f&j)+p+k;return(a<>>32-h)+f}function k(a,f,g,j,p,h,k){a=a+(f&j|g&~j)+p+k;return(a<>>32-h)+f}function l(a,f,g,j,h,k,l){a=a+(f^g^j)+h+l;return(a<>>32-k)+f}function n(a,f,g,j,h,k,l){a=a+(g^(f|~j))+h+l;return(a<>>32-k)+f}for(var r=CryptoJS,q=r.lib,F=q.WordArray,s=q.Hasher,q=r.algo,a=[],t=0;64>t;t++)a[t]=4294967296*E.abs(E.sin(t+1))|0;q=q.MD5=s.extend({_doReset:function(){this._hash=new F.init([1732584193,4023233417,2562383102,271733878])},
-_doProcessBlock:function(m,f){for(var g=0;16>g;g++){var j=f+g,p=m[j];m[j]=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360}var g=this._hash.words,j=m[f+0],p=m[f+1],q=m[f+2],r=m[f+3],s=m[f+4],t=m[f+5],u=m[f+6],v=m[f+7],w=m[f+8],x=m[f+9],y=m[f+10],z=m[f+11],A=m[f+12],B=m[f+13],C=m[f+14],D=m[f+15],b=g[0],c=g[1],d=g[2],e=g[3],b=h(b,c,d,e,j,7,a[0]),e=h(e,b,c,d,p,12,a[1]),d=h(d,e,b,c,q,17,a[2]),c=h(c,d,e,b,r,22,a[3]),b=h(b,c,d,e,s,7,a[4]),e=h(e,b,c,d,t,12,a[5]),d=h(d,e,b,c,u,17,a[6]),c=h(c,d,e,b,v,22,a[7]),
-b=h(b,c,d,e,w,7,a[8]),e=h(e,b,c,d,x,12,a[9]),d=h(d,e,b,c,y,17,a[10]),c=h(c,d,e,b,z,22,a[11]),b=h(b,c,d,e,A,7,a[12]),e=h(e,b,c,d,B,12,a[13]),d=h(d,e,b,c,C,17,a[14]),c=h(c,d,e,b,D,22,a[15]),b=k(b,c,d,e,p,5,a[16]),e=k(e,b,c,d,u,9,a[17]),d=k(d,e,b,c,z,14,a[18]),c=k(c,d,e,b,j,20,a[19]),b=k(b,c,d,e,t,5,a[20]),e=k(e,b,c,d,y,9,a[21]),d=k(d,e,b,c,D,14,a[22]),c=k(c,d,e,b,s,20,a[23]),b=k(b,c,d,e,x,5,a[24]),e=k(e,b,c,d,C,9,a[25]),d=k(d,e,b,c,r,14,a[26]),c=k(c,d,e,b,w,20,a[27]),b=k(b,c,d,e,B,5,a[28]),e=k(e,b,
-c,d,q,9,a[29]),d=k(d,e,b,c,v,14,a[30]),c=k(c,d,e,b,A,20,a[31]),b=l(b,c,d,e,t,4,a[32]),e=l(e,b,c,d,w,11,a[33]),d=l(d,e,b,c,z,16,a[34]),c=l(c,d,e,b,C,23,a[35]),b=l(b,c,d,e,p,4,a[36]),e=l(e,b,c,d,s,11,a[37]),d=l(d,e,b,c,v,16,a[38]),c=l(c,d,e,b,y,23,a[39]),b=l(b,c,d,e,B,4,a[40]),e=l(e,b,c,d,j,11,a[41]),d=l(d,e,b,c,r,16,a[42]),c=l(c,d,e,b,u,23,a[43]),b=l(b,c,d,e,x,4,a[44]),e=l(e,b,c,d,A,11,a[45]),d=l(d,e,b,c,D,16,a[46]),c=l(c,d,e,b,q,23,a[47]),b=n(b,c,d,e,j,6,a[48]),e=n(e,b,c,d,v,10,a[49]),d=n(d,e,b,c,
-C,15,a[50]),c=n(c,d,e,b,t,21,a[51]),b=n(b,c,d,e,A,6,a[52]),e=n(e,b,c,d,r,10,a[53]),d=n(d,e,b,c,y,15,a[54]),c=n(c,d,e,b,p,21,a[55]),b=n(b,c,d,e,w,6,a[56]),e=n(e,b,c,d,D,10,a[57]),d=n(d,e,b,c,u,15,a[58]),c=n(c,d,e,b,B,21,a[59]),b=n(b,c,d,e,s,6,a[60]),e=n(e,b,c,d,z,10,a[61]),d=n(d,e,b,c,q,15,a[62]),c=n(c,d,e,b,x,21,a[63]);g[0]=g[0]+b|0;g[1]=g[1]+c|0;g[2]=g[2]+d|0;g[3]=g[3]+e|0},_doFinalize:function(){var a=this._data,f=a.words,g=8*this._nDataBytes,j=8*a.sigBytes;f[j>>>5]|=128<<24-j%32;var h=E.floor(g/
-4294967296);f[(j+64>>>9<<4)+15]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360;f[(j+64>>>9<<4)+14]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360;a.sigBytes=4*(f.length+1);this._process();a=this._hash;f=a.words;for(g=0;4>g;g++)j=f[g],f[g]=(j<<8|j>>>24)&16711935|(j<<24|j>>>8)&4278255360;return a},clone:function(){var a=s.clone.call(this);a._hash=this._hash.clone();return a}});r.MD5=s._createHelper(q);r.HmacMD5=s._createHmacHelper(q)})(Math);
-
-/*
-CryptoJS v3.1.2 sha1-min.js
-code.google.com/p/crypto-js
-(c) 2009-2013 by Jeff Mott. All rights reserved.
-code.google.com/p/crypto-js/wiki/License
-*/
-(function(){var k=CryptoJS,b=k.lib,m=b.WordArray,l=b.Hasher,d=[],b=k.algo.SHA1=l.extend({_doReset:function(){this._hash=new m.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(n,p){for(var a=this._hash.words,e=a[0],f=a[1],h=a[2],j=a[3],b=a[4],c=0;80>c;c++){if(16>c)d[c]=n[p+c]|0;else{var g=d[c-3]^d[c-8]^d[c-14]^d[c-16];d[c]=g<<1|g>>>31}g=(e<<5|e>>>27)+b+d[c];g=20>c?g+((f&h|~f&j)+1518500249):40>c?g+((f^h^j)+1859775393):60>c?g+((f&h|f&j|h&j)-1894007588):g+((f^h^
-j)-899497514);b=j;j=h;h=f<<30|f>>>2;f=e;e=g}a[0]=a[0]+e|0;a[1]=a[1]+f|0;a[2]=a[2]+h|0;a[3]=a[3]+j|0;a[4]=a[4]+b|0},_doFinalize:function(){var b=this._data,d=b.words,a=8*this._nDataBytes,e=8*b.sigBytes;d[e>>>5]|=128<<24-e%32;d[(e+64>>>9<<4)+14]=Math.floor(a/4294967296);d[(e+64>>>9<<4)+15]=a;b.sigBytes=4*d.length;this._process();return this._hash},clone:function(){var b=l.clone.call(this);b._hash=this._hash.clone();return b}});k.SHA1=l._createHelper(b);k.HmacSHA1=l._createHmacHelper(b)})();
-
-/*
-CryptoJS v3.1.2 sha256-min.js
-code.google.com/p/crypto-js
-(c) 2009-2013 by Jeff Mott. All rights reserved.
-code.google.com/p/crypto-js/wiki/License
-*/
-(function(k){for(var g=CryptoJS,h=g.lib,v=h.WordArray,j=h.Hasher,h=g.algo,s=[],t=[],u=function(q){return 4294967296*(q-(q|0))|0},l=2,b=0;64>b;){var d;a:{d=l;for(var w=k.sqrt(d),r=2;r<=w;r++)if(!(d%r)){d=!1;break a}d=!0}d&&(8>b&&(s[b]=u(k.pow(l,0.5))),t[b]=u(k.pow(l,1/3)),b++);l++}var n=[],h=h.SHA256=j.extend({_doReset:function(){this._hash=new v.init(s.slice(0))},_doProcessBlock:function(q,h){for(var a=this._hash.words,c=a[0],d=a[1],b=a[2],k=a[3],f=a[4],g=a[5],j=a[6],l=a[7],e=0;64>e;e++){if(16>e)n[e]=
-q[h+e]|0;else{var m=n[e-15],p=n[e-2];n[e]=((m<<25|m>>>7)^(m<<14|m>>>18)^m>>>3)+n[e-7]+((p<<15|p>>>17)^(p<<13|p>>>19)^p>>>10)+n[e-16]}m=l+((f<<26|f>>>6)^(f<<21|f>>>11)^(f<<7|f>>>25))+(f&g^~f&j)+t[e]+n[e];p=((c<<30|c>>>2)^(c<<19|c>>>13)^(c<<10|c>>>22))+(c&d^c&b^d&b);l=j;j=g;g=f;f=k+m|0;k=b;b=d;d=c;c=m+p|0}a[0]=a[0]+c|0;a[1]=a[1]+d|0;a[2]=a[2]+b|0;a[3]=a[3]+k|0;a[4]=a[4]+f|0;a[5]=a[5]+g|0;a[6]=a[6]+j|0;a[7]=a[7]+l|0},_doFinalize:function(){var d=this._data,b=d.words,a=8*this._nDataBytes,c=8*d.sigBytes;
-b[c>>>5]|=128<<24-c%32;b[(c+64>>>9<<4)+14]=k.floor(a/4294967296);b[(c+64>>>9<<4)+15]=a;d.sigBytes=4*b.length;this._process();return this._hash},clone:function(){var b=j.clone.call(this);b._hash=this._hash.clone();return b}});g.SHA256=j._createHelper(h);g.HmacSHA256=j._createHmacHelper(h)})(Math);
-
-/*
-CryptoJS v3.1.2 sha224-min.js
-code.google.com/p/crypto-js
-(c) 2009-2013 by Jeff Mott. All rights reserved.
-code.google.com/p/crypto-js/wiki/License
-*/
-(function(){var b=CryptoJS,d=b.lib.WordArray,a=b.algo,c=a.SHA256,a=a.SHA224=c.extend({_doReset:function(){this._hash=new d.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var a=c._doFinalize.call(this);a.sigBytes-=4;return a}});b.SHA224=c._createHelper(a);b.HmacSHA224=c._createHmacHelper(a)})();
-
-/*
-CryptoJS v3.1.2 sha512-min.js
-code.google.com/p/crypto-js
-(c) 2009-2013 by Jeff Mott. All rights reserved.
-code.google.com/p/crypto-js/wiki/License
-*/
-(function(){function a(){return d.create.apply(d,arguments)}for(var n=CryptoJS,r=n.lib.Hasher,e=n.x64,d=e.Word,T=e.WordArray,e=n.algo,ea=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),
-a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,
-2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),
-a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,
-3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],v=[],w=0;80>w;w++)v[w]=a();e=e.SHA512=r.extend({_doReset:function(){this._hash=new T.init([new d.init(1779033703,4089235720),new d.init(3144134277,2227873595),new d.init(1013904242,4271175723),new d.init(2773480762,1595750129),new d.init(1359893119,2917565137),new d.init(2600822924,725511199),new d.init(528734635,4215389547),new d.init(1541459225,327033209)])},_doProcessBlock:function(a,d){for(var f=this._hash.words,
-F=f[0],e=f[1],n=f[2],r=f[3],G=f[4],H=f[5],I=f[6],f=f[7],w=F.high,J=F.low,X=e.high,K=e.low,Y=n.high,L=n.low,Z=r.high,M=r.low,$=G.high,N=G.low,aa=H.high,O=H.low,ba=I.high,P=I.low,ca=f.high,Q=f.low,k=w,g=J,z=X,x=K,A=Y,y=L,U=Z,B=M,l=$,h=N,R=aa,C=O,S=ba,D=P,V=ca,E=Q,m=0;80>m;m++){var s=v[m];if(16>m)var j=s.high=a[d+2*m]|0,b=s.low=a[d+2*m+1]|0;else{var j=v[m-15],b=j.high,p=j.low,j=(b>>>1|p<<31)^(b>>>8|p<<24)^b>>>7,p=(p>>>1|b<<31)^(p>>>8|b<<24)^(p>>>7|b<<25),u=v[m-2],b=u.high,c=u.low,u=(b>>>19|c<<13)^(b<<
-3|c>>>29)^b>>>6,c=(c>>>19|b<<13)^(c<<3|b>>>29)^(c>>>6|b<<26),b=v[m-7],W=b.high,t=v[m-16],q=t.high,t=t.low,b=p+b.low,j=j+W+(b>>>0>>0?1:0),b=b+c,j=j+u+(b>>>0>>0?1:0),b=b+t,j=j+q+(b>>>0>>0?1:0);s.high=j;s.low=b}var W=l&R^~l&S,t=h&C^~h&D,s=k&z^k&A^z&A,T=g&x^g&y^x&y,p=(k>>>28|g<<4)^(k<<30|g>>>2)^(k<<25|g>>>7),u=(g>>>28|k<<4)^(g<<30|k>>>2)^(g<<25|k>>>7),c=ea[m],fa=c.high,da=c.low,c=E+((h>>>14|l<<18)^(h>>>18|l<<14)^(h<<23|l>>>9)),q=V+((l>>>14|h<<18)^(l>>>18|h<<14)^(l<<23|h>>>9))+(c>>>0>>0?1:
-0),c=c+t,q=q+W+(c>>>0>>0?1:0),c=c+da,q=q+fa+(c>>>0>>0?1:0),c=c+b,q=q+j+(c>>>0>>0?1:0),b=u+T,s=p+s+(b>>>0>>0?1:0),V=S,E=D,S=R,D=C,R=l,C=h,h=B+c|0,l=U+q+(h>>>0>>0?1:0)|0,U=A,B=y,A=z,y=x,z=k,x=g,g=c+b|0,k=q+s+(g>>>0>>0?1:0)|0}J=F.low=J+g;F.high=w+k+(J>>>0>>0?1:0);K=e.low=K+x;e.high=X+z+(K>>>0>>0?1:0);L=n.low=L+y;n.high=Y+A+(L>>>0>>0?1:0);M=r.low=M+B;r.high=Z+U+(M>>>0>>0?1:0);N=G.low=N+h;G.high=$+l+(N>>>0>>0?1:0);O=H.low=O+C;H.high=aa+R+(O>>>0>>0?1:0);P=I.low=P+D;
-I.high=ba+S+(P>>>0>>0?1:0);Q=f.low=Q+E;f.high=ca+V+(Q>>>0>>0?1:0)},_doFinalize:function(){var a=this._data,d=a.words,f=8*this._nDataBytes,e=8*a.sigBytes;d[e>>>5]|=128<<24-e%32;d[(e+128>>>10<<5)+30]=Math.floor(f/4294967296);d[(e+128>>>10<<5)+31]=f;a.sigBytes=4*d.length;this._process();return this._hash.toX32()},clone:function(){var a=r.clone.call(this);a._hash=this._hash.clone();return a},blockSize:32});n.SHA512=r._createHelper(e);n.HmacSHA512=r._createHmacHelper(e)})();
-
-/*
-CryptoJS v3.1.2 sha384-min.js
-code.google.com/p/crypto-js
-(c) 2009-2013 by Jeff Mott. All rights reserved.
-code.google.com/p/crypto-js/wiki/License
-*/
-(function(){var c=CryptoJS,a=c.x64,b=a.Word,e=a.WordArray,a=c.algo,d=a.SHA512,a=a.SHA384=d.extend({_doReset:function(){this._hash=new e.init([new b.init(3418070365,3238371032),new b.init(1654270250,914150663),new b.init(2438529370,812702999),new b.init(355462360,4144912697),new b.init(1731405415,4290775857),new b.init(2394180231,1750603025),new b.init(3675008525,1694076839),new b.init(1203062813,3204075428)])},_doFinalize:function(){var a=d._doFinalize.call(this);a.sigBytes-=16;return a}});c.SHA384=
-d._createHelper(a);c.HmacSHA384=d._createHmacHelper(a)})();
-
-/*
-CryptoJS v3.1.2 ripemd160-min.js
-code.google.com/p/crypto-js
-(c) 2009-2013 by Jeff Mott. All rights reserved.
-code.google.com/p/crypto-js/wiki/License
-*/
-/*
-
-(c) 2012 by Cedric Mesnil. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-(function(){var q=CryptoJS,d=q.lib,n=d.WordArray,p=d.Hasher,d=q.algo,x=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),y=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),z=n.create([11,14,15,12,
-5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),A=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),B=n.create([0,1518500249,1859775393,2400959708,2840853838]),C=n.create([1352829926,1548603684,1836072691,
-2053994217,0]),d=d.RIPEMD160=p.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,v){for(var b=0;16>b;b++){var c=v+b,f=e[c];e[c]=(f<<8|f>>>24)&16711935|(f<<24|f>>>8)&4278255360}var c=this._hash.words,f=B.words,d=C.words,n=x.words,q=y.words,p=z.words,w=A.words,t,g,h,j,r,u,k,l,m,s;u=t=c[0];k=g=c[1];l=h=c[2];m=j=c[3];s=r=c[4];for(var a,b=0;80>b;b+=1)a=t+e[v+n[b]]|0,a=16>b?a+((g^h^j)+f[0]):32>b?a+((g&h|~g&j)+f[1]):48>b?
-a+(((g|~h)^j)+f[2]):64>b?a+((g&j|h&~j)+f[3]):a+((g^(h|~j))+f[4]),a|=0,a=a<>>32-p[b],a=a+r|0,t=r,r=j,j=h<<10|h>>>22,h=g,g=a,a=u+e[v+q[b]]|0,a=16>b?a+((k^(l|~m))+d[0]):32>b?a+((k&m|l&~m)+d[1]):48>b?a+(((k|~l)^m)+d[2]):64>b?a+((k&l|~k&m)+d[3]):a+((k^l^m)+d[4]),a|=0,a=a<>>32-w[b],a=a+s|0,u=s,s=m,m=l<<10|l>>>22,l=k,k=a;a=c[1]+h+m|0;c[1]=c[2]+j+s|0;c[2]=c[3]+r+u|0;c[3]=c[4]+t+k|0;c[4]=c[0]+g+l|0;c[0]=a},_doFinalize:function(){var e=this._data,d=e.words,b=8*this._nDataBytes,c=8*e.sigBytes;
-d[c>>>5]|=128<<24-c%32;d[(c+64>>>9<<4)+14]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360;e.sigBytes=4*(d.length+1);this._process();e=this._hash;d=e.words;for(b=0;5>b;b++)c=d[b],d[b]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360;return e},clone:function(){var d=p.clone.call(this);d._hash=this._hash.clone();return d}});q.RIPEMD160=p._createHelper(d);q.HmacRIPEMD160=p._createHmacHelper(d)})(Math);
-
-/*
-CryptoJS v3.1.2 hmac-min.js
-code.google.com/p/crypto-js
-(c) 2009-2013 by Jeff Mott. All rights reserved.
-code.google.com/p/crypto-js/wiki/License
-*/
-(function(){var c=CryptoJS,k=c.enc.Utf8;c.algo.HMAC=c.lib.Base.extend({init:function(a,b){a=this._hasher=new a.init;"string"==typeof b&&(b=k.parse(b));var c=a.blockSize,e=4*c;b.sigBytes>e&&(b=a.finalize(b));b.clamp();for(var f=this._oKey=b.clone(),g=this._iKey=b.clone(),h=f.words,j=g.words,d=0;d>6)+b64map.charAt(e&63)}if(b+1==d.length){e=parseInt(d.substring(b,b+1),16);a+=b64map.charAt(e<<2)}else{if(b+2==d.length){e=parseInt(d.substring(b,b+2),16);a+=b64map.charAt(e>>2)+b64map.charAt((e&3)<<4)}}if(b64pad){while((a.length&3)>0){a+=b64pad}}return a}function b64tohex(f){var d="";var e;var b=0;var c;var a;for(e=0;e>2);c=a&3;b=1}else{if(b==1){d+=int2char((c<<2)|(a>>4));c=a&15;b=2}else{if(b==2){d+=int2char(c);d+=int2char(a>>2);c=a&3;b=3}else{d+=int2char((c<<2)|(a>>4));d+=int2char(a&15);b=0}}}}if(b==1){d+=int2char(c<<2)}return d}function b64toBA(e){var d=b64tohex(e);var c;var b=new Array();for(c=0;2*c=0){var d=a*this[f++]+b[e]+h;h=Math.floor(d/67108864);b[e++]=d&67108863}return h}function am2(f,q,r,e,o,a){var k=q&32767,p=q>>15;while(--a>=0){var d=this[f]&32767;var g=this[f++]>>15;var b=p*d+g*k;d=k*d+((b&32767)<<15)+r[e]+(o&1073741823);o=(d>>>30)+(b>>>15)+p*g+(o>>>30);r[e++]=d&1073741823}return o}function am3(f,q,r,e,o,a){var k=q&16383,p=q>>14;while(--a>=0){var d=this[f]&16383;var g=this[f++]>>14;var b=p*d+g*k;d=k*d+((b&16383)<<14)+r[e]+o;o=(d>>28)+(b>>14)+p*g;r[e++]=d&268435455}return o}if(j_lm&&(navigator.appName=="Microsoft Internet Explorer")){BigInteger.prototype.am=am2;dbits=30}else{if(j_lm&&(navigator.appName!="Netscape")){BigInteger.prototype.am=am1;dbits=26}else{BigInteger.prototype.am=am3;dbits=28}}BigInteger.prototype.DB=dbits;BigInteger.prototype.DM=((1<=0;--a){b[a]=this[a]}b.t=this.t;b.s=this.s}function bnpFromInt(a){this.t=1;this.s=(a<0)?-1:0;if(a>0){this[0]=a}else{if(a<-1){this[0]=a+this.DV}else{this.t=0}}}function nbv(a){var b=nbi();b.fromInt(a);return b}function bnpFromString(h,c){var e;if(c==16){e=4}else{if(c==8){e=3}else{if(c==256){e=8}else{if(c==2){e=1}else{if(c==32){e=5}else{if(c==4){e=2}else{this.fromRadix(h,c);return}}}}}}this.t=0;this.s=0;var g=h.length,d=false,f=0;while(--g>=0){var a=(e==8)?h[g]&255:intAt(h,g);if(a<0){if(h.charAt(g)=="-"){d=true}continue}d=false;if(f==0){this[this.t++]=a}else{if(f+e>this.DB){this[this.t-1]|=(a&((1<<(this.DB-f))-1))<>(this.DB-f))}else{this[this.t-1]|=a<=this.DB){f-=this.DB}}if(e==8&&(h[0]&128)!=0){this.s=-1;if(f>0){this[this.t-1]|=((1<<(this.DB-f))-1)<0&&this[this.t-1]==a){--this.t}}function bnToString(c){if(this.s<0){return"-"+this.negate().toString(c)}var e;if(c==16){e=4}else{if(c==8){e=3}else{if(c==2){e=1}else{if(c==32){e=5}else{if(c==4){e=2}else{return this.toRadix(c)}}}}}var g=(1<0){if(j>j)>0){a=true;h=int2char(l)}while(f>=0){if(j>(j+=this.DB-e)}else{l=(this[f]>>(j-=e))&g;if(j<=0){j+=this.DB;--f}}if(l>0){a=true}if(a){h+=int2char(l)}}}return a?h:"0"}function bnNegate(){var a=nbi();BigInteger.ZERO.subTo(this,a);return a}function bnAbs(){return(this.s<0)?this.negate():this}function bnCompareTo(b){var d=this.s-b.s;if(d!=0){return d}var c=this.t;d=c-b.t;if(d!=0){return(this.s<0)?-d:d}while(--c>=0){if((d=this[c]-b[c])!=0){return d}}return 0}function nbits(a){var c=1,b;if((b=a>>>16)!=0){a=b;c+=16}if((b=a>>8)!=0){a=b;c+=8}if((b=a>>4)!=0){a=b;c+=4}if((b=a>>2)!=0){a=b;c+=2}if((b=a>>1)!=0){a=b;c+=1}return c}function bnBitLength(){if(this.t<=0){return 0}return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM))}function bnpDLShiftTo(c,b){var a;for(a=this.t-1;a>=0;--a){b[a+c]=this[a]}for(a=c-1;a>=0;--a){b[a]=0}b.t=this.t+c;b.s=this.s}function bnpDRShiftTo(c,b){for(var a=c;a=0;--d){e[d+f+1]=(this[d]>>a)|h;h=(this[d]&g)<=0;--d){e[d]=0}e[f]=h;e.t=this.t+f+1;e.s=this.s;e.clamp()}function bnpRShiftTo(g,d){d.s=this.s;var e=Math.floor(g/this.DB);if(e>=this.t){d.t=0;return}var b=g%this.DB;var a=this.DB-b;var f=(1<>b;for(var c=e+1;c>b}if(b>0){d[this.t-e-1]|=(this.s&f)<>=this.DB}if(d.t>=this.DB}g+=this.s}else{g+=this.s;while(e>=this.DB}g-=d.s}f.s=(g<0)?-1:0;if(g<-1){f[e++]=this.DV+g}else{if(g>0){f[e++]=g}}f.t=e;f.clamp()}function bnpMultiplyTo(c,e){var b=this.abs(),f=c.abs();var d=b.t;e.t=d+f.t;while(--d>=0){e[d]=0}for(d=0;d=0){d[b]=0}for(b=0;b=a.DV){d[b+a.t]-=a.DV;d[b+a.t+1]=1}}if(d.t>0){d[d.t-1]+=a.am(b,a[b],d,2*b,0,1)}d.s=0;d.clamp()}function bnpDivRemTo(n,h,g){var w=n.abs();if(w.t<=0){return}var k=this.abs();if(k.t0){w.lShiftTo(v,d);k.lShiftTo(v,g)}else{w.copyTo(d);k.copyTo(g)}var p=d.t;var b=d[p-1];if(b==0){return}var o=b*(1<1)?d[p-2]>>this.F2:0);var A=this.FV/o,z=(1<=0){g[g.t++]=1;g.subTo(f,g)}BigInteger.ONE.dlShiftTo(p,f);f.subTo(d,d);while(d.t=0){var c=(g[--u]==b)?this.DM:Math.floor(g[u]*A+(g[u-1]+x)*z);if((g[u]+=d.am(0,c,g,s,0,p))0){g.rShiftTo(v,g)}if(a<0){BigInteger.ZERO.subTo(g,g)}}function bnMod(b){var c=nbi();this.abs().divRemTo(b,null,c);if(this.s<0&&c.compareTo(BigInteger.ZERO)>0){b.subTo(c,c)}return c}function Classic(a){this.m=a}function cConvert(a){if(a.s<0||a.compareTo(this.m)>=0){return a.mod(this.m)}else{return a}}function cRevert(a){return a}function cReduce(a){a.divRemTo(this.m,null,a)}function cMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}function cSqrTo(a,b){a.squareTo(b);this.reduce(b)}Classic.prototype.convert=cConvert;Classic.prototype.revert=cRevert;Classic.prototype.reduce=cReduce;Classic.prototype.mulTo=cMulTo;Classic.prototype.sqrTo=cSqrTo;function bnpInvDigit(){if(this.t<1){return 0}var a=this[0];if((a&1)==0){return 0}var b=a&3;b=(b*(2-(a&15)*b))&15;b=(b*(2-(a&255)*b))&255;b=(b*(2-(((a&65535)*b)&65535)))&65535;b=(b*(2-a*b%this.DV))%this.DV;return(b>0)?this.DV-b:-b}function Montgomery(a){this.m=a;this.mp=a.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<(a.DB-15))-1;this.mt2=2*a.t}function montConvert(a){var b=nbi();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);if(a.s<0&&b.compareTo(BigInteger.ZERO)>0){this.m.subTo(b,b)}return b}function montRevert(a){var b=nbi();a.copyTo(b);this.reduce(b);return b}function montReduce(a){while(a.t<=this.mt2){a[a.t++]=0}for(var c=0;c>15)*this.mpl)&this.um)<<15))&a.DM;b=c+this.m.t;a[b]+=this.m.am(0,d,a,c,0,this.m.t);while(a[b]>=a.DV){a[b]-=a.DV;a[++b]++}}a.clamp();a.drShiftTo(this.m.t,a);if(a.compareTo(this.m)>=0){a.subTo(this.m,a)}}function montSqrTo(a,b){a.squareTo(b);this.reduce(b)}function montMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}Montgomery.prototype.convert=montConvert;Montgomery.prototype.revert=montRevert;Montgomery.prototype.reduce=montReduce;Montgomery.prototype.mulTo=montMulTo;Montgomery.prototype.sqrTo=montSqrTo;function bnpIsEven(){return((this.t>0)?(this[0]&1):this.s)==0}function bnpExp(h,j){if(h>4294967295||h<1){return BigInteger.ONE}var f=nbi(),a=nbi(),d=j.convert(this),c=nbits(h)-1;d.copyTo(f);while(--c>=0){j.sqrTo(f,a);if((h&(1<0){j.mulTo(a,d,f)}else{var b=f;f=a;a=b}}return j.revert(f)}function bnModPowInt(b,a){var c;if(b<256||a.isEven()){c=new Classic(a)}else{c=new Montgomery(a)}return this.exp(b,c)}BigInteger.prototype.copyTo=bnpCopyTo;BigInteger.prototype.fromInt=bnpFromInt;BigInteger.prototype.fromString=bnpFromString;BigInteger.prototype.clamp=bnpClamp;BigInteger.prototype.dlShiftTo=bnpDLShiftTo;BigInteger.prototype.drShiftTo=bnpDRShiftTo;BigInteger.prototype.lShiftTo=bnpLShiftTo;BigInteger.prototype.rShiftTo=bnpRShiftTo;BigInteger.prototype.subTo=bnpSubTo;BigInteger.prototype.multiplyTo=bnpMultiplyTo;BigInteger.prototype.squareTo=bnpSquareTo;BigInteger.prototype.divRemTo=bnpDivRemTo;BigInteger.prototype.invDigit=bnpInvDigit;BigInteger.prototype.isEven=bnpIsEven;BigInteger.prototype.exp=bnpExp;BigInteger.prototype.toString=bnToString;BigInteger.prototype.negate=bnNegate;BigInteger.prototype.abs=bnAbs;BigInteger.prototype.compareTo=bnCompareTo;BigInteger.prototype.bitLength=bnBitLength;BigInteger.prototype.mod=bnMod;BigInteger.prototype.modPowInt=bnModPowInt;BigInteger.ZERO=nbv(0);BigInteger.ONE=nbv(1);
-/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
- */
-function bnClone(){var a=nbi();this.copyTo(a);return a}function bnIntValue(){if(this.s<0){if(this.t==1){return this[0]-this.DV}else{if(this.t==0){return -1}}}else{if(this.t==1){return this[0]}else{if(this.t==0){return 0}}}return((this[1]&((1<<(32-this.DB))-1))<>24}function bnShortValue(){return(this.t==0)?this.s:(this[0]<<16)>>16}function bnpChunkSize(a){return Math.floor(Math.LN2*this.DB/Math.log(a))}function bnSigNum(){if(this.s<0){return -1}else{if(this.t<=0||(this.t==1&&this[0]<=0)){return 0}else{return 1}}}function bnpToRadix(c){if(c==null){c=10}if(this.signum()==0||c<2||c>36){return"0"}var f=this.chunkSize(c);var e=Math.pow(c,f);var i=nbv(e),j=nbi(),h=nbi(),g="";this.divRemTo(i,j,h);while(j.signum()>0){g=(e+h.intValue()).toString(c).substr(1)+g;j.divRemTo(i,j,h)}return h.intValue().toString(c)+g}function bnpFromRadix(m,h){this.fromInt(0);if(h==null){h=10}var f=this.chunkSize(h);var g=Math.pow(h,f),e=false,a=0,l=0;for(var c=0;c=f){this.dMultiply(g);this.dAddOffset(l,0);a=0;l=0}}if(a>0){this.dMultiply(Math.pow(h,a));this.dAddOffset(l,0)}if(e){BigInteger.ZERO.subTo(this,this)}}function bnpFromNumber(f,e,h){if("number"==typeof e){if(f<2){this.fromInt(1)}else{this.fromNumber(f,h);if(!this.testBit(f-1)){this.bitwiseTo(BigInteger.ONE.shiftLeft(f-1),op_or,this)}if(this.isEven()){this.dAddOffset(1,0)}while(!this.isProbablePrime(e)){this.dAddOffset(2,0);if(this.bitLength()>f){this.subTo(BigInteger.ONE.shiftLeft(f-1),this)}}}}else{var d=new Array(),g=f&7;d.length=(f>>3)+1;e.nextBytes(d);if(g>0){d[0]&=((1<0){if(e>e)!=(this.s&this.DM)>>e){c[a++]=f|(this.s<<(this.DB-e))}while(b>=0){if(e<8){f=(this[b]&((1<>(e+=this.DB-8)}else{f=(this[b]>>(e-=8))&255;if(e<=0){e+=this.DB;--b}}if((f&128)!=0){f|=-256}if(a==0&&(this.s&128)!=(f&128)){++a}if(a>0||f!=this.s){c[a++]=f}}}return c}function bnEquals(b){return(this.compareTo(b)==0)}function bnMin(b){return(this.compareTo(b)<0)?this:b}function bnMax(b){return(this.compareTo(b)>0)?this:b}function bnpBitwiseTo(c,h,e){var d,g,b=Math.min(c.t,this.t);for(d=0;d>=16;b+=16}if((a&255)==0){a>>=8;b+=8}if((a&15)==0){a>>=4;b+=4}if((a&3)==0){a>>=2;b+=2}if((a&1)==0){++b}return b}function bnGetLowestSetBit(){for(var a=0;a=this.t){return(this.s!=0)}return((this[a]&(1<<(b%this.DB)))!=0)}function bnpChangeBit(c,b){var a=BigInteger.ONE.shiftLeft(c);this.bitwiseTo(a,b,a);return a}function bnSetBit(a){return this.changeBit(a,op_or)}function bnClearBit(a){return this.changeBit(a,op_andnot)}function bnFlipBit(a){return this.changeBit(a,op_xor)}function bnpAddTo(d,f){var e=0,g=0,b=Math.min(d.t,this.t);while(e>=this.DB}if(d.t>=this.DB}g+=this.s}else{g+=this.s;while(e>=this.DB}g+=d.s}f.s=(g<0)?-1:0;if(g>0){f[e++]=g}else{if(g<-1){f[e++]=this.DV+g}}f.t=e;f.clamp()}function bnAdd(b){var c=nbi();this.addTo(b,c);return c}function bnSubtract(b){var c=nbi();this.subTo(b,c);return c}function bnMultiply(b){var c=nbi();this.multiplyTo(b,c);return c}function bnSquare(){var a=nbi();this.squareTo(a);return a}function bnDivide(b){var c=nbi();this.divRemTo(b,c,null);return c}function bnRemainder(b){var c=nbi();this.divRemTo(b,null,c);return c}function bnDivideAndRemainder(b){var d=nbi(),c=nbi();this.divRemTo(b,d,c);return new Array(d,c)}function bnpDMultiply(a){this[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()}function bnpDAddOffset(b,a){if(b==0){return}while(this.t<=a){this[this.t++]=0}this[a]+=b;while(this[a]>=this.DV){this[a]-=this.DV;if(++a>=this.t){this[this.t++]=0}++this[a]}}function NullExp(){}function nNop(a){return a}function nMulTo(a,c,b){a.multiplyTo(c,b)}function nSqrTo(a,b){a.squareTo(b)}NullExp.prototype.convert=nNop;NullExp.prototype.revert=nNop;NullExp.prototype.mulTo=nMulTo;NullExp.prototype.sqrTo=nSqrTo;function bnPow(a){return this.exp(a,new NullExp())}function bnpMultiplyLowerTo(b,f,e){var d=Math.min(this.t+b.t,f);e.s=0;e.t=d;while(d>0){e[--d]=0}var c;for(c=e.t-this.t;d=0){d[c]=0}for(c=Math.max(e-this.t,0);c2*this.m.t){return a.mod(this.m)}else{if(a.compareTo(this.m)<0){return a}else{var b=nbi();a.copyTo(b);this.reduce(b);return b}}}function barrettRevert(a){return a}function barrettReduce(a){a.drShiftTo(this.m.t-1,this.r2);if(a.t>this.m.t+1){a.t=this.m.t+1;a.clamp()}this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);while(a.compareTo(this.r2)<0){a.dAddOffset(1,this.m.t+1)}a.subTo(this.r2,a);while(a.compareTo(this.m)>=0){a.subTo(this.m,a)}}function barrettSqrTo(a,b){a.squareTo(b);this.reduce(b)}function barrettMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}Barrett.prototype.convert=barrettConvert;Barrett.prototype.revert=barrettRevert;Barrett.prototype.reduce=barrettReduce;Barrett.prototype.mulTo=barrettMulTo;Barrett.prototype.sqrTo=barrettSqrTo;function bnModPow(q,f){var o=q.bitLength(),h,b=nbv(1),v;if(o<=0){return b}else{if(o<18){h=1}else{if(o<48){h=3}else{if(o<144){h=4}else{if(o<768){h=5}else{h=6}}}}}if(o<8){v=new Classic(f)}else{if(f.isEven()){v=new Barrett(f)}else{v=new Montgomery(f)}}var p=new Array(),d=3,s=h-1,a=(1<1){var A=nbi();v.sqrTo(p[1],A);while(d<=a){p[d]=nbi();v.mulTo(A,p[d-2],p[d]);d+=2}}var l=q.t-1,x,u=true,c=nbi(),y;o=nbits(q[l])-1;while(l>=0){if(o>=s){x=(q[l]>>(o-s))&a}else{x=(q[l]&((1<<(o+1))-1))<<(s-o);if(l>0){x|=q[l-1]>>(this.DB+o-s)}}d=h;while((x&1)==0){x>>=1;--d}if((o-=d)<0){o+=this.DB;--l}if(u){p[x].copyTo(b);u=false}else{while(d>1){v.sqrTo(b,c);v.sqrTo(c,b);d-=2}if(d>0){v.sqrTo(b,c)}else{y=b;b=c;c=y}v.mulTo(c,p[x],b)}while(l>=0&&(q[l]&(1<0){b.rShiftTo(f,b);h.rShiftTo(f,h)}while(b.signum()>0){if((d=b.getLowestSetBit())>0){b.rShiftTo(d,b)}if((d=h.getLowestSetBit())>0){h.rShiftTo(d,h)}if(b.compareTo(h)>=0){b.subTo(h,b);b.rShiftTo(1,b)}else{h.subTo(b,h);h.rShiftTo(1,h)}}if(f>0){h.lShiftTo(f,h)}return h}function bnpModInt(e){if(e<=0){return 0}var c=this.DV%e,b=(this.s<0)?e-1:0;if(this.t>0){if(c==0){b=this[0]%e}else{for(var a=this.t-1;a>=0;--a){b=(c*b+this[a])%e}}}return b}function bnModInverse(f){var j=f.isEven();if((this.isEven()&&j)||f.signum()==0){return BigInteger.ZERO}var i=f.clone(),h=this.clone();var g=nbv(1),e=nbv(0),l=nbv(0),k=nbv(1);while(i.signum()!=0){while(i.isEven()){i.rShiftTo(1,i);if(j){if(!g.isEven()||!e.isEven()){g.addTo(this,g);e.subTo(f,e)}g.rShiftTo(1,g)}else{if(!e.isEven()){e.subTo(f,e)}}e.rShiftTo(1,e)}while(h.isEven()){h.rShiftTo(1,h);if(j){if(!l.isEven()||!k.isEven()){l.addTo(this,l);k.subTo(f,k)}l.rShiftTo(1,l)}else{if(!k.isEven()){k.subTo(f,k)}}k.rShiftTo(1,k)}if(i.compareTo(h)>=0){i.subTo(h,i);if(j){g.subTo(l,g)}e.subTo(k,e)}else{h.subTo(i,h);if(j){l.subTo(g,l)}k.subTo(e,k)}}if(h.compareTo(BigInteger.ONE)!=0){return BigInteger.ZERO}if(k.compareTo(f)>=0){return k.subtract(f)}if(k.signum()<0){k.addTo(f,k)}else{return k}if(k.signum()<0){return k.add(f)}else{return k}}var lowprimes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997];var lplim=(1<<26)/lowprimes[lowprimes.length-1];function bnIsProbablePrime(e){var d,b=this.abs();if(b.t==1&&b[0]<=lowprimes[lowprimes.length-1]){for(d=0;d>1;if(f>lowprimes.length){f=lowprimes.length}var b=nbi();for(var e=0;e>8)&255;rng_pool[rng_pptr++]^=(a>>16)&255;rng_pool[rng_pptr++]^=(a>>24)&255;if(rng_pptr>=rng_psize){rng_pptr-=rng_psize}}function rng_seed_time(){rng_seed_int(new Date().getTime())}if(rng_pool==null){rng_pool=new Array();rng_pptr=0;var t;if(window.crypto&&window.crypto.getRandomValues){var ua=new Uint8Array(32);window.crypto.getRandomValues(ua);for(t=0;t<32;++t){rng_pool[rng_pptr++]=ua[t]}}if(navigator.appName=="Netscape"&&navigator.appVersion<"5"&&window.crypto){var z=window.crypto.random(32);for(t=0;t>>8;rng_pool[rng_pptr++]=t&255}rng_pptr=0;rng_seed_time()}function rng_get_byte(){if(rng_state==null){rng_seed_time();rng_state=prng_newstate();rng_state.init(rng_pool);for(rng_pptr=0;rng_pptr=0&&h>0){var f=e.charCodeAt(d--);if(f<128){g[--h]=f}else{if((f>127)&&(f<2048)){g[--h]=(f&63)|128;g[--h]=(f>>6)|192}else{g[--h]=(f&63)|128;g[--h]=((f>>6)&63)|128;g[--h]=(f>>12)|224}}}g[--h]=0;var b=new SecureRandom();var a=new Array();while(h>2){a[0]=0;while(a[0]==0){b.nextBytes(a)}g[--h]=a[0]}g[--h]=2;g[--h]=0;return new BigInteger(g)}function oaep_mgf1_arr(c,a,e){var b="",d=0;while(b.length>24,(d&16711680)>>16,(d&65280)>>8,d&255])));d+=1}return b}var SHA1_SIZE=20;function oaep_pad(l,a,c){if(l.length+2*SHA1_SIZE+2>a){throw"Message too long for RSA"}var h="",d;for(d=0;d0&&a.length>0){this.n=parseBigInt(b,16);this.e=parseInt(a,16)}else{alert("Invalid RSA public key")}}}function RSADoPublic(a){return a.modPowInt(this.e,this.n)}function RSAEncrypt(d){var a=pkcs1pad2(d,(this.n.bitLength()+7)>>3);if(a==null){return null}var e=this.doPublic(a);if(e==null){return null}var b=e.toString(16);if((b.length&1)==0){return b}else{return"0"+b}}function RSAEncryptOAEP(e,d){var a=oaep_pad(e,(this.n.bitLength()+7)>>3,d);if(a==null){return null}var f=this.doPublic(a);if(f==null){return null}var b=f.toString(16);if((b.length&1)==0){return b}else{return"0"+b}}RSAKey.prototype.doPublic=RSADoPublic;RSAKey.prototype.setPublic=RSASetPublic;RSAKey.prototype.encrypt=RSAEncrypt;RSAKey.prototype.encryptOAEP=RSAEncryptOAEP;RSAKey.prototype.type="RSA";
-/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
- */
-function pkcs1unpad2(g,j){var a=g.toByteArray();var f=0;while(f=a.length){return null}}var e="";while(++f191)&&(h<224)){e+=String.fromCharCode(((h&31)<<6)|(a[f+1]&63));++f}else{e+=String.fromCharCode(((h&15)<<12)|((a[f+1]&63)<<6)|(a[f+2]&63));f+=2}}}return e}function oaep_mgf1_str(c,a,e){var b="",d=0;while(b.length>24,(d&16711680)>>16,(d&65280)>>8,d&255]));d+=1}return b}var SHA1_SIZE=20;function oaep_unpad(l,b,e){l=l.toByteArray();var f;for(f=0;f0&&a.length>0){this.n=parseBigInt(c,16);this.e=parseInt(a,16);this.d=parseBigInt(b,16)}else{alert("Invalid RSA private key")}}}function RSASetPrivateEx(g,d,e,c,b,a,h,f){this.isPrivate=true;if(g==null){throw"RSASetPrivateEx N == null"}if(d==null){throw"RSASetPrivateEx E == null"}if(g.length==0){throw"RSASetPrivateEx N.length == 0"}if(d.length==0){throw"RSASetPrivateEx E.length == 0"}if(g!=null&&d!=null&&g.length>0&&d.length>0){this.n=parseBigInt(g,16);this.e=parseInt(d,16);this.d=parseBigInt(e,16);this.p=parseBigInt(c,16);this.q=parseBigInt(b,16);this.dmp1=parseBigInt(a,16);this.dmq1=parseBigInt(h,16);this.coeff=parseBigInt(f,16)}else{alert("Invalid RSA private key in RSASetPrivateEx")}}function RSAGenerate(b,i){var a=new SecureRandom();var f=b>>1;this.e=parseInt(i,16);var c=new BigInteger(i,16);for(;;){for(;;){this.p=new BigInteger(b-f,1,a);if(this.p.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE)==0&&this.p.isProbablePrime(10)){break}}for(;;){this.q=new BigInteger(f,1,a);if(this.q.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE)==0&&this.q.isProbablePrime(10)){break}}if(this.p.compareTo(this.q)<=0){var h=this.p;this.p=this.q;this.q=h}var g=this.p.subtract(BigInteger.ONE);var d=this.q.subtract(BigInteger.ONE);var e=g.multiply(d);if(e.gcd(c).compareTo(BigInteger.ONE)==0){this.n=this.p.multiply(this.q);this.d=c.modInverse(e);this.dmp1=this.d.mod(g);this.dmq1=this.d.mod(d);this.coeff=this.q.modInverse(this.p);break}}}function RSADoPrivate(a){if(this.p==null||this.q==null){return a.modPow(this.d,this.n)}var c=a.mod(this.p).modPow(this.dmp1,this.p);var b=a.mod(this.q).modPow(this.dmq1,this.q);while(c.compareTo(b)<0){c=c.add(this.p)}return c.subtract(b).multiply(this.coeff).mod(this.p).multiply(this.q).add(b)}function RSADecrypt(b){var d=parseBigInt(b,16);var a=this.doPrivate(d);if(a==null){return null}return pkcs1unpad2(a,(this.n.bitLength()+7)>>3)}function RSADecryptOAEP(d,b){var e=parseBigInt(d,16);var a=this.doPrivate(e);if(a==null){return null}return oaep_unpad(a,(this.n.bitLength()+7)>>3,b)}RSAKey.prototype.doPrivate=RSADoPrivate;RSAKey.prototype.setPrivate=RSASetPrivate;RSAKey.prototype.setPrivateEx=RSASetPrivateEx;RSAKey.prototype.generate=RSAGenerate;RSAKey.prototype.decrypt=RSADecrypt;RSAKey.prototype.decryptOAEP=RSADecryptOAEP;
-/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
- */
-function ECFieldElementFp(b,a){this.x=a;this.q=b}function feFpEquals(a){if(a==this){return true}return(this.q.equals(a.q)&&this.x.equals(a.x))}function feFpToBigInteger(){return this.x}function feFpNegate(){return new ECFieldElementFp(this.q,this.x.negate().mod(this.q))}function feFpAdd(a){return new ECFieldElementFp(this.q,this.x.add(a.toBigInteger()).mod(this.q))}function feFpSubtract(a){return new ECFieldElementFp(this.q,this.x.subtract(a.toBigInteger()).mod(this.q))}function feFpMultiply(a){return new ECFieldElementFp(this.q,this.x.multiply(a.toBigInteger()).mod(this.q))}function feFpSquare(){return new ECFieldElementFp(this.q,this.x.square().mod(this.q))}function feFpDivide(a){return new ECFieldElementFp(this.q,this.x.multiply(a.toBigInteger().modInverse(this.q)).mod(this.q))}ECFieldElementFp.prototype.equals=feFpEquals;ECFieldElementFp.prototype.toBigInteger=feFpToBigInteger;ECFieldElementFp.prototype.negate=feFpNegate;ECFieldElementFp.prototype.add=feFpAdd;ECFieldElementFp.prototype.subtract=feFpSubtract;ECFieldElementFp.prototype.multiply=feFpMultiply;ECFieldElementFp.prototype.square=feFpSquare;ECFieldElementFp.prototype.divide=feFpDivide;function ECPointFp(c,a,d,b){this.curve=c;this.x=a;this.y=d;if(b==null){this.z=BigInteger.ONE}else{this.z=b}this.zinv=null}function pointFpGetX(){if(this.zinv==null){this.zinv=this.z.modInverse(this.curve.q)}return this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function pointFpGetY(){if(this.zinv==null){this.zinv=this.z.modInverse(this.curve.q)}return this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function pointFpEquals(a){if(a==this){return true}if(this.isInfinity()){return a.isInfinity()}if(a.isInfinity()){return this.isInfinity()}var c,b;c=a.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(a.z)).mod(this.curve.q);if(!c.equals(BigInteger.ZERO)){return false}b=a.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(a.z)).mod(this.curve.q);return b.equals(BigInteger.ZERO)}function pointFpIsInfinity(){if((this.x==null)&&(this.y==null)){return true}return this.z.equals(BigInteger.ZERO)&&!this.y.toBigInteger().equals(BigInteger.ZERO)}function pointFpNegate(){return new ECPointFp(this.curve,this.x,this.y.negate(),this.z)}function pointFpAdd(l){if(this.isInfinity()){return l}if(l.isInfinity()){return this}var p=l.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(l.z)).mod(this.curve.q);var o=l.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(l.z)).mod(this.curve.q);if(BigInteger.ZERO.equals(o)){if(BigInteger.ZERO.equals(p)){return this.twice()}return this.curve.getInfinity()}var j=new BigInteger("3");var e=this.x.toBigInteger();var n=this.y.toBigInteger();var c=l.x.toBigInteger();var k=l.y.toBigInteger();var m=o.square();var i=m.multiply(o);var d=e.multiply(m);var g=p.square().multiply(this.z);var a=g.subtract(d.shiftLeft(1)).multiply(l.z).subtract(i).multiply(o).mod(this.curve.q);var h=d.multiply(j).multiply(p).subtract(n.multiply(i)).subtract(g.multiply(p)).multiply(l.z).add(p.multiply(i)).mod(this.curve.q);var f=i.multiply(this.z).multiply(l.z).mod(this.curve.q);return new ECPointFp(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(h),f)}function pointFpTwice(){if(this.isInfinity()){return this}if(this.y.toBigInteger().signum()==0){return this.curve.getInfinity()}var g=new BigInteger("3");var c=this.x.toBigInteger();var h=this.y.toBigInteger();var e=h.multiply(this.z);var j=e.multiply(h).mod(this.curve.q);var i=this.curve.a.toBigInteger();var k=c.square().multiply(g);if(!BigInteger.ZERO.equals(i)){k=k.add(this.z.square().multiply(i))}k=k.mod(this.curve.q);var b=k.square().subtract(c.shiftLeft(3).multiply(j)).shiftLeft(1).multiply(e).mod(this.curve.q);var f=k.multiply(g).multiply(c).subtract(j.shiftLeft(1)).shiftLeft(2).multiply(j).subtract(k.square().multiply(k)).mod(this.curve.q);var d=e.square().multiply(e).shiftLeft(3).mod(this.curve.q);return new ECPointFp(this.curve,this.curve.fromBigInteger(b),this.curve.fromBigInteger(f),d)}function pointFpMultiply(b){if(this.isInfinity()){return this}if(b.signum()==0){return this.curve.getInfinity()}var g=b;var f=g.multiply(new BigInteger("3"));var l=this.negate();var d=this;var c;for(c=f.bitLength()-2;c>0;--c){d=d.twice();var a=f.testBit(c);var j=g.testBit(c);if(a!=j){d=d.add(a?this:l)}}return d}function pointFpMultiplyTwo(c,a,b){var d;if(c.bitLength()>b.bitLength()){d=c.bitLength()-1}else{d=b.bitLength()-1}var f=this.curve.getInfinity();var e=this.add(a);while(d>=0){f=f.twice();if(c.testBit(d)){if(b.testBit(d)){f=f.add(e)}else{f=f.add(this)}}else{if(b.testBit(d)){f=f.add(a)}}--d}return f}ECPointFp.prototype.getX=pointFpGetX;ECPointFp.prototype.getY=pointFpGetY;ECPointFp.prototype.equals=pointFpEquals;ECPointFp.prototype.isInfinity=pointFpIsInfinity;ECPointFp.prototype.negate=pointFpNegate;ECPointFp.prototype.add=pointFpAdd;ECPointFp.prototype.twice=pointFpTwice;ECPointFp.prototype.multiply=pointFpMultiply;ECPointFp.prototype.multiplyTwo=pointFpMultiplyTwo;function ECCurveFp(e,d,c){this.q=e;this.a=this.fromBigInteger(d);this.b=this.fromBigInteger(c);this.infinity=new ECPointFp(this,null,null)}function curveFpGetQ(){return this.q}function curveFpGetA(){return this.a}function curveFpGetB(){return this.b}function curveFpEquals(a){if(a==this){return true}return(this.q.equals(a.q)&&this.a.equals(a.a)&&this.b.equals(a.b))}function curveFpGetInfinity(){return this.infinity}function curveFpFromBigInteger(a){return new ECFieldElementFp(this.q,a)}function curveFpDecodePointHex(d){switch(parseInt(d.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var a=(d.length-2)/2;var c=d.substr(2,a);var b=d.substr(a+2,a);return new ECPointFp(this,this.fromBigInteger(new BigInteger(c,16)),this.fromBigInteger(new BigInteger(b,16)));default:return null}}ECCurveFp.prototype.getQ=curveFpGetQ;ECCurveFp.prototype.getA=curveFpGetA;ECCurveFp.prototype.getB=curveFpGetB;ECCurveFp.prototype.equals=curveFpEquals;ECCurveFp.prototype.getInfinity=curveFpGetInfinity;ECCurveFp.prototype.fromBigInteger=curveFpFromBigInteger;ECCurveFp.prototype.decodePointHex=curveFpDecodePointHex;
-/*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib
- */
-ECFieldElementFp.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)};ECPointFp.prototype.getEncoded=function(c){var d=function(h,f){var g=h.toByteArrayUnsigned();if(fg.length){g.unshift(0)}}return g};var a=this.getX().toBigInteger();var e=this.getY().toBigInteger();var b=d(a,32);if(c){if(e.isEven()){b.unshift(2)}else{b.unshift(3)}}else{b.unshift(4);b=b.concat(d(e,32))}return b};ECPointFp.decodeFrom=function(g,c){var f=c[0];var e=c.length-1;var d=c.slice(1,1+e/2);var b=c.slice(1+e/2,1+e);d.unshift(0);b.unshift(0);var a=new BigInteger(d);var h=new BigInteger(b);return new ECPointFp(g,g.fromBigInteger(a),g.fromBigInteger(h))};ECPointFp.decodeFromHex=function(g,c){var f=c.substr(0,2);var e=c.length-2;var d=c.substr(2,e/2);var b=c.substr(2+e/2,e/2);var a=new BigInteger(d,16);var h=new BigInteger(b,16);return new ECPointFp(g,g.fromBigInteger(a),g.fromBigInteger(h))};ECPointFp.prototype.add2D=function(c){if(this.isInfinity()){return c}if(c.isInfinity()){return this}if(this.x.equals(c.x)){if(this.y.equals(c.y)){return this.twice()}return this.curve.getInfinity()}var g=c.x.subtract(this.x);var e=c.y.subtract(this.y);var a=e.divide(g);var d=a.square().subtract(this.x).subtract(c.x);var f=a.multiply(this.x.subtract(d)).subtract(this.y);return new ECPointFp(this.curve,d,f)};ECPointFp.prototype.twice2D=function(){if(this.isInfinity()){return this}if(this.y.toBigInteger().signum()==0){return this.curve.getInfinity()}var b=this.curve.fromBigInteger(BigInteger.valueOf(2));var e=this.curve.fromBigInteger(BigInteger.valueOf(3));var a=this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(b));var c=a.square().subtract(this.x.multiply(b));var d=a.multiply(this.x.subtract(c)).subtract(this.y);return new ECPointFp(this.curve,c,d)};ECPointFp.prototype.multiply2D=function(b){if(this.isInfinity()){return this}if(b.signum()==0){return this.curve.getInfinity()}var g=b;var f=g.multiply(new BigInteger("3"));var l=this.negate();var d=this;var c;for(c=f.bitLength()-2;c>0;--c){d=d.twice();var a=f.testBit(c);var j=g.testBit(c);if(a!=j){d=d.add2D(a?this:l)}}return d};ECPointFp.prototype.isOnCurve=function(){var d=this.getX().toBigInteger();var i=this.getY().toBigInteger();var f=this.curve.getA().toBigInteger();var c=this.curve.getB().toBigInteger();var h=this.curve.getQ();var e=i.multiply(i).mod(h);var g=d.multiply(d).multiply(d).add(f.multiply(d)).add(c).mod(h);return e.equals(g)};ECPointFp.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"};ECPointFp.prototype.validate=function(){var c=this.curve.getQ();if(this.isInfinity()){throw new Error("Point is at infinity.")}var a=this.getX().toBigInteger();var b=this.getY().toBigInteger();if(a.compareTo(BigInteger.ONE)<0||a.compareTo(c.subtract(BigInteger.ONE))>0){throw new Error("x coordinate out of bounds")}if(b.compareTo(BigInteger.ONE)<0||b.compareTo(c.subtract(BigInteger.ONE))>0){throw new Error("y coordinate out of bounds")}if(!this.isOnCurve()){throw new Error("Point is not on the curve.")}if(this.multiply(c).isInfinity()){throw new Error("Point is not a scalar multiple of G.")}return true};
-/*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval
- */
-var jsonParse=(function(){var e="(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)";var j='(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))';var i='(?:"'+j+'*")';var d=new RegExp("(?:false|true|null|[\\{\\}\\[\\]]|"+e+"|"+i+")","g");var k=new RegExp("\\\\(?:([^u])|u(.{4}))","g");var g={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function h(l,m,n){return m?g[m]:String.fromCharCode(parseInt(n,16))}var c=new String("");var a="\\";var f={"{":Object,"[":Array};var b=Object.hasOwnProperty;return function(u,q){var p=u.match(d);var x;var v=p[0];var l=false;if("{"===v){x={}}else{if("["===v){x=[]}else{x=[];l=true}}var t;var r=[x];for(var o=1-l,m=p.length;o=0;){delete D[n[A]]}}}return q.call(C,B,D)};x=s({"":x},"")}return x}})();
-/*! asn1-1.0.9.js (c) 2013-2015 Kenji Urushima | kjur.github.com/jsrsasign/license
- */
-if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!KJUR.asn1){KJUR.asn1={}}KJUR.asn1.ASN1Util=new function(){this.integerToByteHex=function(a){var b=a.toString(16);if((b.length%2)==1){b="0"+b}return b};this.bigIntToMinTwosComplementsHex=function(j){var f=j.toString(16);if(f.substr(0,1)!="-"){if(f.length%2==1){f="0"+f}else{if(!f.match(/^[0-7]/)){f="00"+f}}}else{var a=f.substr(1);var e=a.length;if(e%2==1){e+=1}else{if(!f.match(/^[0-7]/)){e+=2}}var g="";for(var d=0;d15){throw"ASN.1 length too long to represent by 8x: n = "+i.toString(16)}var f=128+g;return f.toString(16)+h}};this.getEncodedHex=function(){if(this.hTLV==null||this.isModified){this.hV=this.getFreshValueHex();this.hL=this.getLengthHexFromValue();this.hTLV=this.hT+this.hL+this.hV;this.isModified=false}return this.hTLV};this.getValueHex=function(){this.getEncodedHex();return this.hV};this.getFreshValueHex=function(){return""}};KJUR.asn1.DERAbstractString=function(c){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);var b=null;var a=null;this.getString=function(){return this.s};this.setString=function(d){this.hTLV=null;this.isModified=true;this.s=d;this.hV=stohex(this.s)};this.setStringHex=function(d){this.hTLV=null;this.isModified=true;this.s=null;this.hV=d};this.getFreshValueHex=function(){return this.hV};if(typeof c!="undefined"){if(typeof c=="string"){this.setString(c)}else{if(typeof c.str!="undefined"){this.setString(c.str)}else{if(typeof c.hex!="undefined"){this.setStringHex(c.hex)}}}}};YAHOO.lang.extend(KJUR.asn1.DERAbstractString,KJUR.asn1.ASN1Object);KJUR.asn1.DERAbstractTime=function(c){KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);var b=null;var a=null;this.localDateToUTC=function(f){utc=f.getTime()+(f.getTimezoneOffset()*60000);var e=new Date(utc);return e};this.formatDate=function(m,o,e){var g=this.zeroPadding;var n=this.localDateToUTC(m);var p=String(n.getFullYear());if(o=="utc"){p=p.substr(2,2)}var l=g(String(n.getMonth()+1),2);var q=g(String(n.getDate()),2);var h=g(String(n.getHours()),2);var i=g(String(n.getMinutes()),2);var j=g(String(n.getSeconds()),2);var r=p+l+q+h+i+j;if(e===true){var f=n.getMilliseconds();if(f!=0){var k=g(String(f),3);k=k.replace(/[0]+$/,"");r=r+"."+k}}return r+"Z"};this.zeroPadding=function(e,d){if(e.length>=d){return e}return new Array(d-e.length+1).join("0")+e};this.getString=function(){return this.s};this.setString=function(d){this.hTLV=null;this.isModified=true;this.s=d;this.hV=stohex(d)};this.setByDateValue=function(h,j,e,d,f,g){var i=new Date(Date.UTC(h,j-1,e,d,f,g,0));this.setByDate(i)};this.getFreshValueHex=function(){return this.hV}};YAHOO.lang.extend(KJUR.asn1.DERAbstractTime,KJUR.asn1.ASN1Object);KJUR.asn1.DERAbstractStructured=function(b){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);var a=null;this.setByASN1ObjectArray=function(c){this.hTLV=null;this.isModified=true;this.asn1Array=c};this.appendASN1Object=function(c){this.hTLV=null;this.isModified=true;this.asn1Array.push(c)};this.asn1Array=new Array();if(typeof b!="undefined"){if(typeof b.array!="undefined"){this.asn1Array=b.array}}};YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured,KJUR.asn1.ASN1Object);KJUR.asn1.DERBoolean=function(){KJUR.asn1.DERBoolean.superclass.constructor.call(this);this.hT="01";this.hTLV="0101ff"};YAHOO.lang.extend(KJUR.asn1.DERBoolean,KJUR.asn1.ASN1Object);KJUR.asn1.DERInteger=function(a){KJUR.asn1.DERInteger.superclass.constructor.call(this);this.hT="02";this.setByBigInteger=function(b){this.hTLV=null;this.isModified=true;this.hV=KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(b)};this.setByInteger=function(c){var b=new BigInteger(String(c),10);this.setByBigInteger(b)};this.setValueHex=function(b){this.hV=b};this.getFreshValueHex=function(){return this.hV};if(typeof a!="undefined"){if(typeof a.bigint!="undefined"){this.setByBigInteger(a.bigint)}else{if(typeof a["int"]!="undefined"){this.setByInteger(a["int"])}else{if(typeof a=="number"){this.setByInteger(a)}else{if(typeof a.hex!="undefined"){this.setValueHex(a.hex)}}}}}};YAHOO.lang.extend(KJUR.asn1.DERInteger,KJUR.asn1.ASN1Object);KJUR.asn1.DERBitString=function(a){KJUR.asn1.DERBitString.superclass.constructor.call(this);this.hT="03";this.setHexValueIncludingUnusedBits=function(b){this.hTLV=null;this.isModified=true;this.hV=b};this.setUnusedBitsAndHexValue=function(b,d){if(b<0||7=(b*2))){break}if(d>=200){break}c.push(e);g=e;d++}return c};this.getNthChildIndex_AtObj=function(d,b,e){var c=this.getPosArrayOfChildren_AtObj(d,b);return c[e]};this.getDecendantIndexByNthList=function(e,d,c){if(c.length==0){return d}var f=c.shift();var b=this.getPosArrayOfChildren_AtObj(e,d);return this.getDecendantIndexByNthList(e,b[f],c)};this.getDecendantHexTLVByNthList=function(d,c,b){var a=this.getDecendantIndexByNthList(d,c,b);return this.getHexOfTLV_AtObj(d,a)};this.getDecendantHexVByNthList=function(d,c,b){var a=this.getDecendantIndexByNthList(d,c,b);return this.getHexOfV_AtObj(d,a)}};ASN1HEX.getVbyList=function(d,c,b,e){var a=this.getDecendantIndexByNthList(d,c,b);if(a===undefined){throw"can't find nthList object"}if(e!==undefined){if(d.substr(a,2)!=e){throw"checking tag doesn't match: "+d.substr(a,2)+"!="+e}}return this.getHexOfV_AtObj(d,a)};ASN1HEX.hextooidstr=function(e){var h=function(b,a){if(b.length>=a){return b}return new Array(a-b.length+1).join("0")+b};var l=[];var o=e.substr(0,2);var f=parseInt(o,16);l[0]=new String(Math.floor(f/40));l[1]=new String(f%40);var m=e.substr(2);var k=[];for(var g=0;g0){n=n+"."+j.join(".")}return n};ASN1HEX.dump=function(e,c,k,g){var o=function(w,i){if(w.length<=i*2){return w}else{var v=w.substr(0,i)+"..(total "+w.length/2+"bytes).."+w.substr(w.length-i,i);return v}};if(c===undefined){c={ommit_long_octet:32}}if(k===undefined){k=0}if(g===undefined){g=""}var r=c.ommit_long_octet;if(e.substr(k,2)=="01"){var h=ASN1HEX.getHexOfV_AtObj(e,k);if(h=="00"){return g+"BOOLEAN FALSE\n"}else{return g+"BOOLEAN TRUE\n"}}if(e.substr(k,2)=="02"){var h=ASN1HEX.getHexOfV_AtObj(e,k);return g+"INTEGER "+o(h,r)+"\n"}if(e.substr(k,2)=="03"){var h=ASN1HEX.getHexOfV_AtObj(e,k);return g+"BITSTRING "+o(h,r)+"\n"}if(e.substr(k,2)=="04"){var h=ASN1HEX.getHexOfV_AtObj(e,k);if(ASN1HEX.isASN1HEX(h)){var j=g+"OCTETSTRING, encapsulates\n";j=j+ASN1HEX.dump(h,c,0,g+" ");return j}else{return g+"OCTETSTRING "+o(h,r)+"\n"}}if(e.substr(k,2)=="05"){return g+"NULL\n"}if(e.substr(k,2)=="06"){var l=ASN1HEX.getHexOfV_AtObj(e,k);var a=KJUR.asn1.ASN1Util.oidHexToInt(l);var n=KJUR.asn1.x509.OID.oid2name(a);var b=a.replace(/\./g," ");if(n!=""){return g+"ObjectIdentifier "+n+" ("+b+")\n"}else{return g+"ObjectIdentifier ("+b+")\n"}}if(e.substr(k,2)=="0c"){return g+"UTF8String '"+hextoutf8(ASN1HEX.getHexOfV_AtObj(e,k))+"'\n"}if(e.substr(k,2)=="13"){return g+"PrintableString '"+hextoutf8(ASN1HEX.getHexOfV_AtObj(e,k))+"'\n"}if(e.substr(k,2)=="14"){return g+"TeletexString '"+hextoutf8(ASN1HEX.getHexOfV_AtObj(e,k))+"'\n"}if(e.substr(k,2)=="16"){return g+"IA5String '"+hextoutf8(ASN1HEX.getHexOfV_AtObj(e,k))+"'\n"}if(e.substr(k,2)=="17"){return g+"UTCTime "+hextoutf8(ASN1HEX.getHexOfV_AtObj(e,k))+"\n"}if(e.substr(k,2)=="18"){return g+"GeneralizedTime "+hextoutf8(ASN1HEX.getHexOfV_AtObj(e,k))+"\n"}if(e.substr(k,2)=="30"){if(e.substr(k,4)=="3000"){return g+"SEQUENCE {}\n"}var j=g+"SEQUENCE\n";var d=ASN1HEX.getPosArrayOfChildren_AtObj(e,k);var f=c;if((d.length==2||d.length==3)&&e.substr(d[0],2)=="06"&&e.substr(d[d.length-1],2)=="04"){var t=ASN1HEX.getHexOfV_AtObj(e,d[0]);var a=KJUR.asn1.ASN1Util.oidHexToInt(t);var n=KJUR.asn1.x509.OID.oid2name(a);var p=JSON.parse(JSON.stringify(c));p.x509ExtName=n;f=p}for(var q=0;q0){var d=new KJUR.asn1.DERSequence({array:this.extensionsArray});var b=new KJUR.asn1.DERTaggedObject({explicit:true,tag:"a3",obj:d});this.asn1Array.push(b)}var e=new KJUR.asn1.DERSequence({array:this.asn1Array});this.hTLV=e.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize()};YAHOO.lang.extend(KJUR.asn1.x509.TBSCertificate,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Extension=function(b){KJUR.asn1.x509.Extension.superclass.constructor.call(this);var a=null;this.getEncodedHex=function(){var f=new KJUR.asn1.DERObjectIdentifier({oid:this.oid});var e=new KJUR.asn1.DEROctetString({hex:this.getExtnValueHex()});var d=new Array();d.push(f);if(this.critical){d.push(new KJUR.asn1.DERBoolean())}d.push(e);var c=new KJUR.asn1.DERSequence({array:d});return c.getEncodedHex()};this.critical=false;if(typeof b!="undefined"){if(typeof b.critical!="undefined"){this.critical=b.critical}}};YAHOO.lang.extend(KJUR.asn1.x509.Extension,KJUR.asn1.ASN1Object);KJUR.asn1.x509.KeyUsage=function(a){KJUR.asn1.x509.KeyUsage.superclass.constructor.call(this,a);this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.15";if(typeof a!="undefined"){if(typeof a.bin!="undefined"){this.asn1ExtnValue=new KJUR.asn1.DERBitString(a)}}};YAHOO.lang.extend(KJUR.asn1.x509.KeyUsage,KJUR.asn1.x509.Extension);KJUR.asn1.x509.BasicConstraints=function(c){KJUR.asn1.x509.BasicConstraints.superclass.constructor.call(this,c);var a=false;var b=-1;this.getExtnValueHex=function(){var e=new Array();if(this.cA){e.push(new KJUR.asn1.DERBoolean())}if(this.pathLen>-1){e.push(new KJUR.asn1.DERInteger({"int":this.pathLen}))}var d=new KJUR.asn1.DERSequence({array:e});this.asn1ExtnValue=d;return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.19";this.cA=false;this.pathLen=-1;if(typeof c!="undefined"){if(typeof c.cA!="undefined"){this.cA=c.cA}if(typeof c.pathLen!="undefined"){this.pathLen=c.pathLen}}};YAHOO.lang.extend(KJUR.asn1.x509.BasicConstraints,KJUR.asn1.x509.Extension);KJUR.asn1.x509.CRLDistributionPoints=function(a){KJUR.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,a);this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.setByDPArray=function(b){this.asn1ExtnValue=new KJUR.asn1.DERSequence({array:b})};this.setByOneURI=function(e){var b=new KJUR.asn1.x509.GeneralNames([{uri:e}]);var d=new KJUR.asn1.x509.DistributionPointName(b);var c=new KJUR.asn1.x509.DistributionPoint({dpobj:d});this.setByDPArray([c])};this.oid="2.5.29.31";if(typeof a!="undefined"){if(typeof a.array!="undefined"){this.setByDPArray(a.array)}else{if(typeof a.uri!="undefined"){this.setByOneURI(a.uri)}}}};YAHOO.lang.extend(KJUR.asn1.x509.CRLDistributionPoints,KJUR.asn1.x509.Extension);KJUR.asn1.x509.ExtKeyUsage=function(a){KJUR.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,a);this.setPurposeArray=function(b){this.asn1ExtnValue=new KJUR.asn1.DERSequence();for(var c=0;c0){var c=new KJUR.asn1.DERSequence({array:this.aRevokedCert});this.asn1Array.push(c)}var d=new KJUR.asn1.DERSequence({array:this.asn1Array});this.hTLV=d.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize=function(){this.asn1Version=null;this.asn1SignatureAlg=null;this.asn1Issuer=null;this.asn1ThisUpdate=null;this.asn1NextUpdate=null;this.aRevokedCert=new Array()};this._initialize()};YAHOO.lang.extend(KJUR.asn1.x509.TBSCertList,KJUR.asn1.ASN1Object);KJUR.asn1.x509.CRLEntry=function(c){KJUR.asn1.x509.CRLEntry.superclass.constructor.call(this);var b=null;var a=null;this.setCertSerial=function(d){this.sn=new KJUR.asn1.DERInteger(d)};this.setRevocationDate=function(d){this.time=new KJUR.asn1.x509.Time(d)};this.getEncodedHex=function(){var d=new KJUR.asn1.DERSequence({array:[this.sn,this.time]});this.TLV=d.getEncodedHex();return this.TLV};if(typeof c!="undefined"){if(typeof c.time!="undefined"){this.setRevocationDate(c.time)}if(typeof c.sn!="undefined"){this.setCertSerial(c.sn)}}};YAHOO.lang.extend(KJUR.asn1.x509.CRLEntry,KJUR.asn1.ASN1Object);KJUR.asn1.x509.X500Name=function(b){KJUR.asn1.x509.X500Name.superclass.constructor.call(this);this.asn1Array=new Array();this.setByString=function(c){var d=c.split("/");d.shift();for(var e=0;e0){h=new a.DERTaggedObject({obj:this.dUnsignedAttrs,tag:"a1",explicit:false})}var g=[this.dCMSVersion,this.dSignerIdentifier,this.dDigestAlgorithm,e,this.dSigAlg,this.dSig,];if(h!=null){g.push(h)}var f=new a.DERSequence({array:g});this.hTLV=f.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.SignerInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.EncapsulatedContentInfo=function(c){KJUR.asn1.cms.EncapsulatedContentInfo.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dEContentType=new a.DERObjectIdentifier({name:"data"});this.dEContent=null;this.isDetached=false;this.eContentValueHex=null;this.setContentType=function(e){if(e.match(/^[0-2][.][0-9.]+$/)){this.dEContentType=new a.DERObjectIdentifier({oid:e})}else{this.dEContentType=new a.DERObjectIdentifier({name:e})}};this.setContentValue=function(e){if(typeof e!="undefined"){if(typeof e.hex=="string"){this.eContentValueHex=e.hex}else{if(typeof e.str=="string"){this.eContentValueHex=utf8tohex(e.str)}}}};this.setContentValueHex=function(e){this.eContentValueHex=e};this.setContentValueStr=function(e){this.eContentValueHex=utf8tohex(e)};this.getEncodedHex=function(){if(typeof this.eContentValueHex!="string"){throw"eContentValue not yet set"}var g=new a.DEROctetString({hex:this.eContentValueHex});this.dEContent=new a.DERTaggedObject({obj:g,tag:"a0",explicit:true});var e=[this.dEContentType];if(!this.isDetached){e.push(this.dEContent)}var f=new a.DERSequence({array:e});this.hTLV=f.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.EncapsulatedContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.ContentInfo=function(c){KJUR.asn1.cms.ContentInfo.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dContentType=null;this.dContent=null;this.setContentType=function(e){if(typeof e=="string"){this.dContentType=d.OID.name2obj(e)}};this.getEncodedHex=function(){var f=new a.DERTaggedObject({obj:this.dContent,tag:"a0",explicit:true});var e=new a.DERSequence({array:[this.dContentType,f]});this.hTLV=e.getEncodedHex();return this.hTLV};if(typeof c!="undefined"){if(c.type){this.setContentType(c.type)}if(c.obj&&c.obj instanceof a.ASN1Object){this.dContent=c.obj}}};YAHOO.lang.extend(KJUR.asn1.cms.ContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.SignedData=function(c){KJUR.asn1.cms.SignedData.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dCMSVersion=new a.DERInteger({"int":1});this.dDigestAlgs=null;this.digestAlgNameList=[];this.dEncapContentInfo=new b.EncapsulatedContentInfo();this.dCerts=null;this.certificateList=[];this.crlList=[];this.signerInfoList=[new b.SignerInfo()];this.addCertificatesByPEM=function(e){var f=KEYUTIL.getHexFromPEM(e);var g=new a.ASN1Object();g.hTLV=f;this.certificateList.push(g)};this.getEncodedHex=function(){if(typeof this.hTLV=="string"){return this.hTLV}if(this.dDigestAlgs==null){var k=[];for(var j=0;j0){var l=new a.DERSet({array:this.certificateList});this.dCerts=new a.DERTaggedObject({obj:l,tag:"a0",explicit:false})}}if(this.dCerts!=null){e.push(this.dCerts)}var g=new a.DERSet({array:this.signerInfoList});e.push(g);var f=new a.DERSequence({array:e});this.hTLV=f.getEncodedHex();return this.hTLV};this.getContentInfo=function(){this.getEncodedHex();var e=new b.ContentInfo({type:"signed-data",obj:this});return e};this.getContentInfoEncodedHex=function(){var e=this.getContentInfo();var f=e.getEncodedHex();return f};this.getPEM=function(){var e=this.getContentInfoEncodedHex();var f=a.ASN1Util.getPEMStringFromHex(e,"CMS");return f}};YAHOO.lang.extend(KJUR.asn1.cms.SignedData,KJUR.asn1.ASN1Object);KJUR.asn1.cms.CMSUtil=new function(){};KJUR.asn1.cms.CMSUtil.newSignedData=function(a){var h=KJUR.asn1.cms;var g=KJUR.asn1.cades;var f=new h.SignedData();f.dEncapContentInfo.setContentValue(a.content);if(typeof a.certs=="object"){for(var b=0;ba.length){d=a.length}for(var b=0;bd){throw"key is too short for SigAlg: keylen="+j+","+a}var b="0001";var k="00"+c;var g="";var l=d-b.length-k.length;for(var f=0;f=0;--p){q=q.twice2D();q.z=BigInteger.ONE;if(o.testBit(p)){if(n.testBit(p)){q=q.add2D(t)}else{q=q.add2D(s)}}else{if(n.testBit(p)){q=q.add2D(r)}}}return q}this.getBigRandom=function(i){return new BigInteger(i.bitLength(),a).mod(i.subtract(BigInteger.ONE)).add(BigInteger.ONE)};this.setNamedCurve=function(i){this.ecparams=KJUR.crypto.ECParameterDB.getByName(i);this.prvKeyHex=null;this.pubKeyHex=null;this.curveName=i};this.setPrivateKeyHex=function(i){this.isPrivate=true;this.prvKeyHex=i};this.setPublicKeyHex=function(i){this.isPublic=true;this.pubKeyHex=i};this.generateKeyPairHex=function(){var k=this.ecparams.n;var n=this.getBigRandom(k);var l=this.ecparams.G.multiply(n);var q=l.getX().toBigInteger();var o=l.getY().toBigInteger();var i=this.ecparams.keylen/4;var m=("0000000000"+n.toString(16)).slice(-i);var r=("0000000000"+q.toString(16)).slice(-i);var p=("0000000000"+o.toString(16)).slice(-i);var j="04"+r+p;this.setPrivateKeyHex(m);this.setPublicKeyHex(j);return{ecprvhex:m,ecpubhex:j}};this.signWithMessageHash=function(i){return this.signHex(i,this.prvKeyHex)};this.signHex=function(o,j){var t=new BigInteger(j,16);var l=this.ecparams.n;var q=new BigInteger(o,16);do{var m=this.getBigRandom(l);var u=this.ecparams.G;var p=u.multiply(m);var i=p.getX().toBigInteger().mod(l)}while(i.compareTo(BigInteger.ZERO)<=0);var v=m.modInverse(l).multiply(q.add(t.multiply(i))).mod(l);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(i,v)};this.sign=function(m,u){var q=u;var j=this.ecparams.n;var p=BigInteger.fromByteArrayUnsigned(m);do{var l=this.getBigRandom(j);var t=this.ecparams.G;var o=t.multiply(l);var i=o.getX().toBigInteger().mod(j)}while(i.compareTo(BigInteger.ZERO)<=0);var v=l.modInverse(j).multiply(p.add(q.multiply(i))).mod(j);return this.serializeSig(i,v)};this.verifyWithMessageHash=function(j,i){return this.verifyHex(j,i,this.pubKeyHex)};this.verifyHex=function(m,i,p){var l,j;var o=KJUR.crypto.ECDSA.parseSigHex(i);l=o.r;j=o.s;var k;k=ECPointFp.decodeFromHex(this.ecparams.curve,p);var n=new BigInteger(m,16);return this.verifyRaw(n,l,j,k)};this.verify=function(o,p,j){var l,i;if(Bitcoin.Util.isArray(p)){var n=this.parseSig(p);l=n.r;i=n.s}else{if("object"===typeof p&&p.r&&p.s){l=p.r;i=p.s}else{throw"Invalid value for signature"}}var k;if(j instanceof ECPointFp){k=j}else{if(Bitcoin.Util.isArray(j)){k=ECPointFp.decodeFrom(this.ecparams.curve,j)}else{throw"Invalid format for pubkey value, must be byte array or ECPointFp"}}var m=BigInteger.fromByteArrayUnsigned(o);return this.verifyRaw(m,l,i,k)};this.verifyRaw=function(o,i,w,m){var l=this.ecparams.n;var u=this.ecparams.G;if(i.compareTo(BigInteger.ONE)<0||i.compareTo(l)>=0){return false}if(w.compareTo(BigInteger.ONE)<0||w.compareTo(l)>=0){return false}var p=w.modInverse(l);var k=o.multiply(p).mod(l);var j=i.multiply(p).mod(l);var q=u.multiply(k).add(m.multiply(j));var t=q.getX().toBigInteger().mod(l);return t.equals(i)};this.serializeSig=function(k,j){var l=k.toByteArraySigned();var i=j.toByteArraySigned();var m=[];m.push(2);m.push(l.length);m=m.concat(l);m.push(2);m.push(i.length);m=m.concat(i);m.unshift(m.length);m.unshift(48);return m};this.parseSig=function(n){var m;if(n[0]!=48){throw new Error("Signature not a valid DERSequence")}m=2;if(n[m]!=2){throw new Error("First element in signature must be a DERInteger")}var l=n.slice(m+2,m+2+n[m+1]);m+=2+n[m+1];if(n[m]!=2){throw new Error("Second element in signature must be a DERInteger")}var i=n.slice(m+2,m+2+n[m+1]);m+=2+n[m+1];var k=BigInteger.fromByteArrayUnsigned(l);var j=BigInteger.fromByteArrayUnsigned(i);return{r:k,s:j}};this.parseSigCompact=function(m){if(m.length!==65){throw"Signature has the wrong length"}var j=m[0]-27;if(j<0||j>7){throw"Invalid signature type"}var o=this.ecparams.n;var l=BigInteger.fromByteArrayUnsigned(m.slice(1,33)).mod(o);var k=BigInteger.fromByteArrayUnsigned(m.slice(33,65)).mod(o);return{r:l,s:k,i:j}};if(h!==undefined){if(h.curve!==undefined){this.curveName=h.curve}}if(this.curveName===undefined){this.curveName=e}this.setNamedCurve(this.curveName);if(h!==undefined){if(h.prv!==undefined){this.setPrivateKeyHex(h.prv)}if(h.pub!==undefined){this.setPublicKeyHex(h.pub)}}};KJUR.crypto.ECDSA.parseSigHex=function(a){var b=KJUR.crypto.ECDSA.parseSigHexInHexRS(a);var d=new BigInteger(b.r,16);var c=new BigInteger(b.s,16);return{r:d,s:c}};KJUR.crypto.ECDSA.parseSigHexInHexRS=function(c){if(c.substr(0,2)!="30"){throw"signature is not a ASN.1 sequence"}var b=ASN1HEX.getPosArrayOfChildren_AtObj(c,0);if(b.length!=2){throw"number of signature ASN.1 sequence elements seem wrong"}var g=b[0];var f=b[1];if(c.substr(g,2)!="02"){throw"1st item of sequene of signature is not ASN.1 integer"}if(c.substr(f,2)!="02"){throw"2nd item of sequene of signature is not ASN.1 integer"}var e=ASN1HEX.getHexOfV_AtObj(c,g);var d=ASN1HEX.getHexOfV_AtObj(c,f);return{r:e,s:d}};KJUR.crypto.ECDSA.asn1SigToConcatSig=function(c){var d=KJUR.crypto.ECDSA.parseSigHexInHexRS(c);var b=d.r;var a=d.s;if(b.substr(0,2)=="00"&&(((b.length/2)*8)%(16*8))==8){b=b.substr(2)}if(a.substr(0,2)=="00"&&(((a.length/2)*8)%(16*8))==8){a=a.substr(2)}if((((b.length/2)*8)%(16*8))!=0){throw"unknown ECDSA sig r length error"}if((((a.length/2)*8)%(16*8))!=0){throw"unknown ECDSA sig s length error"}return b+a};KJUR.crypto.ECDSA.concatSigToASN1Sig=function(a){if((((a.length/2)*8)%(16*8))!=0){throw"unknown ECDSA concatinated r-s sig length error"}var c=a.substr(0,a.length/2);var b=a.substr(a.length/2);return KJUR.crypto.ECDSA.hexRSSigToASN1Sig(c,b)};KJUR.crypto.ECDSA.hexRSSigToASN1Sig=function(b,a){var d=new BigInteger(b,16);var c=new BigInteger(a,16);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(d,c)};KJUR.crypto.ECDSA.biRSSigToASN1Sig=function(e,c){var b=new KJUR.asn1.DERInteger({bigint:e});var a=new KJUR.asn1.DERInteger({bigint:c});var d=new KJUR.asn1.DERSequence({array:[b,a]});return d.getEncodedHex()};
-/*! ecparam-1.0.0.js (c) 2013 Kenji Urushima | kjur.github.com/jsrsasign/license
- */
-if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.crypto=="undefined"||!KJUR.crypto){KJUR.crypto={}}KJUR.crypto.ECParameterDB=new function(){var b={};var c={};function a(d){return new BigInteger(d,16)}this.getByName=function(e){var d=e;if(typeof c[d]!="undefined"){d=c[e]}if(typeof b[d]!="undefined"){return b[d]}throw"unregistered EC curve name: "+d};this.regist=function(A,l,o,g,m,e,j,f,k,u,d,x){b[A]={};var s=a(o);var z=a(g);var y=a(m);var t=a(e);var w=a(j);var r=new ECCurveFp(s,z,y);var q=r.decodePointHex("04"+f+k);b[A]["name"]=A;b[A]["keylen"]=l;b[A]["curve"]=r;b[A]["G"]=q;b[A]["n"]=t;b[A]["h"]=w;b[A]["oid"]=d;b[A]["info"]=x;for(var v=0;v0||K.compareTo(u)>0||BigInteger.ZERO.compareTo(J)>0||J.compareTo(u)>0){throw"invalid DSA signature"}var I=J.modInverse(u);var A=D.multiply(I).mod(u);var v=K.multiply(I).mod(u);var F=G.modPow(A,z).multiply(H.modPow(v,z)).mod(z).mod(u);return F.compareTo(K)==0};this.parseASN1Signature=function(u){try{var y=new BigInteger(ASN1HEX.getVbyList(u,0,[0],"02"),16);var v=new BigInteger(ASN1HEX.getVbyList(u,0,[1],"02"),16);return[y,v]}catch(w){throw"malformed DSA signature"}};function d(E,w,B,v,u,C){var z=KJUR.crypto.Util.hashString(w,E.toLowerCase());var z=z.substr(0,u.bitLength()/4);var A=new BigInteger(z,16);var y=n(BigInteger.ONE.add(BigInteger.ONE),u.subtract(BigInteger.ONE));var F=(B.modPow(y,v)).mod(u);var D=(y.modInverse(u).multiply(A.add(C.multiply(F)))).mod(u);var G=new Array();G[0]=F;G[1]=D;return G}function r(v){var u=openpgp.config.config.prefer_hash_algorithm;switch(Math.round(v.bitLength()/8)){case 20:if(u!=2&&u>11&&u!=10&&u<8){return 2}return u;case 28:if(u>11&&u<8){return 11}return u;case 32:if(u>10&&u<8){return 8}return u;default:util.print_debug("DSA select hash algorithm: returning null for an unknown length of q");return null}}this.select_hash_algorithm=r;function m(I,K,J,B,z,u,F,G){var C=KJUR.crypto.Util.hashString(B,I.toLowerCase());var C=C.substr(0,u.bitLength()/4);var D=new BigInteger(C,16);if(BigInteger.ZERO.compareTo(K)>0||K.compareTo(u)>0||BigInteger.ZERO.compareTo(J)>0||J.compareTo(u)>0){util.print_error("invalid DSA Signature");return null}var H=J.modInverse(u);var A=D.multiply(H).mod(u);var v=K.multiply(H).mod(u);var E=F.modPow(A,z).multiply(G.modPow(v,z)).mod(z).mod(u);return E.compareTo(K)==0}function a(z){var A=new BigInteger(z,primeCenterie);var y=j(q,512);var u=t(p,q,z);var v;do{v=new BigInteger(q.bitCount(),rand)}while(x.compareTo(BigInteger.ZERO)!=1&&x.compareTo(q)!=-1);var w=g.modPow(x,p);return{x:v,q:A,p:y,g:u,y:w}}function j(y,z,w){if(z%64!=0){return false}var u;var v;do{u=w(bitcount,true);v=u.subtract(BigInteger.ONE);u=u.subtract(v.remainder(y))}while(!u.isProbablePrime(primeCenterie)||u.bitLength()!=l);return u}function t(B,z,A,w){var u=B.subtract(BigInteger.ONE);var y=u.divide(z);var v;do{v=w(A)}while(v.compareTo(u)!=-1&&v.compareTo(BigInteger.ONE)!=1);return v.modPow(y,B)}function o(w,y,u){var v;do{v=u(y,false)}while(v.compareTo(w)!=-1&&v.compareTo(BigInteger.ZERO)!=1);return v}function i(v,w){k=o(v);var u=g.modPow(k,w).mod(v);return u}function h(B,w,y,v,z,u){var A=B(v);s=(w.modInverse(z).multiply(A.add(u.multiply(y)))).mod(z);return s}this.sign=d;this.verify=m;function n(w,u){if(u.compareTo(w)<=0){return}var v=u.subtract(w);var y=e(v.bitLength());while(y>v){y=e(v.bitLength())}return w.add(y)}function e(w){if(w<0){return null}var u=Math.floor((w+7)/8);var v=c(u);if(w%8>0){v=String.fromCharCode((Math.pow(2,w%8)-1)&v.charCodeAt(0))+v.substring(1)}return new BigInteger(f(v),16)}function c(w){var u="";for(var v=0;v=s*2){break}}var x={};x.keyhex=v.substr(0,g[o]["keylen"]*2);x.ivhex=v.substr(g[o]["keylen"]*2,g[o]["ivlen"]*2);return x};var a=function(n,t,p,u){var q=CryptoJS.enc.Base64.parse(n);var o=CryptoJS.enc.Hex.stringify(q);var s=g[t]["proc"];var r=s(o,p,u);return r};var f=function(n,q,o,s){var p=g[q]["eproc"];var r=p(n,o,s);return r};return{version:"1.0.5",getHexFromPEM:function(o,r){var p=o;if(p.indexOf("BEGIN "+r)==-1){throw"can't find PEM header: "+r}p=p.replace("-----BEGIN "+r+"-----","");p=p.replace("-----END "+r+"-----","");var q=p.replace(/\s+/g,"");var n=b64tohex(q);return n},getDecryptedKeyHexByKeyIV:function(o,r,q,p){var n=b(r);return n(o,q,p)},parsePKCS5PEM:function(n){return l(n)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(o,n,p){return h(o,n,p)},decryptKeyB64:function(n,p,o,q){return a(n,p,o,q)},getDecryptedKeyHex:function(w,v){var o=l(w);var r=o.type;var p=o.cipher;var n=o.ivsalt;var q=o.data;var u=h(p,v,n);var t=u.keyhex;var s=a(q,p,t,n);return s},getRSAKeyFromEncryptedPKCS5PEM:function(p,o){var q=this.getDecryptedKeyHex(p,o);var n=new RSAKey();n.readPrivateKeyFromASN1HexString(q);return n},getEryptedPKCS5PEMFromPrvKeyHex:function(q,x,r,p){var n="";if(typeof r=="undefined"||r==null){r="AES-256-CBC"}if(typeof g[r]=="undefined"){throw"PKCS5PKEY unsupported algorithm: "+r}if(typeof p=="undefined"||p==null){var t=g[r]["ivlen"];var s=k(t);p=s.toUpperCase()}var w=h(r,x,p);var v=w.keyhex;var u=f(q,r,v,p);var o=u.replace(/(.{64})/g,"$1\r\n");var n="-----BEGIN RSA PRIVATE KEY-----\r\n";n+="Proc-Type: 4,ENCRYPTED\r\n";n+="DEK-Info: "+r+","+p+"\r\n";n+="\r\n";n+=o;n+="\r\n-----END RSA PRIVATE KEY-----\r\n";return n},getEryptedPKCS5PEMFromRSAKey:function(C,D,o,s){var A=new KJUR.asn1.DERInteger({"int":0});var v=new KJUR.asn1.DERInteger({bigint:C.n});var z=new KJUR.asn1.DERInteger({"int":C.e});var B=new KJUR.asn1.DERInteger({bigint:C.d});var t=new KJUR.asn1.DERInteger({bigint:C.p});var r=new KJUR.asn1.DERInteger({bigint:C.q});var y=new KJUR.asn1.DERInteger({bigint:C.dmp1});var u=new KJUR.asn1.DERInteger({bigint:C.dmq1});var x=new KJUR.asn1.DERInteger({bigint:C.coeff});var E=new KJUR.asn1.DERSequence({array:[A,v,z,B,t,r,y,u,x]});var w=E.getEncodedHex();return this.getEryptedPKCS5PEMFromPrvKeyHex(w,D,o,s)},newEncryptedPKCS5PEM:function(n,o,r,s){if(typeof o=="undefined"||o==null){o=1024}if(typeof r=="undefined"||r==null){r="10001"}var p=new RSAKey();p.generate(o,r);var q=null;if(typeof s=="undefined"||s==null){q=this.getEncryptedPKCS5PEMFromRSAKey(pkey,n)}else{q=this.getEncryptedPKCS5PEMFromRSAKey(pkey,n,s)}return q},getRSAKeyFromPlainPKCS8PEM:function(p){if(p.match(/ENCRYPTED/)){throw"pem shall be not ENCRYPTED"}var o=this.getHexFromPEM(p,"PRIVATE KEY");var n=this.getRSAKeyFromPlainPKCS8Hex(o);return n},getRSAKeyFromPlainPKCS8Hex:function(q){var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,0);if(p.length!=3){throw"outer DERSequence shall have 3 elements: "+p.length}var o=ASN1HEX.getHexOfTLV_AtObj(q,p[1]);if(o!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmIdentifier is not rsaEnc: "+o}var o=ASN1HEX.getHexOfTLV_AtObj(q,p[1]);var r=ASN1HEX.getHexOfTLV_AtObj(q,p[2]);var s=ASN1HEX.getHexOfV_AtObj(r,0);var n=new RSAKey();n.readPrivateKeyFromASN1HexString(s);return n},parseHexOfEncryptedPKCS8:function(u){var q={};var p=ASN1HEX.getPosArrayOfChildren_AtObj(u,0);if(p.length!=2){throw"malformed format: SEQUENCE(0).items != 2: "+p.length}q.ciphertext=ASN1HEX.getHexOfV_AtObj(u,p[1]);var w=ASN1HEX.getPosArrayOfChildren_AtObj(u,p[0]);if(w.length!=2){throw"malformed format: SEQUENCE(0.0).items != 2: "+w.length}if(ASN1HEX.getHexOfV_AtObj(u,w[0])!="2a864886f70d01050d"){throw"this only supports pkcs5PBES2"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(u,w[1]);if(w.length!=2){throw"malformed format: SEQUENCE(0.0.1).items != 2: "+n.length}var o=ASN1HEX.getPosArrayOfChildren_AtObj(u,n[1]);if(o.length!=2){throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+o.length}if(ASN1HEX.getHexOfV_AtObj(u,o[0])!="2a864886f70d0307"){throw"this only supports TripleDES"}q.encryptionSchemeAlg="TripleDES";q.encryptionSchemeIV=ASN1HEX.getHexOfV_AtObj(u,o[1]);var r=ASN1HEX.getPosArrayOfChildren_AtObj(u,n[0]);if(r.length!=2){throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+r.length}if(ASN1HEX.getHexOfV_AtObj(u,r[0])!="2a864886f70d01050c"){throw"this only supports pkcs5PBKDF2"}var v=ASN1HEX.getPosArrayOfChildren_AtObj(u,r[1]);if(v.length<2){throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+v.length}q.pbkdf2Salt=ASN1HEX.getHexOfV_AtObj(u,v[0]);var s=ASN1HEX.getHexOfV_AtObj(u,v[1]);try{q.pbkdf2Iter=parseInt(s,16)}catch(t){throw"malformed format pbkdf2Iter: "+s}return q},getPBKDF2KeyHexFromParam:function(s,n){var r=CryptoJS.enc.Hex.parse(s.pbkdf2Salt);var o=s.pbkdf2Iter;var q=CryptoJS.PBKDF2(n,r,{keySize:192/32,iterations:o});var p=CryptoJS.enc.Hex.stringify(q);return p},getPlainPKCS8HexFromEncryptedPKCS8PEM:function(v,w){var p=this.getHexFromPEM(v,"ENCRYPTED PRIVATE KEY");var n=this.parseHexOfEncryptedPKCS8(p);var s=PKCS5PKEY.getPBKDF2KeyHexFromParam(n,w);var t={};t.ciphertext=CryptoJS.enc.Hex.parse(n.ciphertext);var r=CryptoJS.enc.Hex.parse(s);var q=CryptoJS.enc.Hex.parse(n.encryptionSchemeIV);var u=CryptoJS.TripleDES.decrypt(t,r,{iv:q});var o=CryptoJS.enc.Hex.stringify(u);return o},getRSAKeyFromEncryptedPKCS8PEM:function(q,p){var o=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(q,p);var n=this.getRSAKeyFromPlainPKCS8Hex(o);return n},getKeyFromEncryptedPKCS8PEM:function(q,o){var n=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(q,o);var p=this.getKeyFromPlainPrivatePKCS8Hex(n);return p},parsePlainPrivatePKCS8Hex:function(q){var o={};o.algparam=null;if(q.substr(0,2)!="30"){throw"malformed plain PKCS8 private key(code:001)"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,0);if(p.length!=3){throw"malformed plain PKCS8 private key(code:002)"}if(q.substr(p[1],2)!="30"){throw"malformed PKCS8 private key(code:003)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(q,p[1]);if(n.length!=2){throw"malformed PKCS8 private key(code:004)"}if(q.substr(n[0],2)!="06"){throw"malformed PKCS8 private key(code:005)"}o.algoid=ASN1HEX.getHexOfV_AtObj(q,n[0]);if(q.substr(n[1],2)=="06"){o.algparam=ASN1HEX.getHexOfV_AtObj(q,n[1])}if(q.substr(p[2],2)!="04"){throw"malformed PKCS8 private key(code:006)"}o.keyidx=ASN1HEX.getStartPosOfV_AtObj(q,p[2]);return o},getKeyFromPlainPrivatePKCS8PEM:function(o){var n=this.getHexFromPEM(o,"PRIVATE KEY");var p=this.getKeyFromPlainPrivatePKCS8Hex(n);return p},getKeyFromPlainPrivatePKCS8Hex:function(n){var p=this.parsePlainPrivatePKCS8Hex(n);if(p.algoid=="2a864886f70d010101"){this.parsePrivateRawRSAKeyHexAtObj(n,p);var o=p.key;var q=new RSAKey();q.setPrivateEx(o.n,o.e,o.d,o.p,o.q,o.dp,o.dq,o.co);return q}else{if(p.algoid=="2a8648ce3d0201"){this.parsePrivateRawECKeyHexAtObj(n,p);if(KJUR.crypto.OID.oidhex2name[p.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+p.algparam}var r=KJUR.crypto.OID.oidhex2name[p.algparam];var q=new KJUR.crypto.ECDSA({curve:r,prv:p.key});return q}else{throw"unsupported private key algorithm"}}},getRSAKeyFromPublicPKCS8PEM:function(o){var p=this.getHexFromPEM(o,"PUBLIC KEY");var n=this.getRSAKeyFromPublicPKCS8Hex(p);return n},getKeyFromPublicPKCS8PEM:function(o){var p=this.getHexFromPEM(o,"PUBLIC KEY");var n=this.getKeyFromPublicPKCS8Hex(p);return n},getKeyFromPublicPKCS8Hex:function(o){var n=this.parsePublicPKCS8Hex(o);if(n.algoid=="2a864886f70d010101"){var r=this.parsePublicRawRSAKeyHex(n.key);var p=new RSAKey();p.setPublic(r.n,r.e);return p}else{if(n.algoid=="2a8648ce3d0201"){if(KJUR.crypto.OID.oidhex2name[n.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+n.algparam}var q=KJUR.crypto.OID.oidhex2name[n.algparam];var p=new KJUR.crypto.ECDSA({curve:q,pub:n.key});return p}else{throw"unsupported public key algorithm"}}},parsePublicRawRSAKeyHex:function(p){var n={};if(p.substr(0,2)!="30"){throw"malformed RSA key(code:001)"}var o=ASN1HEX.getPosArrayOfChildren_AtObj(p,0);if(o.length!=2){throw"malformed RSA key(code:002)"}if(p.substr(o[0],2)!="02"){throw"malformed RSA key(code:003)"}n.n=ASN1HEX.getHexOfV_AtObj(p,o[0]);if(p.substr(o[1],2)!="02"){throw"malformed RSA key(code:004)"}n.e=ASN1HEX.getHexOfV_AtObj(p,o[1]);return n},parsePrivateRawRSAKeyHexAtObj:function(o,q){var p=q.keyidx;if(o.substr(p,2)!="30"){throw"malformed RSA private key(code:001)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(o,p);if(n.length!=9){throw"malformed RSA private key(code:002)"}q.key={};q.key.n=ASN1HEX.getHexOfV_AtObj(o,n[1]);q.key.e=ASN1HEX.getHexOfV_AtObj(o,n[2]);q.key.d=ASN1HEX.getHexOfV_AtObj(o,n[3]);q.key.p=ASN1HEX.getHexOfV_AtObj(o,n[4]);q.key.q=ASN1HEX.getHexOfV_AtObj(o,n[5]);q.key.dp=ASN1HEX.getHexOfV_AtObj(o,n[6]);q.key.dq=ASN1HEX.getHexOfV_AtObj(o,n[7]);q.key.co=ASN1HEX.getHexOfV_AtObj(o,n[8])},parsePrivateRawECKeyHexAtObj:function(o,q){var p=q.keyidx;if(o.substr(p,2)!="30"){throw"malformed ECC private key(code:001)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(o,p);if(n.length!=3){throw"malformed ECC private key(code:002)"}if(o.substr(n[1],2)!="04"){throw"malformed ECC private key(code:003)"}q.key=ASN1HEX.getHexOfV_AtObj(o,n[1])},parsePublicPKCS8Hex:function(q){var o={};o.algparam=null;var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,0);if(p.length!=2){throw"outer DERSequence shall have 2 elements: "+p.length}var r=p[0];if(q.substr(r,2)!="30"){throw"malformed PKCS8 public key(code:001)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(q,r);if(n.length!=2){throw"malformed PKCS8 public key(code:002)"}if(q.substr(n[0],2)!="06"){throw"malformed PKCS8 public key(code:003)"}o.algoid=ASN1HEX.getHexOfV_AtObj(q,n[0]);if(q.substr(n[1],2)=="06"){o.algparam=ASN1HEX.getHexOfV_AtObj(q,n[1])}if(q.substr(p[1],2)!="03"){throw"malformed PKCS8 public key(code:004)"}o.key=ASN1HEX.getHexOfV_AtObj(q,p[1]).substr(2);return o},getRSAKeyFromPublicPKCS8Hex:function(r){var q=ASN1HEX.getPosArrayOfChildren_AtObj(r,0);if(q.length!=2){throw"outer DERSequence shall have 2 elements: "+q.length}var p=ASN1HEX.getHexOfTLV_AtObj(r,q[0]);if(p!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmId is not rsaEncryption"}if(r.substr(q[1],2)!="03"){throw"PKCS8 Public Key is not BITSTRING encapslated."}var t=ASN1HEX.getStartPosOfV_AtObj(r,q[1])+2;if(r.substr(t,2)!="30"){throw"PKCS8 Public Key is not SEQUENCE."}var n=ASN1HEX.getPosArrayOfChildren_AtObj(r,t);if(n.length!=2){throw"inner DERSequence shall have 2 elements: "+n.length}if(r.substr(n[0],2)!="02"){throw"N is not ASN.1 INTEGER"}if(r.substr(n[1],2)!="02"){throw"E is not ASN.1 INTEGER"}var u=ASN1HEX.getHexOfV_AtObj(r,n[0]);var s=ASN1HEX.getHexOfV_AtObj(r,n[1]);var o=new RSAKey();o.setPublic(u,s);return o},}}();
-/*! keyutil-1.0.12.js (c) 2013-2015 Kenji Urushima | kjur.github.com/jsrsasign/license
- */
-var KEYUTIL=function(){var d=function(p,r,q){return k(CryptoJS.AES,p,r,q)};var e=function(p,r,q){return k(CryptoJS.TripleDES,p,r,q)};var a=function(p,r,q){return k(CryptoJS.DES,p,r,q)};var k=function(s,x,u,q){var r=CryptoJS.enc.Hex.parse(x);var w=CryptoJS.enc.Hex.parse(u);var p=CryptoJS.enc.Hex.parse(q);var t={};t.key=w;t.iv=p;t.ciphertext=r;var v=s.decrypt(t,w,{iv:p});return CryptoJS.enc.Hex.stringify(v)};var l=function(p,r,q){return g(CryptoJS.AES,p,r,q)};var o=function(p,r,q){return g(CryptoJS.TripleDES,p,r,q)};var f=function(p,r,q){return g(CryptoJS.DES,p,r,q)};var g=function(t,y,v,q){var s=CryptoJS.enc.Hex.parse(y);var x=CryptoJS.enc.Hex.parse(v);var p=CryptoJS.enc.Hex.parse(q);var w=t.encrypt(s,x,{iv:p});var r=CryptoJS.enc.Hex.parse(w.toString());var u=CryptoJS.enc.Base64.stringify(r);return u};var i={"AES-256-CBC":{proc:d,eproc:l,keylen:32,ivlen:16},"AES-192-CBC":{proc:d,eproc:l,keylen:24,ivlen:16},"AES-128-CBC":{proc:d,eproc:l,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:e,eproc:o,keylen:24,ivlen:8},"DES-CBC":{proc:a,eproc:f,keylen:8,ivlen:8}};var c=function(p){return i[p]["proc"]};var m=function(p){var r=CryptoJS.lib.WordArray.random(p);var q=CryptoJS.enc.Hex.stringify(r);return q};var n=function(t){var u={};if(t.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"))){u.cipher=RegExp.$1;u.ivsalt=RegExp.$2}if(t.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"))){u.type=RegExp.$1}var r=-1;var v=0;if(t.indexOf("\r\n\r\n")!=-1){r=t.indexOf("\r\n\r\n");v=2}if(t.indexOf("\n\n")!=-1){r=t.indexOf("\n\n");v=1}var q=t.indexOf("-----END");if(r!=-1&&q!=-1){var p=t.substring(r+v*2,q-v);p=p.replace(/\s+/g,"");u.data=p}return u};var j=function(q,y,p){var v=p.substring(0,16);var t=CryptoJS.enc.Hex.parse(v);var r=CryptoJS.enc.Utf8.parse(y);var u=i[q]["keylen"]+i[q]["ivlen"];var x="";var w=null;for(;;){var s=CryptoJS.algo.MD5.create();if(w!=null){s.update(w)}s.update(r);s.update(t);w=s.finalize();x=x+CryptoJS.enc.Hex.stringify(w);if(x.length>=u*2){break}}var z={};z.keyhex=x.substr(0,i[q]["keylen"]*2);z.ivhex=x.substr(i[q]["keylen"]*2,i[q]["ivlen"]*2);return z};var b=function(p,v,r,w){var s=CryptoJS.enc.Base64.parse(p);var q=CryptoJS.enc.Hex.stringify(s);var u=i[v]["proc"];var t=u(q,r,w);return t};var h=function(p,s,q,u){var r=i[s]["eproc"];var t=r(p,q,u);return t};return{version:"1.0.0",getHexFromPEM:function(q,u){var r=q;if(r.indexOf("-----BEGIN ")==-1){throw"can't find PEM header: "+u}if(typeof u=="string"&&u!=""){r=r.replace("-----BEGIN "+u+"-----","");r=r.replace("-----END "+u+"-----","")}else{r=r.replace(/-----BEGIN [^-]+-----/,"");r=r.replace(/-----END [^-]+-----/,"")}var t=r.replace(/\s+/g,"");var p=b64tohex(t);return p},getDecryptedKeyHexByKeyIV:function(q,t,s,r){var p=c(t);return p(q,s,r)},parsePKCS5PEM:function(p){return n(p)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(q,p,r){return j(q,p,r)},decryptKeyB64:function(p,r,q,s){return b(p,r,q,s)},getDecryptedKeyHex:function(y,x){var q=n(y);var t=q.type;var r=q.cipher;var p=q.ivsalt;var s=q.data;var w=j(r,x,p);var v=w.keyhex;var u=b(s,r,v,p);return u},getRSAKeyFromEncryptedPKCS5PEM:function(r,q){var s=this.getDecryptedKeyHex(r,q);var p=new RSAKey();p.readPrivateKeyFromASN1HexString(s);return p},getEncryptedPKCS5PEMFromPrvKeyHex:function(x,s,A,t,r){var p="";if(typeof t=="undefined"||t==null){t="AES-256-CBC"}if(typeof i[t]=="undefined"){throw"KEYUTIL unsupported algorithm: "+t}if(typeof r=="undefined"||r==null){var v=i[t]["ivlen"];var u=m(v);r=u.toUpperCase()}var z=j(t,A,r);var y=z.keyhex;var w=h(s,t,y,r);var q=w.replace(/(.{64})/g,"$1\r\n");var p="-----BEGIN "+x+" PRIVATE KEY-----\r\n";p+="Proc-Type: 4,ENCRYPTED\r\n";p+="DEK-Info: "+t+","+r+"\r\n";p+="\r\n";p+=q;p+="\r\n-----END "+x+" PRIVATE KEY-----\r\n";return p},getEncryptedPKCS5PEMFromRSAKey:function(D,E,r,t){var B=new KJUR.asn1.DERInteger({"int":0});var w=new KJUR.asn1.DERInteger({bigint:D.n});var A=new KJUR.asn1.DERInteger({"int":D.e});var C=new KJUR.asn1.DERInteger({bigint:D.d});var u=new KJUR.asn1.DERInteger({bigint:D.p});var s=new KJUR.asn1.DERInteger({bigint:D.q});var z=new KJUR.asn1.DERInteger({bigint:D.dmp1});var v=new KJUR.asn1.DERInteger({bigint:D.dmq1});var y=new KJUR.asn1.DERInteger({bigint:D.coeff});var F=new KJUR.asn1.DERSequence({array:[B,w,A,C,u,s,z,v,y]});var x=F.getEncodedHex();return this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",x,E,r,t)},newEncryptedPKCS5PEM:function(p,q,t,u){if(typeof q=="undefined"||q==null){q=1024}if(typeof t=="undefined"||t==null){t="10001"}var r=new RSAKey();r.generate(q,t);var s=null;if(typeof u=="undefined"||u==null){s=this.getEncryptedPKCS5PEMFromRSAKey(r,p)}else{s=this.getEncryptedPKCS5PEMFromRSAKey(r,p,u)}return s},getRSAKeyFromPlainPKCS8PEM:function(r){if(r.match(/ENCRYPTED/)){throw"pem shall be not ENCRYPTED"}var q=this.getHexFromPEM(r,"PRIVATE KEY");var p=this.getRSAKeyFromPlainPKCS8Hex(q);return p},getRSAKeyFromPlainPKCS8Hex:function(s){var r=ASN1HEX.getPosArrayOfChildren_AtObj(s,0);if(r.length!=3){throw"outer DERSequence shall have 3 elements: "+r.length}var q=ASN1HEX.getHexOfTLV_AtObj(s,r[1]);if(q!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmIdentifier is not rsaEnc: "+q}var q=ASN1HEX.getHexOfTLV_AtObj(s,r[1]);var t=ASN1HEX.getHexOfTLV_AtObj(s,r[2]);var u=ASN1HEX.getHexOfV_AtObj(t,0);var p=new RSAKey();p.readPrivateKeyFromASN1HexString(u);return p},parseHexOfEncryptedPKCS8:function(w){var s={};var r=ASN1HEX.getPosArrayOfChildren_AtObj(w,0);if(r.length!=2){throw"malformed format: SEQUENCE(0).items != 2: "+r.length}s.ciphertext=ASN1HEX.getHexOfV_AtObj(w,r[1]);var y=ASN1HEX.getPosArrayOfChildren_AtObj(w,r[0]);if(y.length!=2){throw"malformed format: SEQUENCE(0.0).items != 2: "+y.length}if(ASN1HEX.getHexOfV_AtObj(w,y[0])!="2a864886f70d01050d"){throw"this only supports pkcs5PBES2"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(w,y[1]);if(y.length!=2){throw"malformed format: SEQUENCE(0.0.1).items != 2: "+p.length}var q=ASN1HEX.getPosArrayOfChildren_AtObj(w,p[1]);if(q.length!=2){throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+q.length}if(ASN1HEX.getHexOfV_AtObj(w,q[0])!="2a864886f70d0307"){throw"this only supports TripleDES"}s.encryptionSchemeAlg="TripleDES";s.encryptionSchemeIV=ASN1HEX.getHexOfV_AtObj(w,q[1]);var t=ASN1HEX.getPosArrayOfChildren_AtObj(w,p[0]);if(t.length!=2){throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+t.length}if(ASN1HEX.getHexOfV_AtObj(w,t[0])!="2a864886f70d01050c"){throw"this only supports pkcs5PBKDF2"}var x=ASN1HEX.getPosArrayOfChildren_AtObj(w,t[1]);if(x.length<2){throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+x.length}s.pbkdf2Salt=ASN1HEX.getHexOfV_AtObj(w,x[0]);var u=ASN1HEX.getHexOfV_AtObj(w,x[1]);try{s.pbkdf2Iter=parseInt(u,16)}catch(v){throw"malformed format pbkdf2Iter: "+u}return s},getPBKDF2KeyHexFromParam:function(u,p){var t=CryptoJS.enc.Hex.parse(u.pbkdf2Salt);var q=u.pbkdf2Iter;var s=CryptoJS.PBKDF2(p,t,{keySize:192/32,iterations:q});var r=CryptoJS.enc.Hex.stringify(s);return r},getPlainPKCS8HexFromEncryptedPKCS8PEM:function(x,y){var r=this.getHexFromPEM(x,"ENCRYPTED PRIVATE KEY");var p=this.parseHexOfEncryptedPKCS8(r);var u=KEYUTIL.getPBKDF2KeyHexFromParam(p,y);var v={};v.ciphertext=CryptoJS.enc.Hex.parse(p.ciphertext);var t=CryptoJS.enc.Hex.parse(u);var s=CryptoJS.enc.Hex.parse(p.encryptionSchemeIV);var w=CryptoJS.TripleDES.decrypt(v,t,{iv:s});var q=CryptoJS.enc.Hex.stringify(w);return q},getRSAKeyFromEncryptedPKCS8PEM:function(s,r){var q=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(s,r);var p=this.getRSAKeyFromPlainPKCS8Hex(q);return p},getKeyFromEncryptedPKCS8PEM:function(s,q){var p=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(s,q);var r=this.getKeyFromPlainPrivatePKCS8Hex(p);return r},parsePlainPrivatePKCS8Hex:function(s){var q={};q.algparam=null;if(s.substr(0,2)!="30"){throw"malformed plain PKCS8 private key(code:001)"}var r=ASN1HEX.getPosArrayOfChildren_AtObj(s,0);if(r.length!=3){throw"malformed plain PKCS8 private key(code:002)"}if(s.substr(r[1],2)!="30"){throw"malformed PKCS8 private key(code:003)"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(s,r[1]);if(p.length!=2){throw"malformed PKCS8 private key(code:004)"}if(s.substr(p[0],2)!="06"){throw"malformed PKCS8 private key(code:005)"}q.algoid=ASN1HEX.getHexOfV_AtObj(s,p[0]);if(s.substr(p[1],2)=="06"){q.algparam=ASN1HEX.getHexOfV_AtObj(s,p[1])}if(s.substr(r[2],2)!="04"){throw"malformed PKCS8 private key(code:006)"}q.keyidx=ASN1HEX.getStartPosOfV_AtObj(s,r[2]);return q},getKeyFromPlainPrivatePKCS8PEM:function(q){var p=this.getHexFromPEM(q,"PRIVATE KEY");var r=this.getKeyFromPlainPrivatePKCS8Hex(p);return r},getKeyFromPlainPrivatePKCS8Hex:function(p){var w=this.parsePlainPrivatePKCS8Hex(p);if(w.algoid=="2a864886f70d010101"){this.parsePrivateRawRSAKeyHexAtObj(p,w);var u=w.key;var z=new RSAKey();z.setPrivateEx(u.n,u.e,u.d,u.p,u.q,u.dp,u.dq,u.co);return z}else{if(w.algoid=="2a8648ce3d0201"){this.parsePrivateRawECKeyHexAtObj(p,w);if(KJUR.crypto.OID.oidhex2name[w.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+w.algparam}var v=KJUR.crypto.OID.oidhex2name[w.algparam];var z=new KJUR.crypto.ECDSA({curve:v});z.setPublicKeyHex(w.pubkey);z.setPrivateKeyHex(w.key);z.isPublic=false;return z}else{if(w.algoid=="2a8648ce380401"){var t=ASN1HEX.getVbyList(p,0,[1,1,0],"02");var s=ASN1HEX.getVbyList(p,0,[1,1,1],"02");var y=ASN1HEX.getVbyList(p,0,[1,1,2],"02");var B=ASN1HEX.getVbyList(p,0,[2,0],"02");var r=new BigInteger(t,16);var q=new BigInteger(s,16);var x=new BigInteger(y,16);var A=new BigInteger(B,16);var z=new KJUR.crypto.DSA();z.setPrivate(r,q,x,null,A);return z}else{throw"unsupported private key algorithm"}}}},getRSAKeyFromPublicPKCS8PEM:function(q){var r=this.getHexFromPEM(q,"PUBLIC KEY");var p=this.getRSAKeyFromPublicPKCS8Hex(r);return p},getKeyFromPublicPKCS8PEM:function(q){var r=this.getHexFromPEM(q,"PUBLIC KEY");var p=this.getKeyFromPublicPKCS8Hex(r);return p},getKeyFromPublicPKCS8Hex:function(q){var p=this.parsePublicPKCS8Hex(q);if(p.algoid=="2a864886f70d010101"){var u=this.parsePublicRawRSAKeyHex(p.key);var r=new RSAKey();r.setPublic(u.n,u.e);return r}else{if(p.algoid=="2a8648ce3d0201"){if(KJUR.crypto.OID.oidhex2name[p.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+p.algparam}var s=KJUR.crypto.OID.oidhex2name[p.algparam];var r=new KJUR.crypto.ECDSA({curve:s,pub:p.key});return r}else{if(p.algoid=="2a8648ce380401"){var t=p.algparam;var v=ASN1HEX.getHexOfV_AtObj(p.key,0);var r=new KJUR.crypto.DSA();r.setPublic(new BigInteger(t.p,16),new BigInteger(t.q,16),new BigInteger(t.g,16),new BigInteger(v,16));return r}else{throw"unsupported public key algorithm"}}}},parsePublicRawRSAKeyHex:function(r){var p={};if(r.substr(0,2)!="30"){throw"malformed RSA key(code:001)"}var q=ASN1HEX.getPosArrayOfChildren_AtObj(r,0);if(q.length!=2){throw"malformed RSA key(code:002)"}if(r.substr(q[0],2)!="02"){throw"malformed RSA key(code:003)"}p.n=ASN1HEX.getHexOfV_AtObj(r,q[0]);if(r.substr(q[1],2)!="02"){throw"malformed RSA key(code:004)"}p.e=ASN1HEX.getHexOfV_AtObj(r,q[1]);return p},parsePrivateRawRSAKeyHexAtObj:function(q,s){var r=s.keyidx;if(q.substr(r,2)!="30"){throw"malformed RSA private key(code:001)"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,r);if(p.length!=9){throw"malformed RSA private key(code:002)"}s.key={};s.key.n=ASN1HEX.getHexOfV_AtObj(q,p[1]);s.key.e=ASN1HEX.getHexOfV_AtObj(q,p[2]);s.key.d=ASN1HEX.getHexOfV_AtObj(q,p[3]);s.key.p=ASN1HEX.getHexOfV_AtObj(q,p[4]);s.key.q=ASN1HEX.getHexOfV_AtObj(q,p[5]);s.key.dp=ASN1HEX.getHexOfV_AtObj(q,p[6]);s.key.dq=ASN1HEX.getHexOfV_AtObj(q,p[7]);s.key.co=ASN1HEX.getHexOfV_AtObj(q,p[8])},parsePrivateRawECKeyHexAtObj:function(p,t){var q=t.keyidx;var r=ASN1HEX.getVbyList(p,q,[1],"04");var s=ASN1HEX.getVbyList(p,q,[2,0],"03").substr(2);t.key=r;t.pubkey=s},parsePublicPKCS8Hex:function(s){var q={};q.algparam=null;var r=ASN1HEX.getPosArrayOfChildren_AtObj(s,0);if(r.length!=2){throw"outer DERSequence shall have 2 elements: "+r.length}var t=r[0];if(s.substr(t,2)!="30"){throw"malformed PKCS8 public key(code:001)"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(s,t);if(p.length!=2){throw"malformed PKCS8 public key(code:002)"}if(s.substr(p[0],2)!="06"){throw"malformed PKCS8 public key(code:003)"}q.algoid=ASN1HEX.getHexOfV_AtObj(s,p[0]);if(s.substr(p[1],2)=="06"){q.algparam=ASN1HEX.getHexOfV_AtObj(s,p[1])}else{if(s.substr(p[1],2)=="30"){q.algparam={};q.algparam.p=ASN1HEX.getVbyList(s,p[1],[0],"02");q.algparam.q=ASN1HEX.getVbyList(s,p[1],[1],"02");q.algparam.g=ASN1HEX.getVbyList(s,p[1],[2],"02")}}if(s.substr(r[1],2)!="03"){throw"malformed PKCS8 public key(code:004)"}q.key=ASN1HEX.getHexOfV_AtObj(s,r[1]).substr(2);return q},getRSAKeyFromPublicPKCS8Hex:function(t){var s=ASN1HEX.getPosArrayOfChildren_AtObj(t,0);if(s.length!=2){throw"outer DERSequence shall have 2 elements: "+s.length}var r=ASN1HEX.getHexOfTLV_AtObj(t,s[0]);if(r!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmId is not rsaEncryption"}if(t.substr(s[1],2)!="03"){throw"PKCS8 Public Key is not BITSTRING encapslated."}var v=ASN1HEX.getStartPosOfV_AtObj(t,s[1])+2;if(t.substr(v,2)!="30"){throw"PKCS8 Public Key is not SEQUENCE."}var p=ASN1HEX.getPosArrayOfChildren_AtObj(t,v);if(p.length!=2){throw"inner DERSequence shall have 2 elements: "+p.length}if(t.substr(p[0],2)!="02"){throw"N is not ASN.1 INTEGER"}if(t.substr(p[1],2)!="02"){throw"E is not ASN.1 INTEGER"}var w=ASN1HEX.getHexOfV_AtObj(t,p[0]);var u=ASN1HEX.getHexOfV_AtObj(t,p[1]);var q=new RSAKey();q.setPublic(w,u);return q},}}();KEYUTIL.getKey=function(f,e,h){if(typeof RSAKey!="undefined"&&f instanceof RSAKey){return f}if(typeof KJUR.crypto.ECDSA!="undefined"&&f instanceof KJUR.crypto.ECDSA){return f}if(typeof KJUR.crypto.DSA!="undefined"&&f instanceof KJUR.crypto.DSA){return f}if(f.curve!==undefined&&f.xy!==undefined&&f.d===undefined){return new KJUR.crypto.ECDSA({pub:f.xy,curve:f.curve})}if(f.curve!==undefined&&f.d!==undefined){return new KJUR.crypto.ECDSA({prv:f.d,curve:f.curve})}if(f.kty===undefined&&f.n!==undefined&&f.e!==undefined&&f.d===undefined){var w=new RSAKey();w.setPublic(f.n,f.e);return w}if(f.kty===undefined&&f.n!==undefined&&f.e!==undefined&&f.d!==undefined&&f.p!==undefined&&f.q!==undefined&&f.dp!==undefined&&f.dq!==undefined&&f.co!==undefined&&f.qi===undefined){var w=new RSAKey();w.setPrivateEx(f.n,f.e,f.d,f.p,f.q,f.dp,f.dq,f.co);return w}if(f.kty===undefined&&f.n!==undefined&&f.e!==undefined&&f.d!==undefined&&f.p===undefined){var w=new RSAKey();w.setPrivate(f.n,f.e,f.d);return w}if(f.p!==undefined&&f.q!==undefined&&f.g!==undefined&&f.y!==undefined&&f.x===undefined){var w=new KJUR.crypto.DSA();w.setPublic(f.p,f.q,f.g,f.y);return w}if(f.p!==undefined&&f.q!==undefined&&f.g!==undefined&&f.y!==undefined&&f.x!==undefined){var w=new KJUR.crypto.DSA();w.setPrivate(f.p,f.q,f.g,f.y,f.x);return w}if(f.kty==="RSA"&&f.n!==undefined&&f.e!==undefined&&f.d===undefined){var w=new RSAKey();w.setPublic(b64utohex(f.n),b64utohex(f.e));return w}if(f.kty==="RSA"&&f.n!==undefined&&f.e!==undefined&&f.d!==undefined&&f.p!==undefined&&f.q!==undefined&&f.dp!==undefined&&f.dq!==undefined&&f.qi!==undefined){var w=new RSAKey();w.setPrivateEx(b64utohex(f.n),b64utohex(f.e),b64utohex(f.d),b64utohex(f.p),b64utohex(f.q),b64utohex(f.dp),b64utohex(f.dq),b64utohex(f.qi));return w}if(f.kty==="RSA"&&f.n!==undefined&&f.e!==undefined&&f.d!==undefined){var w=new RSAKey();w.setPrivate(b64utohex(f.n),b64utohex(f.e),b64utohex(f.d));return w}if(f.kty==="EC"&&f.crv!==undefined&&f.x!==undefined&&f.y!==undefined&&f.d===undefined){var d=new KJUR.crypto.ECDSA({curve:f.crv});var l=d.ecparams.keylen/4;var r=("0000000000"+b64utohex(f.x)).slice(-l);var n=("0000000000"+b64utohex(f.y)).slice(-l);var m="04"+r+n;d.setPublicKeyHex(m);return d}if(f.kty==="EC"&&f.crv!==undefined&&f.x!==undefined&&f.y!==undefined&&f.d!==undefined){var d=new KJUR.crypto.ECDSA({curve:f.crv});var l=d.ecparams.keylen/4;var a=("0000000000"+b64utohex(f.d)).slice(-l);d.setPrivateKeyHex(a);return d}if(f.indexOf("-END CERTIFICATE-",0)!=-1||f.indexOf("-END X509 CERTIFICATE-",0)!=-1||f.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1){return X509.getPublicKeyFromCertPEM(f)}if(h==="pkcs8pub"){return KEYUTIL.getKeyFromPublicPKCS8Hex(f)}if(f.indexOf("-END PUBLIC KEY-")!=-1){return KEYUTIL.getKeyFromPublicPKCS8PEM(f)}if(h==="pkcs5prv"){var w=new RSAKey();w.readPrivateKeyFromASN1HexString(f);return w}if(h==="pkcs5prv"){var w=new RSAKey();w.readPrivateKeyFromASN1HexString(f);return w}if(f.indexOf("-END RSA PRIVATE KEY-")!=-1&&f.indexOf("4,ENCRYPTED")==-1){var i=KEYUTIL.getHexFromPEM(f,"RSA PRIVATE KEY");return KEYUTIL.getKey(i,null,"pkcs5prv")}if(f.indexOf("-END DSA PRIVATE KEY-")!=-1&&f.indexOf("4,ENCRYPTED")==-1){var u=this.getHexFromPEM(f,"DSA PRIVATE KEY");var t=ASN1HEX.getVbyList(u,0,[1],"02");var s=ASN1HEX.getVbyList(u,0,[2],"02");var v=ASN1HEX.getVbyList(u,0,[3],"02");var j=ASN1HEX.getVbyList(u,0,[4],"02");var k=ASN1HEX.getVbyList(u,0,[5],"02");var w=new KJUR.crypto.DSA();w.setPrivate(new BigInteger(t,16),new BigInteger(s,16),new BigInteger(v,16),new BigInteger(j,16),new BigInteger(k,16));return w}if(f.indexOf("-END PRIVATE KEY-")!=-1){return KEYUTIL.getKeyFromPlainPrivatePKCS8PEM(f)}if(f.indexOf("-END RSA PRIVATE KEY-")!=-1&&f.indexOf("4,ENCRYPTED")!=-1){return KEYUTIL.getRSAKeyFromEncryptedPKCS5PEM(f,e)}if(f.indexOf("-END EC PRIVATE KEY-")!=-1&&f.indexOf("4,ENCRYPTED")!=-1){var u=KEYUTIL.getDecryptedKeyHex(f,e);var w=ASN1HEX.getVbyList(u,0,[1],"04");var c=ASN1HEX.getVbyList(u,0,[2,0],"06");var o=ASN1HEX.getVbyList(u,0,[3,0],"03").substr(2);var b="";if(KJUR.crypto.OID.oidhex2name[c]!==undefined){b=KJUR.crypto.OID.oidhex2name[c]}else{throw"undefined OID(hex) in KJUR.crypto.OID: "+c}var d=new KJUR.crypto.ECDSA({name:b});d.setPublicKeyHex(o);d.setPrivateKeyHex(w);d.isPublic=false;return d}if(f.indexOf("-END DSA PRIVATE KEY-")!=-1&&f.indexOf("4,ENCRYPTED")!=-1){var u=KEYUTIL.getDecryptedKeyHex(f,e);var t=ASN1HEX.getVbyList(u,0,[1],"02");var s=ASN1HEX.getVbyList(u,0,[2],"02");var v=ASN1HEX.getVbyList(u,0,[3],"02");var j=ASN1HEX.getVbyList(u,0,[4],"02");var k=ASN1HEX.getVbyList(u,0,[5],"02");var w=new KJUR.crypto.DSA();w.setPrivate(new BigInteger(t,16),new BigInteger(s,16),new BigInteger(v,16),new BigInteger(j,16),new BigInteger(k,16));return w}if(f.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1){return KEYUTIL.getKeyFromEncryptedPKCS8PEM(f,e)}throw"not supported argument"};KEYUTIL.generateKeypair=function(a,c){if(a=="RSA"){var b=c;var h=new RSAKey();h.generate(b,"10001");h.isPrivate=true;h.isPublic=true;var f=new RSAKey();var e=h.n.toString(16);var i=h.e.toString(16);f.setPublic(e,i);f.isPrivate=false;f.isPublic=true;var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{if(a=="EC"){var d=c;var g=new KJUR.crypto.ECDSA({curve:d});var j=g.generateKeyPairHex();var h=new KJUR.crypto.ECDSA({curve:d});h.setPrivateKeyHex(j.ecprvhex);h.isPrivate=true;h.isPublic=false;var f=new KJUR.crypto.ECDSA({curve:d});f.setPublicKeyHex(j.ecpubhex);f.isPrivate=false;f.isPublic=true;var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{throw"unknown algorithm: "+a}}};KEYUTIL.getPEM=function(a,r,o,g,j){var v=KJUR.asn1;var u=KJUR.crypto;function p(s){var w=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{"int":{bigint:s.n}},{"int":s.e},{"int":{bigint:s.d}},{"int":{bigint:s.p}},{"int":{bigint:s.q}},{"int":{bigint:s.dmp1}},{"int":{bigint:s.dmq1}},{"int":{bigint:s.coeff}}]});return w}function q(w){var s=KJUR.asn1.ASN1Util.newObject({seq:[{"int":1},{octstr:{hex:w.prvKeyHex}},{tag:["a0",true,{oid:{name:w.curveName}}]},{tag:["a1",true,{bitstr:{hex:"00"+w.pubKeyHex}}]}]});return s}function n(s){var w=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{"int":{bigint:s.p}},{"int":{bigint:s.q}},{"int":{bigint:s.g}},{"int":{bigint:s.y}},{"int":{bigint:s.x}}]});return w}if(((typeof RSAKey!="undefined"&&a instanceof RSAKey)||(typeof u.DSA!="undefined"&&a instanceof u.DSA)||(typeof u.ECDSA!="undefined"&&a instanceof u.ECDSA))&&a.isPublic==true&&(r===undefined||r=="PKCS8PUB")){var t=new KJUR.asn1.x509.SubjectPublicKeyInfo(a);var m=t.getEncodedHex();return v.ASN1Util.getPEMStringFromHex(m,"PUBLIC KEY")}if(r=="PKCS1PRV"&&typeof RSAKey!="undefined"&&a instanceof RSAKey&&(o===undefined||o==null)&&a.isPrivate==true){var t=p(a);var m=t.getEncodedHex();return v.ASN1Util.getPEMStringFromHex(m,"RSA PRIVATE KEY")}if(r=="PKCS1PRV"&&typeof RSAKey!="undefined"&&a instanceof KJUR.crypto.ECDSA&&(o===undefined||o==null)&&a.isPrivate==true){var f=new KJUR.asn1.DERObjectIdentifier({name:a.curveName});var l=f.getEncodedHex();var e=q(a);var k=e.getEncodedHex();var i="";i+=v.ASN1Util.getPEMStringFromHex(l,"EC PARAMETERS");i+=v.ASN1Util.getPEMStringFromHex(k,"EC PRIVATE KEY");return i}if(r=="PKCS1PRV"&&typeof KJUR.crypto.DSA!="undefined"&&a instanceof KJUR.crypto.DSA&&(o===undefined||o==null)&&a.isPrivate==true){var t=n(a);var m=t.getEncodedHex();return v.ASN1Util.getPEMStringFromHex(m,"DSA PRIVATE KEY")}if(r=="PKCS5PRV"&&typeof RSAKey!="undefined"&&a instanceof RSAKey&&(o!==undefined&&o!=null)&&a.isPrivate==true){var t=p(a);var m=t.getEncodedHex();if(g===undefined){g="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",m,o,g)}if(r=="PKCS5PRV"&&typeof KJUR.crypto.ECDSA!="undefined"&&a instanceof KJUR.crypto.ECDSA&&(o!==undefined&&o!=null)&&a.isPrivate==true){var t=q(a);var m=t.getEncodedHex();if(g===undefined){g="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",m,o,g)}if(r=="PKCS5PRV"&&typeof KJUR.crypto.DSA!="undefined"&&a instanceof KJUR.crypto.DSA&&(o!==undefined&&o!=null)&&a.isPrivate==true){var t=n(a);var m=t.getEncodedHex();if(g===undefined){g="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",m,o,g)}var h=function(w,s){var y=b(w,s);var x=new KJUR.asn1.ASN1Util.newObject({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:y.pbkdf2Salt}},{"int":y.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:y.encryptionSchemeIV}}]}]}]},{octstr:{hex:y.ciphertext}}]});return x.getEncodedHex()};var b=function(D,E){var x=100;var C=CryptoJS.lib.WordArray.random(8);var B="DES-EDE3-CBC";var s=CryptoJS.lib.WordArray.random(8);var y=CryptoJS.PBKDF2(E,C,{keySize:192/32,iterations:x});var z=CryptoJS.enc.Hex.parse(D);var A=CryptoJS.TripleDES.encrypt(z,y,{iv:s})+"";var w={};w.ciphertext=A;w.pbkdf2Salt=CryptoJS.enc.Hex.stringify(C);w.pbkdf2Iter=x;w.encryptionSchemeAlg=B;w.encryptionSchemeIV=CryptoJS.enc.Hex.stringify(s);return w};if(r=="PKCS8PRV"&&typeof RSAKey!="undefined"&&a instanceof RSAKey&&a.isPrivate==true){var d=p(a);var c=d.getEncodedHex();var t=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{seq:[{oid:{name:"rsaEncryption"}},{"null":true}]},{octstr:{hex:c}}]});var m=t.getEncodedHex();if(o===undefined||o==null){return v.ASN1Util.getPEMStringFromHex(m,"PRIVATE KEY")}else{var k=h(m,o);return v.ASN1Util.getPEMStringFromHex(k,"ENCRYPTED PRIVATE KEY")}}if(r=="PKCS8PRV"&&typeof KJUR.crypto.ECDSA!="undefined"&&a instanceof KJUR.crypto.ECDSA&&a.isPrivate==true){var d=new KJUR.asn1.ASN1Util.newObject({seq:[{"int":1},{octstr:{hex:a.prvKeyHex}},{tag:["a1",true,{bitstr:{hex:"00"+a.pubKeyHex}}]}]});var c=d.getEncodedHex();var t=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:a.curveName}}]},{octstr:{hex:c}}]});var m=t.getEncodedHex();if(o===undefined||o==null){return v.ASN1Util.getPEMStringFromHex(m,"PRIVATE KEY")}else{var k=h(m,o);return v.ASN1Util.getPEMStringFromHex(k,"ENCRYPTED PRIVATE KEY")}}if(r=="PKCS8PRV"&&typeof KJUR.crypto.DSA!="undefined"&&a instanceof KJUR.crypto.DSA&&a.isPrivate==true){var d=new KJUR.asn1.DERInteger({bigint:a.x});var c=d.getEncodedHex();var t=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{seq:[{oid:{name:"dsa"}},{seq:[{"int":{bigint:a.p}},{"int":{bigint:a.q}},{"int":{bigint:a.g}}]}]},{octstr:{hex:c}}]});var m=t.getEncodedHex();if(o===undefined||o==null){return v.ASN1Util.getPEMStringFromHex(m,"PRIVATE KEY")}else{var k=h(m,o);return v.ASN1Util.getPEMStringFromHex(k,"ENCRYPTED PRIVATE KEY")}}throw"unsupported object nor format"};KEYUTIL.getKeyFromCSRPEM=function(b){var a=KEYUTIL.getHexFromPEM(b,"CERTIFICATE REQUEST");var c=KEYUTIL.getKeyFromCSRHex(a);return c};KEYUTIL.getKeyFromCSRHex=function(a){var c=KEYUTIL.parseCSRHex(a);var b=KEYUTIL.getKey(c.p8pubkeyhex,null,"pkcs8pub");return b};KEYUTIL.parseCSRHex=function(c){var b={};var e=c;if(e.substr(0,2)!="30"){throw"malformed CSR(code:001)"}var d=ASN1HEX.getPosArrayOfChildren_AtObj(e,0);if(d.length<1){throw"malformed CSR(code:002)"}if(e.substr(d[0],2)!="30"){throw"malformed CSR(code:003)"}var a=ASN1HEX.getPosArrayOfChildren_AtObj(e,d[0]);if(a.length<3){throw"malformed CSR(code:004)"}b.p8pubkeyhex=ASN1HEX.getHexOfTLV_AtObj(e,a[2]);return b};
-/*! rsapem-1.1.js (c) 2012 Kenji Urushima | kjur.github.com/jsrsasign/license
- */
-function _rsapem_pemToBase64(b){var a=b;a=a.replace("-----BEGIN RSA PRIVATE KEY-----","");a=a.replace("-----END RSA PRIVATE KEY-----","");a=a.replace(/[ \n]+/g,"");return a}function _rsapem_getPosArrayOfChildrenFromHex(d){var j=new Array();var k=ASN1HEX.getStartPosOfV_AtObj(d,0);var f=ASN1HEX.getPosOfNextSibling_AtObj(d,k);var h=ASN1HEX.getPosOfNextSibling_AtObj(d,f);var b=ASN1HEX.getPosOfNextSibling_AtObj(d,h);var l=ASN1HEX.getPosOfNextSibling_AtObj(d,b);var e=ASN1HEX.getPosOfNextSibling_AtObj(d,l);var g=ASN1HEX.getPosOfNextSibling_AtObj(d,e);var c=ASN1HEX.getPosOfNextSibling_AtObj(d,g);var i=ASN1HEX.getPosOfNextSibling_AtObj(d,c);j.push(k,f,h,b,l,e,g,c,i);return j}function _rsapem_getHexValueArrayOfChildrenFromHex(i){var o=_rsapem_getPosArrayOfChildrenFromHex(i);var r=ASN1HEX.getHexOfV_AtObj(i,o[0]);var f=ASN1HEX.getHexOfV_AtObj(i,o[1]);var j=ASN1HEX.getHexOfV_AtObj(i,o[2]);var k=ASN1HEX.getHexOfV_AtObj(i,o[3]);var c=ASN1HEX.getHexOfV_AtObj(i,o[4]);var b=ASN1HEX.getHexOfV_AtObj(i,o[5]);var h=ASN1HEX.getHexOfV_AtObj(i,o[6]);var g=ASN1HEX.getHexOfV_AtObj(i,o[7]);var l=ASN1HEX.getHexOfV_AtObj(i,o[8]);var m=new Array();m.push(r,f,j,k,c,b,h,g,l);return m}function _rsapem_readPrivateKeyFromASN1HexString(c){var b=_rsapem_getHexValueArrayOfChildrenFromHex(c);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])}function _rsapem_readPrivateKeyFromPEMString(e){var c=_rsapem_pemToBase64(e);var d=b64tohex(c);var b=_rsapem_getHexValueArrayOfChildrenFromHex(d);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])}RSAKey.prototype.readPrivateKeyFromPEMString=_rsapem_readPrivateKeyFromPEMString;RSAKey.prototype.readPrivateKeyFromASN1HexString=_rsapem_readPrivateKeyFromASN1HexString;
-/*! rsasign-1.2.7.js (c) 2012 Kenji Urushima | kjur.github.com/jsrsasign/license
- */
-var _RE_HEXDECONLY=new RegExp("");_RE_HEXDECONLY.compile("[^0-9a-f]","gi");function _rsasign_getHexPaddedDigestInfoForString(d,e,a){var b=function(f){return KJUR.crypto.Util.hashString(f,a)};var c=b(d);return KJUR.crypto.Util.getPaddedDigestInfoHex(c,a,e)}function _zeroPaddingOfSignature(e,d){var c="";var a=d/4-e.length;for(var b=0;b>24,(d&16711680)>>16,(d&65280)>>8,d&255]))));d+=1}return b}function _rsasign_signStringPSS(e,a,d){var c=function(f){return KJUR.crypto.Util.hashHex(f,a)};var b=c(rstrtohex(e));if(d===undefined){d=-1}return this.signWithMessageHashPSS(b,a,d)}function _rsasign_signWithMessageHashPSS(l,a,k){var b=hextorstr(l);var g=b.length;var m=this.n.bitLength()-1;var c=Math.ceil(m/8);var d;var o=function(i){return KJUR.crypto.Util.hashHex(i,a)};if(k===-1||k===undefined){k=g}else{if(k===-2){k=c-g-2}else{if(k<-2){throw"invalid salt length"}}}if(c<(g+k+2)){throw"data too long"}var f="";if(k>0){f=new Array(k);new SecureRandom().nextBytes(f);f=String.fromCharCode.apply(String,f)}var n=hextorstr(o(rstrtohex("\x00\x00\x00\x00\x00\x00\x00\x00"+b+f)));var j=[];for(d=0;d>(8*c-m))&255;q[0]&=~p;for(d=0;dthis.n.bitLength()){return 0}var i=this.doPublic(b);var e=i.toString(16).replace(/^1f+00/,"");var g=_rsasign_getAlgNameAndHashFromHexDisgestInfo(e);if(g.length==0){return false}var d=g[0];var h=g[1];var a=function(k){return KJUR.crypto.Util.hashString(k,d)};var c=a(f);return(h==c)}function _rsasign_verifyWithMessageHash(e,a){a=a.replace(_RE_HEXDECONLY,"");a=a.replace(/[ \n]+/g,"");var b=parseBigInt(a,16);if(b.bitLength()>this.n.bitLength()){return 0}var h=this.doPublic(b);var g=h.toString(16).replace(/^1f+00/,"");var c=_rsasign_getAlgNameAndHashFromHexDisgestInfo(g);if(c.length==0){return false}var d=c[0];var f=c[1];return(f==e)}function _rsasign_verifyStringPSS(c,b,a,f){var e=function(g){return KJUR.crypto.Util.hashHex(g,a)};var d=e(rstrtohex(c));if(f===undefined){f=-1}return this.verifyWithMessageHashPSS(d,b,a,f)}function _rsasign_verifyWithMessageHashPSS(f,s,l,c){var k=new BigInteger(s,16);if(k.bitLength()>this.n.bitLength()){return false}var r=function(i){return KJUR.crypto.Util.hashHex(i,l)};var j=hextorstr(f);var h=j.length;var g=this.n.bitLength()-1;var m=Math.ceil(g/8);var q;if(c===-1||c===undefined){c=h}else{if(c===-2){c=m-h-2}else{if(c<-2){throw"invalid salt length"}}}if(m<(h+c+2)){throw"data too long"}var a=this.doPublic(k).toByteArray();for(q=0;q>(8*m-g))&255;if((d.charCodeAt(0)&p)!==0){throw"bits beyond keysize not zero"}var n=pss_mgf1_str(e,d.length,r);var o=[];for(q=0;q0){var c=":"+j.join(":")+":";if(c.indexOf(":"+h+":")==-1){throw"algorithm '"+h+"' not accepted in the list"}}if(h!="none"&&t===null){throw"key shall be specified to verify."}if(typeof t=="string"&&t.indexOf("-----BEGIN ")!=-1){t=KEYUTIL.getKey(t)}if(s=="RS"||s=="PS"){if(!(t instanceof RSAKey)){throw"key shall be a RSAKey obj for RS* and PS* algs"}}if(s=="ES"){if(!(t instanceof KJUR.crypto.ECDSA)){throw"key shall be a ECDSA obj for ES* algs"}}if(h=="none"){}var n=null;if(m.jwsalg2sigalg[i.alg]===undefined){throw"unsupported alg name: "+h}else{n=m.jwsalg2sigalg[h]}if(n=="none"){throw"not supported"}else{if(n.substr(0,4)=="Hmac"){var k=null;if(t===undefined){throw"hexadecimal key shall be specified for HMAC"}var g=new KJUR.crypto.Mac({alg:n,pass:t});g.updateString(b);k=g.doFinal();return r==k}else{if(n.indexOf("withECDSA")!=-1){var f=null;try{f=KJUR.crypto.ECDSA.concatSigToASN1Sig(r)}catch(o){return false}var e=new KJUR.crypto.Signature({alg:n});e.init(t);e.updateString(b);return e.verify(f)}else{var e=new KJUR.crypto.Signature({alg:n});e.init(t);e.updateString(b);return e.verify(r)}}}};KJUR.jws.JWS.parse=function(g){var c=g.split(".");var b={};var f,e,d;if(c.length!=2&&c.length!=3){throw"malformed sJWS: wrong number of '.' splitted elements"}f=c[0];e=c[1];if(c.length==3){d=c[2]}b.headerObj=KJUR.jws.JWS.readSafeJSONString(b64utoutf8(f));b.payloadObj=KJUR.jws.JWS.readSafeJSONString(b64utoutf8(e));b.headerPP=JSON.stringify(b.headerObj,null," ");if(b.payloadObj==null){b.payloadPP=b64utoutf8(e)}else{b.payloadPP=JSON.stringify(b.payloadObj,null," ")}if(d!==undefined){b.sigHex=b64utohex(d)}return b};KJUR.jws.JWS.verifyJWT=function(d,j,l){var h=KJUR.jws.JWS;var i=d.split(".");var c=i[0];var g=i[1];var m=c+"."+g;var k=b64utohex(i[2]);var f=h.readSafeJSONString(b64utoutf8(c));var e=h.readSafeJSONString(b64utoutf8(g));if(f.alg===undefined){return false}if(l.alg===undefined){throw"acceptField.alg shall be specified"}if(!h.inArray(f.alg,l.alg)){return false}if(e.iss!==undefined&&typeof l.iss==="object"){if(!h.inArray(e.iss,l.iss)){return false}}if(e.sub!==undefined&&typeof l.sub==="object"){if(!h.inArray(e.sub,l.sub)){return false}}if(e.aud!==undefined&&typeof l.aud==="object"){if(typeof e.aud=="string"){if(!h.inArray(e.aud,l.aud)){return false}}else{if(typeof e.aud=="object"){if(!h.includedArray(e.aud,l.aud)){return false}}}}var b=KJUR.jws.IntDate.getNow();if(l.verifyAt!==undefined&&typeof l.verifyAt==="number"){b=l.verifyAt}if(l.gracePeriod===undefined||typeof l.gracePeriod!=="number"){l.gracePeriod=0}if(e.exp!==undefined&&typeof e.exp=="number"){if(e.exp+l.gracePeriodMIT License
- */
-
-if (typeof KJUR == "undefined" || !KJUR) KJUR = {};
-
-/**
- * kjur's JSON Web Signature/Token(JWS/JWT) library name space
- *
- * This namespace privides following JWS/JWS related classes.
- *
- * {@link KJUR.jws.JWS} - JSON Web Signature/Token(JWS/JWT) class
- * {@link KJUR.jws.JWSJS} - JWS JSON Serialization(JWSJS) class
- * {@link KJUR.jws.IntDate} - UNIX origin time utility class
- *
- * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.
- *
- * @name KJUR.jws
- * @namespace
- */
-if (typeof KJUR.jws == "undefined" || !KJUR.jws) KJUR.jws = {};
-
-/**
- * JSON Web Signature(JWS) class.
- * @name KJUR.jws.JWS
- * @class JSON Web Signature(JWS) class
- * @see 'jwjws'(JWS JavaScript Library) home page http://kjur.github.com/jsjws/
- * @see 'jwrsasign'(RSA Sign JavaScript Library) home page http://kjur.github.com/jsrsasign/
- * @see IETF I-D JSON Web Algorithms (JWA)
- * @since jsjws 1.0
- * @description
- * This class provides JSON Web Signature(JWS)/JSON Web Token(JWT) signing and validation.
- * Supported Algorithms
- * Here is supported algorithm names for {@link KJUR.jws.JWS.sign} and {@link KJUR.jws.JWS.verify}
- * methods.
- *
- * alg value spec requirement jsjws support
- * HS256 REQUIRED SUPPORTED
- * HS384 OPTIONAL SUPPORTED
- * HS512 OPTIONAL SUPPORTED
- * RS256 RECOMMENDED SUPPORTED
- * RS384 OPTIONAL SUPPORTED
- * RS512 OPTIONAL SUPPORTED
- * ES256 RECOMMENDED+ SUPPORTED
- * ES384 OPTIONAL SUPPORTED
- * ES512 OPTIONAL -
- * PS256 OPTIONAL SUPPORTED
- * PS384 OPTIONAL SUPPORTED
- * PS512 OPTIONAL SUPPORTED
- * none REQUIRED SUPPORTED(signature generation only)
- *
- *
- * NOTE1
- * HS384 is supported since jsjws 3.0.2 with jsrsasign 4.1.4.
- * NOTE2
- * Some deprecated methods have been removed since jws 3.3 of jsrsasign 4.10.0.
- * Removed methods are following:
- *
- * JWS.verifyJWSByNE
- * JWS.verifyJWSByKey
- * JWS.generateJWSByNED
- * JWS.generateJWSByKey
- * JWS.generateJWSByP1PrvKey
- *
- *
- * EXAMPLE
- * @example
- * // JWS signing
- * sJWS = KJUR.jws.JWS.sign(null, '{"alg":"HS256", "cty":"JWT"}', '{"age": 21}', "password");
- * // JWS validation
- * isValid = KJUR.jws.JWS.verify('eyJjdHkiOiJKV1QiLCJhbGc...', "password");
- * // JWT validation
- * isValid = KJUR.jws.JWS.verifyJWT('eyJh...', "password", {
- * alg: ['HS256', 'HS384'],
- * iss: ['http://foo.com']
- * });
- */
-KJUR.jws.JWS = function() {
- var ns1 = KJUR.jws.JWS;
-
- // === utility =============================================================
-
- /**
- * parse JWS string and set public property 'parsedJWS' dictionary.
- * @name parseJWS
- * @memberOf KJUR.jws.JWS
- * @function
- * @param {String} sJWS JWS signature string to be parsed.
- * @throws if sJWS is not comma separated string such like "Header.Payload.Signature".
- * @throws if JWS Header is a malformed JSON string.
- * @since jws 1.1
- */
- this.parseJWS = function(sJWS, sigValNotNeeded) {
- if ((this.parsedJWS !== undefined) &&
- (sigValNotNeeded || (this.parsedJWS.sigvalH !== undefined))) {
- return;
- }
- if (sJWS.match(/^([^.]+)\.([^.]+)\.([^.]+)$/) == null) {
- throw "JWS signature is not a form of 'Head.Payload.SigValue'.";
- }
- var b6Head = RegExp.$1;
- var b6Payload = RegExp.$2;
- var b6SigVal = RegExp.$3;
- var sSI = b6Head + "." + b6Payload;
- this.parsedJWS = {};
- this.parsedJWS.headB64U = b6Head;
- this.parsedJWS.payloadB64U = b6Payload;
- this.parsedJWS.sigvalB64U = b6SigVal;
- this.parsedJWS.si = sSI;
-
- if (!sigValNotNeeded) {
- var hSigVal = b64utohex(b6SigVal);
- var biSigVal = parseBigInt(hSigVal, 16);
- this.parsedJWS.sigvalH = hSigVal;
- this.parsedJWS.sigvalBI = biSigVal;
- }
-
- var sHead = b64utoutf8(b6Head);
- var sPayload = b64utoutf8(b6Payload);
- this.parsedJWS.headS = sHead;
- this.parsedJWS.payloadS = sPayload;
-
- if (! ns1.isSafeJSONString(sHead, this.parsedJWS, 'headP'))
- throw "malformed JSON string for JWS Head: " + sHead;
- };
-};
-
-// === major static method ========================================================
-
-/**
- * generate JWS signature by specified key
- * @name sign
- * @memberOf KJUR.jws.JWS
- * @function
- * @static
- * @param {String} alg JWS algorithm name to sign and force set to sHead or null
- * @param {String} spHead string or object of JWS Header
- * @param {String} spPayload string or object of JWS Payload
- * @param {String} key string of private key or mac key object to sign
- * @param {String} pass (OPTION)passcode to use encrypted asymmetric private key
- * @return {String} JWS signature string
- * @since jws 3.0.0
- * @see jsrsasign KJUR.crypto.Signature method
- * @see jsrsasign KJUR.crypto.Mac method
- * @description
- * This method supports following algorithms.
- *
- * alg value spec requirement jsjws support
- * HS256 REQUIRED SUPPORTED
- * HS384 OPTIONAL SUPPORTED
- * HS512 OPTIONAL SUPPORTED
- * RS256 RECOMMENDED SUPPORTED
- * RS384 OPTIONAL SUPPORTED
- * RS512 OPTIONAL SUPPORTED
- * ES256 RECOMMENDED+ SUPPORTED
- * ES384 OPTIONAL SUPPORTED
- * ES512 OPTIONAL -
- * PS256 OPTIONAL SUPPORTED
- * PS384 OPTIONAL SUPPORTED
- * PS512 OPTIONAL SUPPORTED
- * none REQUIRED SUPPORTED(signature generation only)
- *
- *
- * NOTE1:
- * salt length of RSAPSS signature is the same as the hash algorithm length
- * because of IETF JOSE ML discussion .
- * NOTE2:
- * To support HS384, patched version of CryptoJS is used.
- * See here for detail .
- * NOTE3:
- * From jsrsasign 4.10.0 jws 3.3.0, Way to provide password
- * for HS* algorithm is changed. The 'key' attribute value is
- * passed to {@link KJUR.crypto.Mac.setPassword} so please see
- * {@link KJUR.crypto.Mac.setPassword} for detail.
- * As for backword compatibility, if key is a string, has even length and
- * 0..9, A-F or a-f characters, key string is treated as a hexadecimal
- * otherwise it is treated as a raw string.
- *
- *
- * EXAMPLE
- * @example
- * // sign HS256 signature with password "aaa" implicitly handled as string
- * sJWS = KJUR.jws.JWS.sign(null, {alg: "HS256", cty: "JWT"}, {age: 21}, "aaa");
- * // sign HS256 signature with password "6161" implicitly handled as hex
- * sJWS = KJUR.jws.JWS.sign(null, {alg: "HS256", cty: "JWT"}, {age: 21}, "6161");
- * // sign HS256 signature with base64 password
- * sJWS = KJUR.jws.JWS.sign(null, {alg: "HS256"}, {age: 21}, {b64: "Mi/8..a="});
- * // sign RS256 signature with PKCS#8 PEM RSA private key
- * sJWS = KJUR.jws.JWS.sign(null, {alg: "RS256"}, {age: 21}, "-----BEGIN PRIVATE KEY...");
- * // sign RS256 signature with PKCS#8 PEM ECC private key with passcode
- * sJWS = KJUR.jws.JWS.sign(null, {alg: "ES256"}, {age: 21},
- * "-----BEGIN PRIVATE KEY...", "keypass");
- * // header and payload can be passed by both string and object
- * sJWS = KJUR.jws.JWS.sign(null, '{alg:"HS256",cty:"JWT"}', '{age:21}', "aaa");
- */
-KJUR.jws.JWS.sign = function(alg, spHeader, spPayload, key, pass) {
- var ns1 = KJUR.jws.JWS;
- var sHeader, pHeader, sPayload;
-
- // 1. check signatureInput(Header, Payload) is string or object
- if (typeof spHeader != 'string' && typeof spHeader != 'object')
- throw "spHeader must be JSON string or object: " + spHeader;
-
- if (typeof spHeader == 'object') {
- pHeader = spHeader;
- sHeader = JSON.stringify(pHeader);
- }
-
- if (typeof spHeader == 'string') {
- sHeader = spHeader;
- if (! ns1.isSafeJSONString(sHeader))
- throw "JWS Head is not safe JSON string: " + sHeader;
- pHeader = ns1.readSafeJSONString(sHeader);
-
- }
-
- sPayload = spPayload;
- if (typeof spPayload == 'object') sPayload = JSON.stringify(spPayload);
-
- // 2. use alg if defined in sHeader
- if ((alg == '' || alg == null) &&
- pHeader['alg'] !== undefined) {
- alg = pHeader['alg'];
- }
-
- // 3. update sHeader to add alg if alg undefined
- if ((alg != '' && alg != null) &&
- pHeader['alg'] === undefined) {
- pHeader['alg'] = alg;
- sHeader = JSON.stringify(pHeader);
- }
-
- // 4. check explicit algorithm doesn't match with JWS header.
- if (alg !== pHeader.alg)
- throw "alg and sHeader.alg doesn't match: " + alg + "!=" + pHeader.alg;
-
- // 5. set signature algorithm like SHA1withRSA
- var sigAlg = null;
- if (ns1.jwsalg2sigalg[alg] === undefined) {
- throw "unsupported alg name: " + alg;
- } else {
- sigAlg = ns1.jwsalg2sigalg[alg];
- }
-
- var uHeader = utf8tob64u(sHeader);
- var uPayload = utf8tob64u(sPayload);
- var uSignatureInput = uHeader + "." + uPayload
- // 6. sign
- var hSig = "";
- if (sigAlg.substr(0, 4) == "Hmac") {
- if (key === undefined)
- throw "mac key shall be specified for HS* alg";
- //alert("sigAlg=" + sigAlg);
- var mac = new KJUR.crypto.Mac({'alg': sigAlg, 'prov': 'cryptojs', 'pass': key});
- mac.updateString(uSignatureInput);
- hSig = mac.doFinal();
- } else if (sigAlg.indexOf("withECDSA") != -1) {
- var sig = new KJUR.crypto.Signature({'alg': sigAlg});
- sig.init(key, pass);
- sig.updateString(uSignatureInput);
- hASN1Sig = sig.sign();
- hSig = KJUR.crypto.ECDSA.asn1SigToConcatSig(hASN1Sig);
- } else if (sigAlg != "none") {
- var sig = new KJUR.crypto.Signature({'alg': sigAlg});
- sig.init(key, pass);
- sig.updateString(uSignatureInput);
- hSig = sig.sign();
- }
-
- var uSig = hextob64u(hSig);
- return uSignatureInput + "." + uSig;
-};
-
-/**
- * verify JWS signature by specified key or certificate
- * @name verify
- * @memberOf KJUR.jws.JWS
- * @function
- * @static
- * @param {String} sJWS string of JWS signature to verify
- * @param {Object} key string of public key, certificate or key object to verify
- * @param {String} acceptAlgs array of algorithm name strings (OPTION)
- * @return {Boolean} true if the signature is valid otherwise false
- * @since jws 3.0.0
- * @see jsrsasign KJUR.crypto.Signature method
- * @see jsrsasign KJUR.crypto.Mac method
- * @description
- *
- * This method verifies a JSON Web Signature Compact Serialization string by the validation
- * algorithm as described in
- *
- * the section 5 of Internet Draft draft-jones-json-web-signature-04.
- *
- *
- * Since 3.2.0 strict key checking has been provided against a JWS algorithm
- * in a JWS header.
- *
- * In case 'alg' is 'HS*' in the JWS header,
- * 'key' shall be hexadecimal string for Hmac{256,384,512} shared secret key.
- * Otherwise it raise an error.
- * In case 'alg' is 'RS*' or 'PS*' in the JWS header,
- * 'key' shall be a RSAKey object or a PEM string of
- * X.509 RSA public key certificate or PKCS#8 RSA public key.
- * Otherwise it raise an error.
- * In case 'alg' is 'ES*' in the JWS header,
- * 'key' shall be a KJUR.crypto.ECDSA object or a PEM string of
- * X.509 ECC public key certificate or PKCS#8 ECC public key.
- * Otherwise it raise an error.
- * In case 'alg' is 'none' in the JWS header,
- * validation not supported after jsjws 3.1.0.
- *
- *
- *
- * NOTE1: The argument 'acceptAlgs' is supported since 3.2.0.
- * Strongly recommended to provide acceptAlgs to mitigate
- * signature replacement attacks.
- *
- *
- * NOTE2: From jsrsasign 4.9.0 jws 3.2.5, Way to provide password
- * for HS* algorithm is changed. The 'key' attribute value is
- * passed to {@link KJUR.crypto.Mac.setPassword} so please see
- * {@link KJUR.crypto.Mac.setPassword} for detail.
- * As for backword compatibility, if key is a string, has even length and
- * 0..9, A-F or a-f characters, key string is treated as a hexadecimal
- * otherwise it is treated as a raw string.
- *
- * @example
- * // 1) verify a RS256 JWS signature by a certificate string.
- * isValid = KJUR.jws.JWS.verify('eyJh...', '-----BEGIN...', ['RS256']);
- *
- * // 2) verify a HS256 JWS signature by a certificate string.
- * isValid = KJUR.jws.JWS.verify('eyJh...', {hex: '6f62ad...'}, ['HS256']);
- * isValid = KJUR.jws.JWS.verify('eyJh...', {b64: 'Mi/ab8...a=='}, ['HS256']);
- * isValid = KJUR.jws.JWS.verify('eyJh...', {utf8: 'Secret秘密'}, ['HS256']);
- * isValid = KJUR.jws.JWS.verify('eyJh...', '6f62ad', ['HS256']); // implicit hex
- * isValid = KJUR.jws.JWS.verify('eyJh...', '6f62ada', ['HS256']); // implicit raw string
- *
- * // 3) verify a ES256 JWS signature by a KJUR.crypto.ECDSA key object.
- * var pubkey = KEYUTIL.getKey('-----BEGIN CERT...');
- * var isValid = KJUR.jws.JWS.verify('eyJh...', pubkey);
- */
-KJUR.jws.JWS.verify = function(sJWS, key, acceptAlgs) {
- var jws = KJUR.jws.JWS;
- var a = sJWS.split(".");
- var uHeader = a[0];
- var uPayload = a[1];
- var uSignatureInput = uHeader + "." + uPayload;
- var hSig = b64utohex(a[2]);
-
- // 1. parse JWS header
- var pHeader = jws.readSafeJSONString(b64utoutf8(a[0]));
- var alg = null;
- var algType = null; // HS|RS|PS|ES|no
- if (pHeader.alg === undefined) {
- throw "algorithm not specified in header";
- } else {
- alg = pHeader.alg;
- algType = alg.substr(0, 2);
- }
-
- // 2. check whether alg is acceptable algorithms
- if (acceptAlgs != null &&
- Object.prototype.toString.call(acceptAlgs) === '[object Array]' &&
- acceptAlgs.length > 0) {
- var acceptAlgStr = ":" + acceptAlgs.join(":") + ":";
- if (acceptAlgStr.indexOf(":" + alg + ":") == -1) {
- throw "algorithm '" + alg + "' not accepted in the list";
- }
- }
-
- // 3. check whether key is a proper key for alg.
- if (alg != "none" && key === null) {
- throw "key shall be specified to verify.";
- }
-
- // 3.1. There is no key check for HS* because Mac will check it.
- // since jsrsasign 5.0.0.
-
- // 3.2. convert key object if key is a public key or cert PEM string
- if (typeof key == "string" &&
- key.indexOf("-----BEGIN ") != -1) {
- key = KEYUTIL.getKey(key);
- }
-
- // 3.3. check whether key is RSAKey obj if alg is RS* or PS*.
- if (algType == "RS" || algType == "PS") {
- if (!(key instanceof RSAKey)) {
- throw "key shall be a RSAKey obj for RS* and PS* algs";
- }
- }
-
- // 3.4. check whether key is ECDSA obj if alg is ES*.
- if (algType == "ES") {
- if (!(key instanceof KJUR.crypto.ECDSA)) {
- throw "key shall be a ECDSA obj for ES* algs";
- }
- }
-
- // 3.5. check when alg is 'none'
- if (alg == "none") {
- }
-
- // 4. check whether alg is supported alg in jsjws.
- var sigAlg = null;
- if (jws.jwsalg2sigalg[pHeader.alg] === undefined) {
- throw "unsupported alg name: " + alg;
- } else {
- sigAlg = jws.jwsalg2sigalg[alg];
- }
-
- // 5. verify
- if (sigAlg == "none") {
- throw "not supported";
- } else if (sigAlg.substr(0, 4) == "Hmac") {
- var hSig2 = null;
- if (key === undefined)
- throw "hexadecimal key shall be specified for HMAC";
- //try {
- var mac = new KJUR.crypto.Mac({'alg': sigAlg, 'pass': key});
- mac.updateString(uSignatureInput);
- hSig2 = mac.doFinal();
- //} catch(ex) {};
- return hSig == hSig2;
- } else if (sigAlg.indexOf("withECDSA") != -1) {
- var hASN1Sig = null;
- try {
- hASN1Sig = KJUR.crypto.ECDSA.concatSigToASN1Sig(hSig);
- } catch (ex) {
- return false;
- }
- var sig = new KJUR.crypto.Signature({'alg': sigAlg});
- sig.init(key)
- sig.updateString(uSignatureInput);
- return sig.verify(hASN1Sig);
- } else {
- var sig = new KJUR.crypto.Signature({'alg': sigAlg});
- sig.init(key)
- sig.updateString(uSignatureInput);
- return sig.verify(hSig);
- }
-};
-
-/**
- * parse header and payload of JWS signature
- * @name parse
- * @memberOf KJUR.jws.JWS
- * @function
- * @static
- * @param {String} sJWS string of JWS signature to parse
- * @return {Array} associative array of parsed header and payload. See below.
- * @throws if sJWS is malformed JWS signature
- * @since jws 3.3.3
- * @description
- * This method parses JWS signature string.
- * Resulted associative array has following properties:
- *
- * headerObj - JSON object of header
- * payloadObj - JSON object of payload if payload is JSON string otherwise undefined
- * headerPP - pretty printed JSON header by stringify
- * payloadPP - pretty printed JSON payload by stringify if payload is JSON otherwise Base64URL decoded raw string of payload
- * sigHex - hexadecimal string of signature
- *
- * @example
- * 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..."
- * }
- */
-KJUR.jws.JWS.parse = function(sJWS) {
- var a = sJWS.split(".");
- var result = {};
- var uHeader, uPayload, uSig;
- if (a.length != 2 && a.length != 3)
- throw "malformed sJWS: wrong number of '.' splitted elements";
-
- uHeader = a[0];
- uPayload = a[1];
- if (a.length == 3) uSig = a[2];
-
- result.headerObj = KJUR.jws.JWS.readSafeJSONString(b64utoutf8(uHeader));
- result.payloadObj = KJUR.jws.JWS.readSafeJSONString(b64utoutf8(uPayload));
-
- result.headerPP = JSON.stringify(result.headerObj, null, " ");
- if (result.payloadObj == null) {
- result.payloadPP = b64utoutf8(uPayload);
- } else {
- result.payloadPP = JSON.stringify(result.payloadObj, null, " ");
- }
-
- if (uSig !== undefined) {
- result.sigHex = b64utohex(uSig);
- }
-
- return result;
-};
-
-/**
- * @name verifyJWT
- * @memberOf KJUR.jws.JWS
- * @function
- * @static
- * @param {String} sJWT string of JSON Web Token(JWT) to verify
- * @param {Object} key string of public key, certificate or key object to verify
- * @param {Array} acceptField associative array of acceptable fields (OPTION)
- * @return {Boolean} true if the JWT token is valid otherwise false
- * @since jws 3.2.3 jsrsasign 4.8.0
- *
- * @description
- * This method verifies a
- * RFC 7519
- * JSON Web Token(JWT).
- * It will verify following:
- *
- * Header.alg
- *
- * alg is specified in JWT header.
- * alg is included in acceptField.alg array. (MANDATORY)
- * alg is proper for key.
- *
- *
- * Payload.iss (issuer) - Payload.iss is included in acceptField.iss array if specified. (OPTION)
- * Payload.sub (subject) - Payload.sub is included in acceptField.sub array if specified. (OPTION)
- * Payload.aud (audience) - Payload.aud is included in acceptField.aud array or
- * the same as value if specified. (OPTION)
- * Time validity
- *
- *
- * If acceptField.verifyAt as number of UNIX origin time is specifed for validation time,
- * this method will verify at the time for it, otherwise current time will be used to verify.
- *
- *
- * Clock of JWT generator or verifier can be fast or slow. If these clocks are
- * very different, JWT validation may fail. To avoid such case, 'jsrsasign' supports
- * 'acceptField.gracePeriod' parameter which specifies acceptable time difference
- * of those clocks in seconds. So if you want to accept slow or fast in 2 hours,
- * you can specify acceptField.gracePeriod = 2 * 60 * 60;
.
- * "gracePeriod" is zero by default.
- * "gracePeriod" is supported since jsrsasign 5.0.12.
- *
- * Payload.exp (expire) - Validation time is smaller than Payload.exp + gracePeriod.
- * Payload.nbf (not before) - Validation time is greater than Payload.nbf - gracePeriod.
- * Payload.iat (issued at) - Validation time is greater than Payload.iat - gracePeriod.
- *
- *
- * Payload.jti (JWT id) - Payload.jti is included in acceptField.jti if specified. (OPTION)
- * JWS signature of JWS is valid for specified key.
- *
- *
- * @example
- * // simple validation for HS256
- * isValid = KJUR.jws.JWS.verifyJWT("eyJhbG...", "616161", {alg: ["HS256"]}),
- *
- * // full validation for RS or PS
- * pubkey = KEYUTIL.getKey('-----BEGIN CERT...');
- * isValid = KJUR.jws.JWS.verifyJWT('eyJh...', pubkey, {
- * alg: ['RS256', 'RS512', 'PS256', 'PS512'],
- * iss: ['http://foo.com'],
- * sub: ['mailto:john@foo.com', 'mailto:alice@foo.com'],
- * verifyAt: KJUR.jws.IntDate.get('20150520235959Z'),
- * aud: ['http://foo.com'], // aud: 'http://foo.com' is fine too.
- * jti: 'id123456',
- * gracePeriod: 1 * 60 * 60 // accept 1 hour slow or fast
- * });
- */
-KJUR.jws.JWS.verifyJWT = function(sJWT, key, acceptField) {
- var ns1 = KJUR.jws.JWS;
-
- // 1. parse JWT
- var a = sJWT.split(".");
- var uHeader = a[0];
- var uPayload = a[1];
- var uSignatureInput = uHeader + "." + uPayload;
- var hSig = b64utohex(a[2]);
-
- // 2. parse JWS header
- var pHeader = ns1.readSafeJSONString(b64utoutf8(uHeader));
-
- // 3. parse JWS payload
- var pPayload = ns1.readSafeJSONString(b64utoutf8(uPayload));
-
- // 4. algorithm ('alg' in header) check
- if (pHeader.alg === undefined) return false;
- if (acceptField.alg === undefined)
- throw "acceptField.alg shall be specified";
- if (! ns1.inArray(pHeader.alg, acceptField.alg)) return false;
-
- // 5. issuer ('iss' in payload) check
- if (pPayload.iss !== undefined && typeof acceptField.iss === "object") {
- if (! ns1.inArray(pPayload.iss, acceptField.iss)) return false;
- }
-
- // 6. subject ('sub' in payload) check
- if (pPayload.sub !== undefined && typeof acceptField.sub === "object") {
- if (! ns1.inArray(pPayload.sub, acceptField.sub)) return false;
- }
-
- // 7. audience ('aud' in payload) check
- if (pPayload.aud !== undefined && typeof acceptField.aud === "object") {
- if (typeof pPayload.aud == "string") {
- if (! ns1.inArray(pPayload.aud, acceptField.aud))
- return false;
- } else if (typeof pPayload.aud == "object") {
- if (! ns1.includedArray(pPayload.aud, acceptField.aud))
- return false;
- }
- }
-
- // 8. time validity
- // (nbf - gracePeriod < now < exp + gracePeriod) && (iat - gracePeriod < now)
- var now = KJUR.jws.IntDate.getNow();
- if (acceptField.verifyAt !== undefined && typeof acceptField.verifyAt === "number") {
- now = acceptField.verifyAt;
- }
- if (acceptField.gracePeriod === undefined ||
- typeof acceptField.gracePeriod !== "number") {
- acceptField.gracePeriod = 0;
- }
-
- // 8.1 expired time 'exp' check
- if (pPayload.exp !== undefined && typeof pPayload.exp == "number") {
- if (pPayload.exp + acceptField.gracePeriod < now) return false;
- }
-
- // 8.2 not before time 'nbf' check
- if (pPayload.nbf !== undefined && typeof pPayload.nbf == "number") {
- if (now < pPayload.nbf - acceptField.gracePeriod) return false;
- }
-
- // 8.3 issued at time 'iat' check
- if (pPayload.iat !== undefined && typeof pPayload.iat == "number") {
- if (now < pPayload.iat - acceptField.gracePeriod) return false;
- }
-
- // 9 JWT id 'jti' check
- if (pPayload.jti !== undefined && acceptField.jti !== undefined) {
- if (pPayload.jti !== acceptField.jti) return false;
- }
-
- // 10 JWS signature check
- if (! KJUR.jws.JWS.verify(sJWT, key, acceptField.alg)) return false;
-
- // 11 passed all check
- return true;
-};
-
-/**
- * check whether array is included by another array
- * @name includedArray
- * @memberOf KJUR.jws.JWS
- * @function
- * @static
- * @param {Array} a1 check whether set a1 is included by a2
- * @param {Array} a2 check whether set a1 is included by a2
- * @return {Boolean} check whether set a1 is included by a2
- * @since jws 3.2.3
- * This method verifies whether an array is included by another array.
- * It doesn't care about item ordering in a array.
- * @example
- * KJUR.jws.JWS.includedArray(['b'], ['b', 'c', 'a']) => true
- * KJUR.jws.JWS.includedArray(['a', 'b'], ['b', 'c', 'a']) => true
- * KJUR.jws.JWS.includedArray(['a', 'b'], ['b', 'c']) => false
- */
-KJUR.jws.JWS.includedArray = function(a1, a2) {
- var inArray = KJUR.jws.JWS.inArray;
- if (a1 === null) return false;
- if (typeof a1 !== "object") return false;
- if (typeof a1.length !== "number") return false;
-
- for (var i = 0; i < a1.length; i++) {
- if (! inArray(a1[i], a2)) return false;
- }
- return true;
-};
-
-/**
- * check whether item is included by array
- * @name inArray
- * @memberOf KJUR.jws.JWS
- * @function
- * @static
- * @param {String} item check whether item is included by array
- * @param {Array} a check whether item is included by array
- * @return {Boolean} check whether item is included by array
- * @since jws 3.2.3
- * This method verifies whether an item is included by an array.
- * It doesn't care about item ordering in an array.
- * @example
- * KJUR.jws.JWS.inArray('b', ['b', 'c', 'a']) => true
- * KJUR.jws.JWS.inArray('a', ['b', 'c', 'a']) => true
- * KJUR.jws.JWS.inArray('a', ['b', 'c']) => false
- */
-KJUR.jws.JWS.inArray = function(item, a) {
- if (a === null) return false;
- if (typeof a !== "object") return false;
- if (typeof a.length !== "number") return false;
- for (var i = 0; i < a.length; i++) {
- if (a[i] == item) return true;
- }
- return false;
-};
-
-/**
- * static associative array of general signature algorithm name from JWS algorithm name
- * @since jws 3.0.0
- */
-KJUR.jws.JWS.jwsalg2sigalg = {
- "HS256": "HmacSHA256",
- "HS384": "HmacSHA384",
- "HS512": "HmacSHA512",
- "RS256": "SHA256withRSA",
- "RS384": "SHA384withRSA",
- "RS512": "SHA512withRSA",
- "ES256": "SHA256withECDSA",
- "ES384": "SHA384withECDSA",
- //"ES512": "SHA512withECDSA", // unsupported because of jsrsasign's bug
- "PS256": "SHA256withRSAandMGF1",
- "PS384": "SHA384withRSAandMGF1",
- "PS512": "SHA512withRSAandMGF1",
- "none": "none",
-};
-
-// === utility static method ==================================================
-
-/**
- * check whether a String "s" is a safe JSON string or not.
- * If a String "s" is a malformed JSON string or an other object type
- * this returns 0, otherwise this returns 1.
- * @name isSafeJSONString
- * @memberOf KJUR.jws.JWS
- * @function
- * @static
- * @param {String} s JSON string
- * @return {Number} 1 or 0
- */
-KJUR.jws.JWS.isSafeJSONString = function(s, h, p) {
- var o = null;
- try {
- o = jsonParse(s);
- if (typeof o != "object") return 0;
- if (o.constructor === Array) return 0;
- if (h) h[p] = o;
- return 1;
- } catch (ex) {
- return 0;
- }
-};
-
-/**
- * read a String "s" as JSON object if it is safe.
- * If a String "s" is a malformed JSON string or not JSON string,
- * this returns null, otherwise returns JSON object.
- * @name readSafeJSONString
- * @memberOf KJUR.jws.JWS
- * @function
- * @static
- * @param {String} s JSON string
- * @return {Object} JSON object or null
- * @since 1.1.1
- */
-KJUR.jws.JWS.readSafeJSONString = function(s) {
- var o = null;
- try {
- o = jsonParse(s);
- if (typeof o != "object") return null;
- if (o.constructor === Array) return null;
- return o;
- } catch (ex) {
- return null;
- }
-};
-
-/**
- * get Encoed Signature Value from JWS string.
- * @name getEncodedSignatureValueFromJWS
- * @memberOf KJUR.jws.JWS
- * @function
- * @static
- * @param {String} sJWS JWS signature string to be verified
- * @return {String} string of Encoded Signature Value
- * @throws if sJWS is not comma separated string such like "Header.Payload.Signature".
- */
-KJUR.jws.JWS.getEncodedSignatureValueFromJWS = function(sJWS) {
- if (sJWS.match(/^[^.]+\.[^.]+\.([^.]+)$/) == null) {
- throw "JWS signature is not a form of 'Head.Payload.SigValue'.";
- }
- return RegExp.$1;
-};
-
-/**
- * get RFC 7638 JWK thumbprint from JWK object
- * @name getJWKthumbprint
- * @memberOf KJUR.jws.JWS
- * @function
- * @static
- * @param {String} o JWK object to be calculated thumbprint
- * @return {String} Base64 URL encoded JWK thumbprint value
- * @since jsrsasign 5.0.2 jws 3.3.2
- * @description
- * This method calculates JWK thmubprint for specified JWK object
- * as described in
- * RFC 7638 .
- * It supports all type of "kty". (i.e. "RSA", "EC" and "oct"
- * (for symmetric key))
- * Working sample is
- * here .
- * @example
- * jwk = {"kty":"RSA", "n":"0vx...", "e":"AQAB", ...};
- * thumbprint = KJUR.jws.JWS.getJWKthumbprint(jwk);
- */
-KJUR.jws.JWS.getJWKthumbprint = function(o) {
- if (o.kty !== "RSA" &&
- o.kty !== "EC" &&
- o.kty !== "oct")
- throw "unsupported algorithm for JWK Thumprint";
-
- // 1. get canonically ordered json string
- var s = '{';
- if (o.kty === "RSA") {
- if (typeof o.n != "string" || typeof o.e != "string")
- throw "wrong n and e value for RSA key";
- s += '"' + 'e' + '":"' + o.e + '",';
- s += '"' + 'kty' + '":"' + o.kty + '",';
- s += '"' + 'n' + '":"' + o.n + '"}';
- } else if (o.kty === "EC") {
- if (typeof o.crv != "string" ||
- typeof o.x != "string" ||
- typeof o.y != "string")
- throw "wrong crv, x and y value for EC key";
- s += '"' + 'crv' + '":"' + o.crv + '",';
- s += '"' + 'kty' + '":"' + o.kty + '",';
- s += '"' + 'x' + '":"' + o.x + '",';
- s += '"' + 'y' + '":"' + o.y + '"}';
- } else if (o.kty === "oct") {
- if (typeof o.k != "string")
- throw "wrong k value for oct(symmetric) key";
- s += '"' + 'kty' + '":"' + o.kty + '",';
- s += '"' + 'k' + '":"' + o.k + '"}';
- }
- //alert(s);
-
- // 2. get thumb print
- var hJWK = rstrtohex(s);
- var hash = KJUR.crypto.Util.hashHex(hJWK, "sha256");
- var hashB64U = hextob64u(hash);
-
- return hashB64U;
-};
-
-/**
- * IntDate class for time representation for JSON Web Token(JWT)
- * @class KJUR.jws.IntDate class
- * @name KJUR.jws.IntDate
- * @since jws 3.0.1
- * @description
- * Utility class for IntDate which is integer representation of UNIX origin time
- * used in JSON Web Token(JWT).
- */
-KJUR.jws.IntDate = {};
-
-/**
- * get UNIX origin time from by string
- * @name get
- * @memberOf KJUR.jws.IntDate
- * @function
- * @static
- * @param {String} s string of time representation
- * @return {Integer} UNIX origin time in seconds for argument 's'
- * @since jws 3.0.1
- * @throws "unsupported format: s" when malformed format
- * @description
- * This method will accept following representation of time.
- *
- * now - current time
- * now + 1hour - after 1 hour from now
- * now + 1day - after 1 day from now
- * now + 1month - after 30 days from now
- * now + 1year - after 365 days from now
- * YYYYmmDDHHMMSSZ - UTC time (ex. 20130828235959Z)
- * number - UNIX origin time (seconds from 1970-01-01 00:00:00) (ex. 1377714748)
- *
- */
-KJUR.jws.IntDate.get = function(s) {
- if (s == "now") {
- return KJUR.jws.IntDate.getNow();
- } else if (s == "now + 1hour") {
- return KJUR.jws.IntDate.getNow() + 60 * 60;
- } else if (s == "now + 1day") {
- return KJUR.jws.IntDate.getNow() + 60 * 60 * 24;
- } else if (s == "now + 1month") {
- return KJUR.jws.IntDate.getNow() + 60 * 60 * 24 * 30;
- } else if (s == "now + 1year") {
- return KJUR.jws.IntDate.getNow() + 60 * 60 * 24 * 365;
- } else if (s.match(/Z$/)) {
- return KJUR.jws.IntDate.getZulu(s);
- } else if (s.match(/^[0-9]+$/)) {
- return parseInt(s);
- }
- throw "unsupported format: " + s;
-};
-
-/**
- * get UNIX origin time from Zulu time representation string
- * @name getZulu
- * @memberOf KJUR.jws.IntDate
- * @function
- * @static
- * @param {String} s string of Zulu time representation (ex. 20151012125959Z)
- * @return {Integer} UNIX origin time in seconds for argument 's'
- * @since jws 3.0.1
- * @throws "unsupported format: s" when malformed format
- * @description
- * This method provides UNIX origin time from Zulu time.
- * Following representations are supported:
- *
- * YYYYMMDDHHmmSSZ - GeneralizedTime format
- * YYMMDDHHmmSSZ - UTCTime format. If YY is greater or equal to
- * 50 then it represents 19YY otherwise 20YY.
- *
- * @example
- * KJUR.jws.IntDate.getZulu("20151012125959Z") => 1478...
- * KJUR.jws.IntDate.getZulu("151012125959Z") => 1478...
- */
-KJUR.jws.IntDate.getZulu = function(s) {
- var a;
- if (a = s.match(/(\d+)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)Z/)) {
- var sYear = RegExp.$1;
- var year = parseInt(sYear);
- if (sYear.length == 4) {
- } else if (sYear.length == 2) {
- if (50 <= year && year < 100) {
- year = 1900 + year;
- } else if (0 <= year && year < 50) {
- year = 2000 + year;
- } else {
- throw "malformed year string for UTCTime";
- }
- } else {
- throw "malformed year string";
- }
- var month = parseInt(RegExp.$2) - 1;
- var day = parseInt(RegExp.$3);
- var hour = parseInt(RegExp.$4);
- var min = parseInt(RegExp.$5);
- var sec = parseInt(RegExp.$6);
- var d = new Date(Date.UTC(year, month, day, hour, min, sec));
- return ~~(d / 1000);
- }
- throw "unsupported format: " + s;
-};
-
-/**
- * get UNIX origin time of current time
- * @name getNow
- * @memberOf KJUR.jws.IntDate
- * @function
- * @static
- * @return {Integer} UNIX origin time for current time
- * @since jws 3.0.1
- * @description
- * This method provides UNIX origin time for current time
- * @example
- * KJUR.jws.IntDate.getNow() => 1478...
- */
-KJUR.jws.IntDate.getNow = function() {
- var d = ~~(new Date() / 1000);
- return d;
-};
-
-/**
- * get UTC time string from UNIX origin time value
- * @name intDate2UTCString
- * @memberOf KJUR.jws.IntDate
- * @function
- * @static
- * @param {Integer} intDate UNIX origin time value (ex. 1478...)
- * @return {String} UTC time string
- * @since jws 3.0.1
- * @description
- * This method provides UTC time string for UNIX origin time value.
- * @example
- * KJUR.jws.IntDate.intDate2UTCString(1478...) => "2015 Oct ..."
- */
-KJUR.jws.IntDate.intDate2UTCString = function(intDate) {
- var d = new Date(intDate * 1000);
- return d.toUTCString();
-};
-
-/**
- * get UTC time string from UNIX origin time value
- * @name intDate2Zulu
- * @memberOf KJUR.jws.IntDate
- * @function
- * @static
- * @param {Integer} intDate UNIX origin time value (ex. 1478...)
- * @return {String} Zulu time string
- * @since jws 3.0.1
- * @description
- * This method provides Zulu time string for UNIX origin time value.
- * @example
- * KJUR.jws.IntDate.intDate2UTCString(1478...) => "20151012...Z"
- */
-KJUR.jws.IntDate.intDate2Zulu = function(intDate) {
- var d = new Date(intDate * 1000);
- var year = ("0000" + d.getUTCFullYear()).slice(-4);
- var mon = ("00" + (d.getUTCMonth() + 1)).slice(-2);
- var day = ("00" + d.getUTCDate()).slice(-2);
- var hour = ("00" + d.getUTCHours()).slice(-2);
- var min = ("00" + d.getUTCMinutes()).slice(-2);
- var sec = ("00" + d.getUTCSeconds()).slice(-2);
- return year + mon + day + hour + min + sec + "Z";
-};
-
diff --git a/jwt/jwsjs-2.0.js b/jwt/jwsjs-2.0.js
deleted file mode 100755
index c040356..0000000
--- a/jwt/jwsjs-2.0.js
+++ /dev/null
@@ -1,203 +0,0 @@
-/*! jwsjs-2.0.2 (c) 2010-2015 Kenji Urushima | kjur.github.com/jsrsasign/license
- */
-/*
- * jwsjs.js - JSON Web Signature JSON Serialization (JWSJS) Class
- *
- * version: 2.0.2 (2015 May 29)
- *
- * Copyright (c) 2010-2015 Kenji Urushima (kenji.urushima@gmail.com)
- *
- * This software is licensed under the terms of the MIT License.
- * http://kjur.github.com/jsrsasign/license/
- *
- * The above copyright and license notice shall be
- * included in all copies or substantial portions of the Software.
- */
-
-/**
- * @fileOverview
- * @name jwsjs-2.0.js
- * @author Kenji Urushima kenji.urushima@gmail.com
- * @version 2.0.2 (2015 May 29)
- * @since jsjws 1.2, jsrsasign 4.8.0
- * @license MIT License
- */
-
-if (typeof KJUR == "undefined" || !KJUR) KJUR = {};
-if (typeof KJUR.jws == "undefined" || !KJUR.jws) KJUR.jws = {};
-
-/**
- * JSON Web Signature JSON Serialization (JWSJS) class.
- * @class JSON Web Signature JSON Serialization (JWSJS) class
- * @name KJUR.jws.JWSJS
- * @property {array of String} aHeader array of Encoded JWS Headers
- * @property {String} sPayload Encoded JWS payload
- * @property {array of String} aSignature array of Encoded JWS signature value
- * @author Kenji Urushima
- * @version 1.0 (18 May 2012)
- * @requires base64x.js, json-sans-eval.js, jws.js and jsrsasign library
- * @see 'jwjws'(JWS JavaScript Library) home page http://kjur.github.com/jsjws/
- * @see 'jwrsasign'(RSA Sign JavaScript Library) home page http://kjur.github.com/jsrsasign/
- * @see IETF I-D JSON Web Signature JSON Serialization (JWS-JS) specification
- */
-KJUR.jws.JWSJS = function() {
- var ns1 = KJUR.jws.JWS;
-
- this.aHeader = [];
- this.sPayload = "";
- this.aSignature = [];
-
- // == initialize ===================================================================
- /**
- * (re-)initialize this object.
- * @name init
- * @memberOf KJUR.jws.JWSJS
- * @function
- */
- this.init = function() {
- this.aHeader = [];
- this.sPayload = "";
- this.aSignature = [];
- };
-
- /**
- * (re-)initialize and set first signature with JWS.
- * @name initWithJWS
- * @memberOf KJUR.jws.JWSJS
- * @param {String} sJWS JWS signature to set
- * @function
- */
- this.initWithJWS = function(sJWS) {
- this.init();
-
- var jws = new KJUR.jws.JWS();
- jws.parseJWS(sJWS);
-
- this.aHeader.push(jws.parsedJWS.headB64U);
- this.sPayload = jws.parsedJWS.payloadB64U;
- this.aSignature.push(jws.parsedJWS.sigvalB64U);
- };
-
- // == add signature ===================================================================
- /**
- * add a signature to existing JWS-JS by Header and PKCS1 private key.
- * @name addSignatureByHeaderKey
- * @memberOf KJUR.jws.JWSJS
- * @function
- * @param {String} sHead JSON string of JWS Header for adding signature.
- * @param {String} sPemPrvKey string of PKCS1 private key
- */
- this.addSignatureByHeaderKey = function(sHead, sPemPrvKey) {
- var sPayload = b64utoutf8(this.sPayload);
-
- var jws = new KJUR.jws.JWS();
- var sJWS = jws.generateJWSByP1PrvKey(sHead, sPayload, sPemPrvKey);
-
- this.aHeader.push(jws.parsedJWS.headB64U);
- this.aSignature.push(jws.parsedJWS.sigvalB64U);
- };
-
- /**
- * add a signature to existing JWS-JS by Header, Payload and PKCS1 private key.
- * This is to add first signature to JWS-JS object.
- * @name addSignatureByHeaderPayloadKey
- * @memberOf KJUR.jws.JWSJS
- * @function
- * @param {String} sHead JSON string of JWS Header for adding signature.
- * @param {String} sPayload string of JWS Payload for adding signature.
- * @param {String} sPemPrvKey string of PKCS1 private key
- */
- this.addSignatureByHeaderPayloadKey = function(sHead, sPayload, sPemPrvKey) {
- var jws = new KJUR.jws.JWS();
- var sJWS = jws.generateJWSByP1PrvKey(sHead, sPayload, sPemPrvKey);
-
- this.aHeader.push(jws.parsedJWS.headB64U);
- this.sPayload = jws.parsedJWS.payloadB64U;
- this.aSignature.push(jws.parsedJWS.sigvalB64U);
- };
-
- // == verify signature ===================================================================
- /**
- * verify JWS-JS object with array of certificate string.
- * @name verifyWithCerts
- * @memberOf KJUR.jws.JWSJS
- * @function
- * @param {array of String} aCert array of string for X.509 PEM certificate.
- * @return 1 if signature is valid.
- * @throw if JWS-JS signature is invalid.
- */
- this.verifyWithCerts = function(aCert) {
- if (this.aHeader.length != aCert.length)
- throw "num headers does not match with num certs";
- if (this.aSignature.length != aCert.length)
- throw "num signatures does not match with num certs";
-
- var payload = this.sPayload;
- var errMsg = "";
- for (var i = 0; i < aCert.length; i++) {
- var cert = aCert[i];
- var header = this.aHeader[i];
- var sig = this.aSignature[i];
- var sJWS = header + "." + payload + "." + sig;
-
- var jws = new KJUR.jws.JWS();
- try {
- var result = jws.verifyJWSByPemX509Cert(sJWS, cert);
- if (result != 1) {
- errMsg += (i + 1) + "th signature unmatch. ";
- }
- } catch (ex) {
- errMsg += (i + 1) + "th signature fail(" + ex + "). ";
- }
- }
-
- if (errMsg == "") {
- return 1;
- } else {
- throw errMsg;
- }
- };
-
- /**
- * read JWS-JS string.
- * @name raedJWSJS
- * @memberOf KJUR.jws.JWSJS
- * @function
- * @param {String} string of JWS-JS to load.
- * @throw if sJWSJS is malformed or not JSON string.
- */
- this.readJWSJS = function(sJWSJS) {
- var oJWSJS = ns1.readSafeJSONString(sJWSJS);
- if (oJWSJS == null) throw "argument is not JSON string: " + sJWSJS;
-
- this.aHeader = oJWSJS.headers;
- this.sPayload = oJWSJS.payload;
- this.aSignature = oJWSJS.signatures;
- };
-
- // == utility ===================================================================
- /**
- * get JSON object for this JWS-JS object.
- * @name getJSON
- * @memberOf KJUR.jws.JWSJS
- * @function
- */
- this.getJSON = function() {
- return { "headers": this.aHeader,
- "payload": this.sPayload,
- "signatures": this.aSignature };
- };
-
- /**
- * check if this JWS-JS object is empty.
- * @name isEmpty
- * @memberOf KJUR.jws.JWSJS
- * @function
- * @return 1 if there is no signatures in this object, otherwise 0.
- */
- this.isEmpty = function() {
- if (this.aHeader.length == 0) return 1;
- return 0;
- };
-};
-
diff --git a/jwt/keyutil-1.0.js b/jwt/keyutil-1.0.js
deleted file mode 100644
index 781d579..0000000
--- a/jwt/keyutil-1.0.js
+++ /dev/null
@@ -1,2020 +0,0 @@
-/*! keyutil-1.0.12.js (c) 2013-2015 Kenji Urushima | kjur.github.com/jsrsasign/license
- */
-/*
- * keyutil.js - key utility for PKCS#1/5/8 PEM, RSA/DSA/ECDSA key object
- *
- * Copyright (c) 2013-2015 Kenji Urushima (kenji.urushima@gmail.com)
- *
- * This software is licensed under the terms of the MIT License.
- * http://kjur.github.com/jsrsasign/license
- *
- * The above copyright and license notice shall be
- * included in all copies or substantial portions of the Software.
- */
-/**
- * @fileOverview
- * @name keyutil-1.0.js
- * @author Kenji Urushima kenji.urushima@gmail.com
- * @version keyutil 1.0.12 (2015-Oct-14)
- * @since jsrsasign 4.1.4
- * @license MIT License
- */
-
-/**
- * @name KEYUTIL
- * @class class for RSA/ECC/DSA key utility
- * @description
- *
- * {@link KEYUTIL} class is an update of former {@link PKCS5PKEY} class.
- * So for now, {@link PKCS5PKEY} is deprecated class.
- * {@link KEYUTIL} class has following features:
- *
- * key loading - {@link KEYUTIL.getKey}
- *
- *
- * supports RSAKey and KJUR.crypto.{ECDSA,DSA} key object
- * supports private key and public key
- * supports encrypted and plain private key
- * supports PKCS#1, PKCS#5 and PKCS#8 key
- * supports public key in X.509 certificate
- * key represented by JSON object
- *
- * NOTE1: Encrypted PKCS#8 only supports PBKDF2/HmacSHA1/3DES
- * NOTE2: Encrypted PKCS#5 supports DES-CBC, DES-EDE3-CBC, AES-{128,192.256}-CBC
- *
- * exporting key - {@link KEYUTIL.getPEM}
- *
- * {@link KEYUTIL.getPEM} method supports following formats:
- *
- * supports RSA/EC/DSA keys
- * PKCS#1 plain RSA/EC/DSA private key
- * PKCS#5 encrypted RSA/EC/DSA private key with DES-CBC, DES-EDE3-CBC, AES-{128,192.256}-CBC
- * PKCS#8 plain RSA/EC/DSA private key
- * PKCS#8 encrypted RSA/EC/DSA private key with PBKDF2_HmacSHA1_3DES
- *
- *
- * keypair generation - {@link KEYUTIL.generateKeypair}
- *
- * generate key pair of {@link RSAKey} or {@link KJUR.crypto.ECDSA}.
- * generate private key and convert it to PKCS#5 encrypted private key.
- *
- * NOTE: {@link KJUR.crypto.DSA} is not yet supported.
- *
- *
- * @example
- * // 1. loading PEM private key
- * var key = KEYUTIL.getKey(pemPKCS1PrivateKey);
- * var key = KEYUTIL.getKey(pemPKCS5EncryptedPrivateKey, "passcode");
- * var key = KEYUTIL.getKey(pemPKC85PlainPrivateKey);
- * var key = KEYUTIL.getKey(pemPKC85EncryptedPrivateKey, "passcode");
- * // 2. loading PEM public key
- * var key = KEYUTIL.getKey(pemPKCS8PublicKey);
- * var key = KEYUTIL.getKey(pemX509Certificate);
- * // 3. exporting private key
- * var pem = KEYUTIL.getPEM(privateKeyObj, "PKCS1PRV");
- * var pem = KEYUTIL.getPEM(privateKeyObj, "PKCS5PRV", "passcode"); // DES-EDE3-CBC by default
- * var pem = KEYUTIL.getPEM(privateKeyObj, "PKCS5PRV", "passcode", "DES-CBC");
- * var pem = KEYUTIL.getPEM(privateKeyObj, "PKCS8PRV");
- * var pem = KEYUTIL.getPEM(privateKeyObj, "PKCS8PRV", "passcode");
- * // 4. exporting public key
- * var pem = KEYUTIL.getPEM(publicKeyObj);
- */
-/*
- * DEPRECATED METHODS
- * GET PKCS8
- * KEYUTIL.getRSAKeyFromPlainPKCS8PEM
- * KEYUTIL.getRSAKeyFromPlainPKCS8Hex
- * KEYUTIL.getRSAKeyFromEncryptedPKCS8PEM
- * P8 UTIL (make internal use)
- * KEYUTIL.getPlainPKCS8HexFromEncryptedPKCS8PEM
- * GET PKCS8 PUB
- * KEYUTIL.getKeyFromPublicPKCS8PEM
- * KEYUTIL.getKeyFromPublicPKCS8Hex
- * KEYUTIL.getRSAKeyFromPublicPKCS8PEM
- * KEYUTIL.getRSAKeyFromPublicPKCS8Hex
- * GET PKCS5
- * KEYUTIL.getRSAKeyFromEncryptedPKCS5PEM
- * PUT PKCS5
- * KEYUTIL.getEncryptedPKCS5PEMFromRSAKey
- * OTHER METHODS (FOR INTERNAL?)
- * KEYUTIL.getHexFromPEM
- * KEYUTIL.getDecryptedKeyHexByKeyIV
- */
-var KEYUTIL = function() {
- // *****************************************************************
- // *** PRIVATE PROPERTIES AND METHODS *******************************
- // *****************************************************************
- // shared key decryption ------------------------------------------
- var decryptAES = function(dataHex, keyHex, ivHex) {
- return decryptGeneral(CryptoJS.AES, dataHex, keyHex, ivHex);
- };
-
- var decrypt3DES = function(dataHex, keyHex, ivHex) {
- return decryptGeneral(CryptoJS.TripleDES, dataHex, keyHex, ivHex);
- };
-
- var decryptDES = function(dataHex, keyHex, ivHex) {
- return decryptGeneral(CryptoJS.DES, dataHex, keyHex, ivHex);
- };
-
- var decryptGeneral = function(f, dataHex, keyHex, ivHex) {
- var data = CryptoJS.enc.Hex.parse(dataHex);
- var key = CryptoJS.enc.Hex.parse(keyHex);
- var iv = CryptoJS.enc.Hex.parse(ivHex);
- var encrypted = {};
- encrypted.key = key;
- encrypted.iv = iv;
- encrypted.ciphertext = data;
- var decrypted = f.decrypt(encrypted, key, { iv: iv });
- return CryptoJS.enc.Hex.stringify(decrypted);
- };
-
- // shared key decryption ------------------------------------------
- var encryptAES = function(dataHex, keyHex, ivHex) {
- return encryptGeneral(CryptoJS.AES, dataHex, keyHex, ivHex);
- };
-
- var encrypt3DES = function(dataHex, keyHex, ivHex) {
- return encryptGeneral(CryptoJS.TripleDES, dataHex, keyHex, ivHex);
- };
-
- var encryptDES = function(dataHex, keyHex, ivHex) {
- return encryptGeneral(CryptoJS.DES, dataHex, keyHex, ivHex);
- };
-
- var encryptGeneral = function(f, dataHex, keyHex, ivHex) {
- var data = CryptoJS.enc.Hex.parse(dataHex);
- var key = CryptoJS.enc.Hex.parse(keyHex);
- var iv = CryptoJS.enc.Hex.parse(ivHex);
- var encryptedHex = f.encrypt(data, key, { iv: iv });
- var encryptedWA = CryptoJS.enc.Hex.parse(encryptedHex.toString());
- var encryptedB64 = CryptoJS.enc.Base64.stringify(encryptedWA);
- return encryptedB64;
- };
-
- // other methods and properties ----------------------------------------
- var ALGLIST = {
- 'AES-256-CBC': { 'proc': decryptAES, 'eproc': encryptAES, keylen: 32, ivlen: 16 },
- 'AES-192-CBC': { 'proc': decryptAES, 'eproc': encryptAES, keylen: 24, ivlen: 16 },
- 'AES-128-CBC': { 'proc': decryptAES, 'eproc': encryptAES, keylen: 16, ivlen: 16 },
- 'DES-EDE3-CBC': { 'proc': decrypt3DES, 'eproc': encrypt3DES, keylen: 24, ivlen: 8 },
- 'DES-CBC': { 'proc': decryptDES, 'eproc': encryptDES, keylen: 8, ivlen: 8 }
- };
-
- var getFuncByName = function(algName) {
- return ALGLIST[algName]['proc'];
- };
-
- var _generateIvSaltHex = function(numBytes) {
- var wa = CryptoJS.lib.WordArray.random(numBytes);
- var hex = CryptoJS.enc.Hex.stringify(wa);
- return hex;
- };
-
- var _parsePKCS5PEM = function(sPKCS5PEM) {
- var info = {};
- if (sPKCS5PEM.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)", "m"))) {
- info.cipher = RegExp.$1;
- info.ivsalt = RegExp.$2;
- }
- if (sPKCS5PEM.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"))) {
- info.type = RegExp.$1;
- }
- var i1 = -1;
- var lenNEWLINE = 0;
- if (sPKCS5PEM.indexOf("\r\n\r\n") != -1) {
- i1 = sPKCS5PEM.indexOf("\r\n\r\n");
- lenNEWLINE = 2;
- }
- if (sPKCS5PEM.indexOf("\n\n") != -1) {
- i1 = sPKCS5PEM.indexOf("\n\n");
- lenNEWLINE = 1;
- }
- var i2 = sPKCS5PEM.indexOf("-----END");
- if (i1 != -1 && i2 != -1) {
- var s = sPKCS5PEM.substring(i1 + lenNEWLINE * 2, i2 - lenNEWLINE);
- s = s.replace(/\s+/g, '');
- info.data = s;
- }
- return info;
- };
-
- var _getKeyAndUnusedIvByPasscodeAndIvsalt = function(algName, passcode, ivsaltHex) {
- //alert("ivsaltHex(2) = " + ivsaltHex);
- var saltHex = ivsaltHex.substring(0, 16);
- //alert("salt = " + saltHex);
-
- var salt = CryptoJS.enc.Hex.parse(saltHex);
- var data = CryptoJS.enc.Utf8.parse(passcode);
- //alert("salt = " + salt);
- //alert("data = " + data);
-
- var nRequiredBytes = ALGLIST[algName]['keylen'] + ALGLIST[algName]['ivlen'];
- var hHexValueJoined = '';
- var hLastValue = null;
- //alert("nRequiredBytes = " + nRequiredBytes);
- for (;;) {
- var h = CryptoJS.algo.MD5.create();
- if (hLastValue != null) {
- h.update(hLastValue);
- }
- h.update(data);
- h.update(salt);
- hLastValue = h.finalize();
- hHexValueJoined = hHexValueJoined + CryptoJS.enc.Hex.stringify(hLastValue);
- //alert("joined = " + hHexValueJoined);
- if (hHexValueJoined.length >= nRequiredBytes * 2) {
- break;
- }
- }
- var result = {};
- result.keyhex = hHexValueJoined.substr(0, ALGLIST[algName]['keylen'] * 2);
- result.ivhex = hHexValueJoined.substr(ALGLIST[algName]['keylen'] * 2, ALGLIST[algName]['ivlen'] * 2);
- return result;
- };
-
- /*
- * @param {String} privateKeyB64 base64 string of encrypted private key
- * @param {String} sharedKeyAlgName algorithm name of shared key encryption
- * @param {String} sharedKeyHex hexadecimal string of shared key to encrypt
- * @param {String} ivsaltHex hexadecimal string of IV and salt
- * @param {String} hexadecimal string of decrypted private key
- */
- var _decryptKeyB64 = function(privateKeyB64, sharedKeyAlgName, sharedKeyHex, ivsaltHex) {
- var privateKeyWA = CryptoJS.enc.Base64.parse(privateKeyB64);
- var privateKeyHex = CryptoJS.enc.Hex.stringify(privateKeyWA);
- var f = ALGLIST[sharedKeyAlgName]['proc'];
- var decryptedKeyHex = f(privateKeyHex, sharedKeyHex, ivsaltHex);
- return decryptedKeyHex;
- };
-
- /*
- * @param {String} privateKeyHex hexadecimal string of private key
- * @param {String} sharedKeyAlgName algorithm name of shared key encryption
- * @param {String} sharedKeyHex hexadecimal string of shared key to encrypt
- * @param {String} ivsaltHex hexadecimal string of IV and salt
- * @param {String} base64 string of encrypted private key
- */
- var _encryptKeyHex = function(privateKeyHex, sharedKeyAlgName, sharedKeyHex, ivsaltHex) {
- var f = ALGLIST[sharedKeyAlgName]['eproc'];
- var encryptedKeyB64 = f(privateKeyHex, sharedKeyHex, ivsaltHex);
- return encryptedKeyB64;
- };
-
- // *****************************************************************
- // *** PUBLIC PROPERTIES AND METHODS *******************************
- // *****************************************************************
- return {
- // -- UTILITY METHODS ------------------------------------------------------------
- /**
- * decrypt private key by shared key
- * @name version
- * @memberOf KEYUTIL
- * @property {String} version
- * @description version string of KEYUTIL class
- */
- version: "1.0.0",
-
- /**
- * get hexacedimal string of PEM format
- * @name getHexFromPEM
- * @memberOf KEYUTIL
- * @function
- * @param {String} sPEM PEM formatted string
- * @param {String} sHead PEM header string without BEGIN/END
- * @return {String} hexadecimal string data of PEM contents
- * @since pkcs5pkey 1.0.5
- */
- getHexFromPEM: function(sPEM, sHead) {
- var s = sPEM;
- if (s.indexOf("-----BEGIN ") == -1) {
- throw "can't find PEM header: " + sHead;
- }
- if (typeof sHead == "string" && sHead != "") {
- s = s.replace("-----BEGIN " + sHead + "-----", "");
- s = s.replace("-----END " + sHead + "-----", "");
- } else {
- s = s.replace(/-----BEGIN [^-]+-----/, '');
- s = s.replace(/-----END [^-]+-----/, '');
- }
- var sB64 = s.replace(/\s+/g, '');
- var dataHex = b64tohex(sB64);
- return dataHex;
- },
-
- /**
- * decrypt private key by shared key
- * @name getDecryptedKeyHexByKeyIV
- * @memberOf KEYUTIL
- * @function
- * @param {String} encryptedKeyHex hexadecimal string of encrypted private key
- * @param {String} algName name of symmetric key algorithm (ex. 'DES-EBE3-CBC')
- * @param {String} sharedKeyHex hexadecimal string of symmetric key
- * @param {String} ivHex hexadecimal string of initial vector(IV).
- * @return {String} hexadecimal string of decrypted privated key
- */
- getDecryptedKeyHexByKeyIV: function(encryptedKeyHex, algName, sharedKeyHex, ivHex) {
- var f1 = getFuncByName(algName);
- return f1(encryptedKeyHex, sharedKeyHex, ivHex);
- },
-
- /**
- * parse PEM formatted passcode protected PKCS#5 private key
- * @name parsePKCS5PEM
- * @memberOf KEYUTIL
- * @function
- * @param {String} sEncryptedPEM PEM formatted protected passcode protected PKCS#5 private key
- * @return {Hash} hash of key information
- * @description
- * Resulted hash has following attributes.
- *
- * cipher - symmetric key algorithm name (ex. 'DES-EBE3-CBC', 'AES-256-CBC')
- * ivsalt - IV used for decrypt. Its heading 8 bytes will be used for passcode salt.
- * type - asymmetric key algorithm name of private key described in PEM header.
- * data - base64 encoded encrypted private key.
- *
- *
- */
- parsePKCS5PEM: function(sPKCS5PEM) {
- return _parsePKCS5PEM(sPKCS5PEM);
- },
-
- /**
- * the same function as OpenSSL EVP_BytsToKey to generate shared key and IV
- * @name getKeyAndUnusedIvByPasscodeAndIvsalt
- * @memberOf KEYUTIL
- * @function
- * @param {String} algName name of symmetric key algorithm (ex. 'DES-EBE3-CBC')
- * @param {String} passcode passcode to decrypt private key (ex. 'password')
- * @param {String} hexadecimal string of IV. heading 8 bytes will be used for passcode salt
- * @return {Hash} hash of key and unused IV (ex. {keyhex:2fe3..., ivhex:3fad..})
- */
- getKeyAndUnusedIvByPasscodeAndIvsalt: function(algName, passcode, ivsaltHex) {
- return _getKeyAndUnusedIvByPasscodeAndIvsalt(algName, passcode, ivsaltHex);
- },
-
- decryptKeyB64: function(privateKeyB64, sharedKeyAlgName, sharedKeyHex, ivsaltHex) {
- return _decryptKeyB64(privateKeyB64, sharedKeyAlgName, sharedKeyHex, ivsaltHex);
- },
-
- /**
- * decrypt PEM formatted protected PKCS#5 private key with passcode
- * @name getDecryptedKeyHex
- * @memberOf KEYUTIL
- * @function
- * @param {String} sEncryptedPEM PEM formatted protected passcode protected PKCS#5 private key
- * @param {String} passcode passcode to decrypt private key (ex. 'password')
- * @return {String} hexadecimal string of decrypted RSA priavte key
- */
- getDecryptedKeyHex: function(sEncryptedPEM, passcode) {
- // 1. parse pem
- var info = _parsePKCS5PEM(sEncryptedPEM);
- var publicKeyAlgName = info.type;
- var sharedKeyAlgName = info.cipher;
- var ivsaltHex = info.ivsalt;
- var privateKeyB64 = info.data;
- //alert("ivsaltHex = " + ivsaltHex);
-
- // 2. generate shared key
- var sharedKeyInfo = _getKeyAndUnusedIvByPasscodeAndIvsalt(sharedKeyAlgName, passcode, ivsaltHex);
- var sharedKeyHex = sharedKeyInfo.keyhex;
- //alert("sharedKeyHex = " + sharedKeyHex);
-
- // 3. decrypt private key
- var decryptedKey = _decryptKeyB64(privateKeyB64, sharedKeyAlgName, sharedKeyHex, ivsaltHex);
- return decryptedKey;
- },
-
- /**
- * (DEPRECATED) read PEM formatted encrypted PKCS#5 private key and returns RSAKey object
- * @name getRSAKeyFromEncryptedPKCS5PEM
- * @memberOf KEYUTIL
- * @function
- * @param {String} sEncryptedP5PEM PEM formatted encrypted PKCS#5 private key
- * @param {String} passcode passcode to decrypt private key
- * @return {RSAKey} loaded RSAKey object of RSA private key
- * @since pkcs5pkey 1.0.2
- * @deprecated From jsrsasign 4.2.1 please use {@link KEYUTIL.getKey#}.
- */
- getRSAKeyFromEncryptedPKCS5PEM: function(sEncryptedP5PEM, passcode) {
- var hPKey = this.getDecryptedKeyHex(sEncryptedP5PEM, passcode);
- var rsaKey = new RSAKey();
- rsaKey.readPrivateKeyFromASN1HexString(hPKey);
- return rsaKey;
- },
-
- /*
- * get PEM formatted encrypted PKCS#5 private key from hexadecimal string of plain private key
- * @name getEncryptedPKCS5PEMFromPrvKeyHex
- * @memberOf KEYUTIL
- * @function
- * @param {String} pemHeadAlg algorithm name in the pem header (i.e. RSA,EC or DSA)
- * @param {String} hPrvKey hexadecimal string of plain private key
- * @param {String} passcode pass code to protect private key (ex. password)
- * @param {String} sharedKeyAlgName algorithm name to protect private key (ex. AES-256-CBC)
- * @param {String} ivsaltHex hexadecimal string of IV and salt
- * @return {String} string of PEM formatted encrypted PKCS#5 private key
- * @since pkcs5pkey 1.0.2
- * @description
- *
- * generate PEM formatted encrypted PKCS#5 private key by hexadecimal string encoded
- * ASN.1 object of plain RSA private key.
- * Following arguments can be omitted.
- *
- * alg - AES-256-CBC will be used if omitted.
- * ivsaltHex - automatically generate IV and salt which length depends on algorithm
- *
- * NOTE1: DES-CBC, DES-EDE3-CBC, AES-{128,192.256}-CBC algorithm are supported.
- * @example
- * var pem =
- * KEYUTIL.getEncryptedPKCS5PEMFromPrvKeyHex(plainKeyHex, "password");
- * var pem2 =
- * KEYUTIL.getEncryptedPKCS5PEMFromPrvKeyHex(plainKeyHex, "password", "AES-128-CBC");
- * var pem3 =
- * KEYUTIL.getEncryptedPKCS5PEMFromPrvKeyHex(plainKeyHex, "password", "AES-128-CBC", "1f3d02...");
- */
- getEncryptedPKCS5PEMFromPrvKeyHex: function(pemHeadAlg, hPrvKey, passcode, sharedKeyAlgName, ivsaltHex) {
- var sPEM = "";
-
- // 1. set sharedKeyAlgName if undefined (default AES-256-CBC)
- if (typeof sharedKeyAlgName == "undefined" || sharedKeyAlgName == null) {
- sharedKeyAlgName = "AES-256-CBC";
- }
- if (typeof ALGLIST[sharedKeyAlgName] == "undefined")
- throw "KEYUTIL unsupported algorithm: " + sharedKeyAlgName;
-
- // 2. set ivsaltHex if undefined
- if (typeof ivsaltHex == "undefined" || ivsaltHex == null) {
- var ivlen = ALGLIST[sharedKeyAlgName]['ivlen'];
- var randIV = _generateIvSaltHex(ivlen);
- ivsaltHex = randIV.toUpperCase();
- }
-
- // 3. get shared key
- //alert("ivsalthex=" + ivsaltHex);
- var sharedKeyInfo = _getKeyAndUnusedIvByPasscodeAndIvsalt(sharedKeyAlgName, passcode, ivsaltHex);
- var sharedKeyHex = sharedKeyInfo.keyhex;
- // alert("sharedKeyHex = " + sharedKeyHex);
-
- // 3. get encrypted Key in Base64
- var encryptedKeyB64 = _encryptKeyHex(hPrvKey, sharedKeyAlgName, sharedKeyHex, ivsaltHex);
-
- var pemBody = encryptedKeyB64.replace(/(.{64})/g, "$1\r\n");
- var sPEM = "-----BEGIN " + pemHeadAlg + " PRIVATE KEY-----\r\n";
- sPEM += "Proc-Type: 4,ENCRYPTED\r\n";
- sPEM += "DEK-Info: " + sharedKeyAlgName + "," + ivsaltHex + "\r\n";
- sPEM += "\r\n";
- sPEM += pemBody;
- sPEM += "\r\n-----END " + pemHeadAlg + " PRIVATE KEY-----\r\n";
-
- return sPEM;
- },
-
- /**
- * (DEPRECATED) get PEM formatted encrypted PKCS#5 private key from RSAKey object of private key
- * @name getEncryptedPKCS5PEMFromRSAKey
- * @memberOf KEYUTIL
- * @function
- * @param {RSAKey} pKey RSAKey object of private key
- * @param {String} passcode pass code to protect private key (ex. password)
- * @param {String} alg algorithm name to protect private key (default AES-256-CBC)
- * @param {String} ivsaltHex hexadecimal string of IV and salt (default generated random IV)
- * @return {String} string of PEM formatted encrypted PKCS#5 private key
- * @since pkcs5pkey 1.0.2
- * @deprecated From jsrsasign 4.2.1 please use {@link KEYUTIL.getPEM#}.
- * @description
- *
- * generate PEM formatted encrypted PKCS#5 private key by
- * {@link RSAKey} object of RSA private key and passcode.
- * Following argument can be omitted.
- *
- * alg - AES-256-CBC will be used if omitted.
- * ivsaltHex - automatically generate IV and salt which length depends on algorithm
- *
- * @example
- * var pkey = new RSAKey();
- * pkey.generate(1024, '10001'); // generate 1024bit RSA private key with public exponent 'x010001'
- * var pem = KEYUTIL.getEncryptedPKCS5PEMFromRSAKey(pkey, "password");
- */
- getEncryptedPKCS5PEMFromRSAKey: function(pKey, passcode, alg, ivsaltHex) {
- var version = new KJUR.asn1.DERInteger({'int': 0});
- var n = new KJUR.asn1.DERInteger({'bigint': pKey.n});
- var e = new KJUR.asn1.DERInteger({'int': pKey.e});
- var d = new KJUR.asn1.DERInteger({'bigint': pKey.d});
- var p = new KJUR.asn1.DERInteger({'bigint': pKey.p});
- var q = new KJUR.asn1.DERInteger({'bigint': pKey.q});
- var dmp1 = new KJUR.asn1.DERInteger({'bigint': pKey.dmp1});
- var dmq1 = new KJUR.asn1.DERInteger({'bigint': pKey.dmq1});
- var coeff = new KJUR.asn1.DERInteger({'bigint': pKey.coeff});
- var seq = new KJUR.asn1.DERSequence({'array': [version, n, e, d, p, q, dmp1, dmq1, coeff]});
- var hex = seq.getEncodedHex();
- return this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA", hex, passcode, alg, ivsaltHex);
- },
-
- /**
- * generate RSAKey and PEM formatted encrypted PKCS#5 private key
- * @name newEncryptedPKCS5PEM
- * @memberOf KEYUTIL
- * @function
- * @param {String} passcode pass code to protect private key (ex. password)
- * @param {Integer} keyLen key bit length of RSA key to be generated. (default 1024)
- * @param {String} hPublicExponent hexadecimal string of public exponent (default 10001)
- * @param {String} alg shared key algorithm to encrypt private key (default AES-258-CBC)
- * @return {String} string of PEM formatted encrypted PKCS#5 private key
- * @since pkcs5pkey 1.0.2
- * @example
- * var pem1 = KEYUTIL.newEncryptedPKCS5PEM("password"); // RSA1024bit/10001/AES-256-CBC
- * var pem2 = KEYUTIL.newEncryptedPKCS5PEM("password", 512); // RSA 512bit/10001/AES-256-CBC
- * var pem3 = KEYUTIL.newEncryptedPKCS5PEM("password", 512, '3'); // RSA 512bit/ 3/AES-256-CBC
- */
- newEncryptedPKCS5PEM: function(passcode, keyLen, hPublicExponent, alg) {
- if (typeof keyLen == "undefined" || keyLen == null) {
- keyLen = 1024;
- }
- if (typeof hPublicExponent == "undefined" || hPublicExponent == null) {
- hPublicExponent = '10001';
- }
- var pKey = new RSAKey();
- pKey.generate(keyLen, hPublicExponent);
- var pem = null;
- if (typeof alg == "undefined" || alg == null) {
- pem = this.getEncryptedPKCS5PEMFromRSAKey(pKey, passcode);
- } else {
- pem = this.getEncryptedPKCS5PEMFromRSAKey(pKey, passcode, alg);
- }
- return pem;
- },
-
- // === PKCS8 ===============================================================
-
- /**
- * (DEPRECATED) read PEM formatted unencrypted PKCS#8 private key and returns RSAKey object
- * @name getRSAKeyFromPlainPKCS8PEM
- * @memberOf KEYUTIL
- * @function
- * @param {String} pkcs8PEM PEM formatted unencrypted PKCS#8 private key
- * @return {RSAKey} loaded RSAKey object of RSA private key
- * @since pkcs5pkey 1.0.1
- * @deprecated From jsrsasign 4.2.1 please use {@link KEYUTIL.getKey#}.
- */
- getRSAKeyFromPlainPKCS8PEM: function(pkcs8PEM) {
- if (pkcs8PEM.match(/ENCRYPTED/))
- throw "pem shall be not ENCRYPTED";
- var prvKeyHex = this.getHexFromPEM(pkcs8PEM, "PRIVATE KEY");
- var rsaKey = this.getRSAKeyFromPlainPKCS8Hex(prvKeyHex);
- return rsaKey;
- },
-
- /**
- * (DEPRECATED) provide hexadecimal string of unencrypted PKCS#8 private key and returns RSAKey object
- * @name getRSAKeyFromPlainPKCS8Hex
- * @memberOf KEYUTIL
- * @function
- * @param {String} prvKeyHex hexadecimal string of unencrypted PKCS#8 private key
- * @return {RSAKey} loaded RSAKey object of RSA private key
- * @since pkcs5pkey 1.0.3
- * @deprecated From jsrsasign 4.2.1 please use {@link KEYUTIL.getKey#}.
- */
- getRSAKeyFromPlainPKCS8Hex: function(prvKeyHex) {
- var a1 = ASN1HEX.getPosArrayOfChildren_AtObj(prvKeyHex, 0);
- if (a1.length != 3)
- throw "outer DERSequence shall have 3 elements: " + a1.length;
- var algIdTLV =ASN1HEX.getHexOfTLV_AtObj(prvKeyHex, a1[1]);
- if (algIdTLV != "300d06092a864886f70d0101010500") // AlgId rsaEncryption
- throw "PKCS8 AlgorithmIdentifier is not rsaEnc: " + algIdTLV;
- var algIdTLV = ASN1HEX.getHexOfTLV_AtObj(prvKeyHex, a1[1]);
- var octetStr = ASN1HEX.getHexOfTLV_AtObj(prvKeyHex, a1[2]);
- var p5KeyHex = ASN1HEX.getHexOfV_AtObj(octetStr, 0);
- //alert(p5KeyHex);
- var rsaKey = new RSAKey();
- rsaKey.readPrivateKeyFromASN1HexString(p5KeyHex);
- return rsaKey;
- },
-
- /**
- * generate PBKDF2 key hexstring with specified passcode and information
- * @name parseHexOfEncryptedPKCS8
- * @memberOf KEYUTIL
- * @function
- * @param {String} passcode passcode to decrypto private key
- * @return {Array} info associative array of PKCS#8 parameters
- * @since pkcs5pkey 1.0.3
- * @description
- * The associative array which is returned by this method has following properties:
- *
- * info.pbkdf2Salt - hexadecimal string of PBKDF2 salt
- * info.pkbdf2Iter - iteration count
- * info.ciphertext - hexadecimal string of encrypted private key
- * info.encryptionSchemeAlg - encryption algorithm name (currently TripleDES only)
- * info.encryptionSchemeIV - initial vector for encryption algorithm
- *
- * Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
- *
- * keyDerivationFunc = pkcs5PBKDF2 with HmacSHA1
- * encryptionScheme = des-EDE3-CBC(i.e. TripleDES
- *
- * @example
- * // to convert plain PKCS#5 private key to encrypted PKCS#8 private
- * // key with PBKDF2 with TripleDES
- * % openssl pkcs8 -in plain_p5.pem -topk8 -v2 -des3 -out encrypted_p8.pem
- */
- parseHexOfEncryptedPKCS8: function(sHEX) {
- var info = {};
-
- var a0 = ASN1HEX.getPosArrayOfChildren_AtObj(sHEX, 0);
- if (a0.length != 2)
- throw "malformed format: SEQUENCE(0).items != 2: " + a0.length;
-
- // 1. ciphertext
- info.ciphertext = ASN1HEX.getHexOfV_AtObj(sHEX, a0[1]);
-
- // 2. pkcs5PBES2
- var a0_0 = ASN1HEX.getPosArrayOfChildren_AtObj(sHEX, a0[0]);
- if (a0_0.length != 2)
- throw "malformed format: SEQUENCE(0.0).items != 2: " + a0_0.length;
-
- // 2.1 check if pkcs5PBES2(1 2 840 113549 1 5 13)
- if (ASN1HEX.getHexOfV_AtObj(sHEX, a0_0[0]) != "2a864886f70d01050d")
- throw "this only supports pkcs5PBES2";
-
- // 2.2 pkcs5PBES2 param
- var a0_0_1 = ASN1HEX.getPosArrayOfChildren_AtObj(sHEX, a0_0[1]);
- if (a0_0.length != 2)
- throw "malformed format: SEQUENCE(0.0.1).items != 2: " + a0_0_1.length;
-
- // 2.2.1 encryptionScheme
- var a0_0_1_1 = ASN1HEX.getPosArrayOfChildren_AtObj(sHEX, a0_0_1[1]);
- if (a0_0_1_1.length != 2)
- throw "malformed format: SEQUENCE(0.0.1.1).items != 2: " + a0_0_1_1.length;
- if (ASN1HEX.getHexOfV_AtObj(sHEX, a0_0_1_1[0]) != "2a864886f70d0307")
- throw "this only supports TripleDES";
- info.encryptionSchemeAlg = "TripleDES";
-
- // 2.2.1.1 IV of encryptionScheme
- info.encryptionSchemeIV = ASN1HEX.getHexOfV_AtObj(sHEX, a0_0_1_1[1]);
-
- // 2.2.2 keyDerivationFunc
- var a0_0_1_0 = ASN1HEX.getPosArrayOfChildren_AtObj(sHEX, a0_0_1[0]);
- if (a0_0_1_0.length != 2)
- throw "malformed format: SEQUENCE(0.0.1.0).items != 2: " + a0_0_1_0.length;
- if (ASN1HEX.getHexOfV_AtObj(sHEX, a0_0_1_0[0]) != "2a864886f70d01050c")
- throw "this only supports pkcs5PBKDF2";
-
- // 2.2.2.1 pkcs5PBKDF2 param
- var a0_0_1_0_1 = ASN1HEX.getPosArrayOfChildren_AtObj(sHEX, a0_0_1_0[1]);
- if (a0_0_1_0_1.length < 2)
- throw "malformed format: SEQUENCE(0.0.1.0.1).items < 2: " + a0_0_1_0_1.length;
-
- // 2.2.2.1.1 PBKDF2 salt
- info.pbkdf2Salt = ASN1HEX.getHexOfV_AtObj(sHEX, a0_0_1_0_1[0]);
-
- // 2.2.2.1.2 PBKDF2 iter
- var iterNumHex = ASN1HEX.getHexOfV_AtObj(sHEX, a0_0_1_0_1[1]);
- try {
- info.pbkdf2Iter = parseInt(iterNumHex, 16);
- } catch(ex) {
- throw "malformed format pbkdf2Iter: " + iterNumHex;
- }
-
- return info;
- },
-
- /**
- * generate PBKDF2 key hexstring with specified passcode and information
- * @name getPBKDF2KeyHexFromParam
- * @memberOf KEYUTIL
- * @function
- * @param {Array} info result of {@link parseHexOfEncryptedPKCS8} which has preference of PKCS#8 file
- * @param {String} passcode passcode to decrypto private key
- * @return {String} hexadecimal string of PBKDF2 key
- * @since pkcs5pkey 1.0.3
- * @description
- * As for info, this uses following properties:
- *
- * info.pbkdf2Salt - hexadecimal string of PBKDF2 salt
- * info.pkbdf2Iter - iteration count
- *
- * Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
- *
- * keyDerivationFunc = pkcs5PBKDF2 with HmacSHA1
- * encryptionScheme = des-EDE3-CBC(i.e. TripleDES
- *
- * @example
- * // to convert plain PKCS#5 private key to encrypted PKCS#8 private
- * // key with PBKDF2 with TripleDES
- * % openssl pkcs8 -in plain_p5.pem -topk8 -v2 -des3 -out encrypted_p8.pem
- */
- getPBKDF2KeyHexFromParam: function(info, passcode) {
- var pbkdf2SaltWS = CryptoJS.enc.Hex.parse(info.pbkdf2Salt);
- var pbkdf2Iter = info.pbkdf2Iter;
- var pbkdf2KeyWS = CryptoJS.PBKDF2(passcode,
- pbkdf2SaltWS,
- { keySize: 192/32, iterations: pbkdf2Iter });
- var pbkdf2KeyHex = CryptoJS.enc.Hex.stringify(pbkdf2KeyWS);
- return pbkdf2KeyHex;
- },
-
- /**
- * read PEM formatted encrypted PKCS#8 private key and returns hexadecimal string of plain PKCS#8 private key
- * @name getPlainPKCS8HexFromEncryptedPKCS8PEM
- * @memberOf KEYUTIL
- * @function
- * @param {String} pkcs8PEM PEM formatted encrypted PKCS#8 private key
- * @param {String} passcode passcode to decrypto private key
- * @return {String} hexadecimal string of plain PKCS#8 private key
- * @since pkcs5pkey 1.0.3
- * @description
- * Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
- *
- * keyDerivationFunc = pkcs5PBKDF2 with HmacSHA1
- * encryptionScheme = des-EDE3-CBC(i.e. TripleDES
- *
- * @example
- * // to convert plain PKCS#5 private key to encrypted PKCS#8 private
- * // key with PBKDF2 with TripleDES
- * % openssl pkcs8 -in plain_p5.pem -topk8 -v2 -des3 -out encrypted_p8.pem
- */
- getPlainPKCS8HexFromEncryptedPKCS8PEM: function(pkcs8PEM, passcode) {
- // 1. derHex - PKCS#8 private key encrypted by PBKDF2
- var derHex = this.getHexFromPEM(pkcs8PEM, "ENCRYPTED PRIVATE KEY");
- // 2. info - PKCS#5 PBES info
- var info = this.parseHexOfEncryptedPKCS8(derHex);
- // 3. hKey - PBKDF2 key
- var pbkdf2KeyHex = KEYUTIL.getPBKDF2KeyHexFromParam(info, passcode);
- // 4. decrypt ciphertext by PBKDF2 key
- var encrypted = {};
- encrypted.ciphertext = CryptoJS.enc.Hex.parse(info.ciphertext);
- var pbkdf2KeyWS = CryptoJS.enc.Hex.parse(pbkdf2KeyHex);
- var des3IVWS = CryptoJS.enc.Hex.parse(info.encryptionSchemeIV);
- var decWS = CryptoJS.TripleDES.decrypt(encrypted, pbkdf2KeyWS, { iv: des3IVWS });
- var decHex = CryptoJS.enc.Hex.stringify(decWS);
- return decHex;
- },
-
- /**
- * (DEPRECATED) read PEM formatted encrypted PKCS#8 private key and returns RSAKey object
- * @name getRSAKeyFromEncryptedPKCS8PEM
- * @memberOf KEYUTIL
- * @function
- * @param {String} pkcs8PEM PEM formatted encrypted PKCS#8 private key
- * @param {String} passcode passcode to decrypto private key
- * @return {RSAKey} loaded RSAKey object of RSA private key
- * @since pkcs5pkey 1.0.3
- * @deprecated From jsrsasign 4.2.1 please use {@link KEYUTIL.getKey#}.
- * @description
- * Currently, this method only supports PKCS#5v2.0 with PBES2/PBDKF2 of HmacSHA1 and TripleDES.
- *
- * keyDerivationFunc = pkcs5PBKDF2 with HmacSHA1
- * encryptionScheme = des-EDE3-CBC(i.e. TripleDES
- *
- * @example
- * // to convert plain PKCS#5 private key to encrypted PKCS#8 private
- * // key with PBKDF2 with TripleDES
- * % openssl pkcs8 -in plain_p5.pem -topk8 -v2 -des3 -out encrypted_p8.pem
- */
- getRSAKeyFromEncryptedPKCS8PEM: function(pkcs8PEM, passcode) {
- var prvKeyHex = this.getPlainPKCS8HexFromEncryptedPKCS8PEM(pkcs8PEM, passcode);
- var rsaKey = this.getRSAKeyFromPlainPKCS8Hex(prvKeyHex);
- return rsaKey;
- },
-
- /**
- * get RSAKey/ECDSA private key object from encrypted PEM PKCS#8 private key
- * @name getKeyFromEncryptedPKCS8PEM
- * @memberOf KEYUTIL
- * @function
- * @param {String} pkcs8PEM string of PEM formatted PKCS#8 private key
- * @param {String} passcode passcode string to decrypt key
- * @return {Object} RSAKey or KJUR.crypto.ECDSA private key object
- * @since pkcs5pkey 1.0.5
- */
- getKeyFromEncryptedPKCS8PEM: function(pkcs8PEM, passcode) {
- var prvKeyHex = this.getPlainPKCS8HexFromEncryptedPKCS8PEM(pkcs8PEM, passcode);
- var key = this.getKeyFromPlainPrivatePKCS8Hex(prvKeyHex);
- return key;
- },
-
- /**
- * parse hexadecimal string of plain PKCS#8 private key
- * @name parsePlainPrivatePKCS8Hex
- * @memberOf KEYUTIL
- * @function
- * @param {String} pkcs8PrvHex hexadecimal string of PKCS#8 plain private key
- * @return {Array} associative array of parsed key
- * @since pkcs5pkey 1.0.5
- * @description
- * Resulted associative array has following properties:
- *
- * algoid - hexadecimal string of OID of asymmetric key algorithm
- * algparam - hexadecimal string of OID of ECC curve name or null
- * keyidx - string starting index of key in pkcs8PrvHex
- *
- */
- parsePlainPrivatePKCS8Hex: function(pkcs8PrvHex) {
- var result = {};
- result.algparam = null;
-
- // 1. sequence
- if (pkcs8PrvHex.substr(0, 2) != "30")
- throw "malformed plain PKCS8 private key(code:001)"; // not sequence
-
- var a1 = ASN1HEX.getPosArrayOfChildren_AtObj(pkcs8PrvHex, 0);
- if (a1.length != 3)
- throw "malformed plain PKCS8 private key(code:002)";
-
- // 2. AlgID
- if (pkcs8PrvHex.substr(a1[1], 2) != "30")
- throw "malformed PKCS8 private key(code:003)"; // AlgId not sequence
-
- var a2 = ASN1HEX.getPosArrayOfChildren_AtObj(pkcs8PrvHex, a1[1]);
- if (a2.length != 2)
- throw "malformed PKCS8 private key(code:004)"; // AlgId not have two elements
-
- // 2.1. AlgID OID
- if (pkcs8PrvHex.substr(a2[0], 2) != "06")
- throw "malformed PKCS8 private key(code:005)"; // AlgId.oid is not OID
-
- result.algoid = ASN1HEX.getHexOfV_AtObj(pkcs8PrvHex, a2[0]);
-
- // 2.2. AlgID param
- if (pkcs8PrvHex.substr(a2[1], 2) == "06") {
- result.algparam = ASN1HEX.getHexOfV_AtObj(pkcs8PrvHex, a2[1]);
- }
-
- // 3. Key index
- if (pkcs8PrvHex.substr(a1[2], 2) != "04")
- throw "malformed PKCS8 private key(code:006)"; // not octet string
-
- result.keyidx = ASN1HEX.getStartPosOfV_AtObj(pkcs8PrvHex, a1[2]);
-
- return result;
- },
-
- /**
- * get RSAKey/ECDSA private key object from PEM plain PEM PKCS#8 private key
- * @name getKeyFromPlainPrivatePKCS8PEM
- * @memberOf KEYUTIL
- * @function
- * @param {String} pkcs8PEM string of plain PEM formatted PKCS#8 private key
- * @return {Object} RSAKey or KJUR.crypto.ECDSA private key object
- * @since pkcs5pkey 1.0.5
- */
- getKeyFromPlainPrivatePKCS8PEM: function(prvKeyPEM) {
- var prvKeyHex = this.getHexFromPEM(prvKeyPEM, "PRIVATE KEY");
- var key = this.getKeyFromPlainPrivatePKCS8Hex(prvKeyHex);
- return key;
- },
-
- /**
- * get RSAKey/ECDSA private key object from HEX plain PEM PKCS#8 private key
- * @name getKeyFromPlainPrivatePKCS8Hex
- * @memberOf KEYUTIL
- * @function
- * @param {String} prvKeyHex hexadecimal string of plain PKCS#8 private key
- * @return {Object} RSAKey or KJUR.crypto.ECDSA private key object
- * @since pkcs5pkey 1.0.5
- */
- getKeyFromPlainPrivatePKCS8Hex: function(prvKeyHex) {
- var p8 = this.parsePlainPrivatePKCS8Hex(prvKeyHex);
-
- if (p8.algoid == "2a864886f70d010101") { // RSA
- this.parsePrivateRawRSAKeyHexAtObj(prvKeyHex, p8);
- var k = p8.key;
- var key = new RSAKey();
- key.setPrivateEx(k.n, k.e, k.d, k.p, k.q, k.dp, k.dq, k.co);
- return key;
- } else if (p8.algoid == "2a8648ce3d0201") { // ECC
- this.parsePrivateRawECKeyHexAtObj(prvKeyHex, p8);
- if (KJUR.crypto.OID.oidhex2name[p8.algparam] === undefined)
- throw "KJUR.crypto.OID.oidhex2name undefined: " + p8.algparam;
- var curveName = KJUR.crypto.OID.oidhex2name[p8.algparam];
- var key = new KJUR.crypto.ECDSA({'curve': curveName});
- key.setPublicKeyHex(p8.pubkey);
- key.setPrivateKeyHex(p8.key);
- key.isPublic = false;
- return key;
- } else if (p8.algoid == "2a8648ce380401") { // DSA
- var hP = ASN1HEX.getVbyList(prvKeyHex, 0, [1,1,0], "02");
- var hQ = ASN1HEX.getVbyList(prvKeyHex, 0, [1,1,1], "02");
- var hG = ASN1HEX.getVbyList(prvKeyHex, 0, [1,1,2], "02");
- var hX = ASN1HEX.getVbyList(prvKeyHex, 0, [2,0], "02");
- var biP = new BigInteger(hP, 16);
- var biQ = new BigInteger(hQ, 16);
- var biG = new BigInteger(hG, 16);
- var biX = new BigInteger(hX, 16);
- var key = new KJUR.crypto.DSA();
- key.setPrivate(biP, biQ, biG, null, biX);
- return key;
- } else {
- throw "unsupported private key algorithm";
- }
- },
-
- // === PKCS8 RSA Public Key ================================================
- /**
- * (DEPRECATED) read PEM formatted PKCS#8 public key and returns RSAKey object
- * @name getRSAKeyFromPublicPKCS8PEM
- * @memberOf KEYUTIL
- * @function
- * @param {String} pkcs8PubPEM PEM formatted PKCS#8 public key
- * @return {RSAKey} loaded RSAKey object of RSA public key
- * @since pkcs5pkey 1.0.4
- * @deprecated From jsrsasign 4.2.1 please use {@link KEYUTIL.getKey#}.
- */
- getRSAKeyFromPublicPKCS8PEM: function(pkcs8PubPEM) {
- var pubKeyHex = this.getHexFromPEM(pkcs8PubPEM, "PUBLIC KEY");
- var rsaKey = this.getRSAKeyFromPublicPKCS8Hex(pubKeyHex);
- return rsaKey;
- },
-
- /**
- * (DEPRECATED) get RSAKey/ECDSA public key object from PEM PKCS#8 public key
- * @name getKeyFromPublicPKCS8PEM
- * @memberOf KEYUTIL
- * @function
- * @param {String} pkcsPub8PEM string of PEM formatted PKCS#8 public key
- * @return {Object} RSAKey or KJUR.crypto.ECDSA private key object
- * @since pkcs5pkey 1.0.5
- * @deprecated From jsrsasign 4.2.1 please use {@link KEYUTIL.getKey#}.
- */
- getKeyFromPublicPKCS8PEM: function(pkcs8PubPEM) {
- var pubKeyHex = this.getHexFromPEM(pkcs8PubPEM, "PUBLIC KEY");
- var key = this.getKeyFromPublicPKCS8Hex(pubKeyHex);
- return key;
- },
-
- /**
- * (DEPRECATED) get RSAKey/DSA/ECDSA public key object from hexadecimal string of PKCS#8 public key
- * @name getKeyFromPublicPKCS8Hex
- * @memberOf KEYUTIL
- * @function
- * @param {String} pkcsPub8Hex hexadecimal string of PKCS#8 public key
- * @return {Object} RSAKey or KJUR.crypto.{ECDSA,DSA} private key object
- * @since pkcs5pkey 1.0.5
- * @deprecated From jsrsasign 4.2.1 please use {@link KEYUTIL.getKey#}.
- */
- getKeyFromPublicPKCS8Hex: function(pkcs8PubHex) {
- var p8 = this.parsePublicPKCS8Hex(pkcs8PubHex);
-
- if (p8.algoid == "2a864886f70d010101") { // RSA
- var aRSA = this.parsePublicRawRSAKeyHex(p8.key);
- var key = new RSAKey();
- key.setPublic(aRSA.n, aRSA.e);
- return key;
- } else if (p8.algoid == "2a8648ce3d0201") { // ECC
- if (KJUR.crypto.OID.oidhex2name[p8.algparam] === undefined)
- throw "KJUR.crypto.OID.oidhex2name undefined: " + p8.algparam;
- var curveName = KJUR.crypto.OID.oidhex2name[p8.algparam];
- var key = new KJUR.crypto.ECDSA({'curve': curveName, 'pub': p8.key});
- return key;
- } else if (p8.algoid == "2a8648ce380401") { // DSA 1.2.840.10040.4.1
- var param = p8.algparam;
- var y = ASN1HEX.getHexOfV_AtObj(p8.key, 0);
- var key = new KJUR.crypto.DSA();
- key.setPublic(new BigInteger(param.p, 16),
- new BigInteger(param.q, 16),
- new BigInteger(param.g, 16),
- new BigInteger(y, 16));
- return key;
- } else {
- throw "unsupported public key algorithm";
- }
- },
-
- /**
- * parse hexadecimal string of plain PKCS#8 private key
- * @name parsePublicRawRSAKeyHex
- * @memberOf KEYUTIL
- * @function
- * @param {String} pubRawRSAHex hexadecimal string of ASN.1 encoded PKCS#8 public key
- * @return {Array} associative array of parsed key
- * @since pkcs5pkey 1.0.5
- * @description
- * Resulted associative array has following properties:
- *
- * n - hexadecimal string of public key
- * e - hexadecimal string of public exponent
- *
- */
- parsePublicRawRSAKeyHex: function(pubRawRSAHex) {
- var result = {};
-
- // 1. Sequence
- if (pubRawRSAHex.substr(0, 2) != "30")
- throw "malformed RSA key(code:001)"; // not sequence
-
- var a1 = ASN1HEX.getPosArrayOfChildren_AtObj(pubRawRSAHex, 0);
- if (a1.length != 2)
- throw "malformed RSA key(code:002)"; // not 2 items in seq
-
- // 2. public key "N"
- if (pubRawRSAHex.substr(a1[0], 2) != "02")
- throw "malformed RSA key(code:003)"; // 1st item is not integer
-
- result.n = ASN1HEX.getHexOfV_AtObj(pubRawRSAHex, a1[0]);
-
- // 3. public key "E"
- if (pubRawRSAHex.substr(a1[1], 2) != "02")
- throw "malformed RSA key(code:004)"; // 2nd item is not integer
-
- result.e = ASN1HEX.getHexOfV_AtObj(pubRawRSAHex, a1[1]);
-
- return result;
- },
-
- /**
- * parse hexadecimal string of RSA private key
- * @name parsePrivateRawRSAKeyHexAtObj
- * @memberOf KEYUTIL
- * @function
- * @param {String} pkcs8PrvHex hexadecimal string of PKCS#8 private key concluding RSA private key
- * @return {Array} info associative array to add parsed RSA private key information
- * @since pkcs5pkey 1.0.5
- * @description
- * Following properties are added to associative array 'info'
- *
- * n - hexadecimal string of public key
- * e - hexadecimal string of public exponent
- * d - hexadecimal string of private key
- * p - hexadecimal string
- * q - hexadecimal string
- * dp - hexadecimal string
- * dq - hexadecimal string
- * co - hexadecimal string
- *
- */
- parsePrivateRawRSAKeyHexAtObj: function(pkcs8PrvHex, info) {
- var keyIdx = info.keyidx;
-
- // 1. sequence
- if (pkcs8PrvHex.substr(keyIdx, 2) != "30")
- throw "malformed RSA private key(code:001)"; // not sequence
-
- var a1 = ASN1HEX.getPosArrayOfChildren_AtObj(pkcs8PrvHex, keyIdx);
- if (a1.length != 9)
- throw "malformed RSA private key(code:002)"; // not sequence
-
- // 2. RSA key
- info.key = {};
- info.key.n = ASN1HEX.getHexOfV_AtObj(pkcs8PrvHex, a1[1]);
- info.key.e = ASN1HEX.getHexOfV_AtObj(pkcs8PrvHex, a1[2]);
- info.key.d = ASN1HEX.getHexOfV_AtObj(pkcs8PrvHex, a1[3]);
- info.key.p = ASN1HEX.getHexOfV_AtObj(pkcs8PrvHex, a1[4]);
- info.key.q = ASN1HEX.getHexOfV_AtObj(pkcs8PrvHex, a1[5]);
- info.key.dp = ASN1HEX.getHexOfV_AtObj(pkcs8PrvHex, a1[6]);
- info.key.dq = ASN1HEX.getHexOfV_AtObj(pkcs8PrvHex, a1[7]);
- info.key.co = ASN1HEX.getHexOfV_AtObj(pkcs8PrvHex, a1[8]);
- },
-
- /**
- * parse hexadecimal string of ECC private key
- * @name parsePrivateRawECKeyHexAtObj
- * @memberOf KEYUTIL
- * @function
- * @param {String} pkcs8PrvHex hexadecimal string of PKCS#8 private key concluding EC private key
- * @return {Array} info associative array to add parsed ECC private key information
- * @since pkcs5pkey 1.0.5
- * @description
- * Following properties are added to associative array 'info'
- *
- * key - hexadecimal string of ECC private key
- *
- */
- parsePrivateRawECKeyHexAtObj: function(pkcs8PrvHex, info) {
- var keyIdx = info.keyidx;
-
- var key = ASN1HEX.getVbyList(pkcs8PrvHex, keyIdx, [1], "04");
- var pubkey = ASN1HEX.getVbyList(pkcs8PrvHex, keyIdx, [2,0], "03").substr(2);
-
- info.key = key;
- info.pubkey = pubkey;
- },
-
- /**
- * parse hexadecimal string of PKCS#8 RSA/EC/DSA public key
- * @name parsePublicPKCS8Hex
- * @memberOf KEYUTIL
- * @function
- * @param {String} pkcs8PubHex hexadecimal string of PKCS#8 public key
- * @return {Hash} hash of key information
- * @description
- * Resulted hash has following attributes.
- *
- * algoid - hexadecimal string of OID of asymmetric key algorithm
- * algparam - hexadecimal string of OID of ECC curve name, parameter SEQUENCE of DSA or null
- * key - hexadecimal string of public key
- *
- */
- parsePublicPKCS8Hex: function(pkcs8PubHex) {
- var result = {};
- result.algparam = null;
-
- // 1. AlgID and Key bit string
- var a1 = ASN1HEX.getPosArrayOfChildren_AtObj(pkcs8PubHex, 0);
- if (a1.length != 2)
- throw "outer DERSequence shall have 2 elements: " + a1.length;
-
- // 2. AlgID
- var idxAlgIdTLV = a1[0];
- if (pkcs8PubHex.substr(idxAlgIdTLV, 2) != "30")
- throw "malformed PKCS8 public key(code:001)"; // AlgId not sequence
-
- var a2 = ASN1HEX.getPosArrayOfChildren_AtObj(pkcs8PubHex, idxAlgIdTLV);
- if (a2.length != 2)
- throw "malformed PKCS8 public key(code:002)"; // AlgId not have two elements
-
- // 2.1. AlgID OID
- if (pkcs8PubHex.substr(a2[0], 2) != "06")
- throw "malformed PKCS8 public key(code:003)"; // AlgId.oid is not OID
-
- result.algoid = ASN1HEX.getHexOfV_AtObj(pkcs8PubHex, a2[0]);
-
- // 2.2. AlgID param
- if (pkcs8PubHex.substr(a2[1], 2) == "06") { // OID for EC
- result.algparam = ASN1HEX.getHexOfV_AtObj(pkcs8PubHex, a2[1]);
- } else if (pkcs8PubHex.substr(a2[1], 2) == "30") { // SEQ for DSA
- result.algparam = {};
- result.algparam.p = ASN1HEX.getVbyList(pkcs8PubHex, a2[1], [0], "02");
- result.algparam.q = ASN1HEX.getVbyList(pkcs8PubHex, a2[1], [1], "02");
- result.algparam.g = ASN1HEX.getVbyList(pkcs8PubHex, a2[1], [2], "02");
- }
-
- // 3. Key
- if (pkcs8PubHex.substr(a1[1], 2) != "03")
- throw "malformed PKCS8 public key(code:004)"; // Key is not bit string
-
- result.key = ASN1HEX.getHexOfV_AtObj(pkcs8PubHex, a1[1]).substr(2);
-
- // 4. return result assoc array
- return result;
- },
-
- /**
- * (DEPRECATED) provide hexadecimal string of unencrypted PKCS#8 private key and returns RSAKey object
- * @name getRSAKeyFromPublicPKCS8Hex
- * @memberOf KEYUTIL
- * @function
- * @param {String} pkcs8PubHex hexadecimal string of unencrypted PKCS#8 public key
- * @return {RSAKey} loaded RSAKey object of RSA public key
- * @since pkcs5pkey 1.0.4
- * @deprecated From jsrsasign 4.2.1 please use {@link KEYUTIL.getKey#}.
- */
- getRSAKeyFromPublicPKCS8Hex: function(pkcs8PubHex) {
- var a1 = ASN1HEX.getPosArrayOfChildren_AtObj(pkcs8PubHex, 0);
- if (a1.length != 2)
- throw "outer DERSequence shall have 2 elements: " + a1.length;
-
- var algIdTLV =ASN1HEX.getHexOfTLV_AtObj(pkcs8PubHex, a1[0]);
- if (algIdTLV != "300d06092a864886f70d0101010500") // AlgId rsaEncryption
- throw "PKCS8 AlgorithmId is not rsaEncryption";
-
- if (pkcs8PubHex.substr(a1[1], 2) != "03")
- throw "PKCS8 Public Key is not BITSTRING encapslated.";
-
- var idxPub = ASN1HEX.getStartPosOfV_AtObj(pkcs8PubHex, a1[1]) + 2; // 2 for unused bit
-
- if (pkcs8PubHex.substr(idxPub, 2) != "30")
- throw "PKCS8 Public Key is not SEQUENCE.";
-
- var a2 = ASN1HEX.getPosArrayOfChildren_AtObj(pkcs8PubHex, idxPub);
- if (a2.length != 2)
- throw "inner DERSequence shall have 2 elements: " + a2.length;
-
- if (pkcs8PubHex.substr(a2[0], 2) != "02")
- throw "N is not ASN.1 INTEGER";
- if (pkcs8PubHex.substr(a2[1], 2) != "02")
- throw "E is not ASN.1 INTEGER";
-
- var hN = ASN1HEX.getHexOfV_AtObj(pkcs8PubHex, a2[0]);
- var hE = ASN1HEX.getHexOfV_AtObj(pkcs8PubHex, a2[1]);
-
- var pubKey = new RSAKey();
- pubKey.setPublic(hN, hE);
-
- return pubKey;
- },
-
- //addAlgorithm: function(functionObject, algName, keyLen, ivLen) {
- //}
- };
-}();
-
-// -- MAJOR PUBLIC METHODS -------------------------------------------------------
-/**
- * get private or public key object from any arguments
- * @name getKey
- * @memberOf KEYUTIL
- * @function
- * @static
- * @param {Object} param parameter to get key object. see description in detail.
- * @param {String} passcode (OPTION) parameter to get key object. see description in detail.
- * @param {String} hextype (OPTOIN) parameter to get key object. see description in detail.
- * @return {Object} {@link RSAKey}, {@link KJUR.crypto.ECDSA} or {@link KJUR.crypto.ECDSA} object
- * @since keyutil 1.0.0
- * @description
- * This method gets private or public key object({@link RSAKey}, {@link KJUR.crypto.DSA} or {@link KJUR.crypto.ECDSA})
- * for RSA, DSA and ECC.
- * Arguments for this methods depends on a key format you specify.
- * Following key representations are supported.
- *
- * ECC private/public key object(as is): param=KJUR.crypto.ECDSA
- * DSA private/public key object(as is): param=KJUR.crypto.DSA
- * RSA private/public key object(as is): param=RSAKey
- * ECC private key parameters: param={d: d, curve: curveName}
- * RSA private key parameters: param={n: n, e: e, d: d, p: p, q: q, dp: dp, dq: dq, co: co}
- * NOTE: Each value shall be hexadecimal string of key spec.
- * DSA private key parameters: param={p: p, q: q, g: g, y: y, x: x}
- * NOTE: Each value shall be hexadecimal string of key spec.
- * ECC public key parameters: param={xy: xy, curve: curveName}
- * NOTE: ECC public key 'xy' shall be concatination of "04", x-bytes-hex and y-bytes-hex.
- * DSA public key parameters: param={p: p, q: q, g: g, y: y}
- * NOTE: Each value shall be hexadecimal string of key spec.
- * RSA public key parameters: param={n: n, e: e}
- * X.509v1/v3 PEM certificate (RSA/DSA/ECC): param=pemString
- * PKCS#8 hexadecimal RSA/ECC public key: param=pemString, null, "pkcs8pub"
- * PKCS#8 PEM RSA/DSA/ECC public key: param=pemString
- * PKCS#5 plain hexadecimal RSA private key: param=hexString, null, "pkcs5prv"
- * PKCS#5 plain PEM DSA/RSA private key: param=pemString
- * PKCS#8 plain PEM RSA/ECDSA private key: param=pemString
- * PKCS#5 encrypted PEM RSA/DSA private key: param=pemString, passcode
- * PKCS#8 encrypted PEM RSA/ECDSA private key: param=pemString, passcode
- *
- * Please note following limitation on encrypted keys:
- *
- * Encrypted PKCS#8 only supports PBKDF2/HmacSHA1/3DES
- * Encrypted PKCS#5 supports DES-CBC, DES-EDE3-CBC, AES-{128,192.256}-CBC
- * JWT plain ECC private/public key
- * JWT plain RSA public key
- * JWT plain RSA private key with P/Q/DP/DQ/COEFF
- * JWT plain RSA private key without P/Q/DP/DQ/COEFF (since jsrsasign 5.0.0)
- *
- * NOTE1: RFC 7517 JSON Web Key(JWK) support for RSA/ECC private/public key from jsrsasign 4.8.1.
- * NOTE2: X509v1 support is added since jsrsasign 5.0.11.
- *
- * EXAMPLE
- * @example
- * // 1. loading private key from PEM string
- * keyObj = KEYUTIL.getKey("-----BEGIN RSA PRIVATE KEY...");
- * keyObj = KEYUTIL.getKey("-----BEGIN RSA PRIVATE KEY..., "passcode");
- * keyObj = KEYUTIL.getKey("-----BEGIN PRIVATE KEY...");
- * keyObj = KEYUTIL.getKey("-----BEGIN PRIVATE KEY...", "passcode");
- * // 2. loading public key from PEM string
- * keyObj = KEYUTIL.getKey("-----BEGIN PUBLIC KEY...");
- * keyObj = KEYUTIL.getKey("-----BEGIN X509 CERTIFICATE...");
- * // 3. loading hexadecimal PKCS#5/PKCS#8 key
- * keyObj = KEYUTIL.getKey("308205c1...", null, "pkcs8pub");
- * keyObj = KEYUTIL.getKey("3082048b...", null, "pkcs5prv");
- * // 4. loading JSON Web Key(JWK)
- * keyObj = KEYUTIL.getKey({kty: "RSA", n: "0vx7...", e: "AQAB"});
- * keyObj = KEYUTIL.getKey({kty: "EC", crv: "P-256",
- * x: "MKBC...", y: "4Etl6...", d: "870Mb..."});
- * // 5. bare hexadecimal key
- * keyObj = KEYUTIL.getKey({n: "75ab..", e: "010001"});
- */
-KEYUTIL.getKey = function(param, passcode, hextype) {
- // 1. by key RSAKey/KJUR.crypto.ECDSA/KJUR.crypto.DSA object
- if (typeof RSAKey != 'undefined' && param instanceof RSAKey)
- return param;
- if (typeof KJUR.crypto.ECDSA != 'undefined' && param instanceof KJUR.crypto.ECDSA)
- return param;
- if (typeof KJUR.crypto.DSA != 'undefined' && param instanceof KJUR.crypto.DSA)
- return param;
-
- // 2. by parameters of key
-
- // 2.1. bare ECC
- // 2.1.1. bare ECC public key by hex values
- if (param.curve !== undefined &&
- param.xy !== undefined && param.d === undefined) {
- return new KJUR.crypto.ECDSA({pub: param.xy, curve: param.curve});
- }
-
- // 2.1.2. bare ECC private key by hex values
- if (param.curve !== undefined && param.d !== undefined) {
- return new KJUR.crypto.ECDSA({prv: param.d, curve: param.curve});
- }
-
- // 2.2. bare RSA
- // 2.2.1. bare RSA public key by hex values
- if (param.kty === undefined &&
- param.n !== undefined && param.e !== undefined &&
- param.d === undefined) {
- var key = new RSAKey();
- key.setPublic(param.n, param.e);
- return key;
- }
-
- // 2.2.2. bare RSA private key with P/Q/DP/DQ/COEFF by hex values
- if (param.kty === undefined &&
- param.n !== undefined &&
- param.e !== undefined &&
- param.d !== undefined &&
- param.p !== undefined &&
- param.q !== undefined &&
- param.dp !== undefined &&
- param.dq !== undefined &&
- param.co !== undefined &&
- param.qi === undefined) {
- var key = new RSAKey();
- key.setPrivateEx(param.n, param.e, param.d, param.p, param.q,
- param.dp, param.dq, param.co);
- return key;
- }
-
- // 2.2.3. bare RSA public key without P/Q/DP/DQ/COEFF by hex values
- if (param.kty === undefined &&
- param.n !== undefined &&
- param.e !== undefined &&
- param.d !== undefined &&
- param.p === undefined) {
- var key = new RSAKey();
- key.setPrivate(param.n, param.e, param.d);
- return key;
- }
-
- // 2.3. bare DSA
- // 2.3.1. bare DSA public key by hex values
- if (param.p !== undefined && param.q !== undefined &&
- param.g !== undefined &&
- param.y !== undefined && param.x === undefined) {
- var key = new KJUR.crypto.DSA();
- key.setPublic(param.p, param.q, param.g, param.y);
- return key;
- }
-
- // 2.3.2. bare DSA private key by hex values
- if (param.p !== undefined && param.q !== undefined &&
- param.g !== undefined &&
- param.y !== undefined && param.x !== undefined) {
- var key = new KJUR.crypto.DSA();
- key.setPrivate(param.p, param.q, param.g, param.y, param.x);
- return key;
- }
-
- // 3. JWK
- // 3.1. JWK RSA
- // 3.1.1. JWK RSA public key by b64u values
- if (param.kty === "RSA" &&
- param.n !== undefined &&
- param.e !== undefined &&
- param.d === undefined) {
- var key = new RSAKey();
- key.setPublic(b64utohex(param.n), b64utohex(param.e));
- return key;
- }
-
- // 3.1.2. JWK RSA private key with p/q/dp/dq/coeff by b64u values
- if (param.kty === "RSA" &&
- param.n !== undefined &&
- param.e !== undefined &&
- param.d !== undefined &&
- param.p !== undefined &&
- param.q !== undefined &&
- param.dp !== undefined &&
- param.dq !== undefined &&
- param.qi !== undefined) {
- var key = new RSAKey();
- key.setPrivateEx(b64utohex(param.n),
- b64utohex(param.e),
- b64utohex(param.d),
- b64utohex(param.p),
- b64utohex(param.q),
- b64utohex(param.dp),
- b64utohex(param.dq),
- b64utohex(param.qi));
- return key;
- }
-
- // 3.1.3. JWK RSA private key without p/q/dp/dq/coeff by b64u
- // since jsrsasign 5.0.0 keyutil 1.0.11
- if (param.kty === "RSA" &&
- param.n !== undefined &&
- param.e !== undefined &&
- param.d !== undefined) {
- var key = new RSAKey();
- key.setPrivate(b64utohex(param.n),
- b64utohex(param.e),
- b64utohex(param.d));
- return key;
- }
-
- // 3.2. JWK ECC
- // 3.2.1. JWK ECC public key by b64u values
- if (param.kty === "EC" &&
- param.crv !== undefined &&
- param.x !== undefined &&
- param.y !== undefined &&
- param.d === undefined) {
- var ec = new KJUR.crypto.ECDSA({"curve": param.crv});
- var charlen = ec.ecparams.keylen / 4;
- var hX = ("0000000000" + b64utohex(param.x)).slice(- charlen);
- var hY = ("0000000000" + b64utohex(param.y)).slice(- charlen);
- var hPub = "04" + hX + hY;
- ec.setPublicKeyHex(hPub);
- return ec;
- }
-
- // 3.2.2. JWK ECC private key by b64u values
- if (param.kty === "EC" &&
- param.crv !== undefined &&
- param.x !== undefined &&
- param.y !== undefined &&
- param.d !== undefined) {
- var ec = new KJUR.crypto.ECDSA({"curve": param.crv});
- var charlen = ec.ecparams.keylen / 4;
- var hPrv = ("0000000000" + b64utohex(param.d)).slice(- charlen);
- ec.setPrivateKeyHex(hPrv);
- return ec;
- }
-
- // 4. by PEM certificate (-----BEGIN ... CERTIFITE----)
- if (param.indexOf("-END CERTIFICATE-", 0) != -1 ||
- param.indexOf("-END X509 CERTIFICATE-", 0) != -1 ||
- param.indexOf("-END TRUSTED CERTIFICATE-", 0) != -1) {
- return X509.getPublicKeyFromCertPEM(param);
- }
-
- // 4. public key by PKCS#8 hexadecimal string
- if (hextype === "pkcs8pub") {
- return KEYUTIL.getKeyFromPublicPKCS8Hex(param);
- }
-
- // 5. public key by PKCS#8 PEM string
- if (param.indexOf("-END PUBLIC KEY-") != -1) {
- return KEYUTIL.getKeyFromPublicPKCS8PEM(param);
- }
-
- // 6. private key by PKCS#5 plain hexadecimal RSA string
- if (hextype === "pkcs5prv") {
- var key = new RSAKey();
- key.readPrivateKeyFromASN1HexString(param);
- return key;
- }
-
- // 7. private key by plain PKCS#5 hexadecimal RSA string
- if (hextype === "pkcs5prv") {
- var key = new RSAKey();
- key.readPrivateKeyFromASN1HexString(param);
- return key;
- }
-
- // 8. private key by plain PKCS#5 PEM RSA string
- // getKey("-----BEGIN RSA PRIVATE KEY-...")
- if (param.indexOf("-END RSA PRIVATE KEY-") != -1 &&
- param.indexOf("4,ENCRYPTED") == -1) {
- var hex = KEYUTIL.getHexFromPEM(param, "RSA PRIVATE KEY");
- return KEYUTIL.getKey(hex, null, "pkcs5prv");
- }
-
- // 8.2. private key by plain PKCS#5 PEM DSA string
- if (param.indexOf("-END DSA PRIVATE KEY-") != -1 &&
- param.indexOf("4,ENCRYPTED") == -1) {
-
- var hKey = this.getHexFromPEM(param, "DSA PRIVATE KEY");
- var p = ASN1HEX.getVbyList(hKey, 0, [1], "02");
- var q = ASN1HEX.getVbyList(hKey, 0, [2], "02");
- var g = ASN1HEX.getVbyList(hKey, 0, [3], "02");
- var y = ASN1HEX.getVbyList(hKey, 0, [4], "02");
- var x = ASN1HEX.getVbyList(hKey, 0, [5], "02");
- var key = new KJUR.crypto.DSA();
- key.setPrivate(new BigInteger(p, 16),
- new BigInteger(q, 16),
- new BigInteger(g, 16),
- new BigInteger(y, 16),
- new BigInteger(x, 16));
- return key;
- }
-
- // 9. private key by plain PKCS#8 PEM ECC/RSA string
- if (param.indexOf("-END PRIVATE KEY-") != -1) {
- return KEYUTIL.getKeyFromPlainPrivatePKCS8PEM(param);
- }
-
- // 10. private key by encrypted PKCS#5 PEM RSA string
- if (param.indexOf("-END RSA PRIVATE KEY-") != -1 &&
- param.indexOf("4,ENCRYPTED") != -1) {
- return KEYUTIL.getRSAKeyFromEncryptedPKCS5PEM(param, passcode);
- }
-
- // 10.2. private key by encrypted PKCS#5 PEM ECDSA string
- if (param.indexOf("-END EC PRIVATE KEY-") != -1 &&
- param.indexOf("4,ENCRYPTED") != -1) {
- var hKey = KEYUTIL.getDecryptedKeyHex(param, passcode);
-
- var key = ASN1HEX.getVbyList(hKey, 0, [1], "04");
- var curveNameOidHex = ASN1HEX.getVbyList(hKey, 0, [2,0], "06");
- var pubkey = ASN1HEX.getVbyList(hKey, 0, [3,0], "03").substr(2);
- var curveName = "";
-
- if (KJUR.crypto.OID.oidhex2name[curveNameOidHex] !== undefined) {
- curveName = KJUR.crypto.OID.oidhex2name[curveNameOidHex];
- } else {
- throw "undefined OID(hex) in KJUR.crypto.OID: " + curveNameOidHex;
- }
-
- var ec = new KJUR.crypto.ECDSA({'name': curveName});
- ec.setPublicKeyHex(pubkey);
- ec.setPrivateKeyHex(key);
- ec.isPublic = false;
- return ec;
- }
-
- // 10.3. private key by encrypted PKCS#5 PEM DSA string
- if (param.indexOf("-END DSA PRIVATE KEY-") != -1 &&
- param.indexOf("4,ENCRYPTED") != -1) {
- var hKey = KEYUTIL.getDecryptedKeyHex(param, passcode);
- var p = ASN1HEX.getVbyList(hKey, 0, [1], "02");
- var q = ASN1HEX.getVbyList(hKey, 0, [2], "02");
- var g = ASN1HEX.getVbyList(hKey, 0, [3], "02");
- var y = ASN1HEX.getVbyList(hKey, 0, [4], "02");
- var x = ASN1HEX.getVbyList(hKey, 0, [5], "02");
- var key = new KJUR.crypto.DSA();
- key.setPrivate(new BigInteger(p, 16),
- new BigInteger(q, 16),
- new BigInteger(g, 16),
- new BigInteger(y, 16),
- new BigInteger(x, 16));
- return key;
- }
-
- // 11. private key by encrypted PKCS#8 hexadecimal RSA/ECDSA string
- if (param.indexOf("-END ENCRYPTED PRIVATE KEY-") != -1) {
- return KEYUTIL.getKeyFromEncryptedPKCS8PEM(param, passcode);
- }
-
- throw "not supported argument";
-};
-
-/**
- * @name generateKeypair
- * @memberOf KEYUTIL
- * @function
- * @static
- * @param {String} alg 'RSA' or 'EC'
- * @param {Object} keylenOrCurve key length for RSA or curve name for EC
- * @return {Array} associative array of keypair which has prvKeyObj and pubKeyObj parameters
- * @since keyutil 1.0.1
- * @description
- * This method generates a key pair of public key algorithm.
- * The result will be an associative array which has following
- * parameters:
- *
- * prvKeyObj - RSAKey or ECDSA object of private key
- * pubKeyObj - RSAKey or ECDSA object of public key
- *
- * NOTE1: As for RSA algoirthm, public exponent has fixed
- * value '0x10001'.
- * NOTE2: As for EC algorithm, supported names of curve are
- * secp256r1, secp256k1 and secp384r1.
- * NOTE3: DSA is not supported yet.
- * @example
- * var rsaKeypair = KEYUTIL.generateKeypair("RSA", 1024);
- * var ecKeypair = KEYUTIL.generateKeypair("EC", "secp256r1");
- *
- */
-KEYUTIL.generateKeypair = function(alg, keylenOrCurve) {
- if (alg == "RSA") {
- var keylen = keylenOrCurve;
- var prvKey = new RSAKey();
- prvKey.generate(keylen, '10001');
- prvKey.isPrivate = true;
- prvKey.isPublic = true;
-
- var pubKey = new RSAKey();
- var hN = prvKey.n.toString(16);
- var hE = prvKey.e.toString(16);
- pubKey.setPublic(hN, hE);
- pubKey.isPrivate = false;
- pubKey.isPublic = true;
-
- var result = {};
- result.prvKeyObj = prvKey;
- result.pubKeyObj = pubKey;
- return result;
- } else if (alg == "EC") {
- var curve = keylenOrCurve;
- var ec = new KJUR.crypto.ECDSA({curve: curve});
- var keypairHex = ec.generateKeyPairHex();
-
- var prvKey = new KJUR.crypto.ECDSA({curve: curve});
- prvKey.setPrivateKeyHex(keypairHex.ecprvhex);
- prvKey.isPrivate = true;
- prvKey.isPublic = false;
-
- var pubKey = new KJUR.crypto.ECDSA({curve: curve});
- pubKey.setPublicKeyHex(keypairHex.ecpubhex);
- pubKey.isPrivate = false;
- pubKey.isPublic = true;
-
- var result = {};
- result.prvKeyObj = prvKey;
- result.pubKeyObj = pubKey;
- return result;
- } else {
- throw "unknown algorithm: " + alg;
- }
-};
-
-/**
- * get PEM formatted private or public key file from a RSA/ECDSA/DSA key object
- * @name getPEM
- * @memberOf KEYUTIL
- * @function
- * @static
- * @param {Object} keyObjOrHex key object {@link RSAKey}, {@link KJUR.crypto.ECDSA} or {@link KJUR.crypto.DSA} to encode to
- * @param {String} formatType (OPTION) output format type of "PKCS1PRV", "PKCS5PRV" or "PKCS8PRV" for private key
- * @param {String} passwd (OPTION) password to protect private key
- * @param {String} encAlg (OPTION) encryption algorithm for PKCS#5. currently supports DES-CBC, DES-EDE3-CBC and AES-{128,192,256}-CBC
- * @since keyutil 1.0.4
- * @description
- *
- * NOTE1:
- *
- * PKCS#5 encrypted private key protection algorithm supports DES-CBC,
- * DES-EDE3-CBC and AES-{128,192,256}-CBC
- * NOTE2:
- *
- * OpenSSL supports
- *
- * @example
- * KEUUTIL.getPEM(publicKey) => generates PEM PKCS#8 public key
- * KEUUTIL.getPEM(privateKey, "PKCS1PRV") => generates PEM PKCS#1 plain private key
- * KEUUTIL.getPEM(privateKey, "PKCS5PRV", "pass") => generates PEM PKCS#5 encrypted private key
- * with DES-EDE3-CBC (DEFAULT)
- * KEUUTIL.getPEM(privateKey, "PKCS5PRV", "pass", "DES-CBC") => generates PEM PKCS#5 encrypted
- * private key with DES-CBC
- * KEUUTIL.getPEM(privateKey, "PKCS8PRV") => generates PEM PKCS#8 plain private key
- * KEUUTIL.getPEM(privateKey, "PKCS8PRV", "pass") => generates PEM PKCS#8 encrypted private key
- * with PBKDF2_HmacSHA1_3DES
- */
-KEYUTIL.getPEM = function(keyObjOrHex, formatType, passwd, encAlg, hexType) {
- var ns1 = KJUR.asn1;
- var ns2 = KJUR.crypto;
-
- function _rsaprv2asn1obj(keyObjOrHex) {
- var asn1Obj = KJUR.asn1.ASN1Util.newObject({
- "seq": [
- {"int": 0 },
- {"int": {"bigint": keyObjOrHex.n}},
- {"int": keyObjOrHex.e},
- {"int": {"bigint": keyObjOrHex.d}},
- {"int": {"bigint": keyObjOrHex.p}},
- {"int": {"bigint": keyObjOrHex.q}},
- {"int": {"bigint": keyObjOrHex.dmp1}},
- {"int": {"bigint": keyObjOrHex.dmq1}},
- {"int": {"bigint": keyObjOrHex.coeff}}
- ]
- });
- return asn1Obj;
- };
-
- function _ecdsaprv2asn1obj(keyObjOrHex) {
- var asn1Obj2 = KJUR.asn1.ASN1Util.newObject({
- "seq": [
- {"int": 1 },
- {"octstr": {"hex": keyObjOrHex.prvKeyHex}},
- {"tag": ['a0', true, {'oid': {'name': keyObjOrHex.curveName}}]},
- {"tag": ['a1', true, {'bitstr': {'hex': '00' + keyObjOrHex.pubKeyHex}}]}
- ]
- });
- return asn1Obj2;
- };
-
- function _dsaprv2asn1obj(keyObjOrHex) {
- var asn1Obj = KJUR.asn1.ASN1Util.newObject({
- "seq": [
- {"int": 0 },
- {"int": {"bigint": keyObjOrHex.p}},
- {"int": {"bigint": keyObjOrHex.q}},
- {"int": {"bigint": keyObjOrHex.g}},
- {"int": {"bigint": keyObjOrHex.y}},
- {"int": {"bigint": keyObjOrHex.x}}
- ]
- });
- return asn1Obj;
- };
-
- // 1. public key
-
- // x. PEM PKCS#8 public key of RSA/ECDSA/DSA public key object
- if (((typeof RSAKey != "undefined" && keyObjOrHex instanceof RSAKey) ||
- (typeof ns2.DSA != "undefined" && keyObjOrHex instanceof ns2.DSA) ||
- (typeof ns2.ECDSA != "undefined" && keyObjOrHex instanceof ns2.ECDSA)) &&
- keyObjOrHex.isPublic == true &&
- (formatType === undefined || formatType == "PKCS8PUB")) {
- var asn1Obj = new KJUR.asn1.x509.SubjectPublicKeyInfo(keyObjOrHex);
- var asn1Hex = asn1Obj.getEncodedHex();
- return ns1.ASN1Util.getPEMStringFromHex(asn1Hex, "PUBLIC KEY");
- }
-
- // 2. private
-
- // x. PEM PKCS#1 plain private key of RSA private key object
- if (formatType == "PKCS1PRV" &&
- typeof RSAKey != "undefined" &&
- keyObjOrHex instanceof RSAKey &&
- (passwd === undefined || passwd == null) &&
- keyObjOrHex.isPrivate == true) {
-
- var asn1Obj = _rsaprv2asn1obj(keyObjOrHex);
- var asn1Hex = asn1Obj.getEncodedHex();
- return ns1.ASN1Util.getPEMStringFromHex(asn1Hex, "RSA PRIVATE KEY");
- }
-
- // x. PEM PKCS#1 plain private key of ECDSA private key object
- if (formatType == "PKCS1PRV" &&
- typeof RSAKey != "undefined" &&
- keyObjOrHex instanceof KJUR.crypto.ECDSA &&
- (passwd === undefined || passwd == null) &&
- keyObjOrHex.isPrivate == true) {
-
- var asn1Obj1 = new KJUR.asn1.DERObjectIdentifier({'name': keyObjOrHex.curveName});
- var asn1Hex1 = asn1Obj1.getEncodedHex();
- var asn1Obj2 = _ecdsaprv2asn1obj(keyObjOrHex);
- var asn1Hex2 = asn1Obj2.getEncodedHex();
-
- var s = "";
- s += ns1.ASN1Util.getPEMStringFromHex(asn1Hex1, "EC PARAMETERS");
- s += ns1.ASN1Util.getPEMStringFromHex(asn1Hex2, "EC PRIVATE KEY");
- return s;
- }
-
- // x. PEM PKCS#1 plain private key of DSA private key object
- if (formatType == "PKCS1PRV" &&
- typeof KJUR.crypto.DSA != "undefined" &&
- keyObjOrHex instanceof KJUR.crypto.DSA &&
- (passwd === undefined || passwd == null) &&
- keyObjOrHex.isPrivate == true) {
-
- var asn1Obj = _dsaprv2asn1obj(keyObjOrHex);
- var asn1Hex = asn1Obj.getEncodedHex();
- return ns1.ASN1Util.getPEMStringFromHex(asn1Hex, "DSA PRIVATE KEY");
- }
-
- // 3. private
-
- // x. PEM PKCS#5 encrypted private key of RSA private key object
- if (formatType == "PKCS5PRV" &&
- typeof RSAKey != "undefined" &&
- keyObjOrHex instanceof RSAKey &&
- (passwd !== undefined && passwd != null) &&
- keyObjOrHex.isPrivate == true) {
-
- var asn1Obj = _rsaprv2asn1obj(keyObjOrHex);
- var asn1Hex = asn1Obj.getEncodedHex();
-
- if (encAlg === undefined) encAlg = "DES-EDE3-CBC";
- return this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA", asn1Hex, passwd, encAlg);
- }
-
- // x. PEM PKCS#5 encrypted private key of ECDSA private key object
- if (formatType == "PKCS5PRV" &&
- typeof KJUR.crypto.ECDSA != "undefined" &&
- keyObjOrHex instanceof KJUR.crypto.ECDSA &&
- (passwd !== undefined && passwd != null) &&
- keyObjOrHex.isPrivate == true) {
-
- var asn1Obj = _ecdsaprv2asn1obj(keyObjOrHex);
- var asn1Hex = asn1Obj.getEncodedHex();
-
- if (encAlg === undefined) encAlg = "DES-EDE3-CBC";
- return this.getEncryptedPKCS5PEMFromPrvKeyHex("EC", asn1Hex, passwd, encAlg);
- }
-
- // x. PEM PKCS#5 encrypted private key of DSA private key object
- if (formatType == "PKCS5PRV" &&
- typeof KJUR.crypto.DSA != "undefined" &&
- keyObjOrHex instanceof KJUR.crypto.DSA &&
- (passwd !== undefined && passwd != null) &&
- keyObjOrHex.isPrivate == true) {
-
- var asn1Obj = _dsaprv2asn1obj(keyObjOrHex);
- var asn1Hex = asn1Obj.getEncodedHex();
-
- if (encAlg === undefined) encAlg = "DES-EDE3-CBC";
- return this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA", asn1Hex, passwd, encAlg);
- }
-
- // x. ======================================================================
-
- var _getEncryptedPKCS8 = function(plainKeyHex, passcode) {
- var info = _getEencryptedPKCS8Info(plainKeyHex, passcode);
- //alert("iv=" + info.encryptionSchemeIV);
- //alert("info.ciphertext2[" + info.ciphertext.length + "=" + info.ciphertext);
- var asn1Obj = new KJUR.asn1.ASN1Util.newObject({
- "seq": [
- {"seq": [
- {"oid": {"name": "pkcs5PBES2"}},
- {"seq": [
- {"seq": [
- {"oid": {"name": "pkcs5PBKDF2"}},
- {"seq": [
- {"octstr": {"hex": info.pbkdf2Salt}},
- {"int": info.pbkdf2Iter}
- ]}
- ]},
- {"seq": [
- {"oid": {"name": "des-EDE3-CBC"}},
- {"octstr": {"hex": info.encryptionSchemeIV}}
- ]}
- ]}
- ]},
- {"octstr": {"hex": info.ciphertext}}
- ]
- });
- return asn1Obj.getEncodedHex();
- };
-
- var _getEencryptedPKCS8Info = function(plainKeyHex, passcode) {
- var pbkdf2Iter = 100;
- var pbkdf2SaltWS = CryptoJS.lib.WordArray.random(8);
- var encryptionSchemeAlg = "DES-EDE3-CBC";
- var encryptionSchemeIVWS = CryptoJS.lib.WordArray.random(8);
- // PBKDF2 key
- var pbkdf2KeyWS = CryptoJS.PBKDF2(passcode,
- pbkdf2SaltWS, { "keySize": 192/32,
- "iterations": pbkdf2Iter });
- // ENCRYPT
- var plainKeyWS = CryptoJS.enc.Hex.parse(plainKeyHex);
- var encryptedKeyHex =
- CryptoJS.TripleDES.encrypt(plainKeyWS, pbkdf2KeyWS, { "iv": encryptionSchemeIVWS }) + "";
-
- //alert("encryptedKeyHex=" + encryptedKeyHex);
-
- var info = {};
- info.ciphertext = encryptedKeyHex;
- //alert("info.ciphertext=" + info.ciphertext);
- info.pbkdf2Salt = CryptoJS.enc.Hex.stringify(pbkdf2SaltWS);
- info.pbkdf2Iter = pbkdf2Iter;
- info.encryptionSchemeAlg = encryptionSchemeAlg;
- info.encryptionSchemeIV = CryptoJS.enc.Hex.stringify(encryptionSchemeIVWS);
- return info;
- };
-
- // x. PEM PKCS#8 plain private key of RSA private key object
- if (formatType == "PKCS8PRV" &&
- typeof RSAKey != "undefined" &&
- keyObjOrHex instanceof RSAKey &&
- keyObjOrHex.isPrivate == true) {
-
- var keyObj = _rsaprv2asn1obj(keyObjOrHex);
- var keyHex = keyObj.getEncodedHex();
-
- var asn1Obj = KJUR.asn1.ASN1Util.newObject({
- "seq": [
- {"int": 0},
- {"seq": [{"oid": {"name": "rsaEncryption"}},{"null": true}]},
- {"octstr": {"hex": keyHex}}
- ]
- });
- var asn1Hex = asn1Obj.getEncodedHex();
-
- if (passwd === undefined || passwd == null) {
- return ns1.ASN1Util.getPEMStringFromHex(asn1Hex, "PRIVATE KEY");
- } else {
- var asn1Hex2 = _getEncryptedPKCS8(asn1Hex, passwd);
- return ns1.ASN1Util.getPEMStringFromHex(asn1Hex2, "ENCRYPTED PRIVATE KEY");
- }
- }
-
- // x. PEM PKCS#8 plain private key of ECDSA private key object
- if (formatType == "PKCS8PRV" &&
- typeof KJUR.crypto.ECDSA != "undefined" &&
- keyObjOrHex instanceof KJUR.crypto.ECDSA &&
- keyObjOrHex.isPrivate == true) {
-
- var keyObj = new KJUR.asn1.ASN1Util.newObject({
- "seq": [
- {"int": 1},
- {"octstr": {"hex": keyObjOrHex.prvKeyHex}},
- {"tag": ['a1', true, {"bitstr": {"hex": "00" + keyObjOrHex.pubKeyHex}}]}
- ]
- });
- var keyHex = keyObj.getEncodedHex();
-
- var asn1Obj = KJUR.asn1.ASN1Util.newObject({
- "seq": [
- {"int": 0},
- {"seq": [
- {"oid": {"name": "ecPublicKey"}},
- {"oid": {"name": keyObjOrHex.curveName}}
- ]},
- {"octstr": {"hex": keyHex}}
- ]
- });
-
- var asn1Hex = asn1Obj.getEncodedHex();
- if (passwd === undefined || passwd == null) {
- return ns1.ASN1Util.getPEMStringFromHex(asn1Hex, "PRIVATE KEY");
- } else {
- var asn1Hex2 = _getEncryptedPKCS8(asn1Hex, passwd);
- return ns1.ASN1Util.getPEMStringFromHex(asn1Hex2, "ENCRYPTED PRIVATE KEY");
- }
- }
-
- // x. PEM PKCS#8 plain private key of DSA private key object
- if (formatType == "PKCS8PRV" &&
- typeof KJUR.crypto.DSA != "undefined" &&
- keyObjOrHex instanceof KJUR.crypto.DSA &&
- keyObjOrHex.isPrivate == true) {
-
- var keyObj = new KJUR.asn1.DERInteger({'bigint': keyObjOrHex.x});
- var keyHex = keyObj.getEncodedHex();
-
- var asn1Obj = KJUR.asn1.ASN1Util.newObject({
- "seq": [
- {"int": 0},
- {"seq": [
- {"oid": {"name": "dsa"}},
- {"seq": [
- {"int": {"bigint": keyObjOrHex.p}},
- {"int": {"bigint": keyObjOrHex.q}},
- {"int": {"bigint": keyObjOrHex.g}}
- ]}
- ]},
- {"octstr": {"hex": keyHex}}
- ]
- });
-
- var asn1Hex = asn1Obj.getEncodedHex();
- if (passwd === undefined || passwd == null) {
- return ns1.ASN1Util.getPEMStringFromHex(asn1Hex, "PRIVATE KEY");
- } else {
- var asn1Hex2 = _getEncryptedPKCS8(asn1Hex, passwd);
- return ns1.ASN1Util.getPEMStringFromHex(asn1Hex2, "ENCRYPTED PRIVATE KEY");
- }
- }
-
- throw "unsupported object nor format";
-};
-
-// -- PUBLIC METHODS FOR CSR -------------------------------------------------------
-
-/**
- * get RSAKey/DSA/ECDSA public key object from PEM formatted PKCS#10 CSR string
- * @name getKeyFromCSRPEM
- * @memberOf KEYUTIL
- * @function
- * @param {String} csrPEM PEM formatted PKCS#10 CSR string
- * @return {Object} RSAKey/DSA/ECDSA public key object
- * @since keyutil 1.0.5
- */
-KEYUTIL.getKeyFromCSRPEM = function(csrPEM) {
- var csrHex = KEYUTIL.getHexFromPEM(csrPEM, "CERTIFICATE REQUEST");
- var key = KEYUTIL.getKeyFromCSRHex(csrHex);
- return key;
-};
-
-/**
- * get RSAKey/DSA/ECDSA public key object from hexadecimal string of PKCS#10 CSR
- * @name getKeyFromCSRHex
- * @memberOf KEYUTIL
- * @function
- * @param {String} csrHex hexadecimal string of PKCS#10 CSR
- * @return {Object} RSAKey/DSA/ECDSA public key object
- * @since keyutil 1.0.5
- */
-KEYUTIL.getKeyFromCSRHex = function(csrHex) {
- var info = KEYUTIL.parseCSRHex(csrHex);
- var key = KEYUTIL.getKey(info.p8pubkeyhex, null, "pkcs8pub");
- return key;
-};
-
-/**
- * parse hexadecimal string of PKCS#10 CSR (certificate signing request)
- * @name parseCSRHex
- * @memberOf KEYUTIL
- * @function
- * @param {String} csrHex hexadecimal string of PKCS#10 CSR
- * @return {Array} associative array of parsed CSR
- * @since keyutil 1.0.5
- * @description
- * Resulted associative array has following properties:
- *
- * p8pubkeyhex - hexadecimal string of subject public key in PKCS#8
- *
- */
-KEYUTIL.parseCSRHex = function(csrHex) {
- var result = {};
- var h = csrHex;
-
- // 1. sequence
- if (h.substr(0, 2) != "30")
- throw "malformed CSR(code:001)"; // not sequence
-
- var a1 = ASN1HEX.getPosArrayOfChildren_AtObj(h, 0);
- if (a1.length < 1)
- throw "malformed CSR(code:002)"; // short length
-
- // 2. 2nd sequence
- if (h.substr(a1[0], 2) != "30")
- throw "malformed CSR(code:003)"; // not sequence
-
- var a2 = ASN1HEX.getPosArrayOfChildren_AtObj(h, a1[0]);
- if (a2.length < 3)
- throw "malformed CSR(code:004)"; // 2nd seq short elem
-
- result.p8pubkeyhex = ASN1HEX.getHexOfTLV_AtObj(h, a2[2]);
-
- return result;
-};
diff --git a/jwt/min/asn1-1.0.min.js b/jwt/min/asn1-1.0.min.js
deleted file mode 100644
index 884efb0..0000000
--- a/jwt/min/asn1-1.0.min.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/*! asn1-1.0.9.js (c) 2013-2015 Kenji Urushima | kjur.github.com/jsrsasign/license
- */
-if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!KJUR.asn1){KJUR.asn1={}}KJUR.asn1.ASN1Util=new function(){this.integerToByteHex=function(a){var b=a.toString(16);if((b.length%2)==1){b="0"+b}return b};this.bigIntToMinTwosComplementsHex=function(j){var f=j.toString(16);if(f.substr(0,1)!="-"){if(f.length%2==1){f="0"+f}else{if(!f.match(/^[0-7]/)){f="00"+f}}}else{var a=f.substr(1);var e=a.length;if(e%2==1){e+=1}else{if(!f.match(/^[0-7]/)){e+=2}}var g="";for(var d=0;d15){throw"ASN.1 length too long to represent by 8x: n = "+i.toString(16)}var f=128+g;return f.toString(16)+h}};this.getEncodedHex=function(){if(this.hTLV==null||this.isModified){this.hV=this.getFreshValueHex();this.hL=this.getLengthHexFromValue();this.hTLV=this.hT+this.hL+this.hV;this.isModified=false}return this.hTLV};this.getValueHex=function(){this.getEncodedHex();return this.hV};this.getFreshValueHex=function(){return""}};KJUR.asn1.DERAbstractString=function(c){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);var b=null;var a=null;this.getString=function(){return this.s};this.setString=function(d){this.hTLV=null;this.isModified=true;this.s=d;this.hV=stohex(this.s)};this.setStringHex=function(d){this.hTLV=null;this.isModified=true;this.s=null;this.hV=d};this.getFreshValueHex=function(){return this.hV};if(typeof c!="undefined"){if(typeof c=="string"){this.setString(c)}else{if(typeof c.str!="undefined"){this.setString(c.str)}else{if(typeof c.hex!="undefined"){this.setStringHex(c.hex)}}}}};YAHOO.lang.extend(KJUR.asn1.DERAbstractString,KJUR.asn1.ASN1Object);KJUR.asn1.DERAbstractTime=function(c){KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);var b=null;var a=null;this.localDateToUTC=function(f){utc=f.getTime()+(f.getTimezoneOffset()*60000);var e=new Date(utc);return e};this.formatDate=function(m,o,e){var g=this.zeroPadding;var n=this.localDateToUTC(m);var p=String(n.getFullYear());if(o=="utc"){p=p.substr(2,2)}var l=g(String(n.getMonth()+1),2);var q=g(String(n.getDate()),2);var h=g(String(n.getHours()),2);var i=g(String(n.getMinutes()),2);var j=g(String(n.getSeconds()),2);var r=p+l+q+h+i+j;if(e===true){var f=n.getMilliseconds();if(f!=0){var k=g(String(f),3);k=k.replace(/[0]+$/,"");r=r+"."+k}}return r+"Z"};this.zeroPadding=function(e,d){if(e.length>=d){return e}return new Array(d-e.length+1).join("0")+e};this.getString=function(){return this.s};this.setString=function(d){this.hTLV=null;this.isModified=true;this.s=d;this.hV=stohex(d)};this.setByDateValue=function(h,j,e,d,f,g){var i=new Date(Date.UTC(h,j-1,e,d,f,g,0));this.setByDate(i)};this.getFreshValueHex=function(){return this.hV}};YAHOO.lang.extend(KJUR.asn1.DERAbstractTime,KJUR.asn1.ASN1Object);KJUR.asn1.DERAbstractStructured=function(b){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);var a=null;this.setByASN1ObjectArray=function(c){this.hTLV=null;this.isModified=true;this.asn1Array=c};this.appendASN1Object=function(c){this.hTLV=null;this.isModified=true;this.asn1Array.push(c)};this.asn1Array=new Array();if(typeof b!="undefined"){if(typeof b.array!="undefined"){this.asn1Array=b.array}}};YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured,KJUR.asn1.ASN1Object);KJUR.asn1.DERBoolean=function(){KJUR.asn1.DERBoolean.superclass.constructor.call(this);this.hT="01";this.hTLV="0101ff"};YAHOO.lang.extend(KJUR.asn1.DERBoolean,KJUR.asn1.ASN1Object);KJUR.asn1.DERInteger=function(a){KJUR.asn1.DERInteger.superclass.constructor.call(this);this.hT="02";this.setByBigInteger=function(b){this.hTLV=null;this.isModified=true;this.hV=KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(b)};this.setByInteger=function(c){var b=new BigInteger(String(c),10);this.setByBigInteger(b)};this.setValueHex=function(b){this.hV=b};this.getFreshValueHex=function(){return this.hV};if(typeof a!="undefined"){if(typeof a.bigint!="undefined"){this.setByBigInteger(a.bigint)}else{if(typeof a["int"]!="undefined"){this.setByInteger(a["int"])}else{if(typeof a=="number"){this.setByInteger(a)}else{if(typeof a.hex!="undefined"){this.setValueHex(a.hex)}}}}}};YAHOO.lang.extend(KJUR.asn1.DERInteger,KJUR.asn1.ASN1Object);KJUR.asn1.DERBitString=function(a){KJUR.asn1.DERBitString.superclass.constructor.call(this);this.hT="03";this.setHexValueIncludingUnusedBits=function(b){this.hTLV=null;this.isModified=true;this.hV=b};this.setUnusedBitsAndHexValue=function(b,d){if(b<0||70){h=new a.DERTaggedObject({obj:this.dUnsignedAttrs,tag:"a1",explicit:false})}var g=[this.dCMSVersion,this.dSignerIdentifier,this.dDigestAlgorithm,e,this.dSigAlg,this.dSig,];if(h!=null){g.push(h)}var f=new a.DERSequence({array:g});this.hTLV=f.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.SignerInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.EncapsulatedContentInfo=function(c){KJUR.asn1.cms.EncapsulatedContentInfo.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dEContentType=new a.DERObjectIdentifier({name:"data"});this.dEContent=null;this.isDetached=false;this.eContentValueHex=null;this.setContentType=function(e){if(e.match(/^[0-2][.][0-9.]+$/)){this.dEContentType=new a.DERObjectIdentifier({oid:e})}else{this.dEContentType=new a.DERObjectIdentifier({name:e})}};this.setContentValue=function(e){if(typeof e!="undefined"){if(typeof e.hex=="string"){this.eContentValueHex=e.hex}else{if(typeof e.str=="string"){this.eContentValueHex=utf8tohex(e.str)}}}};this.setContentValueHex=function(e){this.eContentValueHex=e};this.setContentValueStr=function(e){this.eContentValueHex=utf8tohex(e)};this.getEncodedHex=function(){if(typeof this.eContentValueHex!="string"){throw"eContentValue not yet set"}var g=new a.DEROctetString({hex:this.eContentValueHex});this.dEContent=new a.DERTaggedObject({obj:g,tag:"a0",explicit:true});var e=[this.dEContentType];if(!this.isDetached){e.push(this.dEContent)}var f=new a.DERSequence({array:e});this.hTLV=f.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.EncapsulatedContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.ContentInfo=function(c){KJUR.asn1.cms.ContentInfo.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dContentType=null;this.dContent=null;this.setContentType=function(e){if(typeof e=="string"){this.dContentType=d.OID.name2obj(e)}};this.getEncodedHex=function(){var f=new a.DERTaggedObject({obj:this.dContent,tag:"a0",explicit:true});var e=new a.DERSequence({array:[this.dContentType,f]});this.hTLV=e.getEncodedHex();return this.hTLV};if(typeof c!="undefined"){if(c.type){this.setContentType(c.type)}if(c.obj&&c.obj instanceof a.ASN1Object){this.dContent=c.obj}}};YAHOO.lang.extend(KJUR.asn1.cms.ContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.SignedData=function(c){KJUR.asn1.cms.SignedData.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dCMSVersion=new a.DERInteger({"int":1});this.dDigestAlgs=null;this.digestAlgNameList=[];this.dEncapContentInfo=new b.EncapsulatedContentInfo();this.dCerts=null;this.certificateList=[];this.crlList=[];this.signerInfoList=[new b.SignerInfo()];this.addCertificatesByPEM=function(e){var f=KEYUTIL.getHexFromPEM(e);var g=new a.ASN1Object();g.hTLV=f;this.certificateList.push(g)};this.getEncodedHex=function(){if(typeof this.hTLV=="string"){return this.hTLV}if(this.dDigestAlgs==null){var k=[];for(var j=0;j0){var l=new a.DERSet({array:this.certificateList});this.dCerts=new a.DERTaggedObject({obj:l,tag:"a0",explicit:false})}}if(this.dCerts!=null){e.push(this.dCerts)}var g=new a.DERSet({array:this.signerInfoList});e.push(g);var f=new a.DERSequence({array:e});this.hTLV=f.getEncodedHex();return this.hTLV};this.getContentInfo=function(){this.getEncodedHex();var e=new b.ContentInfo({type:"signed-data",obj:this});return e};this.getContentInfoEncodedHex=function(){var e=this.getContentInfo();var f=e.getEncodedHex();return f};this.getPEM=function(){var e=this.getContentInfoEncodedHex();var f=a.ASN1Util.getPEMStringFromHex(e,"CMS");return f}};YAHOO.lang.extend(KJUR.asn1.cms.SignedData,KJUR.asn1.ASN1Object);KJUR.asn1.cms.CMSUtil=new function(){};KJUR.asn1.cms.CMSUtil.newSignedData=function(a){var h=KJUR.asn1.cms;var g=KJUR.asn1.cades;var f=new h.SignedData();f.dEncapContentInfo.setContentValue(a.content);if(typeof a.certs=="object"){for(var b=0;b=(b*2))){break}if(d>=200){break}c.push(e);g=e;d++}return c};this.getNthChildIndex_AtObj=function(d,b,e){var c=this.getPosArrayOfChildren_AtObj(d,b);return c[e]};this.getDecendantIndexByNthList=function(e,d,c){if(c.length==0){return d}var f=c.shift();var b=this.getPosArrayOfChildren_AtObj(e,d);return this.getDecendantIndexByNthList(e,b[f],c)};this.getDecendantHexTLVByNthList=function(d,c,b){var a=this.getDecendantIndexByNthList(d,c,b);return this.getHexOfTLV_AtObj(d,a)};this.getDecendantHexVByNthList=function(d,c,b){var a=this.getDecendantIndexByNthList(d,c,b);return this.getHexOfV_AtObj(d,a)}};ASN1HEX.getVbyList=function(d,c,b,e){var a=this.getDecendantIndexByNthList(d,c,b);if(a===undefined){throw"can't find nthList object"}if(e!==undefined){if(d.substr(a,2)!=e){throw"checking tag doesn't match: "+d.substr(a,2)+"!="+e}}return this.getHexOfV_AtObj(d,a)};ASN1HEX.hextooidstr=function(e){var h=function(b,a){if(b.length>=a){return b}return new Array(a-b.length+1).join("0")+b};var l=[];var o=e.substr(0,2);var f=parseInt(o,16);l[0]=new String(Math.floor(f/40));l[1]=new String(f%40);var m=e.substr(2);var k=[];for(var g=0;g0){n=n+"."+j.join(".")}return n};ASN1HEX.dump=function(e,c,k,g){var o=function(w,i){if(w.length<=i*2){return w}else{var v=w.substr(0,i)+"..(total "+w.length/2+"bytes).."+w.substr(w.length-i,i);return v}};if(c===undefined){c={ommit_long_octet:32}}if(k===undefined){k=0}if(g===undefined){g=""}var r=c.ommit_long_octet;if(e.substr(k,2)=="01"){var h=ASN1HEX.getHexOfV_AtObj(e,k);if(h=="00"){return g+"BOOLEAN FALSE\n"}else{return g+"BOOLEAN TRUE\n"}}if(e.substr(k,2)=="02"){var h=ASN1HEX.getHexOfV_AtObj(e,k);return g+"INTEGER "+o(h,r)+"\n"}if(e.substr(k,2)=="03"){var h=ASN1HEX.getHexOfV_AtObj(e,k);return g+"BITSTRING "+o(h,r)+"\n"}if(e.substr(k,2)=="04"){var h=ASN1HEX.getHexOfV_AtObj(e,k);if(ASN1HEX.isASN1HEX(h)){var j=g+"OCTETSTRING, encapsulates\n";j=j+ASN1HEX.dump(h,c,0,g+" ");return j}else{return g+"OCTETSTRING "+o(h,r)+"\n"}}if(e.substr(k,2)=="05"){return g+"NULL\n"}if(e.substr(k,2)=="06"){var l=ASN1HEX.getHexOfV_AtObj(e,k);var a=KJUR.asn1.ASN1Util.oidHexToInt(l);var n=KJUR.asn1.x509.OID.oid2name(a);var b=a.replace(/\./g," ");if(n!=""){return g+"ObjectIdentifier "+n+" ("+b+")\n"}else{return g+"ObjectIdentifier ("+b+")\n"}}if(e.substr(k,2)=="0c"){return g+"UTF8String '"+hextoutf8(ASN1HEX.getHexOfV_AtObj(e,k))+"'\n"}if(e.substr(k,2)=="13"){return g+"PrintableString '"+hextoutf8(ASN1HEX.getHexOfV_AtObj(e,k))+"'\n"}if(e.substr(k,2)=="14"){return g+"TeletexString '"+hextoutf8(ASN1HEX.getHexOfV_AtObj(e,k))+"'\n"}if(e.substr(k,2)=="16"){return g+"IA5String '"+hextoutf8(ASN1HEX.getHexOfV_AtObj(e,k))+"'\n"}if(e.substr(k,2)=="17"){return g+"UTCTime "+hextoutf8(ASN1HEX.getHexOfV_AtObj(e,k))+"\n"}if(e.substr(k,2)=="18"){return g+"GeneralizedTime "+hextoutf8(ASN1HEX.getHexOfV_AtObj(e,k))+"\n"}if(e.substr(k,2)=="30"){if(e.substr(k,4)=="3000"){return g+"SEQUENCE {}\n"}var j=g+"SEQUENCE\n";var d=ASN1HEX.getPosArrayOfChildren_AtObj(e,k);var f=c;if((d.length==2||d.length==3)&&e.substr(d[0],2)=="06"&&e.substr(d[d.length-1],2)=="04"){var t=ASN1HEX.getHexOfV_AtObj(e,d[0]);var a=KJUR.asn1.ASN1Util.oidHexToInt(t);var n=KJUR.asn1.x509.OID.oid2name(a);var p=JSON.parse(JSON.stringify(c));p.x509ExtName=n;f=p}for(var q=0;q0){var d=new KJUR.asn1.DERSequence({array:this.extensionsArray});var b=new KJUR.asn1.DERTaggedObject({explicit:true,tag:"a3",obj:d});this.asn1Array.push(b)}var e=new KJUR.asn1.DERSequence({array:this.asn1Array});this.hTLV=e.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize()};YAHOO.lang.extend(KJUR.asn1.x509.TBSCertificate,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Extension=function(b){KJUR.asn1.x509.Extension.superclass.constructor.call(this);var a=null;this.getEncodedHex=function(){var f=new KJUR.asn1.DERObjectIdentifier({oid:this.oid});var e=new KJUR.asn1.DEROctetString({hex:this.getExtnValueHex()});var d=new Array();d.push(f);if(this.critical){d.push(new KJUR.asn1.DERBoolean())}d.push(e);var c=new KJUR.asn1.DERSequence({array:d});return c.getEncodedHex()};this.critical=false;if(typeof b!="undefined"){if(typeof b.critical!="undefined"){this.critical=b.critical}}};YAHOO.lang.extend(KJUR.asn1.x509.Extension,KJUR.asn1.ASN1Object);KJUR.asn1.x509.KeyUsage=function(a){KJUR.asn1.x509.KeyUsage.superclass.constructor.call(this,a);this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.15";if(typeof a!="undefined"){if(typeof a.bin!="undefined"){this.asn1ExtnValue=new KJUR.asn1.DERBitString(a)}}};YAHOO.lang.extend(KJUR.asn1.x509.KeyUsage,KJUR.asn1.x509.Extension);KJUR.asn1.x509.BasicConstraints=function(c){KJUR.asn1.x509.BasicConstraints.superclass.constructor.call(this,c);var a=false;var b=-1;this.getExtnValueHex=function(){var e=new Array();if(this.cA){e.push(new KJUR.asn1.DERBoolean())}if(this.pathLen>-1){e.push(new KJUR.asn1.DERInteger({"int":this.pathLen}))}var d=new KJUR.asn1.DERSequence({array:e});this.asn1ExtnValue=d;return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.19";this.cA=false;this.pathLen=-1;if(typeof c!="undefined"){if(typeof c.cA!="undefined"){this.cA=c.cA}if(typeof c.pathLen!="undefined"){this.pathLen=c.pathLen}}};YAHOO.lang.extend(KJUR.asn1.x509.BasicConstraints,KJUR.asn1.x509.Extension);KJUR.asn1.x509.CRLDistributionPoints=function(a){KJUR.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,a);this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.setByDPArray=function(b){this.asn1ExtnValue=new KJUR.asn1.DERSequence({array:b})};this.setByOneURI=function(e){var b=new KJUR.asn1.x509.GeneralNames([{uri:e}]);var d=new KJUR.asn1.x509.DistributionPointName(b);var c=new KJUR.asn1.x509.DistributionPoint({dpobj:d});this.setByDPArray([c])};this.oid="2.5.29.31";if(typeof a!="undefined"){if(typeof a.array!="undefined"){this.setByDPArray(a.array)}else{if(typeof a.uri!="undefined"){this.setByOneURI(a.uri)}}}};YAHOO.lang.extend(KJUR.asn1.x509.CRLDistributionPoints,KJUR.asn1.x509.Extension);KJUR.asn1.x509.ExtKeyUsage=function(a){KJUR.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,a);this.setPurposeArray=function(b){this.asn1ExtnValue=new KJUR.asn1.DERSequence();for(var c=0;c0){var c=new KJUR.asn1.DERSequence({array:this.aRevokedCert});this.asn1Array.push(c)}var d=new KJUR.asn1.DERSequence({array:this.asn1Array});this.hTLV=d.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize=function(){this.asn1Version=null;this.asn1SignatureAlg=null;this.asn1Issuer=null;this.asn1ThisUpdate=null;this.asn1NextUpdate=null;this.aRevokedCert=new Array()};this._initialize()};YAHOO.lang.extend(KJUR.asn1.x509.TBSCertList,KJUR.asn1.ASN1Object);KJUR.asn1.x509.CRLEntry=function(c){KJUR.asn1.x509.CRLEntry.superclass.constructor.call(this);var b=null;var a=null;this.setCertSerial=function(d){this.sn=new KJUR.asn1.DERInteger(d)};this.setRevocationDate=function(d){this.time=new KJUR.asn1.x509.Time(d)};this.getEncodedHex=function(){var d=new KJUR.asn1.DERSequence({array:[this.sn,this.time]});this.TLV=d.getEncodedHex();return this.TLV};if(typeof c!="undefined"){if(typeof c.time!="undefined"){this.setRevocationDate(c.time)}if(typeof c.sn!="undefined"){this.setCertSerial(c.sn)}}};YAHOO.lang.extend(KJUR.asn1.x509.CRLEntry,KJUR.asn1.ASN1Object);KJUR.asn1.x509.X500Name=function(b){KJUR.asn1.x509.X500Name.superclass.constructor.call(this);this.asn1Array=new Array();this.setByString=function(c){var d=c.split("/");d.shift();for(var e=0;ea.length){d=a.length}for(var b=0;bd){throw"key is too short for SigAlg: keylen="+j+","+a}var b="0001";var k="00"+c;var g="";var l=d-b.length-k.length;for(var f=0;f0||K.compareTo(u)>0||BigInteger.ZERO.compareTo(J)>0||J.compareTo(u)>0){throw"invalid DSA signature"}var I=J.modInverse(u);var A=D.multiply(I).mod(u);var v=K.multiply(I).mod(u);var F=G.modPow(A,z).multiply(H.modPow(v,z)).mod(z).mod(u);return F.compareTo(K)==0};this.parseASN1Signature=function(u){try{var y=new BigInteger(ASN1HEX.getVbyList(u,0,[0],"02"),16);var v=new BigInteger(ASN1HEX.getVbyList(u,0,[1],"02"),16);return[y,v]}catch(w){throw"malformed DSA signature"}};function d(E,w,B,v,u,C){var z=KJUR.crypto.Util.hashString(w,E.toLowerCase());var z=z.substr(0,u.bitLength()/4);var A=new BigInteger(z,16);var y=n(BigInteger.ONE.add(BigInteger.ONE),u.subtract(BigInteger.ONE));var F=(B.modPow(y,v)).mod(u);var D=(y.modInverse(u).multiply(A.add(C.multiply(F)))).mod(u);var G=new Array();G[0]=F;G[1]=D;return G}function r(v){var u=openpgp.config.config.prefer_hash_algorithm;switch(Math.round(v.bitLength()/8)){case 20:if(u!=2&&u>11&&u!=10&&u<8){return 2}return u;case 28:if(u>11&&u<8){return 11}return u;case 32:if(u>10&&u<8){return 8}return u;default:util.print_debug("DSA select hash algorithm: returning null for an unknown length of q");return null}}this.select_hash_algorithm=r;function m(I,K,J,B,z,u,F,G){var C=KJUR.crypto.Util.hashString(B,I.toLowerCase());var C=C.substr(0,u.bitLength()/4);var D=new BigInteger(C,16);if(BigInteger.ZERO.compareTo(K)>0||K.compareTo(u)>0||BigInteger.ZERO.compareTo(J)>0||J.compareTo(u)>0){util.print_error("invalid DSA Signature");return null}var H=J.modInverse(u);var A=D.multiply(H).mod(u);var v=K.multiply(H).mod(u);var E=F.modPow(A,z).multiply(G.modPow(v,z)).mod(z).mod(u);return E.compareTo(K)==0}function a(z){var A=new BigInteger(z,primeCenterie);var y=j(q,512);var u=t(p,q,z);var v;do{v=new BigInteger(q.bitCount(),rand)}while(x.compareTo(BigInteger.ZERO)!=1&&x.compareTo(q)!=-1);var w=g.modPow(x,p);return{x:v,q:A,p:y,g:u,y:w}}function j(y,z,w){if(z%64!=0){return false}var u;var v;do{u=w(bitcount,true);v=u.subtract(BigInteger.ONE);u=u.subtract(v.remainder(y))}while(!u.isProbablePrime(primeCenterie)||u.bitLength()!=l);return u}function t(B,z,A,w){var u=B.subtract(BigInteger.ONE);var y=u.divide(z);var v;do{v=w(A)}while(v.compareTo(u)!=-1&&v.compareTo(BigInteger.ONE)!=1);return v.modPow(y,B)}function o(w,y,u){var v;do{v=u(y,false)}while(v.compareTo(w)!=-1&&v.compareTo(BigInteger.ZERO)!=1);return v}function i(v,w){k=o(v);var u=g.modPow(k,w).mod(v);return u}function h(B,w,y,v,z,u){var A=B(v);s=(w.modInverse(z).multiply(A.add(u.multiply(y)))).mod(z);return s}this.sign=d;this.verify=m;function n(w,u){if(u.compareTo(w)<=0){return}var v=u.subtract(w);var y=e(v.bitLength());while(y>v){y=e(v.bitLength())}return w.add(y)}function e(w){if(w<0){return null}var u=Math.floor((w+7)/8);var v=c(u);if(w%8>0){v=String.fromCharCode((Math.pow(2,w%8)-1)&v.charCodeAt(0))+v.substring(1)}return new BigInteger(f(v),16)}function c(w){var u="";for(var v=0;v=0;--p){q=q.twice2D();q.z=BigInteger.ONE;if(o.testBit(p)){if(n.testBit(p)){q=q.add2D(t)}else{q=q.add2D(s)}}else{if(n.testBit(p)){q=q.add2D(r)}}}return q}this.getBigRandom=function(i){return new BigInteger(i.bitLength(),a).mod(i.subtract(BigInteger.ONE)).add(BigInteger.ONE)};this.setNamedCurve=function(i){this.ecparams=KJUR.crypto.ECParameterDB.getByName(i);this.prvKeyHex=null;this.pubKeyHex=null;this.curveName=i};this.setPrivateKeyHex=function(i){this.isPrivate=true;this.prvKeyHex=i};this.setPublicKeyHex=function(i){this.isPublic=true;this.pubKeyHex=i};this.generateKeyPairHex=function(){var k=this.ecparams.n;var n=this.getBigRandom(k);var l=this.ecparams.G.multiply(n);var q=l.getX().toBigInteger();var o=l.getY().toBigInteger();var i=this.ecparams.keylen/4;var m=("0000000000"+n.toString(16)).slice(-i);var r=("0000000000"+q.toString(16)).slice(-i);var p=("0000000000"+o.toString(16)).slice(-i);var j="04"+r+p;this.setPrivateKeyHex(m);this.setPublicKeyHex(j);return{ecprvhex:m,ecpubhex:j}};this.signWithMessageHash=function(i){return this.signHex(i,this.prvKeyHex)};this.signHex=function(o,j){var t=new BigInteger(j,16);var l=this.ecparams.n;var q=new BigInteger(o,16);do{var m=this.getBigRandom(l);var u=this.ecparams.G;var p=u.multiply(m);var i=p.getX().toBigInteger().mod(l)}while(i.compareTo(BigInteger.ZERO)<=0);var v=m.modInverse(l).multiply(q.add(t.multiply(i))).mod(l);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(i,v)};this.sign=function(m,u){var q=u;var j=this.ecparams.n;var p=BigInteger.fromByteArrayUnsigned(m);do{var l=this.getBigRandom(j);var t=this.ecparams.G;var o=t.multiply(l);var i=o.getX().toBigInteger().mod(j)}while(i.compareTo(BigInteger.ZERO)<=0);var v=l.modInverse(j).multiply(p.add(q.multiply(i))).mod(j);return this.serializeSig(i,v)};this.verifyWithMessageHash=function(j,i){return this.verifyHex(j,i,this.pubKeyHex)};this.verifyHex=function(m,i,p){var l,j;var o=KJUR.crypto.ECDSA.parseSigHex(i);l=o.r;j=o.s;var k;k=ECPointFp.decodeFromHex(this.ecparams.curve,p);var n=new BigInteger(m,16);return this.verifyRaw(n,l,j,k)};this.verify=function(o,p,j){var l,i;if(Bitcoin.Util.isArray(p)){var n=this.parseSig(p);l=n.r;i=n.s}else{if("object"===typeof p&&p.r&&p.s){l=p.r;i=p.s}else{throw"Invalid value for signature"}}var k;if(j instanceof ECPointFp){k=j}else{if(Bitcoin.Util.isArray(j)){k=ECPointFp.decodeFrom(this.ecparams.curve,j)}else{throw"Invalid format for pubkey value, must be byte array or ECPointFp"}}var m=BigInteger.fromByteArrayUnsigned(o);return this.verifyRaw(m,l,i,k)};this.verifyRaw=function(o,i,w,m){var l=this.ecparams.n;var u=this.ecparams.G;if(i.compareTo(BigInteger.ONE)<0||i.compareTo(l)>=0){return false}if(w.compareTo(BigInteger.ONE)<0||w.compareTo(l)>=0){return false}var p=w.modInverse(l);var k=o.multiply(p).mod(l);var j=i.multiply(p).mod(l);var q=u.multiply(k).add(m.multiply(j));var t=q.getX().toBigInteger().mod(l);return t.equals(i)};this.serializeSig=function(k,j){var l=k.toByteArraySigned();var i=j.toByteArraySigned();var m=[];m.push(2);m.push(l.length);m=m.concat(l);m.push(2);m.push(i.length);m=m.concat(i);m.unshift(m.length);m.unshift(48);return m};this.parseSig=function(n){var m;if(n[0]!=48){throw new Error("Signature not a valid DERSequence")}m=2;if(n[m]!=2){throw new Error("First element in signature must be a DERInteger")}var l=n.slice(m+2,m+2+n[m+1]);m+=2+n[m+1];if(n[m]!=2){throw new Error("Second element in signature must be a DERInteger")}var i=n.slice(m+2,m+2+n[m+1]);m+=2+n[m+1];var k=BigInteger.fromByteArrayUnsigned(l);var j=BigInteger.fromByteArrayUnsigned(i);return{r:k,s:j}};this.parseSigCompact=function(m){if(m.length!==65){throw"Signature has the wrong length"}var j=m[0]-27;if(j<0||j>7){throw"Invalid signature type"}var o=this.ecparams.n;var l=BigInteger.fromByteArrayUnsigned(m.slice(1,33)).mod(o);var k=BigInteger.fromByteArrayUnsigned(m.slice(33,65)).mod(o);return{r:l,s:k,i:j}};if(h!==undefined){if(h.curve!==undefined){this.curveName=h.curve}}if(this.curveName===undefined){this.curveName=e}this.setNamedCurve(this.curveName);if(h!==undefined){if(h.prv!==undefined){this.setPrivateKeyHex(h.prv)}if(h.pub!==undefined){this.setPublicKeyHex(h.pub)}}};KJUR.crypto.ECDSA.parseSigHex=function(a){var b=KJUR.crypto.ECDSA.parseSigHexInHexRS(a);var d=new BigInteger(b.r,16);var c=new BigInteger(b.s,16);return{r:d,s:c}};KJUR.crypto.ECDSA.parseSigHexInHexRS=function(c){if(c.substr(0,2)!="30"){throw"signature is not a ASN.1 sequence"}var b=ASN1HEX.getPosArrayOfChildren_AtObj(c,0);if(b.length!=2){throw"number of signature ASN.1 sequence elements seem wrong"}var g=b[0];var f=b[1];if(c.substr(g,2)!="02"){throw"1st item of sequene of signature is not ASN.1 integer"}if(c.substr(f,2)!="02"){throw"2nd item of sequene of signature is not ASN.1 integer"}var e=ASN1HEX.getHexOfV_AtObj(c,g);var d=ASN1HEX.getHexOfV_AtObj(c,f);return{r:e,s:d}};KJUR.crypto.ECDSA.asn1SigToConcatSig=function(c){var d=KJUR.crypto.ECDSA.parseSigHexInHexRS(c);var b=d.r;var a=d.s;if(b.substr(0,2)=="00"&&(((b.length/2)*8)%(16*8))==8){b=b.substr(2)}if(a.substr(0,2)=="00"&&(((a.length/2)*8)%(16*8))==8){a=a.substr(2)}if((((b.length/2)*8)%(16*8))!=0){throw"unknown ECDSA sig r length error"}if((((a.length/2)*8)%(16*8))!=0){throw"unknown ECDSA sig s length error"}return b+a};KJUR.crypto.ECDSA.concatSigToASN1Sig=function(a){if((((a.length/2)*8)%(16*8))!=0){throw"unknown ECDSA concatinated r-s sig length error"}var c=a.substr(0,a.length/2);var b=a.substr(a.length/2);return KJUR.crypto.ECDSA.hexRSSigToASN1Sig(c,b)};KJUR.crypto.ECDSA.hexRSSigToASN1Sig=function(b,a){var d=new BigInteger(b,16);var c=new BigInteger(a,16);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(d,c)};KJUR.crypto.ECDSA.biRSSigToASN1Sig=function(e,c){var b=new KJUR.asn1.DERInteger({bigint:e});var a=new KJUR.asn1.DERInteger({bigint:c});var d=new KJUR.asn1.DERSequence({array:[b,a]});return d.getEncodedHex()};
\ No newline at end of file
diff --git a/jwt/min/ecparam-1.0.min.js b/jwt/min/ecparam-1.0.min.js
deleted file mode 100644
index 7407ef6..0000000
--- a/jwt/min/ecparam-1.0.min.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/*! ecparam-1.0.0.js (c) 2013 Kenji Urushima | kjur.github.com/jsrsasign/license
- */
-if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.crypto=="undefined"||!KJUR.crypto){KJUR.crypto={}}KJUR.crypto.ECParameterDB=new function(){var b={};var c={};function a(d){return new BigInteger(d,16)}this.getByName=function(e){var d=e;if(typeof c[d]!="undefined"){d=c[e]}if(typeof b[d]!="undefined"){return b[d]}throw"unregistered EC curve name: "+d};this.regist=function(A,l,o,g,m,e,j,f,k,u,d,x){b[A]={};var s=a(o);var z=a(g);var y=a(m);var t=a(e);var w=a(j);var r=new ECCurveFp(s,z,y);var q=r.decodePointHex("04"+f+k);b[A]["name"]=A;b[A]["keylen"]=l;b[A]["curve"]=r;b[A]["G"]=q;b[A]["n"]=t;b[A]["h"]=w;b[A]["oid"]=d;b[A]["info"]=x;for(var v=0;v0){var c=":"+j.join(":")+":";if(c.indexOf(":"+h+":")==-1){throw"algorithm '"+h+"' not accepted in the list"}}if(h!="none"&&s===null){throw"key shall be specified to verify."}if(r=="HS"){if(typeof s!="string"&&s.length!=0&&s.length%2!=0&&!s.match(/^[0-9A-Fa-f]+/)){throw"key shall be a hexadecimal str for HS* algs"}}if(typeof s=="string"&&s.indexOf("-----BEGIN ")!=-1){s=KEYUTIL.getKey(s)}if(r=="RS"||r=="PS"){if(!(s instanceof RSAKey)){throw"key shall be a RSAKey obj for RS* and PS* algs"}}if(r=="ES"){if(!(s instanceof KJUR.crypto.ECDSA)){throw"key shall be a ECDSA obj for ES* algs"}}if(h=="none"){}var m=null;if(l.jwsalg2sigalg[i.alg]===undefined){throw"unsupported alg name: "+h}else{m=l.jwsalg2sigalg[h]}if(m=="none"){throw"not supported"}else{if(m.substr(0,4)=="Hmac"){if(s===undefined){throw"hexadecimal key shall be specified for HMAC"}var g=new KJUR.crypto.Mac({alg:m,pass:hextorstr(s)});g.updateString(b);hSig2=g.doFinal();return q==hSig2}else{if(m.indexOf("withECDSA")!=-1){var f=null;try{f=KJUR.crypto.ECDSA.concatSigToASN1Sig(q)}catch(n){return false}var e=new KJUR.crypto.Signature({alg:m});e.init(s);e.updateString(b);return e.verify(f)}else{var e=new KJUR.crypto.Signature({alg:m});e.init(s);e.updateString(b);return e.verify(q)}}}};KJUR.jws.JWS.verifyJWT=function(d,j,l){var h=KJUR.jws.JWS;var i=d.split(".");var c=i[0];var g=i[1];var m=c+"."+g;var k=b64utohex(i[2]);var f=h.readSafeJSONString(b64utoutf8(c));var e=h.readSafeJSONString(b64utoutf8(g));if(f.alg===undefined){return false}if(l.alg===undefined){throw"acceptField.alg shall be specified"}if(!h.inArray(f.alg,l.alg)){return false}if(e.iss!==undefined&&typeof l.iss==="object"){if(!h.inArray(e.iss,l.iss)){return false}}if(e.sub!==undefined&&typeof l.sub==="object"){if(!h.inArray(e.sub,l.sub)){return false}}if(e.aud!==undefined&&typeof l.aud==="object"){if(typeof e.aud=="string"){if(!h.inArray(e.aud,l.aud)){return false}}else{if(typeof e.aud=="object"){if(!h.includedArray(e.aud,l.aud)){return false}}}}var b=KJUR.jws.IntDate.getNow();if(l.verifyAt!==undefined&&typeof l.verifyAt=="number"){b=l.verifyAt}if(e.exp!==undefined&&typeof e.exp=="number"){if(e.exp0){var c=":"+j.join(":")+":";if(c.indexOf(":"+h+":")==-1){throw"algorithm '"+h+"' not accepted in the list"}}if(h!="none"&&t===null){throw"key shall be specified to verify."}if(typeof t=="string"&&t.indexOf("-----BEGIN ")!=-1){t=KEYUTIL.getKey(t)}if(s=="RS"||s=="PS"){if(!(t instanceof RSAKey)){throw"key shall be a RSAKey obj for RS* and PS* algs"}}if(s=="ES"){if(!(t instanceof KJUR.crypto.ECDSA)){throw"key shall be a ECDSA obj for ES* algs"}}if(h=="none"){}var n=null;if(m.jwsalg2sigalg[i.alg]===undefined){throw"unsupported alg name: "+h}else{n=m.jwsalg2sigalg[h]}if(n=="none"){throw"not supported"}else{if(n.substr(0,4)=="Hmac"){var k=null;if(t===undefined){throw"hexadecimal key shall be specified for HMAC"}var g=new KJUR.crypto.Mac({alg:n,pass:t});g.updateString(b);k=g.doFinal();return r==k}else{if(n.indexOf("withECDSA")!=-1){var f=null;try{f=KJUR.crypto.ECDSA.concatSigToASN1Sig(r)}catch(o){return false}var e=new KJUR.crypto.Signature({alg:n});e.init(t);e.updateString(b);return e.verify(f)}else{var e=new KJUR.crypto.Signature({alg:n});e.init(t);e.updateString(b);return e.verify(r)}}}};KJUR.jws.JWS.parse=function(g){var c=g.split(".");var b={};var f,e,d;if(c.length!=2&&c.length!=3){throw"malformed sJWS: wrong number of '.' splitted elements"}f=c[0];e=c[1];if(c.length==3){d=c[2]}b.headerObj=KJUR.jws.JWS.readSafeJSONString(b64utoutf8(f));b.payloadObj=KJUR.jws.JWS.readSafeJSONString(b64utoutf8(e));b.headerPP=JSON.stringify(b.headerObj,null," ");if(b.payloadObj==null){b.payloadPP=b64utoutf8(e)}else{b.payloadPP=JSON.stringify(b.payloadObj,null," ")}if(d!==undefined){b.sigHex=b64utohex(d)}return b};KJUR.jws.JWS.verifyJWT=function(d,j,l){var h=KJUR.jws.JWS;var i=d.split(".");var c=i[0];var g=i[1];var m=c+"."+g;var k=b64utohex(i[2]);var f=h.readSafeJSONString(b64utoutf8(c));var e=h.readSafeJSONString(b64utoutf8(g));if(f.alg===undefined){return false}if(l.alg===undefined){throw"acceptField.alg shall be specified"}if(!h.inArray(f.alg,l.alg)){return false}if(e.iss!==undefined&&typeof l.iss==="object"){if(!h.inArray(e.iss,l.iss)){return false}}if(e.sub!==undefined&&typeof l.sub==="object"){if(!h.inArray(e.sub,l.sub)){return false}}if(e.aud!==undefined&&typeof l.aud==="object"){if(typeof e.aud=="string"){if(!h.inArray(e.aud,l.aud)){return false}}else{if(typeof e.aud=="object"){if(!h.includedArray(e.aud,l.aud)){return false}}}}var b=KJUR.jws.IntDate.getNow();if(l.verifyAt!==undefined&&typeof l.verifyAt==="number"){b=l.verifyAt}if(l.gracePeriod===undefined||typeof l.gracePeriod!=="number"){l.gracePeriod=0}if(e.exp!==undefined&&typeof e.exp=="number"){if(e.exp+l.gracePeriod=u*2){break}}var z={};z.keyhex=x.substr(0,i[q]["keylen"]*2);z.ivhex=x.substr(i[q]["keylen"]*2,i[q]["ivlen"]*2);return z};var b=function(p,v,r,w){var s=CryptoJS.enc.Base64.parse(p);var q=CryptoJS.enc.Hex.stringify(s);var u=i[v]["proc"];var t=u(q,r,w);return t};var h=function(p,s,q,u){var r=i[s]["eproc"];var t=r(p,q,u);return t};return{version:"1.0.0",getHexFromPEM:function(q,u){var r=q;if(r.indexOf("-----BEGIN ")==-1){throw"can't find PEM header: "+u}if(typeof u=="string"&&u!=""){r=r.replace("-----BEGIN "+u+"-----","");r=r.replace("-----END "+u+"-----","")}else{r=r.replace(/-----BEGIN [^-]+-----/,"");r=r.replace(/-----END [^-]+-----/,"")}var t=r.replace(/\s+/g,"");var p=b64tohex(t);return p},getDecryptedKeyHexByKeyIV:function(q,t,s,r){var p=c(t);return p(q,s,r)},parsePKCS5PEM:function(p){return n(p)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(q,p,r){return j(q,p,r)},decryptKeyB64:function(p,r,q,s){return b(p,r,q,s)},getDecryptedKeyHex:function(y,x){var q=n(y);var t=q.type;var r=q.cipher;var p=q.ivsalt;var s=q.data;var w=j(r,x,p);var v=w.keyhex;var u=b(s,r,v,p);return u},getRSAKeyFromEncryptedPKCS5PEM:function(r,q){var s=this.getDecryptedKeyHex(r,q);var p=new RSAKey();p.readPrivateKeyFromASN1HexString(s);return p},getEncryptedPKCS5PEMFromPrvKeyHex:function(x,s,A,t,r){var p="";if(typeof t=="undefined"||t==null){t="AES-256-CBC"}if(typeof i[t]=="undefined"){throw"KEYUTIL unsupported algorithm: "+t}if(typeof r=="undefined"||r==null){var v=i[t]["ivlen"];var u=m(v);r=u.toUpperCase()}var z=j(t,A,r);var y=z.keyhex;var w=h(s,t,y,r);var q=w.replace(/(.{64})/g,"$1\r\n");var p="-----BEGIN "+x+" PRIVATE KEY-----\r\n";p+="Proc-Type: 4,ENCRYPTED\r\n";p+="DEK-Info: "+t+","+r+"\r\n";p+="\r\n";p+=q;p+="\r\n-----END "+x+" PRIVATE KEY-----\r\n";return p},getEncryptedPKCS5PEMFromRSAKey:function(D,E,r,t){var B=new KJUR.asn1.DERInteger({"int":0});var w=new KJUR.asn1.DERInteger({bigint:D.n});var A=new KJUR.asn1.DERInteger({"int":D.e});var C=new KJUR.asn1.DERInteger({bigint:D.d});var u=new KJUR.asn1.DERInteger({bigint:D.p});var s=new KJUR.asn1.DERInteger({bigint:D.q});var z=new KJUR.asn1.DERInteger({bigint:D.dmp1});var v=new KJUR.asn1.DERInteger({bigint:D.dmq1});var y=new KJUR.asn1.DERInteger({bigint:D.coeff});var F=new KJUR.asn1.DERSequence({array:[B,w,A,C,u,s,z,v,y]});var x=F.getEncodedHex();return this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",x,E,r,t)},newEncryptedPKCS5PEM:function(p,q,t,u){if(typeof q=="undefined"||q==null){q=1024}if(typeof t=="undefined"||t==null){t="10001"}var r=new RSAKey();r.generate(q,t);var s=null;if(typeof u=="undefined"||u==null){s=this.getEncryptedPKCS5PEMFromRSAKey(r,p)}else{s=this.getEncryptedPKCS5PEMFromRSAKey(r,p,u)}return s},getRSAKeyFromPlainPKCS8PEM:function(r){if(r.match(/ENCRYPTED/)){throw"pem shall be not ENCRYPTED"}var q=this.getHexFromPEM(r,"PRIVATE KEY");var p=this.getRSAKeyFromPlainPKCS8Hex(q);return p},getRSAKeyFromPlainPKCS8Hex:function(s){var r=ASN1HEX.getPosArrayOfChildren_AtObj(s,0);if(r.length!=3){throw"outer DERSequence shall have 3 elements: "+r.length}var q=ASN1HEX.getHexOfTLV_AtObj(s,r[1]);if(q!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmIdentifier is not rsaEnc: "+q}var q=ASN1HEX.getHexOfTLV_AtObj(s,r[1]);var t=ASN1HEX.getHexOfTLV_AtObj(s,r[2]);var u=ASN1HEX.getHexOfV_AtObj(t,0);var p=new RSAKey();p.readPrivateKeyFromASN1HexString(u);return p},parseHexOfEncryptedPKCS8:function(w){var s={};var r=ASN1HEX.getPosArrayOfChildren_AtObj(w,0);if(r.length!=2){throw"malformed format: SEQUENCE(0).items != 2: "+r.length}s.ciphertext=ASN1HEX.getHexOfV_AtObj(w,r[1]);var y=ASN1HEX.getPosArrayOfChildren_AtObj(w,r[0]);if(y.length!=2){throw"malformed format: SEQUENCE(0.0).items != 2: "+y.length}if(ASN1HEX.getHexOfV_AtObj(w,y[0])!="2a864886f70d01050d"){throw"this only supports pkcs5PBES2"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(w,y[1]);if(y.length!=2){throw"malformed format: SEQUENCE(0.0.1).items != 2: "+p.length}var q=ASN1HEX.getPosArrayOfChildren_AtObj(w,p[1]);if(q.length!=2){throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+q.length}if(ASN1HEX.getHexOfV_AtObj(w,q[0])!="2a864886f70d0307"){throw"this only supports TripleDES"}s.encryptionSchemeAlg="TripleDES";s.encryptionSchemeIV=ASN1HEX.getHexOfV_AtObj(w,q[1]);var t=ASN1HEX.getPosArrayOfChildren_AtObj(w,p[0]);if(t.length!=2){throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+t.length}if(ASN1HEX.getHexOfV_AtObj(w,t[0])!="2a864886f70d01050c"){throw"this only supports pkcs5PBKDF2"}var x=ASN1HEX.getPosArrayOfChildren_AtObj(w,t[1]);if(x.length<2){throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+x.length}s.pbkdf2Salt=ASN1HEX.getHexOfV_AtObj(w,x[0]);var u=ASN1HEX.getHexOfV_AtObj(w,x[1]);try{s.pbkdf2Iter=parseInt(u,16)}catch(v){throw"malformed format pbkdf2Iter: "+u}return s},getPBKDF2KeyHexFromParam:function(u,p){var t=CryptoJS.enc.Hex.parse(u.pbkdf2Salt);var q=u.pbkdf2Iter;var s=CryptoJS.PBKDF2(p,t,{keySize:192/32,iterations:q});var r=CryptoJS.enc.Hex.stringify(s);return r},getPlainPKCS8HexFromEncryptedPKCS8PEM:function(x,y){var r=this.getHexFromPEM(x,"ENCRYPTED PRIVATE KEY");var p=this.parseHexOfEncryptedPKCS8(r);var u=KEYUTIL.getPBKDF2KeyHexFromParam(p,y);var v={};v.ciphertext=CryptoJS.enc.Hex.parse(p.ciphertext);var t=CryptoJS.enc.Hex.parse(u);var s=CryptoJS.enc.Hex.parse(p.encryptionSchemeIV);var w=CryptoJS.TripleDES.decrypt(v,t,{iv:s});var q=CryptoJS.enc.Hex.stringify(w);return q},getRSAKeyFromEncryptedPKCS8PEM:function(s,r){var q=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(s,r);var p=this.getRSAKeyFromPlainPKCS8Hex(q);return p},getKeyFromEncryptedPKCS8PEM:function(s,q){var p=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(s,q);var r=this.getKeyFromPlainPrivatePKCS8Hex(p);return r},parsePlainPrivatePKCS8Hex:function(s){var q={};q.algparam=null;if(s.substr(0,2)!="30"){throw"malformed plain PKCS8 private key(code:001)"}var r=ASN1HEX.getPosArrayOfChildren_AtObj(s,0);if(r.length!=3){throw"malformed plain PKCS8 private key(code:002)"}if(s.substr(r[1],2)!="30"){throw"malformed PKCS8 private key(code:003)"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(s,r[1]);if(p.length!=2){throw"malformed PKCS8 private key(code:004)"}if(s.substr(p[0],2)!="06"){throw"malformed PKCS8 private key(code:005)"}q.algoid=ASN1HEX.getHexOfV_AtObj(s,p[0]);if(s.substr(p[1],2)=="06"){q.algparam=ASN1HEX.getHexOfV_AtObj(s,p[1])}if(s.substr(r[2],2)!="04"){throw"malformed PKCS8 private key(code:006)"}q.keyidx=ASN1HEX.getStartPosOfV_AtObj(s,r[2]);return q},getKeyFromPlainPrivatePKCS8PEM:function(q){var p=this.getHexFromPEM(q,"PRIVATE KEY");var r=this.getKeyFromPlainPrivatePKCS8Hex(p);return r},getKeyFromPlainPrivatePKCS8Hex:function(p){var w=this.parsePlainPrivatePKCS8Hex(p);if(w.algoid=="2a864886f70d010101"){this.parsePrivateRawRSAKeyHexAtObj(p,w);var u=w.key;var z=new RSAKey();z.setPrivateEx(u.n,u.e,u.d,u.p,u.q,u.dp,u.dq,u.co);return z}else{if(w.algoid=="2a8648ce3d0201"){this.parsePrivateRawECKeyHexAtObj(p,w);if(KJUR.crypto.OID.oidhex2name[w.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+w.algparam}var v=KJUR.crypto.OID.oidhex2name[w.algparam];var z=new KJUR.crypto.ECDSA({curve:v});z.setPublicKeyHex(w.pubkey);z.setPrivateKeyHex(w.key);z.isPublic=false;return z}else{if(w.algoid=="2a8648ce380401"){var t=ASN1HEX.getVbyList(p,0,[1,1,0],"02");var s=ASN1HEX.getVbyList(p,0,[1,1,1],"02");var y=ASN1HEX.getVbyList(p,0,[1,1,2],"02");var B=ASN1HEX.getVbyList(p,0,[2,0],"02");var r=new BigInteger(t,16);var q=new BigInteger(s,16);var x=new BigInteger(y,16);var A=new BigInteger(B,16);var z=new KJUR.crypto.DSA();z.setPrivate(r,q,x,null,A);return z}else{throw"unsupported private key algorithm"}}}},getRSAKeyFromPublicPKCS8PEM:function(q){var r=this.getHexFromPEM(q,"PUBLIC KEY");var p=this.getRSAKeyFromPublicPKCS8Hex(r);return p},getKeyFromPublicPKCS8PEM:function(q){var r=this.getHexFromPEM(q,"PUBLIC KEY");var p=this.getKeyFromPublicPKCS8Hex(r);return p},getKeyFromPublicPKCS8Hex:function(q){var p=this.parsePublicPKCS8Hex(q);if(p.algoid=="2a864886f70d010101"){var u=this.parsePublicRawRSAKeyHex(p.key);var r=new RSAKey();r.setPublic(u.n,u.e);return r}else{if(p.algoid=="2a8648ce3d0201"){if(KJUR.crypto.OID.oidhex2name[p.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+p.algparam}var s=KJUR.crypto.OID.oidhex2name[p.algparam];var r=new KJUR.crypto.ECDSA({curve:s,pub:p.key});return r}else{if(p.algoid=="2a8648ce380401"){var t=p.algparam;var v=ASN1HEX.getHexOfV_AtObj(p.key,0);var r=new KJUR.crypto.DSA();r.setPublic(new BigInteger(t.p,16),new BigInteger(t.q,16),new BigInteger(t.g,16),new BigInteger(v,16));return r}else{throw"unsupported public key algorithm"}}}},parsePublicRawRSAKeyHex:function(r){var p={};if(r.substr(0,2)!="30"){throw"malformed RSA key(code:001)"}var q=ASN1HEX.getPosArrayOfChildren_AtObj(r,0);if(q.length!=2){throw"malformed RSA key(code:002)"}if(r.substr(q[0],2)!="02"){throw"malformed RSA key(code:003)"}p.n=ASN1HEX.getHexOfV_AtObj(r,q[0]);if(r.substr(q[1],2)!="02"){throw"malformed RSA key(code:004)"}p.e=ASN1HEX.getHexOfV_AtObj(r,q[1]);return p},parsePrivateRawRSAKeyHexAtObj:function(q,s){var r=s.keyidx;if(q.substr(r,2)!="30"){throw"malformed RSA private key(code:001)"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,r);if(p.length!=9){throw"malformed RSA private key(code:002)"}s.key={};s.key.n=ASN1HEX.getHexOfV_AtObj(q,p[1]);s.key.e=ASN1HEX.getHexOfV_AtObj(q,p[2]);s.key.d=ASN1HEX.getHexOfV_AtObj(q,p[3]);s.key.p=ASN1HEX.getHexOfV_AtObj(q,p[4]);s.key.q=ASN1HEX.getHexOfV_AtObj(q,p[5]);s.key.dp=ASN1HEX.getHexOfV_AtObj(q,p[6]);s.key.dq=ASN1HEX.getHexOfV_AtObj(q,p[7]);s.key.co=ASN1HEX.getHexOfV_AtObj(q,p[8])},parsePrivateRawECKeyHexAtObj:function(p,t){var q=t.keyidx;var r=ASN1HEX.getVbyList(p,q,[1],"04");var s=ASN1HEX.getVbyList(p,q,[2,0],"03").substr(2);t.key=r;t.pubkey=s},parsePublicPKCS8Hex:function(s){var q={};q.algparam=null;var r=ASN1HEX.getPosArrayOfChildren_AtObj(s,0);if(r.length!=2){throw"outer DERSequence shall have 2 elements: "+r.length}var t=r[0];if(s.substr(t,2)!="30"){throw"malformed PKCS8 public key(code:001)"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(s,t);if(p.length!=2){throw"malformed PKCS8 public key(code:002)"}if(s.substr(p[0],2)!="06"){throw"malformed PKCS8 public key(code:003)"}q.algoid=ASN1HEX.getHexOfV_AtObj(s,p[0]);if(s.substr(p[1],2)=="06"){q.algparam=ASN1HEX.getHexOfV_AtObj(s,p[1])}else{if(s.substr(p[1],2)=="30"){q.algparam={};q.algparam.p=ASN1HEX.getVbyList(s,p[1],[0],"02");q.algparam.q=ASN1HEX.getVbyList(s,p[1],[1],"02");q.algparam.g=ASN1HEX.getVbyList(s,p[1],[2],"02")}}if(s.substr(r[1],2)!="03"){throw"malformed PKCS8 public key(code:004)"}q.key=ASN1HEX.getHexOfV_AtObj(s,r[1]).substr(2);return q},getRSAKeyFromPublicPKCS8Hex:function(t){var s=ASN1HEX.getPosArrayOfChildren_AtObj(t,0);if(s.length!=2){throw"outer DERSequence shall have 2 elements: "+s.length}var r=ASN1HEX.getHexOfTLV_AtObj(t,s[0]);if(r!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmId is not rsaEncryption"}if(t.substr(s[1],2)!="03"){throw"PKCS8 Public Key is not BITSTRING encapslated."}var v=ASN1HEX.getStartPosOfV_AtObj(t,s[1])+2;if(t.substr(v,2)!="30"){throw"PKCS8 Public Key is not SEQUENCE."}var p=ASN1HEX.getPosArrayOfChildren_AtObj(t,v);if(p.length!=2){throw"inner DERSequence shall have 2 elements: "+p.length}if(t.substr(p[0],2)!="02"){throw"N is not ASN.1 INTEGER"}if(t.substr(p[1],2)!="02"){throw"E is not ASN.1 INTEGER"}var w=ASN1HEX.getHexOfV_AtObj(t,p[0]);var u=ASN1HEX.getHexOfV_AtObj(t,p[1]);var q=new RSAKey();q.setPublic(w,u);return q},}}();KEYUTIL.getKey=function(f,e,h){if(typeof RSAKey!="undefined"&&f instanceof RSAKey){return f}if(typeof KJUR.crypto.ECDSA!="undefined"&&f instanceof KJUR.crypto.ECDSA){return f}if(typeof KJUR.crypto.DSA!="undefined"&&f instanceof KJUR.crypto.DSA){return f}if(f.curve!==undefined&&f.xy!==undefined&&f.d===undefined){return new KJUR.crypto.ECDSA({pub:f.xy,curve:f.curve})}if(f.curve!==undefined&&f.d!==undefined){return new KJUR.crypto.ECDSA({prv:f.d,curve:f.curve})}if(f.kty===undefined&&f.n!==undefined&&f.e!==undefined&&f.d===undefined){var w=new RSAKey();w.setPublic(f.n,f.e);return w}if(f.kty===undefined&&f.n!==undefined&&f.e!==undefined&&f.d!==undefined&&f.p!==undefined&&f.q!==undefined&&f.dp!==undefined&&f.dq!==undefined&&f.co!==undefined&&f.qi===undefined){var w=new RSAKey();w.setPrivateEx(f.n,f.e,f.d,f.p,f.q,f.dp,f.dq,f.co);return w}if(f.kty===undefined&&f.n!==undefined&&f.e!==undefined&&f.d!==undefined&&f.p===undefined){var w=new RSAKey();w.setPrivate(f.n,f.e,f.d);return w}if(f.p!==undefined&&f.q!==undefined&&f.g!==undefined&&f.y!==undefined&&f.x===undefined){var w=new KJUR.crypto.DSA();w.setPublic(f.p,f.q,f.g,f.y);return w}if(f.p!==undefined&&f.q!==undefined&&f.g!==undefined&&f.y!==undefined&&f.x!==undefined){var w=new KJUR.crypto.DSA();w.setPrivate(f.p,f.q,f.g,f.y,f.x);return w}if(f.kty==="RSA"&&f.n!==undefined&&f.e!==undefined&&f.d===undefined){var w=new RSAKey();w.setPublic(b64utohex(f.n),b64utohex(f.e));return w}if(f.kty==="RSA"&&f.n!==undefined&&f.e!==undefined&&f.d!==undefined&&f.p!==undefined&&f.q!==undefined&&f.dp!==undefined&&f.dq!==undefined&&f.qi!==undefined){var w=new RSAKey();w.setPrivateEx(b64utohex(f.n),b64utohex(f.e),b64utohex(f.d),b64utohex(f.p),b64utohex(f.q),b64utohex(f.dp),b64utohex(f.dq),b64utohex(f.qi));return w}if(f.kty==="RSA"&&f.n!==undefined&&f.e!==undefined&&f.d!==undefined){var w=new RSAKey();w.setPrivate(b64utohex(f.n),b64utohex(f.e),b64utohex(f.d));return w}if(f.kty==="EC"&&f.crv!==undefined&&f.x!==undefined&&f.y!==undefined&&f.d===undefined){var d=new KJUR.crypto.ECDSA({curve:f.crv});var l=d.ecparams.keylen/4;var r=("0000000000"+b64utohex(f.x)).slice(-l);var n=("0000000000"+b64utohex(f.y)).slice(-l);var m="04"+r+n;d.setPublicKeyHex(m);return d}if(f.kty==="EC"&&f.crv!==undefined&&f.x!==undefined&&f.y!==undefined&&f.d!==undefined){var d=new KJUR.crypto.ECDSA({curve:f.crv});var l=d.ecparams.keylen/4;var a=("0000000000"+b64utohex(f.d)).slice(-l);d.setPrivateKeyHex(a);return d}if(f.indexOf("-END CERTIFICATE-",0)!=-1||f.indexOf("-END X509 CERTIFICATE-",0)!=-1||f.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1){return X509.getPublicKeyFromCertPEM(f)}if(h==="pkcs8pub"){return KEYUTIL.getKeyFromPublicPKCS8Hex(f)}if(f.indexOf("-END PUBLIC KEY-")!=-1){return KEYUTIL.getKeyFromPublicPKCS8PEM(f)}if(h==="pkcs5prv"){var w=new RSAKey();w.readPrivateKeyFromASN1HexString(f);return w}if(h==="pkcs5prv"){var w=new RSAKey();w.readPrivateKeyFromASN1HexString(f);return w}if(f.indexOf("-END RSA PRIVATE KEY-")!=-1&&f.indexOf("4,ENCRYPTED")==-1){var i=KEYUTIL.getHexFromPEM(f,"RSA PRIVATE KEY");return KEYUTIL.getKey(i,null,"pkcs5prv")}if(f.indexOf("-END DSA PRIVATE KEY-")!=-1&&f.indexOf("4,ENCRYPTED")==-1){var u=this.getHexFromPEM(f,"DSA PRIVATE KEY");var t=ASN1HEX.getVbyList(u,0,[1],"02");var s=ASN1HEX.getVbyList(u,0,[2],"02");var v=ASN1HEX.getVbyList(u,0,[3],"02");var j=ASN1HEX.getVbyList(u,0,[4],"02");var k=ASN1HEX.getVbyList(u,0,[5],"02");var w=new KJUR.crypto.DSA();w.setPrivate(new BigInteger(t,16),new BigInteger(s,16),new BigInteger(v,16),new BigInteger(j,16),new BigInteger(k,16));return w}if(f.indexOf("-END PRIVATE KEY-")!=-1){return KEYUTIL.getKeyFromPlainPrivatePKCS8PEM(f)}if(f.indexOf("-END RSA PRIVATE KEY-")!=-1&&f.indexOf("4,ENCRYPTED")!=-1){return KEYUTIL.getRSAKeyFromEncryptedPKCS5PEM(f,e)}if(f.indexOf("-END EC PRIVATE KEY-")!=-1&&f.indexOf("4,ENCRYPTED")!=-1){var u=KEYUTIL.getDecryptedKeyHex(f,e);var w=ASN1HEX.getVbyList(u,0,[1],"04");var c=ASN1HEX.getVbyList(u,0,[2,0],"06");var o=ASN1HEX.getVbyList(u,0,[3,0],"03").substr(2);var b="";if(KJUR.crypto.OID.oidhex2name[c]!==undefined){b=KJUR.crypto.OID.oidhex2name[c]}else{throw"undefined OID(hex) in KJUR.crypto.OID: "+c}var d=new KJUR.crypto.ECDSA({name:b});d.setPublicKeyHex(o);d.setPrivateKeyHex(w);d.isPublic=false;return d}if(f.indexOf("-END DSA PRIVATE KEY-")!=-1&&f.indexOf("4,ENCRYPTED")!=-1){var u=KEYUTIL.getDecryptedKeyHex(f,e);var t=ASN1HEX.getVbyList(u,0,[1],"02");var s=ASN1HEX.getVbyList(u,0,[2],"02");var v=ASN1HEX.getVbyList(u,0,[3],"02");var j=ASN1HEX.getVbyList(u,0,[4],"02");var k=ASN1HEX.getVbyList(u,0,[5],"02");var w=new KJUR.crypto.DSA();w.setPrivate(new BigInteger(t,16),new BigInteger(s,16),new BigInteger(v,16),new BigInteger(j,16),new BigInteger(k,16));return w}if(f.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1){return KEYUTIL.getKeyFromEncryptedPKCS8PEM(f,e)}throw"not supported argument"};KEYUTIL.generateKeypair=function(a,c){if(a=="RSA"){var b=c;var h=new RSAKey();h.generate(b,"10001");h.isPrivate=true;h.isPublic=true;var f=new RSAKey();var e=h.n.toString(16);var i=h.e.toString(16);f.setPublic(e,i);f.isPrivate=false;f.isPublic=true;var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{if(a=="EC"){var d=c;var g=new KJUR.crypto.ECDSA({curve:d});var j=g.generateKeyPairHex();var h=new KJUR.crypto.ECDSA({curve:d});h.setPrivateKeyHex(j.ecprvhex);h.isPrivate=true;h.isPublic=false;var f=new KJUR.crypto.ECDSA({curve:d});f.setPublicKeyHex(j.ecpubhex);f.isPrivate=false;f.isPublic=true;var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{throw"unknown algorithm: "+a}}};KEYUTIL.getPEM=function(a,r,o,g,j){var v=KJUR.asn1;var u=KJUR.crypto;function p(s){var w=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{"int":{bigint:s.n}},{"int":s.e},{"int":{bigint:s.d}},{"int":{bigint:s.p}},{"int":{bigint:s.q}},{"int":{bigint:s.dmp1}},{"int":{bigint:s.dmq1}},{"int":{bigint:s.coeff}}]});return w}function q(w){var s=KJUR.asn1.ASN1Util.newObject({seq:[{"int":1},{octstr:{hex:w.prvKeyHex}},{tag:["a0",true,{oid:{name:w.curveName}}]},{tag:["a1",true,{bitstr:{hex:"00"+w.pubKeyHex}}]}]});return s}function n(s){var w=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{"int":{bigint:s.p}},{"int":{bigint:s.q}},{"int":{bigint:s.g}},{"int":{bigint:s.y}},{"int":{bigint:s.x}}]});return w}if(((typeof RSAKey!="undefined"&&a instanceof RSAKey)||(typeof u.DSA!="undefined"&&a instanceof u.DSA)||(typeof u.ECDSA!="undefined"&&a instanceof u.ECDSA))&&a.isPublic==true&&(r===undefined||r=="PKCS8PUB")){var t=new KJUR.asn1.x509.SubjectPublicKeyInfo(a);var m=t.getEncodedHex();return v.ASN1Util.getPEMStringFromHex(m,"PUBLIC KEY")}if(r=="PKCS1PRV"&&typeof RSAKey!="undefined"&&a instanceof RSAKey&&(o===undefined||o==null)&&a.isPrivate==true){var t=p(a);var m=t.getEncodedHex();return v.ASN1Util.getPEMStringFromHex(m,"RSA PRIVATE KEY")}if(r=="PKCS1PRV"&&typeof RSAKey!="undefined"&&a instanceof KJUR.crypto.ECDSA&&(o===undefined||o==null)&&a.isPrivate==true){var f=new KJUR.asn1.DERObjectIdentifier({name:a.curveName});var l=f.getEncodedHex();var e=q(a);var k=e.getEncodedHex();var i="";i+=v.ASN1Util.getPEMStringFromHex(l,"EC PARAMETERS");i+=v.ASN1Util.getPEMStringFromHex(k,"EC PRIVATE KEY");return i}if(r=="PKCS1PRV"&&typeof KJUR.crypto.DSA!="undefined"&&a instanceof KJUR.crypto.DSA&&(o===undefined||o==null)&&a.isPrivate==true){var t=n(a);var m=t.getEncodedHex();return v.ASN1Util.getPEMStringFromHex(m,"DSA PRIVATE KEY")}if(r=="PKCS5PRV"&&typeof RSAKey!="undefined"&&a instanceof RSAKey&&(o!==undefined&&o!=null)&&a.isPrivate==true){var t=p(a);var m=t.getEncodedHex();if(g===undefined){g="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",m,o,g)}if(r=="PKCS5PRV"&&typeof KJUR.crypto.ECDSA!="undefined"&&a instanceof KJUR.crypto.ECDSA&&(o!==undefined&&o!=null)&&a.isPrivate==true){var t=q(a);var m=t.getEncodedHex();if(g===undefined){g="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",m,o,g)}if(r=="PKCS5PRV"&&typeof KJUR.crypto.DSA!="undefined"&&a instanceof KJUR.crypto.DSA&&(o!==undefined&&o!=null)&&a.isPrivate==true){var t=n(a);var m=t.getEncodedHex();if(g===undefined){g="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",m,o,g)}var h=function(w,s){var y=b(w,s);var x=new KJUR.asn1.ASN1Util.newObject({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:y.pbkdf2Salt}},{"int":y.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:y.encryptionSchemeIV}}]}]}]},{octstr:{hex:y.ciphertext}}]});return x.getEncodedHex()};var b=function(D,E){var x=100;var C=CryptoJS.lib.WordArray.random(8);var B="DES-EDE3-CBC";var s=CryptoJS.lib.WordArray.random(8);var y=CryptoJS.PBKDF2(E,C,{keySize:192/32,iterations:x});var z=CryptoJS.enc.Hex.parse(D);var A=CryptoJS.TripleDES.encrypt(z,y,{iv:s})+"";var w={};w.ciphertext=A;w.pbkdf2Salt=CryptoJS.enc.Hex.stringify(C);w.pbkdf2Iter=x;w.encryptionSchemeAlg=B;w.encryptionSchemeIV=CryptoJS.enc.Hex.stringify(s);return w};if(r=="PKCS8PRV"&&typeof RSAKey!="undefined"&&a instanceof RSAKey&&a.isPrivate==true){var d=p(a);var c=d.getEncodedHex();var t=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{seq:[{oid:{name:"rsaEncryption"}},{"null":true}]},{octstr:{hex:c}}]});var m=t.getEncodedHex();if(o===undefined||o==null){return v.ASN1Util.getPEMStringFromHex(m,"PRIVATE KEY")}else{var k=h(m,o);return v.ASN1Util.getPEMStringFromHex(k,"ENCRYPTED PRIVATE KEY")}}if(r=="PKCS8PRV"&&typeof KJUR.crypto.ECDSA!="undefined"&&a instanceof KJUR.crypto.ECDSA&&a.isPrivate==true){var d=new KJUR.asn1.ASN1Util.newObject({seq:[{"int":1},{octstr:{hex:a.prvKeyHex}},{tag:["a1",true,{bitstr:{hex:"00"+a.pubKeyHex}}]}]});var c=d.getEncodedHex();var t=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:a.curveName}}]},{octstr:{hex:c}}]});var m=t.getEncodedHex();if(o===undefined||o==null){return v.ASN1Util.getPEMStringFromHex(m,"PRIVATE KEY")}else{var k=h(m,o);return v.ASN1Util.getPEMStringFromHex(k,"ENCRYPTED PRIVATE KEY")}}if(r=="PKCS8PRV"&&typeof KJUR.crypto.DSA!="undefined"&&a instanceof KJUR.crypto.DSA&&a.isPrivate==true){var d=new KJUR.asn1.DERInteger({bigint:a.x});var c=d.getEncodedHex();var t=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{seq:[{oid:{name:"dsa"}},{seq:[{"int":{bigint:a.p}},{"int":{bigint:a.q}},{"int":{bigint:a.g}}]}]},{octstr:{hex:c}}]});var m=t.getEncodedHex();if(o===undefined||o==null){return v.ASN1Util.getPEMStringFromHex(m,"PRIVATE KEY")}else{var k=h(m,o);return v.ASN1Util.getPEMStringFromHex(k,"ENCRYPTED PRIVATE KEY")}}throw"unsupported object nor format"};KEYUTIL.getKeyFromCSRPEM=function(b){var a=KEYUTIL.getHexFromPEM(b,"CERTIFICATE REQUEST");var c=KEYUTIL.getKeyFromCSRHex(a);return c};KEYUTIL.getKeyFromCSRHex=function(a){var c=KEYUTIL.parseCSRHex(a);var b=KEYUTIL.getKey(c.p8pubkeyhex,null,"pkcs8pub");return b};KEYUTIL.parseCSRHex=function(c){var b={};var e=c;if(e.substr(0,2)!="30"){throw"malformed CSR(code:001)"}var d=ASN1HEX.getPosArrayOfChildren_AtObj(e,0);if(d.length<1){throw"malformed CSR(code:002)"}if(e.substr(d[0],2)!="30"){throw"malformed CSR(code:003)"}var a=ASN1HEX.getPosArrayOfChildren_AtObj(e,d[0]);if(a.length<3){throw"malformed CSR(code:004)"}b.p8pubkeyhex=ASN1HEX.getHexOfTLV_AtObj(e,a[2]);return b};
\ No newline at end of file
diff --git a/jwt/min/nodeutil-1.0.min.js b/jwt/min/nodeutil-1.0.min.js
deleted file mode 100644
index 6ab8730..0000000
--- a/jwt/min/nodeutil-1.0.min.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/*! nodeutil-1.0.0 (c) 2015 Kenji Urushima | kjur.github.com/jsrsasign/license
- */
-function readFileUTF8(a){return require("fs").readFileSync(a,"utf8")}function readFileHexByBin(c){var b=require("jsrsasign");var a=require("fs");return b.rstrtohex(a.readFileSync(c,"binary"))}function readFile(b){var a=require("fs");return a.readFileSync(b,"binary")}function saveFile(c,b){var a=require("fs");a.writeFileSync(c,b,"binary")}function saveFileBinByHex(e,b){var a=require("fs");var c=require("jsrsasign");var d=c.hextorstr(b);a.writeFileSync(e,d,"binary")};
\ No newline at end of file
diff --git a/jwt/min/pkcs5pkey-1.0.min.js b/jwt/min/pkcs5pkey-1.0.min.js
deleted file mode 100644
index 6f3235b..0000000
--- a/jwt/min/pkcs5pkey-1.0.min.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/*! pkcs5pkey-1.0.6.js (c) 2013-2014 Kenji Urushima | kjur.github.com/jsrsasign/license
- */
-var PKCS5PKEY=function(){var c=function(n,p,o){return i(CryptoJS.AES,n,p,o)};var d=function(n,p,o){return i(CryptoJS.TripleDES,n,p,o)};var i=function(q,v,s,o){var p=CryptoJS.enc.Hex.parse(v);var u=CryptoJS.enc.Hex.parse(s);var n=CryptoJS.enc.Hex.parse(o);var r={};r.key=u;r.iv=n;r.ciphertext=p;var t=q.decrypt(r,u,{iv:n});return CryptoJS.enc.Hex.stringify(t)};var j=function(n,p,o){return e(CryptoJS.AES,n,p,o)};var m=function(n,p,o){return e(CryptoJS.TripleDES,n,p,o)};var e=function(s,x,v,p){var r=CryptoJS.enc.Hex.parse(x);var w=CryptoJS.enc.Hex.parse(v);var o=CryptoJS.enc.Hex.parse(p);var n={};var u=s.encrypt(r,w,{iv:o});var q=CryptoJS.enc.Hex.parse(u.toString());var t=CryptoJS.enc.Base64.stringify(q);return t};var g={"AES-256-CBC":{proc:c,eproc:j,keylen:32,ivlen:16},"AES-192-CBC":{proc:c,eproc:j,keylen:24,ivlen:16},"AES-128-CBC":{proc:c,eproc:j,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:d,eproc:m,keylen:24,ivlen:8}};var b=function(n){return g[n]["proc"]};var k=function(n){var p=CryptoJS.lib.WordArray.random(n);var o=CryptoJS.enc.Hex.stringify(p);return o};var l=function(q){var r={};if(q.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"))){r.cipher=RegExp.$1;r.ivsalt=RegExp.$2}if(q.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"))){r.type=RegExp.$1}var p=-1;var t=0;if(q.indexOf("\r\n\r\n")!=-1){p=q.indexOf("\r\n\r\n");t=2}if(q.indexOf("\n\n")!=-1){p=q.indexOf("\n\n");t=1}var o=q.indexOf("-----END");if(p!=-1&&o!=-1){var n=q.substring(p+t*2,o-t);n=n.replace(/\s+/g,"");r.data=n}return r};var h=function(o,w,n){var t=n.substring(0,16);var r=CryptoJS.enc.Hex.parse(t);var p=CryptoJS.enc.Utf8.parse(w);var s=g[o]["keylen"]+g[o]["ivlen"];var v="";var u=null;for(;;){var q=CryptoJS.algo.MD5.create();if(u!=null){q.update(u)}q.update(p);q.update(r);u=q.finalize();v=v+CryptoJS.enc.Hex.stringify(u);if(v.length>=s*2){break}}var x={};x.keyhex=v.substr(0,g[o]["keylen"]*2);x.ivhex=v.substr(g[o]["keylen"]*2,g[o]["ivlen"]*2);return x};var a=function(n,t,p,u){var q=CryptoJS.enc.Base64.parse(n);var o=CryptoJS.enc.Hex.stringify(q);var s=g[t]["proc"];var r=s(o,p,u);return r};var f=function(n,q,o,s){var p=g[q]["eproc"];var r=p(n,o,s);return r};return{version:"1.0.5",getHexFromPEM:function(o,r){var p=o;if(p.indexOf("BEGIN "+r)==-1){throw"can't find PEM header: "+r}p=p.replace("-----BEGIN "+r+"-----","");p=p.replace("-----END "+r+"-----","");var q=p.replace(/\s+/g,"");var n=b64tohex(q);return n},getDecryptedKeyHexByKeyIV:function(o,r,q,p){var n=b(r);return n(o,q,p)},parsePKCS5PEM:function(n){return l(n)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(o,n,p){return h(o,n,p)},decryptKeyB64:function(n,p,o,q){return a(n,p,o,q)},getDecryptedKeyHex:function(w,v){var o=l(w);var r=o.type;var p=o.cipher;var n=o.ivsalt;var q=o.data;var u=h(p,v,n);var t=u.keyhex;var s=a(q,p,t,n);return s},getRSAKeyFromEncryptedPKCS5PEM:function(p,o){var q=this.getDecryptedKeyHex(p,o);var n=new RSAKey();n.readPrivateKeyFromASN1HexString(q);return n},getEryptedPKCS5PEMFromPrvKeyHex:function(q,x,r,p){var n="";if(typeof r=="undefined"||r==null){r="AES-256-CBC"}if(typeof g[r]=="undefined"){throw"PKCS5PKEY unsupported algorithm: "+r}if(typeof p=="undefined"||p==null){var t=g[r]["ivlen"];var s=k(t);p=s.toUpperCase()}var w=h(r,x,p);var v=w.keyhex;var u=f(q,r,v,p);var o=u.replace(/(.{64})/g,"$1\r\n");var n="-----BEGIN RSA PRIVATE KEY-----\r\n";n+="Proc-Type: 4,ENCRYPTED\r\n";n+="DEK-Info: "+r+","+p+"\r\n";n+="\r\n";n+=o;n+="\r\n-----END RSA PRIVATE KEY-----\r\n";return n},getEryptedPKCS5PEMFromRSAKey:function(C,D,o,s){var A=new KJUR.asn1.DERInteger({"int":0});var v=new KJUR.asn1.DERInteger({bigint:C.n});var z=new KJUR.asn1.DERInteger({"int":C.e});var B=new KJUR.asn1.DERInteger({bigint:C.d});var t=new KJUR.asn1.DERInteger({bigint:C.p});var r=new KJUR.asn1.DERInteger({bigint:C.q});var y=new KJUR.asn1.DERInteger({bigint:C.dmp1});var u=new KJUR.asn1.DERInteger({bigint:C.dmq1});var x=new KJUR.asn1.DERInteger({bigint:C.coeff});var E=new KJUR.asn1.DERSequence({array:[A,v,z,B,t,r,y,u,x]});var w=E.getEncodedHex();return this.getEryptedPKCS5PEMFromPrvKeyHex(w,D,o,s)},newEncryptedPKCS5PEM:function(n,o,r,s){if(typeof o=="undefined"||o==null){o=1024}if(typeof r=="undefined"||r==null){r="10001"}var p=new RSAKey();p.generate(o,r);var q=null;if(typeof s=="undefined"||s==null){q=this.getEncryptedPKCS5PEMFromRSAKey(pkey,n)}else{q=this.getEncryptedPKCS5PEMFromRSAKey(pkey,n,s)}return q},getRSAKeyFromPlainPKCS8PEM:function(p){if(p.match(/ENCRYPTED/)){throw"pem shall be not ENCRYPTED"}var o=this.getHexFromPEM(p,"PRIVATE KEY");var n=this.getRSAKeyFromPlainPKCS8Hex(o);return n},getRSAKeyFromPlainPKCS8Hex:function(q){var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,0);if(p.length!=3){throw"outer DERSequence shall have 3 elements: "+p.length}var o=ASN1HEX.getHexOfTLV_AtObj(q,p[1]);if(o!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmIdentifier is not rsaEnc: "+o}var o=ASN1HEX.getHexOfTLV_AtObj(q,p[1]);var r=ASN1HEX.getHexOfTLV_AtObj(q,p[2]);var s=ASN1HEX.getHexOfV_AtObj(r,0);var n=new RSAKey();n.readPrivateKeyFromASN1HexString(s);return n},parseHexOfEncryptedPKCS8:function(u){var q={};var p=ASN1HEX.getPosArrayOfChildren_AtObj(u,0);if(p.length!=2){throw"malformed format: SEQUENCE(0).items != 2: "+p.length}q.ciphertext=ASN1HEX.getHexOfV_AtObj(u,p[1]);var w=ASN1HEX.getPosArrayOfChildren_AtObj(u,p[0]);if(w.length!=2){throw"malformed format: SEQUENCE(0.0).items != 2: "+w.length}if(ASN1HEX.getHexOfV_AtObj(u,w[0])!="2a864886f70d01050d"){throw"this only supports pkcs5PBES2"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(u,w[1]);if(w.length!=2){throw"malformed format: SEQUENCE(0.0.1).items != 2: "+n.length}var o=ASN1HEX.getPosArrayOfChildren_AtObj(u,n[1]);if(o.length!=2){throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+o.length}if(ASN1HEX.getHexOfV_AtObj(u,o[0])!="2a864886f70d0307"){throw"this only supports TripleDES"}q.encryptionSchemeAlg="TripleDES";q.encryptionSchemeIV=ASN1HEX.getHexOfV_AtObj(u,o[1]);var r=ASN1HEX.getPosArrayOfChildren_AtObj(u,n[0]);if(r.length!=2){throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+r.length}if(ASN1HEX.getHexOfV_AtObj(u,r[0])!="2a864886f70d01050c"){throw"this only supports pkcs5PBKDF2"}var v=ASN1HEX.getPosArrayOfChildren_AtObj(u,r[1]);if(v.length<2){throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+v.length}q.pbkdf2Salt=ASN1HEX.getHexOfV_AtObj(u,v[0]);var s=ASN1HEX.getHexOfV_AtObj(u,v[1]);try{q.pbkdf2Iter=parseInt(s,16)}catch(t){throw"malformed format pbkdf2Iter: "+s}return q},getPBKDF2KeyHexFromParam:function(s,n){var r=CryptoJS.enc.Hex.parse(s.pbkdf2Salt);var o=s.pbkdf2Iter;var q=CryptoJS.PBKDF2(n,r,{keySize:192/32,iterations:o});var p=CryptoJS.enc.Hex.stringify(q);return p},getPlainPKCS8HexFromEncryptedPKCS8PEM:function(v,w){var p=this.getHexFromPEM(v,"ENCRYPTED PRIVATE KEY");var n=this.parseHexOfEncryptedPKCS8(p);var s=PKCS5PKEY.getPBKDF2KeyHexFromParam(n,w);var t={};t.ciphertext=CryptoJS.enc.Hex.parse(n.ciphertext);var r=CryptoJS.enc.Hex.parse(s);var q=CryptoJS.enc.Hex.parse(n.encryptionSchemeIV);var u=CryptoJS.TripleDES.decrypt(t,r,{iv:q});var o=CryptoJS.enc.Hex.stringify(u);return o},getRSAKeyFromEncryptedPKCS8PEM:function(q,p){var o=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(q,p);var n=this.getRSAKeyFromPlainPKCS8Hex(o);return n},getKeyFromEncryptedPKCS8PEM:function(q,o){var n=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(q,o);var p=this.getKeyFromPlainPrivatePKCS8Hex(n);return p},parsePlainPrivatePKCS8Hex:function(q){var o={};o.algparam=null;if(q.substr(0,2)!="30"){throw"malformed plain PKCS8 private key(code:001)"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,0);if(p.length!=3){throw"malformed plain PKCS8 private key(code:002)"}if(q.substr(p[1],2)!="30"){throw"malformed PKCS8 private key(code:003)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(q,p[1]);if(n.length!=2){throw"malformed PKCS8 private key(code:004)"}if(q.substr(n[0],2)!="06"){throw"malformed PKCS8 private key(code:005)"}o.algoid=ASN1HEX.getHexOfV_AtObj(q,n[0]);if(q.substr(n[1],2)=="06"){o.algparam=ASN1HEX.getHexOfV_AtObj(q,n[1])}if(q.substr(p[2],2)!="04"){throw"malformed PKCS8 private key(code:006)"}o.keyidx=ASN1HEX.getStartPosOfV_AtObj(q,p[2]);return o},getKeyFromPlainPrivatePKCS8PEM:function(o){var n=this.getHexFromPEM(o,"PRIVATE KEY");var p=this.getKeyFromPlainPrivatePKCS8Hex(n);return p},getKeyFromPlainPrivatePKCS8Hex:function(n){var p=this.parsePlainPrivatePKCS8Hex(n);if(p.algoid=="2a864886f70d010101"){this.parsePrivateRawRSAKeyHexAtObj(n,p);var o=p.key;var q=new RSAKey();q.setPrivateEx(o.n,o.e,o.d,o.p,o.q,o.dp,o.dq,o.co);return q}else{if(p.algoid=="2a8648ce3d0201"){this.parsePrivateRawECKeyHexAtObj(n,p);if(KJUR.crypto.OID.oidhex2name[p.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+p.algparam}var r=KJUR.crypto.OID.oidhex2name[p.algparam];var q=new KJUR.crypto.ECDSA({curve:r,prv:p.key});return q}else{throw"unsupported private key algorithm"}}},getRSAKeyFromPublicPKCS8PEM:function(o){var p=this.getHexFromPEM(o,"PUBLIC KEY");var n=this.getRSAKeyFromPublicPKCS8Hex(p);return n},getKeyFromPublicPKCS8PEM:function(o){var p=this.getHexFromPEM(o,"PUBLIC KEY");var n=this.getKeyFromPublicPKCS8Hex(p);return n},getKeyFromPublicPKCS8Hex:function(o){var n=this.parsePublicPKCS8Hex(o);if(n.algoid=="2a864886f70d010101"){var r=this.parsePublicRawRSAKeyHex(n.key);var p=new RSAKey();p.setPublic(r.n,r.e);return p}else{if(n.algoid=="2a8648ce3d0201"){if(KJUR.crypto.OID.oidhex2name[n.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+n.algparam}var q=KJUR.crypto.OID.oidhex2name[n.algparam];var p=new KJUR.crypto.ECDSA({curve:q,pub:n.key});return p}else{throw"unsupported public key algorithm"}}},parsePublicRawRSAKeyHex:function(p){var n={};if(p.substr(0,2)!="30"){throw"malformed RSA key(code:001)"}var o=ASN1HEX.getPosArrayOfChildren_AtObj(p,0);if(o.length!=2){throw"malformed RSA key(code:002)"}if(p.substr(o[0],2)!="02"){throw"malformed RSA key(code:003)"}n.n=ASN1HEX.getHexOfV_AtObj(p,o[0]);if(p.substr(o[1],2)!="02"){throw"malformed RSA key(code:004)"}n.e=ASN1HEX.getHexOfV_AtObj(p,o[1]);return n},parsePrivateRawRSAKeyHexAtObj:function(o,q){var p=q.keyidx;if(o.substr(p,2)!="30"){throw"malformed RSA private key(code:001)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(o,p);if(n.length!=9){throw"malformed RSA private key(code:002)"}q.key={};q.key.n=ASN1HEX.getHexOfV_AtObj(o,n[1]);q.key.e=ASN1HEX.getHexOfV_AtObj(o,n[2]);q.key.d=ASN1HEX.getHexOfV_AtObj(o,n[3]);q.key.p=ASN1HEX.getHexOfV_AtObj(o,n[4]);q.key.q=ASN1HEX.getHexOfV_AtObj(o,n[5]);q.key.dp=ASN1HEX.getHexOfV_AtObj(o,n[6]);q.key.dq=ASN1HEX.getHexOfV_AtObj(o,n[7]);q.key.co=ASN1HEX.getHexOfV_AtObj(o,n[8])},parsePrivateRawECKeyHexAtObj:function(o,q){var p=q.keyidx;if(o.substr(p,2)!="30"){throw"malformed ECC private key(code:001)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(o,p);if(n.length!=3){throw"malformed ECC private key(code:002)"}if(o.substr(n[1],2)!="04"){throw"malformed ECC private key(code:003)"}q.key=ASN1HEX.getHexOfV_AtObj(o,n[1])},parsePublicPKCS8Hex:function(q){var o={};o.algparam=null;var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,0);if(p.length!=2){throw"outer DERSequence shall have 2 elements: "+p.length}var r=p[0];if(q.substr(r,2)!="30"){throw"malformed PKCS8 public key(code:001)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(q,r);if(n.length!=2){throw"malformed PKCS8 public key(code:002)"}if(q.substr(n[0],2)!="06"){throw"malformed PKCS8 public key(code:003)"}o.algoid=ASN1HEX.getHexOfV_AtObj(q,n[0]);if(q.substr(n[1],2)=="06"){o.algparam=ASN1HEX.getHexOfV_AtObj(q,n[1])}if(q.substr(p[1],2)!="03"){throw"malformed PKCS8 public key(code:004)"}o.key=ASN1HEX.getHexOfV_AtObj(q,p[1]).substr(2);return o},getRSAKeyFromPublicPKCS8Hex:function(r){var q=ASN1HEX.getPosArrayOfChildren_AtObj(r,0);if(q.length!=2){throw"outer DERSequence shall have 2 elements: "+q.length}var p=ASN1HEX.getHexOfTLV_AtObj(r,q[0]);if(p!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmId is not rsaEncryption"}if(r.substr(q[1],2)!="03"){throw"PKCS8 Public Key is not BITSTRING encapslated."}var t=ASN1HEX.getStartPosOfV_AtObj(r,q[1])+2;if(r.substr(t,2)!="30"){throw"PKCS8 Public Key is not SEQUENCE."}var n=ASN1HEX.getPosArrayOfChildren_AtObj(r,t);if(n.length!=2){throw"inner DERSequence shall have 2 elements: "+n.length}if(r.substr(n[0],2)!="02"){throw"N is not ASN.1 INTEGER"}if(r.substr(n[1],2)!="02"){throw"E is not ASN.1 INTEGER"}var u=ASN1HEX.getHexOfV_AtObj(r,n[0]);var s=ASN1HEX.getHexOfV_AtObj(r,n[1]);var o=new RSAKey();o.setPublic(u,s);return o},}}();
\ No newline at end of file
diff --git a/jwt/min/rsapem-1.1.min.js b/jwt/min/rsapem-1.1.min.js
deleted file mode 100644
index 7eb760d..0000000
--- a/jwt/min/rsapem-1.1.min.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/*! rsapem-1.1.js (c) 2012 Kenji Urushima | kjur.github.com/jsrsasign/license
- */
-function _rsapem_pemToBase64(b){var a=b;a=a.replace("-----BEGIN RSA PRIVATE KEY-----","");a=a.replace("-----END RSA PRIVATE KEY-----","");a=a.replace(/[ \n]+/g,"");return a}function _rsapem_getPosArrayOfChildrenFromHex(d){var j=new Array();var k=ASN1HEX.getStartPosOfV_AtObj(d,0);var f=ASN1HEX.getPosOfNextSibling_AtObj(d,k);var h=ASN1HEX.getPosOfNextSibling_AtObj(d,f);var b=ASN1HEX.getPosOfNextSibling_AtObj(d,h);var l=ASN1HEX.getPosOfNextSibling_AtObj(d,b);var e=ASN1HEX.getPosOfNextSibling_AtObj(d,l);var g=ASN1HEX.getPosOfNextSibling_AtObj(d,e);var c=ASN1HEX.getPosOfNextSibling_AtObj(d,g);var i=ASN1HEX.getPosOfNextSibling_AtObj(d,c);j.push(k,f,h,b,l,e,g,c,i);return j}function _rsapem_getHexValueArrayOfChildrenFromHex(i){var o=_rsapem_getPosArrayOfChildrenFromHex(i);var r=ASN1HEX.getHexOfV_AtObj(i,o[0]);var f=ASN1HEX.getHexOfV_AtObj(i,o[1]);var j=ASN1HEX.getHexOfV_AtObj(i,o[2]);var k=ASN1HEX.getHexOfV_AtObj(i,o[3]);var c=ASN1HEX.getHexOfV_AtObj(i,o[4]);var b=ASN1HEX.getHexOfV_AtObj(i,o[5]);var h=ASN1HEX.getHexOfV_AtObj(i,o[6]);var g=ASN1HEX.getHexOfV_AtObj(i,o[7]);var l=ASN1HEX.getHexOfV_AtObj(i,o[8]);var m=new Array();m.push(r,f,j,k,c,b,h,g,l);return m}function _rsapem_readPrivateKeyFromASN1HexString(c){var b=_rsapem_getHexValueArrayOfChildrenFromHex(c);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])}function _rsapem_readPrivateKeyFromPEMString(e){var c=_rsapem_pemToBase64(e);var d=b64tohex(c);var b=_rsapem_getHexValueArrayOfChildrenFromHex(d);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])}RSAKey.prototype.readPrivateKeyFromPEMString=_rsapem_readPrivateKeyFromPEMString;RSAKey.prototype.readPrivateKeyFromASN1HexString=_rsapem_readPrivateKeyFromASN1HexString;
\ No newline at end of file
diff --git a/jwt/min/rsasign-1.2.min.js b/jwt/min/rsasign-1.2.min.js
deleted file mode 100644
index 11f98b1..0000000
--- a/jwt/min/rsasign-1.2.min.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/*! rsasign-1.2.7.js (c) 2012 Kenji Urushima | kjur.github.com/jsrsasign/license
- */
-var _RE_HEXDECONLY=new RegExp("");_RE_HEXDECONLY.compile("[^0-9a-f]","gi");function _rsasign_getHexPaddedDigestInfoForString(d,e,a){var b=function(f){return KJUR.crypto.Util.hashString(f,a)};var c=b(d);return KJUR.crypto.Util.getPaddedDigestInfoHex(c,a,e)}function _zeroPaddingOfSignature(e,d){var c="";var a=d/4-e.length;for(var b=0;b>24,(d&16711680)>>16,(d&65280)>>8,d&255]))));d+=1}return b}function _rsasign_signStringPSS(e,a,d){var c=function(f){return KJUR.crypto.Util.hashHex(f,a)};var b=c(rstrtohex(e));if(d===undefined){d=-1}return this.signWithMessageHashPSS(b,a,d)}function _rsasign_signWithMessageHashPSS(l,a,k){var b=hextorstr(l);var g=b.length;var m=this.n.bitLength()-1;var c=Math.ceil(m/8);var d;var o=function(i){return KJUR.crypto.Util.hashHex(i,a)};if(k===-1||k===undefined){k=g}else{if(k===-2){k=c-g-2}else{if(k<-2){throw"invalid salt length"}}}if(c<(g+k+2)){throw"data too long"}var f="";if(k>0){f=new Array(k);new SecureRandom().nextBytes(f);f=String.fromCharCode.apply(String,f)}var n=hextorstr(o(rstrtohex("\x00\x00\x00\x00\x00\x00\x00\x00"+b+f)));var j=[];for(d=0;d>(8*c-m))&255;q[0]&=~p;for(d=0;dthis.n.bitLength()){return 0}var i=this.doPublic(b);var e=i.toString(16).replace(/^1f+00/,"");var g=_rsasign_getAlgNameAndHashFromHexDisgestInfo(e);if(g.length==0){return false}var d=g[0];var h=g[1];var a=function(k){return KJUR.crypto.Util.hashString(k,d)};var c=a(f);return(h==c)}function _rsasign_verifyWithMessageHash(e,a){a=a.replace(_RE_HEXDECONLY,"");a=a.replace(/[ \n]+/g,"");var b=parseBigInt(a,16);if(b.bitLength()>this.n.bitLength()){return 0}var h=this.doPublic(b);var g=h.toString(16).replace(/^1f+00/,"");var c=_rsasign_getAlgNameAndHashFromHexDisgestInfo(g);if(c.length==0){return false}var d=c[0];var f=c[1];return(f==e)}function _rsasign_verifyStringPSS(c,b,a,f){var e=function(g){return KJUR.crypto.Util.hashHex(g,a)};var d=e(rstrtohex(c));if(f===undefined){f=-1}return this.verifyWithMessageHashPSS(d,b,a,f)}function _rsasign_verifyWithMessageHashPSS(f,s,l,c){var k=new BigInteger(s,16);if(k.bitLength()>this.n.bitLength()){return false}var r=function(i){return KJUR.crypto.Util.hashHex(i,l)};var j=hextorstr(f);var h=j.length;var g=this.n.bitLength()-1;var m=Math.ceil(g/8);var q;if(c===-1||c===undefined){c=h}else{if(c===-2){c=m-h-2}else{if(c<-2){throw"invalid salt length"}}}if(m<(h+c+2)){throw"data too long"}var a=this.doPublic(k).toByteArray();for(q=0;q>(8*m-g))&255;if((d.charCodeAt(0)&p)!==0){throw"bits beyond keysize not zero"}var n=pss_mgf1_str(e,d.length,r);var o=[];for(q=0;q
-
-
-
-
-jsjws: Mobile Top
-
-
-
-
-
-
-
-
-
-
jsjws: Mobile Top
-
-
-
-
-
-
-
diff --git a/jwt/mobile/tool_jwt.html b/jwt/mobile/tool_jwt.html
deleted file mode 100755
index fe8768c..0000000
--- a/jwt/mobile/tool_jwt.html
+++ /dev/null
@@ -1,584 +0,0 @@
-
-
-
-
-
-jsjws: Mobile Top
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-This is a
jsjws
-sample program to generate and verify JSON Web Token(JWT).
-
-
demo
-
-
-
-
-
-
-
-
-
-
-This is a sample program to generate a signed JSON Web Token(JWT).
-
-
(Step1) set claim
-
-
-
-
-
-
-
-
-
-
-