pi-codex-auto-review 0.1.0

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.
Files changed (1057) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +10 -0
  3. package/README.md +77 -0
  4. package/dist/approvals.d.ts +72 -0
  5. package/dist/approvals.js +167 -0
  6. package/dist/approvals.js.map +1 -0
  7. package/dist/audit.d.ts +28 -0
  8. package/dist/audit.js +40 -0
  9. package/dist/audit.js.map +1 -0
  10. package/dist/cli.d.ts +2 -0
  11. package/dist/cli.js +70 -0
  12. package/dist/cli.js.map +1 -0
  13. package/dist/context-files.d.ts +14 -0
  14. package/dist/context-files.js +113 -0
  15. package/dist/context-files.js.map +1 -0
  16. package/dist/contracts.d.ts +258 -0
  17. package/dist/contracts.js +102 -0
  18. package/dist/contracts.js.map +1 -0
  19. package/dist/index.d.ts +28 -0
  20. package/dist/index.js +106 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/native/darwin-arm64/artifact.json +5 -0
  23. package/dist/native/darwin-arm64/pi-guard-execpolicy +0 -0
  24. package/dist/native/linux-x64/artifact.json +5 -0
  25. package/dist/native/linux-x64/pi-guard-execpolicy +0 -0
  26. package/dist/policy/domains.d.ts +5 -0
  27. package/dist/policy/domains.js +18 -0
  28. package/dist/policy/domains.js.map +1 -0
  29. package/dist/policy/index.d.ts +56 -0
  30. package/dist/policy/index.js +304 -0
  31. package/dist/policy/index.js.map +1 -0
  32. package/dist/policy/paths.d.ts +5 -0
  33. package/dist/policy/paths.js +54 -0
  34. package/dist/policy/paths.js.map +1 -0
  35. package/dist/policy/rules.d.ts +36 -0
  36. package/dist/policy/rules.js +61 -0
  37. package/dist/policy/rules.js.map +1 -0
  38. package/dist/policy/shell.d.ts +14 -0
  39. package/dist/policy/shell.js +122 -0
  40. package/dist/policy/shell.js.map +1 -0
  41. package/dist/reports.d.ts +21 -0
  42. package/dist/reports.js +42 -0
  43. package/dist/reports.js.map +1 -0
  44. package/dist/review/context.d.ts +25 -0
  45. package/dist/review/context.js +108 -0
  46. package/dist/review/context.js.map +1 -0
  47. package/dist/review/investigation.d.ts +39 -0
  48. package/dist/review/investigation.js +36 -0
  49. package/dist/review/investigation.js.map +1 -0
  50. package/dist/review/lifecycle.d.ts +29 -0
  51. package/dist/review/lifecycle.js +71 -0
  52. package/dist/review/lifecycle.js.map +1 -0
  53. package/dist/review/policy.d.ts +4 -0
  54. package/dist/review/policy.js +15 -0
  55. package/dist/review/policy.js.map +1 -0
  56. package/dist/review/upstream-policy.d.ts +2 -0
  57. package/dist/review/upstream-policy.js +210 -0
  58. package/dist/review/upstream-policy.js.map +1 -0
  59. package/dist/reviewer.d.ts +45 -0
  60. package/dist/reviewer.js +148 -0
  61. package/dist/reviewer.js.map +1 -0
  62. package/dist/sandbox/broker.d.ts +1 -0
  63. package/dist/sandbox/broker.js +135 -0
  64. package/dist/sandbox/broker.js.map +1 -0
  65. package/dist/sandbox/config.d.ts +5 -0
  66. package/dist/sandbox/config.js +91 -0
  67. package/dist/sandbox/config.js.map +1 -0
  68. package/dist/sandbox/executor.d.ts +20 -0
  69. package/dist/sandbox/executor.js +144 -0
  70. package/dist/sandbox/executor.js.map +1 -0
  71. package/dist/sandbox/hard-links.d.ts +4 -0
  72. package/dist/sandbox/hard-links.js +145 -0
  73. package/dist/sandbox/hard-links.js.map +1 -0
  74. package/dist/sandbox/linux-read-paths.d.ts +7 -0
  75. package/dist/sandbox/linux-read-paths.js +47 -0
  76. package/dist/sandbox/linux-read-paths.js.map +1 -0
  77. package/dist/sandbox/paths.d.ts +3 -0
  78. package/dist/sandbox/paths.js +10 -0
  79. package/dist/sandbox/paths.js.map +1 -0
  80. package/dist/sandbox/runtime-write-paths.d.ts +2 -0
  81. package/dist/sandbox/runtime-write-paths.js +8 -0
  82. package/dist/sandbox/runtime-write-paths.js.map +1 -0
  83. package/dist/sandbox/seccomp.d.ts +5 -0
  84. package/dist/sandbox/seccomp.js +16 -0
  85. package/dist/sandbox/seccomp.js.map +1 -0
  86. package/dist/sandbox/worker.d.ts +1 -0
  87. package/dist/sandbox/worker.js +73 -0
  88. package/dist/sandbox/worker.js.map +1 -0
  89. package/dist/signals.d.ts +10 -0
  90. package/dist/signals.js +21 -0
  91. package/dist/signals.js.map +1 -0
  92. package/dist/startup.d.ts +22 -0
  93. package/dist/startup.js +100 -0
  94. package/dist/startup.js.map +1 -0
  95. package/dist/tools/controller.d.ts +63 -0
  96. package/dist/tools/controller.js +286 -0
  97. package/dist/tools/controller.js.map +1 -0
  98. package/dist/tools/external.d.ts +30 -0
  99. package/dist/tools/external.js +24 -0
  100. package/dist/tools/external.js.map +1 -0
  101. package/dist/tools/mcp.d.ts +17 -0
  102. package/dist/tools/mcp.js +186 -0
  103. package/dist/tools/mcp.js.map +1 -0
  104. package/docs/publishing.md +73 -0
  105. package/docs/security/dependencies.md +43 -0
  106. package/docs/testing/auto-review-protection.md +130 -0
  107. package/docs/usage.md +217 -0
  108. package/native/execpolicy/LICENSE +201 -0
  109. package/native/execpolicy/NOTICE +6 -0
  110. package/node_modules/@anthropic-ai/sandbox-runtime/LICENSE +201 -0
  111. package/node_modules/@anthropic-ai/sandbox-runtime/README.md +901 -0
  112. package/node_modules/@anthropic-ai/sandbox-runtime/dist/cli.d.ts +3 -0
  113. package/node_modules/@anthropic-ai/sandbox-runtime/dist/cli.d.ts.map +1 -0
  114. package/node_modules/@anthropic-ai/sandbox-runtime/dist/cli.js +472 -0
  115. package/node_modules/@anthropic-ai/sandbox-runtime/dist/cli.js.map +1 -0
  116. package/node_modules/@anthropic-ai/sandbox-runtime/dist/index.d.ts +19 -0
  117. package/node_modules/@anthropic-ai/sandbox-runtime/dist/index.d.ts.map +1 -0
  118. package/node_modules/@anthropic-ai/sandbox-runtime/dist/index.js +17 -0
  119. package/node_modules/@anthropic-ai/sandbox-runtime/dist/index.js.map +1 -0
  120. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/address.d.ts +52 -0
  121. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/address.d.ts.map +1 -0
  122. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/address.js +153 -0
  123. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/address.js.map +1 -0
  124. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/aws-sigv4.d.ts +164 -0
  125. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/aws-sigv4.d.ts.map +1 -0
  126. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/aws-sigv4.js +246 -0
  127. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/aws-sigv4.js.map +1 -0
  128. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/body-substitution.d.ts +58 -0
  129. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/body-substitution.d.ts.map +1 -0
  130. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/body-substitution.js +128 -0
  131. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/body-substitution.js.map +1 -0
  132. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-aws-pairs.d.ts +124 -0
  133. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-aws-pairs.d.ts.map +1 -0
  134. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-aws-pairs.js +258 -0
  135. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-aws-pairs.js.map +1 -0
  136. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-decode.d.ts +87 -0
  137. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-decode.d.ts.map +1 -0
  138. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-decode.js +138 -0
  139. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-decode.js.map +1 -0
  140. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-extract.d.ts +67 -0
  141. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-extract.d.ts.map +1 -0
  142. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-extract.js +113 -0
  143. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-extract.js.map +1 -0
  144. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-mask-env.d.ts +70 -0
  145. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-mask-env.d.ts.map +1 -0
  146. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-mask-env.js +171 -0
  147. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-mask-env.js.map +1 -0
  148. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-mask-files.d.ts +120 -0
  149. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-mask-files.d.ts.map +1 -0
  150. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-mask-files.js +281 -0
  151. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-mask-files.js.map +1 -0
  152. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-sentinel.d.ts +108 -0
  153. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-sentinel.d.ts.map +1 -0
  154. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-sentinel.js +208 -0
  155. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-sentinel.js.map +1 -0
  156. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/domain-pattern.d.ts +82 -0
  157. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/domain-pattern.d.ts.map +1 -0
  158. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/domain-pattern.js +155 -0
  159. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/domain-pattern.js.map +1 -0
  160. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/generate-seccomp-filter.d.ts +44 -0
  161. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/generate-seccomp-filter.d.ts.map +1 -0
  162. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/generate-seccomp-filter.js +220 -0
  163. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/generate-seccomp-filter.js.map +1 -0
  164. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/http-proxy.d.ts +150 -0
  165. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/http-proxy.d.ts.map +1 -0
  166. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/http-proxy.js +678 -0
  167. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/http-proxy.js.map +1 -0
  168. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/java-proxy-agent.d.ts +32 -0
  169. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/java-proxy-agent.d.ts.map +1 -0
  170. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/java-proxy-agent.js +111 -0
  171. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/java-proxy-agent.js.map +1 -0
  172. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/linux-sandbox-utils.d.ts +305 -0
  173. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/linux-sandbox-utils.d.ts.map +1 -0
  174. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/linux-sandbox-utils.js +2605 -0
  175. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/linux-sandbox-utils.js.map +1 -0
  176. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/linux-violation-monitor.d.ts +55 -0
  177. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/linux-violation-monitor.d.ts.map +1 -0
  178. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/linux-violation-monitor.js +152 -0
  179. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/linux-violation-monitor.js.map +1 -0
  180. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/listen-in-range.d.ts +12 -0
  181. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/listen-in-range.d.ts.map +1 -0
  182. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/listen-in-range.js +43 -0
  183. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/listen-in-range.js.map +1 -0
  184. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/macos-sandbox-utils.d.ts +116 -0
  185. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/macos-sandbox-utils.d.ts.map +1 -0
  186. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/macos-sandbox-utils.js +1195 -0
  187. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/macos-sandbox-utils.js.map +1 -0
  188. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-ca.d.ts +200 -0
  189. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-ca.d.ts.map +1 -0
  190. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-ca.js +443 -0
  191. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-ca.js.map +1 -0
  192. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-leaf.d.ts +28 -0
  193. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-leaf.d.ts.map +1 -0
  194. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-leaf.js +114 -0
  195. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-leaf.js.map +1 -0
  196. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mux-proxy.d.ts +59 -0
  197. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mux-proxy.d.ts.map +1 -0
  198. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mux-proxy.js +159 -0
  199. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mux-proxy.js.map +1 -0
  200. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/parent-proxy.d.ts +147 -0
  201. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/parent-proxy.d.ts.map +1 -0
  202. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/parent-proxy.js +445 -0
  203. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/parent-proxy.js.map +1 -0
  204. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/read-deny-glob.d.ts +17 -0
  205. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/read-deny-glob.d.ts.map +1 -0
  206. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/read-deny-glob.js +163 -0
  207. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/read-deny-glob.js.map +1 -0
  208. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/request-filter.d.ts +83 -0
  209. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/request-filter.d.ts.map +1 -0
  210. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/request-filter.js +212 -0
  211. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/request-filter.js.map +1 -0
  212. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/resolved-address-guard.d.ts +76 -0
  213. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/resolved-address-guard.d.ts.map +1 -0
  214. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/resolved-address-guard.js +221 -0
  215. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/resolved-address-guard.js.map +1 -0
  216. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-config.d.ts +1691 -0
  217. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-config.d.ts.map +1 -0
  218. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-config.js +1233 -0
  219. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-config.js.map +1 -0
  220. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-manager.d.ts +97 -0
  221. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-manager.d.ts.map +1 -0
  222. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-manager.js +1937 -0
  223. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-manager.js.map +1 -0
  224. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-schemas.d.ts +113 -0
  225. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-schemas.d.ts.map +1 -0
  226. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-schemas.js +3 -0
  227. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-schemas.js.map +1 -0
  228. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-utils.d.ts +411 -0
  229. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-utils.d.ts.map +1 -0
  230. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-utils.js +1408 -0
  231. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-utils.js.map +1 -0
  232. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-violation-store.d.ts +37 -0
  233. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-violation-store.d.ts.map +1 -0
  234. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-violation-store.js +125 -0
  235. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-violation-store.js.map +1 -0
  236. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/socks-proxy.d.ts +57 -0
  237. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/socks-proxy.d.ts.map +1 -0
  238. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/socks-proxy.js +332 -0
  239. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/socks-proxy.js.map +1 -0
  240. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/tls-terminate-proxy.d.ts +100 -0
  241. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/tls-terminate-proxy.d.ts.map +1 -0
  242. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/tls-terminate-proxy.js +546 -0
  243. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/tls-terminate-proxy.js.map +1 -0
  244. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/windows-sandbox-utils.d.ts +923 -0
  245. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/windows-sandbox-utils.d.ts.map +1 -0
  246. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/windows-sandbox-utils.js +1419 -0
  247. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/windows-sandbox-utils.js.map +1 -0
  248. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/config-loader.d.ts +31 -0
  249. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/config-loader.d.ts.map +1 -0
  250. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/config-loader.js +69 -0
  251. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/config-loader.js.map +1 -0
  252. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/debug.d.ts +7 -0
  253. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/debug.d.ts.map +1 -0
  254. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/debug.js +25 -0
  255. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/debug.js.map +1 -0
  256. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/platform.d.ts +15 -0
  257. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/platform.d.ts.map +1 -0
  258. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/platform.js +49 -0
  259. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/platform.js.map +1 -0
  260. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/ripgrep.d.ts +17 -0
  261. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/ripgrep.d.ts.map +1 -0
  262. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/ripgrep.js +37 -0
  263. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/ripgrep.js.map +1 -0
  264. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/shell-quote.d.ts +27 -0
  265. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/shell-quote.d.ts.map +1 -0
  266. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/shell-quote.js +47 -0
  267. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/shell-quote.js.map +1 -0
  268. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/which.d.ts +9 -0
  269. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/which.d.ts.map +1 -0
  270. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/which.js +25 -0
  271. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/which.js.map +1 -0
  272. package/node_modules/@anthropic-ai/sandbox-runtime/package.json +88 -0
  273. package/node_modules/@anthropic-ai/sandbox-runtime/vendor/java-proxy-agent/build.ts +95 -0
  274. package/node_modules/@anthropic-ai/sandbox-runtime/vendor/java-proxy-agent/srt-proxy-agent.jar +0 -0
  275. package/node_modules/@anthropic-ai/sandbox-runtime/vendor/seccomp/arm64/apply-seccomp +0 -0
  276. package/node_modules/@anthropic-ai/sandbox-runtime/vendor/seccomp/build.ts +69 -0
  277. package/node_modules/@anthropic-ai/sandbox-runtime/vendor/seccomp/x64/apply-seccomp +0 -0
  278. package/node_modules/@anthropic-ai/sandbox-runtime/vendor/srt-win/arm64/srt-win.exe +0 -0
  279. package/node_modules/@anthropic-ai/sandbox-runtime/vendor/srt-win/build.ts +28 -0
  280. package/node_modules/@anthropic-ai/sandbox-runtime/vendor/srt-win/x64/srt-win.exe +0 -0
  281. package/node_modules/@pondwader/socks5-server/.github/workflows/ci.yml +27 -0
  282. package/node_modules/@pondwader/socks5-server/LICENSE +20 -0
  283. package/node_modules/@pondwader/socks5-server/README.md +151 -0
  284. package/node_modules/@pondwader/socks5-server/dist/index.d.mts +87 -0
  285. package/node_modules/@pondwader/socks5-server/dist/index.d.ts +87 -0
  286. package/node_modules/@pondwader/socks5-server/dist/index.js +346 -0
  287. package/node_modules/@pondwader/socks5-server/dist/index.mjs +307 -0
  288. package/node_modules/@pondwader/socks5-server/package.json +31 -0
  289. package/node_modules/commander/LICENSE +22 -0
  290. package/node_modules/commander/Readme.md +1157 -0
  291. package/node_modules/commander/esm.mjs +16 -0
  292. package/node_modules/commander/index.js +24 -0
  293. package/node_modules/commander/lib/argument.js +149 -0
  294. package/node_modules/commander/lib/command.js +2509 -0
  295. package/node_modules/commander/lib/error.js +39 -0
  296. package/node_modules/commander/lib/help.js +520 -0
  297. package/node_modules/commander/lib/option.js +330 -0
  298. package/node_modules/commander/lib/suggestSimilar.js +101 -0
  299. package/node_modules/commander/package-support.json +16 -0
  300. package/node_modules/commander/package.json +84 -0
  301. package/node_modules/commander/typings/esm.d.mts +3 -0
  302. package/node_modules/commander/typings/index.d.ts +969 -0
  303. package/node_modules/node-forge/.editorconfig +17 -0
  304. package/node_modules/node-forge/.eslintrc.js +24 -0
  305. package/node_modules/node-forge/.github/workflows/main.yaml +96 -0
  306. package/node_modules/node-forge/.istanbul.yml +2 -0
  307. package/node_modules/node-forge/.npmignore +15 -0
  308. package/node_modules/node-forge/CHANGELOG.md +555 -0
  309. package/node_modules/node-forge/CONTRIBUTING.md +18 -0
  310. package/node_modules/node-forge/LICENSE +331 -0
  311. package/node_modules/node-forge/README.md +2071 -0
  312. package/node_modules/node-forge/RELEASE.md +19 -0
  313. package/node_modules/node-forge/SECURITY.md +5 -0
  314. package/node_modules/node-forge/examples/create-cert.js +110 -0
  315. package/node_modules/node-forge/examples/create-csr.js +66 -0
  316. package/node_modules/node-forge/examples/create-pkcs12.js +160 -0
  317. package/node_modules/node-forge/examples/imap.js +46 -0
  318. package/node_modules/node-forge/examples/sign-p7.js +115 -0
  319. package/node_modules/node-forge/examples/tls.js +189 -0
  320. package/node_modules/node-forge/flash/PooledSocket.as +18 -0
  321. package/node_modules/node-forge/flash/README.md +48 -0
  322. package/node_modules/node-forge/flash/SocketEvent.as +36 -0
  323. package/node_modules/node-forge/flash/SocketPool.as +754 -0
  324. package/node_modules/node-forge/flash/mod_fsp/README +135 -0
  325. package/node_modules/node-forge/flash/mod_fsp/mod_fsp.c +415 -0
  326. package/node_modules/node-forge/flash/package.json +28 -0
  327. package/node_modules/node-forge/flash/policyserver.js +65 -0
  328. package/node_modules/node-forge/flash/policyserver.py +112 -0
  329. package/node_modules/node-forge/flash/swf/SocketPool.swf +0 -0
  330. package/node_modules/node-forge/karma-sauce.conf.js +79 -0
  331. package/node_modules/node-forge/karma.conf.js +133 -0
  332. package/node_modules/node-forge/lib/aes.js +1091 -0
  333. package/node_modules/node-forge/lib/aesCipherSuites.js +282 -0
  334. package/node_modules/node-forge/lib/asn1-validator.js +91 -0
  335. package/node_modules/node-forge/lib/asn1.js +1503 -0
  336. package/node_modules/node-forge/lib/baseN.js +186 -0
  337. package/node_modules/node-forge/lib/cipher.js +230 -0
  338. package/node_modules/node-forge/lib/cipherModes.js +999 -0
  339. package/node_modules/node-forge/lib/des.js +496 -0
  340. package/node_modules/node-forge/lib/ed25519.js +1091 -0
  341. package/node_modules/node-forge/lib/forge.js +13 -0
  342. package/node_modules/node-forge/lib/form.js +149 -0
  343. package/node_modules/node-forge/lib/hmac.js +146 -0
  344. package/node_modules/node-forge/lib/http.js +1346 -0
  345. package/node_modules/node-forge/lib/index.all.js +16 -0
  346. package/node_modules/node-forge/lib/index.js +33 -0
  347. package/node_modules/node-forge/lib/jsbn.js +1294 -0
  348. package/node_modules/node-forge/lib/kem.js +168 -0
  349. package/node_modules/node-forge/lib/log.js +319 -0
  350. package/node_modules/node-forge/lib/md.all.js +13 -0
  351. package/node_modules/node-forge/lib/md.js +11 -0
  352. package/node_modules/node-forge/lib/md5.js +289 -0
  353. package/node_modules/node-forge/lib/mgf.js +12 -0
  354. package/node_modules/node-forge/lib/mgf1.js +57 -0
  355. package/node_modules/node-forge/lib/oids.js +180 -0
  356. package/node_modules/node-forge/lib/pbe.js +1023 -0
  357. package/node_modules/node-forge/lib/pbkdf2.js +211 -0
  358. package/node_modules/node-forge/lib/pem.js +237 -0
  359. package/node_modules/node-forge/lib/pkcs1.js +276 -0
  360. package/node_modules/node-forge/lib/pkcs12.js +1078 -0
  361. package/node_modules/node-forge/lib/pkcs7.js +1260 -0
  362. package/node_modules/node-forge/lib/pkcs7asn1.js +410 -0
  363. package/node_modules/node-forge/lib/pki.js +102 -0
  364. package/node_modules/node-forge/lib/prime.js +297 -0
  365. package/node_modules/node-forge/lib/prime.worker.js +168 -0
  366. package/node_modules/node-forge/lib/prng.js +419 -0
  367. package/node_modules/node-forge/lib/pss.js +241 -0
  368. package/node_modules/node-forge/lib/random.js +191 -0
  369. package/node_modules/node-forge/lib/rc2.js +410 -0
  370. package/node_modules/node-forge/lib/rsa.js +1973 -0
  371. package/node_modules/node-forge/lib/sha1.js +319 -0
  372. package/node_modules/node-forge/lib/sha256.js +327 -0
  373. package/node_modules/node-forge/lib/sha512.js +561 -0
  374. package/node_modules/node-forge/lib/socket.js +287 -0
  375. package/node_modules/node-forge/lib/ssh.js +236 -0
  376. package/node_modules/node-forge/lib/tls.js +4282 -0
  377. package/node_modules/node-forge/lib/tlssocket.js +249 -0
  378. package/node_modules/node-forge/lib/util.js +2652 -0
  379. package/node_modules/node-forge/lib/x509.js +3251 -0
  380. package/node_modules/node-forge/lib/xhr.js +738 -0
  381. package/node_modules/node-forge/package.json +123 -0
  382. package/node_modules/node-forge/tests/.eslintrc.js +5 -0
  383. package/node_modules/node-forge/tests/README.md +4 -0
  384. package/node_modules/node-forge/tests/benchmarks/aes-speed.js +62 -0
  385. package/node_modules/node-forge/tests/benchmarks/so-44303784.js +246 -0
  386. package/node_modules/node-forge/tests/flash/README.md +7 -0
  387. package/node_modules/node-forge/tests/flash/Test.as +96 -0
  388. package/node_modules/node-forge/tests/flash/build-flash.xml +7 -0
  389. package/node_modules/node-forge/tests/flash/index.html +28 -0
  390. package/node_modules/node-forge/tests/index.html +33 -0
  391. package/node_modules/node-forge/tests/issues/heartbleed.js +55 -0
  392. package/node_modules/node-forge/tests/issues/issue-428.html +95 -0
  393. package/node_modules/node-forge/tests/issues/issue-428.js +375 -0
  394. package/node_modules/node-forge/tests/karma/index.js +8 -0
  395. package/node_modules/node-forge/tests/karma/testWorker.js +65 -0
  396. package/node_modules/node-forge/tests/karma/web-worker-rsa.js +55 -0
  397. package/node_modules/node-forge/tests/legacy/common.html +65 -0
  398. package/node_modules/node-forge/tests/legacy/common.js +2199 -0
  399. package/node_modules/node-forge/tests/legacy/form.html +148 -0
  400. package/node_modules/node-forge/tests/legacy/form.js +40 -0
  401. package/node_modules/node-forge/tests/legacy/http.html +235 -0
  402. package/node_modules/node-forge/tests/legacy/index.html +70 -0
  403. package/node_modules/node-forge/tests/legacy/keygen.html +113 -0
  404. package/node_modules/node-forge/tests/legacy/login.css +26 -0
  405. package/node_modules/node-forge/tests/legacy/loginDemo.html +32 -0
  406. package/node_modules/node-forge/tests/legacy/loginDemo.js +149 -0
  407. package/node_modules/node-forge/tests/legacy/performance.html +533 -0
  408. package/node_modules/node-forge/tests/legacy/result.txt +1 -0
  409. package/node_modules/node-forge/tests/legacy/socketPool.html +302 -0
  410. package/node_modules/node-forge/tests/legacy/tasks.html +54 -0
  411. package/node_modules/node-forge/tests/legacy/tasks.js +378 -0
  412. package/node_modules/node-forge/tests/legacy/tls.html +389 -0
  413. package/node_modules/node-forge/tests/legacy/webid.html +89 -0
  414. package/node_modules/node-forge/tests/legacy/webid.js +313 -0
  415. package/node_modules/node-forge/tests/legacy/ws-webid.js +120 -0
  416. package/node_modules/node-forge/tests/legacy/xhr.html +67 -0
  417. package/node_modules/node-forge/tests/legacy/xhr.js +590 -0
  418. package/node_modules/node-forge/tests/pocs/ghsa-2328-f5f3-gj25.js +85 -0
  419. package/node_modules/node-forge/tests/pocs/ghsa-ppp5-5v6c-4jwp.js +166 -0
  420. package/node_modules/node-forge/tests/pocs/ghsa-q67f-28xg-22rw.js +103 -0
  421. package/node_modules/node-forge/tests/security/cve-2025-12816.js +75 -0
  422. package/node_modules/node-forge/tests/security/ghsa-554w-wpv2-vw27.js +81 -0
  423. package/node_modules/node-forge/tests/security/index.js +3 -0
  424. package/node_modules/node-forge/tests/server.crt +26 -0
  425. package/node_modules/node-forge/tests/server.js +87 -0
  426. package/node_modules/node-forge/tests/server.key +27 -0
  427. package/node_modules/node-forge/tests/support/task.js +718 -0
  428. package/node_modules/node-forge/tests/tests.css +61 -0
  429. package/node_modules/node-forge/tests/unit/aes.js +1498 -0
  430. package/node_modules/node-forge/tests/unit/asn1.js +1337 -0
  431. package/node_modules/node-forge/tests/unit/csr.js +129 -0
  432. package/node_modules/node-forge/tests/unit/des.js +231 -0
  433. package/node_modules/node-forge/tests/unit/ed25519.js +395 -0
  434. package/node_modules/node-forge/tests/unit/forge.js +2 -0
  435. package/node_modules/node-forge/tests/unit/hmac.js +64 -0
  436. package/node_modules/node-forge/tests/unit/index.html +20 -0
  437. package/node_modules/node-forge/tests/unit/index.js +27 -0
  438. package/node_modules/node-forge/tests/unit/jsbn.js +40 -0
  439. package/node_modules/node-forge/tests/unit/kem.js +167 -0
  440. package/node_modules/node-forge/tests/unit/md5.js +114 -0
  441. package/node_modules/node-forge/tests/unit/mgf1.js +16 -0
  442. package/node_modules/node-forge/tests/unit/pbkdf2.js +182 -0
  443. package/node_modules/node-forge/tests/unit/pem.js +159 -0
  444. package/node_modules/node-forge/tests/unit/pkcs1.js +1077 -0
  445. package/node_modules/node-forge/tests/unit/pkcs12.js +739 -0
  446. package/node_modules/node-forge/tests/unit/pkcs7.js +792 -0
  447. package/node_modules/node-forge/tests/unit/random.js +48 -0
  448. package/node_modules/node-forge/tests/unit/rc2.js +88 -0
  449. package/node_modules/node-forge/tests/unit/rsa.js +1278 -0
  450. package/node_modules/node-forge/tests/unit/sha1.js +72 -0
  451. package/node_modules/node-forge/tests/unit/sha256.js +79 -0
  452. package/node_modules/node-forge/tests/unit/sha512.js +200 -0
  453. package/node_modules/node-forge/tests/unit/ssh.js +175 -0
  454. package/node_modules/node-forge/tests/unit/tls.js +175 -0
  455. package/node_modules/node-forge/tests/unit/util.js +595 -0
  456. package/node_modules/node-forge/tests/unit/x509.js +1986 -0
  457. package/node_modules/node-forge/tests/websockets/server-webid.js +495 -0
  458. package/node_modules/node-forge/tests/websockets/server-ws.js +158 -0
  459. package/node_modules/node-forge/webpack-tests.config.js +26 -0
  460. package/node_modules/node-forge/webpack.config.js +130 -0
  461. package/node_modules/zod/LICENSE +21 -0
  462. package/node_modules/zod/README.md +208 -0
  463. package/node_modules/zod/index.cjs +33 -0
  464. package/node_modules/zod/index.d.cts +4 -0
  465. package/node_modules/zod/index.d.ts +4 -0
  466. package/node_modules/zod/index.js +4 -0
  467. package/node_modules/zod/package.json +118 -0
  468. package/node_modules/zod/src/index.ts +4 -0
  469. package/node_modules/zod/src/v3/ZodError.ts +330 -0
  470. package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
  471. package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
  472. package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
  473. package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
  474. package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
  475. package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
  476. package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
  477. package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
  478. package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
  479. package/node_modules/zod/src/v3/errors.ts +13 -0
  480. package/node_modules/zod/src/v3/external.ts +6 -0
  481. package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
  482. package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
  483. package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
  484. package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
  485. package/node_modules/zod/src/v3/helpers/typeAliases.ts +2 -0
  486. package/node_modules/zod/src/v3/helpers/util.ts +224 -0
  487. package/node_modules/zod/src/v3/index.ts +4 -0
  488. package/node_modules/zod/src/v3/locales/en.ts +124 -0
  489. package/node_modules/zod/src/v3/standard-schema.ts +113 -0
  490. package/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
  491. package/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
  492. package/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
  493. package/node_modules/zod/src/v3/tests/array.test.ts +71 -0
  494. package/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
  495. package/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
  496. package/node_modules/zod/src/v3/tests/base.test.ts +29 -0
  497. package/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
  498. package/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
  499. package/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
  500. package/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
  501. package/node_modules/zod/src/v3/tests/complex.test.ts +56 -0
  502. package/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
  503. package/node_modules/zod/src/v3/tests/date.test.ts +32 -0
  504. package/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
  505. package/node_modules/zod/src/v3/tests/default.test.ts +112 -0
  506. package/node_modules/zod/src/v3/tests/description.test.ts +33 -0
  507. package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
  508. package/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
  509. package/node_modules/zod/src/v3/tests/error.test.ts +551 -0
  510. package/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
  511. package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
  512. package/node_modules/zod/src/v3/tests/function.test.ts +257 -0
  513. package/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
  514. package/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
  515. package/node_modules/zod/src/v3/tests/intersection.test.ts +110 -0
  516. package/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
  517. package/node_modules/zod/src/v3/tests/language-server.test.ts +207 -0
  518. package/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
  519. package/node_modules/zod/src/v3/tests/map.test.ts +110 -0
  520. package/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
  521. package/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
  522. package/node_modules/zod/src/v3/tests/nan.test.ts +21 -0
  523. package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
  524. package/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
  525. package/node_modules/zod/src/v3/tests/number.test.ts +176 -0
  526. package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
  527. package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
  528. package/node_modules/zod/src/v3/tests/object.test.ts +434 -0
  529. package/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
  530. package/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
  531. package/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
  532. package/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
  533. package/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
  534. package/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
  535. package/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
  536. package/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
  537. package/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
  538. package/node_modules/zod/src/v3/tests/readonly.test.ts +194 -0
  539. package/node_modules/zod/src/v3/tests/record.test.ts +171 -0
  540. package/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
  541. package/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
  542. package/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
  543. package/node_modules/zod/src/v3/tests/set.test.ts +142 -0
  544. package/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
  545. package/node_modules/zod/src/v3/tests/string.test.ts +916 -0
  546. package/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
  547. package/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
  548. package/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
  549. package/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
  550. package/node_modules/zod/src/v3/tests/void.test.ts +15 -0
  551. package/node_modules/zod/src/v3/types.ts +5136 -0
  552. package/node_modules/zod/src/v4/classic/checks.ts +30 -0
  553. package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
  554. package/node_modules/zod/src/v4/classic/compat.ts +66 -0
  555. package/node_modules/zod/src/v4/classic/errors.ts +75 -0
  556. package/node_modules/zod/src/v4/classic/external.ts +50 -0
  557. package/node_modules/zod/src/v4/classic/index.ts +5 -0
  558. package/node_modules/zod/src/v4/classic/iso.ts +90 -0
  559. package/node_modules/zod/src/v4/classic/parse.ts +33 -0
  560. package/node_modules/zod/src/v4/classic/schemas.ts +2054 -0
  561. package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
  562. package/node_modules/zod/src/v4/classic/tests/array.test.ts +264 -0
  563. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +210 -0
  564. package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
  565. package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
  566. package/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
  567. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +54 -0
  568. package/node_modules/zod/src/v4/classic/tests/brand.test.ts +63 -0
  569. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +252 -0
  570. package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
  571. package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
  572. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +352 -0
  573. package/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
  574. package/node_modules/zod/src/v4/classic/tests/date.test.ts +31 -0
  575. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +296 -0
  576. package/node_modules/zod/src/v4/classic/tests/default.test.ts +313 -0
  577. package/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
  578. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +619 -0
  579. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +285 -0
  580. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +527 -0
  581. package/node_modules/zod/src/v4/classic/tests/error.test.ts +711 -0
  582. package/node_modules/zod/src/v4/classic/tests/file.test.ts +91 -0
  583. package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +175 -0
  584. package/node_modules/zod/src/v4/classic/tests/function.test.ts +268 -0
  585. package/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
  586. package/node_modules/zod/src/v4/classic/tests/index.test.ts +829 -0
  587. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +34 -0
  588. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +171 -0
  589. package/node_modules/zod/src/v4/classic/tests/json.test.ts +108 -0
  590. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +227 -0
  591. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +92 -0
  592. package/node_modules/zod/src/v4/classic/tests/map.test.ts +196 -0
  593. package/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
  594. package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
  595. package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +86 -0
  596. package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
  597. package/node_modules/zod/src/v4/classic/tests/number.test.ts +247 -0
  598. package/node_modules/zod/src/v4/classic/tests/object.test.ts +563 -0
  599. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +123 -0
  600. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +147 -0
  601. package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +127 -0
  602. package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +81 -0
  603. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +37 -0
  604. package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +298 -0
  605. package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
  606. package/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
  607. package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
  608. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +252 -0
  609. package/node_modules/zod/src/v4/classic/tests/record.test.ts +342 -0
  610. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +356 -0
  611. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +532 -0
  612. package/node_modules/zod/src/v4/classic/tests/registries.test.ts +204 -0
  613. package/node_modules/zod/src/v4/classic/tests/set.test.ts +179 -0
  614. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +57 -0
  615. package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +109 -0
  616. package/node_modules/zod/src/v4/classic/tests/string.test.ts +881 -0
  617. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +66 -0
  618. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +758 -0
  619. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +2314 -0
  620. package/node_modules/zod/src/v4/classic/tests/transform.test.ts +250 -0
  621. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +163 -0
  622. package/node_modules/zod/src/v4/classic/tests/union.test.ts +94 -0
  623. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
  624. package/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
  625. package/node_modules/zod/src/v4/core/api.ts +1594 -0
  626. package/node_modules/zod/src/v4/core/checks.ts +1283 -0
  627. package/node_modules/zod/src/v4/core/config.ts +15 -0
  628. package/node_modules/zod/src/v4/core/core.ts +134 -0
  629. package/node_modules/zod/src/v4/core/doc.ts +44 -0
  630. package/node_modules/zod/src/v4/core/errors.ts +424 -0
  631. package/node_modules/zod/src/v4/core/function.ts +176 -0
  632. package/node_modules/zod/src/v4/core/index.ts +15 -0
  633. package/node_modules/zod/src/v4/core/json-schema.ts +143 -0
  634. package/node_modules/zod/src/v4/core/parse.ts +94 -0
  635. package/node_modules/zod/src/v4/core/regexes.ts +135 -0
  636. package/node_modules/zod/src/v4/core/registries.ts +96 -0
  637. package/node_modules/zod/src/v4/core/schemas.ts +3842 -0
  638. package/node_modules/zod/src/v4/core/standard-schema.ts +64 -0
  639. package/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
  640. package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
  641. package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
  642. package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
  643. package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
  644. package/node_modules/zod/src/v4/core/to-json-schema.ts +977 -0
  645. package/node_modules/zod/src/v4/core/util.ts +775 -0
  646. package/node_modules/zod/src/v4/core/versions.ts +5 -0
  647. package/node_modules/zod/src/v4/core/zsf.ts +323 -0
  648. package/node_modules/zod/src/v4/index.ts +4 -0
  649. package/node_modules/zod/src/v4/locales/ar.ts +125 -0
  650. package/node_modules/zod/src/v4/locales/az.ts +121 -0
  651. package/node_modules/zod/src/v4/locales/be.ts +184 -0
  652. package/node_modules/zod/src/v4/locales/ca.ts +127 -0
  653. package/node_modules/zod/src/v4/locales/cs.ts +142 -0
  654. package/node_modules/zod/src/v4/locales/de.ts +124 -0
  655. package/node_modules/zod/src/v4/locales/en.ts +127 -0
  656. package/node_modules/zod/src/v4/locales/eo.ts +125 -0
  657. package/node_modules/zod/src/v4/locales/es.ts +125 -0
  658. package/node_modules/zod/src/v4/locales/fa.ts +134 -0
  659. package/node_modules/zod/src/v4/locales/fi.ts +131 -0
  660. package/node_modules/zod/src/v4/locales/fr-CA.ts +126 -0
  661. package/node_modules/zod/src/v4/locales/fr.ts +124 -0
  662. package/node_modules/zod/src/v4/locales/he.ts +125 -0
  663. package/node_modules/zod/src/v4/locales/hu.ts +126 -0
  664. package/node_modules/zod/src/v4/locales/id.ts +125 -0
  665. package/node_modules/zod/src/v4/locales/index.ts +39 -0
  666. package/node_modules/zod/src/v4/locales/it.ts +125 -0
  667. package/node_modules/zod/src/v4/locales/ja.ts +122 -0
  668. package/node_modules/zod/src/v4/locales/kh.ts +126 -0
  669. package/node_modules/zod/src/v4/locales/ko.ts +131 -0
  670. package/node_modules/zod/src/v4/locales/mk.ts +127 -0
  671. package/node_modules/zod/src/v4/locales/ms.ts +124 -0
  672. package/node_modules/zod/src/v4/locales/nl.ts +126 -0
  673. package/node_modules/zod/src/v4/locales/no.ts +124 -0
  674. package/node_modules/zod/src/v4/locales/ota.ts +125 -0
  675. package/node_modules/zod/src/v4/locales/pl.ts +126 -0
  676. package/node_modules/zod/src/v4/locales/ps.ts +133 -0
  677. package/node_modules/zod/src/v4/locales/pt.ts +123 -0
  678. package/node_modules/zod/src/v4/locales/ru.ts +184 -0
  679. package/node_modules/zod/src/v4/locales/sl.ts +126 -0
  680. package/node_modules/zod/src/v4/locales/sv.ts +127 -0
  681. package/node_modules/zod/src/v4/locales/ta.ts +125 -0
  682. package/node_modules/zod/src/v4/locales/th.ts +126 -0
  683. package/node_modules/zod/src/v4/locales/tr.ts +121 -0
  684. package/node_modules/zod/src/v4/locales/ua.ts +126 -0
  685. package/node_modules/zod/src/v4/locales/ur.ts +126 -0
  686. package/node_modules/zod/src/v4/locales/vi.ts +125 -0
  687. package/node_modules/zod/src/v4/locales/zh-CN.ts +123 -0
  688. package/node_modules/zod/src/v4/locales/zh-TW.ts +125 -0
  689. package/node_modules/zod/src/v4/mini/checks.ts +32 -0
  690. package/node_modules/zod/src/v4/mini/coerce.ts +22 -0
  691. package/node_modules/zod/src/v4/mini/external.ts +40 -0
  692. package/node_modules/zod/src/v4/mini/index.ts +3 -0
  693. package/node_modules/zod/src/v4/mini/iso.ts +62 -0
  694. package/node_modules/zod/src/v4/mini/parse.ts +1 -0
  695. package/node_modules/zod/src/v4/mini/schemas.ts +1579 -0
  696. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +129 -0
  697. package/node_modules/zod/src/v4/mini/tests/brand.test.ts +51 -0
  698. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +144 -0
  699. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +36 -0
  700. package/node_modules/zod/src/v4/mini/tests/error.test.ts +22 -0
  701. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +43 -0
  702. package/node_modules/zod/src/v4/mini/tests/index.test.ts +871 -0
  703. package/node_modules/zod/src/v4/mini/tests/number.test.ts +95 -0
  704. package/node_modules/zod/src/v4/mini/tests/object.test.ts +185 -0
  705. package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
  706. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +275 -0
  707. package/node_modules/zod/src/v4/mini/tests/string.test.ts +299 -0
  708. package/node_modules/zod/src/v4-mini/index.ts +1 -0
  709. package/node_modules/zod/v3/ZodError.cjs +138 -0
  710. package/node_modules/zod/v3/ZodError.d.cts +164 -0
  711. package/node_modules/zod/v3/ZodError.d.ts +164 -0
  712. package/node_modules/zod/v3/ZodError.js +133 -0
  713. package/node_modules/zod/v3/errors.cjs +17 -0
  714. package/node_modules/zod/v3/errors.d.cts +5 -0
  715. package/node_modules/zod/v3/errors.d.ts +5 -0
  716. package/node_modules/zod/v3/errors.js +9 -0
  717. package/node_modules/zod/v3/external.cjs +22 -0
  718. package/node_modules/zod/v3/external.d.cts +6 -0
  719. package/node_modules/zod/v3/external.d.ts +6 -0
  720. package/node_modules/zod/v3/external.js +6 -0
  721. package/node_modules/zod/v3/helpers/enumUtil.cjs +2 -0
  722. package/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
  723. package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
  724. package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
  725. package/node_modules/zod/v3/helpers/errorUtil.cjs +9 -0
  726. package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
  727. package/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
  728. package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
  729. package/node_modules/zod/v3/helpers/parseUtil.cjs +124 -0
  730. package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
  731. package/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
  732. package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
  733. package/node_modules/zod/v3/helpers/partialUtil.cjs +2 -0
  734. package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
  735. package/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
  736. package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
  737. package/node_modules/zod/v3/helpers/typeAliases.cjs +2 -0
  738. package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
  739. package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
  740. package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
  741. package/node_modules/zod/v3/helpers/util.cjs +137 -0
  742. package/node_modules/zod/v3/helpers/util.d.cts +85 -0
  743. package/node_modules/zod/v3/helpers/util.d.ts +85 -0
  744. package/node_modules/zod/v3/helpers/util.js +133 -0
  745. package/node_modules/zod/v3/index.cjs +33 -0
  746. package/node_modules/zod/v3/index.d.cts +4 -0
  747. package/node_modules/zod/v3/index.d.ts +4 -0
  748. package/node_modules/zod/v3/index.js +4 -0
  749. package/node_modules/zod/v3/locales/en.cjs +111 -0
  750. package/node_modules/zod/v3/locales/en.d.cts +3 -0
  751. package/node_modules/zod/v3/locales/en.d.ts +3 -0
  752. package/node_modules/zod/v3/locales/en.js +109 -0
  753. package/node_modules/zod/v3/standard-schema.cjs +2 -0
  754. package/node_modules/zod/v3/standard-schema.d.cts +102 -0
  755. package/node_modules/zod/v3/standard-schema.d.ts +102 -0
  756. package/node_modules/zod/v3/standard-schema.js +1 -0
  757. package/node_modules/zod/v3/types.cjs +3775 -0
  758. package/node_modules/zod/v3/types.d.cts +1031 -0
  759. package/node_modules/zod/v3/types.d.ts +1031 -0
  760. package/node_modules/zod/v3/types.js +3693 -0
  761. package/node_modules/zod/v4/classic/checks.cjs +32 -0
  762. package/node_modules/zod/v4/classic/checks.d.cts +1 -0
  763. package/node_modules/zod/v4/classic/checks.d.ts +1 -0
  764. package/node_modules/zod/v4/classic/checks.js +1 -0
  765. package/node_modules/zod/v4/classic/coerce.cjs +47 -0
  766. package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
  767. package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
  768. package/node_modules/zod/v4/classic/coerce.js +17 -0
  769. package/node_modules/zod/v4/classic/compat.cjs +57 -0
  770. package/node_modules/zod/v4/classic/compat.d.cts +46 -0
  771. package/node_modules/zod/v4/classic/compat.d.ts +46 -0
  772. package/node_modules/zod/v4/classic/compat.js +27 -0
  773. package/node_modules/zod/v4/classic/errors.cjs +67 -0
  774. package/node_modules/zod/v4/classic/errors.d.cts +30 -0
  775. package/node_modules/zod/v4/classic/errors.d.ts +30 -0
  776. package/node_modules/zod/v4/classic/errors.js +41 -0
  777. package/node_modules/zod/v4/classic/external.cjs +70 -0
  778. package/node_modules/zod/v4/classic/external.d.cts +13 -0
  779. package/node_modules/zod/v4/classic/external.d.ts +13 -0
  780. package/node_modules/zod/v4/classic/external.js +18 -0
  781. package/node_modules/zod/v4/classic/index.cjs +33 -0
  782. package/node_modules/zod/v4/classic/index.d.cts +4 -0
  783. package/node_modules/zod/v4/classic/index.d.ts +4 -0
  784. package/node_modules/zod/v4/classic/index.js +4 -0
  785. package/node_modules/zod/v4/classic/iso.cjs +60 -0
  786. package/node_modules/zod/v4/classic/iso.d.cts +22 -0
  787. package/node_modules/zod/v4/classic/iso.d.ts +22 -0
  788. package/node_modules/zod/v4/classic/iso.js +30 -0
  789. package/node_modules/zod/v4/classic/parse.cjs +32 -0
  790. package/node_modules/zod/v4/classic/parse.d.cts +23 -0
  791. package/node_modules/zod/v4/classic/parse.d.ts +23 -0
  792. package/node_modules/zod/v4/classic/parse.js +6 -0
  793. package/node_modules/zod/v4/classic/schemas.cjs +1109 -0
  794. package/node_modules/zod/v4/classic/schemas.d.cts +630 -0
  795. package/node_modules/zod/v4/classic/schemas.d.ts +630 -0
  796. package/node_modules/zod/v4/classic/schemas.js +1006 -0
  797. package/node_modules/zod/v4/core/api.cjs +1039 -0
  798. package/node_modules/zod/v4/core/api.d.cts +284 -0
  799. package/node_modules/zod/v4/core/api.d.ts +284 -0
  800. package/node_modules/zod/v4/core/api.js +906 -0
  801. package/node_modules/zod/v4/core/checks.cjs +591 -0
  802. package/node_modules/zod/v4/core/checks.d.cts +278 -0
  803. package/node_modules/zod/v4/core/checks.d.ts +278 -0
  804. package/node_modules/zod/v4/core/checks.js +565 -0
  805. package/node_modules/zod/v4/core/core.cjs +67 -0
  806. package/node_modules/zod/v4/core/core.d.cts +49 -0
  807. package/node_modules/zod/v4/core/core.d.ts +49 -0
  808. package/node_modules/zod/v4/core/core.js +61 -0
  809. package/node_modules/zod/v4/core/doc.cjs +39 -0
  810. package/node_modules/zod/v4/core/doc.d.cts +14 -0
  811. package/node_modules/zod/v4/core/doc.d.ts +14 -0
  812. package/node_modules/zod/v4/core/doc.js +35 -0
  813. package/node_modules/zod/v4/core/errors.cjs +226 -0
  814. package/node_modules/zod/v4/core/errors.d.cts +208 -0
  815. package/node_modules/zod/v4/core/errors.d.ts +208 -0
  816. package/node_modules/zod/v4/core/errors.js +195 -0
  817. package/node_modules/zod/v4/core/function.cjs +102 -0
  818. package/node_modules/zod/v4/core/function.d.cts +52 -0
  819. package/node_modules/zod/v4/core/function.d.ts +52 -0
  820. package/node_modules/zod/v4/core/function.js +75 -0
  821. package/node_modules/zod/v4/core/index.cjs +44 -0
  822. package/node_modules/zod/v4/core/index.d.cts +15 -0
  823. package/node_modules/zod/v4/core/index.d.ts +15 -0
  824. package/node_modules/zod/v4/core/index.js +15 -0
  825. package/node_modules/zod/v4/core/json-schema.cjs +2 -0
  826. package/node_modules/zod/v4/core/json-schema.d.cts +87 -0
  827. package/node_modules/zod/v4/core/json-schema.d.ts +87 -0
  828. package/node_modules/zod/v4/core/json-schema.js +1 -0
  829. package/node_modules/zod/v4/core/parse.cjs +87 -0
  830. package/node_modules/zod/v4/core/parse.d.cts +25 -0
  831. package/node_modules/zod/v4/core/parse.d.ts +25 -0
  832. package/node_modules/zod/v4/core/parse.js +57 -0
  833. package/node_modules/zod/v4/core/regexes.cjs +103 -0
  834. package/node_modules/zod/v4/core/regexes.d.cts +62 -0
  835. package/node_modules/zod/v4/core/regexes.d.ts +62 -0
  836. package/node_modules/zod/v4/core/regexes.js +95 -0
  837. package/node_modules/zod/v4/core/registries.cjs +56 -0
  838. package/node_modules/zod/v4/core/registries.d.cts +35 -0
  839. package/node_modules/zod/v4/core/registries.d.ts +35 -0
  840. package/node_modules/zod/v4/core/registries.js +51 -0
  841. package/node_modules/zod/v4/core/schemas.cjs +1748 -0
  842. package/node_modules/zod/v4/core/schemas.d.cts +1041 -0
  843. package/node_modules/zod/v4/core/schemas.d.ts +1041 -0
  844. package/node_modules/zod/v4/core/schemas.js +1717 -0
  845. package/node_modules/zod/v4/core/standard-schema.cjs +2 -0
  846. package/node_modules/zod/v4/core/standard-schema.d.cts +55 -0
  847. package/node_modules/zod/v4/core/standard-schema.d.ts +55 -0
  848. package/node_modules/zod/v4/core/standard-schema.js +1 -0
  849. package/node_modules/zod/v4/core/to-json-schema.cjs +854 -0
  850. package/node_modules/zod/v4/core/to-json-schema.d.cts +88 -0
  851. package/node_modules/zod/v4/core/to-json-schema.d.ts +88 -0
  852. package/node_modules/zod/v4/core/to-json-schema.js +849 -0
  853. package/node_modules/zod/v4/core/util.cjs +539 -0
  854. package/node_modules/zod/v4/core/util.d.cts +183 -0
  855. package/node_modules/zod/v4/core/util.d.ts +183 -0
  856. package/node_modules/zod/v4/core/util.js +493 -0
  857. package/node_modules/zod/v4/core/versions.cjs +8 -0
  858. package/node_modules/zod/v4/core/versions.d.cts +5 -0
  859. package/node_modules/zod/v4/core/versions.d.ts +5 -0
  860. package/node_modules/zod/v4/core/versions.js +5 -0
  861. package/node_modules/zod/v4/index.cjs +22 -0
  862. package/node_modules/zod/v4/index.d.cts +3 -0
  863. package/node_modules/zod/v4/index.d.ts +3 -0
  864. package/node_modules/zod/v4/index.js +3 -0
  865. package/node_modules/zod/v4/locales/ar.cjs +142 -0
  866. package/node_modules/zod/v4/locales/ar.d.cts +4 -0
  867. package/node_modules/zod/v4/locales/ar.d.ts +4 -0
  868. package/node_modules/zod/v4/locales/ar.js +116 -0
  869. package/node_modules/zod/v4/locales/az.cjs +141 -0
  870. package/node_modules/zod/v4/locales/az.d.cts +4 -0
  871. package/node_modules/zod/v4/locales/az.d.ts +4 -0
  872. package/node_modules/zod/v4/locales/az.js +115 -0
  873. package/node_modules/zod/v4/locales/be.cjs +190 -0
  874. package/node_modules/zod/v4/locales/be.d.cts +4 -0
  875. package/node_modules/zod/v4/locales/be.d.ts +4 -0
  876. package/node_modules/zod/v4/locales/be.js +164 -0
  877. package/node_modules/zod/v4/locales/ca.cjs +144 -0
  878. package/node_modules/zod/v4/locales/ca.d.cts +4 -0
  879. package/node_modules/zod/v4/locales/ca.d.ts +4 -0
  880. package/node_modules/zod/v4/locales/ca.js +118 -0
  881. package/node_modules/zod/v4/locales/cs.cjs +161 -0
  882. package/node_modules/zod/v4/locales/cs.d.cts +4 -0
  883. package/node_modules/zod/v4/locales/cs.d.ts +4 -0
  884. package/node_modules/zod/v4/locales/cs.js +135 -0
  885. package/node_modules/zod/v4/locales/de.cjs +142 -0
  886. package/node_modules/zod/v4/locales/de.d.cts +4 -0
  887. package/node_modules/zod/v4/locales/de.d.ts +4 -0
  888. package/node_modules/zod/v4/locales/de.js +116 -0
  889. package/node_modules/zod/v4/locales/en.cjs +145 -0
  890. package/node_modules/zod/v4/locales/en.d.cts +5 -0
  891. package/node_modules/zod/v4/locales/en.d.ts +5 -0
  892. package/node_modules/zod/v4/locales/en.js +117 -0
  893. package/node_modules/zod/v4/locales/eo.cjs +144 -0
  894. package/node_modules/zod/v4/locales/eo.d.cts +5 -0
  895. package/node_modules/zod/v4/locales/eo.d.ts +5 -0
  896. package/node_modules/zod/v4/locales/eo.js +116 -0
  897. package/node_modules/zod/v4/locales/es.cjs +143 -0
  898. package/node_modules/zod/v4/locales/es.d.cts +4 -0
  899. package/node_modules/zod/v4/locales/es.d.ts +4 -0
  900. package/node_modules/zod/v4/locales/es.js +117 -0
  901. package/node_modules/zod/v4/locales/fa.cjs +148 -0
  902. package/node_modules/zod/v4/locales/fa.d.cts +4 -0
  903. package/node_modules/zod/v4/locales/fa.d.ts +4 -0
  904. package/node_modules/zod/v4/locales/fa.js +122 -0
  905. package/node_modules/zod/v4/locales/fi.cjs +148 -0
  906. package/node_modules/zod/v4/locales/fi.d.cts +4 -0
  907. package/node_modules/zod/v4/locales/fi.d.ts +4 -0
  908. package/node_modules/zod/v4/locales/fi.js +122 -0
  909. package/node_modules/zod/v4/locales/fr-CA.cjs +143 -0
  910. package/node_modules/zod/v4/locales/fr-CA.d.cts +4 -0
  911. package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
  912. package/node_modules/zod/v4/locales/fr-CA.js +117 -0
  913. package/node_modules/zod/v4/locales/fr.cjs +142 -0
  914. package/node_modules/zod/v4/locales/fr.d.cts +4 -0
  915. package/node_modules/zod/v4/locales/fr.d.ts +4 -0
  916. package/node_modules/zod/v4/locales/fr.js +116 -0
  917. package/node_modules/zod/v4/locales/he.cjs +143 -0
  918. package/node_modules/zod/v4/locales/he.d.cts +4 -0
  919. package/node_modules/zod/v4/locales/he.d.ts +4 -0
  920. package/node_modules/zod/v4/locales/he.js +117 -0
  921. package/node_modules/zod/v4/locales/hu.cjs +143 -0
  922. package/node_modules/zod/v4/locales/hu.d.cts +4 -0
  923. package/node_modules/zod/v4/locales/hu.d.ts +4 -0
  924. package/node_modules/zod/v4/locales/hu.js +117 -0
  925. package/node_modules/zod/v4/locales/id.cjs +142 -0
  926. package/node_modules/zod/v4/locales/id.d.cts +4 -0
  927. package/node_modules/zod/v4/locales/id.d.ts +4 -0
  928. package/node_modules/zod/v4/locales/id.js +116 -0
  929. package/node_modules/zod/v4/locales/index.cjs +84 -0
  930. package/node_modules/zod/v4/locales/index.d.cts +39 -0
  931. package/node_modules/zod/v4/locales/index.d.ts +39 -0
  932. package/node_modules/zod/v4/locales/index.js +39 -0
  933. package/node_modules/zod/v4/locales/it.cjs +143 -0
  934. package/node_modules/zod/v4/locales/it.d.cts +4 -0
  935. package/node_modules/zod/v4/locales/it.d.ts +4 -0
  936. package/node_modules/zod/v4/locales/it.js +117 -0
  937. package/node_modules/zod/v4/locales/ja.cjs +141 -0
  938. package/node_modules/zod/v4/locales/ja.d.cts +4 -0
  939. package/node_modules/zod/v4/locales/ja.d.ts +4 -0
  940. package/node_modules/zod/v4/locales/ja.js +115 -0
  941. package/node_modules/zod/v4/locales/kh.cjs +143 -0
  942. package/node_modules/zod/v4/locales/kh.d.cts +4 -0
  943. package/node_modules/zod/v4/locales/kh.d.ts +4 -0
  944. package/node_modules/zod/v4/locales/kh.js +117 -0
  945. package/node_modules/zod/v4/locales/ko.cjs +147 -0
  946. package/node_modules/zod/v4/locales/ko.d.cts +4 -0
  947. package/node_modules/zod/v4/locales/ko.d.ts +4 -0
  948. package/node_modules/zod/v4/locales/ko.js +121 -0
  949. package/node_modules/zod/v4/locales/mk.cjs +144 -0
  950. package/node_modules/zod/v4/locales/mk.d.cts +4 -0
  951. package/node_modules/zod/v4/locales/mk.d.ts +4 -0
  952. package/node_modules/zod/v4/locales/mk.js +118 -0
  953. package/node_modules/zod/v4/locales/ms.cjs +142 -0
  954. package/node_modules/zod/v4/locales/ms.d.cts +4 -0
  955. package/node_modules/zod/v4/locales/ms.d.ts +4 -0
  956. package/node_modules/zod/v4/locales/ms.js +116 -0
  957. package/node_modules/zod/v4/locales/nl.cjs +143 -0
  958. package/node_modules/zod/v4/locales/nl.d.cts +4 -0
  959. package/node_modules/zod/v4/locales/nl.d.ts +4 -0
  960. package/node_modules/zod/v4/locales/nl.js +117 -0
  961. package/node_modules/zod/v4/locales/no.cjs +142 -0
  962. package/node_modules/zod/v4/locales/no.d.cts +4 -0
  963. package/node_modules/zod/v4/locales/no.d.ts +4 -0
  964. package/node_modules/zod/v4/locales/no.js +116 -0
  965. package/node_modules/zod/v4/locales/ota.cjs +143 -0
  966. package/node_modules/zod/v4/locales/ota.d.cts +4 -0
  967. package/node_modules/zod/v4/locales/ota.d.ts +4 -0
  968. package/node_modules/zod/v4/locales/ota.js +117 -0
  969. package/node_modules/zod/v4/locales/pl.cjs +143 -0
  970. package/node_modules/zod/v4/locales/pl.d.cts +4 -0
  971. package/node_modules/zod/v4/locales/pl.d.ts +4 -0
  972. package/node_modules/zod/v4/locales/pl.js +117 -0
  973. package/node_modules/zod/v4/locales/ps.cjs +148 -0
  974. package/node_modules/zod/v4/locales/ps.d.cts +4 -0
  975. package/node_modules/zod/v4/locales/ps.d.ts +4 -0
  976. package/node_modules/zod/v4/locales/ps.js +122 -0
  977. package/node_modules/zod/v4/locales/pt.cjs +142 -0
  978. package/node_modules/zod/v4/locales/pt.d.cts +4 -0
  979. package/node_modules/zod/v4/locales/pt.d.ts +4 -0
  980. package/node_modules/zod/v4/locales/pt.js +116 -0
  981. package/node_modules/zod/v4/locales/ru.cjs +190 -0
  982. package/node_modules/zod/v4/locales/ru.d.cts +4 -0
  983. package/node_modules/zod/v4/locales/ru.d.ts +4 -0
  984. package/node_modules/zod/v4/locales/ru.js +164 -0
  985. package/node_modules/zod/v4/locales/sl.cjs +143 -0
  986. package/node_modules/zod/v4/locales/sl.d.cts +4 -0
  987. package/node_modules/zod/v4/locales/sl.d.ts +4 -0
  988. package/node_modules/zod/v4/locales/sl.js +117 -0
  989. package/node_modules/zod/v4/locales/sv.cjs +144 -0
  990. package/node_modules/zod/v4/locales/sv.d.cts +4 -0
  991. package/node_modules/zod/v4/locales/sv.d.ts +4 -0
  992. package/node_modules/zod/v4/locales/sv.js +118 -0
  993. package/node_modules/zod/v4/locales/ta.cjs +143 -0
  994. package/node_modules/zod/v4/locales/ta.d.cts +4 -0
  995. package/node_modules/zod/v4/locales/ta.d.ts +4 -0
  996. package/node_modules/zod/v4/locales/ta.js +117 -0
  997. package/node_modules/zod/v4/locales/th.cjs +143 -0
  998. package/node_modules/zod/v4/locales/th.d.cts +4 -0
  999. package/node_modules/zod/v4/locales/th.d.ts +4 -0
  1000. package/node_modules/zod/v4/locales/th.js +117 -0
  1001. package/node_modules/zod/v4/locales/tr.cjs +143 -0
  1002. package/node_modules/zod/v4/locales/tr.d.cts +5 -0
  1003. package/node_modules/zod/v4/locales/tr.d.ts +5 -0
  1004. package/node_modules/zod/v4/locales/tr.js +115 -0
  1005. package/node_modules/zod/v4/locales/ua.cjs +143 -0
  1006. package/node_modules/zod/v4/locales/ua.d.cts +4 -0
  1007. package/node_modules/zod/v4/locales/ua.d.ts +4 -0
  1008. package/node_modules/zod/v4/locales/ua.js +117 -0
  1009. package/node_modules/zod/v4/locales/ur.cjs +143 -0
  1010. package/node_modules/zod/v4/locales/ur.d.cts +4 -0
  1011. package/node_modules/zod/v4/locales/ur.d.ts +4 -0
  1012. package/node_modules/zod/v4/locales/ur.js +117 -0
  1013. package/node_modules/zod/v4/locales/vi.cjs +142 -0
  1014. package/node_modules/zod/v4/locales/vi.d.cts +4 -0
  1015. package/node_modules/zod/v4/locales/vi.d.ts +4 -0
  1016. package/node_modules/zod/v4/locales/vi.js +116 -0
  1017. package/node_modules/zod/v4/locales/zh-CN.cjs +142 -0
  1018. package/node_modules/zod/v4/locales/zh-CN.d.cts +4 -0
  1019. package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
  1020. package/node_modules/zod/v4/locales/zh-CN.js +116 -0
  1021. package/node_modules/zod/v4/locales/zh-TW.cjs +143 -0
  1022. package/node_modules/zod/v4/locales/zh-TW.d.cts +4 -0
  1023. package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
  1024. package/node_modules/zod/v4/locales/zh-TW.js +117 -0
  1025. package/node_modules/zod/v4/mini/checks.cjs +34 -0
  1026. package/node_modules/zod/v4/mini/checks.d.cts +1 -0
  1027. package/node_modules/zod/v4/mini/checks.d.ts +1 -0
  1028. package/node_modules/zod/v4/mini/checks.js +1 -0
  1029. package/node_modules/zod/v4/mini/coerce.cjs +47 -0
  1030. package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
  1031. package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
  1032. package/node_modules/zod/v4/mini/coerce.js +17 -0
  1033. package/node_modules/zod/v4/mini/external.cjs +62 -0
  1034. package/node_modules/zod/v4/mini/external.d.cts +11 -0
  1035. package/node_modules/zod/v4/mini/external.d.ts +11 -0
  1036. package/node_modules/zod/v4/mini/external.js +13 -0
  1037. package/node_modules/zod/v4/mini/index.cjs +32 -0
  1038. package/node_modules/zod/v4/mini/index.d.cts +3 -0
  1039. package/node_modules/zod/v4/mini/index.d.ts +3 -0
  1040. package/node_modules/zod/v4/mini/index.js +3 -0
  1041. package/node_modules/zod/v4/mini/iso.cjs +60 -0
  1042. package/node_modules/zod/v4/mini/iso.d.cts +22 -0
  1043. package/node_modules/zod/v4/mini/iso.d.ts +22 -0
  1044. package/node_modules/zod/v4/mini/iso.js +30 -0
  1045. package/node_modules/zod/v4/mini/parse.cjs +8 -0
  1046. package/node_modules/zod/v4/mini/parse.d.cts +1 -0
  1047. package/node_modules/zod/v4/mini/parse.d.ts +1 -0
  1048. package/node_modules/zod/v4/mini/parse.js +1 -0
  1049. package/node_modules/zod/v4/mini/schemas.cjs +839 -0
  1050. package/node_modules/zod/v4/mini/schemas.d.cts +356 -0
  1051. package/node_modules/zod/v4/mini/schemas.d.ts +356 -0
  1052. package/node_modules/zod/v4/mini/schemas.js +732 -0
  1053. package/node_modules/zod/v4-mini/index.cjs +17 -0
  1054. package/node_modules/zod/v4-mini/index.d.cts +1 -0
  1055. package/node_modules/zod/v4-mini/index.d.ts +1 -0
  1056. package/node_modules/zod/v4-mini/index.js +1 -0
  1057. package/package.json +97 -0
@@ -0,0 +1,1278 @@
1
+ var ASSERT = require('assert');
2
+ var FORGE = require('../../lib/forge');
3
+ var JSBN = require('../../lib/jsbn');
4
+ var MD = require('../../lib/md.all');
5
+ var MGF = require('../../lib/mgf');
6
+ var PKI = require('../../lib/pki');
7
+ var PSS = require('../../lib/pss');
8
+ var RANDOM = require('../../lib/random');
9
+ var RSA = require('../../lib/rsa');
10
+ var UTIL = require('../../lib/util');
11
+
12
+ (function() {
13
+ var _pem = {
14
+ privateKey: '-----BEGIN RSA PRIVATE KEY-----\r\n' +
15
+ 'MIICXQIBAAKBgQDL0EugUiNGMWscLAVM0VoMdhDZEJOqdsUMpx9U0YZI7szokJqQ\r\n' +
16
+ 'NIwokiQ6EonNnWSMlIvy46AhnlRYn+ezeTeU7eMGTkP3VF29vXBo+dLq5e+8VyAy\r\n' +
17
+ 'Q3FzM1wI4ts4hRACF8w6mqygXQ7i/SDu8/rXqRGtvnM+z0MYDdKo80efzwIDAQAB\r\n' +
18
+ 'AoGAIzkGONi5G+JifmXlLJdplom486p3upf4Ce2/7mqfaG9MnkyPSairKD/JXvfh\r\n' +
19
+ 'NNWkkN8DKKDKBcVVElPgORYT0qwrWc7ueLBMUCbRXb1ZyfEulimG0R3kjUh7NYau\r\n' +
20
+ 'DaIkVgfykXGSQMZx8FoaT6L080zd+0emKDDYRrb+/kgJNJECQQDoUZoiC2K/DWNY\r\n' +
21
+ 'h3/ppZ0ane2y4SBmJUHJVMPQ2CEgxsrJTxet668ckNCKaOP/3VFPoWC41f17DvKq\r\n' +
22
+ 'noYINNntAkEA4JbZBZBVUrQFhHlrpXT4jzqtO2RlKZzEq8qmFZfEErxOT1WMyyCi\r\n' +
23
+ 'lAQ5gUKardo1Kf0omC8Xq/uO9ZYdED55KwJBALs6cJ65UFaq4oLJiQPzLd7yokuE\r\n' +
24
+ 'dcj8g71PLBTW6jPxIiMFNA89nz3FU9wIVp+xbMNhSoMMKqIPVPC+m0Rn260CQQDA\r\n' +
25
+ 'I83fWK/mZWUjBM33a68KumRiH238v8XyQxj7+C8i6D8G2GXvkigFAehAkb7LZZd+\r\n' +
26
+ 'KLuGFyPlWv3fVWHf99KpAkBQFKk3MRMl6IGJZUEFQe4l5whm8LkGU4acSqv9B3xt\r\n' +
27
+ 'qROkCrsFrMPqjuuzEmyHoQZ64r2PLJg7FOuyhBnQUOt4\r\n' +
28
+ '-----END RSA PRIVATE KEY-----\r\n',
29
+ privateKeyInfo: '-----BEGIN PRIVATE KEY-----\r\n' +
30
+ 'MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAMvQS6BSI0Yxaxws\r\n' +
31
+ 'BUzRWgx2ENkQk6p2xQynH1TRhkjuzOiQmpA0jCiSJDoSic2dZIyUi/LjoCGeVFif\r\n' +
32
+ '57N5N5Tt4wZOQ/dUXb29cGj50url77xXIDJDcXMzXAji2ziFEAIXzDqarKBdDuL9\r\n' +
33
+ 'IO7z+tepEa2+cz7PQxgN0qjzR5/PAgMBAAECgYAjOQY42Lkb4mJ+ZeUsl2mWibjz\r\n' +
34
+ 'qne6l/gJ7b/uap9ob0yeTI9JqKsoP8le9+E01aSQ3wMooMoFxVUSU+A5FhPSrCtZ\r\n' +
35
+ 'zu54sExQJtFdvVnJ8S6WKYbRHeSNSHs1hq4NoiRWB/KRcZJAxnHwWhpPovTzTN37\r\n' +
36
+ 'R6YoMNhGtv7+SAk0kQJBAOhRmiILYr8NY1iHf+mlnRqd7bLhIGYlQclUw9DYISDG\r\n' +
37
+ 'yslPF63rrxyQ0Ipo4//dUU+hYLjV/XsO8qqehgg02e0CQQDgltkFkFVStAWEeWul\r\n' +
38
+ 'dPiPOq07ZGUpnMSryqYVl8QSvE5PVYzLIKKUBDmBQpqt2jUp/SiYLxer+471lh0Q\r\n' +
39
+ 'PnkrAkEAuzpwnrlQVqrigsmJA/Mt3vKiS4R1yPyDvU8sFNbqM/EiIwU0Dz2fPcVT\r\n' +
40
+ '3AhWn7Fsw2FKgwwqog9U8L6bRGfbrQJBAMAjzd9Yr+ZlZSMEzfdrrwq6ZGIfbfy/\r\n' +
41
+ 'xfJDGPv4LyLoPwbYZe+SKAUB6ECRvstll34ou4YXI+Va/d9VYd/30qkCQFAUqTcx\r\n' +
42
+ 'EyXogYllQQVB7iXnCGbwuQZThpxKq/0HfG2pE6QKuwWsw+qO67MSbIehBnrivY8s\r\n' +
43
+ 'mDsU67KEGdBQ63g=\r\n' +
44
+ '-----END PRIVATE KEY-----\r\n',
45
+ publicKey: '-----BEGIN PUBLIC KEY-----\r\n' +
46
+ 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDL0EugUiNGMWscLAVM0VoMdhDZ\r\n' +
47
+ 'EJOqdsUMpx9U0YZI7szokJqQNIwokiQ6EonNnWSMlIvy46AhnlRYn+ezeTeU7eMG\r\n' +
48
+ 'TkP3VF29vXBo+dLq5e+8VyAyQ3FzM1wI4ts4hRACF8w6mqygXQ7i/SDu8/rXqRGt\r\n' +
49
+ 'vnM+z0MYDdKo80efzwIDAQAB\r\n' +
50
+ '-----END PUBLIC KEY-----\r\n'
51
+ };
52
+ var _signature =
53
+ '9200ece65cdaed36bcc20b94c65af852e4f88f0b4fe5b249d54665f815992ac4' +
54
+ '3a1399e65d938c6a7f16dd39d971a53ca66523209dbbfbcb67afa579dbb0c220' +
55
+ '672813d9e6f4818f29b9becbb29da2032c5e422da97e0c39bfb7a2e7d568615a' +
56
+ '5073af0337ff215a8e1b2332d668691f4fb731440055420c24ac451dd3c913f4';
57
+
58
+ describe('rsa', function() {
59
+ // check a pair
60
+ function _pairCheck(pair) {
61
+ // PEM check
62
+ ASSERT.equal(PKI.privateKeyToPem(pair.privateKey).indexOf('-----BEGIN RSA PRIVATE KEY-----'), 0);
63
+ ASSERT.equal(PKI.publicKeyToPem(pair.publicKey).indexOf('-----BEGIN PUBLIC KEY-----'), 0);
64
+
65
+ // sign and verify
66
+ var md = MD.sha1.create();
67
+ md.update('0123456789abcdef');
68
+ var signature = pair.privateKey.sign(md);
69
+ ASSERT.ok(pair.publicKey.verify(md.digest().getBytes(), signature));
70
+ }
71
+
72
+ // compare pairs
73
+ function _pairCmp(pair1, pair2) {
74
+ var pem1 = {
75
+ privateKey: PKI.privateKeyToPem(pair1.privateKey),
76
+ publicKey: PKI.publicKeyToPem(pair1.publicKey)
77
+ };
78
+ var pem2 = {
79
+ privateKey: PKI.privateKeyToPem(pair2.privateKey),
80
+ publicKey: PKI.publicKeyToPem(pair2.publicKey)
81
+ };
82
+ ASSERT.equal(pem1.privateKey, pem2.privateKey);
83
+ ASSERT.equal(pem1.publicKey, pem2.publicKey);
84
+ }
85
+
86
+ // create same prng
87
+ function _samePrng() {
88
+ var prng = RANDOM.createInstance();
89
+ prng.seedFileSync = function(needed) {
90
+ return UTIL.fillString('a', needed);
91
+ };
92
+ return prng;
93
+ }
94
+
95
+ // generate pair in sync mode
96
+ function _genSync(options) {
97
+ options = options || {samePrng: false};
98
+ var pair;
99
+ if(options.samePrng) {
100
+ pair = RSA.generateKeyPair(512, {prng: _samePrng()});
101
+ } else {
102
+ pair = RSA.generateKeyPair(512);
103
+ }
104
+ _pairCheck(pair);
105
+ return pair;
106
+ }
107
+
108
+ // generate pair in async mode
109
+ function _genAsync(options, callback) {
110
+ if(typeof callback !== 'function') {
111
+ callback = options;
112
+ options = {samePrng: false};
113
+ }
114
+ var genOptions = {
115
+ bits: 512,
116
+ workerScript: '/forge/prime.worker.js'
117
+ };
118
+ if(options.samePrng) {
119
+ genOptions.prng = _samePrng();
120
+ }
121
+ if('workers' in options) {
122
+ genOptions.workers = options.workers;
123
+ }
124
+ RSA.generateKeyPair(genOptions, function(err, pair) {
125
+ ASSERT.ifError(err);
126
+ _pairCheck(pair);
127
+ callback(pair);
128
+ });
129
+ }
130
+
131
+ // check if keygen params use deterministic algorithm
132
+ // NOTE: needs to match implementation details
133
+ function isDeterministic(isPrng, isAsync, isPurejs) {
134
+ // always needs to have a prng
135
+ if(!isPrng) {
136
+ return false;
137
+ }
138
+ if(UTIL.isNodejs) {
139
+ // Node versions >= 10.12.0 support native keyPair generation,
140
+ // which is non-deterministic
141
+ if(isAsync && !isPurejs &&
142
+ typeof require('crypto').generateKeyPair === 'function') {
143
+ return false;
144
+ }
145
+ if(!isAsync && !isPurejs &&
146
+ typeof require('crypto').generateKeyPairSync === 'function') {
147
+ return false;
148
+ }
149
+ } else {
150
+ // async browser code has race conditions with multiple workers
151
+ if(isAsync) {
152
+ return false;
153
+ }
154
+ }
155
+ // will run deterministic algorithm
156
+ return true;
157
+ }
158
+
159
+ it('should generate 512 bit key pair (sync)', function() {
160
+ _genSync();
161
+ });
162
+
163
+ it('should generate 512 bit key pair (sync+purejs)', function() {
164
+ // save
165
+ var purejs = FORGE.options.usePureJavaScript;
166
+ // test pure mode
167
+ FORGE.options.usePureJavaScript = true;
168
+ _genSync();
169
+ // restore
170
+ FORGE.options.usePureJavaScript = purejs;
171
+ });
172
+
173
+ it('should generate 512 bit key pair (async)', function(done) {
174
+ _genAsync(function() {
175
+ done();
176
+ });
177
+ });
178
+
179
+ it('should generate 512 bit key pair (async+purejs)', function(done) {
180
+ // save
181
+ var purejs = FORGE.options.usePureJavaScript;
182
+ // test pure mode
183
+ FORGE.options.usePureJavaScript = true;
184
+ _genAsync(function() {
185
+ // restore
186
+ FORGE.options.usePureJavaScript = purejs;
187
+ done();
188
+ });
189
+ });
190
+
191
+ it('should generate 512 bit key pair (async+workers)', function(done) {
192
+ _genAsync({
193
+ workers: -1
194
+ }, function() {
195
+ done();
196
+ });
197
+ });
198
+
199
+ it('should generate same 512 bit key pair (prng+sync,prng+sync)',
200
+ function() {
201
+ var pair1 = _genSync({samePrng: true});
202
+ var pair2 = _genSync({samePrng: true});
203
+ _pairCmp(pair1, pair2);
204
+ });
205
+
206
+ it('should generate same 512 bit key pair (prng+sync,prng+sync+purejs)',
207
+ function() {
208
+ if(!isDeterministic(true, false, false) ||
209
+ !isDeterministic(true, false, true)) {
210
+ this.skip();
211
+ }
212
+ var pair1 = _genSync({samePrng: true});
213
+ // save
214
+ var purejs = FORGE.options.usePureJavaScript;
215
+ // test pure mode
216
+ FORGE.options.usePureJavaScript = true;
217
+ var pair2 = _genSync({samePrng: true});
218
+ // restore
219
+ FORGE.options.usePureJavaScript = purejs;
220
+ _pairCmp(pair1, pair2);
221
+ });
222
+
223
+ it('should generate same 512 bit key pair ' +
224
+ '(prng+sync+purejs,prng+sync+purejs)', function() {
225
+ if(!isDeterministic(true, false, true) ||
226
+ !isDeterministic(true, false, true)) {
227
+ this.skip();
228
+ }
229
+ // save
230
+ var purejs = FORGE.options.usePureJavaScript;
231
+ // test pure mode
232
+ FORGE.options.usePureJavaScript = true;
233
+ var pair1 = _genSync({samePrng: true});
234
+ var pair2 = _genSync({samePrng: true});
235
+ // restore
236
+ FORGE.options.usePureJavaScript = purejs;
237
+ _pairCmp(pair1, pair2);
238
+ });
239
+
240
+ it('should generate same 512 bit key pair (prng+sync,prng+async)',
241
+ function(done) {
242
+ if(!isDeterministic(true, false, false) ||
243
+ !isDeterministic(true, true, false)) {
244
+ this.skip();
245
+ }
246
+ var pair1 = _genSync({samePrng: true});
247
+ _genAsync({samePrng: true}, function(pair2) {
248
+ _pairCmp(pair1, pair2);
249
+ done();
250
+ });
251
+ });
252
+
253
+ it('should generate same 512 bit key pair (prng+async,prng+sync)',
254
+ function(done) {
255
+ if(!isDeterministic(true, true, false) ||
256
+ !isDeterministic(true, false, false)) {
257
+ this.skip();
258
+ }
259
+ _genAsync({samePrng: true}, function(pair1) {
260
+ var pair2 = _genSync({samePrng: true});
261
+ _pairCmp(pair1, pair2);
262
+ done();
263
+ });
264
+ });
265
+
266
+ it('should generate same 512 bit key pair (prng+async,prng+async)',
267
+ function(done) {
268
+ if(!isDeterministic(true, true, false) ||
269
+ !isDeterministic(true, true, false)) {
270
+ this.skip();
271
+ }
272
+ var pair1;
273
+ var pair2;
274
+ // finish when both complete
275
+ function _done() {
276
+ if(pair1 && pair2) {
277
+ _pairCmp(pair1, pair2);
278
+ done();
279
+ }
280
+ }
281
+ _genAsync({samePrng: true}, function(pair) {
282
+ pair1 = pair;
283
+ _done();
284
+ });
285
+ _genAsync({samePrng: true}, function(pair) {
286
+ pair2 = pair;
287
+ _done();
288
+ });
289
+ });
290
+
291
+ it('should convert private key to/from PEM', function() {
292
+ var privateKey = PKI.privateKeyFromPem(_pem.privateKey);
293
+ ASSERT.equal(PKI.privateKeyToPem(privateKey), _pem.privateKey);
294
+ });
295
+
296
+ it('should convert public key to/from PEM', function() {
297
+ var publicKey = PKI.publicKeyFromPem(_pem.publicKey);
298
+ ASSERT.equal(PKI.publicKeyToPem(publicKey), _pem.publicKey);
299
+ });
300
+
301
+ it('should convert a PKCS#8 PrivateKeyInfo to/from PEM', function() {
302
+ var privateKey = PKI.privateKeyFromPem(_pem.privateKeyInfo);
303
+ var rsaPrivateKey = PKI.privateKeyToAsn1(privateKey);
304
+ var pki = PKI.wrapRsaPrivateKey(rsaPrivateKey);
305
+ ASSERT.equal(PKI.privateKeyInfoToPem(pki), _pem.privateKeyInfo);
306
+ });
307
+
308
+ (function() {
309
+ var algorithms = ['aes128', 'aes192', 'aes256', '3des', 'des'];
310
+ algorithms.forEach(function(algorithm) {
311
+ it('should PKCS#8 encrypt and decrypt private key with ' + algorithm, function() {
312
+ var privateKey = PKI.privateKeyFromPem(_pem.privateKey);
313
+ var encryptedPem = PKI.encryptRsaPrivateKey(
314
+ privateKey, 'password', {algorithm: algorithm});
315
+ privateKey = PKI.decryptRsaPrivateKey(encryptedPem, 'password');
316
+ ASSERT.equal(PKI.privateKeyToPem(privateKey), _pem.privateKey);
317
+ });
318
+ });
319
+ })();
320
+
321
+ (function() {
322
+ var algorithms = ['aes128', 'aes192', 'aes256'];
323
+ var prfAlgorithms = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512'];
324
+ algorithms.forEach(function(algorithm) {
325
+ prfAlgorithms.forEach(function(prfAlgorithm) {
326
+ it('should PKCS#8 encrypt and decrypt private key with ' + algorithm +
327
+ ' encryption and ' + prfAlgorithm + ' PRF', function() {
328
+ var privateKey = PKI.privateKeyFromPem(_pem.privateKey);
329
+ var encryptedPem = PKI.encryptRsaPrivateKey(
330
+ privateKey, 'password', {
331
+ algorithm: algorithm,
332
+ prfAlgorithm: prfAlgorithm
333
+ });
334
+ privateKey = PKI.decryptRsaPrivateKey(encryptedPem, 'password');
335
+ ASSERT.equal(PKI.privateKeyToPem(privateKey), _pem.privateKey);
336
+ });
337
+ });
338
+ });
339
+ })();
340
+
341
+ (function() {
342
+ var algorithms = ['aes128', 'aes192', 'aes256', '3des', 'des'];
343
+ algorithms.forEach(function(algorithm) {
344
+ it('should legacy (OpenSSL style) encrypt and decrypt private key with ' + algorithm, function() {
345
+ var privateKey = PKI.privateKeyFromPem(_pem.privateKey);
346
+ var encryptedPem = PKI.encryptRsaPrivateKey(
347
+ privateKey, 'password', {algorithm: algorithm, legacy: true});
348
+ privateKey = PKI.decryptRsaPrivateKey(encryptedPem, 'password');
349
+ ASSERT.equal(PKI.privateKeyToPem(privateKey), _pem.privateKey);
350
+ });
351
+ });
352
+ })();
353
+
354
+ it('should verify signature', function() {
355
+ var publicKey = PKI.publicKeyFromPem(_pem.publicKey);
356
+ var md = MD.sha1.create();
357
+ md.update('0123456789abcdef');
358
+ var signature = UTIL.hexToBytes(_signature);
359
+ ASSERT.ok(publicKey.verify(md.digest().getBytes(), signature));
360
+ });
361
+
362
+ it('should sign and verify', function() {
363
+ var privateKey = PKI.privateKeyFromPem(_pem.privateKey);
364
+ var publicKey = PKI.publicKeyFromPem(_pem.publicKey);
365
+ var md = MD.sha1.create();
366
+ md.update('0123456789abcdef');
367
+ var signature = privateKey.sign(md);
368
+ ASSERT.ok(publicKey.verify(md.digest().getBytes(), signature));
369
+ });
370
+
371
+ it('should generate missing CRT parameters, sign, and verify', function() {
372
+ var privateKey = PKI.privateKeyFromPem(_pem.privateKey);
373
+
374
+ // remove dQ, dP, and qInv
375
+ privateKey = RSA.setPrivateKey(
376
+ privateKey.n, privateKey.e, privateKey.d,
377
+ privateKey.p, privateKey.q);
378
+
379
+ var publicKey = PKI.publicKeyFromPem(_pem.publicKey);
380
+ var md = MD.sha1.create();
381
+ md.update('0123456789abcdef');
382
+ var signature = privateKey.sign(md);
383
+ ASSERT.ok(publicKey.verify(md.digest().getBytes(), signature));
384
+ });
385
+
386
+ it('should sign and verify with a private key containing only e, n, and d parameters', function() {
387
+ var privateKey = PKI.privateKeyFromPem(_pem.privateKey);
388
+
389
+ // remove all CRT parameters from private key, so that it consists
390
+ // only of e, n and d (which make a perfectly valid private key, but its
391
+ // operations are slower)
392
+ privateKey = RSA.setPrivateKey(
393
+ privateKey.n, privateKey.e, privateKey.d);
394
+
395
+ var publicKey = PKI.publicKeyFromPem(_pem.publicKey);
396
+ var md = MD.sha1.create();
397
+ md.update('0123456789abcdef');
398
+ var signature = privateKey.sign(md);
399
+ ASSERT.ok(publicKey.verify(md.digest().getBytes(), signature));
400
+ });
401
+
402
+ (function() {
403
+ var tests = [{
404
+ keySize: 1024,
405
+ privateKeyPem: '-----BEGIN RSA PRIVATE KEY-----\r\n' +
406
+ 'MIICWwIBAAKBgQDCjvkkLWNTeYXqEsqGiVCW/pDt3/qAodNMHcU9gOU2rxeWwiRu\r\n' +
407
+ 'OhhLqmMxXHLi0oP5Xmg0m7zdOiLMEyzzyRzdp21aqp3k5qtuSDkZcf1prsp1jpYm\r\n' +
408
+ '6z9EGpaSHb64BCuUsQGmUPKutd5RERKHGZXtiRuvvIyue7ETq6VjXrOUHQIDAQAB\r\n' +
409
+ 'AoGAOKeBjTNaVRhyEnNeXkbmHNIMSfiK7aIx8VxJ71r1ZDMgX1oxWZe5M29uaxVM\r\n' +
410
+ 'rxg2Lgt7tLYVDSa8s0hyMptBuBdy3TJUWruDx85uwCrWnMerCt/iKVBS22fv5vm0\r\n' +
411
+ 'LEq/4gjgIVTZwgqbVxGsBlKcY2VzxAfYqYzU8EOZBeNhZdECQQDy+PJAPcUN2xOs\r\n' +
412
+ '6qy66S91x6y3vMjs900OeX4+bgT4VSVKmLpqRTPizzcL07tT4+Y+pAAOX6VstZvZ\r\n' +
413
+ '6iFDL5rPAkEAzP1+gaRczboKoJWKJt0uEMUmztcY9NXJFDmjVLqzKwKjcAoGgIal\r\n' +
414
+ 'h+uBFT9VJ16QajC7KxTRLlarzmMvspItUwJAeUMNhEpPwm6ID1DADDi82wdgiALM\r\n' +
415
+ 'NJfn+UVhYD8Ac//qsKQwxUDseFH6owh1AZVIIBMxg/rwUKUCt2tGVoW3uQJAIt6M\r\n' +
416
+ 'Aml/D8+xtxc45NuC1n9y1oRoTl1/Ut1rFyKbD5nnS0upR3uf9LruvjqDtaq0Thvz\r\n' +
417
+ '+qQT4RoFJ5pfprSO2QJAdMkfNWRqECfAhZyQuUrapeWU3eQ0wjvktIynCIwiBDd2\r\n' +
418
+ 'MfjmVXzBJhMk6dtINt+vBEITVQEOdtyTgDt0y3n2Lw==\r\n' +
419
+ '-----END RSA PRIVATE KEY-----\r\n',
420
+ publicKeyPem: '-----BEGIN PUBLIC KEY-----\r\n' +
421
+ 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCjvkkLWNTeYXqEsqGiVCW/pDt\r\n' +
422
+ '3/qAodNMHcU9gOU2rxeWwiRuOhhLqmMxXHLi0oP5Xmg0m7zdOiLMEyzzyRzdp21a\r\n' +
423
+ 'qp3k5qtuSDkZcf1prsp1jpYm6z9EGpaSHb64BCuUsQGmUPKutd5RERKHGZXtiRuv\r\n' +
424
+ 'vIyue7ETq6VjXrOUHQIDAQAB\r\n' +
425
+ '-----END PUBLIC KEY-----\r\n',
426
+ encrypted: 'jsej3OoacmJ1VjWrlw68F+drnQORAuKAqVu6RMbz1xSXjzA355vctrJZXolRU0mvzuu/6VuNynkKGGyRJ6DHt85CvwTMChw4tOMV4Dy6bgnUt3j+DZA2sWTwFhOlpzvNQMK70QpuqrXtOZmAO59EwoDeJkW/iH6t4YzNOVYo9Jg=',
427
+ signature: 'GT0/3EV2zrXxPd1ydijJq3R7lkI4c0GtcprgpG04dSECv/xyXtikuzivxv7XzUdHpu6QiYmM0xE4D4i7LK3Mzy+f7aB4o/dg8XXO3htLiBzVI+ZJCRh06RdYctPtclAWmyZikZ8Etw3NnA/ldKuG4jApbwRb21UFm5gYLrJ4SP4=',
428
+ signaturePss: 'F4xffaANDBjhFxeSJx8ANuBbdhaWZjUHRQh4ueYQMPPCaR2mpwdqxE04sbgNgIiZzBuLIAI4HpTMMoDk3Rruhjefx3+9UhzTxgB0hRI+KzRChRs+ToltWWDZdYzt9T8hfTlELeqT4V8HgjDuteO/IAvIVlRIBwMNv53Iebu1FY4=',
429
+ signatureWithAbcSalt: 'GYA/Zp8G+jqG2Fu7Um+XP7Cr/yaVdzJN8lyt57Lw6gFflia2CPbOVMLyqLzD7fKoE8UD0Rc6DF8k04xhEu60sudw2nxGHeDvpL4M9du0uYra/WSr9kv7xNjAW62NyNerDngHD2J7O8gQ07TZiTXkrfS724vQab5xZL/+FhvisMY=',
430
+ signatureWithCustomPrng: 'LzWcUpUYK+URDp72hJbz1GVEp0rG0LHjd+Pdh2w5rfQFbUThbmXDl3X6DUT5UZr5RjUSHtc2usvH+w49XskyIJJO929sUk9EkMJMK/6QAnYYEp5BA+48pdGNNMZyjIbhyl9Y4lInzFPX8XYMM8o+tdSK+hj+dW5OPdnwWbDtR7U='
431
+ }, {
432
+ keySize: 1025,
433
+ privateKeyPem: '-----BEGIN RSA PRIVATE KEY-----\r\n' +
434
+ 'MIICXgIBAAKBgQGIkej4PDlAigUh5fbbHp1WXuTHhOdQfAke+LoH0TM4uzn0QmgK\r\n' +
435
+ 'SJqxzB1COJ5o0DwZw/NR+CNy7NUrly+vmh2YPwsaqN+AsYBF9qsF93oN8/TBtaL/\r\n' +
436
+ 'GRoRGpDcCglkj1kZnDaWR79NsG8mC0TrvQCkcCLOP0c2Ux1hRbntOetGXwIDAQAB\r\n' +
437
+ 'AoGBAIaJWsoX+ZcAthmT8jHOICXFh6pJBe0zVPzkSPz82Q0MPSRUzcsYbsuYJD7Z\r\n' +
438
+ 'oJBTLQW3feANpjhwqe2ydok7y//ONm3Th53Bcu8jLfoatg4KYxNFIwXEO10mPOld\r\n' +
439
+ 'VuDIGrBkTABe6q2P5PeUKGCKLT6i/u/2OTXTrQiJbQ0gU8thAkEBjqcFivWMXo34\r\n' +
440
+ 'Cb9/EgfWCCtv9edRMexgvcFMysRsbHJHDK9JjRLobZltwtAv3cY7F3a/Cu1afg+g\r\n' +
441
+ 'jAzm5E3gowJBAPwYFHTLzaZToxFKNQztWrPsXF6YfqHpPUUIpT4UzL6DhGG0M00U\r\n' +
442
+ 'qMyhkYRRqmGOSrSovjg2hjM2643MUUWxUxUCQDPkk/khu5L3YglKzyy2rmrD1MAq\r\n' +
443
+ 'y0v3XCR3TBq89Ows+AizrJxbkLvrk/kfBowU6M5GG9o9SWFNgXWZnFittocCQQDT\r\n' +
444
+ 'e1P1419DUFi1UX6NuLTlybx3sxBQvf0jY6xUF1jn3ib5XBXJbTJqcIRF78iyjI9J\r\n' +
445
+ 'XWIugDc20bTsQOJRSAA9AkEBU8kpueHBaiXTikqqlK9wvc2Lp476hgyKVmVyBGye\r\n' +
446
+ '9TLTWkTCzDPtManLy47YtXkXnmyazS+DlKFU61XAGEnZfg==\r\n' +
447
+ '-----END RSA PRIVATE KEY-----\r\n',
448
+ publicKeyPem: '-----BEGIN PUBLIC KEY-----\r\n' +
449
+ 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQGIkej4PDlAigUh5fbbHp1WXuTH\r\n' +
450
+ 'hOdQfAke+LoH0TM4uzn0QmgKSJqxzB1COJ5o0DwZw/NR+CNy7NUrly+vmh2YPwsa\r\n' +
451
+ 'qN+AsYBF9qsF93oN8/TBtaL/GRoRGpDcCglkj1kZnDaWR79NsG8mC0TrvQCkcCLO\r\n' +
452
+ 'P0c2Ux1hRbntOetGXwIDAQAB\r\n' +
453
+ '-----END PUBLIC KEY-----\r\n',
454
+ encrypted: 'AOVeCUN8BOVkZvt4mxyNn/yCYE1MZ40A3e/osh6EvCBcJ09hyYbx7bzKSrdkhRnDyW0pGtgP352CollasllQZ9HlfI2Wy9zKM0aYZZn8OHBA+60Tc3xHHDGznLZqggUKuhoNpj+faVZ1uzb285eTpQQa+4mLUue2svJD4ViM8+ng',
455
+ signature: 'AFSx0axDYXlF2rO3ofgUhYSI8ZlIWtJUUZ62PhgdBp9O5zFqMX3DXoiov1e7NenSOz1khvTSMctFWzKP3GU3F0yewe+Yd3UAZE0dM8vAxigSSfAchUkBDmp9OFuszUie63zwWwpG+gXtvyfueZs1RniBvW1ZmXJvS+HFgX4ouzwd',
456
+ signaturePss: 'AQvBdhAXDpu+7RpcybMgwuTUk6w+qa08Lcq3G1xHY4kC7ZUzauZd/Jn9e0ePKApDqs7eDNAOV+dQkU2wiH/uBg6VGelzb0hFwcpSLyBW92Vw0q3GlzY7myWn8qnNzasrt110zFflWQa1GiuzH/C8f+Z82/MzlWDxloJIYbq2PRC8',
457
+ signatureWithAbcSalt: 'AW4bKnG/0TGvAZgqX5Dk+fXpUNgX7INFelE46d3m+spaMTG5XalY0xP1sxWfaE/+Zl3FmZcfTNtfOCo0eNRO1h1+GZZfp32ZQZmZvkdUG+dUQp318LNzgygrVf/5iIX+QKV5/soSDuAHBzS7yDfMgzJfnXNpFE/zPLOgZIoOIuLq',
458
+ signatureWithCustomPrng: 'AVxfCyGC/7Y3kz//eYFEuWQijjR7eR05AM36CwDlLsVkDRtXoeVzz2yTFBdP+i+QgQ73C/I3lLtvXTwfleorvIX9YncVBeGDQXssmULxzqsM3izaLfJXCRAGx9ErL1Az10+fAqPZpq954OVSDqrR/61Q7CsMY7CiQO3nfIIaxgVL'
459
+ }, {
460
+ keySize: 1031,
461
+ privateKeyPem: '-----BEGIN RSA PRIVATE KEY-----\r\n' +
462
+ 'MIICXwIBAAKBgWyeKqA2oA4klYrKT9hjjutYQksJNN0cxwaQwIm9AYiLxOsYtT/C\r\n' +
463
+ 'ovJx5Oy1EvkbYQbfvYsGISUx9bW8yasZkTHR55IbW3+UptvQjTDtdxBQTgQOpsAh\r\n' +
464
+ 'BJtZYY3OmyH9Sj3F3oB//oyriNoj0QYyfsvlO8UsMmLzpnf6qfZBDHA/9QIDAQAB\r\n' +
465
+ 'AoGBBj/3ne5muUmbnTfU7lOUNrCGaADonMx6G0ObAJHyk6PPOePbEgcmDyNEk+Y7\r\n' +
466
+ 'aEAODjIzmttIbvZ39/Qb+o9nDmCSZC9VxiYPP+rjOzPglCDT5ks2Xcjwzd3If6Ya\r\n' +
467
+ 'Uw6P31Y760OCYeTb4Ib+8zz5q51CkjkdX5Hq/Yu+lZn0Vx7BAkENo83VfL+bwxTm\r\n' +
468
+ 'V7vR6gXqTD5IuuIGHL3uTmMNNURAP6FQDHu//duipys83iMChcOeXtboE16qYrO0\r\n' +
469
+ '9KC0cqL4JQJBB/aYo/auVUGZA6f50YBp0b2slGMk9TBQG0iQefuuSyH4kzKnt2e3\r\n' +
470
+ 'Q40SBmprcM+DfttWJ11bouec++goXjz+95ECQQyiTWYRxulgKVuyqCYnvpLnTEnR\r\n' +
471
+ '0MoYlVTHBriVPkLErYaYCYgse+SNM1+N4p/Thv6KmkUcq/Lmuc5DSRfbl1iBAkEE\r\n' +
472
+ '7GKtJQvd7EO1bfpXnARQx+tWhwHHkgpFBBVHReMZ0rQEFhJ5o2c8HZEiZFNvGO2c\r\n' +
473
+ '1fErP14zlu2JFZ03vpCI8QJBCQz9HL28VNjafSAF2mon/SNjKablRjoGGKSoSdyA\r\n' +
474
+ 'DHDZ/LeRsTp2dg8+bSiG1R+vPqw0f/BT+ux295Sy9ocGEM8=\r\n' +
475
+ '-----END RSA PRIVATE KEY-----\r\n',
476
+ publicKeyPem: '-----BEGIN PUBLIC KEY-----\r\n' +
477
+ 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgWyeKqA2oA4klYrKT9hjjutYQksJ\r\n' +
478
+ 'NN0cxwaQwIm9AYiLxOsYtT/CovJx5Oy1EvkbYQbfvYsGISUx9bW8yasZkTHR55Ib\r\n' +
479
+ 'W3+UptvQjTDtdxBQTgQOpsAhBJtZYY3OmyH9Sj3F3oB//oyriNoj0QYyfsvlO8Us\r\n' +
480
+ 'MmLzpnf6qfZBDHA/9QIDAQAB\r\n' +
481
+ '-----END PUBLIC KEY-----\r\n',
482
+ encrypted: 'ShSS4/fEAkuS6XiQakhOpWp82IXaaCaDNtsndU4uokvriqgCGZyqc+IkIk3eVmZ8bn4vVIRR43ydFuvGgsptVjizOdLGZudph3TJ1clcYEMcCXk4z5HaEu0bx5SW9jmzHhE/z+WV8PB48q7y7C2qtmPmfttG2NMsNLBvkiaDopRO',
483
+ signature: 'Z3vYgRdezrWmdA3NC1Uz2CcHRTcE+/C2idGZA1FjUGqFztAHQ31k0QW/F5zuJdKvg8LQU45S3KxW+OQpbGPL98QbzJLhml88mFGe6OinLXJbi7UQWrtXwamc2jMdiXwovSLbXaXy6PX2QW089iC8XuAZftVi3T/IKV0458FQQprg',
484
+ signaturePss: 'R6QsK6b3QinIPZPamm/dP0Zndqti1TzAkFTRSZJaRSa1u2zuvZC5QHF4flDjEtHosWeDyxrBE7PHGQZ0b1bHv9qgHGsJCMwaQPj3AWj9fjYmx7b86KM2vHr8q/vqDaa9pTvVRSSwvD6fwoZPc9twQEfdjdDBAiy23yLDzk/zZiwM',
485
+ signatureWithAbcSalt: 'Ep9qx4/FPNcWTixWhvL2IAyJR69o5I4MIJi3cMAhDmpuTvAaL/ThQwFWkBPPOPT4Jbumnu6ELjPNjo72wa00e5k64qnZgy1pauBPMlXRlKehRc9UJZ6+xot642z8Qs+rt89OgbYTsvlyr8lzXooUHz/lPpfawYCqd7maRMs8YlYM',
486
+ signatureWithCustomPrng: 'NHAwyn2MdM5ez/WbDNbu2A2JNS+cRiWk/zBoh0lg3aq/RsBS0nrYr4AGiC5jt6KWVcN4AIVOomYtX2k+MhLoemN2t2rDj/+LXOeU7kgCAz0q0ED2NFQz7919JU+PuYXMy03qTMfl5jbvStdi/00eQHjJKGEH+xAgrDcED2lrhtCu'
487
+ }, {
488
+ keySize: 1032,
489
+ privateKeyPem: '-----BEGIN RSA PRIVATE KEY-----\r\n' +
490
+ 'MIICYQIBAAKBggDPhzn5I3GecxWt5DKbP+VhM2AFNSOL0+VbYEOR1hnlZdLbxGK4\r\n' +
491
+ 'cPQzMr2qT6dyttJcsgWr3xKobPkz7vsTZzQATSiekm5Js5dGpaj5lrq/x2+WTZvn\r\n' +
492
+ '55x9M5Y5dlpusDMKcC3KaIX/axc+MbvPFzo6Eli7JLCWdBg01eKo30knil0CAwEA\r\n' +
493
+ 'AQKBggCNl/sjFF7SOD1jbt5kdL0hi7cI9o+xOLs1lEGmAEmc7dNnZN/ibhb/06/6\r\n' +
494
+ 'wuxB5aEz47bg5IvLZMbG+1hNjc26D0J6Y3Ltwrg8f4ZMdDrh4v0DZ8hy/HbEpMrJ\r\n' +
495
+ 'Td5dk3mtw9FLow10MB5udPLTDKhfDpTcWiObKm2STtFeBk3xeEECQQ6Cx6bZxQJ1\r\n' +
496
+ 'zCxflV5Xi8BgAQaUKMqygugte+HpOLflL0j1fuZ0rPosUyDOEFkTzOsPxBYYOU8i\r\n' +
497
+ 'Gzan1GvW3WwRAkEOTTRt849wpgC9xx2pF0IrYEVmv5gEMy3IiRfCNgEoBwpTWVf4\r\n' +
498
+ 'QFpN3V/9GFz0WQEEYo6OTmkNcC3Of5zbHhu1jQJBBGxXAYQ2KnbP4uLL/DMBdYWO\r\n' +
499
+ 'Knw1JvxdLPrYXVejI2MoE7xJj2QXajbirAhEMXL4rtpicj22EmoaE4H7HVgkrJEC\r\n' +
500
+ 'QQq2V5w4AGwvW4TLHXNnYX/eB33z6ujScOuxjGNDUlBqHZja5iKkCUAjnl+UnSPF\r\n' +
501
+ 'exaOwBrlrpiLOzRer94MylKNAkEBmI58bqfkI5OCGDArAsJ0Ih58V0l1UW35C1SX\r\n' +
502
+ '4yDoXSM5A/xQu2BJbXO4jPe3PnDvCVCEyKpbCK6bWbe26Y7zuw==\r\n' +
503
+ '-----END RSA PRIVATE KEY-----\r\n',
504
+ publicKeyPem: '-----BEGIN PUBLIC KEY-----\r\n' +
505
+ 'MIGgMA0GCSqGSIb3DQEBAQUAA4GOADCBigKBggDPhzn5I3GecxWt5DKbP+VhM2AF\r\n' +
506
+ 'NSOL0+VbYEOR1hnlZdLbxGK4cPQzMr2qT6dyttJcsgWr3xKobPkz7vsTZzQATSie\r\n' +
507
+ 'km5Js5dGpaj5lrq/x2+WTZvn55x9M5Y5dlpusDMKcC3KaIX/axc+MbvPFzo6Eli7\r\n' +
508
+ 'JLCWdBg01eKo30knil0CAwEAAQ==\r\n' +
509
+ '-----END PUBLIC KEY-----\r\n',
510
+ encrypted: 'pKTbv+xgXPDc+wbjsANFu1/WTcmy4aZFKXKnxddHbU5S0Dpdj2OqCACiBwu1oENPMgPAJ27XRbFtKG+eS8tX47mKP2Fo0Bi+BPFtzuQ1bj3zUzTwzjemT+PU+a4Tho/eKjPhm6xrwGAoQH2VEDEpvcYf+SRmGFJpJ/zPUrSxgffj',
511
+ signature: 'R9WBFprCfcIC4zY9SmBpEM0E+cr5j4gMn3Ido5mktoR9VBoJqC6eR6lubIPvZZUz9e4yUSYX0squ56Q9Y0yZFQjTHgsrlmhB2YW8kpv4h8P32Oz2TLcMJK9R2tIh9vvyxwBkd/Ml1qG60GnOFUFzxUad9VIlzaF1PFR6EfnkgBUW',
512
+ signaturePss: 'v9UBd4XzBxSRz8yhWKjUkFpBX4Fr2G+ImjqbePL4sAZvYw1tWL+aUQpzG8eOyMxxE703VDh9nIZULYI/uIb9HYHQoGYQ3WoUaWqtZg1x8pZP+Ad7ilUWk5ImRl57fTznNQiVdwlkS5Wgheh1yJCES570a4eujiK9OyB0ba4rKIcM',
513
+ signatureWithAbcSalt: 'HCm0FI1jE6wQgwwi0ZwPTkGjssxAPtRh6tWXhNd2J2IoJYj9oQMMjCEElnvQFBa/l00sIsw2YV1tKyoTABaSTGV4vlJcDF+K0g/wiAf30TRUZo72DZKDNdyffDlH0wBDkNVW+F6uqdciJqBC6zz+unNh7x+FRwYaY8xhudIPXdyP',
514
+ signatureWithCustomPrng: 'AGyN8xu+0yfCR1tyB9mCXcTGb2vdLnsX9ro2Qy5KV6Hw5YMVNltAt65dKR4Y8pfu6D4WUyyJRUtJ8td2ZHYzIVtWY6bG1xFt5rkjTVg4v1tzQgUQq8AHvRE2qLzwDXhazJ1e6Id2Nuxb1uInFyRC6/gLmiPga1WRDEVvFenuIA48'
515
+ }];
516
+ for(var i = 0; i < tests.length; ++i) {
517
+ createTests(tests[i]);
518
+ }
519
+
520
+ it('should ensure maximum message length for a 1024-bit key is exceeded', function() {
521
+ /* For PKCS#1 v1.5, the message must be padded with at least eight bytes,
522
+ two zero bytes and one byte telling what the block type is. This is 11
523
+ extra bytes are added to the message. The test uses a message of 118
524
+ bytes.Together with the 11 extra bytes the encryption block needs to be
525
+ at least 129 bytes long. This requires a key of 1025-bits. */
526
+ var key = PKI.publicKeyFromPem(tests[0].publicKeyPem);
527
+ var message = UTIL.createBuffer().fillWithByte(0, 118);
528
+ ASSERT.throws(function() {
529
+ key.encrypt(message.getBytes());
530
+ });
531
+ });
532
+
533
+ it('should ensure maximum message length for a 1025-bit key is not exceeded', function() {
534
+ var key = PKI.publicKeyFromPem(tests[1].publicKeyPem);
535
+ var message = UTIL.createBuffer().fillWithByte(0, 118);
536
+ ASSERT.doesNotThrow(function() {
537
+ key.encrypt(message.getBytes());
538
+ });
539
+ });
540
+
541
+ /**
542
+ * Creates RSA encryption & decryption tests.
543
+ *
544
+ * Uses different key sizes (1024, 1025, 1031, 1032). The test functions are
545
+ * generated from "templates" below, one for each key size to provide sensible
546
+ * output.
547
+ *
548
+ * Key material in was created with OpenSSL using these commands:
549
+ *
550
+ * openssl genrsa -out rsa_1024_private.pem 1024
551
+ * openssl rsa -in rsa_1024_private.pem -out rsa_1024_public.pem \
552
+ * -outform PEM -pubout
553
+ * echo 'too many secrets' | openssl rsautl -encrypt \
554
+ * -inkey rsa_1024_public.pem -pubin -out rsa_1024_encrypted.bin
555
+ *
556
+ * echo -n 'just testing' | openssl dgst -sha1 -binary > tosign.sha1
557
+ * openssl pkeyutl -sign -in tosign.sha1 -inkey rsa_1024_private.pem \
558
+ * -out rsa_1024_sig.bin -pkeyopt digest:sha1
559
+ * openssl pkeyutl -sign -in tosign.sha1 -inkey rsa_1024_private.pem \
560
+ * -out rsa_1024_sigpss.bin -pkeyopt digest:sha1 \
561
+ * -pkeyopt rsa_padding_mode:pss -pkeyopt rsa_pss_saltlen:20
562
+ *
563
+ * OpenSSL commands for signature verification:
564
+ *
565
+ * openssl pkeyutl -verify -in tosign.sha1 -sigfile rsa_1024_sig.bin \
566
+ * -pubin -inkey rsa_1024_public.pem -pkeyopt digest:sha1
567
+ * openssl pkeyutl -verify -in tosign.sha1 -sigfile rsa_1025_sigpss.bin \
568
+ * -pubin -inkey rsa_1025_public.pem -pkeyopt digest:sha1 \
569
+ * -pkeyopt rsa_padding_mode:pss -pkeyopt rsa_pss_saltlen:20
570
+ */
571
+ function createTests(params) {
572
+ var keySize = params.keySize;
573
+
574
+ it('should rsa encrypt using a ' + keySize + '-bit key', function() {
575
+ var message = 'it need\'s to be about 20% cooler'; // it need's better grammar too
576
+
577
+ /* First step, do public key encryption */
578
+ var key = PKI.publicKeyFromPem(params.publicKeyPem);
579
+ var data = key.encrypt(message);
580
+
581
+ /* Second step, use private key decryption to verify successful
582
+ encryption. The encrypted message differs every time, since it is
583
+ padded with random data. Therefore just rely on the decryption
584
+ routine to work, which is tested separately against an externally
585
+ provided encrypted message. */
586
+ key = PKI.privateKeyFromPem(params.privateKeyPem);
587
+ ASSERT.equal(key.decrypt(data), message);
588
+ });
589
+
590
+ it('should rsa decrypt using a ' + keySize + '-bit key', function() {
591
+ var data = UTIL.decode64(params.encrypted);
592
+ var key = PKI.privateKeyFromPem(params.privateKeyPem);
593
+ ASSERT.equal(key.decrypt(data), 'too many secrets\n');
594
+ });
595
+
596
+ it('should rsa sign using a ' + keySize + '-bit key and PKCS#1 v1.5 padding', function() {
597
+ var key = PKI.privateKeyFromPem(params.privateKeyPem);
598
+
599
+ var md = MD.sha1.create();
600
+ md.start();
601
+ md.update('just testing');
602
+
603
+ var signature = UTIL.decode64(params.signature);
604
+ ASSERT.equal(key.sign(md), signature);
605
+ });
606
+
607
+ it('should verify an rsa signature using a ' + keySize + '-bit key and PKCS#1 v1.5 padding', function() {
608
+ var signature = UTIL.decode64(params.signature);
609
+ var key = PKI.publicKeyFromPem(params.publicKeyPem);
610
+
611
+ var md = MD.sha1.create();
612
+ md.start();
613
+ md.update('just testing');
614
+
615
+ ASSERT.equal(key.verify(md.digest().getBytes(), signature), true);
616
+ });
617
+
618
+ /* Note: signatures are *not* deterministic (the point of RSASSA-PSS),
619
+ so they can't be compared easily -- instead they are just verified
620
+ using the verify() function which is tested against OpenSSL-generated
621
+ signatures. */
622
+ it('should rsa sign using a ' + keySize + '-bit key and PSS padding', function() {
623
+ var privateKey = PKI.privateKeyFromPem(params.privateKeyPem);
624
+ var publicKey = PKI.publicKeyFromPem(params.publicKeyPem);
625
+
626
+ var md = MD.sha1.create();
627
+ md.start();
628
+ md.update('just testing');
629
+
630
+ // create signature
631
+ var pss = PSS.create(
632
+ MD.sha1.create(), MGF.mgf1.create(MD.sha1.create()), 20);
633
+ var signature = privateKey.sign(md, pss);
634
+
635
+ // verify signature
636
+ md.start();
637
+ md.update('just testing');
638
+ ASSERT.equal(
639
+ publicKey.verify(md.digest().getBytes(), signature, pss), true);
640
+ });
641
+
642
+ it('should verify an rsa signature using a ' + keySize + '-bit key and PSS padding', function() {
643
+ var signature = UTIL.decode64(params.signaturePss);
644
+ var key = PKI.publicKeyFromPem(params.publicKeyPem);
645
+
646
+ var md = MD.sha1.create();
647
+ md.start();
648
+ md.update('just testing');
649
+
650
+ var pss = PSS.create(
651
+ MD.sha1.create(), MGF.mgf1.create(MD.sha1.create()), 20);
652
+ ASSERT.equal(
653
+ key.verify(md.digest().getBytes(), signature, pss), true);
654
+ });
655
+
656
+ it('should rsa sign using a ' + keySize + '-bit key and PSS padding using pss named-param API', function() {
657
+ var privateKey = PKI.privateKeyFromPem(params.privateKeyPem);
658
+ var publicKey = PKI.publicKeyFromPem(params.publicKeyPem);
659
+
660
+ var md = MD.sha1.create();
661
+ md.start();
662
+ md.update('just testing');
663
+
664
+ // create signature
665
+ var pss = PSS.create({
666
+ md: MD.sha1.create(),
667
+ mgf: MGF.mgf1.create(MD.sha1.create()),
668
+ saltLength: 20
669
+ });
670
+ var signature = privateKey.sign(md, pss);
671
+
672
+ // verify signature
673
+ md.start();
674
+ md.update('just testing');
675
+ ASSERT.equal(
676
+ publicKey.verify(md.digest().getBytes(), signature, pss), true);
677
+ });
678
+
679
+ it('should verify an rsa signature using a ' + keySize + '-bit key and PSS padding using pss named-param API', function() {
680
+ var signature = UTIL.decode64(params.signaturePss);
681
+ var key = PKI.publicKeyFromPem(params.publicKeyPem);
682
+
683
+ var md = MD.sha1.create();
684
+ md.start();
685
+ md.update('just testing');
686
+
687
+ var pss = PSS.create({
688
+ md: MD.sha1.create(),
689
+ mgf: MGF.mgf1.create(MD.sha1.create()),
690
+ saltLength: 20
691
+ });
692
+ ASSERT.equal(
693
+ key.verify(md.digest().getBytes(), signature, pss), true);
694
+ });
695
+
696
+ it('should rsa sign using a ' + keySize + '-bit key and PSS padding using salt "abc"', function() {
697
+ var privateKey = PKI.privateKeyFromPem(params.privateKeyPem);
698
+
699
+ var md = MD.sha1.create();
700
+ md.start();
701
+ md.update('just testing');
702
+
703
+ // create signature
704
+ var pss = PSS.create({
705
+ md: MD.sha1.create(),
706
+ mgf: MGF.mgf1.create(MD.sha1.create()),
707
+ salt: UTIL.createBuffer('abc')
708
+ });
709
+ var signature = privateKey.sign(md, pss);
710
+ var b64 = UTIL.encode64(signature);
711
+ ASSERT.equal(b64, params.signatureWithAbcSalt);
712
+ });
713
+
714
+ it('should verify an rsa signature using a ' + keySize + '-bit key and PSS padding using salt "abc"', function() {
715
+ var signature = UTIL.decode64(params.signatureWithAbcSalt);
716
+ var key = PKI.publicKeyFromPem(params.publicKeyPem);
717
+
718
+ var md = MD.sha1.create();
719
+ md.start();
720
+ md.update('just testing');
721
+
722
+ var pss = PSS.create({
723
+ md: MD.sha1.create(),
724
+ mgf: MGF.mgf1.create(MD.sha1.create()),
725
+ saltLength: 3
726
+ });
727
+ ASSERT.equal(
728
+ key.verify(md.digest().getBytes(), signature, pss), true);
729
+ });
730
+
731
+ it('should rsa sign using a ' + keySize + '-bit key and PSS padding using custom PRNG', function() {
732
+ var prng = RANDOM.createInstance();
733
+ prng.seedFileSync = function(needed) {
734
+ return UTIL.fillString('a', needed);
735
+ };
736
+ var privateKey = PKI.privateKeyFromPem(params.privateKeyPem);
737
+
738
+ var md = MD.sha1.create();
739
+ md.start();
740
+ md.update('just testing');
741
+
742
+ // create signature
743
+ var pss = PSS.create({
744
+ md: MD.sha1.create(),
745
+ mgf: MGF.mgf1.create(MD.sha1.create()),
746
+ saltLength: 20,
747
+ prng: prng
748
+ });
749
+ var signature = privateKey.sign(md, pss);
750
+ var b64 = UTIL.encode64(signature);
751
+ ASSERT.equal(b64, params.signatureWithCustomPrng);
752
+ });
753
+
754
+ it('should verify an rsa signature using a ' + keySize + '-bit key and PSS padding using custom PRNG', function() {
755
+ var prng = RANDOM.createInstance();
756
+ prng.seedFileSync = function(needed) {
757
+ return UTIL.fillString('a', needed);
758
+ };
759
+ var signature = UTIL.decode64(params.signatureWithCustomPrng);
760
+ var key = PKI.publicKeyFromPem(params.publicKeyPem);
761
+
762
+ var md = MD.sha1.create();
763
+ md.start();
764
+ md.update('just testing');
765
+
766
+ var pss = PSS.create({
767
+ md: MD.sha1.create(),
768
+ mgf: MGF.mgf1.create(MD.sha1.create()),
769
+ saltLength: 20,
770
+ prng: prng
771
+ });
772
+ ASSERT.equal(
773
+ key.verify(md.digest().getBytes(), signature, pss), true);
774
+ });
775
+ }
776
+ })();
777
+
778
+ describe('signature verification', function() {
779
+
780
+ // NOTE: Tests in this section, and associated fixes, are largely derived
781
+ // from a detailed vulnerability report provided by Moosa Yahyazadeh
782
+ // (moosa-yahyazadeh@uiowa.edu).
783
+
784
+ // NOTE: Future updates made the issues here more difficult to trigger
785
+ // with the this code flow. A special testing flag was added to avoid
786
+ // other checks so these tests can continue to exercise other parts of
787
+ // the code that may be trigger in other code paths.
788
+
789
+ // params for tests
790
+
791
+ // public modulus / 256 bytes
792
+ var N = new JSBN.BigInteger(
793
+ 'E932AC92252F585B3A80A4DD76A897C8B7652952FE788F6EC8DD640587A1EE56' +
794
+ '47670A8AD4C2BE0F9FA6E49C605ADF77B5174230AF7BD50E5D6D6D6D28CCF0A8' +
795
+ '86A514CC72E51D209CC772A52EF419F6A953F3135929588EBE9B351FCA61CED7' +
796
+ '8F346FE00DBB6306E5C2A4C6DFC3779AF85AB417371CF34D8387B9B30AE46D7A' +
797
+ '5FF5A655B8D8455F1B94AE736989D60A6F2FD5CADBFFBD504C5A756A2E6BB5CE' +
798
+ 'CC13BCA7503F6DF8B52ACE5C410997E98809DB4DC30D943DE4E812A47553DCE5' +
799
+ '4844A78E36401D13F77DC650619FED88D8B3926E3D8E319C80C744779AC5D6AB' +
800
+ 'E252896950917476ECE5E8FC27D5F053D6018D91B502C4787558A002B9283DA7',
801
+ 16);
802
+
803
+ // private exponent
804
+ var d = new JSBN.BigInteger(
805
+ '009b771db6c374e59227006de8f9c5ba85cf98c63754505f9f30939803afc149' +
806
+ '8eda44b1b1e32c7eb51519edbd9591ea4fce0f8175ca528e09939e48f37088a0' +
807
+ '7059c36332f74368c06884f718c9f8114f1b8d4cb790c63b09d46778bfdc4134' +
808
+ '8fb4cd9feab3d24204992c6dd9ea824fbca591cd64cf68a233ad0526775c9848' +
809
+ 'fafa31528177e1f8df9181a8b945081106fd58bd3d73799b229575c4f3b29101' +
810
+ 'a03ee1f05472b3615784d9244ce0ed639c77e8e212ab52abddf4a928224b6b6f' +
811
+ '74b7114786dd6071bd9113d7870c6b52c0bc8b9c102cfe321dac357e030ed6c5' +
812
+ '80040ca41c13d6b4967811807ef2a225983ea9f88d67faa42620f42a4f5bdbe0' +
813
+ '3b',
814
+ 16);
815
+
816
+ // public exponent
817
+ var e = new JSBN.BigInteger('3');
818
+
819
+ // hash function
820
+ // H = SHA-256 (OID = 0x608648016503040201)
821
+
822
+ // message
823
+ var m = 'hello world!';
824
+
825
+ // to-be-signed RSA PKCS#1 v1.5 signature scheme input structure
826
+ // I
827
+
828
+ // signature value obtained by I^d mod N
829
+ // S
830
+
831
+ function _checkBadTailingGarbage(publicKey, S) {
832
+ var md = MD.sha256.create();
833
+ md.update(m);
834
+
835
+ ASSERT.throws(function() {
836
+ publicKey.verify(md.digest().getBytes(), S, undefined, {
837
+ _skipPaddingChecks: true
838
+ });
839
+ },
840
+ /^Error: Unparsed DER bytes remain after ASN.1 parsing.$/);
841
+ }
842
+
843
+ function _checkBadDigestInfo(publicKey, S, skipTailingGarbage) {
844
+ var md = MD.sha256.create();
845
+ md.update(m);
846
+
847
+ ASSERT.throws(function() {
848
+ publicKey.verify(md.digest().getBytes(), S, undefined, {
849
+ _parseAllDigestBytes: !skipTailingGarbage,
850
+ _skipPaddingChecks: true
851
+ });
852
+ },
853
+ /^Error: ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.$/);
854
+ }
855
+
856
+ function _checkGoodDigestInfo(publicKey, S, skipTailingGarbage) {
857
+ var md = MD.sha256.create();
858
+ md.update(m);
859
+
860
+ ASSERT.ok(publicKey.verify(md.digest().getBytes(), S, undefined, {
861
+ _parseAllDigestBytes: !skipTailingGarbage,
862
+ _skipPaddingChecks: true
863
+ }));
864
+ }
865
+
866
+ it('should check DigestInfo structure', function() {
867
+ var publicKey = RSA.setPublicKey(N, e);
868
+ // 0xff bytes stolen from padding
869
+ // unchecked portion of PKCS#1 encoded message used to forge a
870
+ // signature when low public exponent is being used.
871
+ // See "Bleichenbacher's RSA signature forgery based on implementation
872
+ // error" by Hal Finney
873
+ // https://mailarchive.ietf.org/arch/msg/openpgp/5rnE9ZRN1AokBVj3VqblGlP63QE/
874
+
875
+ // 91 garbage byte injected as the value of a TLV replaced digest
876
+ // algorithm structure
877
+ var I = UTIL.binary.hex.decode(
878
+ '0001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' +
879
+ 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' +
880
+ 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' +
881
+ 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0030' +
882
+ '7f065b8888888888888888888888888888888888888888888888888888888888' +
883
+ '8888888888888888888888888888888888888888888888888888888888888888' +
884
+ '8888888888888888888888888888888888888888888888888888888888880420' +
885
+ '7509e5bda0c762d2bac7f90d758b5b2263fa01ccbc542ab5e3df163be08e6ca9');
886
+ var S = UTIL.binary.hex.decode(
887
+ 'e7410e05bdc38d1c72fab784be41df3d3de2ae83894d9ec86cb5fe343d5dc7d4' +
888
+ '5df2a36fc60363faf32f0d37ab457648af40a48a6c53ae7af0575e92cb1ffc23' +
889
+ '6d55e1325af8c71b3ac313f2630fb498b8e1546093aca1ed56026a96cb525d99' +
890
+ '1159a2d6ccbfd5ef63ae718f8ace2469e357ccf3f6a048bbf9760f5fb36b9dd3' +
891
+ '8fb330eab504f05078b83f5d8bd95dce8fccc6b46babd56f678300f2b39083e5' +
892
+ '3e04e79f503358a6222f8dd66b561fea3a51ecf3be16c9e2ea6ba8aaed9fbe6b' +
893
+ 'a510ff752e4529385f759d4d6120b15f65534248ed5bbb1307a7d0a983832969' +
894
+ '7f5fbae91f48e478dcbb77190f0d173b6cb8b1299cf4202570d25d11a7862b47');
895
+
896
+ _checkBadDigestInfo(publicKey, S);
897
+ });
898
+
899
+ it('should check tailing garbage and DigestInfo [1]', function() {
900
+ var publicKey = RSA.setPublicKey(N, e);
901
+ // bytes stolen from padding and unchecked tailing bytes used to forge
902
+ // a signature when low public exponent is used
903
+
904
+ // 204 tailing garbage bytes injected after DigestInfo structure
905
+ var I = UTIL.binary.hex.decode(
906
+ '000100302f300b060960864801650304020104207509e5bda0c762d2bac7f90d' +
907
+ '758b5b2263fa01ccbc542ab5e3df163be08e6ca9888888888888888888888888' +
908
+ '8888888888888888888888888888888888888888888888888888888888888888' +
909
+ '8888888888888888888888888888888888888888888888888888888888888888' +
910
+ '8888888888888888888888888888888888888888888888888888888888888888' +
911
+ '8888888888888888888888888888888888888888888888888888888888888888' +
912
+ '8888888888888888888888888888888888888888888888888888888888888888' +
913
+ '8888888888888888888888888888888888888888888888888888888888888888');
914
+ var S = UTIL.binary.hex.decode(
915
+ 'c2ad2fa23c246ee98c453d69023e7ec05956b48bd0e287341ba9d342ad49b0ff' +
916
+ 'f2bcbb9adc50f1ccbfc54106305cc74a88db89ff94901a08359893a08426373e' +
917
+ '7949a8794798233445af6c48bc6ccbe278bdeb62c31e40c3bf0014af2faadcc9' +
918
+ 'ed7885756789a5b95c2a355fbb3f04412f42e0f9ed335ab51af8f091a62aaaaf' +
919
+ '6577422220917daaece3ca2f4e66dc4e0574356762592052b406768c31c25cf4' +
920
+ 'c1754e6da9dc3440e238c4f9b25cccc174dd1b17b027e0f9ce2763b86f0e6871' +
921
+ '690ddd018d2e774bc968c9c6e907a000daf5044ba31a0b9eefbd7b4b1ec466d2' +
922
+ '0bc1dd3f020cb1091af6b476416da3024ea046b09fbbbc4d2355da9a2bc6ddb9');
923
+
924
+ _checkBadTailingGarbage(publicKey, S);
925
+ _checkGoodDigestInfo(publicKey, S, true);
926
+ });
927
+
928
+ it('should check tailing garbage and DigestInfo [2]', function() {
929
+ var publicKey = RSA.setPublicKey(N, e);
930
+ // bytes stolen from padding and unchecked tailing bytes used to forge
931
+ // a signature when low public exponent is used
932
+
933
+ // 215 tailing garbage bytes injected after DigestInfo structure
934
+ // unchecked digest algorithm structure
935
+ // combined with earlier issue
936
+ var I = UTIL.binary.hex.decode(
937
+ '0001003024010004207509e5bda0c762d2bac7f90d758b5b2263fa01ccbc542a' +
938
+ 'b5e3df163be08e6ca98888888888888888888888888888888888888888888888' +
939
+ '8888888888888888888888888888888888888888888888888888888888888888' +
940
+ '8888888888888888888888888888888888888888888888888888888888888888' +
941
+ '8888888888888888888888888888888888888888888888888888888888888888' +
942
+ '8888888888888888888888888888888888888888888888888888888888888888' +
943
+ '8888888888888888888888888888888888888888888888888888888888888888' +
944
+ '8888888888888888888888888888888888888888888888888888888888888888');
945
+ var S = UTIL.binary.hex.decode(
946
+ 'a7c5812d7fc0eef766a481aac18c8c48483daf9b5ffb6614bd98ebe4ecb746dd' +
947
+ '493cf5dd2cbe16ecaa0b52109b744930eda49316605fc823fd57a68b5b2c62e8' +
948
+ 'c1b158b26e1547a2e33cdd79427d7c513f07d02261ffe43db197d8cddca2b5b4' +
949
+ '3c1df85aaed6e91aadd44a46bff7f5c70f1acc1a193917e3908444632f30e69c' +
950
+ 'fe95d8036d3b6ad318eefd3952804f16613c969e6d13604bb4e723dfad24c42c' +
951
+ '8d9b5b16a9f5a4b40dcf17b167d319017740f9cc0836436c14d51c3d8a697f1f' +
952
+ 'a2b65196deb5c21b1559c7dea7f598007fa7320909825009f8bf376491c298d8' +
953
+ '155a382e967042db952e995d14b2f961e1b22f911d1b77895def1c7ef229c87e');
954
+
955
+ _checkBadTailingGarbage(publicKey, S);
956
+ _checkBadDigestInfo(publicKey, S, true);
957
+ });
958
+
959
+ it('should check tailing garbage and DigestInfo [e=3]', function() {
960
+ // signature forged without knowledge of private key for given message
961
+ // and low exponent e=3
962
+
963
+ // test data computed from a script
964
+ var N = new JSBN.BigInteger(
965
+ '2943851338959486749023220128247883872673446416188780128906858510' +
966
+ '0507839535636256317277708295678804401391394313946142335874609638' +
967
+ '6660819509361141525748702240343825617847432837639613499808068190' +
968
+ '7802897559477710338828027239284411238090037450817022107555351764' +
969
+ '1170327441791034393719271744724924194371070527213991317221667249' +
970
+ '0779727008421990374037994805699108447010306443226160454080397152' +
971
+ '7839457232809919202392450307767317822761454935119120485180507635' +
972
+ '9472439160130994385433568113626206477097769842080459156024112389' +
973
+ '4062006872333417793816670825914214968706669312685485046743622307' +
974
+ '25756397511775557878046572472650613407143');
975
+ var e = new JSBN.BigInteger('3');
976
+ var publicKey = RSA.setPublicKey(N, e);
977
+
978
+ var S = UTIL.binary.hex.decode(
979
+ '0000000000000000000000000000000000000000000000000000000000000000' +
980
+ '0000000000000000000000000000000000000000000000000000000000000000' +
981
+ '0000000000000000000000000000000000000000000000000000000000000000' +
982
+ '0000000000000000000000000000000000000000000000000000000000000000' +
983
+ '0000000000000000000000000000000000000000000000000000000000000000' +
984
+ '00000000000000000000002853ccc2cd32a8d430dd3bde37e70782ac82cdb7bc' +
985
+ 'e3c044219b50aefd689c20d3b840299f28e2fde6c67c8a7f9e528ac222fae947' +
986
+ 'a6dee0d812e3c3b3452171717396e8bedc3132d92d8317e3593642640d1431ef');
987
+
988
+ _checkBadTailingGarbage(publicKey, S);
989
+ _checkBadDigestInfo(publicKey, S, true);
990
+ });
991
+
992
+ it('should check tailing garbage and DigestInfo [e=5]', function() {
993
+ // signature forged without knowledge of private key for given message
994
+ // and low exponent e=5
995
+
996
+ // test data computed from a script
997
+ var N = new JSBN.BigInteger(
998
+ '2943851338959486749023220128247883872673446416188780128906858510' +
999
+ '0507839535636256317277708295678804401391394313946142335874609638' +
1000
+ '6660819509361141525748702240343825617847432837639613499808068190' +
1001
+ '7802897559477710338828027239284411238090037450817022107555351764' +
1002
+ '1170327441791034393719271744724924194371070527213991317221667249' +
1003
+ '0779727008421990374037994805699108447010306443226160454080397152' +
1004
+ '7839457232809919202392450307767317822761454935119120485180507635' +
1005
+ '9472439160130994385433568113626206477097769842080459156024112389' +
1006
+ '4062006872333417793816670825914214968706669312685485046743622307' +
1007
+ '25756397511775557878046572472650613407143');
1008
+ var e = new JSBN.BigInteger('5');
1009
+ var publicKey = RSA.setPublicKey(N, e);
1010
+
1011
+ var S = UTIL.binary.hex.decode(
1012
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1013
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1014
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1015
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1016
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1017
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1018
+ '000000000000000000000000005475fe2681d7125972bd2c2f2c7ab7b8003b03' +
1019
+ 'd4a487d6dee07c14eb5212a9fe0071b93f84ba5bb4b0cfaf20c976b11d902013');
1020
+
1021
+ _checkBadTailingGarbage(publicKey, S);
1022
+ _checkBadDigestInfo(publicKey, S, true);
1023
+ });
1024
+
1025
+ it('should check tailing garbage and DigestInfo [e=17]', function() {
1026
+ // signature forged without knowledge of private key for given message
1027
+ // and low exponent e=17
1028
+
1029
+ // test data computed from a script
1030
+ var N = new JSBN.BigInteger(
1031
+ '9283656416612985262941143827717696579056959956800096804440022580' +
1032
+ '8979605519224532102091105159037909758713334182004379540747102163' +
1033
+ '0328875171430160513961779154294247563032373839871165519961382202' +
1034
+ '8118288833646515747631246999476620608496831766892861810215014002' +
1035
+ '6197665341672524640393361361575818164897153768964295647456396149' +
1036
+ '0989544033629566558036444831495046301215543198107208071526376318' +
1037
+ '9614817392787691228850316867637768748063173527415482321108924014' +
1038
+ '0172719575883597580010690402077593789150581979877629529469651667' +
1039
+ '0437057465296389148672556848624501468669295285428387365416747516' +
1040
+ '1806526300547653933352115280843297169178217266705491556199868750' +
1041
+ '3004910766820506445410432860104193197231996634882562129969319354' +
1042
+ '2460060799067674344247887198933507132592770898312271636011037138' +
1043
+ '9847292565155151851533347436854797090854109022697775636916157198' +
1044
+ '8470890850961835279273782642105981947430594900197891694944702901' +
1045
+ '0362775778664826653636547333219983468955600305523140183269580452' +
1046
+ '7928125033990422010817859727072181449684606236639224708148897385' +
1047
+ '6473081641220112881037032407068024585466913055187295801749427746' +
1048
+ '8722193869883705529583737211815974801292292728082721785855274147' +
1049
+ '9919792200010181565600099271483749952360303834740314188025547140' +
1050
+ '4368096941701515529809239068018840617766710102093620675455198522' +
1051
+ '9636814788735090951246816765035721775759652424641736739668936540' +
1052
+ '4502328148572893125899985056273755530380627654934084609415976292' +
1053
+ '9123186604266210829116435949633497856328752368587226250956046322' +
1054
+ '5096226739991402761266388226652661345282274508037924611589455395' +
1055
+ '6555120130786293751868059518231813715612891296160287687335835654' +
1056
+ '3979850800254668550551247800296013251153132326459614458561196296' +
1057
+ '9372672455541953777622436993987703564293487820434112162562492086' +
1058
+ '8651475984366477254452308612460939500200990849949906321025068481' +
1059
+ '9019640785570574553040761725312997166593985384222496507953730319' +
1060
+ '8339986953399517682750248394628026225887174258267456078564070387' +
1061
+ '3276539895054169432261639890044193773631304665663877617572725639' +
1062
+ '9608670862191314058068741469812649057261850985814174869283757023' +
1063
+ '5128900627675422927964369356691123905362222855545719945605604307' +
1064
+ '2632528510813096225692258119794268564646732338755890857736163737' +
1065
+ '9885700134409359441713832300526017978115395080312777381770201653' +
1066
+ '4081581157881295739782000814998795398671806283018844936919299070' +
1067
+ '5625387639000374694851356996772485803653791257029031861749956519' +
1068
+ '3846941219138832785295572786934547608717304766525989212989524778' +
1069
+ '5416834855450881318585909376917039');
1070
+ var e = new JSBN.BigInteger('17');
1071
+ var publicKey = RSA.setPublicKey(N, e);
1072
+
1073
+ var S = UTIL.binary.hex.decode(
1074
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1075
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1076
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1077
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1078
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1079
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1080
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1081
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1082
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1083
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1084
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1085
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1086
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1087
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1088
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1089
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1090
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1091
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1092
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1093
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1094
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1095
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1096
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1097
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1098
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1099
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1100
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1101
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1102
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1103
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1104
+ '00000001eb90acbec1bf590ba1e50960db8381fb5bdc363d46379d09956560a6' +
1105
+ '16b88616ce7fa4309dc45f47f5fa47d61bf66baa3d11732ce71768ded295f962');
1106
+
1107
+ _checkBadTailingGarbage(publicKey, S);
1108
+ _checkBadDigestInfo(publicKey, S, true);
1109
+ });
1110
+
1111
+ it('should check DigestInfo type octet [1]', function() {
1112
+ var publicKey = RSA.setPublicKey(N, e);
1113
+ // incorrect value for digest algorithm's type octet
1114
+ // 0x0c instead of correct 0x06
1115
+ var I = UTIL.binary.hex.decode(
1116
+ '0001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' +
1117
+ 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' +
1118
+ 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' +
1119
+ 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' +
1120
+ 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' +
1121
+ 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' +
1122
+ 'ffffffffffffffffffffffff0030310c0d060960864801650304020105000420' +
1123
+ '7509e5bda0c762d2bac7f90d758b5b2263fa01ccbc542ab5e3df163be08e6ca9');
1124
+ var S = UTIL.binary.hex.decode(
1125
+ 'd8298a199e1b6ac18f3c0067a004bd9ff7af87be6ad857d73cc3d24ef06195b8' +
1126
+ '2aaddb0194f8e61fc31453b9163062255e8baf9c480200d0991a5f764f63d5f6' +
1127
+ 'afd283b9cd6afe54f0b7f738707b4eb6b8807539bb627e74db87a50413ab18e5' +
1128
+ '04e37975aad1edc612bc8ecad53b81ea249deb5a2acc27e6419c61ab9acec660' +
1129
+ '8f5ae6a2985ba0b6f42d831bc6cce4b044864154b935cf179967d129e0ad8eda' +
1130
+ '9bfbb638121c3ff13c64d439632e62250d4be928a3deb112ef76a025c5d91805' +
1131
+ '1e601878eac0049fc9d82be9ae3475deb7ca515c830c20b91b7bedf2184fef66' +
1132
+ 'aea0bde62ccd1659afbfd1342322b095309451b1a87e007e640e368fb68a13c9');
1133
+
1134
+ _checkBadDigestInfo(publicKey, S);
1135
+ });
1136
+
1137
+ it('should check DigestInfo type octet [2]', function() {
1138
+ var publicKey = RSA.setPublicKey(N, e);
1139
+ // incorrect value for hash value's type octet
1140
+ // 0x0a instead of correct 0x04
1141
+ var I = UTIL.binary.hex.decode(
1142
+ '0001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' +
1143
+ 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' +
1144
+ 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' +
1145
+ 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' +
1146
+ 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' +
1147
+ 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' +
1148
+ 'ffffffffffffffffffffffff003031300d060960864801650304020105000a20' +
1149
+ '7509e5bda0c762d2bac7f90d758b5b2263fa01ccbc542ab5e3df163be08e6ca9');
1150
+ var S = UTIL.binary.hex.decode(
1151
+ 'c1acdd3aef5f0439c254980295fc0d81b628df00726310a1041d79b5dd94c11d' +
1152
+ '3bcaf0236763c77c25d9ab49522ed2a7d6ea3a4e483a29838acd48f2d60a7902' +
1153
+ '75f4cd46e4b1d09c527a426ec373e8a21746ad3ea541d3b85ba4c303ff793ea8' +
1154
+ 'a0a3458e93a7ec42ed66f675d7c299b0817ac95f7f45b2f48c09b3c070171f31' +
1155
+ 'a33ac789da9943da5dabcda1c95b42531d45484ac1efde0fe0519077debb9318' +
1156
+ '3e63de8f80d7f3cbfecb03cbb44ac4a2d56699e33fca0663b79ca627755fc4fc' +
1157
+ '684b4ab358a0b4ac5b7e9d0cc18b6ab6300b40781502a1c03d34f31dd19d8119' +
1158
+ '5f8a44bc03a2595a706f06f0cb39b8e3f4afe06675fe7439b057f1200a06f4fd');
1159
+
1160
+ _checkBadDigestInfo(publicKey, S);
1161
+ });
1162
+
1163
+ it('should check nested DigestAlgorithm element count', function() {
1164
+ var publicKey = RSA.setPublicKey(N, e);
1165
+ // garbage OCTET STRING injected as an extra, unconsumed child of the
1166
+ // nested DigestInfo.DigestAlgorithm SEQUENCE (after the OID and
1167
+ // NULL). The GHSA-ppp5-5v6c-4jwp / CVE-2026-33894 fix only checks the
1168
+ // element count of the outer DigestInfo SEQUENCE, so this nested
1169
+ // garbage previously passed validation and could be used to forge
1170
+ // signatures for low public exponent keys (e.g. e=3). See #1149 /
1171
+ // CVE-2026-85393.
1172
+ var I = UTIL.binary.hex.decode(
1173
+ '0001ffffffffffffffff003081f23081cd060960864801650304020105000481bd88' +
1174
+ '88888888888888888888888888888888888888888888888888888888888888888888' +
1175
+ '88888888888888888888888888888888888888888888888888888888888888888888' +
1176
+ '88888888888888888888888888888888888888888888888888888888888888888888' +
1177
+ '88888888888888888888888888888888888888888888888888888888888888888888' +
1178
+ '88888888888888888888888888888888888888888888888888888888888888888888' +
1179
+ '88888888888888888888888888888888888804207509e5bda0c762d2bac7f90d758b' +
1180
+ '5b2263fa01ccbc542ab5e3df163be08e6ca9');
1181
+ var S = UTIL.binary.hex.decode(
1182
+ 'a4ae63dd5e7712b78f4870d0f51e294df5503d4f16c5d27ae33370981fb57f0de49f' +
1183
+ '50f3d6a04666774cd984cd13972db9bf8e12bd294ef0ddc916c7c86cbae63efd7b6b' +
1184
+ '97885e69760c208a40f1aecc76a90d7af5145177efce1bb55807a8d05c20b1596753' +
1185
+ 'ba710642fc9acdde6c160232654662c77cc4466c8257a38edb49f894e8845d0fd987' +
1186
+ 'b857ced88f4b62505a080bd87ef700d35d392a6e8f6fde34250c50b86fae606cb551' +
1187
+ '215e8f4813239b77651d5565ad453698c071d48c31e8e526fb4a37610f64b3e1fb8e' +
1188
+ '5be5898e408ad08197a0947794a530b54f84485377ce4a7488ed485ce4e5e105dd89' +
1189
+ '698a472f390c3b1b76bc16b73276c4d1c81d');
1190
+
1191
+ _checkBadDigestInfo(publicKey, S);
1192
+ });
1193
+ });
1194
+
1195
+ describe('GHSA-ppp5-5v6c-4jwp DigestInfo/padding checks', function() {
1196
+ // https://github.com/digitalbazaar/forge/security/advisories/GHSA-ppp5-5v6c-4jwp
1197
+ // test vectors generated from /tests/pocs/ghsa-ppp5-5v6c-4jwp.js
1198
+ var publicKeyPem = '-----BEGIN RSA PUBLIC KEY-----\n' +
1199
+ 'MIICCAKCAgEAw+dqbST8SB6v+is5lOMhrfOWd44qfLsSavTVzA9xRKHNTsXe6PLl\n' +
1200
+ 'di6PLVaYHsnc1OTrJhS8g+NdvTsnR2+oYVFb8DEwp0aS3b9J14Cthm5lXjQH9Nov\n' +
1201
+ '5/57RUbV/eg67hqEPYkUC0X+gMogij8O2D7P4vujk1YHReBSKhKbFKY/GCCvdITp\n' +
1202
+ '1hBDhhgNrRvUCh/4fCJV5Dj5qquYevWAF5HaSogqnBPXdt6mX1S+OluQkq6K5vPC\n' +
1203
+ 'YAImWz8VtazwiTQU8dAuH98uNpbORLQN8Un4Cw1aIHy60LFq7N1fnVrjpKxQRW+d\n' +
1204
+ 'NKlfQM21y/4zL25hv7P1E3tBjzajlCfgbLUrP5janSNNrTOwapMu9XPdWktdNgJ7\n' +
1205
+ 'HAEt3QzXXuWmdPIEPKzu1FrbDoUqhBOcNkD8K+BNnufh9bGKKA9bKJnd7Ubl2QQ7\n' +
1206
+ 'zLHQgXYSZID/nLAFtOqoOmjAXPHrzzyU7y/Z0TBn+rhnFHniRUFXb9T0RPSu7RVH\n' +
1207
+ 'qw01dHm/gHKb3LZeLzf91nur9jD4c0bKNr9kTSI/M5BgdsmfaAZoNZcTuhLCb65t\n' +
1208
+ 'b8iWGvwLoKVNZGYa6s77r8dJc1ZPB2DolB9LEOo1nfwsMk1i8fPb+CvGaihyvaPR\n' +
1209
+ 'GdbiIE6fkCjD8ZW/v5lrOYgpP0x+iwwD3z9ckaXgBpJy1BieHkuLKsUCAQM=\n' +
1210
+ '-----END RSA PUBLIC KEY-----\n';
1211
+ var controlMsg = UTIL.hexToBytes(
1212
+ '636f6e74726f6c2d6d657373616765');
1213
+ var controlSig = UTIL.hexToBytes(
1214
+ '4901e07c1efa0cb738795ece5c25a804a11a2d217cafa2c71ae18bdf0faa9fd5' +
1215
+ '2151c82648108fdad18af6e532417a0c532c667bf325e21730115ab01662f219' +
1216
+ '6cfe39b8b43e14859f69c722d71b19f1ae3ece2147b2ccf302a4150afd6484f1' +
1217
+ '28ba4bf0bc7e5a0b8cd038e65a2b6e19cfda05f014a96335b858121437f4c9e8' +
1218
+ '9ed553a123911bff994c492c6cdc34b2778d85b0c1ac782dec4a1adcb84607ec' +
1219
+ '3628724e1a7f5f4b8eb18ab2a6c26c17964bbcadee0c2cae7056585d7ac6c5ec' +
1220
+ '1a0480600e67acc897ad00154f0dbadd194e22060bf4e967d5cb4a4ecebf8f2a' +
1221
+ '237ca0f4558650c20e3f2dac615594680990f57e4f61aed878dd080336be9825' +
1222
+ 'd11346ff01d4d3b06f776cd0446e2960e78fbd33f18ca0055bf289c3cd5f753d' +
1223
+ 'adff1cf380d58762bbc86910b55afae7fe82da41c07a9c7718d0e75d18a624f1' +
1224
+ '025f001893d4abed98313b3c21689ff4bef182a828400c5b0ba1cdd82ded205e' +
1225
+ '9964f85042692653381eaecb89d5add0b2bebd963ee47bc11e011fde3b744c49' +
1226
+ '62b7025a4449053c2d2505170050cd3bc4b1e1335b6bfedf46d2d997521ca838' +
1227
+ 'dfa3ede4ec99c4eef4a740019c2e122e7f70e7e870b877f7753a08df36a58be5' +
1228
+ '74e4b8a4eec734efacb95e0ee7662c241bc570f6c84a2e65950b6e0d46e882d4' +
1229
+ '76762a8942b34aec9cfad18cd9ee45a4abddaa8c2cbf7d9bbc1523969e4bb3ae');
1230
+ var forgedMsg = UTIL.hexToBytes(
1231
+ '666f726765642d6d6573736167652d30');
1232
+ var forgedSig = UTIL.hexToBytes(
1233
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1234
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1235
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1236
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1237
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1238
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1239
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1240
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1241
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1242
+ '0000000000000000000000000000000000000000000000000000000000000000' +
1243
+ '0000000000000000000000000000000000000000000100102a50a7272393aae1' +
1244
+ 'a1e2496345ec18cce14ae8bc043810aa6951a629873961ca91eb1dbd9e8c211d' +
1245
+ '2a54b77c28ba840ae3c65ba87ce3ec59eb8e81e8559b044559dd2836d8b13b5f' +
1246
+ 'd0674de9c5e5754d3a5a9e77f5f0dcfb1dd6561f5ac15310f0febc7f358988f3' +
1247
+ 'bde09a122ff98c915c0b6171ce938227abc2cdf67b99c21612c161f7905c2066' +
1248
+ 'bb2af4438487d2f1cd4b462c7cf172b31d9f2615a54c6e908e1837b3b7fc09e0');
1249
+
1250
+ it('should check control data', function() {
1251
+ var publicKey = PKI.publicKeyFromPem(publicKeyPem);
1252
+ var md = MD.sha256.create();
1253
+ md.update(controlMsg);
1254
+ ASSERT.ok(publicKey.verify(md.digest().getBytes(), controlSig));
1255
+ });
1256
+ it('should check forged data (normal via padding check)', function() {
1257
+ var publicKey = PKI.publicKeyFromPem(publicKeyPem);
1258
+ var md = MD.sha256.create();
1259
+ md.update(forgedMsg);
1260
+ ASSERT.throws(function() {
1261
+ publicKey.verify(md.digest().getBytes(), forgedSig);
1262
+ },
1263
+ /^Error: Encryption block is invalid.$/);
1264
+ });
1265
+ it('should check forged data (via digestinfo length)', function() {
1266
+ var publicKey = PKI.publicKeyFromPem(publicKeyPem);
1267
+ var md = MD.sha256.create();
1268
+ md.update(forgedMsg);
1269
+ ASSERT.throws(function() {
1270
+ publicKey.verify(md.digest().getBytes(), forgedSig, undefined, {
1271
+ _skipPaddingChecks: true
1272
+ });
1273
+ },
1274
+ /^Error: ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.$/);
1275
+ });
1276
+ });
1277
+ });
1278
+ })();