index.js 14 KB

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