Advertisement
Guest User

Untitled

a guest
Dec 19th, 2017
1,248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 42.22 KB | None | 0 0
  1. var isPluginEnabled = false;
  2. var fileContent; // Переменная для хранения информации из файла, значение присваивается в cades_bes_file.html
  3. function getXmlHttp(){
  4. var xmlhttp;
  5. try {
  6. xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  7. } catch (e) {
  8. try {
  9. xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  10. } catch (E) {
  11. xmlhttp = false;
  12. }
  13. }
  14. if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
  15. xmlhttp = new XMLHttpRequest();
  16. }
  17. return xmlhttp;
  18. }
  19.  
  20. var async_code_included = 0;
  21. var async_Promise;
  22. var async_resolve;
  23. function include_async_code()
  24. {
  25. if(async_code_included)
  26. {
  27. return async_Promise;
  28. }
  29. var fileref = document.createElement('script');
  30. fileref.setAttribute("type", "text/javascript");
  31. fileref.setAttribute("src", "async_code.js");
  32. document.getElementsByTagName("head")[0].appendChild(fileref);
  33. async_Promise = new Promise(function(resolve, reject){
  34. async_resolve = resolve;
  35. });
  36. async_code_included = 1;
  37. return async_Promise;
  38. }
  39.  
  40. function Common_RetrieveCertificate()
  41. {
  42. var canAsync = !!cadesplugin.CreateObjectAsync;
  43. if(canAsync)
  44. {
  45. include_async_code().then(function(){
  46. return RetrieveCertificate_Async();
  47. });
  48. }else
  49. {
  50. return RetrieveCertificate_NPAPI();
  51. }
  52. }
  53.  
  54. function Common_CreateSimpleSign(id)
  55. {
  56. var canAsync = !!cadesplugin.CreateObjectAsync;
  57. if(canAsync)
  58. {
  59. include_async_code().then(function(){
  60. return CreateSimpleSign_Async(id);
  61. });
  62. }else
  63. {
  64. return CreateSimpleSign_NPAPI(id);
  65. }
  66. }
  67.  
  68. function Common_SignCadesBES(id, text, setDisplayData)
  69. {
  70. var canAsync = !!cadesplugin.CreateObjectAsync;
  71. if(canAsync)
  72. {
  73. include_async_code().then(function(){
  74. return SignCadesBES_Async(id, text, setDisplayData);
  75. });
  76. }else
  77. {
  78. return SignCadesBES_NPAPI(id, text, setDisplayData);
  79. }
  80. }
  81.  
  82. function Common_SignCadesBES_File(id) {
  83. var canAsync = !!cadesplugin.CreateObjectAsync;
  84. if (canAsync) {
  85. include_async_code().then(function () {
  86. return SignCadesBES_Async_File(id);
  87. });
  88. } else {
  89. return SignCadesBES_NPAPI_File(id);
  90. }
  91. }
  92.  
  93. function Common_SignCadesXLong(id)
  94. {
  95. var canAsync = !!cadesplugin.CreateObjectAsync;
  96. if(canAsync)
  97. {
  98. include_async_code().then(function(){
  99. return SignCadesXLong_Async(id);
  100. });
  101. }else
  102. {
  103. return SignCadesXLong_NPAPI(id);
  104. }
  105. }
  106.  
  107. function Common_SignCadesXML(id)
  108. {
  109. var canAsync = !!cadesplugin.CreateObjectAsync;
  110. if(canAsync)
  111. {
  112. include_async_code().then(function(){
  113. return SignCadesXML_Async(id);
  114. });
  115. }else
  116. {
  117. return SignCadesXML_NPAPI(id);
  118. }
  119. }
  120.  
  121. function Common_CheckForPlugIn() {
  122. cadesplugin.set_log_level(cadesplugin.LOG_LEVEL_DEBUG);
  123. var canAsync = !!cadesplugin.CreateObjectAsync;
  124. if(canAsync)
  125. {
  126. include_async_code().then(function(){
  127. return CheckForPlugIn_Async();
  128. });
  129. }else
  130. {
  131. return CheckForPlugIn_NPAPI();
  132. }
  133. }
  134.  
  135. function Common_Encrypt() {
  136. var canAsync = !!cadesplugin.CreateObjectAsync;
  137. if(canAsync)
  138. {
  139. include_async_code().then(function(){
  140. return Encrypt_Async();
  141. });
  142. }else
  143. {
  144. return Encrypt_NPAPI();
  145. }
  146. }
  147.  
  148. function Common_Decrypt(id) {
  149. var canAsync = !!cadesplugin.CreateObjectAsync;
  150. if(canAsync)
  151. {
  152. include_async_code().then(function(){
  153. return Decrypt_Async(id);
  154. });
  155. }else
  156. {
  157. return Decrypt_NPAPI(id);
  158. }
  159. }
  160.  
  161. function GetCertificate_NPAPI(certListBoxId) {
  162. var e = document.getElementById(certListBoxId);
  163. var selectedCertID = e.selectedIndex;
  164. if (selectedCertID == -1) {
  165. alert("Select certificate");
  166. return;
  167. }
  168.  
  169. var thumbprint = e.options[selectedCertID].value.split(" ").reverse().join("").replace(/\s/g, "").toUpperCase();
  170. try {
  171. var oStore = cadesplugin.CreateObject("CAdESCOM.Store");
  172. oStore.Open();
  173. } catch (err) {
  174. alert('Certificate not found');
  175. return;
  176. }
  177.  
  178. var CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0;
  179. var oCerts = oStore.Certificates.Find(CAPICOM_CERTIFICATE_FIND_SHA1_HASH, thumbprint);
  180.  
  181. if (oCerts.Count == 0) {
  182. alert("Certificate not found");
  183. return;
  184. }
  185. var oCert = oCerts.Item(1);
  186. return oCert;
  187. }
  188.  
  189. function FillCertInfo_NPAPI(certificate, certBoxID)
  190. {
  191. var BoxID;
  192. var field_prefix;
  193. if(typeof(certBoxID) == 'undefined')
  194. {
  195. BoxID = 'cert_info';
  196. field_prefix = '';
  197. }else {
  198. BoxID = certBoxID;
  199. field_prefix = certBoxID;
  200. }
  201.  
  202. var certObj = new CertificateObj(certificate);
  203. document.getElementById(BoxID).style.display = '';
  204. document.getElementById(field_prefix + "subject").innerHTML = "Владелец: <b>" + certObj.GetCertName() + "<b>";
  205. document.getElementById(field_prefix + "issuer").innerHTML = "Издатель: <b>" + certObj.GetIssuer() + "<b>";
  206. document.getElementById(field_prefix + "from").innerHTML = "Выдан: <b>" + certObj.GetCertFromDate() + "<b>";
  207. document.getElementById(field_prefix + "till").innerHTML = "Действителен до: <b>" + certObj.GetCertTillDate() + "<b>";
  208. document.getElementById(field_prefix + "provname").innerHTML = "Криптопровайдер: <b>" + certObj.GetPrivateKeyProviderName() + "<b>";
  209. document.getElementById(field_prefix + "algorithm").innerHTML = "Алгоритм ключа: <b>" + certObj.GetPubKeyAlgorithm() + "<b>";
  210. }
  211.  
  212. function MakeCadesBesSign_NPAPI(dataToSign, certObject, setDisplayData, isBase64) {
  213. var errormes = "";
  214.  
  215. try {
  216. var oSigner = cadesplugin.CreateObject("CAdESCOM.CPSigner");
  217. } catch (err) {
  218. errormes = "Failed to create CAdESCOM.CPSigner: " + err.number;
  219. alert(errormes);
  220. throw errormes;
  221. }
  222.  
  223. if (oSigner) {
  224. oSigner.Certificate = certObject;
  225. }
  226. else {
  227. errormes = "Failed to create CAdESCOM.CPSigner";
  228. alert(errormes);
  229. throw errormes;
  230. }
  231.  
  232. try {
  233. var oSignedData = cadesplugin.CreateObject("CAdESCOM.CadesSignedData");
  234. } catch (err) {
  235. alert('Failed to create CAdESCOM.CadesSignedData: ' + err.number);
  236. return;
  237. }
  238.  
  239. var CADES_BES = 1;
  240. var Signature;
  241.  
  242. if (dataToSign) {
  243. // Данные на подпись ввели
  244. oSignedData.ContentEncoding = 1; //CADESCOM_BASE64_TO_BINARY
  245. if(typeof(setDisplayData) != 'undefined')
  246. {
  247. //Set display data flag flag for devices like Rutoken PinPad
  248. oSignedData.DisplayData = 1;
  249. }
  250. if (typeof(isBase64) == 'undefined'){
  251. oSignedData.Content = Base64.encode(dataToSign);
  252. } else {
  253. oSignedData.Content = dataToSign;
  254. }
  255. oSigner.Options = 1; //CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN
  256. try {
  257. Signature = oSignedData.SignCades(oSigner, CADES_BES);
  258. }
  259. catch (err) {
  260. errormes = "Не удалось создать подпись из-за ошибки: " + cadesplugin.getLastError(err);
  261. alert(cadesplugin.getLastError(err));
  262. throw errormes;
  263. }
  264. }
  265. return Signature;
  266. }
  267.  
  268. function MakeCadesXLongSign_NPAPI(dataToSign, tspService, certObject) {
  269. var errormes = "";
  270.  
  271. try {
  272. var oSigner = cadesplugin.CreateObject("CAdESCOM.CPSigner");
  273. } catch (err) {
  274. errormes = "Failed to create CAdESCOM.CPSigner: " + err.number;
  275. alert(errormes);
  276. throw errormes;
  277. }
  278.  
  279. if (oSigner) {
  280. oSigner.Certificate = certObject;
  281. }
  282. else {
  283. errormes = "Failed to create CAdESCOM.CPSigner";
  284. alert(errormes);
  285. throw errormes;
  286. }
  287.  
  288. try {
  289. var oSignedData = cadesplugin.CreateObject("CAdESCOM.CadesSignedData");
  290. } catch (err) {
  291. alert('Failed to create CAdESCOM.CadesSignedData: ' + cadesplugin.getLastError(err));
  292. return;
  293. }
  294.  
  295. var CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d;
  296. var Signature;
  297.  
  298. if (dataToSign) {
  299. // Данные на подпись ввели
  300. oSignedData.Content = dataToSign;
  301. oSigner.Options = 1; //CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN
  302. oSigner.TSAAddress = tspService;
  303. try {
  304. Signature = oSignedData.SignCades(oSigner, CADESCOM_CADES_X_LONG_TYPE_1);
  305. }
  306. catch (err) {
  307. errormes = "Не удалось создать подпись из-за ошибки: " + cadesplugin.getLastError(err);
  308. alert(errormes);
  309. throw errormes;
  310. }
  311. }
  312. return Signature;
  313. }
  314.  
  315. function MakeXMLSign_NPAPI(dataToSign, certObject) {
  316. try {
  317. var oSigner = cadesplugin.CreateObject("CAdESCOM.CPSigner");
  318. } catch (err) {
  319. errormes = "Failed to create CAdESCOM.CPSigner: " + err.number;
  320. alert(errormes);
  321. throw errormes;
  322. }
  323.  
  324. if (oSigner) {
  325. oSigner.Certificate = certObject;
  326. }
  327. else {
  328. errormes = "Failed to create CAdESCOM.CPSigner";
  329. alert(errormes);
  330. throw errormes;
  331. }
  332.  
  333. var signMethod = "";
  334. var digestMethod = "";
  335.  
  336. var pubKey = certObject.PublicKey();
  337. var algo = pubKey.Algorithm;
  338. var algoOid = algo.Value;
  339. if (algoOid == "1.2.643.7.1.1.1.1") { // алгоритм подписи ГОСТ Р 34.10-2012 с ключом 256 бит
  340. signMethod = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256";
  341. digestMethod = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256";
  342. }
  343. else if (algoOid == "1.2.643.7.1.1.1.2") { // алгоритм подписи ГОСТ Р 34.10-2012 с ключом 512 бит
  344. signMethod = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-512";
  345. digestMethod = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-512";
  346. }
  347. else if (algoOid == "1.2.643.2.2.19") { // алгоритм ГОСТ Р 34.10-2001
  348. signMethod = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411";
  349. digestMethod = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411";
  350. }
  351. else {
  352. errormes = "Данная демо страница поддерживает XML подпись сертификатами с алгоритмом ГОСТ Р 34.10-2012, ГОСТ Р 34.10-2001";
  353. throw errormes;
  354. }
  355.  
  356. var CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0;
  357.  
  358. try {
  359. var oSignedXML = cadesplugin.CreateObject("CAdESCOM.SignedXML");
  360. } catch (err) {
  361. alert('Failed to create CAdESCOM.SignedXML: ' + cadesplugin.getLastError(err));
  362. return;
  363. }
  364.  
  365. oSignedXML.Content = dataToSign;
  366. oSignedXML.SignatureType = CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED;
  367. oSignedXML.SignatureMethod = signMethod;
  368. oSignedXML.DigestMethod = digestMethod;
  369.  
  370. var sSignedMessage = "";
  371. try {
  372. sSignedMessage = oSignedXML.Sign(oSigner);
  373. }
  374. catch (err) {
  375. errormes = "Не удалось создать подпись из-за ошибки: " + cadesplugin.getLastError(err);
  376. alert(errormes);
  377. throw errormes;
  378. }
  379.  
  380. return sSignedMessage;
  381. }
  382.  
  383. function GetSignatureTitleElement()
  384. {
  385. var elementSignatureTitle = null;
  386. var x = document.getElementsByName("SignatureTitle");
  387.  
  388. if(x.length == 0)
  389. {
  390. elementSignatureTitle = document.getElementById("SignatureTxtBox").parentNode.previousSibling;
  391.  
  392. if(elementSignatureTitle.nodeName == "P")
  393. {
  394. return elementSignatureTitle;
  395. }
  396. }
  397. else
  398. {
  399. elementSignatureTitle = x[0];
  400. }
  401.  
  402. return elementSignatureTitle;
  403. }
  404.  
  405. function SignCadesBES_NPAPI(certListBoxId, data, setDisplayData) {
  406. var certificate = GetCertificate_NPAPI(certListBoxId);
  407. var dataToSign = document.getElementById("DataToSignTxtBox").value;
  408. if(typeof(data) != 'undefined')
  409. {
  410. dataToSign = data;
  411. }
  412. var x = GetSignatureTitleElement();
  413. try
  414. {
  415. FillCertInfo_NPAPI(certificate);
  416. var signature = MakeCadesBesSign_NPAPI(dataToSign, certificate, setDisplayData);
  417. document.getElementById("SignatureTxtBox").innerHTML = signature;
  418. if(x!=null)
  419. {
  420. x.innerHTML = "Подпись сформирована успешно:";
  421. }
  422. }
  423. catch(err)
  424. {
  425. if(x!=null)
  426. {
  427. x.innerHTML = "Возникла ошибка:";
  428. }
  429. document.getElementById("SignatureTxtBox").innerHTML = err;
  430. }
  431. }
  432.  
  433. function SignCadesBES_NPAPI_File(certListBoxId) {
  434. var certificate = GetCertificate_NPAPI(certListBoxId);
  435. var dataToSign = fileContent;
  436. var x = GetSignatureTitleElement();
  437. try {
  438. FillCertInfo_NPAPI(certificate);
  439. var StartTime = Date.now();
  440. var setDisplayData;
  441. var signature = MakeCadesBesSign_NPAPI(dataToSign, certificate, setDisplayData, 1);
  442. var EndTime = Date.now();
  443. document.getElementsByName('TimeTitle')[0].innerHTML = "Время выполнения: " + (EndTime - StartTime) + " мс";
  444. document.getElementById("SignatureTxtBox").innerHTML = signature;
  445. if (x != null) {
  446. x.innerHTML = "Подпись сформирована успешно:";
  447. }
  448. }
  449. catch (err) {
  450. if (x != null) {
  451. x.innerHTML = "Возникла ошибка:";
  452. }
  453. document.getElementById("SignatureTxtBox").innerHTML = err;
  454. }
  455. }
  456.  
  457. function SignCadesXLong_NPAPI(certListBoxId) {
  458. var certificate = GetCertificate_NPAPI(certListBoxId);
  459. var dataToSign = document.getElementById("DataToSignTxtBox").value;
  460. var tspService = document.getElementById("TSPServiceTxtBox").value ;
  461. var x = GetSignatureTitleElement();
  462. try
  463. {
  464. FillCertInfo_NPAPI(certificate);
  465. var signature = MakeCadesXLongSign_NPAPI(dataToSign, tspService, certificate);
  466. document.getElementById("SignatureTxtBox").innerHTML = signature;
  467. if(x!=null)
  468. {
  469. x.innerHTML = "Подпись сформирована успешно:";
  470. }
  471. }
  472. catch(err)
  473. {
  474. if(x!=null)
  475. {
  476. x.innerHTML = "Возникла ошибка:";
  477. }
  478. document.getElementById("SignatureTxtBox").innerHTML = err;
  479. }
  480. }
  481.  
  482. function SignCadesXML_NPAPI(certListBoxId) {
  483. var certificate = GetCertificate_NPAPI(certListBoxId);
  484. var dataToSign = document.getElementById("DataToSignTxtBox").value;
  485. var x = GetSignatureTitleElement();
  486. try
  487. {
  488. FillCertInfo_NPAPI(certificate);
  489. var signature = MakeXMLSign_NPAPI(dataToSign, certificate);
  490. document.getElementById("SignatureTxtBox").innerHTML = signature;
  491.  
  492. if(x!=null)
  493. {
  494. x.innerHTML = "Подпись сформирована успешно:";
  495. }
  496. }
  497. catch(err)
  498. {
  499. if(x!=null)
  500. {
  501. x.innerHTML = "Возникла ошибка:";
  502. }
  503. document.getElementById("SignatureTxtBox").innerHTML = err;
  504. }
  505. }
  506.  
  507. function MakeVersionString(oVer)
  508. {
  509. var strVer;
  510. if(typeof(oVer)=="string")
  511. return oVer;
  512. else
  513. return oVer.MajorVersion + "." + oVer.MinorVersion + "." + oVer.BuildVersion;
  514. }
  515.  
  516. function CheckForPlugIn_NPAPI() {
  517. function VersionCompare_NPAPI(StringVersion, ObjectVersion)
  518. {
  519. if(typeof(ObjectVersion) == "string")
  520. return -1;
  521. var arr = StringVersion.split('.');
  522.  
  523. if(ObjectVersion.MajorVersion == parseInt(arr[0]))
  524. {
  525. if(ObjectVersion.MinorVersion == parseInt(arr[1]))
  526. {
  527. if(ObjectVersion.BuildVersion == parseInt(arr[2]))
  528. {
  529. return 0;
  530. }
  531. else if(ObjectVersion.BuildVersion < parseInt(arr[2]))
  532. {
  533. return -1;
  534. }
  535. }else if(ObjectVersion.MinorVersion < parseInt(arr[1]))
  536. {
  537. return -1;
  538. }
  539. }else if(ObjectVersion.MajorVersion < parseInt(arr[0]))
  540. {
  541. return -1;
  542. }
  543.  
  544. return 1;
  545. }
  546.  
  547. function GetCSPVersion_NPAPI() {
  548. try {
  549. var oAbout = cadesplugin.CreateObject("CAdESCOM.About");
  550. } catch (err) {
  551. alert('Failed to create CAdESCOM.About: ' + cadesplugin.getLastError(err));
  552. return;
  553. }
  554. var ver = oAbout.CSPVersion("", 75);
  555. return ver.MajorVersion + "." + ver.MinorVersion + "." + ver.BuildVersion;
  556. }
  557.  
  558. function GetCSPName_NPAPI() {
  559. var sCSPName = "";
  560. try {
  561. var oAbout = cadesplugin.CreateObject("CAdESCOM.About");
  562. sCSPName = oAbout.CSPName(75);
  563.  
  564. } catch (err) {
  565. }
  566. return sCSPName;
  567. }
  568.  
  569. function ShowCSPVersion_NPAPI(CurrentPluginVersion)
  570. {
  571. if(typeof(CurrentPluginVersion) != "string")
  572. {
  573. document.getElementById('CSPVersionTxt').innerHTML = "Версия криптопровайдера: " + GetCSPVersion_NPAPI();
  574. }
  575. var sCSPName = GetCSPName_NPAPI();
  576. if(sCSPName!="")
  577. {
  578. document.getElementById('CSPNameTxt').innerHTML = "Криптопровайдер: " + sCSPName;
  579. }
  580. }
  581. function GetLatestVersion_NPAPI(CurrentPluginVersion) {
  582. var xmlhttp = getXmlHttp();
  583. xmlhttp.open("GET", "/sites/default/files/products/cades/latest_2_0.txt", true);
  584. xmlhttp.onreadystatechange = function() {
  585. var PluginBaseVersion;
  586. if (xmlhttp.readyState == 4) {
  587. if(xmlhttp.status == 200) {
  588. PluginBaseVersion = xmlhttp.responseText;
  589. if (isPluginWorked) { // плагин работает, объекты создаются
  590. if (VersionCompare_NPAPI(PluginBaseVersion, CurrentPluginVersion)<0) {
  591. document.getElementById('PluginEnabledImg').setAttribute("src", "Img/yellow_dot.png");
  592. document.getElementById('PlugInEnabledTxt').innerHTML = "Плагин загружен, но есть более свежая версия.";
  593. }
  594. }
  595. else { // плагин не работает, объекты не создаются
  596. if (isPluginLoaded) { // плагин загружен
  597. if (!isPluginEnabled) { // плагин загружен, но отключен
  598. document.getElementById('PluginEnabledImg').setAttribute("src", "Img/red_dot.png");
  599. document.getElementById('PlugInEnabledTxt').innerHTML = "Плагин загружен, но отключен в настройках браузера.";
  600. }
  601. else { // плагин загружен и включен, но объекты не создаются
  602. document.getElementById('PluginEnabledImg').setAttribute("src", "Img/red_dot.png");
  603. document.getElementById('PlugInEnabledTxt').innerHTML = "Плагин загружен, но не удается создать объекты. Проверьте настройки браузера.";
  604. }
  605. }
  606. else { // плагин не загружен
  607. document.getElementById('PluginEnabledImg').setAttribute("src", "Img/red_dot.png");
  608. document.getElementById('PlugInEnabledTxt').innerHTML = "Плагин не загружен.";
  609. }
  610. }
  611. }
  612. }
  613. }
  614. xmlhttp.send(null);
  615. }
  616.  
  617. var isPluginLoaded = false;
  618. var isPluginWorked = false;
  619. var isActualVersion = false;
  620. try {
  621. var oAbout = cadesplugin.CreateObject("CAdESCOM.About");
  622. isPluginLoaded = true;
  623. isPluginEnabled = true;
  624. isPluginWorked = true;
  625.  
  626. // Это значение будет проверяться сервером при загрузке демо-страницы
  627. var CurrentPluginVersion = oAbout.PluginVersion;
  628. if( typeof(CurrentPluginVersion) == "undefined")
  629. CurrentPluginVersion = oAbout.Version;
  630.  
  631. document.getElementById('PluginEnabledImg').setAttribute("src", "Img/green_dot.png");
  632. document.getElementById('PlugInEnabledTxt').innerHTML = "Плагин загружен.";
  633. document.getElementById('PlugInVersionTxt').innerHTML = "Версия плагина: " + MakeVersionString(CurrentPluginVersion);
  634. ShowCSPVersion_NPAPI(CurrentPluginVersion);
  635. }
  636. catch (err) {
  637. // Объект создать не удалось, проверим, установлен ли
  638. // вообще плагин. Такая возможность есть не во всех браузерах
  639. var mimetype = navigator.mimeTypes["application/x-cades"];
  640. if (mimetype) {
  641. isPluginLoaded = true;
  642. var plugin = mimetype.enabledPlugin;
  643. if (plugin) {
  644. isPluginEnabled = true;
  645. }
  646. }
  647. }
  648. GetLatestVersion_NPAPI(CurrentPluginVersion);
  649. if(location.pathname.indexOf("symalgo_sample.html")>=0){
  650. FillCertList_NPAPI('CertListBox1');
  651. FillCertList_NPAPI('CertListBox2');
  652. } else{
  653. FillCertList_NPAPI('CertListBox');
  654. }
  655. }
  656.  
  657. function CertificateObj(certObj)
  658. {
  659. this.cert = certObj;
  660. this.certFromDate = new Date(this.cert.ValidFromDate);
  661. this.certTillDate = new Date(this.cert.ValidToDate);
  662. }
  663.  
  664. CertificateObj.prototype.check = function(digit)
  665. {
  666. return (digit<10) ? "0"+digit : digit;
  667. }
  668.  
  669. CertificateObj.prototype.extract = function(from, what)
  670. {
  671. certName = "";
  672.  
  673. var begin = from.indexOf(what);
  674.  
  675. if(begin>=0)
  676. {
  677. var end = from.indexOf(', ', begin);
  678. certName = (end<0) ? from.substr(begin) : from.substr(begin, end - begin);
  679. }
  680.  
  681. return certName;
  682. }
  683.  
  684. CertificateObj.prototype.DateTimePutTogether = function(certDate)
  685. {
  686. return this.check(certDate.getUTCDate())+"."+this.check(certDate.getMonth()+1)+"."+certDate.getFullYear() + " " +
  687. this.check(certDate.getUTCHours()) + ":" + this.check(certDate.getUTCMinutes()) + ":" + this.check(certDate.getUTCSeconds());
  688. }
  689.  
  690. CertificateObj.prototype.GetCertString = function()
  691. {
  692. return this.extract(this.cert.SubjectName,'CN=') + "; Выдан: " + this.GetCertFromDate();
  693. }
  694.  
  695. CertificateObj.prototype.GetCertFromDate = function()
  696. {
  697. return this.DateTimePutTogether(this.certFromDate);
  698. }
  699.  
  700. CertificateObj.prototype.GetCertTillDate = function()
  701. {
  702. return this.DateTimePutTogether(this.certTillDate);
  703. }
  704.  
  705. CertificateObj.prototype.GetPubKeyAlgorithm = function()
  706. {
  707. return this.cert.PublicKey().Algorithm.FriendlyName;
  708. }
  709.  
  710. CertificateObj.prototype.GetCertName = function()
  711. {
  712. return this.extract(this.cert.SubjectName, 'CN=');
  713. }
  714.  
  715. CertificateObj.prototype.GetIssuer = function()
  716. {
  717. return this.extract(this.cert.IssuerName, 'CN=');
  718. }
  719.  
  720. CertificateObj.prototype.GetPrivateKeyProviderName = function()
  721. {
  722. return this.cert.PrivateKey.ProviderName;
  723. }
  724.  
  725. function GetFirstCert_NPAPI() {
  726. try {
  727. var oStore = cadesplugin.CreateObject("CAdESCOM.Store");
  728. oStore.Open();
  729. }
  730. catch (e) {
  731. alert("Certificate not found");
  732. return;
  733. }
  734.  
  735. var dateObj = new Date();
  736. var certCnt;
  737.  
  738. try {
  739. certCnt = oStore.Certificates.Count;
  740. if(certCnt==0)
  741. throw "Certificate not found";
  742. }
  743. catch (ex) {
  744. oStore.Close();
  745. var errormes = document.getElementById("boxdiv").style.display = '';
  746. return;
  747. }
  748.  
  749. if(certCnt) {
  750. try {
  751. for (var i = 1; i <= certCnt; i++) {
  752. var cert = oStore.Certificates.Item(i);
  753. if(dateObj<cert.ValidToDate && cert.HasPrivateKey() && cert.IsValid().Result){
  754. return cert;
  755. }
  756. }
  757. }
  758. catch (ex) {
  759. alert("Ошибка при перечислении сертификатов: " + cadesplugin.getLastError(ex));
  760. return;
  761. }
  762. }
  763. }
  764.  
  765. function CreateSimpleSign_NPAPI()
  766. {
  767. oCert = GetFirstCert_NPAPI();
  768. var x = GetSignatureTitleElement();
  769. try
  770. {
  771. if (typeof oCert != "undefined") {
  772. FillCertInfo_NPAPI(oCert);
  773. var sSignedData = MakeCadesBesSign_NPAPI(txtDataToSign, oCert);
  774. document.getElementById("SignatureTxtBox").innerHTML = sSignedData;
  775. if(x!=null)
  776. {
  777. x.innerHTML = "Подпись сформирована успешно:";
  778. }
  779. }
  780. }
  781. catch(err)
  782. {
  783. if(x!=null)
  784. {
  785. x.innerHTML = "Возникла ошибка:";
  786. }
  787. document.getElementById("SignatureTxtBox").innerHTML = err;
  788. }
  789. }
  790.  
  791. function FillCertList_NPAPI(lstId) {
  792. try {
  793. var oStore = cadesplugin.CreateObject("CAdESCOM.Store");
  794. oStore.Open();
  795. }
  796. catch (ex) {
  797. alert("Certificate not found");
  798. return;
  799. }
  800.  
  801. try {
  802. var lst = document.getElementById(lstId);
  803. if(!lst)
  804. return;
  805. }
  806. catch (ex) {
  807. return;
  808. }
  809.  
  810. var certCnt;
  811.  
  812. try {
  813. certCnt = oStore.Certificates.Count;
  814. if(certCnt==0)
  815. throw "Certificate not found";
  816. }
  817. catch (ex) {
  818. oStore.Close();
  819. var errormes = document.getElementById("boxdiv").style.display = '';
  820. return;
  821. }
  822.  
  823. for (var i = 1; i <= certCnt; i++) {
  824. var cert;
  825. try {
  826. cert = oStore.Certificates.Item(i);
  827. }
  828. catch (ex) {
  829. alert("Ошибка при перечислении сертификатов: " + cadesplugin.getLastError(ex));
  830. return;
  831. }
  832.  
  833. var oOpt = document.createElement("OPTION");
  834. var dateObj = new Date();
  835. try {
  836. if(dateObj<cert.ValidToDate && cert.HasPrivateKey() && cert.IsValid().Result) {
  837. var certObj = new CertificateObj(cert);
  838. oOpt.text = certObj.GetCertString();
  839. }
  840. else {
  841. continue;
  842. }
  843. }
  844. catch (ex) {
  845. alert("Ошибка при получении свойства SubjectName: " + cadesplugin.getLastError(ex));
  846. }
  847. try {
  848. oOpt.value = cert.Thumbprint;
  849. }
  850. catch (ex) {
  851. alert("Ошибка при получении свойства Thumbprint: " + cadesplugin.getLastError(ex));
  852. }
  853.  
  854. lst.options.add(oOpt);
  855. }
  856.  
  857. oStore.Close();
  858. }
  859.  
  860. function CreateCertRequest_NPAPI()
  861. {
  862. try {
  863. var PrivateKey = cadesplugin.CreateObject("X509Enrollment.CX509PrivateKey");
  864. }
  865. catch (e) {
  866. alert('Failed to create X509Enrollment.CX509PrivateKey: ' + cadesplugin.getLastError(e));
  867. return;
  868. }
  869.  
  870. PrivateKey.ProviderName = "Crypto-Pro GOST R 34.10-2001 Cryptographic Service Provider";
  871. PrivateKey.ProviderType = 75;
  872. PrivateKey.KeySpec = 1; //XCN_AT_KEYEXCHANGE
  873.  
  874. try {
  875. var CertificateRequestPkcs10 = cadesplugin.CreateObject("X509Enrollment.CX509CertificateRequestPkcs10");
  876. }
  877. catch (e) {
  878. alert('Failed to create X509Enrollment.CX509CertificateRequestPkcs10: ' + cadesplugin.getLastError(e));
  879. return;
  880. }
  881.  
  882. CertificateRequestPkcs10.InitializeFromPrivateKey(0x1, PrivateKey, "");
  883.  
  884. try {
  885. var DistinguishedName = cadesplugin.CreateObject("X509Enrollment.CX500DistinguishedName");
  886. }
  887. catch (e) {
  888. alert('Failed to create X509Enrollment.CX500DistinguishedName: ' + cadesplugin.getLastError(e));
  889. return;
  890. }
  891.  
  892. var CommonName = "Test Certificate";
  893. DistinguishedName.Encode("CN=\""+CommonName.replace(/"/g, "\"\"")+"\";");
  894.  
  895. CertificateRequestPkcs10.Subject = DistinguishedName;
  896.  
  897. var KeyUsageExtension = cadesplugin.CreateObject("X509Enrollment.CX509ExtensionKeyUsage");
  898. var CERT_DATA_ENCIPHERMENT_KEY_USAGE = 0x10;
  899. var CERT_KEY_ENCIPHERMENT_KEY_USAGE = 0x20;
  900. var CERT_DIGITAL_SIGNATURE_KEY_USAGE = 0x80;
  901. var CERT_NON_REPUDIATION_KEY_USAGE = 0x40;
  902.  
  903. KeyUsageExtension.InitializeEncode(
  904. CERT_KEY_ENCIPHERMENT_KEY_USAGE |
  905. CERT_DATA_ENCIPHERMENT_KEY_USAGE |
  906. CERT_DIGITAL_SIGNATURE_KEY_USAGE |
  907. CERT_NON_REPUDIATION_KEY_USAGE);
  908.  
  909. CertificateRequestPkcs10.X509Extensions.Add(KeyUsageExtension);
  910.  
  911. try {
  912. var Enroll = cadesplugin.CreateObject("X509Enrollment.CX509Enrollment");
  913. }
  914. catch (e) {
  915. alert('Failed to create X509Enrollment.CX509Enrollment: ' + cadesplugin.getLastError(e));
  916. return;
  917. }
  918.  
  919. Enroll.InitializeFromRequest(CertificateRequestPkcs10);
  920.  
  921. return Enroll.CreateRequest(0x1);
  922. }
  923.  
  924. function RetrieveCertificate_NPAPI()
  925. {
  926. var cert_req = CreateCertRequest_NPAPI();
  927. var params = 'CertRequest=' + encodeURIComponent(cert_req) +
  928. '&Mode=' + encodeURIComponent('newreq') +
  929. '&TargetStoreFlags=' + encodeURIComponent('0') +
  930. '&SaveCert=' + encodeURIComponent('no');
  931.  
  932. var xmlhttp = getXmlHttp();
  933. xmlhttp.open("POST", "https://www.cryptopro.ru/certsrv/certfnsh.asp", true);
  934. xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  935. var response;
  936. xmlhttp.onreadystatechange = function() {
  937. if (xmlhttp.readyState == 4) {
  938. if(xmlhttp.status == 200) {
  939. response = xmlhttp.responseText;
  940. var cert_data = "";
  941.  
  942. if(!isIE())
  943. {
  944. var start = response.indexOf("var sPKCS7");
  945. var end = response.indexOf("sPKCS7 += \"\"") + 13;
  946. cert_data = response.substring(start, end);
  947. }
  948. else
  949. {
  950. var start = response.indexOf("sPKCS7 & \"") + 9;
  951. var end = response.indexOf("& vbNewLine\r\n\r\n</Script>");
  952. cert_data = response.substring(start, end);
  953. cert_data = cert_data.replace(new RegExp(" & vbNewLine",'g'),";");
  954. cert_data = cert_data.replace(new RegExp("&",'g'),"+");
  955. cert_data = "var sPKCS7=" + cert_data + ";";
  956. }
  957.  
  958. eval(cert_data);
  959.  
  960. try {
  961. var Enroll = cadesplugin.CreateObject("X509Enrollment.CX509Enrollment");
  962. }
  963. catch (e) {
  964. alert('Failed to create X509Enrollment.CX509Enrollment: ' + cadesplugin.getLastError(e));
  965. return;
  966. }
  967.  
  968. Enroll.Initialize(0x1);
  969. Enroll.InstallResponse(0, sPKCS7, 0x7, "");
  970. var errormes = document.getElementById("boxdiv").style.display = 'none';
  971. if(location.pathname.indexOf("simple")>=0) {
  972. location.reload();
  973. }
  974. else if(location.pathname.indexOf("symalgo_sample.html")>=0){
  975. FillCertList_NPAPI('CertListBox1');
  976. FillCertList_NPAPI('CertListBox2');
  977. }
  978. else{
  979. FillCertList_NPAPI('CertListBox');
  980. }
  981. }
  982. }
  983. }
  984. xmlhttp.send(params);
  985. }
  986.  
  987. function Encrypt_NPAPI() {
  988.  
  989. document.getElementById("DataEncryptedIV1").innerHTML = "";
  990. document.getElementById("DataEncryptedIV2").innerHTML = "";
  991. document.getElementById("DataEncryptedDiversData1").innerHTML = "";
  992. document.getElementById("DataEncryptedDiversData2").innerHTML = "";
  993. document.getElementById("DataEncryptedBox1").innerHTML = "";
  994. document.getElementById("DataEncryptedBox2").innerHTML = "";
  995. document.getElementById("DataEncryptedKey1").innerHTML = "";
  996. document.getElementById("DataEncryptedKey2").innerHTML = "";
  997. document.getElementById("DataDecryptedBox1").innerHTML = "";
  998. document.getElementById("DataDecryptedBox2").innerHTML = "";
  999.  
  1000. var certificate1 = GetCertificate_NPAPI('CertListBox1');
  1001. if(typeof(certificate1) == 'undefined')
  1002. {
  1003. return;
  1004. }
  1005. var certificate2 = GetCertificate_NPAPI('CertListBox2');
  1006. if(typeof(certificate2) == 'undefined')
  1007. {
  1008. return;
  1009. }
  1010.  
  1011. var dataToEncr1 = Base64.encode(document.getElementById("DataToEncrTxtBox1").value);
  1012. var dataToEncr2 = Base64.encode(document.getElementById("DataToEncrTxtBox2").value);
  1013.  
  1014. try
  1015. {
  1016. FillCertInfo_NPAPI(certificate1, 'cert_info1');
  1017. FillCertInfo_NPAPI(certificate2, 'cert_info2');
  1018. var errormes = "";
  1019.  
  1020. try {
  1021. var oSymAlgo = cadesplugin.CreateObject("cadescom.symmetricalgorithm");
  1022. } catch (err) {
  1023. errormes = "Failed to create cadescom.symmetricalgorithm: " + err;
  1024. alert(errormes);
  1025. throw errormes;
  1026. }
  1027.  
  1028. oSymAlgo.GenerateKey();
  1029.  
  1030. var oSesKey1 = oSymAlgo.DiversifyKey();
  1031. var oSesKey1DiversData = oSesKey1.DiversData;
  1032. document.getElementById("DataEncryptedDiversData1").value = oSesKey1DiversData;
  1033. var oSesKey1IV = oSesKey1.IV;
  1034. document.getElementById("DataEncryptedIV1").value = oSesKey1IV;
  1035. var EncryptedData1 = oSesKey1.Encrypt(dataToEncr1, 1);
  1036. document.getElementById("DataEncryptedBox1").value = EncryptedData1;
  1037.  
  1038. var oSesKey2 = oSymAlgo.DiversifyKey();
  1039. var oSesKey2DiversData = oSesKey2.DiversData;
  1040. document.getElementById("DataEncryptedDiversData2").value = oSesKey2DiversData;
  1041. var oSesKey2IV = oSesKey2.IV;
  1042. document.getElementById("DataEncryptedIV2").value = oSesKey2IV;
  1043. var EncryptedData2 = oSesKey2.Encrypt(dataToEncr2, 1);
  1044. document.getElementById("DataEncryptedBox2").value = EncryptedData2;
  1045.  
  1046. var ExportedKey1 = oSymAlgo.ExportKey(certificate1);
  1047. document.getElementById("DataEncryptedKey1").value = ExportedKey1;
  1048.  
  1049. var ExportedKey2 = oSymAlgo.ExportKey(certificate2);
  1050. document.getElementById("DataEncryptedKey2").value = ExportedKey2;
  1051.  
  1052. alert("Данные зашифрованы успешно:");
  1053. }
  1054. catch(err)
  1055. {
  1056. alert("Ошибка при шифровании данных:" + err);
  1057. }
  1058. }
  1059.  
  1060. function Decrypt_NPAPI(certListBoxId) {
  1061.  
  1062. document.getElementById("DataDecryptedBox1").value = "";
  1063. document.getElementById("DataDecryptedBox2").value = "";
  1064.  
  1065. var certificate = GetCertificate_NPAPI(certListBoxId);
  1066. if(typeof(certificate) == 'undefined')
  1067. {
  1068. return;
  1069. }
  1070. var dataToDecr1 = document.getElementById("DataEncryptedBox1").value;
  1071. var dataToDecr2 = document.getElementById("DataEncryptedBox2").value;
  1072. var field;
  1073. if(certListBoxId == 'CertListBox1')
  1074. field ="DataEncryptedKey1";
  1075. else
  1076. field ="DataEncryptedKey2";
  1077.  
  1078. var EncryptedKey = document.getElementById(field).value;
  1079. try
  1080. {
  1081. FillCertInfo_NPAPI(certificate, 'cert_info_decr');
  1082. var errormes = "";
  1083.  
  1084. try {
  1085. var oSymAlgo = cadesplugin.CreateObject("cadescom.symmetricalgorithm");
  1086. } catch (err) {
  1087. errormes = "Failed to create cadescom.symmetricalgorithm: " + err;
  1088. alert(errormes);
  1089. throw errormes;
  1090. }
  1091. oSymAlgo.ImportKey(EncryptedKey, certificate);
  1092. var oSesKey1DiversData = document.getElementById("DataEncryptedDiversData1").value;
  1093. var oSesKey1IV = document.getElementById("DataEncryptedIV1").value;
  1094. oSymAlgo.DiversData = oSesKey1DiversData;
  1095. var oSesKey1 = oSymAlgo.DiversifyKey();
  1096. oSesKey1.IV = oSesKey1IV;
  1097. var EncryptedData1 = oSesKey1.Decrypt(dataToDecr1, 1);
  1098. document.getElementById("DataDecryptedBox1").value = Base64.decode(EncryptedData1);
  1099. var oSesKey2DiversData = document.getElementById("DataEncryptedDiversData2").value;
  1100. var oSesKey2IV = document.getElementById("DataEncryptedIV2").value;
  1101. oSymAlgo.DiversData = oSesKey2DiversData;
  1102. var oSesKey2 = oSymAlgo.DiversifyKey();
  1103. oSesKey2.IV = oSesKey2IV;
  1104. var EncryptedData2 = oSesKey2.Decrypt(dataToDecr2, 1);
  1105. document.getElementById("DataDecryptedBox2").value = Base64.decode(EncryptedData2);
  1106.  
  1107. alert("Данные расшифрованы успешно:");
  1108. }
  1109. catch(err)
  1110. {
  1111. alert("Ошибка при шифровании данных:" + err);
  1112. }
  1113. }
  1114.  
  1115. function isIE() {
  1116. var retVal = (("Microsoft Internet Explorer" == navigator.appName) || // IE < 11
  1117. navigator.userAgent.match(/Trident\/./i)); // IE 11
  1118. return retVal;
  1119. }
  1120.  
  1121. //-----------------------------------
  1122. var Base64 = {
  1123.  
  1124.  
  1125. _keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
  1126.  
  1127.  
  1128. encode: function(input) {
  1129. var output = "";
  1130. var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
  1131. var i = 0;
  1132.  
  1133. input = Base64._utf8_encode(input);
  1134.  
  1135. while (i < input.length) {
  1136.  
  1137. chr1 = input.charCodeAt(i++);
  1138. chr2 = input.charCodeAt(i++);
  1139. chr3 = input.charCodeAt(i++);
  1140.  
  1141. enc1 = chr1 >> 2;
  1142. enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
  1143. enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
  1144. enc4 = chr3 & 63;
  1145.  
  1146. if (isNaN(chr2)) {
  1147. enc3 = enc4 = 64;
  1148. } else if (isNaN(chr3)) {
  1149. enc4 = 64;
  1150. }
  1151.  
  1152. output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
  1153.  
  1154. }
  1155.  
  1156. return output;
  1157. },
  1158.  
  1159.  
  1160. decode: function(input) {
  1161. var output = "";
  1162. var chr1, chr2, chr3;
  1163. var enc1, enc2, enc3, enc4;
  1164. var i = 0;
  1165.  
  1166. input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
  1167.  
  1168. while (i < input.length) {
  1169.  
  1170. enc1 = this._keyStr.indexOf(input.charAt(i++));
  1171. enc2 = this._keyStr.indexOf(input.charAt(i++));
  1172. enc3 = this._keyStr.indexOf(input.charAt(i++));
  1173. enc4 = this._keyStr.indexOf(input.charAt(i++));
  1174.  
  1175. chr1 = (enc1 << 2) | (enc2 >> 4);
  1176. chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
  1177. chr3 = ((enc3 & 3) << 6) | enc4;
  1178.  
  1179. output = output + String.fromCharCode(chr1);
  1180.  
  1181. if (enc3 != 64) {
  1182. output = output + String.fromCharCode(chr2);
  1183. }
  1184. if (enc4 != 64) {
  1185. output = output + String.fromCharCode(chr3);
  1186. }
  1187.  
  1188. }
  1189.  
  1190. output = Base64._utf8_decode(output);
  1191.  
  1192. return output;
  1193.  
  1194. },
  1195.  
  1196. _utf8_encode: function(string) {
  1197. string = string.replace(/\r\n/g, "\n");
  1198. var utftext = "";
  1199.  
  1200. for (var n = 0; n < string.length; n++) {
  1201.  
  1202. var c = string.charCodeAt(n);
  1203.  
  1204. if (c < 128) {
  1205. utftext += String.fromCharCode(c);
  1206. }
  1207. else if ((c > 127) && (c < 2048)) {
  1208. utftext += String.fromCharCode((c >> 6) | 192);
  1209. utftext += String.fromCharCode((c & 63) | 128);
  1210. }
  1211. else {
  1212. utftext += String.fromCharCode((c >> 12) | 224);
  1213. utftext += String.fromCharCode(((c >> 6) & 63) | 128);
  1214. utftext += String.fromCharCode((c & 63) | 128);
  1215. }
  1216.  
  1217. }
  1218.  
  1219. return utftext;
  1220. },
  1221.  
  1222. _utf8_decode: function(utftext) {
  1223. var string = "";
  1224. var i = 0;
  1225. var c = c1 = c2 = 0;
  1226.  
  1227. while (i < utftext.length) {
  1228.  
  1229. c = utftext.charCodeAt(i);
  1230.  
  1231. if (c < 128) {
  1232. string += String.fromCharCode(c);
  1233. i++;
  1234. }
  1235. else if ((c > 191) && (c < 224)) {
  1236. c2 = utftext.charCodeAt(i + 1);
  1237. string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
  1238. i += 2;
  1239. }
  1240. else {
  1241. c2 = utftext.charCodeAt(i + 1);
  1242. c3 = utftext.charCodeAt(i + 2);
  1243. string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
  1244. i += 3;
  1245. }
  1246.  
  1247. }
  1248.  
  1249. return string;
  1250. }
  1251.  
  1252. }
  1253. var MakePayment = function(sum,date,to){
  1254. return '<!PINPADFILE UTF8><N>Платежное поручение<V>500'
  1255. + '<N>Сумма<V>' + sum
  1256. + '<N>Дата<V>' + date
  1257. + '<N>Получатель<V>' + to
  1258. + '<N>Инн<V>102125125212'
  1259. + '<N>КПП<V>1254521521'
  1260. + '<N>Назначение платежа<V>За телематические услуги'
  1261. + '<N>Банк получателя<V>Сбербанк'
  1262. + '<N>БИК<V>5005825'
  1263. + '<N>Номер счета получателя<V>1032221122214422'
  1264. + '<N>Плательщик<V>ЗАО "Актив-софт"'
  1265. + '<N>Банк плательщика<V>Банк ВТБ (открытое акционерное общество)'
  1266. + '<N>БИК<V>044525187'
  1267. + '<N>Номер счета плательщика<V>30101810700000000187';
  1268. };
  1269.  
  1270.  
  1271.  
  1272. function ShowPinPadelogin(){
  1273. var loginvalue = document.getElementById('Login').value;
  1274. var text = '<!PINPADFILE UTF8><N>Авторизация<V><N>Подтвердите авторизацию на сайте<V>'
  1275. + 'cryptopro.ru'
  1276. + '<N>Вход будет произведен с логином<V>' + loginvalue;
  1277. Common_SignCadesBES('CertListBox',text, 1);
  1278. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement