@hilbras/omnihilbras 2.9.6 → 2.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/.next-cli-build/BUILD_ID +1 -1
- package/app/.next-cli-build/app-path-routes-manifest.json +22 -22
- package/app/.next-cli-build/build-manifest.json +3 -3
- package/app/.next-cli-build/prerender-manifest.json +17 -17
- package/app/.next-cli-build/react-loadable-manifest.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error.html +1 -1
- package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_not-found.html +1 -1
- package/app/.next-cli-build/server/app/_not-found.rsc +4 -4
- package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/api/models/chat/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/route.js +1 -1
- package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/callback.html +1 -1
- package/app/.next-cli-build/server/app/callback.rsc +4 -4
- package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard.html +1 -1
- package/app/.next-cli-build/server/app/dashboard.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/index.html +1 -1
- package/app/.next-cli-build/server/app/index.rsc +4 -4
- package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/landing.html +1 -1
- package/app/.next-cli-build/server/app/landing.rsc +4 -4
- package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/login.html +1 -1
- package/app/.next-cli-build/server/app/login.rsc +4 -4
- package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app-paths-manifest.json +22 -22
- package/app/.next-cli-build/server/chunks/2617.js +1 -1
- package/app/.next-cli-build/server/chunks/412.js +1 -1
- package/app/.next-cli-build/server/chunks/436.js +1 -1
- package/app/.next-cli-build/server/chunks/7431.js +3 -3
- package/app/.next-cli-build/server/chunks/820.js +1 -1
- package/app/.next-cli-build/server/chunks/8287.js +1 -1
- package/app/.next-cli-build/server/chunks/8525.js +1 -1
- package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/app/.next-cli-build/server/middleware-react-loadable-manifest.js +1 -1
- package/app/.next-cli-build/server/pages/404.html +1 -1
- package/app/.next-cli-build/server/pages/500.html +1 -1
- package/app/.next-cli-build/static/chunks/{2723-7d202e913c52264d.js → 2723-6c3362ddd04a22cd.js} +1 -1
- package/app/.next-cli-build/static/chunks/{5497-df32bda6e3c66c2a.js → 5497-e2c10e10b7e013fc.js} +1 -1
- package/app/.next-cli-build/static/chunks/7958-888ab0e64e06ab2f.js +5 -0
- package/app/.next-cli-build/static/chunks/{webpack-2a9ce2c5b55aa5a4.js → webpack-a09b596b791957cc.js} +1 -1
- package/app/.next-cli-build/static/css/747780fc07d59019.css +1 -0
- package/app/node_modules/node-forge/LICENSE +331 -0
- package/app/node_modules/node-forge/README.md +2071 -0
- package/app/node_modules/node-forge/dist/forge.all.min.js +2 -0
- package/app/node_modules/node-forge/dist/forge.all.min.js.map +1 -0
- package/app/node_modules/node-forge/dist/forge.min.js +2 -0
- package/app/node_modules/node-forge/dist/forge.min.js.map +1 -0
- package/app/node_modules/node-forge/dist/prime.worker.min.js +2 -0
- package/app/node_modules/node-forge/dist/prime.worker.min.js.map +1 -0
- package/app/node_modules/node-forge/flash/swf/SocketPool.swf +0 -0
- package/app/node_modules/node-forge/lib/aes.js +1091 -0
- package/app/node_modules/node-forge/lib/aesCipherSuites.js +282 -0
- package/app/node_modules/node-forge/lib/asn1-validator.js +91 -0
- package/app/node_modules/node-forge/lib/asn1.js +1520 -0
- package/app/node_modules/node-forge/lib/baseN.js +186 -0
- package/app/node_modules/node-forge/lib/cipher.js +230 -0
- package/app/node_modules/node-forge/lib/cipherModes.js +999 -0
- package/app/node_modules/node-forge/lib/des.js +496 -0
- package/app/node_modules/node-forge/lib/ed25519.js +1091 -0
- package/app/node_modules/node-forge/lib/forge.js +13 -0
- package/app/node_modules/node-forge/lib/form.js +149 -0
- package/app/node_modules/node-forge/lib/hmac.js +146 -0
- package/app/node_modules/node-forge/lib/http.js +1346 -0
- package/app/node_modules/node-forge/lib/index.all.js +16 -0
- package/app/node_modules/node-forge/lib/index.js +33 -0
- package/app/node_modules/node-forge/lib/jsbn.js +1294 -0
- package/app/node_modules/node-forge/lib/kem.js +168 -0
- package/app/node_modules/node-forge/lib/log.js +319 -0
- package/app/node_modules/node-forge/lib/md.all.js +13 -0
- package/app/node_modules/node-forge/lib/md.js +11 -0
- package/app/node_modules/node-forge/lib/md5.js +289 -0
- package/app/node_modules/node-forge/lib/mgf.js +12 -0
- package/app/node_modules/node-forge/lib/mgf1.js +57 -0
- package/app/node_modules/node-forge/lib/oids.js +180 -0
- package/app/node_modules/node-forge/lib/pbe.js +1023 -0
- package/app/node_modules/node-forge/lib/pbkdf2.js +211 -0
- package/app/node_modules/node-forge/lib/pem.js +237 -0
- package/app/node_modules/node-forge/lib/pkcs1.js +276 -0
- package/app/node_modules/node-forge/lib/pkcs12.js +1078 -0
- package/app/node_modules/node-forge/lib/pkcs7.js +1260 -0
- package/app/node_modules/node-forge/lib/pkcs7asn1.js +410 -0
- package/app/node_modules/node-forge/lib/pki.js +102 -0
- package/app/node_modules/node-forge/lib/prime.js +297 -0
- package/app/node_modules/node-forge/lib/prime.worker.js +168 -0
- package/app/node_modules/node-forge/lib/prng.js +419 -0
- package/app/node_modules/node-forge/lib/pss.js +241 -0
- package/app/node_modules/node-forge/lib/random.js +191 -0
- package/app/node_modules/node-forge/lib/rc2.js +410 -0
- package/app/node_modules/node-forge/lib/rsa.js +1968 -0
- package/app/node_modules/node-forge/lib/sha1.js +319 -0
- package/app/node_modules/node-forge/lib/sha256.js +327 -0
- package/app/node_modules/node-forge/lib/sha512.js +561 -0
- package/app/node_modules/node-forge/lib/socket.js +287 -0
- package/app/node_modules/node-forge/lib/ssh.js +236 -0
- package/app/node_modules/node-forge/lib/tls.js +4282 -0
- package/app/node_modules/node-forge/lib/tlssocket.js +249 -0
- package/app/node_modules/node-forge/lib/util.js +2652 -0
- package/app/node_modules/node-forge/lib/x509.js +3251 -0
- package/app/node_modules/node-forge/lib/xhr.js +738 -0
- package/app/node_modules/node-forge/package.json +123 -0
- package/app/package.json +1 -1
- package/hooks/postinstall.js +22 -0
- package/package.json +3 -2
- package/app/.next-cli-build/static/chunks/7958-316473a002b2e084.js +0 -5
- package/app/.next-cli-build/static/css/73729572c2967c28.css +0 -1
- /package/app/.next-cli-build/static/{50L_O0gZpitHt-drH8zm8 → cZhiw78jUWQGJMmSZolvp}/_buildManifest.js +0 -0
- /package/app/.next-cli-build/static/{50L_O0gZpitHt-drH8zm8 → cZhiw78jUWQGJMmSZolvp}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Javascript implementation of ASN.1 validators for PKCS#7 v1.5.
|
|
3
|
+
*
|
|
4
|
+
* @author Dave Longley
|
|
5
|
+
* @author Stefan Siegl
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2012-2015 Digital Bazaar, Inc.
|
|
8
|
+
* Copyright (c) 2012 Stefan Siegl <stesie@brokenpipe.de>
|
|
9
|
+
*
|
|
10
|
+
* The ASN.1 representation of PKCS#7 is as follows
|
|
11
|
+
* (see RFC #2315 for details, http://www.ietf.org/rfc/rfc2315.txt):
|
|
12
|
+
*
|
|
13
|
+
* A PKCS#7 message consists of a ContentInfo on root level, which may
|
|
14
|
+
* contain any number of further ContentInfo nested into it.
|
|
15
|
+
*
|
|
16
|
+
* ContentInfo ::= SEQUENCE {
|
|
17
|
+
* contentType ContentType,
|
|
18
|
+
* content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* ContentType ::= OBJECT IDENTIFIER
|
|
22
|
+
*
|
|
23
|
+
* EnvelopedData ::= SEQUENCE {
|
|
24
|
+
* version Version,
|
|
25
|
+
* recipientInfos RecipientInfos,
|
|
26
|
+
* encryptedContentInfo EncryptedContentInfo
|
|
27
|
+
* }
|
|
28
|
+
*
|
|
29
|
+
* EncryptedData ::= SEQUENCE {
|
|
30
|
+
* version Version,
|
|
31
|
+
* encryptedContentInfo EncryptedContentInfo
|
|
32
|
+
* }
|
|
33
|
+
*
|
|
34
|
+
* id-signedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
|
|
35
|
+
* us(840) rsadsi(113549) pkcs(1) pkcs7(7) 2 }
|
|
36
|
+
*
|
|
37
|
+
* SignedData ::= SEQUENCE {
|
|
38
|
+
* version INTEGER,
|
|
39
|
+
* digestAlgorithms DigestAlgorithmIdentifiers,
|
|
40
|
+
* contentInfo ContentInfo,
|
|
41
|
+
* certificates [0] IMPLICIT Certificates OPTIONAL,
|
|
42
|
+
* crls [1] IMPLICIT CertificateRevocationLists OPTIONAL,
|
|
43
|
+
* signerInfos SignerInfos
|
|
44
|
+
* }
|
|
45
|
+
*
|
|
46
|
+
* SignerInfos ::= SET OF SignerInfo
|
|
47
|
+
*
|
|
48
|
+
* SignerInfo ::= SEQUENCE {
|
|
49
|
+
* version Version,
|
|
50
|
+
* issuerAndSerialNumber IssuerAndSerialNumber,
|
|
51
|
+
* digestAlgorithm DigestAlgorithmIdentifier,
|
|
52
|
+
* authenticatedAttributes [0] IMPLICIT Attributes OPTIONAL,
|
|
53
|
+
* digestEncryptionAlgorithm DigestEncryptionAlgorithmIdentifier,
|
|
54
|
+
* encryptedDigest EncryptedDigest,
|
|
55
|
+
* unauthenticatedAttributes [1] IMPLICIT Attributes OPTIONAL
|
|
56
|
+
* }
|
|
57
|
+
*
|
|
58
|
+
* EncryptedDigest ::= OCTET STRING
|
|
59
|
+
*
|
|
60
|
+
* Attributes ::= SET OF Attribute
|
|
61
|
+
*
|
|
62
|
+
* Attribute ::= SEQUENCE {
|
|
63
|
+
* attrType OBJECT IDENTIFIER,
|
|
64
|
+
* attrValues SET OF AttributeValue
|
|
65
|
+
* }
|
|
66
|
+
*
|
|
67
|
+
* AttributeValue ::= ANY
|
|
68
|
+
*
|
|
69
|
+
* Version ::= INTEGER
|
|
70
|
+
*
|
|
71
|
+
* RecipientInfos ::= SET OF RecipientInfo
|
|
72
|
+
*
|
|
73
|
+
* EncryptedContentInfo ::= SEQUENCE {
|
|
74
|
+
* contentType ContentType,
|
|
75
|
+
* contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
|
|
76
|
+
* encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL
|
|
77
|
+
* }
|
|
78
|
+
*
|
|
79
|
+
* ContentEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
|
|
80
|
+
*
|
|
81
|
+
* The AlgorithmIdentifier contains an Object Identifier (OID) and parameters
|
|
82
|
+
* for the algorithm, if any. In the case of AES and DES3, there is only one,
|
|
83
|
+
* the IV.
|
|
84
|
+
*
|
|
85
|
+
* AlgorithmIdentifer ::= SEQUENCE {
|
|
86
|
+
* algorithm OBJECT IDENTIFIER,
|
|
87
|
+
* parameters ANY DEFINED BY algorithm OPTIONAL
|
|
88
|
+
* }
|
|
89
|
+
*
|
|
90
|
+
* EncryptedContent ::= OCTET STRING
|
|
91
|
+
*
|
|
92
|
+
* RecipientInfo ::= SEQUENCE {
|
|
93
|
+
* version Version,
|
|
94
|
+
* issuerAndSerialNumber IssuerAndSerialNumber,
|
|
95
|
+
* keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
|
|
96
|
+
* encryptedKey EncryptedKey
|
|
97
|
+
* }
|
|
98
|
+
*
|
|
99
|
+
* IssuerAndSerialNumber ::= SEQUENCE {
|
|
100
|
+
* issuer Name,
|
|
101
|
+
* serialNumber CertificateSerialNumber
|
|
102
|
+
* }
|
|
103
|
+
*
|
|
104
|
+
* CertificateSerialNumber ::= INTEGER
|
|
105
|
+
*
|
|
106
|
+
* KeyEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
|
|
107
|
+
*
|
|
108
|
+
* EncryptedKey ::= OCTET STRING
|
|
109
|
+
*/
|
|
110
|
+
var forge = require('./forge');
|
|
111
|
+
require('./asn1');
|
|
112
|
+
require('./util');
|
|
113
|
+
|
|
114
|
+
// shortcut for ASN.1 API
|
|
115
|
+
var asn1 = forge.asn1;
|
|
116
|
+
|
|
117
|
+
// shortcut for PKCS#7 API
|
|
118
|
+
var p7v = module.exports = forge.pkcs7asn1 = forge.pkcs7asn1 || {};
|
|
119
|
+
forge.pkcs7 = forge.pkcs7 || {};
|
|
120
|
+
forge.pkcs7.asn1 = p7v;
|
|
121
|
+
|
|
122
|
+
var contentInfoValidator = {
|
|
123
|
+
name: 'ContentInfo',
|
|
124
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
125
|
+
type: asn1.Type.SEQUENCE,
|
|
126
|
+
constructed: true,
|
|
127
|
+
value: [{
|
|
128
|
+
name: 'ContentInfo.ContentType',
|
|
129
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
130
|
+
type: asn1.Type.OID,
|
|
131
|
+
constructed: false,
|
|
132
|
+
capture: 'contentType'
|
|
133
|
+
}, {
|
|
134
|
+
name: 'ContentInfo.content',
|
|
135
|
+
tagClass: asn1.Class.CONTEXT_SPECIFIC,
|
|
136
|
+
type: 0,
|
|
137
|
+
constructed: true,
|
|
138
|
+
optional: true,
|
|
139
|
+
captureAsn1: 'content'
|
|
140
|
+
}]
|
|
141
|
+
};
|
|
142
|
+
p7v.contentInfoValidator = contentInfoValidator;
|
|
143
|
+
|
|
144
|
+
var encryptedContentInfoValidator = {
|
|
145
|
+
name: 'EncryptedContentInfo',
|
|
146
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
147
|
+
type: asn1.Type.SEQUENCE,
|
|
148
|
+
constructed: true,
|
|
149
|
+
value: [{
|
|
150
|
+
name: 'EncryptedContentInfo.contentType',
|
|
151
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
152
|
+
type: asn1.Type.OID,
|
|
153
|
+
constructed: false,
|
|
154
|
+
capture: 'contentType'
|
|
155
|
+
}, {
|
|
156
|
+
name: 'EncryptedContentInfo.contentEncryptionAlgorithm',
|
|
157
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
158
|
+
type: asn1.Type.SEQUENCE,
|
|
159
|
+
constructed: true,
|
|
160
|
+
value: [{
|
|
161
|
+
name: 'EncryptedContentInfo.contentEncryptionAlgorithm.algorithm',
|
|
162
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
163
|
+
type: asn1.Type.OID,
|
|
164
|
+
constructed: false,
|
|
165
|
+
capture: 'encAlgorithm'
|
|
166
|
+
}, {
|
|
167
|
+
name: 'EncryptedContentInfo.contentEncryptionAlgorithm.parameter',
|
|
168
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
169
|
+
captureAsn1: 'encParameter'
|
|
170
|
+
}]
|
|
171
|
+
}, {
|
|
172
|
+
name: 'EncryptedContentInfo.encryptedContent',
|
|
173
|
+
tagClass: asn1.Class.CONTEXT_SPECIFIC,
|
|
174
|
+
type: 0,
|
|
175
|
+
/* The PKCS#7 structure output by OpenSSL somewhat differs from what
|
|
176
|
+
* other implementations do generate.
|
|
177
|
+
*
|
|
178
|
+
* OpenSSL generates a structure like this:
|
|
179
|
+
* SEQUENCE {
|
|
180
|
+
* ...
|
|
181
|
+
* [0]
|
|
182
|
+
* 26 DA 67 D2 17 9C 45 3C B1 2A A8 59 2F 29 33 38
|
|
183
|
+
* C3 C3 DF 86 71 74 7A 19 9F 40 D0 29 BE 85 90 45
|
|
184
|
+
* ...
|
|
185
|
+
* }
|
|
186
|
+
*
|
|
187
|
+
* Whereas other implementations (and this PKCS#7 module) generate:
|
|
188
|
+
* SEQUENCE {
|
|
189
|
+
* ...
|
|
190
|
+
* [0] {
|
|
191
|
+
* OCTET STRING
|
|
192
|
+
* 26 DA 67 D2 17 9C 45 3C B1 2A A8 59 2F 29 33 38
|
|
193
|
+
* C3 C3 DF 86 71 74 7A 19 9F 40 D0 29 BE 85 90 45
|
|
194
|
+
* ...
|
|
195
|
+
* }
|
|
196
|
+
* }
|
|
197
|
+
*
|
|
198
|
+
* In order to support both, we just capture the context specific
|
|
199
|
+
* field here. The OCTET STRING bit is removed below.
|
|
200
|
+
*/
|
|
201
|
+
capture: 'encryptedContent',
|
|
202
|
+
captureAsn1: 'encryptedContentAsn1'
|
|
203
|
+
}]
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
p7v.envelopedDataValidator = {
|
|
207
|
+
name: 'EnvelopedData',
|
|
208
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
209
|
+
type: asn1.Type.SEQUENCE,
|
|
210
|
+
constructed: true,
|
|
211
|
+
value: [{
|
|
212
|
+
name: 'EnvelopedData.Version',
|
|
213
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
214
|
+
type: asn1.Type.INTEGER,
|
|
215
|
+
constructed: false,
|
|
216
|
+
capture: 'version'
|
|
217
|
+
}, {
|
|
218
|
+
name: 'EnvelopedData.RecipientInfos',
|
|
219
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
220
|
+
type: asn1.Type.SET,
|
|
221
|
+
constructed: true,
|
|
222
|
+
captureAsn1: 'recipientInfos'
|
|
223
|
+
}].concat(encryptedContentInfoValidator)
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
p7v.encryptedDataValidator = {
|
|
227
|
+
name: 'EncryptedData',
|
|
228
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
229
|
+
type: asn1.Type.SEQUENCE,
|
|
230
|
+
constructed: true,
|
|
231
|
+
value: [{
|
|
232
|
+
name: 'EncryptedData.Version',
|
|
233
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
234
|
+
type: asn1.Type.INTEGER,
|
|
235
|
+
constructed: false,
|
|
236
|
+
capture: 'version'
|
|
237
|
+
}].concat(encryptedContentInfoValidator)
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
var signerValidator = {
|
|
241
|
+
name: 'SignerInfo',
|
|
242
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
243
|
+
type: asn1.Type.SEQUENCE,
|
|
244
|
+
constructed: true,
|
|
245
|
+
value: [{
|
|
246
|
+
name: 'SignerInfo.version',
|
|
247
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
248
|
+
type: asn1.Type.INTEGER,
|
|
249
|
+
constructed: false
|
|
250
|
+
}, {
|
|
251
|
+
name: 'SignerInfo.issuerAndSerialNumber',
|
|
252
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
253
|
+
type: asn1.Type.SEQUENCE,
|
|
254
|
+
constructed: true,
|
|
255
|
+
value: [{
|
|
256
|
+
name: 'SignerInfo.issuerAndSerialNumber.issuer',
|
|
257
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
258
|
+
type: asn1.Type.SEQUENCE,
|
|
259
|
+
constructed: true,
|
|
260
|
+
captureAsn1: 'issuer'
|
|
261
|
+
}, {
|
|
262
|
+
name: 'SignerInfo.issuerAndSerialNumber.serialNumber',
|
|
263
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
264
|
+
type: asn1.Type.INTEGER,
|
|
265
|
+
constructed: false,
|
|
266
|
+
capture: 'serial'
|
|
267
|
+
}]
|
|
268
|
+
}, {
|
|
269
|
+
name: 'SignerInfo.digestAlgorithm',
|
|
270
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
271
|
+
type: asn1.Type.SEQUENCE,
|
|
272
|
+
constructed: true,
|
|
273
|
+
value: [{
|
|
274
|
+
name: 'SignerInfo.digestAlgorithm.algorithm',
|
|
275
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
276
|
+
type: asn1.Type.OID,
|
|
277
|
+
constructed: false,
|
|
278
|
+
capture: 'digestAlgorithm'
|
|
279
|
+
}, {
|
|
280
|
+
name: 'SignerInfo.digestAlgorithm.parameter',
|
|
281
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
282
|
+
constructed: false,
|
|
283
|
+
captureAsn1: 'digestParameter',
|
|
284
|
+
optional: true
|
|
285
|
+
}]
|
|
286
|
+
}, {
|
|
287
|
+
name: 'SignerInfo.authenticatedAttributes',
|
|
288
|
+
tagClass: asn1.Class.CONTEXT_SPECIFIC,
|
|
289
|
+
type: 0,
|
|
290
|
+
constructed: true,
|
|
291
|
+
optional: true,
|
|
292
|
+
capture: 'authenticatedAttributes'
|
|
293
|
+
}, {
|
|
294
|
+
name: 'SignerInfo.digestEncryptionAlgorithm',
|
|
295
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
296
|
+
type: asn1.Type.SEQUENCE,
|
|
297
|
+
constructed: true,
|
|
298
|
+
capture: 'signatureAlgorithm'
|
|
299
|
+
}, {
|
|
300
|
+
name: 'SignerInfo.encryptedDigest',
|
|
301
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
302
|
+
type: asn1.Type.OCTETSTRING,
|
|
303
|
+
constructed: false,
|
|
304
|
+
capture: 'signature'
|
|
305
|
+
}, {
|
|
306
|
+
name: 'SignerInfo.unauthenticatedAttributes',
|
|
307
|
+
tagClass: asn1.Class.CONTEXT_SPECIFIC,
|
|
308
|
+
type: 1,
|
|
309
|
+
constructed: true,
|
|
310
|
+
optional: true,
|
|
311
|
+
capture: 'unauthenticatedAttributes'
|
|
312
|
+
}]
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
p7v.signedDataValidator = {
|
|
316
|
+
name: 'SignedData',
|
|
317
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
318
|
+
type: asn1.Type.SEQUENCE,
|
|
319
|
+
constructed: true,
|
|
320
|
+
value: [{
|
|
321
|
+
name: 'SignedData.Version',
|
|
322
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
323
|
+
type: asn1.Type.INTEGER,
|
|
324
|
+
constructed: false,
|
|
325
|
+
capture: 'version'
|
|
326
|
+
}, {
|
|
327
|
+
name: 'SignedData.DigestAlgorithms',
|
|
328
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
329
|
+
type: asn1.Type.SET,
|
|
330
|
+
constructed: true,
|
|
331
|
+
captureAsn1: 'digestAlgorithms'
|
|
332
|
+
},
|
|
333
|
+
contentInfoValidator,
|
|
334
|
+
{
|
|
335
|
+
name: 'SignedData.Certificates',
|
|
336
|
+
tagClass: asn1.Class.CONTEXT_SPECIFIC,
|
|
337
|
+
type: 0,
|
|
338
|
+
optional: true,
|
|
339
|
+
captureAsn1: 'certificates'
|
|
340
|
+
}, {
|
|
341
|
+
name: 'SignedData.CertificateRevocationLists',
|
|
342
|
+
tagClass: asn1.Class.CONTEXT_SPECIFIC,
|
|
343
|
+
type: 1,
|
|
344
|
+
optional: true,
|
|
345
|
+
captureAsn1: 'crls'
|
|
346
|
+
}, {
|
|
347
|
+
name: 'SignedData.SignerInfos',
|
|
348
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
349
|
+
type: asn1.Type.SET,
|
|
350
|
+
capture: 'signerInfos',
|
|
351
|
+
optional: true,
|
|
352
|
+
value: [signerValidator]
|
|
353
|
+
}]
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
p7v.recipientInfoValidator = {
|
|
357
|
+
name: 'RecipientInfo',
|
|
358
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
359
|
+
type: asn1.Type.SEQUENCE,
|
|
360
|
+
constructed: true,
|
|
361
|
+
value: [{
|
|
362
|
+
name: 'RecipientInfo.version',
|
|
363
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
364
|
+
type: asn1.Type.INTEGER,
|
|
365
|
+
constructed: false,
|
|
366
|
+
capture: 'version'
|
|
367
|
+
}, {
|
|
368
|
+
name: 'RecipientInfo.issuerAndSerial',
|
|
369
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
370
|
+
type: asn1.Type.SEQUENCE,
|
|
371
|
+
constructed: true,
|
|
372
|
+
value: [{
|
|
373
|
+
name: 'RecipientInfo.issuerAndSerial.issuer',
|
|
374
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
375
|
+
type: asn1.Type.SEQUENCE,
|
|
376
|
+
constructed: true,
|
|
377
|
+
captureAsn1: 'issuer'
|
|
378
|
+
}, {
|
|
379
|
+
name: 'RecipientInfo.issuerAndSerial.serialNumber',
|
|
380
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
381
|
+
type: asn1.Type.INTEGER,
|
|
382
|
+
constructed: false,
|
|
383
|
+
capture: 'serial'
|
|
384
|
+
}]
|
|
385
|
+
}, {
|
|
386
|
+
name: 'RecipientInfo.keyEncryptionAlgorithm',
|
|
387
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
388
|
+
type: asn1.Type.SEQUENCE,
|
|
389
|
+
constructed: true,
|
|
390
|
+
value: [{
|
|
391
|
+
name: 'RecipientInfo.keyEncryptionAlgorithm.algorithm',
|
|
392
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
393
|
+
type: asn1.Type.OID,
|
|
394
|
+
constructed: false,
|
|
395
|
+
capture: 'encAlgorithm'
|
|
396
|
+
}, {
|
|
397
|
+
name: 'RecipientInfo.keyEncryptionAlgorithm.parameter',
|
|
398
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
399
|
+
constructed: false,
|
|
400
|
+
captureAsn1: 'encParameter',
|
|
401
|
+
optional: true
|
|
402
|
+
}]
|
|
403
|
+
}, {
|
|
404
|
+
name: 'RecipientInfo.encryptedKey',
|
|
405
|
+
tagClass: asn1.Class.UNIVERSAL,
|
|
406
|
+
type: asn1.Type.OCTETSTRING,
|
|
407
|
+
constructed: false,
|
|
408
|
+
capture: 'encKey'
|
|
409
|
+
}]
|
|
410
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Javascript implementation of a basic Public Key Infrastructure, including
|
|
3
|
+
* support for RSA public and private keys.
|
|
4
|
+
*
|
|
5
|
+
* @author Dave Longley
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2010-2013 Digital Bazaar, Inc.
|
|
8
|
+
*/
|
|
9
|
+
var forge = require('./forge');
|
|
10
|
+
require('./asn1');
|
|
11
|
+
require('./oids');
|
|
12
|
+
require('./pbe');
|
|
13
|
+
require('./pem');
|
|
14
|
+
require('./pbkdf2');
|
|
15
|
+
require('./pkcs12');
|
|
16
|
+
require('./pss');
|
|
17
|
+
require('./rsa');
|
|
18
|
+
require('./util');
|
|
19
|
+
require('./x509');
|
|
20
|
+
|
|
21
|
+
// shortcut for asn.1 API
|
|
22
|
+
var asn1 = forge.asn1;
|
|
23
|
+
|
|
24
|
+
/* Public Key Infrastructure (PKI) implementation. */
|
|
25
|
+
var pki = module.exports = forge.pki = forge.pki || {};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* NOTE: THIS METHOD IS DEPRECATED. Use pem.decode() instead.
|
|
29
|
+
*
|
|
30
|
+
* Converts PEM-formatted data to DER.
|
|
31
|
+
*
|
|
32
|
+
* @param pem the PEM-formatted data.
|
|
33
|
+
*
|
|
34
|
+
* @return the DER-formatted data.
|
|
35
|
+
*/
|
|
36
|
+
pki.pemToDer = function(pem) {
|
|
37
|
+
var msg = forge.pem.decode(pem)[0];
|
|
38
|
+
if(msg.procType && msg.procType.type === 'ENCRYPTED') {
|
|
39
|
+
throw new Error('Could not convert PEM to DER; PEM is encrypted.');
|
|
40
|
+
}
|
|
41
|
+
return forge.util.createBuffer(msg.body);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Converts an RSA private key from PEM format.
|
|
46
|
+
*
|
|
47
|
+
* @param pem the PEM-formatted private key.
|
|
48
|
+
*
|
|
49
|
+
* @return the private key.
|
|
50
|
+
*/
|
|
51
|
+
pki.privateKeyFromPem = function(pem) {
|
|
52
|
+
var msg = forge.pem.decode(pem)[0];
|
|
53
|
+
|
|
54
|
+
if(msg.type !== 'PRIVATE KEY' && msg.type !== 'RSA PRIVATE KEY') {
|
|
55
|
+
var error = new Error('Could not convert private key from PEM; PEM ' +
|
|
56
|
+
'header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');
|
|
57
|
+
error.headerType = msg.type;
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
if(msg.procType && msg.procType.type === 'ENCRYPTED') {
|
|
61
|
+
throw new Error('Could not convert private key from PEM; PEM is encrypted.');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// convert DER to ASN.1 object
|
|
65
|
+
var obj = asn1.fromDer(msg.body);
|
|
66
|
+
|
|
67
|
+
return pki.privateKeyFromAsn1(obj);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Converts an RSA private key to PEM format.
|
|
72
|
+
*
|
|
73
|
+
* @param key the private key.
|
|
74
|
+
* @param maxline the maximum characters per line, defaults to 64.
|
|
75
|
+
*
|
|
76
|
+
* @return the PEM-formatted private key.
|
|
77
|
+
*/
|
|
78
|
+
pki.privateKeyToPem = function(key, maxline) {
|
|
79
|
+
// convert to ASN.1, then DER, then PEM-encode
|
|
80
|
+
var msg = {
|
|
81
|
+
type: 'RSA PRIVATE KEY',
|
|
82
|
+
body: asn1.toDer(pki.privateKeyToAsn1(key)).getBytes()
|
|
83
|
+
};
|
|
84
|
+
return forge.pem.encode(msg, {maxline: maxline});
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Converts a PrivateKeyInfo to PEM format.
|
|
89
|
+
*
|
|
90
|
+
* @param pki the PrivateKeyInfo.
|
|
91
|
+
* @param maxline the maximum characters per line, defaults to 64.
|
|
92
|
+
*
|
|
93
|
+
* @return the PEM-formatted private key.
|
|
94
|
+
*/
|
|
95
|
+
pki.privateKeyInfoToPem = function(pki, maxline) {
|
|
96
|
+
// convert to DER, then PEM-encode
|
|
97
|
+
var msg = {
|
|
98
|
+
type: 'PRIVATE KEY',
|
|
99
|
+
body: asn1.toDer(pki).getBytes()
|
|
100
|
+
};
|
|
101
|
+
return forge.pem.encode(msg, {maxline: maxline});
|
|
102
|
+
};
|