index.js 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. var ExtensionRequest_1, ExtendedCertificateAttributes_1, SMIMECapabilities_1;
  2. import { __decorate } from "tslib";
  3. import { AsnType, AsnTypeTypes, AsnPropTypes, AsnProp, OctetString, AsnArray, } from "@peculiar/asn1-schema";
  4. import * as cms from "@peculiar/asn1-cms";
  5. import * as pfx from "@peculiar/asn1-pfx";
  6. import * as pkcs8 from "@peculiar/asn1-pkcs8";
  7. import * as x509 from "@peculiar/asn1-x509";
  8. import * as attr from "@peculiar/asn1-x509-attr";
  9. export const id_pkcs9 = "1.2.840.113549.1.9";
  10. export const id_pkcs9_mo = `${id_pkcs9}.0`;
  11. export const id_pkcs9_oc = `${id_pkcs9}.24`;
  12. export const id_pkcs9_at = `${id_pkcs9}.25`;
  13. export const id_pkcs9_sx = `${id_pkcs9}.26`;
  14. export const id_pkcs9_mr = `${id_pkcs9}.27`;
  15. export const id_pkcs9_oc_pkcsEntity = `${id_pkcs9_oc}.1`;
  16. export const id_pkcs9_oc_naturalPerson = `${id_pkcs9_oc}.2`;
  17. export const id_pkcs9_at_emailAddress = `${id_pkcs9}.1`;
  18. export const id_pkcs9_at_unstructuredName = `${id_pkcs9}.2`;
  19. export const id_pkcs9_at_contentType = `${id_pkcs9}.3`;
  20. export const id_pkcs9_at_messageDigest = `${id_pkcs9}.4`;
  21. export const id_pkcs9_at_signingTime = `${id_pkcs9}.5`;
  22. export const id_pkcs9_at_counterSignature = `${id_pkcs9}.6`;
  23. export const id_pkcs9_at_challengePassword = `${id_pkcs9}.7`;
  24. export const id_pkcs9_at_unstructuredAddress = `${id_pkcs9}.8`;
  25. export const id_pkcs9_at_extendedCertificateAttributes = `${id_pkcs9}.9`;
  26. export const id_pkcs9_at_signingDescription = `${id_pkcs9}.13`;
  27. export const id_pkcs9_at_extensionRequest = `${id_pkcs9}.14`;
  28. export const id_pkcs9_at_smimeCapabilities = `${id_pkcs9}.15`;
  29. export const id_pkcs9_at_friendlyName = `${id_pkcs9}.20`;
  30. export const id_pkcs9_at_localKeyId = `${id_pkcs9}.21`;
  31. export const id_pkcs9_at_userPKCS12 = `2.16.840.1.113730.3.1.216`;
  32. export const id_pkcs9_at_pkcs15Token = `${id_pkcs9_at}.1`;
  33. export const id_pkcs9_at_encryptedPrivateKeyInfo = `${id_pkcs9_at}.2`;
  34. export const id_pkcs9_at_randomNonce = `${id_pkcs9_at}.3`;
  35. export const id_pkcs9_at_sequenceNumber = `${id_pkcs9_at}.4`;
  36. export const id_pkcs9_at_pkcs7PDU = `${id_pkcs9_at}.5`;
  37. export const id_ietf_at = `1.3.6.1.5.5.7.9`;
  38. export const id_pkcs9_at_dateOfBirth = `${id_ietf_at}.1`;
  39. export const id_pkcs9_at_placeOfBirth = `${id_ietf_at}.2`;
  40. export const id_pkcs9_at_gender = `${id_ietf_at}.3`;
  41. export const id_pkcs9_at_countryOfCitizenship = `${id_ietf_at}.4`;
  42. export const id_pkcs9_at_countryOfResidence = `${id_ietf_at}.5`;
  43. export const id_pkcs9_sx_pkcs9String = `${id_pkcs9_sx}.1`;
  44. export const id_pkcs9_sx_signingTime = `${id_pkcs9_sx}.2`;
  45. export const id_pkcs9_mr_caseIgnoreMatch = `${id_pkcs9_mr}.1`;
  46. export const id_pkcs9_mr_signingTimeMatch = `${id_pkcs9_mr}.2`;
  47. export const id_smime = `${id_pkcs9}.16`;
  48. export const id_certTypes = `${id_pkcs9}.22`;
  49. export const crlTypes = `${id_pkcs9}.23`;
  50. export const id_at_pseudonym = `${attr.id_at}.65`;
  51. let PKCS9String = class PKCS9String extends x509.DirectoryString {
  52. constructor(params = {}) {
  53. super(params);
  54. }
  55. toString() {
  56. const o = {};
  57. o.toString();
  58. return this.ia5String || super.toString();
  59. }
  60. };
  61. __decorate([
  62. AsnProp({ type: AsnPropTypes.IA5String })
  63. ], PKCS9String.prototype, "ia5String", void 0);
  64. PKCS9String = __decorate([
  65. AsnType({ type: AsnTypeTypes.Choice })
  66. ], PKCS9String);
  67. export { PKCS9String };
  68. let Pkcs7PDU = class Pkcs7PDU extends cms.ContentInfo {
  69. };
  70. Pkcs7PDU = __decorate([
  71. AsnType({ type: AsnTypeTypes.Sequence })
  72. ], Pkcs7PDU);
  73. export { Pkcs7PDU };
  74. let UserPKCS12 = class UserPKCS12 extends pfx.PFX {
  75. };
  76. UserPKCS12 = __decorate([
  77. AsnType({ type: AsnTypeTypes.Sequence })
  78. ], UserPKCS12);
  79. export { UserPKCS12 };
  80. let EncryptedPrivateKeyInfo = class EncryptedPrivateKeyInfo extends pkcs8.EncryptedPrivateKeyInfo {
  81. };
  82. EncryptedPrivateKeyInfo = __decorate([
  83. AsnType({ type: AsnTypeTypes.Sequence })
  84. ], EncryptedPrivateKeyInfo);
  85. export { EncryptedPrivateKeyInfo };
  86. let EmailAddress = class EmailAddress {
  87. constructor(value = "") {
  88. this.value = value;
  89. }
  90. toString() {
  91. return this.value;
  92. }
  93. };
  94. __decorate([
  95. AsnProp({ type: AsnPropTypes.IA5String })
  96. ], EmailAddress.prototype, "value", void 0);
  97. EmailAddress = __decorate([
  98. AsnType({ type: AsnTypeTypes.Choice })
  99. ], EmailAddress);
  100. export { EmailAddress };
  101. let UnstructuredName = class UnstructuredName extends PKCS9String {
  102. };
  103. UnstructuredName = __decorate([
  104. AsnType({ type: AsnTypeTypes.Choice })
  105. ], UnstructuredName);
  106. export { UnstructuredName };
  107. let UnstructuredAddress = class UnstructuredAddress extends x509.DirectoryString {
  108. };
  109. UnstructuredAddress = __decorate([
  110. AsnType({ type: AsnTypeTypes.Choice })
  111. ], UnstructuredAddress);
  112. export { UnstructuredAddress };
  113. let DateOfBirth = class DateOfBirth {
  114. constructor(value = new Date()) {
  115. this.value = value;
  116. }
  117. };
  118. __decorate([
  119. AsnProp({ type: AsnPropTypes.GeneralizedTime })
  120. ], DateOfBirth.prototype, "value", void 0);
  121. DateOfBirth = __decorate([
  122. AsnType({ type: AsnTypeTypes.Choice })
  123. ], DateOfBirth);
  124. export { DateOfBirth };
  125. let PlaceOfBirth = class PlaceOfBirth extends x509.DirectoryString {
  126. };
  127. PlaceOfBirth = __decorate([
  128. AsnType({ type: AsnTypeTypes.Choice })
  129. ], PlaceOfBirth);
  130. export { PlaceOfBirth };
  131. let Gender = class Gender {
  132. constructor(value = "M") {
  133. this.value = value;
  134. }
  135. toString() {
  136. return this.value;
  137. }
  138. };
  139. __decorate([
  140. AsnProp({ type: AsnPropTypes.PrintableString })
  141. ], Gender.prototype, "value", void 0);
  142. Gender = __decorate([
  143. AsnType({ type: AsnTypeTypes.Choice })
  144. ], Gender);
  145. export { Gender };
  146. let CountryOfCitizenship = class CountryOfCitizenship {
  147. constructor(value = "") {
  148. this.value = value;
  149. }
  150. toString() {
  151. return this.value;
  152. }
  153. };
  154. __decorate([
  155. AsnProp({ type: AsnPropTypes.PrintableString })
  156. ], CountryOfCitizenship.prototype, "value", void 0);
  157. CountryOfCitizenship = __decorate([
  158. AsnType({ type: AsnTypeTypes.Choice })
  159. ], CountryOfCitizenship);
  160. export { CountryOfCitizenship };
  161. let CountryOfResidence = class CountryOfResidence extends CountryOfCitizenship {
  162. };
  163. CountryOfResidence = __decorate([
  164. AsnType({ type: AsnTypeTypes.Choice })
  165. ], CountryOfResidence);
  166. export { CountryOfResidence };
  167. let Pseudonym = class Pseudonym extends x509.DirectoryString {
  168. };
  169. Pseudonym = __decorate([
  170. AsnType({ type: AsnTypeTypes.Choice })
  171. ], Pseudonym);
  172. export { Pseudonym };
  173. let ContentType = class ContentType {
  174. constructor(value = "") {
  175. this.value = value;
  176. }
  177. toString() {
  178. return this.value;
  179. }
  180. };
  181. __decorate([
  182. AsnProp({ type: AsnPropTypes.ObjectIdentifier })
  183. ], ContentType.prototype, "value", void 0);
  184. ContentType = __decorate([
  185. AsnType({ type: AsnTypeTypes.Choice })
  186. ], ContentType);
  187. export { ContentType };
  188. export class MessageDigest extends OctetString {
  189. }
  190. let SigningTime = class SigningTime extends x509.Time {
  191. };
  192. SigningTime = __decorate([
  193. AsnType({ type: AsnTypeTypes.Choice })
  194. ], SigningTime);
  195. export { SigningTime };
  196. export class RandomNonce extends OctetString {
  197. }
  198. let SequenceNumber = class SequenceNumber {
  199. constructor(value = 0) {
  200. this.value = value;
  201. }
  202. toString() {
  203. return this.value.toString();
  204. }
  205. };
  206. __decorate([
  207. AsnProp({ type: AsnPropTypes.Integer })
  208. ], SequenceNumber.prototype, "value", void 0);
  209. SequenceNumber = __decorate([
  210. AsnType({ type: AsnTypeTypes.Choice })
  211. ], SequenceNumber);
  212. export { SequenceNumber };
  213. let CounterSignature = class CounterSignature extends cms.SignerInfo {
  214. };
  215. CounterSignature = __decorate([
  216. AsnType({ type: AsnTypeTypes.Sequence })
  217. ], CounterSignature);
  218. export { CounterSignature };
  219. let ChallengePassword = class ChallengePassword extends x509.DirectoryString {
  220. };
  221. ChallengePassword = __decorate([
  222. AsnType({ type: AsnTypeTypes.Choice })
  223. ], ChallengePassword);
  224. export { ChallengePassword };
  225. let ExtensionRequest = ExtensionRequest_1 = class ExtensionRequest extends x509.Extensions {
  226. constructor(items) {
  227. super(items);
  228. Object.setPrototypeOf(this, ExtensionRequest_1.prototype);
  229. }
  230. };
  231. ExtensionRequest = ExtensionRequest_1 = __decorate([
  232. AsnType({ type: AsnTypeTypes.Sequence })
  233. ], ExtensionRequest);
  234. export { ExtensionRequest };
  235. let ExtendedCertificateAttributes = ExtendedCertificateAttributes_1 = class ExtendedCertificateAttributes extends AsnArray {
  236. constructor(items) {
  237. super(items);
  238. Object.setPrototypeOf(this, ExtendedCertificateAttributes_1.prototype);
  239. }
  240. };
  241. ExtendedCertificateAttributes = ExtendedCertificateAttributes_1 = __decorate([
  242. AsnType({ type: AsnTypeTypes.Set, itemType: cms.Attribute })
  243. ], ExtendedCertificateAttributes);
  244. export { ExtendedCertificateAttributes };
  245. let FriendlyName = class FriendlyName {
  246. constructor(value = "") {
  247. this.value = value;
  248. }
  249. toString() {
  250. return this.value;
  251. }
  252. };
  253. __decorate([
  254. AsnProp({ type: AsnPropTypes.BmpString })
  255. ], FriendlyName.prototype, "value", void 0);
  256. FriendlyName = __decorate([
  257. AsnType({ type: AsnTypeTypes.Choice })
  258. ], FriendlyName);
  259. export { FriendlyName };
  260. export class LocalKeyId extends OctetString {
  261. }
  262. export class SigningDescription extends x509.DirectoryString {
  263. }
  264. let SMIMECapability = class SMIMECapability extends x509.AlgorithmIdentifier {
  265. };
  266. SMIMECapability = __decorate([
  267. AsnType({ type: AsnTypeTypes.Sequence })
  268. ], SMIMECapability);
  269. export { SMIMECapability };
  270. let SMIMECapabilities = SMIMECapabilities_1 = class SMIMECapabilities extends AsnArray {
  271. constructor(items) {
  272. super(items);
  273. Object.setPrototypeOf(this, SMIMECapabilities_1.prototype);
  274. }
  275. };
  276. SMIMECapabilities = SMIMECapabilities_1 = __decorate([
  277. AsnType({ type: AsnTypeTypes.Sequence, itemType: SMIMECapability })
  278. ], SMIMECapabilities);
  279. export { SMIMECapabilities };