11 lines
288 KiB
JavaScript
11 lines
288 KiB
JavaScript
|
|
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.forge=t():e.forge=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var r={};return t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=48)}([function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,r){function n(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function a(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(o.isArrayBuffer(e)||o.isArrayBufferView(e)){var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r<t.length;++r)this.putByte(t[r])}}else(e instanceof a||"object"==typeof e&&"string"==typeof e.data&&"number"==typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}function i(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var r=o.isArrayBuffer(e),n=o.isArrayBufferView(e);return r||n?(r?this.data=new DataView(e):this.data=new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength)):(this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!==e&&void 0!==e&&this.putBytes(e),void("writeOffset"in t&&(this.write=t.writeOffset)))}var s=r(0),o=e.exports=s.util=s.util||{};!function(){function e(e){if(e.source===window&&e.data===t){e.stopPropagation();var n=r.slice();r.length=0,n.forEach(function(e){e()})}}if("undefined"!=typeof process&&process.nextTick)return o.nextTick=process.nextTick,void("function"==typeof setImmediate?o.setImmediate=setImmediate:o.setImmediate=o.nextTick);if("function"==typeof setImmediate)return o.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(o.nextTick=function(e){return setImmediate(e)});if(o.setImmediate=function(e){setTimeout(e,0)},"undefined"!=typeof window&&"function"==typeof window.postMessage){var t="forge.setImmediate",r=[];o.setImmediate=function(e){r.push(e),1===r.length&&window.postMessage(t,"*")},window.addEventListener("message",e,!0)}if("undefined"!=typeof MutationObserver){var n=Date.now(),a=!0,i=document.createElement("div"),r=[];new MutationObserver(function(){var e=r.slice();r.length=0,e.forEach(function(e){e()})}).observe(i,{attributes:!0});var s=o.setImmediate;o.setImmediate=function(e){Date.now()-n>15?(n=Date.now(),s(e)):(r.push(e),1===r.length&&i.setAttribute("a",a=!a))}}o.nextTick=o.setImmediate}(),o.isNodejs="undefined"!=typeof process&&process.versions&&process.versions.node,o.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},o.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},o.isArrayBufferView=function(e){return e&&o.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},o.ByteBuffer=a,o.ByteStringBuffer=a;var c=4096;o.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>c&&(this.data.substr(0,1),this._constructedStringLength=0)},o.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},o.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},o.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},o.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),t>>>=1,t>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},o.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},o.ByteStringB
|
||
|
|
n<<=7,128&r?n+=127&r:(t+="."+(n+r),n=0);return t},s.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,a=parseInt(e.substr(4,2),10),i=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),o=0;if(e.length>11){var c=e.charAt(10),u=10;"+"!==c&&"-"!==c&&(o=parseInt(e.substr(10,2),10),u+=2)}if(t.setUTCFullYear(r,n,a),t.setUTCHours(i,s,o,0),u&&(c=e.charAt(u),"+"===c||"-"===c)){var l=parseInt(e.substr(u+1,2),10),p=parseInt(e.substr(u+4,2),10),f=60*l+p;f*=6e4,"+"===c?t.setTime(+t-f):t.setTime(+t+f)}return t},s.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,a=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),o=parseInt(e.substr(12,2),10),c=0,u=0,l=!1;"Z"===e.charAt(e.length-1)&&(l=!0);var p=e.length-5,f=e.charAt(p);if("+"===f||"-"===f){var h=parseInt(e.substr(p+1,2),10),d=parseInt(e.substr(p+4,2),10);u=60*h+d,u*=6e4,"+"===f&&(u*=-1),l=!0}return"."===e.charAt(14)&&(c=1e3*parseFloat(e.substr(14),10)),l?(t.setUTCFullYear(r,n,a),t.setUTCHours(i,s,o,c),t.setTime(+t+u)):(t.setFullYear(r,n,a),t.setHours(i,s,o,c)),t},s.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},s.dateToGeneralizedTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},s.integerToDer=function(e){var t=i.util.createBuffer();if(e>=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},s.derToInteger=function(e){"string"==typeof e&&(e=i.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},s.validate=function(e,t,r,n){var a=!1;if(e.tagClass!==t.tagClass&&"undefined"!=typeof t.tagClass||e.type!==t.type&&"undefined"!=typeof t.type)n&&(e.tagClass!==t.tagClass&&n.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&n.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||"undefined"==typeof t.constructed){if(a=!0,t.value&&i.util.isArray(t.value))for(var o=0,c=0;a&&c<t.value.length;++c)a=t.value[c].optional||!1,e.value[o]&&(a=s.validate(e.value[o],t.value[c],r,n),a?++o:t.value[c].optional&&(a=!0)),!a&&n&&n.push("["+t.name+'] Tag class "'+t.tagClass+'", type "'+t.type+'" expected value length "'+t.value.length+'", got "'+e.value.length+'"');if(a&&r&&(t.capture&&(r[t.capture]=e.value),t.captureAsn1&&(r[t.captureAsn1]=e),t.captureBitStringContents&&"bitStringContents"in e&&(r[t.captureBitStringContents]=e.bitStringContents),t.captureBitStringValue&&"bitStringContents"in e)){if(e.bitStringContents.length<2)r[t.captureBitStringValue]="";else{var u=e.bitStringContents.charCodeAt(0);if(0!==u)throw new Error("captureBitStringValue only supported for zero unused bits");r[t.captureBitStringValue]=e.bitStringContents.slice(1)}}}else n&&n.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+e.constructed+'"');return a};var c=/[^\\u0000-\\u00ff]/;s.prettyPrint=function(e,t,r){var n="";t=t||0,r=r||2,t>0&&(n+="\n");for(var a="",o=0;o<t*r;++o)a+=" ";switch(n+=a+"Tag: ",e.tagClass){case s.Class.UNIVERSAL:n+="Universal:";break;case s.Class.APPLICATION:n+="Application:";break;case s.Class.CONTEXT_SPECIFIC:n+="Context-Specific:";break;case s.Class.PRIVATE:n+="Private:"}if(e.tagClass===s.Class.UNIVERS
|
||
|
|
}function u(e){return"undefined"!=typeof window&&"object"==typeof window.msCrypto&&"object"==typeof window.msCrypto.subtle&&"function"==typeof window.msCrypto.subtle[e]}function l(e){for(var t=p.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),n=0;n<t.length;++n)r[n]=t.charCodeAt(n);return r}var p=r(0);if(r(3),r(15),r(6),r(25),r(29),r(2),r(1),"undefined"==typeof f)var f=p.jsbn.BigInteger;var h=p.asn1;p.pki=p.pki||{},e.exports=p.pki.rsa=p.rsa=p.rsa||{};var d=p.pki,y=[6,4,2,4,2,4,6,2],g={name:"PrivateKeyInfo",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:h.Class.UNIVERSAL,type:h.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},v={name:"RSAPrivateKey",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},m={name:"RSAPublicKey",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},C=p.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:h.Class.UNIVERSAL,type:h.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},E=function(e){var t;if(!(e.algorithm in d.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=d.oids[e.algorithm];var n=h.oidToDer(t).getBytes(),a=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]),i=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);i.value.push(h.create(h.Class.UNIVERSAL,h.Type.OID,!1,n)),i.value.push(h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,""));var s=h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,e.digest().getBytes());return a.value.push(i),a.value.push(s),h.toDer(a).getBytes()},S=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);t.dP||(t.dP=t.d.mod(t.p.subtract(f.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(f.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));var n;do n=new f(p.util
|
||
|
|
var D=l.handleHelloRequest,P=l.handleServerHello,O=l.handleCertificate,V=l.handleServerKeyExchange,x=l.handleCertificateRequest,K=l.handleServerHelloDone,M=l.handleFinished,F=[];F[l.ConnectionEnd.client]=[[k,k,P,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k],[D,k,k,k,k,k,k,k,k,k,k,O,V,x,K,k,k,k,k,k,k],[D,k,k,k,k,k,k,k,k,k,k,k,V,x,K,k,k,k,k,k,k],[D,k,k,k,k,k,k,k,k,k,k,k,k,x,K,k,k,k,k,k,k],[D,k,k,k,k,k,k,k,k,k,k,k,k,k,K,k,k,k,k,k,k],[D,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k],[D,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,M],[D,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k],[D,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k]];var q=l.handleClientHello,j=l.handleClientKeyExchange,H=l.handleCertificateVerify;F[l.ConnectionEnd.server]=[[k,q,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k],[k,k,k,k,k,k,k,k,k,k,k,O,k,k,k,k,k,k,k,k,k],[k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,j,k,k,k,k],[k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,H,k,k,k,k,k],[k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k],[k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,M],[k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k],[k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k]],l.generateKeys=function(e,t){var r=a,n=t.client_random+t.server_random;e.session.resuming||(t.master_secret=r(t.pre_master_secret,"master secret",n,48).bytes(),t.pre_master_secret=null),n=t.server_random+t.client_random;var i=2*t.mac_key_length+2*t.enc_key_length,s=e.version.major===l.Versions.TLS_1_0.major&&e.version.minor===l.Versions.TLS_1_0.minor;s&&(i+=2*t.fixed_iv_length);var o=r(t.master_secret,"key expansion",n,i),c={client_write_MAC_key:o.getBytes(t.mac_key_length),server_write_MAC_key:o.getBytes(t.mac_key_length),client_write_key:o.getBytes(t.enc_key_length),server_write_key:o.getBytes(t.enc_key_length)};return s&&(c.client_write_IV=o.getBytes(t.fixed_iv_length),c.server_write_IV=o.getBytes(t.fixed_iv_length)),c},l.createConnectionState=function(e){var t=e.entity===l.ConnectionEnd.client,r=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0},compressionState:null,compressFunction:function(e){return!0},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1]}};return e},n={read:r(),write:r()};if(n.read.update=function(e,t){return n.read.cipherFunction(t,n.read)?n.read.compressFunction(e,t,n.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.bad_record_mac}}),!e.fail},n.write.update=function(e,t){return n.write.compressFunction(e,t,n.write)?n.write.cipherFunction(t,n.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}}),!e.fail},e.session){var a=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(a),a.keys=l.generateKeys(e,a),n.read.macKey=t?a.keys.server_write_MAC_key:a.keys.client_write_MAC_key,n.write.macKey=t?a.keys.client_write_MAC_key:a.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(n,e,a),a.compression_algorithm){case l.CompressionMethod.none:break;case l.CompressionMethod.deflate:n.read.compressFunction=o,n.write.compressFunction=s;break;default:throw new Error("Unsupported compression algorithm.")}}return n},l.createRandom=function(){var e=new Date,t=+e+6e4*e.getTimezoneOffset(),r=n.util.createBuffer();return r.putInt32(t),r.putBytes(n.random.getBytes(28)),r},l.createRecord=function(e,t){if(!t.data)return null;var r={type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data};return r},l.createAlert=function(e,t){var r=n.util.createBuffer();return r.putByte(t.level),r.putByte(t.description),l.createRecord(e,{type:l.ContentType.alert,data:r})},l.createClientHello=function
|
||
|
|
var n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r.data[--n]=0;var a;for(a=r.t-this.t;n<a;++n)r.data[n+this.t]=this.am(0,e.data[n],r,n,0,this.t);for(a=Math.min(e.t,t);n<a;++n)this.am(0,e.data[n],r,n,0,t-n);r.clamp()}function Fe(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r.data[this.t+n-t]=this.am(t-n,e.data[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)}function qe(e){this.r2=a(),this.q3=a(),n.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function je(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=a();return e.copyTo(t),this.reduce(t),t}function He(e){return e}function Ge(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function Qe(e,t){e.squareTo(t),this.reduce(t)}function ze(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function Xe(e,t){var r,n,i=e.bitLength(),s=f(1);if(i<=0)return s;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new R(t):t.isEven()?new qe(t):new V(t);var o=new Array,c=3,u=r-1,l=(1<<r)-1;if(o[1]=n.convert(this),r>1){var p=a();for(n.sqrTo(o[1],p);c<=l;)o[c]=a(),n.mulTo(p,o[c-2],o[c]),c+=2}var h,d,y=e.t-1,g=!0,v=a();for(i=C(e.data[y])-1;y>=0;){for(i>=u?h=e.data[y]>>i-u&l:(h=(e.data[y]&(1<<i+1)-1)<<u-i,y>0&&(h|=e.data[y-1]>>this.DB+i-u)),c=r;0==(1&h);)h>>=1,--c;if((i-=c)<0&&(i+=this.DB,--y),g)o[h].copyTo(s),g=!1;else{for(;c>1;)n.sqrTo(s,v),n.sqrTo(v,s),c-=2;c>0?n.sqrTo(s,v):(d=s,s=v,v=d),n.mulTo(v,o[h],s)}for(;y>=0&&0==(e.data[y]&1<<i);)n.sqrTo(s,v),d=s,s=v,v=d,--i<0&&(i=this.DB-1,--y)}return n.revert(s)}function We(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var a=t.getLowestSetBit(),i=r.getLowestSetBit();if(i<0)return t;for(a<i&&(i=a),i>0&&(t.rShiftTo(i,t),r.rShiftTo(i,r));t.signum()>0;)(a=t.getLowestSetBit())>0&&t.rShiftTo(a,t),(a=r.getLowestSetBit())>0&&r.rShiftTo(a,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return i>0&&r.lShiftTo(i,r),r}function Ye(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r}function Ze(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return n.ZERO;for(var r=e.clone(),a=this.clone(),i=f(1),s=f(0),o=f(0),c=f(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(i.isEven()&&s.isEven()||(i.addTo(this,i),s.subTo(e,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;a.isEven();)a.rShiftTo(1,a),t?(o.isEven()&&c.isEven()||(o.addTo(this,o),c.subTo(e,c)),o.rShiftTo(1,o)):c.isEven()||c.subTo(e,c),c.rShiftTo(1,c);r.compareTo(a)>=0?(r.subTo(a,r),t&&i.subTo(o,i),s.subTo(c,s)):(a.subTo(r,a),t&&o.subTo(i,o),c.subTo(s,c))}return 0!=a.compareTo(n.ONE)?n.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c}function Je(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=lt[lt.length-1]){for(t=0;t<lt.length;++t)if(r.data[0]==lt[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<lt.length;){for(var n=lt[t],a=t+1;a<lt.length&&n<pt;)n*=lt[a++];for(n=r.modInt(n);t<a;)if(n%lt[t++]==0)return!1}return r.millerRabin(e)}function $e(e){var t=this.subtract(n.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var a,i=t.shiftRight(r),s=et(),o=0;o<e;++o){do a=new n(this.bitLength(),s);while(a.compareTo(n.ONE)<=0||a.compareTo(t)>=0);var c=a.modPow(i,this);if(0!=c.compareTo(n.ONE)&&0!=c.compareTo(t)){for(var u=1;u++<r&&0!=c.compareTo(t);)if(c=c.modPowInt(2,this),0==c.compareTo(n.ONE))return!1;if(0!=c.compareTo(t))return!1}}return!0}function et(){return{nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random())}}}var tt=r(0);e.exports=tt.jsbn=tt.jsbn||{};var rt,nt=0xdeadbeefcafe,at=15715070==(16777215&nt);tt.jsbn.BigInteger=n,"undefined"==typeof navigator?(n.prototype.am=o,rt=28
|
||
|
|
cert:e});e.extensions=t},e.getExtension=function(t){"string"==typeof t&&(t={name:t});for(var r,n=null,a=0;null===n&&a<e.extensions.length;++a)r=e.extensions[a],t.id&&r.id===t.id?n=r:t.name&&r.name===t.name&&(n=r);return n},e.sign=function(t,r){e.md=r||u.md.sha1.create();var n=f[e.md.algorithm+"WithRSAEncryption"];if(!n){var a=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw a.algorithm=e.md.algorithm,a}e.signatureOid=e.siginfo.algorithmOid=n,e.tbsCertificate=p.getTBSCertificate(e);var i=l.toDer(e.tbsCertificate);e.md.update(i.getBytes()),e.signature=t.sign(e.md)},e.verify=function(t){var r=!1;if(!e.issued(t)){var n=t.issuer,a=e.subject,i=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw i.expectedIssuer=n.attributes,i.actualIssuer=a.attributes,i}var s=t.md;if(null===s){if(t.signatureOid in f){var o=f[t.signatureOid];switch(o){case"sha1WithRSAEncryption":s=u.md.sha1.create();break;case"md5WithRSAEncryption":s=u.md.md5.create();break;case"sha256WithRSAEncryption":s=u.md.sha256.create();break;case"sha512WithRSAEncryption":s=u.md.sha512.create();break;case"RSASSA-PSS":s=u.md.sha256.create()}}if(null===s){var i=new Error("Could not compute certificate digest. Unknown signature OID.");throw i.signatureOid=t.signatureOid,i}var c=t.tbsCertificate||p.getTBSCertificate(t),h=l.toDer(c);s.update(h.getBytes())}if(null!==s){var d;switch(t.signatureOid){case f.sha1WithRSAEncryption:d=void 0;break;case f["RSASSA-PSS"]:var y,g;if(y=f[t.signatureParameters.mgf.hash.algorithmOid],void 0===y||void 0===u.md[y]){var i=new Error("Unsupported MGF hash function.");throw i.oid=t.signatureParameters.mgf.hash.algorithmOid,i.name=y,i}if(g=f[t.signatureParameters.mgf.algorithmOid],void 0===g||void 0===u.mgf[g]){var i=new Error("Unsupported MGF function.");throw i.oid=t.signatureParameters.mgf.algorithmOid,i.name=g,i}if(g=u.mgf[g].create(u.md[y].create()),y=f[t.signatureParameters.hash.algorithmOid],void 0===y||void 0===u.md[y])throw{message:"Unsupported RSASSA-PSS hash function.",oid:t.signatureParameters.hash.algorithmOid,name:y};d=u.pss.create(u.md[y].create(),g,t.signatureParameters.saltLength)}r=e.publicKey.verify(s.digest().getBytes(),t.signature,d)}return r},e.isIssuer=function(t){var r=!1,n=e.issuer,a=t.subject;if(n.hash&&a.hash)r=n.hash===a.hash;else if(n.attributes.length===a.attributes.length){r=!0;for(var i,s,o=0;r&&o<n.attributes.length;++o)i=n.attributes[o],s=a.attributes[o],i.type===s.type&&i.value===s.value||(r=!1)}return r},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return p.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=f.subjectKeyIdentifier,r=0;r<e.extensions.length;++r){var n=e.extensions[r];if(n.id===t){var a=e.generateSubjectKeyIdentifier().getBytes();return u.util.hexToBytes(n.subjectKeyIdentifier)===a}}return!1},e},p.certificateFromAsn1=function(e,t){var r={},a=[];if(!l.validate(e,y,r,a)){var s=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw s.errors=a,s}var o=l.derToOid(r.publicKeyOid);if(o!==p.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var c=p.createCertificate();c.version=r.certVersion?r.certVersion.charCodeAt(0):0;var h=u.util.createBuffer(r.certSerialNumber);c.serialNumber=h.toHex(),c.signatureOid=u.asn1.derToOid(r.certSignatureOid),c.signatureParameters=C(c.signatureOid,r.certSignatureParams,!0),c.siginfo.algorithmOid=u.asn1.derToOid(r.certinfoSignatureOid),c.siginfo.parameters=C(c.siginfo.algorithmOid,r.certinfoSignatureParams,!1),c.signature=r.certSignature;var d=[];if(void 0!==r.certValidity1UTCTime&&d.push(l.utcTimeToDate(r.certValidity1UTCTime)),void 0!==r.certValidity2GeneralizedTime&&d.push(l.generalizedTimeToDate(r.certValidity2GeneralizedTime)),void 0!==r.certValidity3UTCTime&&d.push(l.utcTimeToDate(r.certValidity3UTCTime)),void 0!==r.certValidity4GeneralizedTime&&d.push(l.generalize
|
||
|
|
e.cookies=t||{}}catch(e){}},c=function(e){if(e.persistCookies)try{n.util.setItem(e.socketPool.flashApi,s(e),"cookies",e.cookies)}catch(e){}o(e)},u=function(e){if(e.persistCookies)try{n.util.clearItems(e.socketPool.flashApi,s(e))}catch(e){}},l=function(e,t){t.isConnected()?(t.options.request.connectTime=+new Date,t.connected({type:"connect",id:t.id})):(t.options.request.connectTime=+new Date,t.connect({host:e.url.host,port:e.url.port,policyPort:e.policyPort,policyUrl:e.policyUrl}))},p=function(e,t){t.buffer.clear();for(var r=null;null===r&&e.requests.length>0;)r=e.requests.shift(),r.request.aborted&&(r=null);null===r?(null!==t.options&&(t.options=null),e.idle.push(t)):(t.retries=1,t.options=r,l(e,t))},f=function(e,t,r){t.options=null,t.connected=function(r){if(null===t.options)p(e,t);else{var n=t.options.request;if(n.connectTime=+new Date-n.connectTime,r.socket=t,t.options.connected(r),n.aborted)t.close();else{var a=n.toString();n.body&&(a+=n.body),n.time=+new Date,t.send(a),n.time=+new Date-n.time,t.options.response.time=+new Date,t.sending=!0}}},t.closed=function(r){if(t.sending)t.sending=!1,t.retries>0?(--t.retries,l(e,t)):t.error({id:t.id,type:"ioError",message:"Connection closed during send. Broken pipe.",bytesAvailable:0});else{var n=t.options.response;n.readBodyUntilClose&&(n.time=+new Date-n.time,n.bodyReceived=!0,t.options.bodyReady({request:t.options.request,response:n,socket:t})),t.options.closed(r),p(e,t)}},t.data=function(r){t.sending=!1;var n=t.options.request;if(n.aborted)t.close();else{var a=t.options.response,i=t.receive(r.bytesAvailable);if(null!==i&&(t.buffer.putBytes(i),a.headerReceived||(a.readHeader(t.buffer),a.headerReceived&&t.options.headerReady({request:t.options.request,response:a,socket:t})),a.headerReceived&&!a.bodyReceived&&a.readBody(t.buffer),a.bodyReceived)){t.options.bodyReady({request:t.options.request,response:a,socket:t});var s=a.getField("Connection")||"";s.indexOf("close")!=-1||"HTTP/1.0"===a.version&&null===a.getField("Keep-Alive")?t.close():p(e,t)}}},t.error=function(e){t.options.error({type:e.type,message:e.message,request:t.options.request,response:t.options.response,socket:t}),t.close()},r?(t=n.tls.wrapSocket({sessionId:null,sessionCache:{},caStore:r.caStore,cipherSuites:r.cipherSuites,socket:t,virtualHost:r.virtualHost,verify:r.verify,getCertificate:r.getCertificate,getPrivateKey:r.getPrivateKey,getSignature:r.getSignature,deflate:r.deflate||null,inflate:r.inflate||null}),t.options=null,t.buffer=n.util.createBuffer(),e.sockets.push(t),r.prime?t.connect({host:e.url.host,port:e.url.port,policyPort:e.policyPort,policyUrl:e.policyUrl}):e.idle.push(t)):(t.buffer=n.util.createBuffer(),e.sockets.push(t),e.idle.push(t))},h=function(e){var t=!1;if(e.maxAge!==-1){var r=m(new Date),n=e.created+e.maxAge;n<=r&&(t=!0)}return t},d=function(e,t){var r=[],n=(e.url,e.cookies);for(var a in n){var i=n[a];for(var s in i){var o=i[s];h(o)?r.push(o):0===t.path.indexOf(o.path)&&t.addCookie(o)}}for(var c=0;c<r.length;++c){var o=r[c];e.removeCookie(o.name,o.path)}},y=function(e,t){for(var r=t.getCookies(),n=0;n<r.length;++n)try{e.setCookie(r[n])}catch(e){}};a.createClient=function(e){var t=null;e.caCerts&&(t=n.pki.createCaStore(e.caCerts)),e.url=e.url||window.location.protocol+"//"+window.location.host;var r=a.parseUrl(e.url);if(!r){var i=new Error("Invalid url.");throw i.details={url:e.url},i}e.connections=e.connections||1;var s=e.socketPool,p={url:r,socketPool:s,policyPort:e.policyPort,policyUrl:e.policyUrl,requests:[],sockets:[],idle:[],secure:"https"===r.scheme,cookies:{},persistCookies:"undefined"==typeof e.persistCookies||e.persistCookies};n.debug&&n.debug.get("forge.http","clients").push(p),o(p);var h=function(e,t,r,n){if(0===r&&t===!0){var a=n[r].subject.getField("CN");null!==a&&p.url.host===a.value||(t={message:"Certificate common name does not match url host."})}return t},g=null;p.secure&&(g={caStore:t,cipherSuites:e.cipherSuites||null,virtualHost:e.virtualHost||r.host,verify:e.verify||h,getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null
|
||
|
|
var e=new Error("Unsupported certificate type, only X.509 supported.");throw e.oid=l.derToOid(s.certId),e}var r=l.fromDer(s.cert,t);try{f.cert=p.certificateFromAsn1(r,!0)}catch(e){f.cert=null,f.asn1=r}};break;default:var u=new Error("Unsupported PKCS#12 SafeBag type.");throw u.oid=f.type,u}if(void 0!==h&&!l.validate(g,h,s,o)){var u=new Error("Cannot read PKCS#12 "+h.name);throw u.errors=o,u}d()}return n}function c(e){var t={};if(void 0!==e)for(var r=0;r<e.length;++r){var n={},a=[];if(!l.validate(e[r],g,n,a)){var i=new Error("Cannot read PKCS#12 BagAttribute.");throw i.errors=a,i}var s=l.derToOid(n.oid);if(void 0!==p.oids[s]){t[p.oids[s]]=[];for(var o=0;o<n.values.length;++o)t[p.oids[s]].push(n.values[o].value)}}return t}var u=r(0);r(3),r(8),r(6),r(27),r(24),r(2),r(11),r(9),r(1),r(19);var l=u.asn1,p=u.pki,f=e.exports=u.pkcs12=u.pkcs12||{},h={name:"ContentInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:l.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},d={name:"PFX",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"version"},h,{name:"PFX.macData",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:l.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:l.Class.UNIVERSAL,type:l.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:l.Class.UNIVERSAL,type:l.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},y={name:"SafeBag",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:l.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:l.Class.UNIVERSAL,type:l.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},g={name:"Attribute",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:l.Class.UNIVERSAL,type:l.Type.SET,constructed:!0,capture:"values"}]},v={name:"CertBag",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:l.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:l.Class.UNIVERSAL,type:l.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};f.pkcs12FromAsn1=function(e,t,r){"string"==typeof t?(r=t,t=!0):void 0===t&&(t=!0);var s={},o=[];if(!l.validate(e,d,s,o)){var c=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw c.errors=c,c}var h={version:s.version.charCodeAt(0),safeContents:[],getBags:function(e){var t,r={};return"localKeyId"in e?t=e.localKeyId:"localKeyIdHex"in e&&(t=u.util.hexToBytes(e.localKeyIdHex)),void 0===t&&!("friendlyName"in e)&&"bagType"in e&&(r[e.bagType]=n(h.safeContents,null,null,e.bagType)),void 0!==t&&(r.localKeyId=n(h.safeContents,"localKeyId",t,e.bagType)),"friendlyName"in e&&(r.friendlyName=n(h.safeContents,"friendlyName",e.friendlyName,e.bagType)),r},getBagsByFriendlyName:function(e,t){return n(
|
||
|
|
e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=l.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var p=0},function(e,t,r){var n=r(0),a=e.exports=n.form=n.form||{};!function(e){var t=/(.*?)\[(.*?)\]/g,r=function(e){for(var r,n=[];r=t.exec(e);)r[1].length>0&&n.push(r[1]),r.length>=2&&n.push(r[2]);return 0===n.length&&n.push(e),n},n=function(t,n,a,i){for(var s=[],o=0;o<n.length;++o){var c=n[o];if(c.indexOf("[")!==-1&&c.indexOf("]")===-1&&o<n.length-1)do c+="."+n[++o];while(o<n.length-1&&n[o].indexOf("]")===-1);s.push(c)}n=s;var s=[];e.each(n,function(e,t){s=s.concat(r(t))}),n=s,e.each(n,function(r,s){if(i&&0!==s.length&&s in i&&(s=i[s]),0===s.length&&(s=t.length),t[s])r==n.length-1?(e.isArray(t[s])||(t[s]=[t[s]]),t[s].push(a)):t=t[s];else if(r==n.length-1)t[s]=a;else{var o=n[r+1];if(0===o.length)t[s]=[];else{var c=o-0==o&&o.length>0;t[s]=c?[]:{}}t=t[s]}})};a.serialize=function(t,r,a){var i={};return r=r||".",e.each(t.serializeArray(),function(){n(i,this.name.split(r),this.value||"",a)}),i}}(jQuery)},function(e,t,r){e.exports=r(0),r(5),r(36),r(3),r(13),r(14),r(10),r(8),r(39),r(22),r(40),r(23),r(17),r(7),r(25),r(26),r(42),r(28),r(29),r(30),r(18),r(2),r(31),r(44),r(45),r(12),r(1)},function(e,t,r){function n(e,t,r,n){e.generate=function(e,i){for(var s=new a.util.ByteBuffer,o=Math.ceil(i/n)+r,c=new a.util.ByteBuffer,u=r;u<o;++u){c.putInt32(u),t.start(),t.update(e+c.getBytes());var l=t.digest();s.putBytes(l.getBytes(n))}return s.truncate(s.length()-i),s.getBytes()}}var a=r(0);r(1),r(2),r(15),e.exports=a.kem=a.kem||{};var i=a.jsbn.BigInteger;a.kem.rsa={},a.kem.rsa.create=function(e,t){t=t||{};var r=t.prng||a.random,n={};return n.encrypt=function(t,n){var s,o=Math.ceil(t.n.bitLength()/8);do s=new i(a.util.bytesToHex(r.getBytesSync(o)),16).mod(t.n);while(s.equals(i.ZERO));s=a.util.hexToBytes(s.toString(16));var c=o-s.length;c>0&&(s=a.util.fillString(String.fromCharCode(0),c)+s);var u=t.encrypt(s,"NONE"),l=e.generate(s,n);return{encapsulation:u,key:l}},n.decrypt=function(t,r,n){var a=t.decrypt(r,"NONE");return e.generate(a,n)},n},a.kem.kdf1=function(e,t){n(this,e,0,t||e.digestLength)},a.kem.kdf2=function(e,t){n(this,e,1,t||e.digestLength)}},function(e,t,r){e.exports=r(4),r(16),r(9),r(32),r(43)},function(e,t,r){var n=r(0);r(23),e.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},function(e,t,r){function n(e){var t={},r=[];if(!d.validate(e,y.asn1.recipientInfoValidator,t,r)){var n=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw n.errors=r,n}return{version:t.version.charCodeAt(0),issuer:h.pki.RDNAttributesAsArray(t.issuer),serialNumber:h.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:d.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function a(e){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(e.version).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[h.pki.distinguishedNameToAsn1({attributes:e.issuer}),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,h.util.hexToBytes(e.serialNumber))]),d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(e.encryptedContent.algorithm).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,"")]),d.create(d.Class.UNIVERSAL,d.Type.OCTETSTRING,!1,e.encryptedContent.content)])}function i(e){for(var t=[],r=0;r<e.length;++r)t.push(n(e[r]));return t}function s(e){for(var t=[],r=0;r<e.length;++r)t.push(a(e[r]));return t}function o(e){var t=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(e.version).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[h.pki.distinguishedNameToAsn1({attributes:e.issuer}),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,h.util.hexToBytes(e.serialNumber))]),d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(e.digestAlgorithm).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,"")])]);if(e.authenticatedAttri
|
||
|
|
message:n.message,bytesAvailable:0,error:n}),t.close()}});t.connected=function(t){a.handshake(e.sessionId)},t.closed=function(e){a.open&&a.handshaking&&r.error({id:t.id,type:"ioError",message:"Connection closed during handshake.",bytesAvailable:0}),a.close(),r.closed({id:t.id,type:"close",bytesAvailable:0})},t.error=function(e){r.error({id:t.id,type:e.type,message:e.message,bytesAvailable:0}),a.close()};var i=0;return t.data=function(e){if(a.open){if(e.bytesAvailable>=i){var r=Math.max(e.bytesAvailable,i),n=t.receive(r);null!==n&&(i=a.process(n))}}else t.receive(e.bytesAvailable)},r.destroy=function(){t.destroy()},r.setSessionCache=function(e){a.sessionCache=tls.createSessionCache(e)},r.connect=function(e){t.connect(e)},r.close=function(){a.close()},r.isConnected=function(){return a.isConnected&&t.isConnected()},r.send=function(e){return a.prepare(e)},r.receive=function(e){return a.data.getBytes(e)},r.bytesAvailable=function(){return a.data.length()},r}},function(e,t,r){var n=r(0);r(33),r(21);var a=e.exports=n.xhr=n.xhr||{};!function(e){var t="forge.xhr",r=0,i=1,s=2,o=3,c=4,u=null,l=0,p=null,f=null,h={},d=10,y=n.net,g=n.http;a.init=function(e){n.log.debug(t,"initializing",e),l=e.policyPort||l,p=e.policyUrl||p,d=e.connections||d,u=y.createSocketPool({flashId:e.flashId,policyPort:l,policyUrl:p,msie:e.msie||!1}),f=g.createClient({url:e.url||window.location.protocol+"//"+window.location.host,socketPool:u,policyPort:l,policyUrl:p,connections:e.connections||d,caCerts:e.caCerts,cipherSuites:e.cipherSuites,persistCookies:e.persistCookies||!0,primeTlsSockets:e.primeTlsSockets||!1,verify:e.verify,getCertificate:e.getCertificate,getPrivateKey:e.getPrivateKey,getSignature:e.getSignature}),h[f.url.full]=f,n.log.debug(t,"ready")},a.cleanup=function(){for(var e in h)h[e].destroy();h={},f=null,u.destroy(),u=null},a.setCookie=function(e){if(e.maxAge=e.maxAge||-1,e.domain)for(var t in h){var r=h[t];g.withinCookieDomain(r.url,e)&&r.secure===e.secure&&r.setCookie(e)}else f.setCookie(e)},a.getCookie=function(e,t,r){var a=null;if(r)for(var i in h){var s=h[i];if(g.withinCookieDomain(s.url,r)){var o=s.getCookie(e,t);null!==o&&(null===a?a=o:n.util.isArray(a)?a.push(o):a=[a,o])}}else a=f.getCookie(e,t);return a},a.removeCookie=function(e,t,r){var n=!1;if(r)for(var a in h){var i=h[a];g.withinCookieDomain(i.url,r)&&i.removeCookie(e,t)&&(n=!0)}else n=f.removeCookie(e,t);return n},a.create=function(a){a=e.extend({logWarningOnError:!0,verbose:!1,logError:function(){},logWarning:function(){},logDebug:function(){},logVerbose:function(){},url:null},a||{});var y={client:null,request:null,response:null,asynchronous:!0,sendFlag:!1,errorFlag:!1},v={error:a.logError||n.log.error,warning:a.logWarning||n.log.warning,debug:a.logDebug||n.log.debug,verbose:a.logVerbose||n.log.verbose},m={onreadystatechange:null,readyState:r,responseText:"",responseXML:null,status:0,statusText:""};if(null===a.url)y.client=f;else{var C=g.parseUrl(a.url);if(!C){var E=new Error("Invalid url.");E.details={url:a.url}}C.full in h?y.client=h[C.full]:(y.client=g.createClient({url:a.url,socketPool:u,policyPort:a.policyPort||l,policyUrl:a.policyUrl||p,connections:a.connections||d,caCerts:a.caCerts,cipherSuites:a.cipherSuites,persistCookies:a.persistCookies||!0,primeTlsSockets:a.primeTlsSockets||!1,verify:a.verify,getCertificate:a.getCertificate,getPrivateKey:a.getPrivateKey,getSignature:a.getSignature}),h[C.full]=y.client)}return m.open=function(e,t,r,n,a){switch(e){case"DELETE":case"GET":case"HEAD":case"OPTIONS":case"PATCH":case"POST":case"PUT":break;case"CONNECT":case"TRACE":case"TRACK":throw new Error("CONNECT, TRACE and TRACK methods are disallowed");default:throw new Error("Invalid method: "+e)}y.sendFlag=!1,m.responseText="",m.responseXML=null,m.status=0,m.statusText="",y.request=g.createRequest({method:e,path:t}),m.readyState=i,m.onreadystatechange&&m.onreadystatechange()},m.setRequestHeader=function(e,t){if(m.readyState!=i||y.sendFlag)throw new Error("XHR not open or sending");y.request.setField(e,t)},m.send=function(e){if(m.readyState!=i||y.sendFlag)throw new Error("XHR not open or
|
||
|
|
//# sourceMappingURL=forge.all.min.js.map
|