@ganwei-web/ganwei-pc-cli 6.2.1 → 6.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ganwei-app-6.2.1/.nvmrc +1 -0
- package/ganwei-app-6.2.1/moduleConfiguration/.editorconfig +22 -0
- package/ganwei-app-6.2.1/moduleConfiguration/.env.development +23 -0
- package/ganwei-app-6.2.1/moduleConfiguration/.env.local.config +8 -0
- package/ganwei-app-6.2.1/moduleConfiguration/.env.production +29 -0
- package/ganwei-app-6.2.1/moduleConfiguration/.env.test +22 -0
- package/ganwei-app-6.2.1/moduleConfiguration/.eslintignore +13 -0
- package/ganwei-app-6.2.1/moduleConfiguration/.eslintrc.cjs +178 -0
- package/ganwei-app-6.2.1/moduleConfiguration/.prettierignore +13 -0
- package/ganwei-app-6.2.1/moduleConfiguration/.prettierrc.cjs +37 -0
- package/ganwei-app-6.2.1/moduleConfiguration/cleanNodeModule.js +16 -0
- package/ganwei-app-6.2.1/moduleConfiguration/copyFile.js +127 -0
- package/ganwei-app-6.2.1/moduleConfiguration/filterStatic.js +65 -0
- package/ganwei-app-6.2.1/moduleConfiguration/init.js +42 -0
- package/ganwei-app-6.2.1/moduleConfiguration/moduleConfiguration.json +17 -0
- package/ganwei-app-6.2.1/package.json +41 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/.babelrc +4 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/.editorconfig +22 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/.env.development +23 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/.env.production +29 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/.env.test +22 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/.eslintignore +13 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/.eslintrc.cjs +178 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/.prettierignore +13 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/.prettierrc.cjs +37 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/auto-imports.d.ts +5 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/build/banner.js +9 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/build/build-version.js +42 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/build/bulidList.js +26 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/build/enteryJson.js +108 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/build/filterStatic.js +64 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/build/init.js +27 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/build/look-dir.js +24 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/build/rollup-options.js +35 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/build/test.js +3 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/build/vite-plugin-stats-html.js +595 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/components.d.ts +20 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/env.d.ts +7 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/index.html +20 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/package-lock.json +3965 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/package.json +69 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/pnpm-lock.yaml +5034 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/public/static/css/index-plus-vars.css +93 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/public/static/css/index-plus.css +1 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/public/static/css/index.css +15926 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/public/static/css/pptxjs.css +161 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/public/static/font/iconfont.css +1135 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/public/static/font/iconfont.js +1 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/public/static/font/iconfont.json +1969 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/public/static/font/iconfont.ttf +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/public/static/font/iconfont.woff +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/public/static/font/iconfont.woff2 +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/public/static/language/en-US/noPage.json +3 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/public/static/language/zh-CN/noPage.json +3 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/public/static/language/zh-HK/noPage.json +3 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/public/static/themes/dark.css +77 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/public/static/themes/default-theme.js +34 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/public/static/themes/light.css +79 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/App.vue +198 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/assets/css/.sass-cache/59ae6c3370e48597956c7d0775238711a2c22a84/index.scssc +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/assets/css/.sass-cache/59ae6c3370e48597956c7d0775238711a2c22a84/linkSetting.scssc +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/assets/css/.sass-cache/59ae6c3370e48597956c7d0775238711a2c22a84/sceneSetting.scssc +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/assets/css/.sass-cache/59ae6c3370e48597956c7d0775238711a2c22a84/specialTask.scssc +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/assets/css/.sass-cache/59ae6c3370e48597956c7d0775238711a2c22a84/style.scssc +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/assets/css/.sass-cache/59ae6c3370e48597956c7d0775238711a2c22a84/weekTask.scssc +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/assets/css/VideoSystem.scss +397 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/assets/css/el-dialog.scss +58 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/assets/css/el-drawer.scss +41 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/assets/css/index.scss +1052 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/assets/css/login.scss +320 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/assets/css/mobileStyle.scss +332 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/assets/css/noDataTips.scss +57 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/assets/css/reset.scss +1192 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/assets/css/style-black.scss +1 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/assets/css/style-white.scss +1 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/assets/css/style.scss +633 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/assets/css/videoPlaybackCom.scss +468 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/assets/css/videoPlayer.scss +441 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/assets/images/logo.png +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/assets/plugins/encrypt.js +122 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/components/appFrame/appFrame.vue +163 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/components/appFrame/bottom.vue +15 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/components/appFrame/css/bottom.scss +381 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/components/appFrame/css/top.scss +49 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/components/appFrame/js/Voice.js +345 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/components/appFrame/js/bottom.js +102 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/components/appFrame/top.vue +114 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/components/i18n/i18n.js +42 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/components/i18n/i18nObserver.js +39 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/components/i18n/vueI18n.js +17 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/components/toast/index.js +64 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/components/toast/index.vue +152 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/hostMap.js +9 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/main.js +39 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/request/api/Auth.js +83 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/request/api/BA.js +81 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/request/api/EquipList.js +127 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/request/api/Event.js +34 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/request/api/GwEcharts.js +9 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/request/api/PPT.js +5 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/request/api/RealTime.js +43 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/request/api/SystemConfig.js +177 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/request/api/Video.js +57 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/request/api/VideoTour.js +129 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/request/api/WelcomeWord.js +24 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/request/api/WorkOrder.js +265 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/request/api/videoSystem.js +81 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/request/api.js +35 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/request/apiFunction.js +200 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/request/encrypt.js +14 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/request/http.js +186 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/router.js +31 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/store.js +189 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/types.js +16 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/utils/formValidate.js +25 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/utils/isApp.js +18 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/utils/language.js +45 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/utils/myUtils.js +643 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/utils/timeFormat.js +23 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/utils/timesYMDHMS.js +27 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/src/views/ganwei-app-empty-page/src/noPage.vue +22 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/stats.html +356 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/vite.base.config.js +244 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-empty-page/vite.config.ts +44 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/.babelrc +4 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/.editorconfig +22 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/.env.development +23 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/.env.production +29 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/.env.test +22 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/.eslintignore +13 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/.eslintrc.cjs +178 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/.prettierignore +13 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/.prettierrc.cjs +37 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/.stylelintrc.cjs +18 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/auto-imports.d.ts +56 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/components.d.ts +25 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/env.d.ts +21 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/index.html +20 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/package.json +87 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/public/static/language/en-US/home.json +39 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/public/static/language/zh-CN/home.json +39 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/public/static/language/zh-HK/home.json +39 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/App.vue +203 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/assets/images/logo.png +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/components/Layout/TitleList.vue +20 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/enums/index.ts +24 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/main.ts +29 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/models/index.ts +91 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/request/api/RealTime.ts +27 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/request/api.ts +5 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/router.ts +30 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/store.js +189 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/types.js +16 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/views/ganwei-app-home/src/components/HomeMenuItem.vue +95 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/views/ganwei-app-home/src/components/HomeMenus.vue +118 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/views/ganwei-app-home/src/components/HomeMenusEditDrawer.vue +119 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/views/ganwei-app-home/src/components/HomeSnapshots.vue +109 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/views/ganwei-app-home/src/components/chatbot.vue +96 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/views/ganwei-app-home/src/components/eslint.config.js +10 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/views/ganwei-app-home/src/css/index.scss +5 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/views/ganwei-app-home/src/img/chatbot.gif +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/views/ganwei-app-home/src/img/six.png +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/views/ganwei-app-home/src/index.vue +42 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/views/ganwei-app-home/src/js/useLanguageStyle.ts +21 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/views/ganwei-app-home/src/js/useManageMenus.ts +38 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/views/ganwei-app-home/src/js/useMenus.ts +49 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/views/ganwei-app-home/src/js/usePolling.ts +38 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/src/views/ganwei-app-home/src/js/useRealTime.ts +128 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/stats.html +4975 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/tsconfig.json +58 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/types/gw-app-public.d.ts +4 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/vite.base.config.ts +233 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-home/vite.config.ts +49 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/.babelrc +4 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/.editorconfig +22 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/.env.development +23 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/.env.production +29 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/.env.test +22 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/.eslintignore +13 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/.eslintrc.cjs +178 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/.prettierignore +13 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/.prettierrc.cjs +37 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/.stylelintrc.cjs +18 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/auto-imports.d.ts +5 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/env.d.ts +22 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/index.html +20 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/package-lock.json +18130 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/package.json +88 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/css/ElementPlusAdapter.css +706 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/css/index-plus-vars.css +93 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/css/index-plus.css +1 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/css/index.css +15254 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/css/pptxjs.css +161 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/css/reset-6.1.css +433 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/font/element-icons.ttf +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/font/element-icons.woff +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/font/iconfont.css +1167 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/font/iconfont.js +1 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/font/iconfont.json +2025 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/font/iconfont.ttf +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/font/iconfont.woff +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/font/iconfont.woff2 +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/images/index-loading.png +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/images/loading_1.png +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/images/loading_2.png +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/images/loading_3.png +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/images/loading_4.png +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/images/logo.png +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/images/noPermission.png +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/images/noPermission1.png +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/images/refresh.png +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/images/scene_current.svg +36 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/images/scene_equip.svg +30 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/images/scene_safe.svg +29 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/images/scene_zonghe.svg +28 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/images/snapshot_alarm.svg +13 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/images/snapshot_info.svg +15 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/images/snapshot_setup.svg +15 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/images/snapshot_warning.svg +15 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/images/snapshot_zichan.svg +15 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/images/ts.svg +29 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/js/axios.min.js +2 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/js/base/MFEManager.js +70 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/js/echarts.min.js +45 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/js/enc-base64-min.js +88 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/js/hmac-sha256.js +18 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/js/jsencrypt.min.js +2 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/js/signalr.min.js +17 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/js/transformpcm.worker.js +58 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/js/vue2/elementUI.min.js +1 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/js/vue2/injectCss.js +12 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/js/vue2/vue-i18n.min.js +6 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/js/vue2/vue-router.min.js +11 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/js/vue2/vue.min.js +11 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/js/vue2/vuex.min.js +6 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/js/vue3/ElementPlusAdapter.iife.js +628 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/js/vue3/elementPlus.min.js +73 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/js/vue3/gw_app_api.iife.js +4024 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/js/vue3/vue-i18n.min.js +6 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/js/vue3/vue-router.min.js +6 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/js/vue3/vue.min.js +1 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/js/vue3/vuex.min.js +6 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/json/autoPlay.json +187 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/json/commandConfig.json +10 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/json/config.json +32 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/json/modules.json +93 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/json/player.json +6 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/json/ppt.json +6 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/json/scene.json +72 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/json/welcome.json +8 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/language/en-US/frame.json +30 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/language/en-US/publics.json +73 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/language/zh-CN/frame.json +30 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/language/zh-CN/publics.json +73 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/language/zh-HK/frame.json +30 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/language/zh-HK/publics.json +73 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/themes/dark-6.1.css +325 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/themes/dark.css +84 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/themes/default-theme.js +43 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/themes/light-6.1.css +333 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/public/static/themes/light.css +85 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/App.vue +256 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/components/NavigationBar/components/NavBarItem.vue +28 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/components/NavigationBar/components/NavBarItemBack.vue +18 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/components/NavigationBar/components/NavBarItemCommon.vue +13 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/components/NavigationBar/components/NavBarItemLogo.vue +33 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/components/NavigationBar/index.vue +66 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/components/NavigationBar/models/index.ts +10 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/components/appFrame/appFrame.vue +119 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/components/appFrame/bottom.vue +76 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/components/appFrame/css/bottom.scss +54 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/components/appFrame/css/top.scss +44 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/components/appFrame/js/useGestrue.ts +22 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/components/appFrame/top.vue +93 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/components/loading/index.vue +71 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/components/qrcodeReader/qrcodeReader.vue +328 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/components/vue-qrcode-reader/src/components/QrcodeCapture.vue +54 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/components/vue-qrcode-reader/src/components/QrcodeDropZone.vue +42 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/components/vue-qrcode-reader/src/components/QrcodeStream.vue +327 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/components/vue-qrcode-reader/src/index.js +32 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/components/vue-qrcode-reader/src/misc/camera.js +153 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/components/vue-qrcode-reader/src/misc/errors.js +25 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/components/vue-qrcode-reader/src/misc/scanner.js +114 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/components/vue-qrcode-reader/src/misc/shimGetUserMedia.js +30 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/components/vue-qrcode-reader/src/misc/util.js +16 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/components/vue-qrcode-reader/src/mixins/CommonAPI.vue +27 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/enums/index.ts +19 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/hostMap.ts +8 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/main.ts +27 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/models/index.ts +81 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/request/api/Auth.ts +80 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/request/api.ts +5 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/router.ts +134 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/store.js +192 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/types.js +16 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/utils/MFEManager.ts +141 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/utils/URLSearchParams.ts +149 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/utils/defineWindowAttr.ts +4 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/utils/eventBus.ts +6 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/views/EditPassword/index.vue +142 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/views/ganwei-app-jump/src/index.vue +174 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/views/ganwei-app-jump/src/lifecycles.js +29 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/views/index/Index.vue +113 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/views/index/getSystemInfo.ts +35 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/views/index/useEventBus.ts +93 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/views/index/useInitMenus.ts +47 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/views/index/useKeepAlive.ts +35 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/views/index/useNavigationBar.ts +94 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/views/index/usePush.ts +62 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/src/views/index/useScan.ts +36 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/stats.html +4975 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/tsconfig.json +58 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/types/gw-app-public.d.ts +4 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/vite.base.config.ts +233 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-index/vite.config.ts +51 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/.babelrc +4 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/.editorconfig +22 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/.env.development +23 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/.env.production +29 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/.env.test +22 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/.eslintignore +13 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/.eslintrc.cjs +178 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/.prettierignore +13 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/.prettierrc.cjs +37 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/.stylelintrc.cjs +16 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/auto-imports.d.ts +5 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/env.d.ts +67 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/index.html +20 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/package.json +79 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/public/static/language/en-US/login.json +48 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/public/static/language/zh-CN/login.json +48 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/public/static/language/zh-HK/login.json +48 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/src/App.vue +225 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/src/assets/images/bg.png +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/src/assets/images/logo.png +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/src/assets/images/refresh.png +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/src/components/app-drag/index.vue +183 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/src/hostMap.ts +11 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/src/main.ts +19 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/src/models/index.ts +48 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/src/request/api/Auth.ts +27 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/src/request/api.ts +5 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/src/router.ts +30 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/src/views/login/Login.vue +99 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/src/views/login/css/login.scss +78 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/src/views/login/js/useLogin.ts +73 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/src/views/login/js/useRememberPassword.ts +48 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/stats.html +4975 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/tsconfig.json +56 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/types/gw-app-public.d.ts +4 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/vite.base.config.ts +233 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-login/vite.config.ts +51 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/.babelrc +4 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/.editorconfig +22 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/.env.development +23 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/.env.production +29 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/.env.test +22 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/.eslintignore +13 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/.eslintrc.cjs +178 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/.prettierignore +13 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/.prettierrc.cjs +37 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/.stylelintrc.cjs +17 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/auto-imports.d.ts +5 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/env.d.ts +21 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/index.html +20 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/package.json +85 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/public/static/language/en-US/setPage.json +25 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/public/static/language/zh-CN/setPage.json +25 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/public/static/language/zh-HK/setPage.json +25 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/src/App.vue +202 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/src/assets/images/logo.png +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/src/components/buttonModeSelect/index.vue +190 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/src/hostMap.ts +11 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/src/main.ts +24 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/src/models/index.ts +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/src/request/api/Auth.ts +21 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/src/request/api.ts +5 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/src/router.ts +29 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/src/store.js +189 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/src/types.js +16 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/src/views/ganwei-app-setPage/src/js/useChangeLanguage.ts +19 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/src/views/ganwei-app-setPage/src/js/useChangeTheme.ts +16 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/src/views/ganwei-app-setPage/src/js/useClearCache.ts +26 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/src/views/ganwei-app-setPage/src/js/useJavaFunc.ts +146 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/src/views/ganwei-app-setPage/src/js/useLogout.ts +52 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/src/views/ganwei-app-setPage/src/setPage.vue +120 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/stats.html +4975 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/tsconfig.json +58 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/types/gw-app-public.d.ts +4 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/vite.base.config.ts +233 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-set-page/vite.config.ts +49 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/.babelrc +4 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/.editorconfig +22 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/.env.development +23 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/.env.production +29 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/.env.test +22 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/.eslintignore +13 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/.eslintrc.cjs +178 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/.prettierignore +13 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/.prettierrc.cjs +37 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/auto-imports.d.ts +5 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/components.d.ts +14 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/env.d.ts +7 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/index.html +18 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/package.json +77 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/public/static/language/en-US/template.json +3 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/public/static/language/zh-CN/template.json +3 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/public/static/language/zh-HK/template.json +3 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/src/App.vue +202 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/src/assets/images/logo.png +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/src/components/buttonModeSelect/index.vue +190 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/src/hostMap.ts +11 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/src/main.ts +24 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/src/models/index.ts +0 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/src/request/api/Auth.ts +21 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/src/request/api.ts +5 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/src/router.ts +29 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/src/store.js +189 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/src/types.js +16 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/src/views/ganwei-app-template/src/template.vue +22 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/tsconfig.json +58 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/types/gw-app-public.d.ts +4 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/vite.base.config.js +246 -0
- package/ganwei-app-6.2.1/packages/ganwei-app-template/vite.config.ts +44 -0
- package/ganwei-app-6.2.1/pnpm-lock.yaml +8810 -0
- package/ganwei-app-6.2.1/pnpm-workspace.yaml +3 -0
- package/ganwei-iotcenter-index-6.2.1/.nvmrc +1 -0
- package/ganwei-iotcenter-index-6.2.1/configuration/cleanNodeModule.js +18 -0
- package/ganwei-iotcenter-index-6.2.1/configuration/gitClone.js +45 -0
- package/ganwei-iotcenter-index-6.2.1/configuration/moduleConfiguration.json +20 -0
- package/ganwei-iotcenter-index-6.2.1/configuration/updateModule.cjs +30 -0
- package/ganwei-iotcenter-index-6.2.1/init.cjs +30 -0
- package/ganwei-iotcenter-index-6.2.1/package.json +41 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/.babelrc +4 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/.editorconfig +22 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/.env.development +22 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/.env.production +22 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/.env.test +22 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/.eslintignore +13 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/.eslintrc.cjs +176 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/.prettierignore +13 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/.prettierrc.cjs +19 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/auto-imports.d.ts +5 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/build/enteryJson.js +9 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/build/vite-addInfo-html.ts +38 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/build/vite-plugin-stats-html.js +595 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/components.d.ts +87 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/env.d.ts +7 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/index.html +31 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/package.json +89 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/css/element-plus/css-vars.css +1 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/css/element-plus/index.css +16959 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/css/element-ui/index.css +16075 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/css/equipStatus.css +70 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/css/index.css +15926 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/css/reset-6-1.css +155 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/fonts/appFont/iconfont.css +1135 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/fonts/appFont/iconfont.js +1 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/fonts/appFont/iconfont.json +1969 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/fonts/appFont/iconfont.ttf +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/fonts/appFont/iconfont.woff +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/fonts/appFont/iconfont.woff2 +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/fonts/element-icons.ttf +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/fonts/element-icons.woff +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/fonts/font/iconfont.css +3779 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/fonts/font/iconfont.js +1 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/fonts/font/iconfont.json +6596 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/fonts/font/iconfont.ttf +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/fonts/font/iconfont.woff +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/fonts/font/iconfont.woff2 +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/http/createAxios.js +486 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/head-background.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-alarmIcon-dark.svg +48 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-alarmIcon-green.svg +42 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-alarmIcon-light.svg +26 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-apppreview-dark.svg +20 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-apppreview-green.svg +20 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-apppreview-light.svg +14 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-contentfull-dark.svg +22 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-contentfull-green.svg +16 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-contentfull-light.svg +16 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-contentfull.svg +22 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-fullscreen-dark.svg +19 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-fullscreen-green.svg +14 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-fullscreen-light.svg +12 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-fullscreen.svg +19 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-loading.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-logo-src-dark.svg +67 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-logo-src-green.svg +67 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-logo-src-light.svg +67 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-logo-src-small.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-logo-src.svg +67 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-nopage-dark.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-nopage-green.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-nopage-light.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-normalIcon-dark.svg +32 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-normalIcon-green.svg +32 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-normalIcon-light.svg +9 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-skin-dark.svg +22 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-skin-green.svg +22 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-skin-light.svg +15 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-skin.svg +22 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-tuchuquanping-dark.svg +18 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-tuchuquanping-green.svg +18 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-tuchuquanping-light.svg +18 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-tuchuquanping.svg +18 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-upgrade.svg +18 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-user-dark.svg +22 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-user-green.svg +27 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-user-light.svg +22 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-user.svg +26 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-warningIcon-dark.svg +37 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-warningIcon-green.svg +37 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/index-warningIcon-light.svg +15 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/login-bg-img.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/logo.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/menu-background.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/renew-message-dark.svg +1 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/renew-message-green.svg +1 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/renew-message-light.svg +1 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/right-close.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/right-open.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/systemsnapshot-fullscreen.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/systemsnapshot-guzhang.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/systemsnapshot-jinggao.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/systemsnapshot-shezhi.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/systemsnapshot-xinxi.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/systemsnapshot-zichan.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/unread-message-dark.svg +19 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/unread-message-green.svg +22 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/unread-message-light.svg +17 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/images/webconfig-location.svg +17 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/axios.min.js +2 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/echarts.min.js +25 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/element-ui/index.js +1 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/element-ui/index.js.gz +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/enc-base64-min.js +86 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/filereader.js +455 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/font.js +56 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/getConfigInfoData.js +57 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/getLanguage.js +144 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/getLanguageOptions.js +52 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/getUserPermissionList.js +55 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/h5player.min.js +311 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/hmac-sha256.js +18 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/jquery.slim.min.js +2 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/jsencrypt.min.js +2 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/jszip.min.js +14 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/liveplayer-lib.min.js +1 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/moment.js +5670 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/pptxjs.min.js +14105 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/signalr.min.js +17 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/tXml.js +244 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/transformpcm.worker.js +58 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/vue-i18n.min.js +6 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/vue-router.min.js +11 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/vue.min.js +11 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/js/vuex.min.js +6 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/json/RAMScope.json +201 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/json/config.json +158 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/json/snapshot.json +34 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/lib/treeV2/treeV2.css +246 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/lib/treeV2/treeV2.js +5384 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/themes/dark-6-1.css +430 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/themes/dark.css +426 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/themes/default-theme-6-1.js +48 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/themes/default-theme.js +53 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/themes/green-6-1.css +357 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/themes/light-6-1.css +424 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/themes/light.css +414 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/public/static/themes/themeConfig.json +42 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/App.vue +52 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/assets/plugins/encrypt.js +122 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/auto-import.d.ts +61 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/asideMenu/contractMenu.vue +216 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/asideMenu/menu.vue +238 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/asideMenu/topNav.vue +238 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/contextMenu/index.js +42 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/contextMenu/index.vue +113 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexLeftContent/index.js +204 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexLeftContent/index.scss +258 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexLeftContent/index.vue +112 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/appPreview/images/appconnect.jpg +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/appPreview/index.vue +282 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/contentFullScreen/index.js +19 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/contentFullScreen/index.vue +10 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/fullScreen/index.js +50 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/fullScreen/index.vue +10 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/index.js +28 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/index.scss +137 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/index.vue +20 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/processDesign/ApprovalDialog.vue +147 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/processDesign/index.js +327 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/processDesign/index.scss +253 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/processDesign/index.vue +61 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/renewMessages/RenewDialog.vue +97 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/renewMessages/index.js +95 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/renewMessages/index.scss +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/renewMessages/index.vue +8 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/renewMessages/renew.vue +271 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/saveMode/index.js +45 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/saveMode/index.scss +36 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/saveMode/index.vue +22 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/switchTheme/index.js +70 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/switchTheme/index.scss +94 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/switchTheme/index.vue +35 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/unReadMessages/index.js +146 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/unReadMessages/index.scss +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/unReadMessages/index.vue +8 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/upgrade/index.js +81 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/upgrade/index.scss +147 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/upgrade/index.vue +30 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/userInfo/PWEditDialog/forceEdit.js +78 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/userInfo/PWEditDialog/index.js +265 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/userInfo/PWEditDialog/index.scss +5 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/userInfo/PWEditDialog/index.vue +39 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/userInfo/index.js +94 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/userInfo/index.scss +113 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/userInfo/index.vue +90 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/userInfo/logoutDialog/index.js +68 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/userInfo/logoutDialog/index.vue +16 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/userInfo/restartPlatformDialog/index.js +178 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/userInfo/restartPlatformDialog/index.scss +16 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/userInfo/restartPlatformDialog/index.vue +46 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/userInfo/safeModeDialog/index.vue +195 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/userInfo/switchPark/index.js +70 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/userInfo/switchPark/index.scss +95 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/userInfo/switchPark/index.vue +35 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/userInfo/systemInfoDialog/index.js +240 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/userInfo/systemInfoDialog/index.scss +158 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/userInfo/systemInfoDialog/index.vue +50 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/index.js +63 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/index.scss +40 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/index.vue +20 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/labelPage/index.js +398 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/labelPage/index.scss +136 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/labelPage/index.vue +36 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/normalPage/index.js +34 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/normalPage/index.scss +44 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/indexRightContent/normalPage/index.vue +21 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/inputPassword/index.vue +65 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/isDebug/isDebug.vue +50 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/isDebug/warning.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/noAccess/noAccess.vue +78 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/noAccess/noPage.vue +68 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/sceneMonitor/index.js +95 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/toast/index.js +65 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/toast/index.vue +136 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/unreadMsg/listItem.vue +36 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/components/unreadMsg/unread.vue +300 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/hostMap.js +13 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/main.js +50 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/mixins/judgePermission.js +29 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/publish/pub.ts +28 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/request/api/frame.js +142 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/request/api.js +14 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/router.js +34 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/store.js +221 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/types.js +16 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/utils/MFEManager.js +156 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/utils/gwEquipCache.js +325 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/utils/gwSignalr.js +66 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/utils/historyExport.js +158 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/utils/setStorage.js +5 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/views/Index.vue +81 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/views/index.js +294 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/views/jumpIframe/index.vue +242 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/views/jumpIframe/preloadMethod.js +54 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/src/views/jumpIframe/queryParser.js +47 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/tsconfig.json +57 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-index/vite.config.ts +270 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/.babelrc +8 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/.editorconfig +22 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/.env.development +22 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/.env.production +22 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/.env.test +22 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/.eslintignore +13 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/.eslintrc.cjs +162 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/.prettierignore +13 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/.prettierrc.cjs +37 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/auto-imports.d.ts +5 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/build/enteryJson.js +72 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/build/vite-addInfo-html.ts +38 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/build/vite-plugin-stats-html.js +595 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/env.d.ts +7 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/index.html +34 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/package.json +84 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/css/drag.css +140 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/css/element-plus/css-vars.css +1 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/css/element-plus/index.css +16957 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/css/element-ui/index.css +16075 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/css/element-ui/reset.css +1471 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/css/index.css +15926 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/css/reset-6-1.css +114 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/fonts/appFont/iconfont.css +1135 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/fonts/appFont/iconfont.js +1 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/fonts/appFont/iconfont.json +1969 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/fonts/appFont/iconfont.ttf +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/fonts/appFont/iconfont.woff +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/fonts/appFont/iconfont.woff2 +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/fonts/element-icons.ttf +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/fonts/element-icons.woff +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/fonts/font/iconfont.css +4151 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/fonts/font/iconfont.js +1 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/fonts/font/iconfont.json +7247 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/fonts/font/iconfont.ttf +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/fonts/font/iconfont.woff +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/fonts/font/iconfont.woff2 +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/http/createAxios.js +316 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/images/center.svg +23 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/images/centerActive.svg +24 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/images/center_light.svg +15 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/images/index-loading.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/images/index-logo-src-dark.svg +67 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/images/index-logo-src-green.svg +67 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/images/index-logo-src-light.svg +67 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/images/index-logo-src-small.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/images/index-logo-src.svg +67 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/images/left.svg +23 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/images/leftActive.svg +24 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/images/left_light.svg +15 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/images/login-bg-img.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/images/login-drag-start.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/images/login-drag-stop.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/images/logo.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/images/refresh.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/images/right.svg +23 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/images/rightActive.svg +24 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/images/right_light.svg +15 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/js/axios.min.js +3 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/js/drag.js +391 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/js/font.js +57 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/js/getConfigInfoData.js +57 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/js/getLanguage.js +143 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/js/getLanguageOptions.js +52 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/js/jquery.min.js +10716 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/themes/dark-6-1.css +430 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/themes/dark.css +426 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/themes/default-theme-6-1.js +46 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/themes/default-theme.js +53 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/themes/green-6-1.css +336 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/themes/light-6-1.css +424 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/themes/light.css +414 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/public/static/themes/themeConfig.json +42 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/App.vue +70 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/assets/css/alertHandle.scss +22 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/assets/css/browserScroll.scss +5 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/assets/css/btnHandle.scss +36 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/assets/css/containerHandle.scss +402 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/assets/css/dialogStyle.scss +43 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/assets/css/equipStatus.scss +88 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/assets/css/index.scss +1358 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/assets/css/inputStyle.scss +16 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/assets/css/listHandle.scss +113 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/assets/css/login.scss +355 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/assets/css/mainInfo.scss +297 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/assets/css/maintenanceInfo.scss +199 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/assets/css/style.css +921 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/assets/css/tableHandle.scss +147 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/assets/css/txtHandle.scss +39 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/assets/images/login-bg-img.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/assets/images/login-sso-error.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/assets/images/logo-bg.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/assets/plugins/encrypt.js +122 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/components/declaration/declaration.scss +118 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/components/declaration/declaration.vue +109 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/components/declaration/declarationPacts.vue +42 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/components/passwordModification/checkEmailContainer.vue +134 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/components/passwordModification/inputEmailContainer.vue +128 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/components/passwordModification/modifyPasswordContainer.vue +138 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/components/passwordModification/passwordModification - /345/211/257/346/234/254.vue" +4 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/components/passwordModification/passwordModification.vue +223 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/directive/loadMore/loadMore.js +14 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/hostMap.js +18 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/main.js +39 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/mixins/setDefaultLanguage.js +87 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/request/api/login.js +95 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/request/api.js +13 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/router.js +48 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/types.js +16 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/utils/formValidate.js +25 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/utils/isApp.js +18 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/utils/language.js +45 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/utils/myUtils.js +646 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/utils/timeFormat.js +23 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/utils/timesYMDHMS.js +27 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/views/js/mainInfo.js +374 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/views/js/maintenanceInfo.js +202 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/views/login.vue +458 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/views/ssoLogin.vue +230 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/src/views/ssoLogout.vue +58 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-login/vite.config.ts +237 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/.babelrc +8 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/.editorconfig +22 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/.env.development +22 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/.env.production +22 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/.env.test +22 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/.eslintignore +13 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/.eslintrc.cjs +162 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/.prettierignore +13 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/.prettierrc.cjs +37 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/auto-imports.d.ts +5 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/build/enteryJson.js +64 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/build/vite-addInfo-html.js +15 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/build/vite-addInfo-html.ts +38 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/build/vite-plugin-stats-html +14 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/build/vite-plugin-stats-html.js +595 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/env.d.ts +7 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/index.html +25 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/package.json +94 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/css/element-plus/css-vars.css +1 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/css/element-plus/index.css +16957 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/css/reset-6-1.css +114 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/fonts/appFont/iconfont.css +1135 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/fonts/appFont/iconfont.js +1 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/fonts/appFont/iconfont.json +1969 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/fonts/appFont/iconfont.ttf +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/fonts/appFont/iconfont.woff +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/fonts/appFont/iconfont.woff2 +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/fonts/element-icons.ttf +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/fonts/element-icons.woff +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/fonts/font/iconfont.css +3535 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/fonts/font/iconfont.js +1 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/fonts/font/iconfont.json +6169 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/fonts/font/iconfont.ttf +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/fonts/font/iconfont.woff +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/fonts/font/iconfont.woff2 +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/http/createAxios.js +372 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/images/index-loading.png +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/js/axios.min.js +3 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/js/font.js +58 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/js/getConfigInfoData.js +58 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/js/getLanguage.js +142 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/js/getLanguageOptions.js +51 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/themes/dark-6-1.css +430 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/themes/default-theme-6-1.js +48 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/themes/light-6-1.css +424 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/public/static/themes/themeConfig.json +42 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/src/App.vue +41 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/src/assets/images/template.jpg +0 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/src/hostMap.js +14 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/src/main.js +39 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/src/request/api/template.js +11 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/src/request/api.js +9 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/src/router.js +23 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/src/utils/setStorage.js +5 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/src/views/template.vue +1008 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/tsconfig.json +21 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/tsconfig.node.json +10 -0
- package/ganwei-iotcenter-index-6.2.1/packages/ganwei-iotcenter-template/vite.config.ts +240 -0
- package/ganwei-iotcenter-index-6.2.1/pnpm-workspace.yaml +3 -0
- package/package.json +3 -2
|
@@ -0,0 +1,4024 @@
|
|
|
1
|
+
var gw_app_api = function(exports, axios2) {
|
|
2
|
+
"use strict";
|
|
3
|
+
const toLogin = (n) => {
|
|
4
|
+
const location = window.top ? window.top.location : window.location;
|
|
5
|
+
if (location.href.indexOf("Login") == -1) {
|
|
6
|
+
location.href = `/APP/ganwei-app-login/#/Login`;
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
function errorHandler(status, other) {
|
|
10
|
+
switch (status) {
|
|
11
|
+
case 401:
|
|
12
|
+
if (window.sessionStorage.getItem("isSingleSignOn")) {
|
|
13
|
+
window.location.href = "/loginOut.html";
|
|
14
|
+
} else {
|
|
15
|
+
toLogin();
|
|
16
|
+
}
|
|
17
|
+
break;
|
|
18
|
+
case 403:
|
|
19
|
+
setTimeout(() => {
|
|
20
|
+
toLogin();
|
|
21
|
+
}, 1e3);
|
|
22
|
+
break;
|
|
23
|
+
case 404:
|
|
24
|
+
break;
|
|
25
|
+
case 500:
|
|
26
|
+
{
|
|
27
|
+
let url = other.config.url;
|
|
28
|
+
if (url.indexOf("/IoT/api/v3/Auth/GetMenus") != -1 || url.indexOf("IoT/api/v3/RealTime/GetRealTimeData") != -1) {
|
|
29
|
+
toLogin();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
break;
|
|
33
|
+
case 501:
|
|
34
|
+
break;
|
|
35
|
+
case 504:
|
|
36
|
+
toLogin();
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
class AxiosBuilder {
|
|
41
|
+
constructor(vm) {
|
|
42
|
+
this.vm = vm;
|
|
43
|
+
this.create();
|
|
44
|
+
this.setRequestInterceptors();
|
|
45
|
+
this.setResponseInterceptors();
|
|
46
|
+
}
|
|
47
|
+
create() {
|
|
48
|
+
let httpConfig = window.sessionStorage.httpConfig ? JSON.parse(window.sessionStorage.httpConfig) : {
|
|
49
|
+
"countRetry": 0,
|
|
50
|
+
"timeout": 3e4,
|
|
51
|
+
"retryDelay": 3e3
|
|
52
|
+
};
|
|
53
|
+
let countRetry = httpConfig.countRetry;
|
|
54
|
+
this.instance = axios2.create({
|
|
55
|
+
timeout: httpConfig.timeout,
|
|
56
|
+
retry: countRetry,
|
|
57
|
+
retryDelay: httpConfig.retryDelay
|
|
58
|
+
});
|
|
59
|
+
this.instance.defaults.withCredentials = true;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* 请求拦截器
|
|
63
|
+
* 每次请求前,如果存在token则在请求头中携带token
|
|
64
|
+
*/
|
|
65
|
+
setRequestInterceptors() {
|
|
66
|
+
this.instance.interceptors.request.use(
|
|
67
|
+
(config) => {
|
|
68
|
+
config.headers["Accept-Language"] = window.localStorage.languageType || "zh-CN";
|
|
69
|
+
config.headers["Xsrf-Token"] = window.sessionStorage.CSRF_TOKEN || "";
|
|
70
|
+
return config;
|
|
71
|
+
},
|
|
72
|
+
(error) => Promise.reject(error)
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
// 请求重试
|
|
76
|
+
setResponseInterceptors() {
|
|
77
|
+
const _this = this;
|
|
78
|
+
this.instance.interceptors.response.use(
|
|
79
|
+
(res) => {
|
|
80
|
+
if (res.status === 200 || res.status === 201 || res.status === 204) {
|
|
81
|
+
let requestData = res.request;
|
|
82
|
+
if (requestData.responseURL.indexOf("?ReturnUrl=") != -1) {
|
|
83
|
+
toLogin();
|
|
84
|
+
return Promise.reject("重定向");
|
|
85
|
+
}
|
|
86
|
+
if (res.data && res.data.code == -99999) {
|
|
87
|
+
window.location.href = "/APP/#/editPwd?force=true";
|
|
88
|
+
return Promise.reject(res);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return res.status === 200 || res.status === 201 ? Promise.resolve(res) : Promise.reject(res);
|
|
92
|
+
},
|
|
93
|
+
async function axiosRetryInterceptor(err) {
|
|
94
|
+
const { response } = err;
|
|
95
|
+
if (response) {
|
|
96
|
+
errorHandler(response.status, response);
|
|
97
|
+
return Promise.reject(response);
|
|
98
|
+
} else if (response == void 0) {
|
|
99
|
+
let config = err.config;
|
|
100
|
+
if (!config || !config.retry || config.url.indexOf("/api/ServiceManage/Reboot") != -1 || config.url.indexOf("/api/v3/RealTime/GetRealTimeData") != -1) {
|
|
101
|
+
if (config.url.indexOf("/api/v3/RealTime/GetRealTimeData") != -1) {
|
|
102
|
+
_this.tips("网络请求超时,请继续等待或者重新登录", 3e3);
|
|
103
|
+
}
|
|
104
|
+
return Promise.reject(err);
|
|
105
|
+
}
|
|
106
|
+
config.__retryCount = config.__retryCount || 1;
|
|
107
|
+
if (config.retry >= config.__retryCount) {
|
|
108
|
+
config.__retryCount += 1;
|
|
109
|
+
await sleep(config.retryDelay);
|
|
110
|
+
const res = await this.instance(config);
|
|
111
|
+
return Promise.resolve(res);
|
|
112
|
+
}
|
|
113
|
+
throw err;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* @description 弹窗提示
|
|
120
|
+
*/
|
|
121
|
+
tips(msg, duration) {
|
|
122
|
+
return this.vm.config.globalProperties.$message({
|
|
123
|
+
message: msg,
|
|
124
|
+
duration
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
async function sleep(timeout = 1) {
|
|
129
|
+
return new Promise((resolve) => setTimeout(resolve, timeout));
|
|
130
|
+
}
|
|
131
|
+
var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz";
|
|
132
|
+
function int2char(n) {
|
|
133
|
+
return BI_RM.charAt(n);
|
|
134
|
+
}
|
|
135
|
+
function op_and(x, y) {
|
|
136
|
+
return x & y;
|
|
137
|
+
}
|
|
138
|
+
function op_or(x, y) {
|
|
139
|
+
return x | y;
|
|
140
|
+
}
|
|
141
|
+
function op_xor(x, y) {
|
|
142
|
+
return x ^ y;
|
|
143
|
+
}
|
|
144
|
+
function op_andnot(x, y) {
|
|
145
|
+
return x & ~y;
|
|
146
|
+
}
|
|
147
|
+
function lbit(x) {
|
|
148
|
+
if (x == 0) {
|
|
149
|
+
return -1;
|
|
150
|
+
}
|
|
151
|
+
var r = 0;
|
|
152
|
+
if ((x & 65535) == 0) {
|
|
153
|
+
x >>= 16;
|
|
154
|
+
r += 16;
|
|
155
|
+
}
|
|
156
|
+
if ((x & 255) == 0) {
|
|
157
|
+
x >>= 8;
|
|
158
|
+
r += 8;
|
|
159
|
+
}
|
|
160
|
+
if ((x & 15) == 0) {
|
|
161
|
+
x >>= 4;
|
|
162
|
+
r += 4;
|
|
163
|
+
}
|
|
164
|
+
if ((x & 3) == 0) {
|
|
165
|
+
x >>= 2;
|
|
166
|
+
r += 2;
|
|
167
|
+
}
|
|
168
|
+
if ((x & 1) == 0) {
|
|
169
|
+
++r;
|
|
170
|
+
}
|
|
171
|
+
return r;
|
|
172
|
+
}
|
|
173
|
+
function cbit(x) {
|
|
174
|
+
var r = 0;
|
|
175
|
+
while (x != 0) {
|
|
176
|
+
x &= x - 1;
|
|
177
|
+
++r;
|
|
178
|
+
}
|
|
179
|
+
return r;
|
|
180
|
+
}
|
|
181
|
+
var b64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
182
|
+
var b64pad = "=";
|
|
183
|
+
function hex2b64(h) {
|
|
184
|
+
var i;
|
|
185
|
+
var c;
|
|
186
|
+
var ret = "";
|
|
187
|
+
for (i = 0; i + 3 <= h.length; i += 3) {
|
|
188
|
+
c = parseInt(h.substring(i, i + 3), 16);
|
|
189
|
+
ret += b64map.charAt(c >> 6) + b64map.charAt(c & 63);
|
|
190
|
+
}
|
|
191
|
+
if (i + 1 == h.length) {
|
|
192
|
+
c = parseInt(h.substring(i, i + 1), 16);
|
|
193
|
+
ret += b64map.charAt(c << 2);
|
|
194
|
+
} else if (i + 2 == h.length) {
|
|
195
|
+
c = parseInt(h.substring(i, i + 2), 16);
|
|
196
|
+
ret += b64map.charAt(c >> 2) + b64map.charAt((c & 3) << 4);
|
|
197
|
+
}
|
|
198
|
+
while ((ret.length & 3) > 0) {
|
|
199
|
+
ret += b64pad;
|
|
200
|
+
}
|
|
201
|
+
return ret;
|
|
202
|
+
}
|
|
203
|
+
function b64tohex(s) {
|
|
204
|
+
var ret = "";
|
|
205
|
+
var i;
|
|
206
|
+
var k = 0;
|
|
207
|
+
var slop = 0;
|
|
208
|
+
for (i = 0; i < s.length; ++i) {
|
|
209
|
+
if (s.charAt(i) == b64pad) {
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
var v = b64map.indexOf(s.charAt(i));
|
|
213
|
+
if (v < 0) {
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
if (k == 0) {
|
|
217
|
+
ret += int2char(v >> 2);
|
|
218
|
+
slop = v & 3;
|
|
219
|
+
k = 1;
|
|
220
|
+
} else if (k == 1) {
|
|
221
|
+
ret += int2char(slop << 2 | v >> 4);
|
|
222
|
+
slop = v & 15;
|
|
223
|
+
k = 2;
|
|
224
|
+
} else if (k == 2) {
|
|
225
|
+
ret += int2char(slop);
|
|
226
|
+
ret += int2char(v >> 2);
|
|
227
|
+
slop = v & 3;
|
|
228
|
+
k = 3;
|
|
229
|
+
} else {
|
|
230
|
+
ret += int2char(slop << 2 | v >> 4);
|
|
231
|
+
ret += int2char(v & 15);
|
|
232
|
+
k = 0;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
if (k == 1) {
|
|
236
|
+
ret += int2char(slop << 2);
|
|
237
|
+
}
|
|
238
|
+
return ret;
|
|
239
|
+
}
|
|
240
|
+
var decoder$1;
|
|
241
|
+
var Hex = {
|
|
242
|
+
decode: function(a) {
|
|
243
|
+
var i;
|
|
244
|
+
if (decoder$1 === void 0) {
|
|
245
|
+
var hex = "0123456789ABCDEF";
|
|
246
|
+
var ignore = " \f\n\r \u2028\u2029";
|
|
247
|
+
decoder$1 = {};
|
|
248
|
+
for (i = 0; i < 16; ++i) {
|
|
249
|
+
decoder$1[hex.charAt(i)] = i;
|
|
250
|
+
}
|
|
251
|
+
hex = hex.toLowerCase();
|
|
252
|
+
for (i = 10; i < 16; ++i) {
|
|
253
|
+
decoder$1[hex.charAt(i)] = i;
|
|
254
|
+
}
|
|
255
|
+
for (i = 0; i < ignore.length; ++i) {
|
|
256
|
+
decoder$1[ignore.charAt(i)] = -1;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
var out = [];
|
|
260
|
+
var bits = 0;
|
|
261
|
+
var char_count = 0;
|
|
262
|
+
for (i = 0; i < a.length; ++i) {
|
|
263
|
+
var c = a.charAt(i);
|
|
264
|
+
if (c == "=") {
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
c = decoder$1[c];
|
|
268
|
+
if (c == -1) {
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
if (c === void 0) {
|
|
272
|
+
throw new Error("Illegal character at offset " + i);
|
|
273
|
+
}
|
|
274
|
+
bits |= c;
|
|
275
|
+
if (++char_count >= 2) {
|
|
276
|
+
out[out.length] = bits;
|
|
277
|
+
bits = 0;
|
|
278
|
+
char_count = 0;
|
|
279
|
+
} else {
|
|
280
|
+
bits <<= 4;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
if (char_count) {
|
|
284
|
+
throw new Error("Hex encoding incomplete: 4 bits missing");
|
|
285
|
+
}
|
|
286
|
+
return out;
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
var decoder;
|
|
290
|
+
var Base64 = {
|
|
291
|
+
decode: function(a) {
|
|
292
|
+
var i;
|
|
293
|
+
if (decoder === void 0) {
|
|
294
|
+
var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
295
|
+
var ignore = "= \f\n\r \u2028\u2029";
|
|
296
|
+
decoder = /* @__PURE__ */ Object.create(null);
|
|
297
|
+
for (i = 0; i < 64; ++i) {
|
|
298
|
+
decoder[b64.charAt(i)] = i;
|
|
299
|
+
}
|
|
300
|
+
decoder["-"] = 62;
|
|
301
|
+
decoder["_"] = 63;
|
|
302
|
+
for (i = 0; i < ignore.length; ++i) {
|
|
303
|
+
decoder[ignore.charAt(i)] = -1;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
var out = [];
|
|
307
|
+
var bits = 0;
|
|
308
|
+
var char_count = 0;
|
|
309
|
+
for (i = 0; i < a.length; ++i) {
|
|
310
|
+
var c = a.charAt(i);
|
|
311
|
+
if (c == "=") {
|
|
312
|
+
break;
|
|
313
|
+
}
|
|
314
|
+
c = decoder[c];
|
|
315
|
+
if (c == -1) {
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
if (c === void 0) {
|
|
319
|
+
throw new Error("Illegal character at offset " + i);
|
|
320
|
+
}
|
|
321
|
+
bits |= c;
|
|
322
|
+
if (++char_count >= 4) {
|
|
323
|
+
out[out.length] = bits >> 16;
|
|
324
|
+
out[out.length] = bits >> 8 & 255;
|
|
325
|
+
out[out.length] = bits & 255;
|
|
326
|
+
bits = 0;
|
|
327
|
+
char_count = 0;
|
|
328
|
+
} else {
|
|
329
|
+
bits <<= 6;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
switch (char_count) {
|
|
333
|
+
case 1:
|
|
334
|
+
throw new Error("Base64 encoding incomplete: at least 2 bits missing");
|
|
335
|
+
case 2:
|
|
336
|
+
out[out.length] = bits >> 10;
|
|
337
|
+
break;
|
|
338
|
+
case 3:
|
|
339
|
+
out[out.length] = bits >> 16;
|
|
340
|
+
out[out.length] = bits >> 8 & 255;
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
return out;
|
|
344
|
+
},
|
|
345
|
+
re: /-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,
|
|
346
|
+
unarmor: function(a) {
|
|
347
|
+
var m = Base64.re.exec(a);
|
|
348
|
+
if (m) {
|
|
349
|
+
if (m[1]) {
|
|
350
|
+
a = m[1];
|
|
351
|
+
} else if (m[2]) {
|
|
352
|
+
a = m[2];
|
|
353
|
+
} else {
|
|
354
|
+
throw new Error("RegExp out of sync");
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
return Base64.decode(a);
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
var max = 1e13;
|
|
361
|
+
var Int10 = (
|
|
362
|
+
/** @class */
|
|
363
|
+
function() {
|
|
364
|
+
function Int102(value) {
|
|
365
|
+
this.buf = [+value || 0];
|
|
366
|
+
}
|
|
367
|
+
Int102.prototype.mulAdd = function(m, c) {
|
|
368
|
+
var b = this.buf;
|
|
369
|
+
var l = b.length;
|
|
370
|
+
var i;
|
|
371
|
+
var t2;
|
|
372
|
+
for (i = 0; i < l; ++i) {
|
|
373
|
+
t2 = b[i] * m + c;
|
|
374
|
+
if (t2 < max) {
|
|
375
|
+
c = 0;
|
|
376
|
+
} else {
|
|
377
|
+
c = 0 | t2 / max;
|
|
378
|
+
t2 -= c * max;
|
|
379
|
+
}
|
|
380
|
+
b[i] = t2;
|
|
381
|
+
}
|
|
382
|
+
if (c > 0) {
|
|
383
|
+
b[i] = c;
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
Int102.prototype.sub = function(c) {
|
|
387
|
+
var b = this.buf;
|
|
388
|
+
var l = b.length;
|
|
389
|
+
var i;
|
|
390
|
+
var t2;
|
|
391
|
+
for (i = 0; i < l; ++i) {
|
|
392
|
+
t2 = b[i] - c;
|
|
393
|
+
if (t2 < 0) {
|
|
394
|
+
t2 += max;
|
|
395
|
+
c = 1;
|
|
396
|
+
} else {
|
|
397
|
+
c = 0;
|
|
398
|
+
}
|
|
399
|
+
b[i] = t2;
|
|
400
|
+
}
|
|
401
|
+
while (b[b.length - 1] === 0) {
|
|
402
|
+
b.pop();
|
|
403
|
+
}
|
|
404
|
+
};
|
|
405
|
+
Int102.prototype.toString = function(base) {
|
|
406
|
+
if ((base || 10) != 10) {
|
|
407
|
+
throw new Error("only base 10 is supported");
|
|
408
|
+
}
|
|
409
|
+
var b = this.buf;
|
|
410
|
+
var s = b[b.length - 1].toString();
|
|
411
|
+
for (var i = b.length - 2; i >= 0; --i) {
|
|
412
|
+
s += (max + b[i]).toString().substring(1);
|
|
413
|
+
}
|
|
414
|
+
return s;
|
|
415
|
+
};
|
|
416
|
+
Int102.prototype.valueOf = function() {
|
|
417
|
+
var b = this.buf;
|
|
418
|
+
var v = 0;
|
|
419
|
+
for (var i = b.length - 1; i >= 0; --i) {
|
|
420
|
+
v = v * max + b[i];
|
|
421
|
+
}
|
|
422
|
+
return v;
|
|
423
|
+
};
|
|
424
|
+
Int102.prototype.simplify = function() {
|
|
425
|
+
var b = this.buf;
|
|
426
|
+
return b.length == 1 ? b[0] : this;
|
|
427
|
+
};
|
|
428
|
+
return Int102;
|
|
429
|
+
}()
|
|
430
|
+
);
|
|
431
|
+
var ellipsis = "…";
|
|
432
|
+
var reTimeS = /^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;
|
|
433
|
+
var reTimeL = /^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;
|
|
434
|
+
function stringCut(str, len) {
|
|
435
|
+
if (str.length > len) {
|
|
436
|
+
str = str.substring(0, len) + ellipsis;
|
|
437
|
+
}
|
|
438
|
+
return str;
|
|
439
|
+
}
|
|
440
|
+
var Stream = (
|
|
441
|
+
/** @class */
|
|
442
|
+
function() {
|
|
443
|
+
function Stream2(enc, pos) {
|
|
444
|
+
this.hexDigits = "0123456789ABCDEF";
|
|
445
|
+
if (enc instanceof Stream2) {
|
|
446
|
+
this.enc = enc.enc;
|
|
447
|
+
this.pos = enc.pos;
|
|
448
|
+
} else {
|
|
449
|
+
this.enc = enc;
|
|
450
|
+
this.pos = pos;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
Stream2.prototype.get = function(pos) {
|
|
454
|
+
if (pos === void 0) {
|
|
455
|
+
pos = this.pos++;
|
|
456
|
+
}
|
|
457
|
+
if (pos >= this.enc.length) {
|
|
458
|
+
throw new Error("Requesting byte offset ".concat(pos, " on a stream of length ").concat(this.enc.length));
|
|
459
|
+
}
|
|
460
|
+
return "string" === typeof this.enc ? this.enc.charCodeAt(pos) : this.enc[pos];
|
|
461
|
+
};
|
|
462
|
+
Stream2.prototype.hexByte = function(b) {
|
|
463
|
+
return this.hexDigits.charAt(b >> 4 & 15) + this.hexDigits.charAt(b & 15);
|
|
464
|
+
};
|
|
465
|
+
Stream2.prototype.hexDump = function(start, end, raw) {
|
|
466
|
+
var s = "";
|
|
467
|
+
for (var i = start; i < end; ++i) {
|
|
468
|
+
s += this.hexByte(this.get(i));
|
|
469
|
+
if (raw !== true) {
|
|
470
|
+
switch (i & 15) {
|
|
471
|
+
case 7:
|
|
472
|
+
s += " ";
|
|
473
|
+
break;
|
|
474
|
+
case 15:
|
|
475
|
+
s += "\n";
|
|
476
|
+
break;
|
|
477
|
+
default:
|
|
478
|
+
s += " ";
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
return s;
|
|
483
|
+
};
|
|
484
|
+
Stream2.prototype.isASCII = function(start, end) {
|
|
485
|
+
for (var i = start; i < end; ++i) {
|
|
486
|
+
var c = this.get(i);
|
|
487
|
+
if (c < 32 || c > 176) {
|
|
488
|
+
return false;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
return true;
|
|
492
|
+
};
|
|
493
|
+
Stream2.prototype.parseStringISO = function(start, end) {
|
|
494
|
+
var s = "";
|
|
495
|
+
for (var i = start; i < end; ++i) {
|
|
496
|
+
s += String.fromCharCode(this.get(i));
|
|
497
|
+
}
|
|
498
|
+
return s;
|
|
499
|
+
};
|
|
500
|
+
Stream2.prototype.parseStringUTF = function(start, end) {
|
|
501
|
+
var s = "";
|
|
502
|
+
for (var i = start; i < end; ) {
|
|
503
|
+
var c = this.get(i++);
|
|
504
|
+
if (c < 128) {
|
|
505
|
+
s += String.fromCharCode(c);
|
|
506
|
+
} else if (c > 191 && c < 224) {
|
|
507
|
+
s += String.fromCharCode((c & 31) << 6 | this.get(i++) & 63);
|
|
508
|
+
} else {
|
|
509
|
+
s += String.fromCharCode((c & 15) << 12 | (this.get(i++) & 63) << 6 | this.get(i++) & 63);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
return s;
|
|
513
|
+
};
|
|
514
|
+
Stream2.prototype.parseStringBMP = function(start, end) {
|
|
515
|
+
var str = "";
|
|
516
|
+
var hi;
|
|
517
|
+
var lo;
|
|
518
|
+
for (var i = start; i < end; ) {
|
|
519
|
+
hi = this.get(i++);
|
|
520
|
+
lo = this.get(i++);
|
|
521
|
+
str += String.fromCharCode(hi << 8 | lo);
|
|
522
|
+
}
|
|
523
|
+
return str;
|
|
524
|
+
};
|
|
525
|
+
Stream2.prototype.parseTime = function(start, end, shortYear) {
|
|
526
|
+
var s = this.parseStringISO(start, end);
|
|
527
|
+
var m = (shortYear ? reTimeS : reTimeL).exec(s);
|
|
528
|
+
if (!m) {
|
|
529
|
+
return "Unrecognized time: " + s;
|
|
530
|
+
}
|
|
531
|
+
if (shortYear) {
|
|
532
|
+
m[1] = +m[1];
|
|
533
|
+
m[1] += +m[1] < 70 ? 2e3 : 1900;
|
|
534
|
+
}
|
|
535
|
+
s = m[1] + "-" + m[2] + "-" + m[3] + " " + m[4];
|
|
536
|
+
if (m[5]) {
|
|
537
|
+
s += ":" + m[5];
|
|
538
|
+
if (m[6]) {
|
|
539
|
+
s += ":" + m[6];
|
|
540
|
+
if (m[7]) {
|
|
541
|
+
s += "." + m[7];
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
if (m[8]) {
|
|
546
|
+
s += " UTC";
|
|
547
|
+
if (m[8] != "Z") {
|
|
548
|
+
s += m[8];
|
|
549
|
+
if (m[9]) {
|
|
550
|
+
s += ":" + m[9];
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
return s;
|
|
555
|
+
};
|
|
556
|
+
Stream2.prototype.parseInteger = function(start, end) {
|
|
557
|
+
var v = this.get(start);
|
|
558
|
+
var neg = v > 127;
|
|
559
|
+
var pad = neg ? 255 : 0;
|
|
560
|
+
var len;
|
|
561
|
+
var s = "";
|
|
562
|
+
while (v == pad && ++start < end) {
|
|
563
|
+
v = this.get(start);
|
|
564
|
+
}
|
|
565
|
+
len = end - start;
|
|
566
|
+
if (len === 0) {
|
|
567
|
+
return neg ? -1 : 0;
|
|
568
|
+
}
|
|
569
|
+
if (len > 4) {
|
|
570
|
+
s = v;
|
|
571
|
+
len <<= 3;
|
|
572
|
+
while (((+s ^ pad) & 128) == 0) {
|
|
573
|
+
s = +s << 1;
|
|
574
|
+
--len;
|
|
575
|
+
}
|
|
576
|
+
s = "(" + len + " bit)\n";
|
|
577
|
+
}
|
|
578
|
+
if (neg) {
|
|
579
|
+
v = v - 256;
|
|
580
|
+
}
|
|
581
|
+
var n = new Int10(v);
|
|
582
|
+
for (var i = start + 1; i < end; ++i) {
|
|
583
|
+
n.mulAdd(256, this.get(i));
|
|
584
|
+
}
|
|
585
|
+
return s + n.toString();
|
|
586
|
+
};
|
|
587
|
+
Stream2.prototype.parseBitString = function(start, end, maxLength) {
|
|
588
|
+
var unusedBit = this.get(start);
|
|
589
|
+
var lenBit = (end - start - 1 << 3) - unusedBit;
|
|
590
|
+
var intro = "(" + lenBit + " bit)\n";
|
|
591
|
+
var s = "";
|
|
592
|
+
for (var i = start + 1; i < end; ++i) {
|
|
593
|
+
var b = this.get(i);
|
|
594
|
+
var skip = i == end - 1 ? unusedBit : 0;
|
|
595
|
+
for (var j = 7; j >= skip; --j) {
|
|
596
|
+
s += b >> j & 1 ? "1" : "0";
|
|
597
|
+
}
|
|
598
|
+
if (s.length > maxLength) {
|
|
599
|
+
return intro + stringCut(s, maxLength);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
return intro + s;
|
|
603
|
+
};
|
|
604
|
+
Stream2.prototype.parseOctetString = function(start, end, maxLength) {
|
|
605
|
+
if (this.isASCII(start, end)) {
|
|
606
|
+
return stringCut(this.parseStringISO(start, end), maxLength);
|
|
607
|
+
}
|
|
608
|
+
var len = end - start;
|
|
609
|
+
var s = "(" + len + " byte)\n";
|
|
610
|
+
maxLength /= 2;
|
|
611
|
+
if (len > maxLength) {
|
|
612
|
+
end = start + maxLength;
|
|
613
|
+
}
|
|
614
|
+
for (var i = start; i < end; ++i) {
|
|
615
|
+
s += this.hexByte(this.get(i));
|
|
616
|
+
}
|
|
617
|
+
if (len > maxLength) {
|
|
618
|
+
s += ellipsis;
|
|
619
|
+
}
|
|
620
|
+
return s;
|
|
621
|
+
};
|
|
622
|
+
Stream2.prototype.parseOID = function(start, end, maxLength) {
|
|
623
|
+
var s = "";
|
|
624
|
+
var n = new Int10();
|
|
625
|
+
var bits = 0;
|
|
626
|
+
for (var i = start; i < end; ++i) {
|
|
627
|
+
var v = this.get(i);
|
|
628
|
+
n.mulAdd(128, v & 127);
|
|
629
|
+
bits += 7;
|
|
630
|
+
if (!(v & 128)) {
|
|
631
|
+
if (s === "") {
|
|
632
|
+
n = n.simplify();
|
|
633
|
+
if (n instanceof Int10) {
|
|
634
|
+
n.sub(80);
|
|
635
|
+
s = "2." + n.toString();
|
|
636
|
+
} else {
|
|
637
|
+
var m = n < 80 ? n < 40 ? 0 : 1 : 2;
|
|
638
|
+
s = m + "." + (n - m * 40);
|
|
639
|
+
}
|
|
640
|
+
} else {
|
|
641
|
+
s += "." + n.toString();
|
|
642
|
+
}
|
|
643
|
+
if (s.length > maxLength) {
|
|
644
|
+
return stringCut(s, maxLength);
|
|
645
|
+
}
|
|
646
|
+
n = new Int10();
|
|
647
|
+
bits = 0;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
if (bits > 0) {
|
|
651
|
+
s += ".incomplete";
|
|
652
|
+
}
|
|
653
|
+
return s;
|
|
654
|
+
};
|
|
655
|
+
return Stream2;
|
|
656
|
+
}()
|
|
657
|
+
);
|
|
658
|
+
var ASN1 = (
|
|
659
|
+
/** @class */
|
|
660
|
+
function() {
|
|
661
|
+
function ASN12(stream, header, length, tag, sub) {
|
|
662
|
+
if (!(tag instanceof ASN1Tag)) {
|
|
663
|
+
throw new Error("Invalid tag value.");
|
|
664
|
+
}
|
|
665
|
+
this.stream = stream;
|
|
666
|
+
this.header = header;
|
|
667
|
+
this.length = length;
|
|
668
|
+
this.tag = tag;
|
|
669
|
+
this.sub = sub;
|
|
670
|
+
}
|
|
671
|
+
ASN12.prototype.typeName = function() {
|
|
672
|
+
switch (this.tag.tagClass) {
|
|
673
|
+
case 0:
|
|
674
|
+
switch (this.tag.tagNumber) {
|
|
675
|
+
case 0:
|
|
676
|
+
return "EOC";
|
|
677
|
+
case 1:
|
|
678
|
+
return "BOOLEAN";
|
|
679
|
+
case 2:
|
|
680
|
+
return "INTEGER";
|
|
681
|
+
case 3:
|
|
682
|
+
return "BIT_STRING";
|
|
683
|
+
case 4:
|
|
684
|
+
return "OCTET_STRING";
|
|
685
|
+
case 5:
|
|
686
|
+
return "NULL";
|
|
687
|
+
case 6:
|
|
688
|
+
return "OBJECT_IDENTIFIER";
|
|
689
|
+
case 7:
|
|
690
|
+
return "ObjectDescriptor";
|
|
691
|
+
case 8:
|
|
692
|
+
return "EXTERNAL";
|
|
693
|
+
case 9:
|
|
694
|
+
return "REAL";
|
|
695
|
+
case 10:
|
|
696
|
+
return "ENUMERATED";
|
|
697
|
+
case 11:
|
|
698
|
+
return "EMBEDDED_PDV";
|
|
699
|
+
case 12:
|
|
700
|
+
return "UTF8String";
|
|
701
|
+
case 16:
|
|
702
|
+
return "SEQUENCE";
|
|
703
|
+
case 17:
|
|
704
|
+
return "SET";
|
|
705
|
+
case 18:
|
|
706
|
+
return "NumericString";
|
|
707
|
+
case 19:
|
|
708
|
+
return "PrintableString";
|
|
709
|
+
case 20:
|
|
710
|
+
return "TeletexString";
|
|
711
|
+
case 21:
|
|
712
|
+
return "VideotexString";
|
|
713
|
+
case 22:
|
|
714
|
+
return "IA5String";
|
|
715
|
+
case 23:
|
|
716
|
+
return "UTCTime";
|
|
717
|
+
case 24:
|
|
718
|
+
return "GeneralizedTime";
|
|
719
|
+
case 25:
|
|
720
|
+
return "GraphicString";
|
|
721
|
+
case 26:
|
|
722
|
+
return "VisibleString";
|
|
723
|
+
case 27:
|
|
724
|
+
return "GeneralString";
|
|
725
|
+
case 28:
|
|
726
|
+
return "UniversalString";
|
|
727
|
+
case 30:
|
|
728
|
+
return "BMPString";
|
|
729
|
+
}
|
|
730
|
+
return "Universal_" + this.tag.tagNumber.toString();
|
|
731
|
+
case 1:
|
|
732
|
+
return "Application_" + this.tag.tagNumber.toString();
|
|
733
|
+
case 2:
|
|
734
|
+
return "[" + this.tag.tagNumber.toString() + "]";
|
|
735
|
+
case 3:
|
|
736
|
+
return "Private_" + this.tag.tagNumber.toString();
|
|
737
|
+
}
|
|
738
|
+
};
|
|
739
|
+
ASN12.prototype.content = function(maxLength) {
|
|
740
|
+
if (this.tag === void 0) {
|
|
741
|
+
return null;
|
|
742
|
+
}
|
|
743
|
+
if (maxLength === void 0) {
|
|
744
|
+
maxLength = Infinity;
|
|
745
|
+
}
|
|
746
|
+
var content = this.posContent();
|
|
747
|
+
var len = Math.abs(this.length);
|
|
748
|
+
if (!this.tag.isUniversal()) {
|
|
749
|
+
if (this.sub !== null) {
|
|
750
|
+
return "(" + this.sub.length + " elem)";
|
|
751
|
+
}
|
|
752
|
+
return this.stream.parseOctetString(content, content + len, maxLength);
|
|
753
|
+
}
|
|
754
|
+
switch (this.tag.tagNumber) {
|
|
755
|
+
case 1:
|
|
756
|
+
return this.stream.get(content) === 0 ? "false" : "true";
|
|
757
|
+
case 2:
|
|
758
|
+
return this.stream.parseInteger(content, content + len);
|
|
759
|
+
case 3:
|
|
760
|
+
return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseBitString(content, content + len, maxLength);
|
|
761
|
+
case 4:
|
|
762
|
+
return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(content, content + len, maxLength);
|
|
763
|
+
case 6:
|
|
764
|
+
return this.stream.parseOID(content, content + len, maxLength);
|
|
765
|
+
case 16:
|
|
766
|
+
case 17:
|
|
767
|
+
if (this.sub !== null) {
|
|
768
|
+
return "(" + this.sub.length + " elem)";
|
|
769
|
+
} else {
|
|
770
|
+
return "(no elem)";
|
|
771
|
+
}
|
|
772
|
+
case 12:
|
|
773
|
+
return stringCut(this.stream.parseStringUTF(content, content + len), maxLength);
|
|
774
|
+
case 18:
|
|
775
|
+
case 19:
|
|
776
|
+
case 20:
|
|
777
|
+
case 21:
|
|
778
|
+
case 22:
|
|
779
|
+
case 26:
|
|
780
|
+
return stringCut(this.stream.parseStringISO(content, content + len), maxLength);
|
|
781
|
+
case 30:
|
|
782
|
+
return stringCut(this.stream.parseStringBMP(content, content + len), maxLength);
|
|
783
|
+
case 23:
|
|
784
|
+
case 24:
|
|
785
|
+
return this.stream.parseTime(content, content + len, this.tag.tagNumber == 23);
|
|
786
|
+
}
|
|
787
|
+
return null;
|
|
788
|
+
};
|
|
789
|
+
ASN12.prototype.toString = function() {
|
|
790
|
+
return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + (this.sub === null ? "null" : this.sub.length) + "]";
|
|
791
|
+
};
|
|
792
|
+
ASN12.prototype.toPrettyString = function(indent) {
|
|
793
|
+
if (indent === void 0) {
|
|
794
|
+
indent = "";
|
|
795
|
+
}
|
|
796
|
+
var s = indent + this.typeName() + " @" + this.stream.pos;
|
|
797
|
+
if (this.length >= 0) {
|
|
798
|
+
s += "+";
|
|
799
|
+
}
|
|
800
|
+
s += this.length;
|
|
801
|
+
if (this.tag.tagConstructed) {
|
|
802
|
+
s += " (constructed)";
|
|
803
|
+
} else if (this.tag.isUniversal() && (this.tag.tagNumber == 3 || this.tag.tagNumber == 4) && this.sub !== null) {
|
|
804
|
+
s += " (encapsulates)";
|
|
805
|
+
}
|
|
806
|
+
s += "\n";
|
|
807
|
+
if (this.sub !== null) {
|
|
808
|
+
indent += " ";
|
|
809
|
+
for (var i = 0, max2 = this.sub.length; i < max2; ++i) {
|
|
810
|
+
s += this.sub[i].toPrettyString(indent);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
return s;
|
|
814
|
+
};
|
|
815
|
+
ASN12.prototype.posStart = function() {
|
|
816
|
+
return this.stream.pos;
|
|
817
|
+
};
|
|
818
|
+
ASN12.prototype.posContent = function() {
|
|
819
|
+
return this.stream.pos + this.header;
|
|
820
|
+
};
|
|
821
|
+
ASN12.prototype.posEnd = function() {
|
|
822
|
+
return this.stream.pos + this.header + Math.abs(this.length);
|
|
823
|
+
};
|
|
824
|
+
ASN12.prototype.toHexString = function() {
|
|
825
|
+
return this.stream.hexDump(this.posStart(), this.posEnd(), true);
|
|
826
|
+
};
|
|
827
|
+
ASN12.decodeLength = function(stream) {
|
|
828
|
+
var buf = stream.get();
|
|
829
|
+
var len = buf & 127;
|
|
830
|
+
if (len == buf) {
|
|
831
|
+
return len;
|
|
832
|
+
}
|
|
833
|
+
if (len > 6) {
|
|
834
|
+
throw new Error("Length over 48 bits not supported at position " + (stream.pos - 1));
|
|
835
|
+
}
|
|
836
|
+
if (len === 0) {
|
|
837
|
+
return null;
|
|
838
|
+
}
|
|
839
|
+
buf = 0;
|
|
840
|
+
for (var i = 0; i < len; ++i) {
|
|
841
|
+
buf = buf * 256 + stream.get();
|
|
842
|
+
}
|
|
843
|
+
return buf;
|
|
844
|
+
};
|
|
845
|
+
ASN12.prototype.getHexStringValue = function() {
|
|
846
|
+
var hexString = this.toHexString();
|
|
847
|
+
var offset = this.header * 2;
|
|
848
|
+
var length = this.length * 2;
|
|
849
|
+
return hexString.substr(offset, length);
|
|
850
|
+
};
|
|
851
|
+
ASN12.decode = function(str) {
|
|
852
|
+
var stream;
|
|
853
|
+
if (!(str instanceof Stream)) {
|
|
854
|
+
stream = new Stream(str, 0);
|
|
855
|
+
} else {
|
|
856
|
+
stream = str;
|
|
857
|
+
}
|
|
858
|
+
var streamStart = new Stream(stream);
|
|
859
|
+
var tag = new ASN1Tag(stream);
|
|
860
|
+
var len = ASN12.decodeLength(stream);
|
|
861
|
+
var start = stream.pos;
|
|
862
|
+
var header = start - streamStart.pos;
|
|
863
|
+
var sub = null;
|
|
864
|
+
var getSub = function() {
|
|
865
|
+
var ret = [];
|
|
866
|
+
if (len !== null) {
|
|
867
|
+
var end = start + len;
|
|
868
|
+
while (stream.pos < end) {
|
|
869
|
+
ret[ret.length] = ASN12.decode(stream);
|
|
870
|
+
}
|
|
871
|
+
if (stream.pos != end) {
|
|
872
|
+
throw new Error("Content size is not correct for container starting at offset " + start);
|
|
873
|
+
}
|
|
874
|
+
} else {
|
|
875
|
+
try {
|
|
876
|
+
for (; ; ) {
|
|
877
|
+
var s = ASN12.decode(stream);
|
|
878
|
+
if (s.tag.isEOC()) {
|
|
879
|
+
break;
|
|
880
|
+
}
|
|
881
|
+
ret[ret.length] = s;
|
|
882
|
+
}
|
|
883
|
+
len = start - stream.pos;
|
|
884
|
+
} catch (e) {
|
|
885
|
+
throw new Error("Exception while decoding undefined length content: " + e);
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
return ret;
|
|
889
|
+
};
|
|
890
|
+
if (tag.tagConstructed) {
|
|
891
|
+
sub = getSub();
|
|
892
|
+
} else if (tag.isUniversal() && (tag.tagNumber == 3 || tag.tagNumber == 4)) {
|
|
893
|
+
try {
|
|
894
|
+
if (tag.tagNumber == 3) {
|
|
895
|
+
if (stream.get() != 0) {
|
|
896
|
+
throw new Error("BIT STRINGs with unused bits cannot encapsulate.");
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
sub = getSub();
|
|
900
|
+
for (var i = 0; i < sub.length; ++i) {
|
|
901
|
+
if (sub[i].tag.isEOC()) {
|
|
902
|
+
throw new Error("EOC is not supposed to be actual content.");
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
} catch (e) {
|
|
906
|
+
sub = null;
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
if (sub === null) {
|
|
910
|
+
if (len === null) {
|
|
911
|
+
throw new Error("We can't skip over an invalid tag with undefined length at offset " + start);
|
|
912
|
+
}
|
|
913
|
+
stream.pos = start + Math.abs(len);
|
|
914
|
+
}
|
|
915
|
+
return new ASN12(streamStart, header, len, tag, sub);
|
|
916
|
+
};
|
|
917
|
+
return ASN12;
|
|
918
|
+
}()
|
|
919
|
+
);
|
|
920
|
+
var ASN1Tag = (
|
|
921
|
+
/** @class */
|
|
922
|
+
function() {
|
|
923
|
+
function ASN1Tag2(stream) {
|
|
924
|
+
var buf = stream.get();
|
|
925
|
+
this.tagClass = buf >> 6;
|
|
926
|
+
this.tagConstructed = (buf & 32) !== 0;
|
|
927
|
+
this.tagNumber = buf & 31;
|
|
928
|
+
if (this.tagNumber == 31) {
|
|
929
|
+
var n = new Int10();
|
|
930
|
+
do {
|
|
931
|
+
buf = stream.get();
|
|
932
|
+
n.mulAdd(128, buf & 127);
|
|
933
|
+
} while (buf & 128);
|
|
934
|
+
this.tagNumber = n.simplify();
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
ASN1Tag2.prototype.isUniversal = function() {
|
|
938
|
+
return this.tagClass === 0;
|
|
939
|
+
};
|
|
940
|
+
ASN1Tag2.prototype.isEOC = function() {
|
|
941
|
+
return this.tagClass === 0 && this.tagNumber === 0;
|
|
942
|
+
};
|
|
943
|
+
return ASN1Tag2;
|
|
944
|
+
}()
|
|
945
|
+
);
|
|
946
|
+
var dbits;
|
|
947
|
+
var canary = 244837814094590;
|
|
948
|
+
var j_lm = (canary & 16777215) == 15715070;
|
|
949
|
+
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];
|
|
950
|
+
var lplim = (1 << 26) / lowprimes[lowprimes.length - 1];
|
|
951
|
+
var BigInteger = (
|
|
952
|
+
/** @class */
|
|
953
|
+
function() {
|
|
954
|
+
function BigInteger2(a, b, c) {
|
|
955
|
+
if (a != null) {
|
|
956
|
+
if ("number" == typeof a) {
|
|
957
|
+
this.fromNumber(a, b, c);
|
|
958
|
+
} else if (b == null && "string" != typeof a) {
|
|
959
|
+
this.fromString(a, 256);
|
|
960
|
+
} else {
|
|
961
|
+
this.fromString(a, b);
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
BigInteger2.prototype.toString = function(b) {
|
|
966
|
+
if (this.s < 0) {
|
|
967
|
+
return "-" + this.negate().toString(b);
|
|
968
|
+
}
|
|
969
|
+
var k;
|
|
970
|
+
if (b == 16) {
|
|
971
|
+
k = 4;
|
|
972
|
+
} else if (b == 8) {
|
|
973
|
+
k = 3;
|
|
974
|
+
} else if (b == 2) {
|
|
975
|
+
k = 1;
|
|
976
|
+
} else if (b == 32) {
|
|
977
|
+
k = 5;
|
|
978
|
+
} else if (b == 4) {
|
|
979
|
+
k = 2;
|
|
980
|
+
} else {
|
|
981
|
+
return this.toRadix(b);
|
|
982
|
+
}
|
|
983
|
+
var km = (1 << k) - 1;
|
|
984
|
+
var d;
|
|
985
|
+
var m = false;
|
|
986
|
+
var r = "";
|
|
987
|
+
var i = this.t;
|
|
988
|
+
var p = this.DB - i * this.DB % k;
|
|
989
|
+
if (i-- > 0) {
|
|
990
|
+
if (p < this.DB && (d = this[i] >> p) > 0) {
|
|
991
|
+
m = true;
|
|
992
|
+
r = int2char(d);
|
|
993
|
+
}
|
|
994
|
+
while (i >= 0) {
|
|
995
|
+
if (p < k) {
|
|
996
|
+
d = (this[i] & (1 << p) - 1) << k - p;
|
|
997
|
+
d |= this[--i] >> (p += this.DB - k);
|
|
998
|
+
} else {
|
|
999
|
+
d = this[i] >> (p -= k) & km;
|
|
1000
|
+
if (p <= 0) {
|
|
1001
|
+
p += this.DB;
|
|
1002
|
+
--i;
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
if (d > 0) {
|
|
1006
|
+
m = true;
|
|
1007
|
+
}
|
|
1008
|
+
if (m) {
|
|
1009
|
+
r += int2char(d);
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
return m ? r : "0";
|
|
1014
|
+
};
|
|
1015
|
+
BigInteger2.prototype.negate = function() {
|
|
1016
|
+
var r = nbi();
|
|
1017
|
+
BigInteger2.ZERO.subTo(this, r);
|
|
1018
|
+
return r;
|
|
1019
|
+
};
|
|
1020
|
+
BigInteger2.prototype.abs = function() {
|
|
1021
|
+
return this.s < 0 ? this.negate() : this;
|
|
1022
|
+
};
|
|
1023
|
+
BigInteger2.prototype.compareTo = function(a) {
|
|
1024
|
+
var r = this.s - a.s;
|
|
1025
|
+
if (r != 0) {
|
|
1026
|
+
return r;
|
|
1027
|
+
}
|
|
1028
|
+
var i = this.t;
|
|
1029
|
+
r = i - a.t;
|
|
1030
|
+
if (r != 0) {
|
|
1031
|
+
return this.s < 0 ? -r : r;
|
|
1032
|
+
}
|
|
1033
|
+
while (--i >= 0) {
|
|
1034
|
+
if ((r = this[i] - a[i]) != 0) {
|
|
1035
|
+
return r;
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
return 0;
|
|
1039
|
+
};
|
|
1040
|
+
BigInteger2.prototype.bitLength = function() {
|
|
1041
|
+
if (this.t <= 0) {
|
|
1042
|
+
return 0;
|
|
1043
|
+
}
|
|
1044
|
+
return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ this.s & this.DM);
|
|
1045
|
+
};
|
|
1046
|
+
BigInteger2.prototype.mod = function(a) {
|
|
1047
|
+
var r = nbi();
|
|
1048
|
+
this.abs().divRemTo(a, null, r);
|
|
1049
|
+
if (this.s < 0 && r.compareTo(BigInteger2.ZERO) > 0) {
|
|
1050
|
+
a.subTo(r, r);
|
|
1051
|
+
}
|
|
1052
|
+
return r;
|
|
1053
|
+
};
|
|
1054
|
+
BigInteger2.prototype.modPowInt = function(e, m) {
|
|
1055
|
+
var z2;
|
|
1056
|
+
if (e < 256 || m.isEven()) {
|
|
1057
|
+
z2 = new Classic(m);
|
|
1058
|
+
} else {
|
|
1059
|
+
z2 = new Montgomery(m);
|
|
1060
|
+
}
|
|
1061
|
+
return this.exp(e, z2);
|
|
1062
|
+
};
|
|
1063
|
+
BigInteger2.prototype.clone = function() {
|
|
1064
|
+
var r = nbi();
|
|
1065
|
+
this.copyTo(r);
|
|
1066
|
+
return r;
|
|
1067
|
+
};
|
|
1068
|
+
BigInteger2.prototype.intValue = function() {
|
|
1069
|
+
if (this.s < 0) {
|
|
1070
|
+
if (this.t == 1) {
|
|
1071
|
+
return this[0] - this.DV;
|
|
1072
|
+
} else if (this.t == 0) {
|
|
1073
|
+
return -1;
|
|
1074
|
+
}
|
|
1075
|
+
} else if (this.t == 1) {
|
|
1076
|
+
return this[0];
|
|
1077
|
+
} else if (this.t == 0) {
|
|
1078
|
+
return 0;
|
|
1079
|
+
}
|
|
1080
|
+
return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0];
|
|
1081
|
+
};
|
|
1082
|
+
BigInteger2.prototype.byteValue = function() {
|
|
1083
|
+
return this.t == 0 ? this.s : this[0] << 24 >> 24;
|
|
1084
|
+
};
|
|
1085
|
+
BigInteger2.prototype.shortValue = function() {
|
|
1086
|
+
return this.t == 0 ? this.s : this[0] << 16 >> 16;
|
|
1087
|
+
};
|
|
1088
|
+
BigInteger2.prototype.signum = function() {
|
|
1089
|
+
if (this.s < 0) {
|
|
1090
|
+
return -1;
|
|
1091
|
+
} else if (this.t <= 0 || this.t == 1 && this[0] <= 0) {
|
|
1092
|
+
return 0;
|
|
1093
|
+
} else {
|
|
1094
|
+
return 1;
|
|
1095
|
+
}
|
|
1096
|
+
};
|
|
1097
|
+
BigInteger2.prototype.toByteArray = function() {
|
|
1098
|
+
var i = this.t;
|
|
1099
|
+
var r = [];
|
|
1100
|
+
r[0] = this.s;
|
|
1101
|
+
var p = this.DB - i * this.DB % 8;
|
|
1102
|
+
var d;
|
|
1103
|
+
var k = 0;
|
|
1104
|
+
if (i-- > 0) {
|
|
1105
|
+
if (p < this.DB && (d = this[i] >> p) != (this.s & this.DM) >> p) {
|
|
1106
|
+
r[k++] = d | this.s << this.DB - p;
|
|
1107
|
+
}
|
|
1108
|
+
while (i >= 0) {
|
|
1109
|
+
if (p < 8) {
|
|
1110
|
+
d = (this[i] & (1 << p) - 1) << 8 - p;
|
|
1111
|
+
d |= this[--i] >> (p += this.DB - 8);
|
|
1112
|
+
} else {
|
|
1113
|
+
d = this[i] >> (p -= 8) & 255;
|
|
1114
|
+
if (p <= 0) {
|
|
1115
|
+
p += this.DB;
|
|
1116
|
+
--i;
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
if ((d & 128) != 0) {
|
|
1120
|
+
d |= -256;
|
|
1121
|
+
}
|
|
1122
|
+
if (k == 0 && (this.s & 128) != (d & 128)) {
|
|
1123
|
+
++k;
|
|
1124
|
+
}
|
|
1125
|
+
if (k > 0 || d != this.s) {
|
|
1126
|
+
r[k++] = d;
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
return r;
|
|
1131
|
+
};
|
|
1132
|
+
BigInteger2.prototype.equals = function(a) {
|
|
1133
|
+
return this.compareTo(a) == 0;
|
|
1134
|
+
};
|
|
1135
|
+
BigInteger2.prototype.min = function(a) {
|
|
1136
|
+
return this.compareTo(a) < 0 ? this : a;
|
|
1137
|
+
};
|
|
1138
|
+
BigInteger2.prototype.max = function(a) {
|
|
1139
|
+
return this.compareTo(a) > 0 ? this : a;
|
|
1140
|
+
};
|
|
1141
|
+
BigInteger2.prototype.and = function(a) {
|
|
1142
|
+
var r = nbi();
|
|
1143
|
+
this.bitwiseTo(a, op_and, r);
|
|
1144
|
+
return r;
|
|
1145
|
+
};
|
|
1146
|
+
BigInteger2.prototype.or = function(a) {
|
|
1147
|
+
var r = nbi();
|
|
1148
|
+
this.bitwiseTo(a, op_or, r);
|
|
1149
|
+
return r;
|
|
1150
|
+
};
|
|
1151
|
+
BigInteger2.prototype.xor = function(a) {
|
|
1152
|
+
var r = nbi();
|
|
1153
|
+
this.bitwiseTo(a, op_xor, r);
|
|
1154
|
+
return r;
|
|
1155
|
+
};
|
|
1156
|
+
BigInteger2.prototype.andNot = function(a) {
|
|
1157
|
+
var r = nbi();
|
|
1158
|
+
this.bitwiseTo(a, op_andnot, r);
|
|
1159
|
+
return r;
|
|
1160
|
+
};
|
|
1161
|
+
BigInteger2.prototype.not = function() {
|
|
1162
|
+
var r = nbi();
|
|
1163
|
+
for (var i = 0; i < this.t; ++i) {
|
|
1164
|
+
r[i] = this.DM & ~this[i];
|
|
1165
|
+
}
|
|
1166
|
+
r.t = this.t;
|
|
1167
|
+
r.s = ~this.s;
|
|
1168
|
+
return r;
|
|
1169
|
+
};
|
|
1170
|
+
BigInteger2.prototype.shiftLeft = function(n) {
|
|
1171
|
+
var r = nbi();
|
|
1172
|
+
if (n < 0) {
|
|
1173
|
+
this.rShiftTo(-n, r);
|
|
1174
|
+
} else {
|
|
1175
|
+
this.lShiftTo(n, r);
|
|
1176
|
+
}
|
|
1177
|
+
return r;
|
|
1178
|
+
};
|
|
1179
|
+
BigInteger2.prototype.shiftRight = function(n) {
|
|
1180
|
+
var r = nbi();
|
|
1181
|
+
if (n < 0) {
|
|
1182
|
+
this.lShiftTo(-n, r);
|
|
1183
|
+
} else {
|
|
1184
|
+
this.rShiftTo(n, r);
|
|
1185
|
+
}
|
|
1186
|
+
return r;
|
|
1187
|
+
};
|
|
1188
|
+
BigInteger2.prototype.getLowestSetBit = function() {
|
|
1189
|
+
for (var i = 0; i < this.t; ++i) {
|
|
1190
|
+
if (this[i] != 0) {
|
|
1191
|
+
return i * this.DB + lbit(this[i]);
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
if (this.s < 0) {
|
|
1195
|
+
return this.t * this.DB;
|
|
1196
|
+
}
|
|
1197
|
+
return -1;
|
|
1198
|
+
};
|
|
1199
|
+
BigInteger2.prototype.bitCount = function() {
|
|
1200
|
+
var r = 0;
|
|
1201
|
+
var x = this.s & this.DM;
|
|
1202
|
+
for (var i = 0; i < this.t; ++i) {
|
|
1203
|
+
r += cbit(this[i] ^ x);
|
|
1204
|
+
}
|
|
1205
|
+
return r;
|
|
1206
|
+
};
|
|
1207
|
+
BigInteger2.prototype.testBit = function(n) {
|
|
1208
|
+
var j = Math.floor(n / this.DB);
|
|
1209
|
+
if (j >= this.t) {
|
|
1210
|
+
return this.s != 0;
|
|
1211
|
+
}
|
|
1212
|
+
return (this[j] & 1 << n % this.DB) != 0;
|
|
1213
|
+
};
|
|
1214
|
+
BigInteger2.prototype.setBit = function(n) {
|
|
1215
|
+
return this.changeBit(n, op_or);
|
|
1216
|
+
};
|
|
1217
|
+
BigInteger2.prototype.clearBit = function(n) {
|
|
1218
|
+
return this.changeBit(n, op_andnot);
|
|
1219
|
+
};
|
|
1220
|
+
BigInteger2.prototype.flipBit = function(n) {
|
|
1221
|
+
return this.changeBit(n, op_xor);
|
|
1222
|
+
};
|
|
1223
|
+
BigInteger2.prototype.add = function(a) {
|
|
1224
|
+
var r = nbi();
|
|
1225
|
+
this.addTo(a, r);
|
|
1226
|
+
return r;
|
|
1227
|
+
};
|
|
1228
|
+
BigInteger2.prototype.subtract = function(a) {
|
|
1229
|
+
var r = nbi();
|
|
1230
|
+
this.subTo(a, r);
|
|
1231
|
+
return r;
|
|
1232
|
+
};
|
|
1233
|
+
BigInteger2.prototype.multiply = function(a) {
|
|
1234
|
+
var r = nbi();
|
|
1235
|
+
this.multiplyTo(a, r);
|
|
1236
|
+
return r;
|
|
1237
|
+
};
|
|
1238
|
+
BigInteger2.prototype.divide = function(a) {
|
|
1239
|
+
var r = nbi();
|
|
1240
|
+
this.divRemTo(a, r, null);
|
|
1241
|
+
return r;
|
|
1242
|
+
};
|
|
1243
|
+
BigInteger2.prototype.remainder = function(a) {
|
|
1244
|
+
var r = nbi();
|
|
1245
|
+
this.divRemTo(a, null, r);
|
|
1246
|
+
return r;
|
|
1247
|
+
};
|
|
1248
|
+
BigInteger2.prototype.divideAndRemainder = function(a) {
|
|
1249
|
+
var q = nbi();
|
|
1250
|
+
var r = nbi();
|
|
1251
|
+
this.divRemTo(a, q, r);
|
|
1252
|
+
return [q, r];
|
|
1253
|
+
};
|
|
1254
|
+
BigInteger2.prototype.modPow = function(e, m) {
|
|
1255
|
+
var i = e.bitLength();
|
|
1256
|
+
var k;
|
|
1257
|
+
var r = nbv(1);
|
|
1258
|
+
var z2;
|
|
1259
|
+
if (i <= 0) {
|
|
1260
|
+
return r;
|
|
1261
|
+
} else if (i < 18) {
|
|
1262
|
+
k = 1;
|
|
1263
|
+
} else if (i < 48) {
|
|
1264
|
+
k = 3;
|
|
1265
|
+
} else if (i < 144) {
|
|
1266
|
+
k = 4;
|
|
1267
|
+
} else if (i < 768) {
|
|
1268
|
+
k = 5;
|
|
1269
|
+
} else {
|
|
1270
|
+
k = 6;
|
|
1271
|
+
}
|
|
1272
|
+
if (i < 8) {
|
|
1273
|
+
z2 = new Classic(m);
|
|
1274
|
+
} else if (m.isEven()) {
|
|
1275
|
+
z2 = new Barrett(m);
|
|
1276
|
+
} else {
|
|
1277
|
+
z2 = new Montgomery(m);
|
|
1278
|
+
}
|
|
1279
|
+
var g = [];
|
|
1280
|
+
var n = 3;
|
|
1281
|
+
var k1 = k - 1;
|
|
1282
|
+
var km = (1 << k) - 1;
|
|
1283
|
+
g[1] = z2.convert(this);
|
|
1284
|
+
if (k > 1) {
|
|
1285
|
+
var g2 = nbi();
|
|
1286
|
+
z2.sqrTo(g[1], g2);
|
|
1287
|
+
while (n <= km) {
|
|
1288
|
+
g[n] = nbi();
|
|
1289
|
+
z2.mulTo(g2, g[n - 2], g[n]);
|
|
1290
|
+
n += 2;
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
var j = e.t - 1;
|
|
1294
|
+
var w;
|
|
1295
|
+
var is1 = true;
|
|
1296
|
+
var r2 = nbi();
|
|
1297
|
+
var t2;
|
|
1298
|
+
i = nbits(e[j]) - 1;
|
|
1299
|
+
while (j >= 0) {
|
|
1300
|
+
if (i >= k1) {
|
|
1301
|
+
w = e[j] >> i - k1 & km;
|
|
1302
|
+
} else {
|
|
1303
|
+
w = (e[j] & (1 << i + 1) - 1) << k1 - i;
|
|
1304
|
+
if (j > 0) {
|
|
1305
|
+
w |= e[j - 1] >> this.DB + i - k1;
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
n = k;
|
|
1309
|
+
while ((w & 1) == 0) {
|
|
1310
|
+
w >>= 1;
|
|
1311
|
+
--n;
|
|
1312
|
+
}
|
|
1313
|
+
if ((i -= n) < 0) {
|
|
1314
|
+
i += this.DB;
|
|
1315
|
+
--j;
|
|
1316
|
+
}
|
|
1317
|
+
if (is1) {
|
|
1318
|
+
g[w].copyTo(r);
|
|
1319
|
+
is1 = false;
|
|
1320
|
+
} else {
|
|
1321
|
+
while (n > 1) {
|
|
1322
|
+
z2.sqrTo(r, r2);
|
|
1323
|
+
z2.sqrTo(r2, r);
|
|
1324
|
+
n -= 2;
|
|
1325
|
+
}
|
|
1326
|
+
if (n > 0) {
|
|
1327
|
+
z2.sqrTo(r, r2);
|
|
1328
|
+
} else {
|
|
1329
|
+
t2 = r;
|
|
1330
|
+
r = r2;
|
|
1331
|
+
r2 = t2;
|
|
1332
|
+
}
|
|
1333
|
+
z2.mulTo(r2, g[w], r);
|
|
1334
|
+
}
|
|
1335
|
+
while (j >= 0 && (e[j] & 1 << i) == 0) {
|
|
1336
|
+
z2.sqrTo(r, r2);
|
|
1337
|
+
t2 = r;
|
|
1338
|
+
r = r2;
|
|
1339
|
+
r2 = t2;
|
|
1340
|
+
if (--i < 0) {
|
|
1341
|
+
i = this.DB - 1;
|
|
1342
|
+
--j;
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
return z2.revert(r);
|
|
1347
|
+
};
|
|
1348
|
+
BigInteger2.prototype.modInverse = function(m) {
|
|
1349
|
+
var ac = m.isEven();
|
|
1350
|
+
if (this.isEven() && ac || m.signum() == 0) {
|
|
1351
|
+
return BigInteger2.ZERO;
|
|
1352
|
+
}
|
|
1353
|
+
var u = m.clone();
|
|
1354
|
+
var v = this.clone();
|
|
1355
|
+
var a = nbv(1);
|
|
1356
|
+
var b = nbv(0);
|
|
1357
|
+
var c = nbv(0);
|
|
1358
|
+
var d = nbv(1);
|
|
1359
|
+
while (u.signum() != 0) {
|
|
1360
|
+
while (u.isEven()) {
|
|
1361
|
+
u.rShiftTo(1, u);
|
|
1362
|
+
if (ac) {
|
|
1363
|
+
if (!a.isEven() || !b.isEven()) {
|
|
1364
|
+
a.addTo(this, a);
|
|
1365
|
+
b.subTo(m, b);
|
|
1366
|
+
}
|
|
1367
|
+
a.rShiftTo(1, a);
|
|
1368
|
+
} else if (!b.isEven()) {
|
|
1369
|
+
b.subTo(m, b);
|
|
1370
|
+
}
|
|
1371
|
+
b.rShiftTo(1, b);
|
|
1372
|
+
}
|
|
1373
|
+
while (v.isEven()) {
|
|
1374
|
+
v.rShiftTo(1, v);
|
|
1375
|
+
if (ac) {
|
|
1376
|
+
if (!c.isEven() || !d.isEven()) {
|
|
1377
|
+
c.addTo(this, c);
|
|
1378
|
+
d.subTo(m, d);
|
|
1379
|
+
}
|
|
1380
|
+
c.rShiftTo(1, c);
|
|
1381
|
+
} else if (!d.isEven()) {
|
|
1382
|
+
d.subTo(m, d);
|
|
1383
|
+
}
|
|
1384
|
+
d.rShiftTo(1, d);
|
|
1385
|
+
}
|
|
1386
|
+
if (u.compareTo(v) >= 0) {
|
|
1387
|
+
u.subTo(v, u);
|
|
1388
|
+
if (ac) {
|
|
1389
|
+
a.subTo(c, a);
|
|
1390
|
+
}
|
|
1391
|
+
b.subTo(d, b);
|
|
1392
|
+
} else {
|
|
1393
|
+
v.subTo(u, v);
|
|
1394
|
+
if (ac) {
|
|
1395
|
+
c.subTo(a, c);
|
|
1396
|
+
}
|
|
1397
|
+
d.subTo(b, d);
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
if (v.compareTo(BigInteger2.ONE) != 0) {
|
|
1401
|
+
return BigInteger2.ZERO;
|
|
1402
|
+
}
|
|
1403
|
+
if (d.compareTo(m) >= 0) {
|
|
1404
|
+
return d.subtract(m);
|
|
1405
|
+
}
|
|
1406
|
+
if (d.signum() < 0) {
|
|
1407
|
+
d.addTo(m, d);
|
|
1408
|
+
} else {
|
|
1409
|
+
return d;
|
|
1410
|
+
}
|
|
1411
|
+
if (d.signum() < 0) {
|
|
1412
|
+
return d.add(m);
|
|
1413
|
+
} else {
|
|
1414
|
+
return d;
|
|
1415
|
+
}
|
|
1416
|
+
};
|
|
1417
|
+
BigInteger2.prototype.pow = function(e) {
|
|
1418
|
+
return this.exp(e, new NullExp());
|
|
1419
|
+
};
|
|
1420
|
+
BigInteger2.prototype.gcd = function(a) {
|
|
1421
|
+
var x = this.s < 0 ? this.negate() : this.clone();
|
|
1422
|
+
var y = a.s < 0 ? a.negate() : a.clone();
|
|
1423
|
+
if (x.compareTo(y) < 0) {
|
|
1424
|
+
var t2 = x;
|
|
1425
|
+
x = y;
|
|
1426
|
+
y = t2;
|
|
1427
|
+
}
|
|
1428
|
+
var i = x.getLowestSetBit();
|
|
1429
|
+
var g = y.getLowestSetBit();
|
|
1430
|
+
if (g < 0) {
|
|
1431
|
+
return x;
|
|
1432
|
+
}
|
|
1433
|
+
if (i < g) {
|
|
1434
|
+
g = i;
|
|
1435
|
+
}
|
|
1436
|
+
if (g > 0) {
|
|
1437
|
+
x.rShiftTo(g, x);
|
|
1438
|
+
y.rShiftTo(g, y);
|
|
1439
|
+
}
|
|
1440
|
+
while (x.signum() > 0) {
|
|
1441
|
+
if ((i = x.getLowestSetBit()) > 0) {
|
|
1442
|
+
x.rShiftTo(i, x);
|
|
1443
|
+
}
|
|
1444
|
+
if ((i = y.getLowestSetBit()) > 0) {
|
|
1445
|
+
y.rShiftTo(i, y);
|
|
1446
|
+
}
|
|
1447
|
+
if (x.compareTo(y) >= 0) {
|
|
1448
|
+
x.subTo(y, x);
|
|
1449
|
+
x.rShiftTo(1, x);
|
|
1450
|
+
} else {
|
|
1451
|
+
y.subTo(x, y);
|
|
1452
|
+
y.rShiftTo(1, y);
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
if (g > 0) {
|
|
1456
|
+
y.lShiftTo(g, y);
|
|
1457
|
+
}
|
|
1458
|
+
return y;
|
|
1459
|
+
};
|
|
1460
|
+
BigInteger2.prototype.isProbablePrime = function(t2) {
|
|
1461
|
+
var i;
|
|
1462
|
+
var x = this.abs();
|
|
1463
|
+
if (x.t == 1 && x[0] <= lowprimes[lowprimes.length - 1]) {
|
|
1464
|
+
for (i = 0; i < lowprimes.length; ++i) {
|
|
1465
|
+
if (x[0] == lowprimes[i]) {
|
|
1466
|
+
return true;
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
return false;
|
|
1470
|
+
}
|
|
1471
|
+
if (x.isEven()) {
|
|
1472
|
+
return false;
|
|
1473
|
+
}
|
|
1474
|
+
i = 1;
|
|
1475
|
+
while (i < lowprimes.length) {
|
|
1476
|
+
var m = lowprimes[i];
|
|
1477
|
+
var j = i + 1;
|
|
1478
|
+
while (j < lowprimes.length && m < lplim) {
|
|
1479
|
+
m *= lowprimes[j++];
|
|
1480
|
+
}
|
|
1481
|
+
m = x.modInt(m);
|
|
1482
|
+
while (i < j) {
|
|
1483
|
+
if (m % lowprimes[i++] == 0) {
|
|
1484
|
+
return false;
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
return x.millerRabin(t2);
|
|
1489
|
+
};
|
|
1490
|
+
BigInteger2.prototype.copyTo = function(r) {
|
|
1491
|
+
for (var i = this.t - 1; i >= 0; --i) {
|
|
1492
|
+
r[i] = this[i];
|
|
1493
|
+
}
|
|
1494
|
+
r.t = this.t;
|
|
1495
|
+
r.s = this.s;
|
|
1496
|
+
};
|
|
1497
|
+
BigInteger2.prototype.fromInt = function(x) {
|
|
1498
|
+
this.t = 1;
|
|
1499
|
+
this.s = x < 0 ? -1 : 0;
|
|
1500
|
+
if (x > 0) {
|
|
1501
|
+
this[0] = x;
|
|
1502
|
+
} else if (x < -1) {
|
|
1503
|
+
this[0] = x + this.DV;
|
|
1504
|
+
} else {
|
|
1505
|
+
this.t = 0;
|
|
1506
|
+
}
|
|
1507
|
+
};
|
|
1508
|
+
BigInteger2.prototype.fromString = function(s, b) {
|
|
1509
|
+
var k;
|
|
1510
|
+
if (b == 16) {
|
|
1511
|
+
k = 4;
|
|
1512
|
+
} else if (b == 8) {
|
|
1513
|
+
k = 3;
|
|
1514
|
+
} else if (b == 256) {
|
|
1515
|
+
k = 8;
|
|
1516
|
+
} else if (b == 2) {
|
|
1517
|
+
k = 1;
|
|
1518
|
+
} else if (b == 32) {
|
|
1519
|
+
k = 5;
|
|
1520
|
+
} else if (b == 4) {
|
|
1521
|
+
k = 2;
|
|
1522
|
+
} else {
|
|
1523
|
+
this.fromRadix(s, b);
|
|
1524
|
+
return;
|
|
1525
|
+
}
|
|
1526
|
+
this.t = 0;
|
|
1527
|
+
this.s = 0;
|
|
1528
|
+
var i = s.length;
|
|
1529
|
+
var mi = false;
|
|
1530
|
+
var sh = 0;
|
|
1531
|
+
while (--i >= 0) {
|
|
1532
|
+
var x = k == 8 ? +s[i] & 255 : intAt(s, i);
|
|
1533
|
+
if (x < 0) {
|
|
1534
|
+
if (s.charAt(i) == "-") {
|
|
1535
|
+
mi = true;
|
|
1536
|
+
}
|
|
1537
|
+
continue;
|
|
1538
|
+
}
|
|
1539
|
+
mi = false;
|
|
1540
|
+
if (sh == 0) {
|
|
1541
|
+
this[this.t++] = x;
|
|
1542
|
+
} else if (sh + k > this.DB) {
|
|
1543
|
+
this[this.t - 1] |= (x & (1 << this.DB - sh) - 1) << sh;
|
|
1544
|
+
this[this.t++] = x >> this.DB - sh;
|
|
1545
|
+
} else {
|
|
1546
|
+
this[this.t - 1] |= x << sh;
|
|
1547
|
+
}
|
|
1548
|
+
sh += k;
|
|
1549
|
+
if (sh >= this.DB) {
|
|
1550
|
+
sh -= this.DB;
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
if (k == 8 && (+s[0] & 128) != 0) {
|
|
1554
|
+
this.s = -1;
|
|
1555
|
+
if (sh > 0) {
|
|
1556
|
+
this[this.t - 1] |= (1 << this.DB - sh) - 1 << sh;
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
this.clamp();
|
|
1560
|
+
if (mi) {
|
|
1561
|
+
BigInteger2.ZERO.subTo(this, this);
|
|
1562
|
+
}
|
|
1563
|
+
};
|
|
1564
|
+
BigInteger2.prototype.clamp = function() {
|
|
1565
|
+
var c = this.s & this.DM;
|
|
1566
|
+
while (this.t > 0 && this[this.t - 1] == c) {
|
|
1567
|
+
--this.t;
|
|
1568
|
+
}
|
|
1569
|
+
};
|
|
1570
|
+
BigInteger2.prototype.dlShiftTo = function(n, r) {
|
|
1571
|
+
var i;
|
|
1572
|
+
for (i = this.t - 1; i >= 0; --i) {
|
|
1573
|
+
r[i + n] = this[i];
|
|
1574
|
+
}
|
|
1575
|
+
for (i = n - 1; i >= 0; --i) {
|
|
1576
|
+
r[i] = 0;
|
|
1577
|
+
}
|
|
1578
|
+
r.t = this.t + n;
|
|
1579
|
+
r.s = this.s;
|
|
1580
|
+
};
|
|
1581
|
+
BigInteger2.prototype.drShiftTo = function(n, r) {
|
|
1582
|
+
for (var i = n; i < this.t; ++i) {
|
|
1583
|
+
r[i - n] = this[i];
|
|
1584
|
+
}
|
|
1585
|
+
r.t = Math.max(this.t - n, 0);
|
|
1586
|
+
r.s = this.s;
|
|
1587
|
+
};
|
|
1588
|
+
BigInteger2.prototype.lShiftTo = function(n, r) {
|
|
1589
|
+
var bs = n % this.DB;
|
|
1590
|
+
var cbs = this.DB - bs;
|
|
1591
|
+
var bm = (1 << cbs) - 1;
|
|
1592
|
+
var ds = Math.floor(n / this.DB);
|
|
1593
|
+
var c = this.s << bs & this.DM;
|
|
1594
|
+
for (var i = this.t - 1; i >= 0; --i) {
|
|
1595
|
+
r[i + ds + 1] = this[i] >> cbs | c;
|
|
1596
|
+
c = (this[i] & bm) << bs;
|
|
1597
|
+
}
|
|
1598
|
+
for (var i = ds - 1; i >= 0; --i) {
|
|
1599
|
+
r[i] = 0;
|
|
1600
|
+
}
|
|
1601
|
+
r[ds] = c;
|
|
1602
|
+
r.t = this.t + ds + 1;
|
|
1603
|
+
r.s = this.s;
|
|
1604
|
+
r.clamp();
|
|
1605
|
+
};
|
|
1606
|
+
BigInteger2.prototype.rShiftTo = function(n, r) {
|
|
1607
|
+
r.s = this.s;
|
|
1608
|
+
var ds = Math.floor(n / this.DB);
|
|
1609
|
+
if (ds >= this.t) {
|
|
1610
|
+
r.t = 0;
|
|
1611
|
+
return;
|
|
1612
|
+
}
|
|
1613
|
+
var bs = n % this.DB;
|
|
1614
|
+
var cbs = this.DB - bs;
|
|
1615
|
+
var bm = (1 << bs) - 1;
|
|
1616
|
+
r[0] = this[ds] >> bs;
|
|
1617
|
+
for (var i = ds + 1; i < this.t; ++i) {
|
|
1618
|
+
r[i - ds - 1] |= (this[i] & bm) << cbs;
|
|
1619
|
+
r[i - ds] = this[i] >> bs;
|
|
1620
|
+
}
|
|
1621
|
+
if (bs > 0) {
|
|
1622
|
+
r[this.t - ds - 1] |= (this.s & bm) << cbs;
|
|
1623
|
+
}
|
|
1624
|
+
r.t = this.t - ds;
|
|
1625
|
+
r.clamp();
|
|
1626
|
+
};
|
|
1627
|
+
BigInteger2.prototype.subTo = function(a, r) {
|
|
1628
|
+
var i = 0;
|
|
1629
|
+
var c = 0;
|
|
1630
|
+
var m = Math.min(a.t, this.t);
|
|
1631
|
+
while (i < m) {
|
|
1632
|
+
c += this[i] - a[i];
|
|
1633
|
+
r[i++] = c & this.DM;
|
|
1634
|
+
c >>= this.DB;
|
|
1635
|
+
}
|
|
1636
|
+
if (a.t < this.t) {
|
|
1637
|
+
c -= a.s;
|
|
1638
|
+
while (i < this.t) {
|
|
1639
|
+
c += this[i];
|
|
1640
|
+
r[i++] = c & this.DM;
|
|
1641
|
+
c >>= this.DB;
|
|
1642
|
+
}
|
|
1643
|
+
c += this.s;
|
|
1644
|
+
} else {
|
|
1645
|
+
c += this.s;
|
|
1646
|
+
while (i < a.t) {
|
|
1647
|
+
c -= a[i];
|
|
1648
|
+
r[i++] = c & this.DM;
|
|
1649
|
+
c >>= this.DB;
|
|
1650
|
+
}
|
|
1651
|
+
c -= a.s;
|
|
1652
|
+
}
|
|
1653
|
+
r.s = c < 0 ? -1 : 0;
|
|
1654
|
+
if (c < -1) {
|
|
1655
|
+
r[i++] = this.DV + c;
|
|
1656
|
+
} else if (c > 0) {
|
|
1657
|
+
r[i++] = c;
|
|
1658
|
+
}
|
|
1659
|
+
r.t = i;
|
|
1660
|
+
r.clamp();
|
|
1661
|
+
};
|
|
1662
|
+
BigInteger2.prototype.multiplyTo = function(a, r) {
|
|
1663
|
+
var x = this.abs();
|
|
1664
|
+
var y = a.abs();
|
|
1665
|
+
var i = x.t;
|
|
1666
|
+
r.t = i + y.t;
|
|
1667
|
+
while (--i >= 0) {
|
|
1668
|
+
r[i] = 0;
|
|
1669
|
+
}
|
|
1670
|
+
for (i = 0; i < y.t; ++i) {
|
|
1671
|
+
r[i + x.t] = x.am(0, y[i], r, i, 0, x.t);
|
|
1672
|
+
}
|
|
1673
|
+
r.s = 0;
|
|
1674
|
+
r.clamp();
|
|
1675
|
+
if (this.s != a.s) {
|
|
1676
|
+
BigInteger2.ZERO.subTo(r, r);
|
|
1677
|
+
}
|
|
1678
|
+
};
|
|
1679
|
+
BigInteger2.prototype.squareTo = function(r) {
|
|
1680
|
+
var x = this.abs();
|
|
1681
|
+
var i = r.t = 2 * x.t;
|
|
1682
|
+
while (--i >= 0) {
|
|
1683
|
+
r[i] = 0;
|
|
1684
|
+
}
|
|
1685
|
+
for (i = 0; i < x.t - 1; ++i) {
|
|
1686
|
+
var c = x.am(i, x[i], r, 2 * i, 0, 1);
|
|
1687
|
+
if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) {
|
|
1688
|
+
r[i + x.t] -= x.DV;
|
|
1689
|
+
r[i + x.t + 1] = 1;
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
if (r.t > 0) {
|
|
1693
|
+
r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1);
|
|
1694
|
+
}
|
|
1695
|
+
r.s = 0;
|
|
1696
|
+
r.clamp();
|
|
1697
|
+
};
|
|
1698
|
+
BigInteger2.prototype.divRemTo = function(m, q, r) {
|
|
1699
|
+
var pm = m.abs();
|
|
1700
|
+
if (pm.t <= 0) {
|
|
1701
|
+
return;
|
|
1702
|
+
}
|
|
1703
|
+
var pt = this.abs();
|
|
1704
|
+
if (pt.t < pm.t) {
|
|
1705
|
+
if (q != null) {
|
|
1706
|
+
q.fromInt(0);
|
|
1707
|
+
}
|
|
1708
|
+
if (r != null) {
|
|
1709
|
+
this.copyTo(r);
|
|
1710
|
+
}
|
|
1711
|
+
return;
|
|
1712
|
+
}
|
|
1713
|
+
if (r == null) {
|
|
1714
|
+
r = nbi();
|
|
1715
|
+
}
|
|
1716
|
+
var y = nbi();
|
|
1717
|
+
var ts = this.s;
|
|
1718
|
+
var ms = m.s;
|
|
1719
|
+
var nsh = this.DB - nbits(pm[pm.t - 1]);
|
|
1720
|
+
if (nsh > 0) {
|
|
1721
|
+
pm.lShiftTo(nsh, y);
|
|
1722
|
+
pt.lShiftTo(nsh, r);
|
|
1723
|
+
} else {
|
|
1724
|
+
pm.copyTo(y);
|
|
1725
|
+
pt.copyTo(r);
|
|
1726
|
+
}
|
|
1727
|
+
var ys = y.t;
|
|
1728
|
+
var y0 = y[ys - 1];
|
|
1729
|
+
if (y0 == 0) {
|
|
1730
|
+
return;
|
|
1731
|
+
}
|
|
1732
|
+
var yt = y0 * (1 << this.F1) + (ys > 1 ? y[ys - 2] >> this.F2 : 0);
|
|
1733
|
+
var d1 = this.FV / yt;
|
|
1734
|
+
var d2 = (1 << this.F1) / yt;
|
|
1735
|
+
var e = 1 << this.F2;
|
|
1736
|
+
var i = r.t;
|
|
1737
|
+
var j = i - ys;
|
|
1738
|
+
var t2 = q == null ? nbi() : q;
|
|
1739
|
+
y.dlShiftTo(j, t2);
|
|
1740
|
+
if (r.compareTo(t2) >= 0) {
|
|
1741
|
+
r[r.t++] = 1;
|
|
1742
|
+
r.subTo(t2, r);
|
|
1743
|
+
}
|
|
1744
|
+
BigInteger2.ONE.dlShiftTo(ys, t2);
|
|
1745
|
+
t2.subTo(y, y);
|
|
1746
|
+
while (y.t < ys) {
|
|
1747
|
+
y[y.t++] = 0;
|
|
1748
|
+
}
|
|
1749
|
+
while (--j >= 0) {
|
|
1750
|
+
var qd = r[--i] == y0 ? this.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2);
|
|
1751
|
+
if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) {
|
|
1752
|
+
y.dlShiftTo(j, t2);
|
|
1753
|
+
r.subTo(t2, r);
|
|
1754
|
+
while (r[i] < --qd) {
|
|
1755
|
+
r.subTo(t2, r);
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
if (q != null) {
|
|
1760
|
+
r.drShiftTo(ys, q);
|
|
1761
|
+
if (ts != ms) {
|
|
1762
|
+
BigInteger2.ZERO.subTo(q, q);
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
r.t = ys;
|
|
1766
|
+
r.clamp();
|
|
1767
|
+
if (nsh > 0) {
|
|
1768
|
+
r.rShiftTo(nsh, r);
|
|
1769
|
+
}
|
|
1770
|
+
if (ts < 0) {
|
|
1771
|
+
BigInteger2.ZERO.subTo(r, r);
|
|
1772
|
+
}
|
|
1773
|
+
};
|
|
1774
|
+
BigInteger2.prototype.invDigit = function() {
|
|
1775
|
+
if (this.t < 1) {
|
|
1776
|
+
return 0;
|
|
1777
|
+
}
|
|
1778
|
+
var x = this[0];
|
|
1779
|
+
if ((x & 1) == 0) {
|
|
1780
|
+
return 0;
|
|
1781
|
+
}
|
|
1782
|
+
var y = x & 3;
|
|
1783
|
+
y = y * (2 - (x & 15) * y) & 15;
|
|
1784
|
+
y = y * (2 - (x & 255) * y) & 255;
|
|
1785
|
+
y = y * (2 - ((x & 65535) * y & 65535)) & 65535;
|
|
1786
|
+
y = y * (2 - x * y % this.DV) % this.DV;
|
|
1787
|
+
return y > 0 ? this.DV - y : -y;
|
|
1788
|
+
};
|
|
1789
|
+
BigInteger2.prototype.isEven = function() {
|
|
1790
|
+
return (this.t > 0 ? this[0] & 1 : this.s) == 0;
|
|
1791
|
+
};
|
|
1792
|
+
BigInteger2.prototype.exp = function(e, z2) {
|
|
1793
|
+
if (e > 4294967295 || e < 1) {
|
|
1794
|
+
return BigInteger2.ONE;
|
|
1795
|
+
}
|
|
1796
|
+
var r = nbi();
|
|
1797
|
+
var r2 = nbi();
|
|
1798
|
+
var g = z2.convert(this);
|
|
1799
|
+
var i = nbits(e) - 1;
|
|
1800
|
+
g.copyTo(r);
|
|
1801
|
+
while (--i >= 0) {
|
|
1802
|
+
z2.sqrTo(r, r2);
|
|
1803
|
+
if ((e & 1 << i) > 0) {
|
|
1804
|
+
z2.mulTo(r2, g, r);
|
|
1805
|
+
} else {
|
|
1806
|
+
var t2 = r;
|
|
1807
|
+
r = r2;
|
|
1808
|
+
r2 = t2;
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1811
|
+
return z2.revert(r);
|
|
1812
|
+
};
|
|
1813
|
+
BigInteger2.prototype.chunkSize = function(r) {
|
|
1814
|
+
return Math.floor(Math.LN2 * this.DB / Math.log(r));
|
|
1815
|
+
};
|
|
1816
|
+
BigInteger2.prototype.toRadix = function(b) {
|
|
1817
|
+
if (b == null) {
|
|
1818
|
+
b = 10;
|
|
1819
|
+
}
|
|
1820
|
+
if (this.signum() == 0 || b < 2 || b > 36) {
|
|
1821
|
+
return "0";
|
|
1822
|
+
}
|
|
1823
|
+
var cs = this.chunkSize(b);
|
|
1824
|
+
var a = Math.pow(b, cs);
|
|
1825
|
+
var d = nbv(a);
|
|
1826
|
+
var y = nbi();
|
|
1827
|
+
var z2 = nbi();
|
|
1828
|
+
var r = "";
|
|
1829
|
+
this.divRemTo(d, y, z2);
|
|
1830
|
+
while (y.signum() > 0) {
|
|
1831
|
+
r = (a + z2.intValue()).toString(b).substr(1) + r;
|
|
1832
|
+
y.divRemTo(d, y, z2);
|
|
1833
|
+
}
|
|
1834
|
+
return z2.intValue().toString(b) + r;
|
|
1835
|
+
};
|
|
1836
|
+
BigInteger2.prototype.fromRadix = function(s, b) {
|
|
1837
|
+
this.fromInt(0);
|
|
1838
|
+
if (b == null) {
|
|
1839
|
+
b = 10;
|
|
1840
|
+
}
|
|
1841
|
+
var cs = this.chunkSize(b);
|
|
1842
|
+
var d = Math.pow(b, cs);
|
|
1843
|
+
var mi = false;
|
|
1844
|
+
var j = 0;
|
|
1845
|
+
var w = 0;
|
|
1846
|
+
for (var i = 0; i < s.length; ++i) {
|
|
1847
|
+
var x = intAt(s, i);
|
|
1848
|
+
if (x < 0) {
|
|
1849
|
+
if (s.charAt(i) == "-" && this.signum() == 0) {
|
|
1850
|
+
mi = true;
|
|
1851
|
+
}
|
|
1852
|
+
continue;
|
|
1853
|
+
}
|
|
1854
|
+
w = b * w + x;
|
|
1855
|
+
if (++j >= cs) {
|
|
1856
|
+
this.dMultiply(d);
|
|
1857
|
+
this.dAddOffset(w, 0);
|
|
1858
|
+
j = 0;
|
|
1859
|
+
w = 0;
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
if (j > 0) {
|
|
1863
|
+
this.dMultiply(Math.pow(b, j));
|
|
1864
|
+
this.dAddOffset(w, 0);
|
|
1865
|
+
}
|
|
1866
|
+
if (mi) {
|
|
1867
|
+
BigInteger2.ZERO.subTo(this, this);
|
|
1868
|
+
}
|
|
1869
|
+
};
|
|
1870
|
+
BigInteger2.prototype.fromNumber = function(a, b, c) {
|
|
1871
|
+
if ("number" == typeof b) {
|
|
1872
|
+
if (a < 2) {
|
|
1873
|
+
this.fromInt(1);
|
|
1874
|
+
} else {
|
|
1875
|
+
this.fromNumber(a, c);
|
|
1876
|
+
if (!this.testBit(a - 1)) {
|
|
1877
|
+
this.bitwiseTo(BigInteger2.ONE.shiftLeft(a - 1), op_or, this);
|
|
1878
|
+
}
|
|
1879
|
+
if (this.isEven()) {
|
|
1880
|
+
this.dAddOffset(1, 0);
|
|
1881
|
+
}
|
|
1882
|
+
while (!this.isProbablePrime(b)) {
|
|
1883
|
+
this.dAddOffset(2, 0);
|
|
1884
|
+
if (this.bitLength() > a) {
|
|
1885
|
+
this.subTo(BigInteger2.ONE.shiftLeft(a - 1), this);
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
} else {
|
|
1890
|
+
var x = [];
|
|
1891
|
+
var t2 = a & 7;
|
|
1892
|
+
x.length = (a >> 3) + 1;
|
|
1893
|
+
b.nextBytes(x);
|
|
1894
|
+
if (t2 > 0) {
|
|
1895
|
+
x[0] &= (1 << t2) - 1;
|
|
1896
|
+
} else {
|
|
1897
|
+
x[0] = 0;
|
|
1898
|
+
}
|
|
1899
|
+
this.fromString(x, 256);
|
|
1900
|
+
}
|
|
1901
|
+
};
|
|
1902
|
+
BigInteger2.prototype.bitwiseTo = function(a, op, r) {
|
|
1903
|
+
var i;
|
|
1904
|
+
var f;
|
|
1905
|
+
var m = Math.min(a.t, this.t);
|
|
1906
|
+
for (i = 0; i < m; ++i) {
|
|
1907
|
+
r[i] = op(this[i], a[i]);
|
|
1908
|
+
}
|
|
1909
|
+
if (a.t < this.t) {
|
|
1910
|
+
f = a.s & this.DM;
|
|
1911
|
+
for (i = m; i < this.t; ++i) {
|
|
1912
|
+
r[i] = op(this[i], f);
|
|
1913
|
+
}
|
|
1914
|
+
r.t = this.t;
|
|
1915
|
+
} else {
|
|
1916
|
+
f = this.s & this.DM;
|
|
1917
|
+
for (i = m; i < a.t; ++i) {
|
|
1918
|
+
r[i] = op(f, a[i]);
|
|
1919
|
+
}
|
|
1920
|
+
r.t = a.t;
|
|
1921
|
+
}
|
|
1922
|
+
r.s = op(this.s, a.s);
|
|
1923
|
+
r.clamp();
|
|
1924
|
+
};
|
|
1925
|
+
BigInteger2.prototype.changeBit = function(n, op) {
|
|
1926
|
+
var r = BigInteger2.ONE.shiftLeft(n);
|
|
1927
|
+
this.bitwiseTo(r, op, r);
|
|
1928
|
+
return r;
|
|
1929
|
+
};
|
|
1930
|
+
BigInteger2.prototype.addTo = function(a, r) {
|
|
1931
|
+
var i = 0;
|
|
1932
|
+
var c = 0;
|
|
1933
|
+
var m = Math.min(a.t, this.t);
|
|
1934
|
+
while (i < m) {
|
|
1935
|
+
c += this[i] + a[i];
|
|
1936
|
+
r[i++] = c & this.DM;
|
|
1937
|
+
c >>= this.DB;
|
|
1938
|
+
}
|
|
1939
|
+
if (a.t < this.t) {
|
|
1940
|
+
c += a.s;
|
|
1941
|
+
while (i < this.t) {
|
|
1942
|
+
c += this[i];
|
|
1943
|
+
r[i++] = c & this.DM;
|
|
1944
|
+
c >>= this.DB;
|
|
1945
|
+
}
|
|
1946
|
+
c += this.s;
|
|
1947
|
+
} else {
|
|
1948
|
+
c += this.s;
|
|
1949
|
+
while (i < a.t) {
|
|
1950
|
+
c += a[i];
|
|
1951
|
+
r[i++] = c & this.DM;
|
|
1952
|
+
c >>= this.DB;
|
|
1953
|
+
}
|
|
1954
|
+
c += a.s;
|
|
1955
|
+
}
|
|
1956
|
+
r.s = c < 0 ? -1 : 0;
|
|
1957
|
+
if (c > 0) {
|
|
1958
|
+
r[i++] = c;
|
|
1959
|
+
} else if (c < -1) {
|
|
1960
|
+
r[i++] = this.DV + c;
|
|
1961
|
+
}
|
|
1962
|
+
r.t = i;
|
|
1963
|
+
r.clamp();
|
|
1964
|
+
};
|
|
1965
|
+
BigInteger2.prototype.dMultiply = function(n) {
|
|
1966
|
+
this[this.t] = this.am(0, n - 1, this, 0, 0, this.t);
|
|
1967
|
+
++this.t;
|
|
1968
|
+
this.clamp();
|
|
1969
|
+
};
|
|
1970
|
+
BigInteger2.prototype.dAddOffset = function(n, w) {
|
|
1971
|
+
if (n == 0) {
|
|
1972
|
+
return;
|
|
1973
|
+
}
|
|
1974
|
+
while (this.t <= w) {
|
|
1975
|
+
this[this.t++] = 0;
|
|
1976
|
+
}
|
|
1977
|
+
this[w] += n;
|
|
1978
|
+
while (this[w] >= this.DV) {
|
|
1979
|
+
this[w] -= this.DV;
|
|
1980
|
+
if (++w >= this.t) {
|
|
1981
|
+
this[this.t++] = 0;
|
|
1982
|
+
}
|
|
1983
|
+
++this[w];
|
|
1984
|
+
}
|
|
1985
|
+
};
|
|
1986
|
+
BigInteger2.prototype.multiplyLowerTo = function(a, n, r) {
|
|
1987
|
+
var i = Math.min(this.t + a.t, n);
|
|
1988
|
+
r.s = 0;
|
|
1989
|
+
r.t = i;
|
|
1990
|
+
while (i > 0) {
|
|
1991
|
+
r[--i] = 0;
|
|
1992
|
+
}
|
|
1993
|
+
for (var j = r.t - this.t; i < j; ++i) {
|
|
1994
|
+
r[i + this.t] = this.am(0, a[i], r, i, 0, this.t);
|
|
1995
|
+
}
|
|
1996
|
+
for (var j = Math.min(a.t, n); i < j; ++i) {
|
|
1997
|
+
this.am(0, a[i], r, i, 0, n - i);
|
|
1998
|
+
}
|
|
1999
|
+
r.clamp();
|
|
2000
|
+
};
|
|
2001
|
+
BigInteger2.prototype.multiplyUpperTo = function(a, n, r) {
|
|
2002
|
+
--n;
|
|
2003
|
+
var i = r.t = this.t + a.t - n;
|
|
2004
|
+
r.s = 0;
|
|
2005
|
+
while (--i >= 0) {
|
|
2006
|
+
r[i] = 0;
|
|
2007
|
+
}
|
|
2008
|
+
for (i = Math.max(n - this.t, 0); i < a.t; ++i) {
|
|
2009
|
+
r[this.t + i - n] = this.am(n - i, a[i], r, 0, 0, this.t + i - n);
|
|
2010
|
+
}
|
|
2011
|
+
r.clamp();
|
|
2012
|
+
r.drShiftTo(1, r);
|
|
2013
|
+
};
|
|
2014
|
+
BigInteger2.prototype.modInt = function(n) {
|
|
2015
|
+
if (n <= 0) {
|
|
2016
|
+
return 0;
|
|
2017
|
+
}
|
|
2018
|
+
var d = this.DV % n;
|
|
2019
|
+
var r = this.s < 0 ? n - 1 : 0;
|
|
2020
|
+
if (this.t > 0) {
|
|
2021
|
+
if (d == 0) {
|
|
2022
|
+
r = this[0] % n;
|
|
2023
|
+
} else {
|
|
2024
|
+
for (var i = this.t - 1; i >= 0; --i) {
|
|
2025
|
+
r = (d * r + this[i]) % n;
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
return r;
|
|
2030
|
+
};
|
|
2031
|
+
BigInteger2.prototype.millerRabin = function(t2) {
|
|
2032
|
+
var n1 = this.subtract(BigInteger2.ONE);
|
|
2033
|
+
var k = n1.getLowestSetBit();
|
|
2034
|
+
if (k <= 0) {
|
|
2035
|
+
return false;
|
|
2036
|
+
}
|
|
2037
|
+
var r = n1.shiftRight(k);
|
|
2038
|
+
t2 = t2 + 1 >> 1;
|
|
2039
|
+
if (t2 > lowprimes.length) {
|
|
2040
|
+
t2 = lowprimes.length;
|
|
2041
|
+
}
|
|
2042
|
+
var a = nbi();
|
|
2043
|
+
for (var i = 0; i < t2; ++i) {
|
|
2044
|
+
a.fromInt(lowprimes[Math.floor(Math.random() * lowprimes.length)]);
|
|
2045
|
+
var y = a.modPow(r, this);
|
|
2046
|
+
if (y.compareTo(BigInteger2.ONE) != 0 && y.compareTo(n1) != 0) {
|
|
2047
|
+
var j = 1;
|
|
2048
|
+
while (j++ < k && y.compareTo(n1) != 0) {
|
|
2049
|
+
y = y.modPowInt(2, this);
|
|
2050
|
+
if (y.compareTo(BigInteger2.ONE) == 0) {
|
|
2051
|
+
return false;
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
if (y.compareTo(n1) != 0) {
|
|
2055
|
+
return false;
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
return true;
|
|
2060
|
+
};
|
|
2061
|
+
BigInteger2.prototype.square = function() {
|
|
2062
|
+
var r = nbi();
|
|
2063
|
+
this.squareTo(r);
|
|
2064
|
+
return r;
|
|
2065
|
+
};
|
|
2066
|
+
BigInteger2.prototype.gcda = function(a, callback) {
|
|
2067
|
+
var x = this.s < 0 ? this.negate() : this.clone();
|
|
2068
|
+
var y = a.s < 0 ? a.negate() : a.clone();
|
|
2069
|
+
if (x.compareTo(y) < 0) {
|
|
2070
|
+
var t2 = x;
|
|
2071
|
+
x = y;
|
|
2072
|
+
y = t2;
|
|
2073
|
+
}
|
|
2074
|
+
var i = x.getLowestSetBit();
|
|
2075
|
+
var g = y.getLowestSetBit();
|
|
2076
|
+
if (g < 0) {
|
|
2077
|
+
callback(x);
|
|
2078
|
+
return;
|
|
2079
|
+
}
|
|
2080
|
+
if (i < g) {
|
|
2081
|
+
g = i;
|
|
2082
|
+
}
|
|
2083
|
+
if (g > 0) {
|
|
2084
|
+
x.rShiftTo(g, x);
|
|
2085
|
+
y.rShiftTo(g, y);
|
|
2086
|
+
}
|
|
2087
|
+
var gcda1 = function() {
|
|
2088
|
+
if ((i = x.getLowestSetBit()) > 0) {
|
|
2089
|
+
x.rShiftTo(i, x);
|
|
2090
|
+
}
|
|
2091
|
+
if ((i = y.getLowestSetBit()) > 0) {
|
|
2092
|
+
y.rShiftTo(i, y);
|
|
2093
|
+
}
|
|
2094
|
+
if (x.compareTo(y) >= 0) {
|
|
2095
|
+
x.subTo(y, x);
|
|
2096
|
+
x.rShiftTo(1, x);
|
|
2097
|
+
} else {
|
|
2098
|
+
y.subTo(x, y);
|
|
2099
|
+
y.rShiftTo(1, y);
|
|
2100
|
+
}
|
|
2101
|
+
if (!(x.signum() > 0)) {
|
|
2102
|
+
if (g > 0) {
|
|
2103
|
+
y.lShiftTo(g, y);
|
|
2104
|
+
}
|
|
2105
|
+
setTimeout(function() {
|
|
2106
|
+
callback(y);
|
|
2107
|
+
}, 0);
|
|
2108
|
+
} else {
|
|
2109
|
+
setTimeout(gcda1, 0);
|
|
2110
|
+
}
|
|
2111
|
+
};
|
|
2112
|
+
setTimeout(gcda1, 10);
|
|
2113
|
+
};
|
|
2114
|
+
BigInteger2.prototype.fromNumberAsync = function(a, b, c, callback) {
|
|
2115
|
+
if ("number" == typeof b) {
|
|
2116
|
+
if (a < 2) {
|
|
2117
|
+
this.fromInt(1);
|
|
2118
|
+
} else {
|
|
2119
|
+
this.fromNumber(a, c);
|
|
2120
|
+
if (!this.testBit(a - 1)) {
|
|
2121
|
+
this.bitwiseTo(BigInteger2.ONE.shiftLeft(a - 1), op_or, this);
|
|
2122
|
+
}
|
|
2123
|
+
if (this.isEven()) {
|
|
2124
|
+
this.dAddOffset(1, 0);
|
|
2125
|
+
}
|
|
2126
|
+
var bnp_1 = this;
|
|
2127
|
+
var bnpfn1_1 = function() {
|
|
2128
|
+
bnp_1.dAddOffset(2, 0);
|
|
2129
|
+
if (bnp_1.bitLength() > a) {
|
|
2130
|
+
bnp_1.subTo(BigInteger2.ONE.shiftLeft(a - 1), bnp_1);
|
|
2131
|
+
}
|
|
2132
|
+
if (bnp_1.isProbablePrime(b)) {
|
|
2133
|
+
setTimeout(function() {
|
|
2134
|
+
callback();
|
|
2135
|
+
}, 0);
|
|
2136
|
+
} else {
|
|
2137
|
+
setTimeout(bnpfn1_1, 0);
|
|
2138
|
+
}
|
|
2139
|
+
};
|
|
2140
|
+
setTimeout(bnpfn1_1, 0);
|
|
2141
|
+
}
|
|
2142
|
+
} else {
|
|
2143
|
+
var x = [];
|
|
2144
|
+
var t2 = a & 7;
|
|
2145
|
+
x.length = (a >> 3) + 1;
|
|
2146
|
+
b.nextBytes(x);
|
|
2147
|
+
if (t2 > 0) {
|
|
2148
|
+
x[0] &= (1 << t2) - 1;
|
|
2149
|
+
} else {
|
|
2150
|
+
x[0] = 0;
|
|
2151
|
+
}
|
|
2152
|
+
this.fromString(x, 256);
|
|
2153
|
+
}
|
|
2154
|
+
};
|
|
2155
|
+
return BigInteger2;
|
|
2156
|
+
}()
|
|
2157
|
+
);
|
|
2158
|
+
var NullExp = (
|
|
2159
|
+
/** @class */
|
|
2160
|
+
function() {
|
|
2161
|
+
function NullExp2() {
|
|
2162
|
+
}
|
|
2163
|
+
NullExp2.prototype.convert = function(x) {
|
|
2164
|
+
return x;
|
|
2165
|
+
};
|
|
2166
|
+
NullExp2.prototype.revert = function(x) {
|
|
2167
|
+
return x;
|
|
2168
|
+
};
|
|
2169
|
+
NullExp2.prototype.mulTo = function(x, y, r) {
|
|
2170
|
+
x.multiplyTo(y, r);
|
|
2171
|
+
};
|
|
2172
|
+
NullExp2.prototype.sqrTo = function(x, r) {
|
|
2173
|
+
x.squareTo(r);
|
|
2174
|
+
};
|
|
2175
|
+
return NullExp2;
|
|
2176
|
+
}()
|
|
2177
|
+
);
|
|
2178
|
+
var Classic = (
|
|
2179
|
+
/** @class */
|
|
2180
|
+
function() {
|
|
2181
|
+
function Classic2(m) {
|
|
2182
|
+
this.m = m;
|
|
2183
|
+
}
|
|
2184
|
+
Classic2.prototype.convert = function(x) {
|
|
2185
|
+
if (x.s < 0 || x.compareTo(this.m) >= 0) {
|
|
2186
|
+
return x.mod(this.m);
|
|
2187
|
+
} else {
|
|
2188
|
+
return x;
|
|
2189
|
+
}
|
|
2190
|
+
};
|
|
2191
|
+
Classic2.prototype.revert = function(x) {
|
|
2192
|
+
return x;
|
|
2193
|
+
};
|
|
2194
|
+
Classic2.prototype.reduce = function(x) {
|
|
2195
|
+
x.divRemTo(this.m, null, x);
|
|
2196
|
+
};
|
|
2197
|
+
Classic2.prototype.mulTo = function(x, y, r) {
|
|
2198
|
+
x.multiplyTo(y, r);
|
|
2199
|
+
this.reduce(r);
|
|
2200
|
+
};
|
|
2201
|
+
Classic2.prototype.sqrTo = function(x, r) {
|
|
2202
|
+
x.squareTo(r);
|
|
2203
|
+
this.reduce(r);
|
|
2204
|
+
};
|
|
2205
|
+
return Classic2;
|
|
2206
|
+
}()
|
|
2207
|
+
);
|
|
2208
|
+
var Montgomery = (
|
|
2209
|
+
/** @class */
|
|
2210
|
+
function() {
|
|
2211
|
+
function Montgomery2(m) {
|
|
2212
|
+
this.m = m;
|
|
2213
|
+
this.mp = m.invDigit();
|
|
2214
|
+
this.mpl = this.mp & 32767;
|
|
2215
|
+
this.mph = this.mp >> 15;
|
|
2216
|
+
this.um = (1 << m.DB - 15) - 1;
|
|
2217
|
+
this.mt2 = 2 * m.t;
|
|
2218
|
+
}
|
|
2219
|
+
Montgomery2.prototype.convert = function(x) {
|
|
2220
|
+
var r = nbi();
|
|
2221
|
+
x.abs().dlShiftTo(this.m.t, r);
|
|
2222
|
+
r.divRemTo(this.m, null, r);
|
|
2223
|
+
if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) {
|
|
2224
|
+
this.m.subTo(r, r);
|
|
2225
|
+
}
|
|
2226
|
+
return r;
|
|
2227
|
+
};
|
|
2228
|
+
Montgomery2.prototype.revert = function(x) {
|
|
2229
|
+
var r = nbi();
|
|
2230
|
+
x.copyTo(r);
|
|
2231
|
+
this.reduce(r);
|
|
2232
|
+
return r;
|
|
2233
|
+
};
|
|
2234
|
+
Montgomery2.prototype.reduce = function(x) {
|
|
2235
|
+
while (x.t <= this.mt2) {
|
|
2236
|
+
x[x.t++] = 0;
|
|
2237
|
+
}
|
|
2238
|
+
for (var i = 0; i < this.m.t; ++i) {
|
|
2239
|
+
var j = x[i] & 32767;
|
|
2240
|
+
var u0 = j * this.mpl + ((j * this.mph + (x[i] >> 15) * this.mpl & this.um) << 15) & x.DM;
|
|
2241
|
+
j = i + this.m.t;
|
|
2242
|
+
x[j] += this.m.am(0, u0, x, i, 0, this.m.t);
|
|
2243
|
+
while (x[j] >= x.DV) {
|
|
2244
|
+
x[j] -= x.DV;
|
|
2245
|
+
x[++j]++;
|
|
2246
|
+
}
|
|
2247
|
+
}
|
|
2248
|
+
x.clamp();
|
|
2249
|
+
x.drShiftTo(this.m.t, x);
|
|
2250
|
+
if (x.compareTo(this.m) >= 0) {
|
|
2251
|
+
x.subTo(this.m, x);
|
|
2252
|
+
}
|
|
2253
|
+
};
|
|
2254
|
+
Montgomery2.prototype.mulTo = function(x, y, r) {
|
|
2255
|
+
x.multiplyTo(y, r);
|
|
2256
|
+
this.reduce(r);
|
|
2257
|
+
};
|
|
2258
|
+
Montgomery2.prototype.sqrTo = function(x, r) {
|
|
2259
|
+
x.squareTo(r);
|
|
2260
|
+
this.reduce(r);
|
|
2261
|
+
};
|
|
2262
|
+
return Montgomery2;
|
|
2263
|
+
}()
|
|
2264
|
+
);
|
|
2265
|
+
var Barrett = (
|
|
2266
|
+
/** @class */
|
|
2267
|
+
function() {
|
|
2268
|
+
function Barrett2(m) {
|
|
2269
|
+
this.m = m;
|
|
2270
|
+
this.r2 = nbi();
|
|
2271
|
+
this.q3 = nbi();
|
|
2272
|
+
BigInteger.ONE.dlShiftTo(2 * m.t, this.r2);
|
|
2273
|
+
this.mu = this.r2.divide(m);
|
|
2274
|
+
}
|
|
2275
|
+
Barrett2.prototype.convert = function(x) {
|
|
2276
|
+
if (x.s < 0 || x.t > 2 * this.m.t) {
|
|
2277
|
+
return x.mod(this.m);
|
|
2278
|
+
} else if (x.compareTo(this.m) < 0) {
|
|
2279
|
+
return x;
|
|
2280
|
+
} else {
|
|
2281
|
+
var r = nbi();
|
|
2282
|
+
x.copyTo(r);
|
|
2283
|
+
this.reduce(r);
|
|
2284
|
+
return r;
|
|
2285
|
+
}
|
|
2286
|
+
};
|
|
2287
|
+
Barrett2.prototype.revert = function(x) {
|
|
2288
|
+
return x;
|
|
2289
|
+
};
|
|
2290
|
+
Barrett2.prototype.reduce = function(x) {
|
|
2291
|
+
x.drShiftTo(this.m.t - 1, this.r2);
|
|
2292
|
+
if (x.t > this.m.t + 1) {
|
|
2293
|
+
x.t = this.m.t + 1;
|
|
2294
|
+
x.clamp();
|
|
2295
|
+
}
|
|
2296
|
+
this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3);
|
|
2297
|
+
this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2);
|
|
2298
|
+
while (x.compareTo(this.r2) < 0) {
|
|
2299
|
+
x.dAddOffset(1, this.m.t + 1);
|
|
2300
|
+
}
|
|
2301
|
+
x.subTo(this.r2, x);
|
|
2302
|
+
while (x.compareTo(this.m) >= 0) {
|
|
2303
|
+
x.subTo(this.m, x);
|
|
2304
|
+
}
|
|
2305
|
+
};
|
|
2306
|
+
Barrett2.prototype.mulTo = function(x, y, r) {
|
|
2307
|
+
x.multiplyTo(y, r);
|
|
2308
|
+
this.reduce(r);
|
|
2309
|
+
};
|
|
2310
|
+
Barrett2.prototype.sqrTo = function(x, r) {
|
|
2311
|
+
x.squareTo(r);
|
|
2312
|
+
this.reduce(r);
|
|
2313
|
+
};
|
|
2314
|
+
return Barrett2;
|
|
2315
|
+
}()
|
|
2316
|
+
);
|
|
2317
|
+
function nbi() {
|
|
2318
|
+
return new BigInteger(null);
|
|
2319
|
+
}
|
|
2320
|
+
function parseBigInt(str, r) {
|
|
2321
|
+
return new BigInteger(str, r);
|
|
2322
|
+
}
|
|
2323
|
+
var inBrowser = typeof navigator !== "undefined";
|
|
2324
|
+
if (inBrowser && j_lm && navigator.appName == "Microsoft Internet Explorer") {
|
|
2325
|
+
BigInteger.prototype.am = function am2(i, x, w, j, c, n) {
|
|
2326
|
+
var xl = x & 32767;
|
|
2327
|
+
var xh = x >> 15;
|
|
2328
|
+
while (--n >= 0) {
|
|
2329
|
+
var l = this[i] & 32767;
|
|
2330
|
+
var h = this[i++] >> 15;
|
|
2331
|
+
var m = xh * l + h * xl;
|
|
2332
|
+
l = xl * l + ((m & 32767) << 15) + w[j] + (c & 1073741823);
|
|
2333
|
+
c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30);
|
|
2334
|
+
w[j++] = l & 1073741823;
|
|
2335
|
+
}
|
|
2336
|
+
return c;
|
|
2337
|
+
};
|
|
2338
|
+
dbits = 30;
|
|
2339
|
+
} else if (inBrowser && j_lm && navigator.appName != "Netscape") {
|
|
2340
|
+
BigInteger.prototype.am = function am1(i, x, w, j, c, n) {
|
|
2341
|
+
while (--n >= 0) {
|
|
2342
|
+
var v = x * this[i++] + w[j] + c;
|
|
2343
|
+
c = Math.floor(v / 67108864);
|
|
2344
|
+
w[j++] = v & 67108863;
|
|
2345
|
+
}
|
|
2346
|
+
return c;
|
|
2347
|
+
};
|
|
2348
|
+
dbits = 26;
|
|
2349
|
+
} else {
|
|
2350
|
+
BigInteger.prototype.am = function am3(i, x, w, j, c, n) {
|
|
2351
|
+
var xl = x & 16383;
|
|
2352
|
+
var xh = x >> 14;
|
|
2353
|
+
while (--n >= 0) {
|
|
2354
|
+
var l = this[i] & 16383;
|
|
2355
|
+
var h = this[i++] >> 14;
|
|
2356
|
+
var m = xh * l + h * xl;
|
|
2357
|
+
l = xl * l + ((m & 16383) << 14) + w[j] + c;
|
|
2358
|
+
c = (l >> 28) + (m >> 14) + xh * h;
|
|
2359
|
+
w[j++] = l & 268435455;
|
|
2360
|
+
}
|
|
2361
|
+
return c;
|
|
2362
|
+
};
|
|
2363
|
+
dbits = 28;
|
|
2364
|
+
}
|
|
2365
|
+
BigInteger.prototype.DB = dbits;
|
|
2366
|
+
BigInteger.prototype.DM = (1 << dbits) - 1;
|
|
2367
|
+
BigInteger.prototype.DV = 1 << dbits;
|
|
2368
|
+
var BI_FP = 52;
|
|
2369
|
+
BigInteger.prototype.FV = Math.pow(2, BI_FP);
|
|
2370
|
+
BigInteger.prototype.F1 = BI_FP - dbits;
|
|
2371
|
+
BigInteger.prototype.F2 = 2 * dbits - BI_FP;
|
|
2372
|
+
var BI_RC = [];
|
|
2373
|
+
var rr;
|
|
2374
|
+
var vv;
|
|
2375
|
+
rr = "0".charCodeAt(0);
|
|
2376
|
+
for (vv = 0; vv <= 9; ++vv) {
|
|
2377
|
+
BI_RC[rr++] = vv;
|
|
2378
|
+
}
|
|
2379
|
+
rr = "a".charCodeAt(0);
|
|
2380
|
+
for (vv = 10; vv < 36; ++vv) {
|
|
2381
|
+
BI_RC[rr++] = vv;
|
|
2382
|
+
}
|
|
2383
|
+
rr = "A".charCodeAt(0);
|
|
2384
|
+
for (vv = 10; vv < 36; ++vv) {
|
|
2385
|
+
BI_RC[rr++] = vv;
|
|
2386
|
+
}
|
|
2387
|
+
function intAt(s, i) {
|
|
2388
|
+
var c = BI_RC[s.charCodeAt(i)];
|
|
2389
|
+
return c == null ? -1 : c;
|
|
2390
|
+
}
|
|
2391
|
+
function nbv(i) {
|
|
2392
|
+
var r = nbi();
|
|
2393
|
+
r.fromInt(i);
|
|
2394
|
+
return r;
|
|
2395
|
+
}
|
|
2396
|
+
function nbits(x) {
|
|
2397
|
+
var r = 1;
|
|
2398
|
+
var t2;
|
|
2399
|
+
if ((t2 = x >>> 16) != 0) {
|
|
2400
|
+
x = t2;
|
|
2401
|
+
r += 16;
|
|
2402
|
+
}
|
|
2403
|
+
if ((t2 = x >> 8) != 0) {
|
|
2404
|
+
x = t2;
|
|
2405
|
+
r += 8;
|
|
2406
|
+
}
|
|
2407
|
+
if ((t2 = x >> 4) != 0) {
|
|
2408
|
+
x = t2;
|
|
2409
|
+
r += 4;
|
|
2410
|
+
}
|
|
2411
|
+
if ((t2 = x >> 2) != 0) {
|
|
2412
|
+
x = t2;
|
|
2413
|
+
r += 2;
|
|
2414
|
+
}
|
|
2415
|
+
if ((t2 = x >> 1) != 0) {
|
|
2416
|
+
x = t2;
|
|
2417
|
+
r += 1;
|
|
2418
|
+
}
|
|
2419
|
+
return r;
|
|
2420
|
+
}
|
|
2421
|
+
BigInteger.ZERO = nbv(0);
|
|
2422
|
+
BigInteger.ONE = nbv(1);
|
|
2423
|
+
var Arcfour = (
|
|
2424
|
+
/** @class */
|
|
2425
|
+
function() {
|
|
2426
|
+
function Arcfour2() {
|
|
2427
|
+
this.i = 0;
|
|
2428
|
+
this.j = 0;
|
|
2429
|
+
this.S = [];
|
|
2430
|
+
}
|
|
2431
|
+
Arcfour2.prototype.init = function(key) {
|
|
2432
|
+
var i;
|
|
2433
|
+
var j;
|
|
2434
|
+
var t2;
|
|
2435
|
+
for (i = 0; i < 256; ++i) {
|
|
2436
|
+
this.S[i] = i;
|
|
2437
|
+
}
|
|
2438
|
+
j = 0;
|
|
2439
|
+
for (i = 0; i < 256; ++i) {
|
|
2440
|
+
j = j + this.S[i] + key[i % key.length] & 255;
|
|
2441
|
+
t2 = this.S[i];
|
|
2442
|
+
this.S[i] = this.S[j];
|
|
2443
|
+
this.S[j] = t2;
|
|
2444
|
+
}
|
|
2445
|
+
this.i = 0;
|
|
2446
|
+
this.j = 0;
|
|
2447
|
+
};
|
|
2448
|
+
Arcfour2.prototype.next = function() {
|
|
2449
|
+
var t2;
|
|
2450
|
+
this.i = this.i + 1 & 255;
|
|
2451
|
+
this.j = this.j + this.S[this.i] & 255;
|
|
2452
|
+
t2 = this.S[this.i];
|
|
2453
|
+
this.S[this.i] = this.S[this.j];
|
|
2454
|
+
this.S[this.j] = t2;
|
|
2455
|
+
return this.S[t2 + this.S[this.i] & 255];
|
|
2456
|
+
};
|
|
2457
|
+
return Arcfour2;
|
|
2458
|
+
}()
|
|
2459
|
+
);
|
|
2460
|
+
function prng_newstate() {
|
|
2461
|
+
return new Arcfour();
|
|
2462
|
+
}
|
|
2463
|
+
var rng_psize = 256;
|
|
2464
|
+
var rng_state;
|
|
2465
|
+
var rng_pool = null;
|
|
2466
|
+
var rng_pptr;
|
|
2467
|
+
if (rng_pool == null) {
|
|
2468
|
+
rng_pool = [];
|
|
2469
|
+
rng_pptr = 0;
|
|
2470
|
+
var t = void 0;
|
|
2471
|
+
if (typeof window !== "undefined" && window.crypto && window.crypto.getRandomValues) {
|
|
2472
|
+
var z = new Uint32Array(256);
|
|
2473
|
+
window.crypto.getRandomValues(z);
|
|
2474
|
+
for (t = 0; t < z.length; ++t) {
|
|
2475
|
+
rng_pool[rng_pptr++] = z[t] & 255;
|
|
2476
|
+
}
|
|
2477
|
+
}
|
|
2478
|
+
var count = 0;
|
|
2479
|
+
var onMouseMoveListener_1 = function(ev) {
|
|
2480
|
+
count = count || 0;
|
|
2481
|
+
if (count >= 256 || rng_pptr >= rng_psize) {
|
|
2482
|
+
if (window.removeEventListener) {
|
|
2483
|
+
window.removeEventListener("mousemove", onMouseMoveListener_1, false);
|
|
2484
|
+
} else if (window.detachEvent) {
|
|
2485
|
+
window.detachEvent("onmousemove", onMouseMoveListener_1);
|
|
2486
|
+
}
|
|
2487
|
+
return;
|
|
2488
|
+
}
|
|
2489
|
+
try {
|
|
2490
|
+
var mouseCoordinates = ev.x + ev.y;
|
|
2491
|
+
rng_pool[rng_pptr++] = mouseCoordinates & 255;
|
|
2492
|
+
count += 1;
|
|
2493
|
+
} catch (e) {
|
|
2494
|
+
}
|
|
2495
|
+
};
|
|
2496
|
+
if (typeof window !== "undefined") {
|
|
2497
|
+
if (window.addEventListener) {
|
|
2498
|
+
window.addEventListener("mousemove", onMouseMoveListener_1, false);
|
|
2499
|
+
} else if (window.attachEvent) {
|
|
2500
|
+
window.attachEvent("onmousemove", onMouseMoveListener_1);
|
|
2501
|
+
}
|
|
2502
|
+
}
|
|
2503
|
+
}
|
|
2504
|
+
function rng_get_byte() {
|
|
2505
|
+
if (rng_state == null) {
|
|
2506
|
+
rng_state = prng_newstate();
|
|
2507
|
+
while (rng_pptr < rng_psize) {
|
|
2508
|
+
var random = Math.floor(65536 * Math.random());
|
|
2509
|
+
rng_pool[rng_pptr++] = random & 255;
|
|
2510
|
+
}
|
|
2511
|
+
rng_state.init(rng_pool);
|
|
2512
|
+
for (rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) {
|
|
2513
|
+
rng_pool[rng_pptr] = 0;
|
|
2514
|
+
}
|
|
2515
|
+
rng_pptr = 0;
|
|
2516
|
+
}
|
|
2517
|
+
return rng_state.next();
|
|
2518
|
+
}
|
|
2519
|
+
var SecureRandom = (
|
|
2520
|
+
/** @class */
|
|
2521
|
+
function() {
|
|
2522
|
+
function SecureRandom2() {
|
|
2523
|
+
}
|
|
2524
|
+
SecureRandom2.prototype.nextBytes = function(ba) {
|
|
2525
|
+
for (var i = 0; i < ba.length; ++i) {
|
|
2526
|
+
ba[i] = rng_get_byte();
|
|
2527
|
+
}
|
|
2528
|
+
};
|
|
2529
|
+
return SecureRandom2;
|
|
2530
|
+
}()
|
|
2531
|
+
);
|
|
2532
|
+
function pkcs1pad1(s, n) {
|
|
2533
|
+
if (n < s.length + 22) {
|
|
2534
|
+
console.error("Message too long for RSA");
|
|
2535
|
+
return null;
|
|
2536
|
+
}
|
|
2537
|
+
var len = n - s.length - 6;
|
|
2538
|
+
var filler = "";
|
|
2539
|
+
for (var f = 0; f < len; f += 2) {
|
|
2540
|
+
filler += "ff";
|
|
2541
|
+
}
|
|
2542
|
+
var m = "0001" + filler + "00" + s;
|
|
2543
|
+
return parseBigInt(m, 16);
|
|
2544
|
+
}
|
|
2545
|
+
function pkcs1pad2(s, n) {
|
|
2546
|
+
if (n < s.length + 11) {
|
|
2547
|
+
console.error("Message too long for RSA");
|
|
2548
|
+
return null;
|
|
2549
|
+
}
|
|
2550
|
+
var ba = [];
|
|
2551
|
+
var i = s.length - 1;
|
|
2552
|
+
while (i >= 0 && n > 0) {
|
|
2553
|
+
var c = s.charCodeAt(i--);
|
|
2554
|
+
if (c < 128) {
|
|
2555
|
+
ba[--n] = c;
|
|
2556
|
+
} else if (c > 127 && c < 2048) {
|
|
2557
|
+
ba[--n] = c & 63 | 128;
|
|
2558
|
+
ba[--n] = c >> 6 | 192;
|
|
2559
|
+
} else {
|
|
2560
|
+
ba[--n] = c & 63 | 128;
|
|
2561
|
+
ba[--n] = c >> 6 & 63 | 128;
|
|
2562
|
+
ba[--n] = c >> 12 | 224;
|
|
2563
|
+
}
|
|
2564
|
+
}
|
|
2565
|
+
ba[--n] = 0;
|
|
2566
|
+
var rng = new SecureRandom();
|
|
2567
|
+
var x = [];
|
|
2568
|
+
while (n > 2) {
|
|
2569
|
+
x[0] = 0;
|
|
2570
|
+
while (x[0] == 0) {
|
|
2571
|
+
rng.nextBytes(x);
|
|
2572
|
+
}
|
|
2573
|
+
ba[--n] = x[0];
|
|
2574
|
+
}
|
|
2575
|
+
ba[--n] = 2;
|
|
2576
|
+
ba[--n] = 0;
|
|
2577
|
+
return new BigInteger(ba);
|
|
2578
|
+
}
|
|
2579
|
+
var RSAKey = (
|
|
2580
|
+
/** @class */
|
|
2581
|
+
function() {
|
|
2582
|
+
function RSAKey2() {
|
|
2583
|
+
this.n = null;
|
|
2584
|
+
this.e = 0;
|
|
2585
|
+
this.d = null;
|
|
2586
|
+
this.p = null;
|
|
2587
|
+
this.q = null;
|
|
2588
|
+
this.dmp1 = null;
|
|
2589
|
+
this.dmq1 = null;
|
|
2590
|
+
this.coeff = null;
|
|
2591
|
+
}
|
|
2592
|
+
RSAKey2.prototype.doPublic = function(x) {
|
|
2593
|
+
return x.modPowInt(this.e, this.n);
|
|
2594
|
+
};
|
|
2595
|
+
RSAKey2.prototype.doPrivate = function(x) {
|
|
2596
|
+
if (this.p == null || this.q == null) {
|
|
2597
|
+
return x.modPow(this.d, this.n);
|
|
2598
|
+
}
|
|
2599
|
+
var xp = x.mod(this.p).modPow(this.dmp1, this.p);
|
|
2600
|
+
var xq = x.mod(this.q).modPow(this.dmq1, this.q);
|
|
2601
|
+
while (xp.compareTo(xq) < 0) {
|
|
2602
|
+
xp = xp.add(this.p);
|
|
2603
|
+
}
|
|
2604
|
+
return xp.subtract(xq).multiply(this.coeff).mod(this.p).multiply(this.q).add(xq);
|
|
2605
|
+
};
|
|
2606
|
+
RSAKey2.prototype.setPublic = function(N, E) {
|
|
2607
|
+
if (N != null && E != null && N.length > 0 && E.length > 0) {
|
|
2608
|
+
this.n = parseBigInt(N, 16);
|
|
2609
|
+
this.e = parseInt(E, 16);
|
|
2610
|
+
} else {
|
|
2611
|
+
console.error("Invalid RSA public key");
|
|
2612
|
+
}
|
|
2613
|
+
};
|
|
2614
|
+
RSAKey2.prototype.encrypt = function(text) {
|
|
2615
|
+
var maxLength = this.n.bitLength() + 7 >> 3;
|
|
2616
|
+
var m = pkcs1pad2(text, maxLength);
|
|
2617
|
+
if (m == null) {
|
|
2618
|
+
return null;
|
|
2619
|
+
}
|
|
2620
|
+
var c = this.doPublic(m);
|
|
2621
|
+
if (c == null) {
|
|
2622
|
+
return null;
|
|
2623
|
+
}
|
|
2624
|
+
var h = c.toString(16);
|
|
2625
|
+
var length = h.length;
|
|
2626
|
+
for (var i = 0; i < maxLength * 2 - length; i++) {
|
|
2627
|
+
h = "0" + h;
|
|
2628
|
+
}
|
|
2629
|
+
return h;
|
|
2630
|
+
};
|
|
2631
|
+
RSAKey2.prototype.setPrivate = function(N, E, D) {
|
|
2632
|
+
if (N != null && E != null && N.length > 0 && E.length > 0) {
|
|
2633
|
+
this.n = parseBigInt(N, 16);
|
|
2634
|
+
this.e = parseInt(E, 16);
|
|
2635
|
+
this.d = parseBigInt(D, 16);
|
|
2636
|
+
} else {
|
|
2637
|
+
console.error("Invalid RSA private key");
|
|
2638
|
+
}
|
|
2639
|
+
};
|
|
2640
|
+
RSAKey2.prototype.setPrivateEx = function(N, E, D, P, Q, DP, DQ, C) {
|
|
2641
|
+
if (N != null && E != null && N.length > 0 && E.length > 0) {
|
|
2642
|
+
this.n = parseBigInt(N, 16);
|
|
2643
|
+
this.e = parseInt(E, 16);
|
|
2644
|
+
this.d = parseBigInt(D, 16);
|
|
2645
|
+
this.p = parseBigInt(P, 16);
|
|
2646
|
+
this.q = parseBigInt(Q, 16);
|
|
2647
|
+
this.dmp1 = parseBigInt(DP, 16);
|
|
2648
|
+
this.dmq1 = parseBigInt(DQ, 16);
|
|
2649
|
+
this.coeff = parseBigInt(C, 16);
|
|
2650
|
+
} else {
|
|
2651
|
+
console.error("Invalid RSA private key");
|
|
2652
|
+
}
|
|
2653
|
+
};
|
|
2654
|
+
RSAKey2.prototype.generate = function(B, E) {
|
|
2655
|
+
var rng = new SecureRandom();
|
|
2656
|
+
var qs = B >> 1;
|
|
2657
|
+
this.e = parseInt(E, 16);
|
|
2658
|
+
var ee = new BigInteger(E, 16);
|
|
2659
|
+
for (; ; ) {
|
|
2660
|
+
for (; ; ) {
|
|
2661
|
+
this.p = new BigInteger(B - qs, 1, rng);
|
|
2662
|
+
if (this.p.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.p.isProbablePrime(10)) {
|
|
2663
|
+
break;
|
|
2664
|
+
}
|
|
2665
|
+
}
|
|
2666
|
+
for (; ; ) {
|
|
2667
|
+
this.q = new BigInteger(qs, 1, rng);
|
|
2668
|
+
if (this.q.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.q.isProbablePrime(10)) {
|
|
2669
|
+
break;
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
if (this.p.compareTo(this.q) <= 0) {
|
|
2673
|
+
var t2 = this.p;
|
|
2674
|
+
this.p = this.q;
|
|
2675
|
+
this.q = t2;
|
|
2676
|
+
}
|
|
2677
|
+
var p1 = this.p.subtract(BigInteger.ONE);
|
|
2678
|
+
var q1 = this.q.subtract(BigInteger.ONE);
|
|
2679
|
+
var phi = p1.multiply(q1);
|
|
2680
|
+
if (phi.gcd(ee).compareTo(BigInteger.ONE) == 0) {
|
|
2681
|
+
this.n = this.p.multiply(this.q);
|
|
2682
|
+
this.d = ee.modInverse(phi);
|
|
2683
|
+
this.dmp1 = this.d.mod(p1);
|
|
2684
|
+
this.dmq1 = this.d.mod(q1);
|
|
2685
|
+
this.coeff = this.q.modInverse(this.p);
|
|
2686
|
+
break;
|
|
2687
|
+
}
|
|
2688
|
+
}
|
|
2689
|
+
};
|
|
2690
|
+
RSAKey2.prototype.decrypt = function(ctext) {
|
|
2691
|
+
var c = parseBigInt(ctext, 16);
|
|
2692
|
+
var m = this.doPrivate(c);
|
|
2693
|
+
if (m == null) {
|
|
2694
|
+
return null;
|
|
2695
|
+
}
|
|
2696
|
+
return pkcs1unpad2(m, this.n.bitLength() + 7 >> 3);
|
|
2697
|
+
};
|
|
2698
|
+
RSAKey2.prototype.generateAsync = function(B, E, callback) {
|
|
2699
|
+
var rng = new SecureRandom();
|
|
2700
|
+
var qs = B >> 1;
|
|
2701
|
+
this.e = parseInt(E, 16);
|
|
2702
|
+
var ee = new BigInteger(E, 16);
|
|
2703
|
+
var rsa = this;
|
|
2704
|
+
var loop1 = function() {
|
|
2705
|
+
var loop4 = function() {
|
|
2706
|
+
if (rsa.p.compareTo(rsa.q) <= 0) {
|
|
2707
|
+
var t2 = rsa.p;
|
|
2708
|
+
rsa.p = rsa.q;
|
|
2709
|
+
rsa.q = t2;
|
|
2710
|
+
}
|
|
2711
|
+
var p1 = rsa.p.subtract(BigInteger.ONE);
|
|
2712
|
+
var q1 = rsa.q.subtract(BigInteger.ONE);
|
|
2713
|
+
var phi = p1.multiply(q1);
|
|
2714
|
+
if (phi.gcd(ee).compareTo(BigInteger.ONE) == 0) {
|
|
2715
|
+
rsa.n = rsa.p.multiply(rsa.q);
|
|
2716
|
+
rsa.d = ee.modInverse(phi);
|
|
2717
|
+
rsa.dmp1 = rsa.d.mod(p1);
|
|
2718
|
+
rsa.dmq1 = rsa.d.mod(q1);
|
|
2719
|
+
rsa.coeff = rsa.q.modInverse(rsa.p);
|
|
2720
|
+
setTimeout(function() {
|
|
2721
|
+
callback();
|
|
2722
|
+
}, 0);
|
|
2723
|
+
} else {
|
|
2724
|
+
setTimeout(loop1, 0);
|
|
2725
|
+
}
|
|
2726
|
+
};
|
|
2727
|
+
var loop3 = function() {
|
|
2728
|
+
rsa.q = nbi();
|
|
2729
|
+
rsa.q.fromNumberAsync(qs, 1, rng, function() {
|
|
2730
|
+
rsa.q.subtract(BigInteger.ONE).gcda(ee, function(r) {
|
|
2731
|
+
if (r.compareTo(BigInteger.ONE) == 0 && rsa.q.isProbablePrime(10)) {
|
|
2732
|
+
setTimeout(loop4, 0);
|
|
2733
|
+
} else {
|
|
2734
|
+
setTimeout(loop3, 0);
|
|
2735
|
+
}
|
|
2736
|
+
});
|
|
2737
|
+
});
|
|
2738
|
+
};
|
|
2739
|
+
var loop2 = function() {
|
|
2740
|
+
rsa.p = nbi();
|
|
2741
|
+
rsa.p.fromNumberAsync(B - qs, 1, rng, function() {
|
|
2742
|
+
rsa.p.subtract(BigInteger.ONE).gcda(ee, function(r) {
|
|
2743
|
+
if (r.compareTo(BigInteger.ONE) == 0 && rsa.p.isProbablePrime(10)) {
|
|
2744
|
+
setTimeout(loop3, 0);
|
|
2745
|
+
} else {
|
|
2746
|
+
setTimeout(loop2, 0);
|
|
2747
|
+
}
|
|
2748
|
+
});
|
|
2749
|
+
});
|
|
2750
|
+
};
|
|
2751
|
+
setTimeout(loop2, 0);
|
|
2752
|
+
};
|
|
2753
|
+
setTimeout(loop1, 0);
|
|
2754
|
+
};
|
|
2755
|
+
RSAKey2.prototype.sign = function(text, digestMethod, digestName) {
|
|
2756
|
+
var header = getDigestHeader(digestName);
|
|
2757
|
+
var digest = header + digestMethod(text).toString();
|
|
2758
|
+
var m = pkcs1pad1(digest, this.n.bitLength() / 4);
|
|
2759
|
+
if (m == null) {
|
|
2760
|
+
return null;
|
|
2761
|
+
}
|
|
2762
|
+
var c = this.doPrivate(m);
|
|
2763
|
+
if (c == null) {
|
|
2764
|
+
return null;
|
|
2765
|
+
}
|
|
2766
|
+
var h = c.toString(16);
|
|
2767
|
+
if ((h.length & 1) == 0) {
|
|
2768
|
+
return h;
|
|
2769
|
+
} else {
|
|
2770
|
+
return "0" + h;
|
|
2771
|
+
}
|
|
2772
|
+
};
|
|
2773
|
+
RSAKey2.prototype.verify = function(text, signature, digestMethod) {
|
|
2774
|
+
var c = parseBigInt(signature, 16);
|
|
2775
|
+
var m = this.doPublic(c);
|
|
2776
|
+
if (m == null) {
|
|
2777
|
+
return null;
|
|
2778
|
+
}
|
|
2779
|
+
var unpadded = m.toString(16).replace(/^1f+00/, "");
|
|
2780
|
+
var digest = removeDigestHeader(unpadded);
|
|
2781
|
+
return digest == digestMethod(text).toString();
|
|
2782
|
+
};
|
|
2783
|
+
return RSAKey2;
|
|
2784
|
+
}()
|
|
2785
|
+
);
|
|
2786
|
+
function pkcs1unpad2(d, n) {
|
|
2787
|
+
var b = d.toByteArray();
|
|
2788
|
+
var i = 0;
|
|
2789
|
+
while (i < b.length && b[i] == 0) {
|
|
2790
|
+
++i;
|
|
2791
|
+
}
|
|
2792
|
+
if (b.length - i != n - 1 || b[i] != 2) {
|
|
2793
|
+
return null;
|
|
2794
|
+
}
|
|
2795
|
+
++i;
|
|
2796
|
+
while (b[i] != 0) {
|
|
2797
|
+
if (++i >= b.length) {
|
|
2798
|
+
return null;
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
var ret = "";
|
|
2802
|
+
while (++i < b.length) {
|
|
2803
|
+
var c = b[i] & 255;
|
|
2804
|
+
if (c < 128) {
|
|
2805
|
+
ret += String.fromCharCode(c);
|
|
2806
|
+
} else if (c > 191 && c < 224) {
|
|
2807
|
+
ret += String.fromCharCode((c & 31) << 6 | b[i + 1] & 63);
|
|
2808
|
+
++i;
|
|
2809
|
+
} else {
|
|
2810
|
+
ret += String.fromCharCode((c & 15) << 12 | (b[i + 1] & 63) << 6 | b[i + 2] & 63);
|
|
2811
|
+
i += 2;
|
|
2812
|
+
}
|
|
2813
|
+
}
|
|
2814
|
+
return ret;
|
|
2815
|
+
}
|
|
2816
|
+
var DIGEST_HEADERS = {
|
|
2817
|
+
md2: "3020300c06082a864886f70d020205000410",
|
|
2818
|
+
md5: "3020300c06082a864886f70d020505000410",
|
|
2819
|
+
sha1: "3021300906052b0e03021a05000414",
|
|
2820
|
+
sha224: "302d300d06096086480165030402040500041c",
|
|
2821
|
+
sha256: "3031300d060960864801650304020105000420",
|
|
2822
|
+
sha384: "3041300d060960864801650304020205000430",
|
|
2823
|
+
sha512: "3051300d060960864801650304020305000440",
|
|
2824
|
+
ripemd160: "3021300906052b2403020105000414"
|
|
2825
|
+
};
|
|
2826
|
+
function getDigestHeader(name) {
|
|
2827
|
+
return DIGEST_HEADERS[name] || "";
|
|
2828
|
+
}
|
|
2829
|
+
function removeDigestHeader(str) {
|
|
2830
|
+
for (var name_1 in DIGEST_HEADERS) {
|
|
2831
|
+
if (DIGEST_HEADERS.hasOwnProperty(name_1)) {
|
|
2832
|
+
var header = DIGEST_HEADERS[name_1];
|
|
2833
|
+
var len = header.length;
|
|
2834
|
+
if (str.substr(0, len) == header) {
|
|
2835
|
+
return str.substr(len);
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
}
|
|
2839
|
+
return str;
|
|
2840
|
+
}
|
|
2841
|
+
/*!
|
|
2842
|
+
Copyright (c) 2011, Yahoo! Inc. All rights reserved.
|
|
2843
|
+
Code licensed under the BSD License:
|
|
2844
|
+
http://developer.yahoo.com/yui/license.html
|
|
2845
|
+
version: 2.9.0
|
|
2846
|
+
*/
|
|
2847
|
+
var YAHOO = {};
|
|
2848
|
+
YAHOO.lang = {
|
|
2849
|
+
/**
|
|
2850
|
+
* Utility to set up the prototype, constructor and superclass properties to
|
|
2851
|
+
* support an inheritance strategy that can chain constructors and methods.
|
|
2852
|
+
* Static members will not be inherited.
|
|
2853
|
+
*
|
|
2854
|
+
* @method extend
|
|
2855
|
+
* @static
|
|
2856
|
+
* @param {Function} subc the object to modify
|
|
2857
|
+
* @param {Function} superc the object to inherit
|
|
2858
|
+
* @param {Object} overrides additional properties/methods to add to the
|
|
2859
|
+
* subclass prototype. These will override the
|
|
2860
|
+
* matching items obtained from the superclass
|
|
2861
|
+
* if present.
|
|
2862
|
+
*/
|
|
2863
|
+
extend: function(subc, superc, overrides) {
|
|
2864
|
+
if (!superc || !subc) {
|
|
2865
|
+
throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");
|
|
2866
|
+
}
|
|
2867
|
+
var F = function() {
|
|
2868
|
+
};
|
|
2869
|
+
F.prototype = superc.prototype;
|
|
2870
|
+
subc.prototype = new F();
|
|
2871
|
+
subc.prototype.constructor = subc;
|
|
2872
|
+
subc.superclass = superc.prototype;
|
|
2873
|
+
if (superc.prototype.constructor == Object.prototype.constructor) {
|
|
2874
|
+
superc.prototype.constructor = superc;
|
|
2875
|
+
}
|
|
2876
|
+
if (overrides) {
|
|
2877
|
+
var i;
|
|
2878
|
+
for (i in overrides) {
|
|
2879
|
+
subc.prototype[i] = overrides[i];
|
|
2880
|
+
}
|
|
2881
|
+
var _IEEnumFix = function() {
|
|
2882
|
+
}, ADD = ["toString", "valueOf"];
|
|
2883
|
+
try {
|
|
2884
|
+
if (/MSIE/.test(navigator.userAgent)) {
|
|
2885
|
+
_IEEnumFix = function(r, s) {
|
|
2886
|
+
for (i = 0; i < ADD.length; i = i + 1) {
|
|
2887
|
+
var fname = ADD[i], f = s[fname];
|
|
2888
|
+
if (typeof f === "function" && f != Object.prototype[fname]) {
|
|
2889
|
+
r[fname] = f;
|
|
2890
|
+
}
|
|
2891
|
+
}
|
|
2892
|
+
};
|
|
2893
|
+
}
|
|
2894
|
+
} catch (ex) {
|
|
2895
|
+
}
|
|
2896
|
+
_IEEnumFix(subc.prototype, overrides);
|
|
2897
|
+
}
|
|
2898
|
+
}
|
|
2899
|
+
};
|
|
2900
|
+
/**
|
|
2901
|
+
* @fileOverview
|
|
2902
|
+
* @name asn1-1.0.js
|
|
2903
|
+
* @author Kenji Urushima kenji.urushima@gmail.com
|
|
2904
|
+
* @version asn1 1.0.13 (2017-Jun-02)
|
|
2905
|
+
* @since jsrsasign 2.1
|
|
2906
|
+
* @license <a href="https://kjur.github.io/jsrsasign/license/">MIT License</a>
|
|
2907
|
+
*/
|
|
2908
|
+
var KJUR = {};
|
|
2909
|
+
if (typeof KJUR.asn1 == "undefined" || !KJUR.asn1)
|
|
2910
|
+
KJUR.asn1 = {};
|
|
2911
|
+
KJUR.asn1.ASN1Util = new function() {
|
|
2912
|
+
this.integerToByteHex = function(i) {
|
|
2913
|
+
var h = i.toString(16);
|
|
2914
|
+
if (h.length % 2 == 1)
|
|
2915
|
+
h = "0" + h;
|
|
2916
|
+
return h;
|
|
2917
|
+
};
|
|
2918
|
+
this.bigIntToMinTwosComplementsHex = function(bigIntegerValue) {
|
|
2919
|
+
var h = bigIntegerValue.toString(16);
|
|
2920
|
+
if (h.substr(0, 1) != "-") {
|
|
2921
|
+
if (h.length % 2 == 1) {
|
|
2922
|
+
h = "0" + h;
|
|
2923
|
+
} else {
|
|
2924
|
+
if (!h.match(/^[0-7]/)) {
|
|
2925
|
+
h = "00" + h;
|
|
2926
|
+
}
|
|
2927
|
+
}
|
|
2928
|
+
} else {
|
|
2929
|
+
var hPos = h.substr(1);
|
|
2930
|
+
var xorLen = hPos.length;
|
|
2931
|
+
if (xorLen % 2 == 1) {
|
|
2932
|
+
xorLen += 1;
|
|
2933
|
+
} else {
|
|
2934
|
+
if (!h.match(/^[0-7]/)) {
|
|
2935
|
+
xorLen += 2;
|
|
2936
|
+
}
|
|
2937
|
+
}
|
|
2938
|
+
var hMask = "";
|
|
2939
|
+
for (var i = 0; i < xorLen; i++) {
|
|
2940
|
+
hMask += "f";
|
|
2941
|
+
}
|
|
2942
|
+
var biMask = new BigInteger(hMask, 16);
|
|
2943
|
+
var biNeg = biMask.xor(bigIntegerValue).add(BigInteger.ONE);
|
|
2944
|
+
h = biNeg.toString(16).replace(/^-/, "");
|
|
2945
|
+
}
|
|
2946
|
+
return h;
|
|
2947
|
+
};
|
|
2948
|
+
this.getPEMStringFromHex = function(dataHex, pemHeader) {
|
|
2949
|
+
return hextopem(dataHex, pemHeader);
|
|
2950
|
+
};
|
|
2951
|
+
this.newObject = function(param) {
|
|
2952
|
+
var _KJUR = KJUR, _KJUR_asn1 = _KJUR.asn1, _DERBoolean = _KJUR_asn1.DERBoolean, _DERInteger = _KJUR_asn1.DERInteger, _DERBitString = _KJUR_asn1.DERBitString, _DEROctetString = _KJUR_asn1.DEROctetString, _DERNull = _KJUR_asn1.DERNull, _DERObjectIdentifier = _KJUR_asn1.DERObjectIdentifier, _DEREnumerated = _KJUR_asn1.DEREnumerated, _DERUTF8String = _KJUR_asn1.DERUTF8String, _DERNumericString = _KJUR_asn1.DERNumericString, _DERPrintableString = _KJUR_asn1.DERPrintableString, _DERTeletexString = _KJUR_asn1.DERTeletexString, _DERIA5String = _KJUR_asn1.DERIA5String, _DERUTCTime = _KJUR_asn1.DERUTCTime, _DERGeneralizedTime = _KJUR_asn1.DERGeneralizedTime, _DERSequence = _KJUR_asn1.DERSequence, _DERSet = _KJUR_asn1.DERSet, _DERTaggedObject = _KJUR_asn1.DERTaggedObject, _newObject = _KJUR_asn1.ASN1Util.newObject;
|
|
2953
|
+
var keys = Object.keys(param);
|
|
2954
|
+
if (keys.length != 1)
|
|
2955
|
+
throw "key of param shall be only one.";
|
|
2956
|
+
var key = keys[0];
|
|
2957
|
+
if (":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":" + key + ":") == -1)
|
|
2958
|
+
throw "undefined key: " + key;
|
|
2959
|
+
if (key == "bool")
|
|
2960
|
+
return new _DERBoolean(param[key]);
|
|
2961
|
+
if (key == "int")
|
|
2962
|
+
return new _DERInteger(param[key]);
|
|
2963
|
+
if (key == "bitstr")
|
|
2964
|
+
return new _DERBitString(param[key]);
|
|
2965
|
+
if (key == "octstr")
|
|
2966
|
+
return new _DEROctetString(param[key]);
|
|
2967
|
+
if (key == "null")
|
|
2968
|
+
return new _DERNull(param[key]);
|
|
2969
|
+
if (key == "oid")
|
|
2970
|
+
return new _DERObjectIdentifier(param[key]);
|
|
2971
|
+
if (key == "enum")
|
|
2972
|
+
return new _DEREnumerated(param[key]);
|
|
2973
|
+
if (key == "utf8str")
|
|
2974
|
+
return new _DERUTF8String(param[key]);
|
|
2975
|
+
if (key == "numstr")
|
|
2976
|
+
return new _DERNumericString(param[key]);
|
|
2977
|
+
if (key == "prnstr")
|
|
2978
|
+
return new _DERPrintableString(param[key]);
|
|
2979
|
+
if (key == "telstr")
|
|
2980
|
+
return new _DERTeletexString(param[key]);
|
|
2981
|
+
if (key == "ia5str")
|
|
2982
|
+
return new _DERIA5String(param[key]);
|
|
2983
|
+
if (key == "utctime")
|
|
2984
|
+
return new _DERUTCTime(param[key]);
|
|
2985
|
+
if (key == "gentime")
|
|
2986
|
+
return new _DERGeneralizedTime(param[key]);
|
|
2987
|
+
if (key == "seq") {
|
|
2988
|
+
var paramList = param[key];
|
|
2989
|
+
var a = [];
|
|
2990
|
+
for (var i = 0; i < paramList.length; i++) {
|
|
2991
|
+
var asn1Obj = _newObject(paramList[i]);
|
|
2992
|
+
a.push(asn1Obj);
|
|
2993
|
+
}
|
|
2994
|
+
return new _DERSequence({ "array": a });
|
|
2995
|
+
}
|
|
2996
|
+
if (key == "set") {
|
|
2997
|
+
var paramList = param[key];
|
|
2998
|
+
var a = [];
|
|
2999
|
+
for (var i = 0; i < paramList.length; i++) {
|
|
3000
|
+
var asn1Obj = _newObject(paramList[i]);
|
|
3001
|
+
a.push(asn1Obj);
|
|
3002
|
+
}
|
|
3003
|
+
return new _DERSet({ "array": a });
|
|
3004
|
+
}
|
|
3005
|
+
if (key == "tag") {
|
|
3006
|
+
var tagParam = param[key];
|
|
3007
|
+
if (Object.prototype.toString.call(tagParam) === "[object Array]" && tagParam.length == 3) {
|
|
3008
|
+
var obj = _newObject(tagParam[2]);
|
|
3009
|
+
return new _DERTaggedObject({
|
|
3010
|
+
tag: tagParam[0],
|
|
3011
|
+
explicit: tagParam[1],
|
|
3012
|
+
obj
|
|
3013
|
+
});
|
|
3014
|
+
} else {
|
|
3015
|
+
var newParam = {};
|
|
3016
|
+
if (tagParam.explicit !== void 0)
|
|
3017
|
+
newParam.explicit = tagParam.explicit;
|
|
3018
|
+
if (tagParam.tag !== void 0)
|
|
3019
|
+
newParam.tag = tagParam.tag;
|
|
3020
|
+
if (tagParam.obj === void 0)
|
|
3021
|
+
throw "obj shall be specified for 'tag'.";
|
|
3022
|
+
newParam.obj = _newObject(tagParam.obj);
|
|
3023
|
+
return new _DERTaggedObject(newParam);
|
|
3024
|
+
}
|
|
3025
|
+
}
|
|
3026
|
+
};
|
|
3027
|
+
this.jsonToASN1HEX = function(param) {
|
|
3028
|
+
var asn1Obj = this.newObject(param);
|
|
3029
|
+
return asn1Obj.getEncodedHex();
|
|
3030
|
+
};
|
|
3031
|
+
}();
|
|
3032
|
+
KJUR.asn1.ASN1Util.oidHexToInt = function(hex) {
|
|
3033
|
+
var s = "";
|
|
3034
|
+
var i01 = parseInt(hex.substr(0, 2), 16);
|
|
3035
|
+
var i0 = Math.floor(i01 / 40);
|
|
3036
|
+
var i1 = i01 % 40;
|
|
3037
|
+
var s = i0 + "." + i1;
|
|
3038
|
+
var binbuf = "";
|
|
3039
|
+
for (var i = 2; i < hex.length; i += 2) {
|
|
3040
|
+
var value = parseInt(hex.substr(i, 2), 16);
|
|
3041
|
+
var bin = ("00000000" + value.toString(2)).slice(-8);
|
|
3042
|
+
binbuf = binbuf + bin.substr(1, 7);
|
|
3043
|
+
if (bin.substr(0, 1) == "0") {
|
|
3044
|
+
var bi = new BigInteger(binbuf, 2);
|
|
3045
|
+
s = s + "." + bi.toString(10);
|
|
3046
|
+
binbuf = "";
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
return s;
|
|
3050
|
+
};
|
|
3051
|
+
KJUR.asn1.ASN1Util.oidIntToHex = function(oidString) {
|
|
3052
|
+
var itox = function(i2) {
|
|
3053
|
+
var h2 = i2.toString(16);
|
|
3054
|
+
if (h2.length == 1)
|
|
3055
|
+
h2 = "0" + h2;
|
|
3056
|
+
return h2;
|
|
3057
|
+
};
|
|
3058
|
+
var roidtox = function(roid) {
|
|
3059
|
+
var h2 = "";
|
|
3060
|
+
var bi = new BigInteger(roid, 10);
|
|
3061
|
+
var b = bi.toString(2);
|
|
3062
|
+
var padLen = 7 - b.length % 7;
|
|
3063
|
+
if (padLen == 7)
|
|
3064
|
+
padLen = 0;
|
|
3065
|
+
var bPad = "";
|
|
3066
|
+
for (var i2 = 0; i2 < padLen; i2++)
|
|
3067
|
+
bPad += "0";
|
|
3068
|
+
b = bPad + b;
|
|
3069
|
+
for (var i2 = 0; i2 < b.length - 1; i2 += 7) {
|
|
3070
|
+
var b8 = b.substr(i2, 7);
|
|
3071
|
+
if (i2 != b.length - 7)
|
|
3072
|
+
b8 = "1" + b8;
|
|
3073
|
+
h2 += itox(parseInt(b8, 2));
|
|
3074
|
+
}
|
|
3075
|
+
return h2;
|
|
3076
|
+
};
|
|
3077
|
+
if (!oidString.match(/^[0-9.]+$/)) {
|
|
3078
|
+
throw "malformed oid string: " + oidString;
|
|
3079
|
+
}
|
|
3080
|
+
var h = "";
|
|
3081
|
+
var a = oidString.split(".");
|
|
3082
|
+
var i0 = parseInt(a[0]) * 40 + parseInt(a[1]);
|
|
3083
|
+
h += itox(i0);
|
|
3084
|
+
a.splice(0, 2);
|
|
3085
|
+
for (var i = 0; i < a.length; i++) {
|
|
3086
|
+
h += roidtox(a[i]);
|
|
3087
|
+
}
|
|
3088
|
+
return h;
|
|
3089
|
+
};
|
|
3090
|
+
KJUR.asn1.ASN1Object = function() {
|
|
3091
|
+
var hV = "";
|
|
3092
|
+
this.getLengthHexFromValue = function() {
|
|
3093
|
+
if (typeof this.hV == "undefined" || this.hV == null) {
|
|
3094
|
+
throw "this.hV is null or undefined.";
|
|
3095
|
+
}
|
|
3096
|
+
if (this.hV.length % 2 == 1) {
|
|
3097
|
+
throw "value hex must be even length: n=" + hV.length + ",v=" + this.hV;
|
|
3098
|
+
}
|
|
3099
|
+
var n = this.hV.length / 2;
|
|
3100
|
+
var hN = n.toString(16);
|
|
3101
|
+
if (hN.length % 2 == 1) {
|
|
3102
|
+
hN = "0" + hN;
|
|
3103
|
+
}
|
|
3104
|
+
if (n < 128) {
|
|
3105
|
+
return hN;
|
|
3106
|
+
} else {
|
|
3107
|
+
var hNlen = hN.length / 2;
|
|
3108
|
+
if (hNlen > 15) {
|
|
3109
|
+
throw "ASN.1 length too long to represent by 8x: n = " + n.toString(16);
|
|
3110
|
+
}
|
|
3111
|
+
var head = 128 + hNlen;
|
|
3112
|
+
return head.toString(16) + hN;
|
|
3113
|
+
}
|
|
3114
|
+
};
|
|
3115
|
+
this.getEncodedHex = function() {
|
|
3116
|
+
if (this.hTLV == null || this.isModified) {
|
|
3117
|
+
this.hV = this.getFreshValueHex();
|
|
3118
|
+
this.hL = this.getLengthHexFromValue();
|
|
3119
|
+
this.hTLV = this.hT + this.hL + this.hV;
|
|
3120
|
+
this.isModified = false;
|
|
3121
|
+
}
|
|
3122
|
+
return this.hTLV;
|
|
3123
|
+
};
|
|
3124
|
+
this.getValueHex = function() {
|
|
3125
|
+
this.getEncodedHex();
|
|
3126
|
+
return this.hV;
|
|
3127
|
+
};
|
|
3128
|
+
this.getFreshValueHex = function() {
|
|
3129
|
+
return "";
|
|
3130
|
+
};
|
|
3131
|
+
};
|
|
3132
|
+
KJUR.asn1.DERAbstractString = function(params) {
|
|
3133
|
+
KJUR.asn1.DERAbstractString.superclass.constructor.call(this);
|
|
3134
|
+
this.getString = function() {
|
|
3135
|
+
return this.s;
|
|
3136
|
+
};
|
|
3137
|
+
this.setString = function(newS) {
|
|
3138
|
+
this.hTLV = null;
|
|
3139
|
+
this.isModified = true;
|
|
3140
|
+
this.s = newS;
|
|
3141
|
+
this.hV = stohex(this.s);
|
|
3142
|
+
};
|
|
3143
|
+
this.setStringHex = function(newHexString) {
|
|
3144
|
+
this.hTLV = null;
|
|
3145
|
+
this.isModified = true;
|
|
3146
|
+
this.s = null;
|
|
3147
|
+
this.hV = newHexString;
|
|
3148
|
+
};
|
|
3149
|
+
this.getFreshValueHex = function() {
|
|
3150
|
+
return this.hV;
|
|
3151
|
+
};
|
|
3152
|
+
if (typeof params != "undefined") {
|
|
3153
|
+
if (typeof params == "string") {
|
|
3154
|
+
this.setString(params);
|
|
3155
|
+
} else if (typeof params["str"] != "undefined") {
|
|
3156
|
+
this.setString(params["str"]);
|
|
3157
|
+
} else if (typeof params["hex"] != "undefined") {
|
|
3158
|
+
this.setStringHex(params["hex"]);
|
|
3159
|
+
}
|
|
3160
|
+
}
|
|
3161
|
+
};
|
|
3162
|
+
YAHOO.lang.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object);
|
|
3163
|
+
KJUR.asn1.DERAbstractTime = function(params) {
|
|
3164
|
+
KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);
|
|
3165
|
+
this.localDateToUTC = function(d) {
|
|
3166
|
+
utc = d.getTime() + d.getTimezoneOffset() * 6e4;
|
|
3167
|
+
var utcDate = new Date(utc);
|
|
3168
|
+
return utcDate;
|
|
3169
|
+
};
|
|
3170
|
+
this.formatDate = function(dateObject, type, withMillis) {
|
|
3171
|
+
var pad = this.zeroPadding;
|
|
3172
|
+
var d = this.localDateToUTC(dateObject);
|
|
3173
|
+
var year = String(d.getFullYear());
|
|
3174
|
+
if (type == "utc")
|
|
3175
|
+
year = year.substr(2, 2);
|
|
3176
|
+
var month = pad(String(d.getMonth() + 1), 2);
|
|
3177
|
+
var day = pad(String(d.getDate()), 2);
|
|
3178
|
+
var hour = pad(String(d.getHours()), 2);
|
|
3179
|
+
var min = pad(String(d.getMinutes()), 2);
|
|
3180
|
+
var sec = pad(String(d.getSeconds()), 2);
|
|
3181
|
+
var s = year + month + day + hour + min + sec;
|
|
3182
|
+
if (withMillis === true) {
|
|
3183
|
+
var millis = d.getMilliseconds();
|
|
3184
|
+
if (millis != 0) {
|
|
3185
|
+
var sMillis = pad(String(millis), 3);
|
|
3186
|
+
sMillis = sMillis.replace(/[0]+$/, "");
|
|
3187
|
+
s = s + "." + sMillis;
|
|
3188
|
+
}
|
|
3189
|
+
}
|
|
3190
|
+
return s + "Z";
|
|
3191
|
+
};
|
|
3192
|
+
this.zeroPadding = function(s, len) {
|
|
3193
|
+
if (s.length >= len)
|
|
3194
|
+
return s;
|
|
3195
|
+
return new Array(len - s.length + 1).join("0") + s;
|
|
3196
|
+
};
|
|
3197
|
+
this.getString = function() {
|
|
3198
|
+
return this.s;
|
|
3199
|
+
};
|
|
3200
|
+
this.setString = function(newS) {
|
|
3201
|
+
this.hTLV = null;
|
|
3202
|
+
this.isModified = true;
|
|
3203
|
+
this.s = newS;
|
|
3204
|
+
this.hV = stohex(newS);
|
|
3205
|
+
};
|
|
3206
|
+
this.setByDateValue = function(year, month, day, hour, min, sec) {
|
|
3207
|
+
var dateObject = new Date(Date.UTC(year, month - 1, day, hour, min, sec, 0));
|
|
3208
|
+
this.setByDate(dateObject);
|
|
3209
|
+
};
|
|
3210
|
+
this.getFreshValueHex = function() {
|
|
3211
|
+
return this.hV;
|
|
3212
|
+
};
|
|
3213
|
+
};
|
|
3214
|
+
YAHOO.lang.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object);
|
|
3215
|
+
KJUR.asn1.DERAbstractStructured = function(params) {
|
|
3216
|
+
KJUR.asn1.DERAbstractString.superclass.constructor.call(this);
|
|
3217
|
+
this.setByASN1ObjectArray = function(asn1ObjectArray) {
|
|
3218
|
+
this.hTLV = null;
|
|
3219
|
+
this.isModified = true;
|
|
3220
|
+
this.asn1Array = asn1ObjectArray;
|
|
3221
|
+
};
|
|
3222
|
+
this.appendASN1Object = function(asn1Object) {
|
|
3223
|
+
this.hTLV = null;
|
|
3224
|
+
this.isModified = true;
|
|
3225
|
+
this.asn1Array.push(asn1Object);
|
|
3226
|
+
};
|
|
3227
|
+
this.asn1Array = new Array();
|
|
3228
|
+
if (typeof params != "undefined") {
|
|
3229
|
+
if (typeof params["array"] != "undefined") {
|
|
3230
|
+
this.asn1Array = params["array"];
|
|
3231
|
+
}
|
|
3232
|
+
}
|
|
3233
|
+
};
|
|
3234
|
+
YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object);
|
|
3235
|
+
KJUR.asn1.DERBoolean = function() {
|
|
3236
|
+
KJUR.asn1.DERBoolean.superclass.constructor.call(this);
|
|
3237
|
+
this.hT = "01";
|
|
3238
|
+
this.hTLV = "0101ff";
|
|
3239
|
+
};
|
|
3240
|
+
YAHOO.lang.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object);
|
|
3241
|
+
KJUR.asn1.DERInteger = function(params) {
|
|
3242
|
+
KJUR.asn1.DERInteger.superclass.constructor.call(this);
|
|
3243
|
+
this.hT = "02";
|
|
3244
|
+
this.setByBigInteger = function(bigIntegerValue) {
|
|
3245
|
+
this.hTLV = null;
|
|
3246
|
+
this.isModified = true;
|
|
3247
|
+
this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue);
|
|
3248
|
+
};
|
|
3249
|
+
this.setByInteger = function(intValue) {
|
|
3250
|
+
var bi = new BigInteger(String(intValue), 10);
|
|
3251
|
+
this.setByBigInteger(bi);
|
|
3252
|
+
};
|
|
3253
|
+
this.setValueHex = function(newHexString) {
|
|
3254
|
+
this.hV = newHexString;
|
|
3255
|
+
};
|
|
3256
|
+
this.getFreshValueHex = function() {
|
|
3257
|
+
return this.hV;
|
|
3258
|
+
};
|
|
3259
|
+
if (typeof params != "undefined") {
|
|
3260
|
+
if (typeof params["bigint"] != "undefined") {
|
|
3261
|
+
this.setByBigInteger(params["bigint"]);
|
|
3262
|
+
} else if (typeof params["int"] != "undefined") {
|
|
3263
|
+
this.setByInteger(params["int"]);
|
|
3264
|
+
} else if (typeof params == "number") {
|
|
3265
|
+
this.setByInteger(params);
|
|
3266
|
+
} else if (typeof params["hex"] != "undefined") {
|
|
3267
|
+
this.setValueHex(params["hex"]);
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3270
|
+
};
|
|
3271
|
+
YAHOO.lang.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object);
|
|
3272
|
+
KJUR.asn1.DERBitString = function(params) {
|
|
3273
|
+
if (params !== void 0 && typeof params.obj !== "undefined") {
|
|
3274
|
+
var o = KJUR.asn1.ASN1Util.newObject(params.obj);
|
|
3275
|
+
params.hex = "00" + o.getEncodedHex();
|
|
3276
|
+
}
|
|
3277
|
+
KJUR.asn1.DERBitString.superclass.constructor.call(this);
|
|
3278
|
+
this.hT = "03";
|
|
3279
|
+
this.setHexValueIncludingUnusedBits = function(newHexStringIncludingUnusedBits) {
|
|
3280
|
+
this.hTLV = null;
|
|
3281
|
+
this.isModified = true;
|
|
3282
|
+
this.hV = newHexStringIncludingUnusedBits;
|
|
3283
|
+
};
|
|
3284
|
+
this.setUnusedBitsAndHexValue = function(unusedBits, hValue) {
|
|
3285
|
+
if (unusedBits < 0 || 7 < unusedBits) {
|
|
3286
|
+
throw "unused bits shall be from 0 to 7: u = " + unusedBits;
|
|
3287
|
+
}
|
|
3288
|
+
var hUnusedBits = "0" + unusedBits;
|
|
3289
|
+
this.hTLV = null;
|
|
3290
|
+
this.isModified = true;
|
|
3291
|
+
this.hV = hUnusedBits + hValue;
|
|
3292
|
+
};
|
|
3293
|
+
this.setByBinaryString = function(binaryString) {
|
|
3294
|
+
binaryString = binaryString.replace(/0+$/, "");
|
|
3295
|
+
var unusedBits = 8 - binaryString.length % 8;
|
|
3296
|
+
if (unusedBits == 8)
|
|
3297
|
+
unusedBits = 0;
|
|
3298
|
+
for (var i = 0; i <= unusedBits; i++) {
|
|
3299
|
+
binaryString += "0";
|
|
3300
|
+
}
|
|
3301
|
+
var h = "";
|
|
3302
|
+
for (var i = 0; i < binaryString.length - 1; i += 8) {
|
|
3303
|
+
var b = binaryString.substr(i, 8);
|
|
3304
|
+
var x = parseInt(b, 2).toString(16);
|
|
3305
|
+
if (x.length == 1)
|
|
3306
|
+
x = "0" + x;
|
|
3307
|
+
h += x;
|
|
3308
|
+
}
|
|
3309
|
+
this.hTLV = null;
|
|
3310
|
+
this.isModified = true;
|
|
3311
|
+
this.hV = "0" + unusedBits + h;
|
|
3312
|
+
};
|
|
3313
|
+
this.setByBooleanArray = function(booleanArray) {
|
|
3314
|
+
var s = "";
|
|
3315
|
+
for (var i = 0; i < booleanArray.length; i++) {
|
|
3316
|
+
if (booleanArray[i] == true) {
|
|
3317
|
+
s += "1";
|
|
3318
|
+
} else {
|
|
3319
|
+
s += "0";
|
|
3320
|
+
}
|
|
3321
|
+
}
|
|
3322
|
+
this.setByBinaryString(s);
|
|
3323
|
+
};
|
|
3324
|
+
this.newFalseArray = function(nLength) {
|
|
3325
|
+
var a = new Array(nLength);
|
|
3326
|
+
for (var i = 0; i < nLength; i++) {
|
|
3327
|
+
a[i] = false;
|
|
3328
|
+
}
|
|
3329
|
+
return a;
|
|
3330
|
+
};
|
|
3331
|
+
this.getFreshValueHex = function() {
|
|
3332
|
+
return this.hV;
|
|
3333
|
+
};
|
|
3334
|
+
if (typeof params != "undefined") {
|
|
3335
|
+
if (typeof params == "string" && params.toLowerCase().match(/^[0-9a-f]+$/)) {
|
|
3336
|
+
this.setHexValueIncludingUnusedBits(params);
|
|
3337
|
+
} else if (typeof params["hex"] != "undefined") {
|
|
3338
|
+
this.setHexValueIncludingUnusedBits(params["hex"]);
|
|
3339
|
+
} else if (typeof params["bin"] != "undefined") {
|
|
3340
|
+
this.setByBinaryString(params["bin"]);
|
|
3341
|
+
} else if (typeof params["array"] != "undefined") {
|
|
3342
|
+
this.setByBooleanArray(params["array"]);
|
|
3343
|
+
}
|
|
3344
|
+
}
|
|
3345
|
+
};
|
|
3346
|
+
YAHOO.lang.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object);
|
|
3347
|
+
KJUR.asn1.DEROctetString = function(params) {
|
|
3348
|
+
if (params !== void 0 && typeof params.obj !== "undefined") {
|
|
3349
|
+
var o = KJUR.asn1.ASN1Util.newObject(params.obj);
|
|
3350
|
+
params.hex = o.getEncodedHex();
|
|
3351
|
+
}
|
|
3352
|
+
KJUR.asn1.DEROctetString.superclass.constructor.call(this, params);
|
|
3353
|
+
this.hT = "04";
|
|
3354
|
+
};
|
|
3355
|
+
YAHOO.lang.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString);
|
|
3356
|
+
KJUR.asn1.DERNull = function() {
|
|
3357
|
+
KJUR.asn1.DERNull.superclass.constructor.call(this);
|
|
3358
|
+
this.hT = "05";
|
|
3359
|
+
this.hTLV = "0500";
|
|
3360
|
+
};
|
|
3361
|
+
YAHOO.lang.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object);
|
|
3362
|
+
KJUR.asn1.DERObjectIdentifier = function(params) {
|
|
3363
|
+
var itox = function(i) {
|
|
3364
|
+
var h = i.toString(16);
|
|
3365
|
+
if (h.length == 1)
|
|
3366
|
+
h = "0" + h;
|
|
3367
|
+
return h;
|
|
3368
|
+
};
|
|
3369
|
+
var roidtox = function(roid) {
|
|
3370
|
+
var h = "";
|
|
3371
|
+
var bi = new BigInteger(roid, 10);
|
|
3372
|
+
var b = bi.toString(2);
|
|
3373
|
+
var padLen = 7 - b.length % 7;
|
|
3374
|
+
if (padLen == 7)
|
|
3375
|
+
padLen = 0;
|
|
3376
|
+
var bPad = "";
|
|
3377
|
+
for (var i = 0; i < padLen; i++)
|
|
3378
|
+
bPad += "0";
|
|
3379
|
+
b = bPad + b;
|
|
3380
|
+
for (var i = 0; i < b.length - 1; i += 7) {
|
|
3381
|
+
var b8 = b.substr(i, 7);
|
|
3382
|
+
if (i != b.length - 7)
|
|
3383
|
+
b8 = "1" + b8;
|
|
3384
|
+
h += itox(parseInt(b8, 2));
|
|
3385
|
+
}
|
|
3386
|
+
return h;
|
|
3387
|
+
};
|
|
3388
|
+
KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this);
|
|
3389
|
+
this.hT = "06";
|
|
3390
|
+
this.setValueHex = function(newHexString) {
|
|
3391
|
+
this.hTLV = null;
|
|
3392
|
+
this.isModified = true;
|
|
3393
|
+
this.s = null;
|
|
3394
|
+
this.hV = newHexString;
|
|
3395
|
+
};
|
|
3396
|
+
this.setValueOidString = function(oidString) {
|
|
3397
|
+
if (!oidString.match(/^[0-9.]+$/)) {
|
|
3398
|
+
throw "malformed oid string: " + oidString;
|
|
3399
|
+
}
|
|
3400
|
+
var h = "";
|
|
3401
|
+
var a = oidString.split(".");
|
|
3402
|
+
var i0 = parseInt(a[0]) * 40 + parseInt(a[1]);
|
|
3403
|
+
h += itox(i0);
|
|
3404
|
+
a.splice(0, 2);
|
|
3405
|
+
for (var i = 0; i < a.length; i++) {
|
|
3406
|
+
h += roidtox(a[i]);
|
|
3407
|
+
}
|
|
3408
|
+
this.hTLV = null;
|
|
3409
|
+
this.isModified = true;
|
|
3410
|
+
this.s = null;
|
|
3411
|
+
this.hV = h;
|
|
3412
|
+
};
|
|
3413
|
+
this.setValueName = function(oidName) {
|
|
3414
|
+
var oid = KJUR.asn1.x509.OID.name2oid(oidName);
|
|
3415
|
+
if (oid !== "") {
|
|
3416
|
+
this.setValueOidString(oid);
|
|
3417
|
+
} else {
|
|
3418
|
+
throw "DERObjectIdentifier oidName undefined: " + oidName;
|
|
3419
|
+
}
|
|
3420
|
+
};
|
|
3421
|
+
this.getFreshValueHex = function() {
|
|
3422
|
+
return this.hV;
|
|
3423
|
+
};
|
|
3424
|
+
if (params !== void 0) {
|
|
3425
|
+
if (typeof params === "string") {
|
|
3426
|
+
if (params.match(/^[0-2].[0-9.]+$/)) {
|
|
3427
|
+
this.setValueOidString(params);
|
|
3428
|
+
} else {
|
|
3429
|
+
this.setValueName(params);
|
|
3430
|
+
}
|
|
3431
|
+
} else if (params.oid !== void 0) {
|
|
3432
|
+
this.setValueOidString(params.oid);
|
|
3433
|
+
} else if (params.hex !== void 0) {
|
|
3434
|
+
this.setValueHex(params.hex);
|
|
3435
|
+
} else if (params.name !== void 0) {
|
|
3436
|
+
this.setValueName(params.name);
|
|
3437
|
+
}
|
|
3438
|
+
}
|
|
3439
|
+
};
|
|
3440
|
+
YAHOO.lang.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object);
|
|
3441
|
+
KJUR.asn1.DEREnumerated = function(params) {
|
|
3442
|
+
KJUR.asn1.DEREnumerated.superclass.constructor.call(this);
|
|
3443
|
+
this.hT = "0a";
|
|
3444
|
+
this.setByBigInteger = function(bigIntegerValue) {
|
|
3445
|
+
this.hTLV = null;
|
|
3446
|
+
this.isModified = true;
|
|
3447
|
+
this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue);
|
|
3448
|
+
};
|
|
3449
|
+
this.setByInteger = function(intValue) {
|
|
3450
|
+
var bi = new BigInteger(String(intValue), 10);
|
|
3451
|
+
this.setByBigInteger(bi);
|
|
3452
|
+
};
|
|
3453
|
+
this.setValueHex = function(newHexString) {
|
|
3454
|
+
this.hV = newHexString;
|
|
3455
|
+
};
|
|
3456
|
+
this.getFreshValueHex = function() {
|
|
3457
|
+
return this.hV;
|
|
3458
|
+
};
|
|
3459
|
+
if (typeof params != "undefined") {
|
|
3460
|
+
if (typeof params["int"] != "undefined") {
|
|
3461
|
+
this.setByInteger(params["int"]);
|
|
3462
|
+
} else if (typeof params == "number") {
|
|
3463
|
+
this.setByInteger(params);
|
|
3464
|
+
} else if (typeof params["hex"] != "undefined") {
|
|
3465
|
+
this.setValueHex(params["hex"]);
|
|
3466
|
+
}
|
|
3467
|
+
}
|
|
3468
|
+
};
|
|
3469
|
+
YAHOO.lang.extend(KJUR.asn1.DEREnumerated, KJUR.asn1.ASN1Object);
|
|
3470
|
+
KJUR.asn1.DERUTF8String = function(params) {
|
|
3471
|
+
KJUR.asn1.DERUTF8String.superclass.constructor.call(this, params);
|
|
3472
|
+
this.hT = "0c";
|
|
3473
|
+
};
|
|
3474
|
+
YAHOO.lang.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString);
|
|
3475
|
+
KJUR.asn1.DERNumericString = function(params) {
|
|
3476
|
+
KJUR.asn1.DERNumericString.superclass.constructor.call(this, params);
|
|
3477
|
+
this.hT = "12";
|
|
3478
|
+
};
|
|
3479
|
+
YAHOO.lang.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString);
|
|
3480
|
+
KJUR.asn1.DERPrintableString = function(params) {
|
|
3481
|
+
KJUR.asn1.DERPrintableString.superclass.constructor.call(this, params);
|
|
3482
|
+
this.hT = "13";
|
|
3483
|
+
};
|
|
3484
|
+
YAHOO.lang.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString);
|
|
3485
|
+
KJUR.asn1.DERTeletexString = function(params) {
|
|
3486
|
+
KJUR.asn1.DERTeletexString.superclass.constructor.call(this, params);
|
|
3487
|
+
this.hT = "14";
|
|
3488
|
+
};
|
|
3489
|
+
YAHOO.lang.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString);
|
|
3490
|
+
KJUR.asn1.DERIA5String = function(params) {
|
|
3491
|
+
KJUR.asn1.DERIA5String.superclass.constructor.call(this, params);
|
|
3492
|
+
this.hT = "16";
|
|
3493
|
+
};
|
|
3494
|
+
YAHOO.lang.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString);
|
|
3495
|
+
KJUR.asn1.DERUTCTime = function(params) {
|
|
3496
|
+
KJUR.asn1.DERUTCTime.superclass.constructor.call(this, params);
|
|
3497
|
+
this.hT = "17";
|
|
3498
|
+
this.setByDate = function(dateObject) {
|
|
3499
|
+
this.hTLV = null;
|
|
3500
|
+
this.isModified = true;
|
|
3501
|
+
this.date = dateObject;
|
|
3502
|
+
this.s = this.formatDate(this.date, "utc");
|
|
3503
|
+
this.hV = stohex(this.s);
|
|
3504
|
+
};
|
|
3505
|
+
this.getFreshValueHex = function() {
|
|
3506
|
+
if (typeof this.date == "undefined" && typeof this.s == "undefined") {
|
|
3507
|
+
this.date = /* @__PURE__ */ new Date();
|
|
3508
|
+
this.s = this.formatDate(this.date, "utc");
|
|
3509
|
+
this.hV = stohex(this.s);
|
|
3510
|
+
}
|
|
3511
|
+
return this.hV;
|
|
3512
|
+
};
|
|
3513
|
+
if (params !== void 0) {
|
|
3514
|
+
if (params.str !== void 0) {
|
|
3515
|
+
this.setString(params.str);
|
|
3516
|
+
} else if (typeof params == "string" && params.match(/^[0-9]{12}Z$/)) {
|
|
3517
|
+
this.setString(params);
|
|
3518
|
+
} else if (params.hex !== void 0) {
|
|
3519
|
+
this.setStringHex(params.hex);
|
|
3520
|
+
} else if (params.date !== void 0) {
|
|
3521
|
+
this.setByDate(params.date);
|
|
3522
|
+
}
|
|
3523
|
+
}
|
|
3524
|
+
};
|
|
3525
|
+
YAHOO.lang.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime);
|
|
3526
|
+
KJUR.asn1.DERGeneralizedTime = function(params) {
|
|
3527
|
+
KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, params);
|
|
3528
|
+
this.hT = "18";
|
|
3529
|
+
this.withMillis = false;
|
|
3530
|
+
this.setByDate = function(dateObject) {
|
|
3531
|
+
this.hTLV = null;
|
|
3532
|
+
this.isModified = true;
|
|
3533
|
+
this.date = dateObject;
|
|
3534
|
+
this.s = this.formatDate(this.date, "gen", this.withMillis);
|
|
3535
|
+
this.hV = stohex(this.s);
|
|
3536
|
+
};
|
|
3537
|
+
this.getFreshValueHex = function() {
|
|
3538
|
+
if (this.date === void 0 && this.s === void 0) {
|
|
3539
|
+
this.date = /* @__PURE__ */ new Date();
|
|
3540
|
+
this.s = this.formatDate(this.date, "gen", this.withMillis);
|
|
3541
|
+
this.hV = stohex(this.s);
|
|
3542
|
+
}
|
|
3543
|
+
return this.hV;
|
|
3544
|
+
};
|
|
3545
|
+
if (params !== void 0) {
|
|
3546
|
+
if (params.str !== void 0) {
|
|
3547
|
+
this.setString(params.str);
|
|
3548
|
+
} else if (typeof params == "string" && params.match(/^[0-9]{14}Z$/)) {
|
|
3549
|
+
this.setString(params);
|
|
3550
|
+
} else if (params.hex !== void 0) {
|
|
3551
|
+
this.setStringHex(params.hex);
|
|
3552
|
+
} else if (params.date !== void 0) {
|
|
3553
|
+
this.setByDate(params.date);
|
|
3554
|
+
}
|
|
3555
|
+
if (params.millis === true) {
|
|
3556
|
+
this.withMillis = true;
|
|
3557
|
+
}
|
|
3558
|
+
}
|
|
3559
|
+
};
|
|
3560
|
+
YAHOO.lang.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime);
|
|
3561
|
+
KJUR.asn1.DERSequence = function(params) {
|
|
3562
|
+
KJUR.asn1.DERSequence.superclass.constructor.call(this, params);
|
|
3563
|
+
this.hT = "30";
|
|
3564
|
+
this.getFreshValueHex = function() {
|
|
3565
|
+
var h = "";
|
|
3566
|
+
for (var i = 0; i < this.asn1Array.length; i++) {
|
|
3567
|
+
var asn1Obj = this.asn1Array[i];
|
|
3568
|
+
h += asn1Obj.getEncodedHex();
|
|
3569
|
+
}
|
|
3570
|
+
this.hV = h;
|
|
3571
|
+
return this.hV;
|
|
3572
|
+
};
|
|
3573
|
+
};
|
|
3574
|
+
YAHOO.lang.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured);
|
|
3575
|
+
KJUR.asn1.DERSet = function(params) {
|
|
3576
|
+
KJUR.asn1.DERSet.superclass.constructor.call(this, params);
|
|
3577
|
+
this.hT = "31";
|
|
3578
|
+
this.sortFlag = true;
|
|
3579
|
+
this.getFreshValueHex = function() {
|
|
3580
|
+
var a = new Array();
|
|
3581
|
+
for (var i = 0; i < this.asn1Array.length; i++) {
|
|
3582
|
+
var asn1Obj = this.asn1Array[i];
|
|
3583
|
+
a.push(asn1Obj.getEncodedHex());
|
|
3584
|
+
}
|
|
3585
|
+
if (this.sortFlag == true)
|
|
3586
|
+
a.sort();
|
|
3587
|
+
this.hV = a.join("");
|
|
3588
|
+
return this.hV;
|
|
3589
|
+
};
|
|
3590
|
+
if (typeof params != "undefined") {
|
|
3591
|
+
if (typeof params.sortflag != "undefined" && params.sortflag == false)
|
|
3592
|
+
this.sortFlag = false;
|
|
3593
|
+
}
|
|
3594
|
+
};
|
|
3595
|
+
YAHOO.lang.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured);
|
|
3596
|
+
KJUR.asn1.DERTaggedObject = function(params) {
|
|
3597
|
+
KJUR.asn1.DERTaggedObject.superclass.constructor.call(this);
|
|
3598
|
+
this.hT = "a0";
|
|
3599
|
+
this.hV = "";
|
|
3600
|
+
this.isExplicit = true;
|
|
3601
|
+
this.asn1Object = null;
|
|
3602
|
+
this.setASN1Object = function(isExplicitFlag, tagNoHex, asn1Object) {
|
|
3603
|
+
this.hT = tagNoHex;
|
|
3604
|
+
this.isExplicit = isExplicitFlag;
|
|
3605
|
+
this.asn1Object = asn1Object;
|
|
3606
|
+
if (this.isExplicit) {
|
|
3607
|
+
this.hV = this.asn1Object.getEncodedHex();
|
|
3608
|
+
this.hTLV = null;
|
|
3609
|
+
this.isModified = true;
|
|
3610
|
+
} else {
|
|
3611
|
+
this.hV = null;
|
|
3612
|
+
this.hTLV = asn1Object.getEncodedHex();
|
|
3613
|
+
this.hTLV = this.hTLV.replace(/^../, tagNoHex);
|
|
3614
|
+
this.isModified = false;
|
|
3615
|
+
}
|
|
3616
|
+
};
|
|
3617
|
+
this.getFreshValueHex = function() {
|
|
3618
|
+
return this.hV;
|
|
3619
|
+
};
|
|
3620
|
+
if (typeof params != "undefined") {
|
|
3621
|
+
if (typeof params["tag"] != "undefined") {
|
|
3622
|
+
this.hT = params["tag"];
|
|
3623
|
+
}
|
|
3624
|
+
if (typeof params["explicit"] != "undefined") {
|
|
3625
|
+
this.isExplicit = params["explicit"];
|
|
3626
|
+
}
|
|
3627
|
+
if (typeof params["obj"] != "undefined") {
|
|
3628
|
+
this.asn1Object = params["obj"];
|
|
3629
|
+
this.setASN1Object(this.isExplicit, this.hT, this.asn1Object);
|
|
3630
|
+
}
|
|
3631
|
+
}
|
|
3632
|
+
};
|
|
3633
|
+
YAHOO.lang.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object);
|
|
3634
|
+
var __extends = globalThis && globalThis.__extends || function() {
|
|
3635
|
+
var extendStatics = function(d, b) {
|
|
3636
|
+
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
3637
|
+
d2.__proto__ = b2;
|
|
3638
|
+
} || function(d2, b2) {
|
|
3639
|
+
for (var p in b2)
|
|
3640
|
+
if (Object.prototype.hasOwnProperty.call(b2, p))
|
|
3641
|
+
d2[p] = b2[p];
|
|
3642
|
+
};
|
|
3643
|
+
return extendStatics(d, b);
|
|
3644
|
+
};
|
|
3645
|
+
return function(d, b) {
|
|
3646
|
+
if (typeof b !== "function" && b !== null)
|
|
3647
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
3648
|
+
extendStatics(d, b);
|
|
3649
|
+
function __() {
|
|
3650
|
+
this.constructor = d;
|
|
3651
|
+
}
|
|
3652
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
3653
|
+
};
|
|
3654
|
+
}();
|
|
3655
|
+
var JSEncryptRSAKey = (
|
|
3656
|
+
/** @class */
|
|
3657
|
+
function(_super) {
|
|
3658
|
+
__extends(JSEncryptRSAKey2, _super);
|
|
3659
|
+
function JSEncryptRSAKey2(key) {
|
|
3660
|
+
var _this = _super.call(this) || this;
|
|
3661
|
+
if (key) {
|
|
3662
|
+
if (typeof key === "string") {
|
|
3663
|
+
_this.parseKey(key);
|
|
3664
|
+
} else if (JSEncryptRSAKey2.hasPrivateKeyProperty(key) || JSEncryptRSAKey2.hasPublicKeyProperty(key)) {
|
|
3665
|
+
_this.parsePropertiesFrom(key);
|
|
3666
|
+
}
|
|
3667
|
+
}
|
|
3668
|
+
return _this;
|
|
3669
|
+
}
|
|
3670
|
+
JSEncryptRSAKey2.prototype.parseKey = function(pem) {
|
|
3671
|
+
try {
|
|
3672
|
+
var modulus = 0;
|
|
3673
|
+
var public_exponent = 0;
|
|
3674
|
+
var reHex = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/;
|
|
3675
|
+
var der = reHex.test(pem) ? Hex.decode(pem) : Base64.unarmor(pem);
|
|
3676
|
+
var asn1 = ASN1.decode(der);
|
|
3677
|
+
if (asn1.sub.length === 3) {
|
|
3678
|
+
asn1 = asn1.sub[2].sub[0];
|
|
3679
|
+
}
|
|
3680
|
+
if (asn1.sub.length === 9) {
|
|
3681
|
+
modulus = asn1.sub[1].getHexStringValue();
|
|
3682
|
+
this.n = parseBigInt(modulus, 16);
|
|
3683
|
+
public_exponent = asn1.sub[2].getHexStringValue();
|
|
3684
|
+
this.e = parseInt(public_exponent, 16);
|
|
3685
|
+
var private_exponent = asn1.sub[3].getHexStringValue();
|
|
3686
|
+
this.d = parseBigInt(private_exponent, 16);
|
|
3687
|
+
var prime1 = asn1.sub[4].getHexStringValue();
|
|
3688
|
+
this.p = parseBigInt(prime1, 16);
|
|
3689
|
+
var prime2 = asn1.sub[5].getHexStringValue();
|
|
3690
|
+
this.q = parseBigInt(prime2, 16);
|
|
3691
|
+
var exponent1 = asn1.sub[6].getHexStringValue();
|
|
3692
|
+
this.dmp1 = parseBigInt(exponent1, 16);
|
|
3693
|
+
var exponent2 = asn1.sub[7].getHexStringValue();
|
|
3694
|
+
this.dmq1 = parseBigInt(exponent2, 16);
|
|
3695
|
+
var coefficient = asn1.sub[8].getHexStringValue();
|
|
3696
|
+
this.coeff = parseBigInt(coefficient, 16);
|
|
3697
|
+
} else if (asn1.sub.length === 2) {
|
|
3698
|
+
if (asn1.sub[0].sub) {
|
|
3699
|
+
var bit_string = asn1.sub[1];
|
|
3700
|
+
var sequence = bit_string.sub[0];
|
|
3701
|
+
modulus = sequence.sub[0].getHexStringValue();
|
|
3702
|
+
this.n = parseBigInt(modulus, 16);
|
|
3703
|
+
public_exponent = sequence.sub[1].getHexStringValue();
|
|
3704
|
+
this.e = parseInt(public_exponent, 16);
|
|
3705
|
+
} else {
|
|
3706
|
+
modulus = asn1.sub[0].getHexStringValue();
|
|
3707
|
+
this.n = parseBigInt(modulus, 16);
|
|
3708
|
+
public_exponent = asn1.sub[1].getHexStringValue();
|
|
3709
|
+
this.e = parseInt(public_exponent, 16);
|
|
3710
|
+
}
|
|
3711
|
+
} else {
|
|
3712
|
+
return false;
|
|
3713
|
+
}
|
|
3714
|
+
return true;
|
|
3715
|
+
} catch (ex) {
|
|
3716
|
+
return false;
|
|
3717
|
+
}
|
|
3718
|
+
};
|
|
3719
|
+
JSEncryptRSAKey2.prototype.getPrivateBaseKey = function() {
|
|
3720
|
+
var options = {
|
|
3721
|
+
array: [
|
|
3722
|
+
new KJUR.asn1.DERInteger({ int: 0 }),
|
|
3723
|
+
new KJUR.asn1.DERInteger({ bigint: this.n }),
|
|
3724
|
+
new KJUR.asn1.DERInteger({ int: this.e }),
|
|
3725
|
+
new KJUR.asn1.DERInteger({ bigint: this.d }),
|
|
3726
|
+
new KJUR.asn1.DERInteger({ bigint: this.p }),
|
|
3727
|
+
new KJUR.asn1.DERInteger({ bigint: this.q }),
|
|
3728
|
+
new KJUR.asn1.DERInteger({ bigint: this.dmp1 }),
|
|
3729
|
+
new KJUR.asn1.DERInteger({ bigint: this.dmq1 }),
|
|
3730
|
+
new KJUR.asn1.DERInteger({ bigint: this.coeff })
|
|
3731
|
+
]
|
|
3732
|
+
};
|
|
3733
|
+
var seq = new KJUR.asn1.DERSequence(options);
|
|
3734
|
+
return seq.getEncodedHex();
|
|
3735
|
+
};
|
|
3736
|
+
JSEncryptRSAKey2.prototype.getPrivateBaseKeyB64 = function() {
|
|
3737
|
+
return hex2b64(this.getPrivateBaseKey());
|
|
3738
|
+
};
|
|
3739
|
+
JSEncryptRSAKey2.prototype.getPublicBaseKey = function() {
|
|
3740
|
+
var first_sequence = new KJUR.asn1.DERSequence({
|
|
3741
|
+
array: [
|
|
3742
|
+
new KJUR.asn1.DERObjectIdentifier({ oid: "1.2.840.113549.1.1.1" }),
|
|
3743
|
+
new KJUR.asn1.DERNull()
|
|
3744
|
+
]
|
|
3745
|
+
});
|
|
3746
|
+
var second_sequence = new KJUR.asn1.DERSequence({
|
|
3747
|
+
array: [
|
|
3748
|
+
new KJUR.asn1.DERInteger({ bigint: this.n }),
|
|
3749
|
+
new KJUR.asn1.DERInteger({ int: this.e })
|
|
3750
|
+
]
|
|
3751
|
+
});
|
|
3752
|
+
var bit_string = new KJUR.asn1.DERBitString({
|
|
3753
|
+
hex: "00" + second_sequence.getEncodedHex()
|
|
3754
|
+
});
|
|
3755
|
+
var seq = new KJUR.asn1.DERSequence({
|
|
3756
|
+
array: [first_sequence, bit_string]
|
|
3757
|
+
});
|
|
3758
|
+
return seq.getEncodedHex();
|
|
3759
|
+
};
|
|
3760
|
+
JSEncryptRSAKey2.prototype.getPublicBaseKeyB64 = function() {
|
|
3761
|
+
return hex2b64(this.getPublicBaseKey());
|
|
3762
|
+
};
|
|
3763
|
+
JSEncryptRSAKey2.wordwrap = function(str, width) {
|
|
3764
|
+
width = width || 64;
|
|
3765
|
+
if (!str) {
|
|
3766
|
+
return str;
|
|
3767
|
+
}
|
|
3768
|
+
var regex = "(.{1," + width + "})( +|$\n?)|(.{1," + width + "})";
|
|
3769
|
+
return str.match(RegExp(regex, "g")).join("\n");
|
|
3770
|
+
};
|
|
3771
|
+
JSEncryptRSAKey2.prototype.getPrivateKey = function() {
|
|
3772
|
+
var key = "-----BEGIN RSA PRIVATE KEY-----\n";
|
|
3773
|
+
key += JSEncryptRSAKey2.wordwrap(this.getPrivateBaseKeyB64()) + "\n";
|
|
3774
|
+
key += "-----END RSA PRIVATE KEY-----";
|
|
3775
|
+
return key;
|
|
3776
|
+
};
|
|
3777
|
+
JSEncryptRSAKey2.prototype.getPublicKey = function() {
|
|
3778
|
+
var key = "-----BEGIN PUBLIC KEY-----\n";
|
|
3779
|
+
key += JSEncryptRSAKey2.wordwrap(this.getPublicBaseKeyB64()) + "\n";
|
|
3780
|
+
key += "-----END PUBLIC KEY-----";
|
|
3781
|
+
return key;
|
|
3782
|
+
};
|
|
3783
|
+
JSEncryptRSAKey2.hasPublicKeyProperty = function(obj) {
|
|
3784
|
+
obj = obj || {};
|
|
3785
|
+
return obj.hasOwnProperty("n") && obj.hasOwnProperty("e");
|
|
3786
|
+
};
|
|
3787
|
+
JSEncryptRSAKey2.hasPrivateKeyProperty = function(obj) {
|
|
3788
|
+
obj = obj || {};
|
|
3789
|
+
return obj.hasOwnProperty("n") && obj.hasOwnProperty("e") && obj.hasOwnProperty("d") && obj.hasOwnProperty("p") && obj.hasOwnProperty("q") && obj.hasOwnProperty("dmp1") && obj.hasOwnProperty("dmq1") && obj.hasOwnProperty("coeff");
|
|
3790
|
+
};
|
|
3791
|
+
JSEncryptRSAKey2.prototype.parsePropertiesFrom = function(obj) {
|
|
3792
|
+
this.n = obj.n;
|
|
3793
|
+
this.e = obj.e;
|
|
3794
|
+
if (obj.hasOwnProperty("d")) {
|
|
3795
|
+
this.d = obj.d;
|
|
3796
|
+
this.p = obj.p;
|
|
3797
|
+
this.q = obj.q;
|
|
3798
|
+
this.dmp1 = obj.dmp1;
|
|
3799
|
+
this.dmq1 = obj.dmq1;
|
|
3800
|
+
this.coeff = obj.coeff;
|
|
3801
|
+
}
|
|
3802
|
+
};
|
|
3803
|
+
return JSEncryptRSAKey2;
|
|
3804
|
+
}(RSAKey)
|
|
3805
|
+
);
|
|
3806
|
+
var _a;
|
|
3807
|
+
var version = typeof process !== "undefined" ? (_a = process.env) === null || _a === void 0 ? void 0 : _a.npm_package_version : void 0;
|
|
3808
|
+
var JSEncrypt = (
|
|
3809
|
+
/** @class */
|
|
3810
|
+
function() {
|
|
3811
|
+
function JSEncrypt2(options) {
|
|
3812
|
+
if (options === void 0) {
|
|
3813
|
+
options = {};
|
|
3814
|
+
}
|
|
3815
|
+
options = options || {};
|
|
3816
|
+
this.default_key_size = options.default_key_size ? parseInt(options.default_key_size, 10) : 1024;
|
|
3817
|
+
this.default_public_exponent = options.default_public_exponent || "010001";
|
|
3818
|
+
this.log = options.log || false;
|
|
3819
|
+
this.key = null;
|
|
3820
|
+
}
|
|
3821
|
+
JSEncrypt2.prototype.setKey = function(key) {
|
|
3822
|
+
if (this.log && this.key) {
|
|
3823
|
+
console.warn("A key was already set, overriding existing.");
|
|
3824
|
+
}
|
|
3825
|
+
this.key = new JSEncryptRSAKey(key);
|
|
3826
|
+
};
|
|
3827
|
+
JSEncrypt2.prototype.setPrivateKey = function(privkey) {
|
|
3828
|
+
this.setKey(privkey);
|
|
3829
|
+
};
|
|
3830
|
+
JSEncrypt2.prototype.setPublicKey = function(pubkey) {
|
|
3831
|
+
this.setKey(pubkey);
|
|
3832
|
+
};
|
|
3833
|
+
JSEncrypt2.prototype.decrypt = function(str) {
|
|
3834
|
+
try {
|
|
3835
|
+
return this.getKey().decrypt(b64tohex(str));
|
|
3836
|
+
} catch (ex) {
|
|
3837
|
+
return false;
|
|
3838
|
+
}
|
|
3839
|
+
};
|
|
3840
|
+
JSEncrypt2.prototype.encrypt = function(str) {
|
|
3841
|
+
try {
|
|
3842
|
+
return hex2b64(this.getKey().encrypt(str));
|
|
3843
|
+
} catch (ex) {
|
|
3844
|
+
return false;
|
|
3845
|
+
}
|
|
3846
|
+
};
|
|
3847
|
+
JSEncrypt2.prototype.sign = function(str, digestMethod, digestName) {
|
|
3848
|
+
try {
|
|
3849
|
+
return hex2b64(this.getKey().sign(str, digestMethod, digestName));
|
|
3850
|
+
} catch (ex) {
|
|
3851
|
+
return false;
|
|
3852
|
+
}
|
|
3853
|
+
};
|
|
3854
|
+
JSEncrypt2.prototype.verify = function(str, signature, digestMethod) {
|
|
3855
|
+
try {
|
|
3856
|
+
return this.getKey().verify(str, b64tohex(signature), digestMethod);
|
|
3857
|
+
} catch (ex) {
|
|
3858
|
+
return false;
|
|
3859
|
+
}
|
|
3860
|
+
};
|
|
3861
|
+
JSEncrypt2.prototype.getKey = function(cb) {
|
|
3862
|
+
if (!this.key) {
|
|
3863
|
+
this.key = new JSEncryptRSAKey();
|
|
3864
|
+
if (cb && {}.toString.call(cb) === "[object Function]") {
|
|
3865
|
+
this.key.generateAsync(this.default_key_size, this.default_public_exponent, cb);
|
|
3866
|
+
return;
|
|
3867
|
+
}
|
|
3868
|
+
this.key.generate(this.default_key_size, this.default_public_exponent);
|
|
3869
|
+
}
|
|
3870
|
+
return this.key;
|
|
3871
|
+
};
|
|
3872
|
+
JSEncrypt2.prototype.getPrivateKey = function() {
|
|
3873
|
+
return this.getKey().getPrivateKey();
|
|
3874
|
+
};
|
|
3875
|
+
JSEncrypt2.prototype.getPrivateKeyB64 = function() {
|
|
3876
|
+
return this.getKey().getPrivateBaseKeyB64();
|
|
3877
|
+
};
|
|
3878
|
+
JSEncrypt2.prototype.getPublicKey = function() {
|
|
3879
|
+
return this.getKey().getPublicKey();
|
|
3880
|
+
};
|
|
3881
|
+
JSEncrypt2.prototype.getPublicKeyB64 = function() {
|
|
3882
|
+
return this.getKey().getPublicBaseKeyB64();
|
|
3883
|
+
};
|
|
3884
|
+
JSEncrypt2.version = version;
|
|
3885
|
+
return JSEncrypt2;
|
|
3886
|
+
}()
|
|
3887
|
+
);
|
|
3888
|
+
class RSAHelper {
|
|
3889
|
+
constructor() {
|
|
3890
|
+
this.myKey = "";
|
|
3891
|
+
this.type = "";
|
|
3892
|
+
this.url = "/IoT/api/v3/auth/getString";
|
|
3893
|
+
}
|
|
3894
|
+
/**
|
|
3895
|
+
* @description 获取RSA加密密钥
|
|
3896
|
+
*/
|
|
3897
|
+
getPublic() {
|
|
3898
|
+
const ajax = new XMLHttpRequest();
|
|
3899
|
+
ajax.onreadystatechange = () => {
|
|
3900
|
+
if (ajax.readyState == 4 && ajax.status == 200) {
|
|
3901
|
+
let datas = JSON.parse(ajax.responseText);
|
|
3902
|
+
if (datas.data.cipher) {
|
|
3903
|
+
this.myKey = decodeURIComponent(datas.data.cipher);
|
|
3904
|
+
this.type = datas.data.padding;
|
|
3905
|
+
} else {
|
|
3906
|
+
this.myKey = decodeURIComponent(datas.data);
|
|
3907
|
+
}
|
|
3908
|
+
}
|
|
3909
|
+
};
|
|
3910
|
+
ajax.open("get", this.url, false);
|
|
3911
|
+
ajax.send();
|
|
3912
|
+
}
|
|
3913
|
+
/**
|
|
3914
|
+
* @description RSA加密
|
|
3915
|
+
* @param {string} dataString
|
|
3916
|
+
* @return {Promise<string>} 加密结果
|
|
3917
|
+
*/
|
|
3918
|
+
async RSAEncrypt(dataString) {
|
|
3919
|
+
if (this.myKey === "") {
|
|
3920
|
+
this.getPublic();
|
|
3921
|
+
}
|
|
3922
|
+
let RSAData = "";
|
|
3923
|
+
if (!this.type || this.type == "pkcs1") {
|
|
3924
|
+
RSAData = this.RSAEncryptOne(dataString);
|
|
3925
|
+
} else {
|
|
3926
|
+
RSAData = await this.newEncrypt(dataString);
|
|
3927
|
+
}
|
|
3928
|
+
return RSAData;
|
|
3929
|
+
}
|
|
3930
|
+
/**
|
|
3931
|
+
* @description 默认密钥格式 `pkcs1` 时调用
|
|
3932
|
+
* @param {string} dataString
|
|
3933
|
+
* @return {string} 加密数据
|
|
3934
|
+
*/
|
|
3935
|
+
RSAEncryptOne(dataString) {
|
|
3936
|
+
let encrypt = new JSEncrypt();
|
|
3937
|
+
encrypt.setPublicKey(this.myKey);
|
|
3938
|
+
let data = encrypt.encrypt(dataString) || "";
|
|
3939
|
+
return data;
|
|
3940
|
+
}
|
|
3941
|
+
/**
|
|
3942
|
+
* @description 密钥格式为 `OAEP-256` 时调用
|
|
3943
|
+
* @param {*} dataString
|
|
3944
|
+
* @return {Promise<string>} 加密数据
|
|
3945
|
+
*/
|
|
3946
|
+
async newEncrypt(dataString) {
|
|
3947
|
+
let cryptoKey = await this.getCryptoKey(this.myKey);
|
|
3948
|
+
let RSAData = await this.cryptoEncrypt(cryptoKey, dataString);
|
|
3949
|
+
return RSAData;
|
|
3950
|
+
}
|
|
3951
|
+
/**
|
|
3952
|
+
* @description 将密钥字符串转化为 `CryptoKey` 对象
|
|
3953
|
+
* @param {*} publicKey
|
|
3954
|
+
* @return {CryptoKey} CryptoKey
|
|
3955
|
+
*/
|
|
3956
|
+
async getCryptoKey(publicKey) {
|
|
3957
|
+
let crypto = window.crypto;
|
|
3958
|
+
return crypto.subtle.importKey(
|
|
3959
|
+
"jwk",
|
|
3960
|
+
{
|
|
3961
|
+
kty: "RSA",
|
|
3962
|
+
e: "AQAB",
|
|
3963
|
+
n: publicKey,
|
|
3964
|
+
alg: "RSA-OAEP-256",
|
|
3965
|
+
ext: true
|
|
3966
|
+
},
|
|
3967
|
+
{
|
|
3968
|
+
name: "RSA-OAEP",
|
|
3969
|
+
hash: { name: "SHA-256" }
|
|
3970
|
+
},
|
|
3971
|
+
false,
|
|
3972
|
+
["encrypt"]
|
|
3973
|
+
).then((publicKey2) => {
|
|
3974
|
+
return publicKey2;
|
|
3975
|
+
});
|
|
3976
|
+
}
|
|
3977
|
+
/**
|
|
3978
|
+
* @description crypto `RSA-OAEP-256` 加密
|
|
3979
|
+
* @param {*} cryptoKey 密钥
|
|
3980
|
+
* @param {*} dataString 原文
|
|
3981
|
+
* @return {Promise<string>}
|
|
3982
|
+
*/
|
|
3983
|
+
async cryptoEncrypt(cryptoKey, dataString) {
|
|
3984
|
+
let crypto = window.crypto || window.webkitCrypto || window.mozCrypto || window.oCrypto || window.msCrypto;
|
|
3985
|
+
return crypto.subtle.encrypt(
|
|
3986
|
+
{
|
|
3987
|
+
name: "RSA-OAEP"
|
|
3988
|
+
},
|
|
3989
|
+
cryptoKey,
|
|
3990
|
+
new Uint8Array(this.StringToByte(dataString))
|
|
3991
|
+
).then((encrypted) => {
|
|
3992
|
+
return this.uint8ArrayToBase64(new Uint8Array(encrypted));
|
|
3993
|
+
});
|
|
3994
|
+
}
|
|
3995
|
+
// 字符串转换为字节数组
|
|
3996
|
+
StringToByte(str) {
|
|
3997
|
+
var utf8 = unescape(encodeURIComponent(str));
|
|
3998
|
+
var arr = [];
|
|
3999
|
+
for (var i = 0; i < utf8.length; i++) {
|
|
4000
|
+
arr.push(utf8.charCodeAt(i));
|
|
4001
|
+
}
|
|
4002
|
+
return arr;
|
|
4003
|
+
}
|
|
4004
|
+
uint8ArrayToBase64(data) {
|
|
4005
|
+
return window.btoa(Array.from(data).map((c) => String.fromCharCode(c)).join(""));
|
|
4006
|
+
}
|
|
4007
|
+
}
|
|
4008
|
+
const RSAHelper$1 = new RSAHelper();
|
|
4009
|
+
const createAxios = function(app) {
|
|
4010
|
+
const axiosBuilder = new AxiosBuilder(app);
|
|
4011
|
+
app.config.globalProperties.Axios = axiosBuilder;
|
|
4012
|
+
createAxios.instance = axiosBuilder.instance;
|
|
4013
|
+
if (!window.gw_app_api) {
|
|
4014
|
+
window.gw_app_api = {
|
|
4015
|
+
createAxios
|
|
4016
|
+
};
|
|
4017
|
+
}
|
|
4018
|
+
};
|
|
4019
|
+
exports.createAxios = createAxios;
|
|
4020
|
+
exports.getCode = RSAHelper$1;
|
|
4021
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4022
|
+
return exports;
|
|
4023
|
+
}({}, axios);
|
|
4024
|
+
//# sourceMappingURL=gw_app_api.iife.js.map
|