добавил возможность отладки eval функций

This commit is contained in:
vgoma 2017-11-29 15:16:02 +03:00
parent 1b4c840d55
commit e038629878
4 changed files with 581 additions and 581 deletions

1129
dist/crypto-pro.js vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -18,7 +18,7 @@ Certificate.prototype.isValid = function isValid() {
var cert = this._cert; var cert = this._cert;
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
eval(cryptoCommon.generateAsyncFn(function () { eval(cryptoCommon.generateAsyncFn(function isValid() {
var result; var result;
try { try {
@ -41,7 +41,7 @@ Certificate.prototype.getProp = function (propName) {
var cert = this._cert; var cert = this._cert;
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
eval(cryptoCommon.generateAsyncFn(function () { eval(cryptoCommon.generateAsyncFn(function getProp() {
var result; var result;
try { try {
@ -63,7 +63,7 @@ Certificate.prototype.exportBase64 = function exportBase64() {
var cert = this._cert; var cert = this._cert;
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
eval(cryptoCommon.generateAsyncFn(function () { eval(cryptoCommon.generateAsyncFn(function exportBase64() {
var base64; var base64;
try { try {
@ -85,7 +85,7 @@ Certificate.prototype.getAlgorithm = function getAlgorithm() {
var cert = this._cert; var cert = this._cert;
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
eval(cryptoCommon.generateAsyncFn(function () { eval(cryptoCommon.generateAsyncFn(function getAlgorithm() {
var result = {}, var result = {},
algorithm; algorithm;
@ -128,7 +128,7 @@ Certificate.prototype.getExtendedKeyUsage = function getExtendedKeyUsage() {
var cert = this._cert; var cert = this._cert;
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
eval(cryptoCommon.generateAsyncFn(function () { eval(cryptoCommon.generateAsyncFn(function getExtendedKeyUsage() {
var OIDS = [], var OIDS = [],
count, count,
item; item;
@ -169,7 +169,7 @@ Certificate.prototype.hasExtendedKeyUsage = cryptoCommon.hasExtendedKeyUsage;
* */ * */
function isValidEDSSettings() { function isValidEDSSettings() {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
eval(cryptoCommon.generateAsyncFn(function () { eval(cryptoCommon.generateAsyncFn(function isValidEDSSettings() {
var result; var result;
try { try {
@ -188,7 +188,7 @@ function isValidEDSSettings() {
* */ * */
function getCadesCert(hash) { function getCadesCert(hash) {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
eval(cryptoCommon.generateAsyncFn(function () { eval(cryptoCommon.generateAsyncFn(function getCadesCert() {
var oStore = 'yield' + cryptoCommon.createObj('CAdESCOM.Store'), var oStore = 'yield' + cryptoCommon.createObj('CAdESCOM.Store'),
certs, certs,
certCnt, certCnt,
@ -253,7 +253,7 @@ function getCertInfo(tags, propName) {
var cert = this._cert; var cert = this._cert;
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
eval(cryptoCommon.generateAsyncFn(function () { eval(cryptoCommon.generateAsyncFn(function getCertInfo() {
var propInfo; var propInfo;
try { try {
@ -281,7 +281,7 @@ function getCertsList(resetCache) {
return; return;
} }
eval(cryptoCommon.generateAsyncFn(function () { eval(cryptoCommon.generateAsyncFn(function getCertsList() {
var oStore = 'yield' + cryptoCommon.createObj('CAdESCOM.Store'), var oStore = 'yield' + cryptoCommon.createObj('CAdESCOM.Store'),
result = [], result = [],
certs, certs,
@ -398,7 +398,7 @@ function signData(hash, dataBase64, signType) {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
getCadesCert(hash).then(function (cert) { getCadesCert(hash).then(function (cert) {
eval(cryptoCommon.generateAsyncFn(function () { eval(cryptoCommon.generateAsyncFn(function signData() {
var clientTime = new Date(), var clientTime = new Date(),
oAttrs = 'yield' + cryptoCommon.createObj('CADESCOM.CPAttribute'), oAttrs = 'yield' + cryptoCommon.createObj('CADESCOM.CPAttribute'),
oSignedData = 'yield' + cryptoCommon.createObj('CAdESCOM.CadesSignedData'), oSignedData = 'yield' + cryptoCommon.createObj('CAdESCOM.CadesSignedData'),
@ -456,7 +456,7 @@ function signData(hash, dataBase64, signType) {
function signDataXML(hash, dataXML) { function signDataXML(hash, dataXML) {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
getCadesCert(hash).then(function (cert) { getCadesCert(hash).then(function (cert) {
eval(cryptoCommon.generateAsyncFn(function () { eval(cryptoCommon.generateAsyncFn(function signDataXML() {
var oSigner = 'yield' + cryptoCommon.createObj('CAdESCOM.CPSigner'), var oSigner = 'yield' + cryptoCommon.createObj('CAdESCOM.CPSigner'),
signerXML = 'yield' + cryptoCommon.createObj('CAdESCOM.SignedXML'), signerXML = 'yield' + cryptoCommon.createObj('CAdESCOM.SignedXML'),
cnts = cryptoConstants, cnts = cryptoConstants,
@ -498,7 +498,7 @@ function getSystemInfo() {
var sysInfo = cryptoCommon.getEnvInfo(); var sysInfo = cryptoCommon.getEnvInfo();
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
eval(cryptoCommon.generateAsyncFn(function () { eval(cryptoCommon.generateAsyncFn(function getSystemInfo() {
var e; var e;
try { try {

View File

@ -39,10 +39,11 @@ var subjectNameTagsTranslations = [
function generateAsyncFn(cb) { function generateAsyncFn(cb) {
var canAsync = cadesplugin.CreateObjectAsync; var canAsync = cadesplugin.CreateObjectAsync;
var dynamicScriptName = cb.name || 'asyncFn';
cb = String(cb); cb = String(cb);
var args = cb.match(/^function\s*?\((.*?)\)/); var args = cb.match(/^function[\s\w]*?\((.*?)\)/);
args = (args && args[1]) || ''; args = (args && args[1]) || '';
@ -61,9 +62,9 @@ function generateAsyncFn(cb) {
cb = cb.replace(/propset_(.*?)\((.*?)\)/gm, '$1 = $2'); cb = cb.replace(/propset_(.*?)\((.*?)\)/gm, '$1 = $2');
} }
return canAsync ? return (canAsync ?
'cadesplugin.async_spawn(' + cb + ');' 'cadesplugin.async_spawn(' + cb + ');'
: '(' + cb + ')();'; : '(' + cb + ')();') + '//# sourceURL=evaled-' + dynamicScriptName + '.js';
} }
/** /**