@peculiar/certificates-viewer 4.2.1 → 4.3.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 (227) hide show
  1. package/components/attribute-certificate-viewer.js +17 -14
  2. package/components/attribute-certificate-viewer.js.map +1 -1
  3. package/components/attribute.js +53 -0
  4. package/components/attribute.js.map +1 -0
  5. package/components/certificate-viewer.js +15 -13
  6. package/components/certificate-viewer.js.map +1 -1
  7. package/components/crl-viewer.js +20 -18
  8. package/components/crl-viewer.js.map +1 -1
  9. package/components/csr-viewer.js +9 -99
  10. package/components/csr-viewer.js.map +1 -1
  11. package/components/download.js +12518 -9
  12. package/components/download.js.map +1 -1
  13. package/components/index.js +2 -0
  14. package/components/index.js.map +1 -1
  15. package/components/index2.js +3 -48
  16. package/components/index2.js.map +1 -1
  17. package/components/issuer_name.js +2 -2
  18. package/components/miscellaneous.js +41 -12555
  19. package/components/miscellaneous.js.map +1 -1
  20. package/components/peculiar-certificate-decoder.js +17 -105
  21. package/components/peculiar-certificate-decoder.js.map +1 -1
  22. package/components/peculiar-certificates-viewer.js +1 -2
  23. package/components/peculiar-certificates-viewer.js.map +1 -1
  24. package/components/peculiar-crl-viewer.js +1 -1
  25. package/components/peculiar-csr-viewer.js +1 -1
  26. package/components/pkcs10_certificate_request.js +102 -0
  27. package/components/pkcs10_certificate_request.js.map +1 -0
  28. package/components/read_file.js +110 -0
  29. package/components/read_file.js.map +1 -0
  30. package/components/subject_name.js +2 -2
  31. package/dist/cjs/{certification_request-b0d72620.js → certification_request-314859bb.js} +3266 -2810
  32. package/dist/cjs/certification_request-314859bb.js.map +1 -0
  33. package/dist/cjs/index.cjs.js +12 -5
  34. package/dist/cjs/index.cjs.js.map +1 -1
  35. package/dist/cjs/{miscellaneous-dcb93a5b.js → miscellaneous-f1bc3a4b.js} +22 -23
  36. package/dist/cjs/miscellaneous-f1bc3a4b.js.map +1 -0
  37. package/dist/cjs/peculiar-attribute-certificate-viewer_3.cjs.entry.js +20 -20
  38. package/dist/cjs/peculiar-attribute-certificate-viewer_3.cjs.entry.js.map +1 -1
  39. package/dist/cjs/peculiar-certificate-decoder.cjs.entry.js +20 -108
  40. package/dist/cjs/peculiar-certificate-decoder.cjs.entry.js.map +1 -1
  41. package/dist/cjs/peculiar-certificate-viewer.cjs.entry.js +3 -4
  42. package/dist/cjs/peculiar-certificate-viewer.cjs.entry.js.map +1 -1
  43. package/dist/cjs/peculiar-certificates-viewer.cjs.entry.js +2 -3
  44. package/dist/cjs/peculiar-certificates-viewer.cjs.entry.js.map +1 -1
  45. package/dist/cjs/pkcs10_certificate_request-93c66ce7.js +149 -0
  46. package/dist/cjs/pkcs10_certificate_request-93c66ce7.js.map +1 -0
  47. package/dist/cjs/read_file-2e22a97e.js +115 -0
  48. package/dist/cjs/read_file-2e22a97e.js.map +1 -0
  49. package/dist/cjs/{x509_certificate-ebf4cbd4.js → x509_certificate-0776e3ec.js} +17 -16
  50. package/dist/cjs/x509_certificate-0776e3ec.js.map +1 -0
  51. package/dist/cjs/x509_crl-5326d209.js +179 -0
  52. package/dist/cjs/x509_crl-5326d209.js.map +1 -0
  53. package/dist/collection/components/certificate-decoder/certificate-decoder.js +15 -72
  54. package/dist/collection/components/certificate-decoder/certificate-decoder.js.map +1 -1
  55. package/dist/collection/components/certificate-details-parts/miscellaneous.js.map +1 -1
  56. package/dist/collection/components/crl-viewer/crl-viewer.js +6 -6
  57. package/dist/collection/components/crl-viewer/crl-viewer.js.map +1 -1
  58. package/dist/collection/components/csr-viewer/csr-viewer.js +6 -6
  59. package/dist/collection/components/csr-viewer/csr-viewer.js.map +1 -1
  60. package/dist/collection/constants/oids.js +3 -0
  61. package/dist/collection/constants/oids.js.map +1 -1
  62. package/dist/collection/crypto/index.js +2 -2
  63. package/dist/collection/crypto/index.js.map +1 -1
  64. package/dist/collection/crypto/{csr.js → pkcs10_certificate_request.js} +14 -12
  65. package/dist/collection/crypto/pkcs10_certificate_request.js.map +1 -0
  66. package/dist/collection/crypto/x509_attribute_certificate.js +13 -11
  67. package/dist/collection/crypto/x509_attribute_certificate.js.map +1 -1
  68. package/dist/collection/crypto/x509_certificate.js +13 -11
  69. package/dist/collection/crypto/x509_certificate.js.map +1 -1
  70. package/dist/collection/crypto/{crl.js → x509_crl.js} +14 -12
  71. package/dist/collection/crypto/x509_crl.js.map +1 -0
  72. package/dist/collection/index.js +2 -0
  73. package/dist/collection/index.js.map +1 -1
  74. package/dist/collection/utils/download.js +8 -8
  75. package/dist/collection/utils/download.js.map +1 -1
  76. package/dist/collection/utils/validator.js +0 -8
  77. package/dist/collection/utils/validator.js.map +1 -1
  78. package/dist/esm/{certification_request-2c054ece.js → certification_request-b531916a.js} +3202 -2745
  79. package/dist/esm/certification_request-b531916a.js.map +1 -0
  80. package/dist/esm/index.js +3 -1
  81. package/dist/esm/index.js.map +1 -1
  82. package/dist/esm/{miscellaneous-0e98b5bc.js → miscellaneous-7fe71e3f.js} +2 -3
  83. package/dist/esm/miscellaneous-7fe71e3f.js.map +1 -0
  84. package/dist/esm/peculiar-attribute-certificate-viewer_3.entry.js +12 -12
  85. package/dist/esm/peculiar-attribute-certificate-viewer_3.entry.js.map +1 -1
  86. package/dist/esm/peculiar-certificate-decoder.entry.js +18 -106
  87. package/dist/esm/peculiar-certificate-decoder.entry.js.map +1 -1
  88. package/dist/esm/peculiar-certificate-viewer.entry.js +3 -4
  89. package/dist/esm/peculiar-certificate-viewer.entry.js.map +1 -1
  90. package/dist/esm/peculiar-certificates-viewer.entry.js +2 -3
  91. package/dist/esm/peculiar-certificates-viewer.entry.js.map +1 -1
  92. package/dist/esm/pkcs10_certificate_request-cca2ca68.js +146 -0
  93. package/dist/esm/pkcs10_certificate_request-cca2ca68.js.map +1 -0
  94. package/dist/esm/read_file-bb0b1450.js +110 -0
  95. package/dist/esm/read_file-bb0b1450.js.map +1 -0
  96. package/dist/esm/{x509_certificate-ad568d3a.js → x509_certificate-050175dd.js} +15 -14
  97. package/dist/esm/x509_certificate-050175dd.js.map +1 -0
  98. package/dist/esm/x509_crl-c497f907.js +176 -0
  99. package/dist/esm/x509_crl-c497f907.js.map +1 -0
  100. package/dist/esm-es5/{certification_request-2c054ece.js → certification_request-b531916a.js} +61 -23
  101. package/dist/esm-es5/certification_request-b531916a.js.map +1 -0
  102. package/dist/esm-es5/index.js +1 -1
  103. package/dist/esm-es5/{miscellaneous-0e98b5bc.js → miscellaneous-7fe71e3f.js} +2 -2
  104. package/dist/esm-es5/{miscellaneous-0e98b5bc.js.map → miscellaneous-7fe71e3f.js.map} +1 -1
  105. package/dist/esm-es5/peculiar-attribute-certificate-viewer_3.entry.js +2 -2
  106. package/dist/esm-es5/peculiar-attribute-certificate-viewer_3.entry.js.map +1 -1
  107. package/dist/esm-es5/peculiar-certificate-decoder.entry.js +2 -9
  108. package/dist/esm-es5/peculiar-certificate-decoder.entry.js.map +1 -1
  109. package/dist/esm-es5/peculiar-certificate-viewer.entry.js +2 -2
  110. package/dist/esm-es5/peculiar-certificate-viewer.entry.js.map +1 -1
  111. package/dist/esm-es5/peculiar-certificates-viewer.entry.js +1 -1
  112. package/dist/esm-es5/pkcs10_certificate_request-cca2ca68.js +19 -0
  113. package/dist/esm-es5/pkcs10_certificate_request-cca2ca68.js.map +1 -0
  114. package/dist/esm-es5/read_file-bb0b1450.js +12 -0
  115. package/dist/esm-es5/read_file-bb0b1450.js.map +1 -0
  116. package/dist/esm-es5/x509_certificate-050175dd.js +12 -0
  117. package/dist/esm-es5/x509_certificate-050175dd.js.map +1 -0
  118. package/dist/esm-es5/x509_crl-c497f907.js +19 -0
  119. package/dist/esm-es5/x509_crl-c497f907.js.map +1 -0
  120. package/dist/peculiar/index.esm.js +1 -1
  121. package/dist/peculiar/p-05af3b74.system.js +13 -0
  122. package/dist/peculiar/p-05af3b74.system.js.map +1 -0
  123. package/dist/peculiar/p-163a3052.system.js +20 -0
  124. package/dist/peculiar/p-163a3052.system.js.map +1 -0
  125. package/dist/peculiar/p-25a532a3.js +12 -0
  126. package/dist/peculiar/p-25a532a3.js.map +1 -0
  127. package/dist/peculiar/{p-5cf4562f.system.entry.js → p-2d9c40d6.system.entry.js} +16 -16
  128. package/dist/peculiar/p-2d9c40d6.system.entry.js.map +1 -0
  129. package/dist/peculiar/p-494d26fb.entry.js +5 -0
  130. package/dist/peculiar/p-494d26fb.entry.js.map +1 -0
  131. package/dist/peculiar/{p-ff3ced3c.system.js → p-52f13c4a.system.js} +45 -45
  132. package/dist/peculiar/{p-ff3ced3c.system.js.map → p-52f13c4a.system.js.map} +1 -1
  133. package/dist/peculiar/p-55303453.system.js +12 -0
  134. package/dist/peculiar/p-55303453.system.js.map +1 -0
  135. package/dist/peculiar/p-5a699274.js +19 -0
  136. package/dist/peculiar/p-5a699274.js.map +1 -0
  137. package/dist/peculiar/p-6221d0a4.system.entry.js +5 -0
  138. package/dist/peculiar/p-6221d0a4.system.entry.js.map +1 -0
  139. package/dist/peculiar/p-666438a8.js +135 -0
  140. package/dist/peculiar/p-666438a8.js.map +1 -0
  141. package/dist/peculiar/{p-c23fd001.entry.js → p-7a5173be.entry.js} +16 -16
  142. package/dist/peculiar/p-7a5173be.entry.js.map +1 -0
  143. package/dist/peculiar/p-80477c05.js +12 -0
  144. package/dist/peculiar/p-80477c05.js.map +1 -0
  145. package/dist/peculiar/p-8393399a.system.js +1 -1
  146. package/dist/peculiar/p-8ff95ad8.entry.js +5 -0
  147. package/dist/peculiar/{p-54b37ef9.entry.js.map → p-8ff95ad8.entry.js.map} +1 -1
  148. package/dist/peculiar/p-a06f51a2.system.js +19 -0
  149. package/dist/peculiar/p-a06f51a2.system.js.map +1 -0
  150. package/dist/peculiar/{p-75166532.js → p-adf16adb.js} +21 -21
  151. package/dist/peculiar/{p-75166532.js.map → p-adf16adb.js.map} +1 -1
  152. package/dist/peculiar/p-b6d5e413.js +19 -0
  153. package/dist/peculiar/p-b6d5e413.js.map +1 -0
  154. package/dist/peculiar/p-bd7fb688.system.entry.js +5 -0
  155. package/dist/peculiar/{p-00302a20.system.entry.js.map → p-bd7fb688.system.entry.js.map} +1 -1
  156. package/dist/peculiar/{p-496449cf.system.entry.js → p-cc256004.system.entry.js} +2 -2
  157. package/dist/peculiar/p-d1066b51.system.js +135 -0
  158. package/dist/peculiar/p-d1066b51.system.js.map +1 -0
  159. package/dist/peculiar/p-d6229f42.system.js +5 -0
  160. package/dist/peculiar/{p-5f3b0fc7.entry.js → p-ddadcb44.entry.js} +3 -3
  161. package/dist/peculiar/peculiar.esm.js +1 -1
  162. package/dist/types/components/certificate-decoder/certificate-decoder.d.ts +3 -3
  163. package/dist/types/components/certificate-details-parts/miscellaneous.d.ts +2 -2
  164. package/dist/types/components/crl-viewer/crl-viewer.d.ts +2 -2
  165. package/dist/types/components/csr-viewer/csr-viewer.d.ts +2 -2
  166. package/dist/types/constants/oids.d.ts +3 -0
  167. package/dist/types/crypto/index.d.ts +2 -2
  168. package/dist/types/crypto/{csr.d.ts → pkcs10_certificate_request.d.ts} +4 -5
  169. package/dist/types/crypto/x509_attribute_certificate.d.ts +3 -4
  170. package/dist/types/crypto/x509_certificate.d.ts +3 -4
  171. package/dist/types/crypto/{crl.d.ts → x509_crl.d.ts} +4 -5
  172. package/dist/types/index.d.ts +2 -0
  173. package/dist/types/utils/download.d.ts +4 -4
  174. package/dist/types/utils/validator.d.ts +0 -4
  175. package/hydrate/index.js +84 -138
  176. package/package.json +4 -4
  177. package/dist/cjs/certification_request-b0d72620.js.map +0 -1
  178. package/dist/cjs/crl-812dd7a1.js +0 -312
  179. package/dist/cjs/crl-812dd7a1.js.map +0 -1
  180. package/dist/cjs/download-6f550549.js +0 -476
  181. package/dist/cjs/download-6f550549.js.map +0 -1
  182. package/dist/cjs/miscellaneous-dcb93a5b.js.map +0 -1
  183. package/dist/cjs/x509_certificate-ebf4cbd4.js.map +0 -1
  184. package/dist/collection/crypto/crl.js.map +0 -1
  185. package/dist/collection/crypto/csr.js.map +0 -1
  186. package/dist/esm/certification_request-2c054ece.js.map +0 -1
  187. package/dist/esm/crl-a7318483.js +0 -308
  188. package/dist/esm/crl-a7318483.js.map +0 -1
  189. package/dist/esm/download-8c128e2e.js +0 -470
  190. package/dist/esm/download-8c128e2e.js.map +0 -1
  191. package/dist/esm/miscellaneous-0e98b5bc.js.map +0 -1
  192. package/dist/esm/x509_certificate-ad568d3a.js.map +0 -1
  193. package/dist/esm-es5/certification_request-2c054ece.js.map +0 -1
  194. package/dist/esm-es5/crl-a7318483.js +0 -33
  195. package/dist/esm-es5/crl-a7318483.js.map +0 -1
  196. package/dist/esm-es5/download-8c128e2e.js +0 -43
  197. package/dist/esm-es5/download-8c128e2e.js.map +0 -1
  198. package/dist/esm-es5/x509_certificate-ad568d3a.js +0 -12
  199. package/dist/esm-es5/x509_certificate-ad568d3a.js.map +0 -1
  200. package/dist/peculiar/p-00302a20.system.entry.js +0 -5
  201. package/dist/peculiar/p-0dbc8238.system.js +0 -13
  202. package/dist/peculiar/p-0dbc8238.system.js.map +0 -1
  203. package/dist/peculiar/p-1302bd67.js +0 -97
  204. package/dist/peculiar/p-1302bd67.js.map +0 -1
  205. package/dist/peculiar/p-1f766dd5.js +0 -43
  206. package/dist/peculiar/p-1f766dd5.js.map +0 -1
  207. package/dist/peculiar/p-3d44cbd2.js +0 -12
  208. package/dist/peculiar/p-3d44cbd2.js.map +0 -1
  209. package/dist/peculiar/p-3f9af5f5.system.js +0 -97
  210. package/dist/peculiar/p-3f9af5f5.system.js.map +0 -1
  211. package/dist/peculiar/p-54b37ef9.entry.js +0 -5
  212. package/dist/peculiar/p-5c6f9a14.entry.js +0 -12
  213. package/dist/peculiar/p-5c6f9a14.entry.js.map +0 -1
  214. package/dist/peculiar/p-5cf4562f.system.entry.js.map +0 -1
  215. package/dist/peculiar/p-6680f277.system.entry.js +0 -13
  216. package/dist/peculiar/p-6680f277.system.entry.js.map +0 -1
  217. package/dist/peculiar/p-924790f5.js +0 -33
  218. package/dist/peculiar/p-924790f5.js.map +0 -1
  219. package/dist/peculiar/p-b2890eb8.system.js +0 -5
  220. package/dist/peculiar/p-c156b495.system.js +0 -33
  221. package/dist/peculiar/p-c156b495.system.js.map +0 -1
  222. package/dist/peculiar/p-c23fd001.entry.js.map +0 -1
  223. package/dist/peculiar/p-dde511c8.system.js +0 -43
  224. package/dist/peculiar/p-dde511c8.system.js.map +0 -1
  225. /package/dist/peculiar/{p-496449cf.system.entry.js.map → p-cc256004.system.entry.js.map} +0 -0
  226. /package/dist/peculiar/{p-b2890eb8.system.js.map → p-d6229f42.system.js.map} +0 -0
  227. /package/dist/peculiar/{p-5f3b0fc7.entry.js.map → p-ddadcb44.entry.js.map} +0 -0
package/hydrate/index.js CHANGED
@@ -14749,14 +14749,6 @@ const isHex = (value) => (/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/
14749
14749
  .test(value));
14750
14750
  const isPem = (value) => (/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/
14751
14751
  .test(value));
14752
- const isX509Pem = (value) => (/-----BEGIN CERTIFICATE-----([A-Za-z0-9+\/=\s]+)-----END CERTIFICATE-----/
14753
- .test(value));
14754
- const isX509CRLPem = (value) => (/-----BEGIN X509 CRL-----([A-Za-z0-9+\/=\s]+)-----END X509 CRL-----/
14755
- .test(value));
14756
- const isPkcs10Pem = (value) => (/-----BEGIN CERTIFICATE REQUEST-----([A-Za-z0-9+\/=\s]+)-----END CERTIFICATE REQUEST-----/
14757
- .test(value));
14758
- const isX509AttributePem = (value) => (/-----BEGIN ATTRIBUTE CERTIFICATE-----([A-Za-z0-9+\/=\s]+)-----END ATTRIBUTE CERTIFICATE-----/
14759
- .test(value));
14760
14752
  const isBase64 = (value) => {
14761
14753
  try {
14762
14754
  window.atob(value);
@@ -15029,32 +15021,32 @@ Download.cert = {
15029
15021
  asPEM: (pem, name) => {
15030
15022
  downloadFromBuffer(Convert_1.FromString(pem), name, 'cer', 'application/pkix-cert');
15031
15023
  },
15032
- asDER: (hex, name) => {
15033
- downloadFromBuffer(Convert_1.FromString(hex), name, 'cer', 'application/pkix-cert');
15024
+ asDER: (raw, name) => {
15025
+ downloadFromBuffer(raw, name, 'cer', 'application/pkix-cert');
15034
15026
  },
15035
15027
  };
15036
15028
  Download.attrCert = {
15037
15029
  asPEM: (pem, name) => {
15038
15030
  downloadFromBuffer(Convert_1.FromString(pem), name, 'cer', 'application/pkix-attr-cert');
15039
15031
  },
15040
- asDER: (hex, name) => {
15041
- downloadFromBuffer(Convert_1.FromString(hex), name, 'cer', 'application/pkix-attr-cert');
15032
+ asDER: (raw, name) => {
15033
+ downloadFromBuffer(raw, name, 'cer', 'application/pkix-attr-cert');
15042
15034
  },
15043
15035
  };
15044
15036
  Download.csr = {
15045
15037
  asPEM: (pem, name) => {
15046
15038
  downloadFromBuffer(Convert_1.FromString(pem), name, 'csr', 'application/pkcs10');
15047
15039
  },
15048
- asDER: (hex, name) => {
15049
- downloadFromBuffer(Convert_1.FromString(hex), name, 'csr', 'application/pkcs10');
15040
+ asDER: (raw, name) => {
15041
+ downloadFromBuffer(raw, name, 'csr', 'application/pkcs10');
15050
15042
  },
15051
15043
  };
15052
15044
  Download.crl = {
15053
15045
  asPEM: (pem, name) => {
15054
15046
  downloadFromBuffer(Convert_1.FromString(pem), name, 'crl', 'application/pkix-crl');
15055
15047
  },
15056
- asDER: (hex, name) => {
15057
- downloadFromBuffer(Convert_1.FromString(hex), name, 'crl', 'application/pkix-crl');
15048
+ asDER: (raw, name) => {
15049
+ downloadFromBuffer(raw, name, 'crl', 'application/pkix-crl');
15058
15050
  },
15059
15051
  };
15060
15052
 
@@ -16042,6 +16034,7 @@ const OIDs = {
16042
16034
  '1.2.840.113635.100.4.6.3': 'Apple Crypto Tier2 QoS',
16043
16035
  '1.2.840.113635.100.4.6.4': 'Apple Crypto Tier3 QoS',
16044
16036
  '1.2.840.113635.100.4.7': 'Apple ID Sharing Certificate',
16037
+ '1.2.840.113635.100.4.13': 'Apple Extended Key Usage Developer ID Installer',
16045
16038
  '1.2.840.113635.100.5': 'Apple Certificate Policies',
16046
16039
  '1.2.840.113635.100.5.1': 'Apple Certificate Policy ID',
16047
16040
  '1.2.840.113635.100.5.2': 'Apple Dot Mac Certificate Policy ID',
@@ -16053,6 +16046,8 @@ const OIDs = {
16053
16046
  '1.2.840.113635.100.6.1.2': 'Apple Certificate Extension ADC Developer Signing',
16054
16047
  '1.2.840.113635.100.6.1.3': 'Apple Certificate Extension ADC Apple Signing',
16055
16048
  '1.2.840.113635.100.6.2.3': 'Apple Application Integration',
16049
+ '1.2.840.113635.100.6.1.33': 'Apple Certificate Extension Developer ID Date',
16050
+ '1.2.840.113635.100.6.1.14': 'Apple Certificate Extension Developer ID Installer',
16056
16051
  '1.2.840.114021.1.6.1': 'Identrus unknown policy Identifier',
16057
16052
  '1.2.840.114021.4.1': 'Identrus OCSP',
16058
16053
  '1.3.6.1.4.1.188.7.1.1': 'Ascom',
@@ -19116,6 +19111,7 @@ class X509Certificate extends AsnData {
19116
19111
  super(certificateRawToBuffer(raw), Certificate);
19117
19112
  this.thumbprints = {};
19118
19113
  this.type = 'X.509 Certificate';
19114
+ this.tag = 'CERTIFICATE';
19119
19115
  const { tbsCertificate } = this.asn;
19120
19116
  this.serialNumber = Convert_1.ToHex(tbsCertificate.serialNumber);
19121
19117
  this.subject = new Name(tbsCertificate.subject).toJSON();
@@ -19179,15 +19175,6 @@ class X509Certificate extends AsnData {
19179
19175
  algorithm: signatureAlgorithm.algorithm,
19180
19176
  };
19181
19177
  }
19182
- exportAsBase64() {
19183
- return Convert_1.ToBase64(this.raw);
19184
- }
19185
- exportAsHexFormatted() {
19186
- return hexFormat(Convert_1.ToHex(this.raw));
19187
- }
19188
- exportAsPemFormatted() {
19189
- return `-----BEGIN CERTIFICATE-----\n${base64Format(this.exportAsBase64())}\n-----END CERTIFICATE-----`;
19190
- }
19191
19178
  async getThumbprint(algorithm = 'SHA-1') {
19192
19179
  try {
19193
19180
  const thumbprint = await getCertificateThumbprint(algorithm, this.raw);
@@ -19245,11 +19232,21 @@ class X509Certificate extends AsnData {
19245
19232
  .map((name) => (`${name.shortName}=${name.value}`))
19246
19233
  .join(', ');
19247
19234
  }
19235
+ toString(format = 'pem') {
19236
+ switch (format) {
19237
+ case 'hex':
19238
+ return hexFormat(Convert_1.ToHex(this.raw));
19239
+ case 'pem':
19240
+ return `-----BEGIN ${this.tag}-----\n${base64Format(this.toString('base64'))}\n-----END ${this.tag}-----`;
19241
+ default:
19242
+ return Convert_1.ToBase64(this.raw);
19243
+ }
19244
+ }
19248
19245
  downloadAsPEM(name) {
19249
- Download.cert.asPEM(this.exportAsPemFormatted(), name || this.commonName);
19246
+ Download.cert.asPEM(this.toString('pem'), name || this.commonName);
19250
19247
  }
19251
19248
  downloadAsDER(name) {
19252
- Download.cert.asDER(this.exportAsHexFormatted(), name || this.commonName);
19249
+ Download.cert.asDER(this.raw, name || this.commonName);
19253
19250
  }
19254
19251
  }
19255
19252
 
@@ -20852,6 +20849,7 @@ class X509AttributeCertificate extends AsnData {
20852
20849
  super(certificateRawToBuffer(raw), AttributeCertificate);
20853
20850
  this.thumbprints = {};
20854
20851
  this.type = 'X.509 Attribute Certificate';
20852
+ this.tag = 'ATTRIBUTE CERTIFICATE';
20855
20853
  const { acinfo } = this.asn;
20856
20854
  this.serialNumber = Convert_1.ToHex(acinfo.serialNumber);
20857
20855
  this.version = acinfo.version;
@@ -20901,23 +20899,24 @@ class X509AttributeCertificate extends AsnData {
20901
20899
  console.error('Error thumbprint get:', error);
20902
20900
  }
20903
20901
  }
20904
- exportAsBase64() {
20905
- return Convert_1.ToBase64(this.raw);
20906
- }
20907
- exportAsHexFormatted() {
20908
- return hexFormat(Convert_1.ToHex(this.raw));
20909
- }
20910
- exportAsPemFormatted() {
20911
- return `-----BEGIN ATTRIBUTE CERTIFICATE-----\n${base64Format(this.exportAsBase64())}\n-----END ATTRIBUTE CERTIFICATE-----`;
20912
- }
20913
20902
  get commonName() {
20914
20903
  return `attribute-certificate-${this.thumbprints['SHA-1']}`;
20915
20904
  }
20905
+ toString(format = 'pem') {
20906
+ switch (format) {
20907
+ case 'hex':
20908
+ return hexFormat(Convert_1.ToHex(this.raw));
20909
+ case 'pem':
20910
+ return `-----BEGIN ${this.tag}-----\n${base64Format(this.toString('base64'))}\n-----END ${this.tag}-----`;
20911
+ default:
20912
+ return Convert_1.ToBase64(this.raw);
20913
+ }
20914
+ }
20916
20915
  downloadAsPEM(name) {
20917
- Download.attrCert.asPEM(this.exportAsPemFormatted(), name || this.commonName);
20916
+ Download.attrCert.asPEM(this.toString('pem'), name || this.commonName);
20918
20917
  }
20919
20918
  downloadAsDER(name) {
20920
- Download.attrCert.asDER(this.exportAsHexFormatted(), name || this.commonName);
20919
+ Download.attrCert.asDER(this.raw, name || this.commonName);
20921
20920
  }
20922
20921
  }
20923
20922
 
@@ -20979,11 +20978,12 @@ __decorate$1([
20979
20978
  * This source code is licensed under the MIT license found in the
20980
20979
  * LICENSE file in the root directory of this source tree.
20981
20980
  */
20982
- class CSR extends AsnData {
20981
+ class Pkcs10CertificateRequest extends AsnData {
20983
20982
  constructor(raw) {
20984
20983
  super(certificateRawToBuffer(raw), CertificationRequest);
20985
20984
  this.thumbprints = {};
20986
20985
  this.type = 'PKCS#10 Certificate Request';
20986
+ this.tag = 'CERTIFICATE REQUEST';
20987
20987
  const { certificationRequestInfo } = this.asn;
20988
20988
  this.subject = new Name(certificationRequestInfo.subject).toJSON();
20989
20989
  this.version = certificationRequestInfo.version;
@@ -21046,20 +21046,21 @@ class CSR extends AsnData {
21046
21046
  }
21047
21047
  }
21048
21048
  }
21049
- exportAsBase64() {
21050
- return Convert_1.ToBase64(this.raw);
21051
- }
21052
- exportAsHexFormatted() {
21053
- return hexFormat(Convert_1.ToHex(this.raw));
21054
- }
21055
- exportAsPemFormatted() {
21056
- return `-----BEGIN CERTIFICATE REQUEST-----\n${base64Format(this.exportAsBase64())}\n-----END CERTIFICATE REQUEST-----`;
21049
+ toString(format = 'pem') {
21050
+ switch (format) {
21051
+ case 'hex':
21052
+ return hexFormat(Convert_1.ToHex(this.raw));
21053
+ case 'pem':
21054
+ return `-----BEGIN ${this.tag}-----\n${base64Format(this.toString('base64'))}\n-----END ${this.tag}-----`;
21055
+ default:
21056
+ return Convert_1.ToBase64(this.raw);
21057
+ }
21057
21058
  }
21058
21059
  downloadAsPEM(name) {
21059
- Download.csr.asPEM(this.exportAsPemFormatted(), name || this.commonName);
21060
+ Download.csr.asPEM(this.toString('pem'), name || this.commonName);
21060
21061
  }
21061
21062
  downloadAsDER(name) {
21062
- Download.csr.asDER(this.exportAsHexFormatted(), name || this.commonName);
21063
+ Download.csr.asDER(this.raw, name || this.commonName);
21063
21064
  }
21064
21065
  }
21065
21066
 
@@ -21070,11 +21071,12 @@ class CSR extends AsnData {
21070
21071
  * This source code is licensed under the MIT license found in the
21071
21072
  * LICENSE file in the root directory of this source tree.
21072
21073
  */
21073
- class CRL extends AsnData {
21074
+ class X509Crl extends AsnData {
21074
21075
  constructor(raw) {
21075
21076
  super(certificateRawToBuffer(raw), CertificateList);
21076
21077
  this.thumbprints = {};
21077
21078
  this.type = 'X.509 Certificate Revocation List';
21079
+ this.tag = 'X509 CRL';
21078
21080
  const { tbsCertList } = this.asn;
21079
21081
  this.issuer = new Name(tbsCertList.issuer).toJSON();
21080
21082
  this.version = tbsCertList.version + 1;
@@ -21127,20 +21129,21 @@ class CRL extends AsnData {
21127
21129
  .map((e) => new Extension(AsnConvert.serialize(e)));
21128
21130
  }
21129
21131
  }
21130
- exportAsBase64() {
21131
- return Convert_1.ToBase64(this.raw);
21132
- }
21133
- exportAsHexFormatted() {
21134
- return hexFormat(Convert_1.ToHex(this.raw));
21135
- }
21136
- exportAsPemFormatted() {
21137
- return `-----BEGIN X509 CRL-----\n${base64Format(this.exportAsBase64())}\n-----END X509 CRL-----`;
21132
+ toString(format = 'pem') {
21133
+ switch (format) {
21134
+ case 'hex':
21135
+ return hexFormat(Convert_1.ToHex(this.raw));
21136
+ case 'pem':
21137
+ return `-----BEGIN ${this.tag}-----\n${base64Format(this.toString('base64'))}\n-----END ${this.tag}-----`;
21138
+ default:
21139
+ return Convert_1.ToBase64(this.raw);
21140
+ }
21138
21141
  }
21139
21142
  downloadAsPEM(name) {
21140
- Download.crl.asPEM(this.exportAsPemFormatted(), name || this.commonName);
21143
+ Download.crl.asPEM(this.toString('pem'), name || this.commonName);
21141
21144
  }
21142
21145
  downloadAsDER(name) {
21143
- Download.crl.asDER(this.exportAsHexFormatted(), name || this.commonName);
21146
+ Download.crl.asDER(this.raw, name || this.commonName);
21144
21147
  }
21145
21148
  }
21146
21149
 
@@ -23230,83 +23233,26 @@ class CertificateDecoder {
23230
23233
  }
23231
23234
  setValue(value) {
23232
23235
  this.certificateDecoded = value;
23233
- this.inputPaste.value = value.exportAsPemFormatted();
23234
- this.successParse.emit(value.exportAsBase64());
23236
+ this.inputPaste.value = value.toString('pem');
23237
+ this.successParse.emit(value.toString('base64'));
23235
23238
  }
23236
23239
  decode(certificate) {
23237
- const isPem$1 = isPem(certificate);
23238
- const isX509Pem$1 = isX509Pem(certificate);
23239
- const isPkcs10Pem$1 = isPkcs10Pem(certificate);
23240
- const isX509AttributePem$1 = isX509AttributePem(certificate);
23241
- const isX509CRLPem$1 = isX509CRLPem(certificate);
23242
- let decoded;
23243
- let decodeError;
23244
- if (isPem$1 && !(isX509Pem$1 || isX509AttributePem$1 || isPkcs10Pem$1 || isX509CRLPem$1)) {
23240
+ new Promise((resolve) => {
23241
+ resolve(new X509Certificate(certificate));
23242
+ })
23243
+ .catch(() => new X509AttributeCertificate(certificate))
23244
+ .catch(() => new Pkcs10CertificateRequest(certificate))
23245
+ .catch(() => new X509Crl(certificate))
23246
+ .then((res) => this.setValue(res))
23247
+ .catch((err) => {
23245
23248
  this.clearValue();
23246
- alert('Unsupported file type. Please try to use Certificate/AttributeCertificate/CertificateRequest/CRL.');
23247
- return;
23248
- }
23249
- try {
23250
- if (isX509Pem$1) {
23251
- decoded = new X509Certificate(certificate);
23252
- }
23253
- if (isX509AttributePem$1) {
23254
- decoded = new X509AttributeCertificate(certificate);
23255
- }
23256
- if (isPkcs10Pem$1) {
23257
- decoded = new CSR(certificate);
23258
- }
23259
- if (isX509CRLPem$1) {
23260
- decoded = new CRL(certificate);
23261
- }
23262
- }
23263
- catch (error) {
23264
- decodeError = error;
23265
- }
23266
- if (!decoded) {
23267
- try {
23268
- decoded = new X509Certificate(certificate);
23269
- }
23270
- catch (error) {
23271
- decodeError = error;
23272
- }
23273
- }
23274
- if (!decoded) {
23275
- try {
23276
- decoded = new X509AttributeCertificate(certificate);
23277
- }
23278
- catch (error) {
23279
- decodeError = error;
23280
- }
23281
- }
23282
- if (!decoded) {
23283
- try {
23284
- decoded = new CSR(certificate);
23285
- }
23286
- catch (error) {
23287
- decodeError = error;
23288
- }
23289
- }
23290
- if (!decoded) {
23291
- try {
23292
- decoded = new CRL(certificate);
23293
- }
23294
- catch (error) {
23295
- decodeError = error;
23296
- }
23297
- }
23298
- if (!decoded) {
23299
- this.clearValue();
23300
- console.log(decodeError);
23249
+ console.log(err);
23301
23250
  alert('Error decoding file. Please try to use Certificate/AttributeCertificate/CertificateRequest/CRL.');
23302
- }
23303
- else {
23304
- this.setValue(decoded);
23305
- }
23251
+ });
23306
23252
  }
23307
23253
  render() {
23308
23254
  var _a;
23309
- return (hAsync(Host, { key: 'b10e5ce1d2efe26bbe7e0daafb3bbaf5a9f73a62' }, hAsync("textarea", { key: '581e7c2eadf2fe33876106b2fdc90bdc9fb92096', placeholder: "Certificate DER or PEM", class: "textarea t-b2 c-black", ref: (el) => { this.inputPaste = el; }, onDrop: this.handleDropFile }), hAsync("div", { key: '71f93ecef6e3571d3ca795be1b53e1b19c4881d3', class: "controls" }, hAsync("div", { key: 'b2f2dfbe0637d3119bbb2dbf622f7614685f5cb5', class: "control_row" }, hAsync(Typography, { key: 'c639c7c696d589ef1035ca8c0f910ce5456e83cf', variant: "b3", color: "secondary-tint-2" }, "Drag or load file:"), hAsync("input", { key: 'c8acf8a1620a802fbcf9afe6b52d8bed1e90bd23', type: "file", accept: "application/pkix-cert,application/x-x509-ca-cert,application/x-x509-user-cert,application/pkcs10,application/pkix-crl,.csr,.req,.crl", onChange: this.handleChangeInputFile, value: "" })), ((_a = this.certificateExamples) === null || _a === void 0 ? void 0 : _a.length) && (hAsync("div", { class: "control_row" }, hAsync(Typography, { variant: "b3", color: "secondary-tint-2" }, "Load examples:"), hAsync("select", { onChange: this.handleChangeExample }, hAsync("option", { value: "" }, "None"), this.certificateExamples.map((example) => (hAsync("option", { value: example.value }, example.title)))))), hAsync("div", { key: '051ce823203fa7bf2a5f4e2c85b121017fdd8651', class: "control_row" }, hAsync(Button, { key: '405a0894a87ab000e3717cecd7d3fa34620c26a9', onClick: this.handleClickDecode }, "Decode"), hAsync(Button, { key: '34282cb209b5fb99a29b2b415435d31646fe0e7e', onClick: this.handleClickClear }, "Clear"))), this.certificateDecoded instanceof X509Certificate && (hAsync("peculiar-certificate-viewer", { certificate: this.certificateDecoded, class: "viewer", download: true })), this.certificateDecoded instanceof X509AttributeCertificate && (hAsync("peculiar-attribute-certificate-viewer", { certificate: this.certificateDecoded, class: "viewer", download: true })), this.certificateDecoded instanceof CSR && (hAsync("peculiar-csr-viewer", { certificate: this.certificateDecoded, class: "viewer", download: true })), this.certificateDecoded instanceof CRL && (hAsync("peculiar-crl-viewer", { certificate: this.certificateDecoded, class: "viewer", download: true }))));
23255
+ return (hAsync(Host, { key: '7c3bfca68882e39705e9640f76754cce2e5d6c6a' }, hAsync("textarea", { key: '4d24f4b914f7f118efde2144e7597e0767d59ce8', placeholder: "Certificate DER or PEM", class: "textarea t-b2 c-black", ref: (el) => { this.inputPaste = el; }, onDrop: this.handleDropFile }), hAsync("div", { key: '06ba6e2b5658225a585ec9711e6f3f945ef3a840', class: "controls" }, hAsync("div", { key: 'df2e115ea04d4eae7985f6ee57bfe47354f50240', class: "control_row" }, hAsync(Typography, { key: '05c30b2956055455cdb1f52b40995752dd0d7da4', variant: "b3", color: "secondary-tint-2" }, "Drag or load file:"), hAsync("input", { key: 'cca59d7c59d9917e728f9795bcfbd546d4cf75b8', type: "file", accept: "application/pkix-cert,application/x-x509-ca-cert,application/x-x509-user-cert,application/pkcs10,application/pkix-crl,.csr,.req,.crl", onChange: this.handleChangeInputFile, value: "" })), ((_a = this.certificateExamples) === null || _a === void 0 ? void 0 : _a.length) && (hAsync("div", { class: "control_row" }, hAsync(Typography, { variant: "b3", color: "secondary-tint-2" }, "Load examples:"), hAsync("select", { onChange: this.handleChangeExample }, hAsync("option", { value: "" }, "None"), this.certificateExamples.map((example) => (hAsync("option", { value: example.value }, example.title)))))), hAsync("div", { key: '6d1f010e03d7836459214e5c0abe1af7fbbe2a10', class: "control_row" }, hAsync(Button, { key: '4038db36b62ff11f592f380f5c98bebb0014585e', onClick: this.handleClickDecode }, "Decode"), hAsync(Button, { key: 'fb7c30e61b10194b5f02a2cefa06191904f5ce46', onClick: this.handleClickClear }, "Clear"))), this.certificateDecoded instanceof X509Certificate && (hAsync("peculiar-certificate-viewer", { certificate: this.certificateDecoded, class: "viewer", download: true })), this.certificateDecoded instanceof X509AttributeCertificate && (hAsync("peculiar-attribute-certificate-viewer", { certificate: this.certificateDecoded, class: "viewer", download: true })), this.certificateDecoded instanceof Pkcs10CertificateRequest && (hAsync("peculiar-csr-viewer", { certificate: this.certificateDecoded, class: "viewer", download: true })), this.certificateDecoded instanceof X509Crl && (hAsync("peculiar-crl-viewer", { certificate: this.certificateDecoded, class: "viewer", download: true }))));
23310
23256
  }
23311
23257
  static get style() { return PeculiarCertificateDecoderStyle0; }
23312
23258
  static get cmpMeta() { return {
@@ -23808,11 +23754,11 @@ class CrlViewer {
23808
23754
  async decodeCertificate(certificate) {
23809
23755
  this.isDecodeInProcess = true;
23810
23756
  try {
23811
- if (certificate instanceof CRL) {
23757
+ if (certificate instanceof X509Crl) {
23812
23758
  this.certificateDecoded = certificate;
23813
23759
  }
23814
23760
  else if (typeof certificate === 'string') {
23815
- this.certificateDecoded = new CRL(certificate);
23761
+ this.certificateDecoded = new X509Crl(certificate);
23816
23762
  }
23817
23763
  else {
23818
23764
  return;
@@ -23840,8 +23786,8 @@ class CrlViewer {
23840
23786
  }
23841
23787
  return;
23842
23788
  }
23843
- if (newValue instanceof CRL
23844
- && oldValue instanceof CRL) {
23789
+ if (newValue instanceof X509Crl
23790
+ && oldValue instanceof X509Crl) {
23845
23791
  if (newValue.commonName !== oldValue.commonName) {
23846
23792
  this.decodeCertificate(newValue);
23847
23793
  }
@@ -23925,11 +23871,11 @@ class CsrViewer {
23925
23871
  async decodeCertificate(certificate) {
23926
23872
  this.isDecodeInProcess = true;
23927
23873
  try {
23928
- if (certificate instanceof CSR) {
23874
+ if (certificate instanceof Pkcs10CertificateRequest) {
23929
23875
  this.certificateDecoded = certificate;
23930
23876
  }
23931
23877
  else if (typeof certificate === 'string') {
23932
- this.certificateDecoded = new CSR(certificate);
23878
+ this.certificateDecoded = new Pkcs10CertificateRequest(certificate);
23933
23879
  }
23934
23880
  else {
23935
23881
  return;
@@ -23954,8 +23900,8 @@ class CsrViewer {
23954
23900
  }
23955
23901
  return;
23956
23902
  }
23957
- if (newValue instanceof CSR
23958
- && oldValue instanceof CSR) {
23903
+ if (newValue instanceof Pkcs10CertificateRequest
23904
+ && oldValue instanceof Pkcs10CertificateRequest) {
23959
23905
  if (newValue.commonName !== oldValue.commonName) {
23960
23906
  this.decodeCertificate(newValue);
23961
23907
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peculiar/certificates-viewer",
3
- "version": "4.2.1",
3
+ "version": "4.3.0",
4
4
  "private": false,
5
5
  "description": "Peculiar Certificate Viewer web-components makes it easy for you to display certificate related details in your web application.",
6
6
  "keywords": [
@@ -58,14 +58,14 @@
58
58
  "@peculiar/asn1-x509-qualified": "^2.3.8",
59
59
  "@peculiar/asn1-x509-qualified-etsi": "^2.3.8",
60
60
  "@stencil/core": "^4.13.0",
61
- "dayjs": "^1.11.10",
61
+ "dayjs": "^1.11.11",
62
62
  "pvtsutils": "^1.3.5"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@stencil/sass": "^3.0.11",
66
66
  "@types/jest": "27.0.3",
67
67
  "@types/jest-image-snapshot": "^6.2.3",
68
- "gh-pages": "^4.0.0",
68
+ "gh-pages": "^5.0.0",
69
69
  "jest": "27.0.3",
70
70
  "jest-cli": "27.4.5",
71
71
  "jest-image-snapshot": "^6.2.0",
@@ -83,5 +83,5 @@
83
83
  "publishConfig": {
84
84
  "access": "public"
85
85
  },
86
- "gitHead": "789897725908382755196690a22dc3696fd1ac08"
86
+ "gitHead": "698cbf60141169b910f6fc64d275fdf5ca662983"
87
87
  }