index.js 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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. ia5String;
  53. constructor(params = {}) {
  54. super(params);
  55. }
  56. toString() {
  57. const o = {};
  58. o.toString();
  59. return this.ia5String || super.toString();
  60. }
  61. };
  62. __decorate([
  63. AsnProp({ type: AsnPropTypes.IA5String })
  64. ], PKCS9String.prototype, "ia5String", void 0);
  65. PKCS9String = __decorate([
  66. AsnType({ type: AsnTypeTypes.Choice })
  67. ], PKCS9String);
  68. export { PKCS9String };
  69. let Pkcs7PDU = class Pkcs7PDU extends cms.ContentInfo {
  70. };
  71. Pkcs7PDU = __decorate([
  72. AsnType({ type: AsnTypeTypes.Sequence })
  73. ], Pkcs7PDU);
  74. export { Pkcs7PDU };
  75. let UserPKCS12 = class UserPKCS12 extends pfx.PFX {
  76. };
  77. UserPKCS12 = __decorate([
  78. AsnType({ type: AsnTypeTypes.Sequence })
  79. ], UserPKCS12);
  80. export { UserPKCS12 };
  81. let EncryptedPrivateKeyInfo = class EncryptedPrivateKeyInfo extends pkcs8.EncryptedPrivateKeyInfo {
  82. };
  83. EncryptedPrivateKeyInfo = __decorate([
  84. AsnType({ type: AsnTypeTypes.Sequence })
  85. ], EncryptedPrivateKeyInfo);
  86. export { EncryptedPrivateKeyInfo };
  87. let EmailAddress = class EmailAddress {
  88. value;
  89. constructor(value = "") {
  90. this.value = value;
  91. }
  92. toString() {
  93. return this.value;
  94. }
  95. };
  96. __decorate([
  97. AsnProp({ type: AsnPropTypes.IA5String })
  98. ], EmailAddress.prototype, "value", void 0);
  99. EmailAddress = __decorate([
  100. AsnType({ type: AsnTypeTypes.Choice })
  101. ], EmailAddress);
  102. export { EmailAddress };
  103. let UnstructuredName = class UnstructuredName extends PKCS9String {
  104. };
  105. UnstructuredName = __decorate([
  106. AsnType({ type: AsnTypeTypes.Choice })
  107. ], UnstructuredName);
  108. export { UnstructuredName };
  109. let UnstructuredAddress = class UnstructuredAddress extends x509.DirectoryString {
  110. };
  111. UnstructuredAddress = __decorate([
  112. AsnType({ type: AsnTypeTypes.Choice })
  113. ], UnstructuredAddress);
  114. export { UnstructuredAddress };
  115. let DateOfBirth = class DateOfBirth {
  116. value;
  117. constructor(value = new Date()) {
  118. this.value = value;
  119. }
  120. };
  121. __decorate([
  122. AsnProp({ type: AsnPropTypes.GeneralizedTime })
  123. ], DateOfBirth.prototype, "value", void 0);
  124. DateOfBirth = __decorate([
  125. AsnType({ type: AsnTypeTypes.Choice })
  126. ], DateOfBirth);
  127. export { DateOfBirth };
  128. let PlaceOfBirth = class PlaceOfBirth extends x509.DirectoryString {
  129. };
  130. PlaceOfBirth = __decorate([
  131. AsnType({ type: AsnTypeTypes.Choice })
  132. ], PlaceOfBirth);
  133. export { PlaceOfBirth };
  134. let Gender = class Gender {
  135. value;
  136. constructor(value = "M") {
  137. this.value = value;
  138. }
  139. toString() {
  140. return this.value;
  141. }
  142. };
  143. __decorate([
  144. AsnProp({ type: AsnPropTypes.PrintableString })
  145. ], Gender.prototype, "value", void 0);
  146. Gender = __decorate([
  147. AsnType({ type: AsnTypeTypes.Choice })
  148. ], Gender);
  149. export { Gender };
  150. let CountryOfCitizenship = class CountryOfCitizenship {
  151. value;
  152. constructor(value = "") {
  153. this.value = value;
  154. }
  155. toString() {
  156. return this.value;
  157. }
  158. };
  159. __decorate([
  160. AsnProp({ type: AsnPropTypes.PrintableString })
  161. ], CountryOfCitizenship.prototype, "value", void 0);
  162. CountryOfCitizenship = __decorate([
  163. AsnType({ type: AsnTypeTypes.Choice })
  164. ], CountryOfCitizenship);
  165. export { CountryOfCitizenship };
  166. let CountryOfResidence = class CountryOfResidence extends CountryOfCitizenship {
  167. };
  168. CountryOfResidence = __decorate([
  169. AsnType({ type: AsnTypeTypes.Choice })
  170. ], CountryOfResidence);
  171. export { CountryOfResidence };
  172. let Pseudonym = class Pseudonym extends x509.DirectoryString {
  173. };
  174. Pseudonym = __decorate([
  175. AsnType({ type: AsnTypeTypes.Choice })
  176. ], Pseudonym);
  177. export { Pseudonym };
  178. let ContentType = class ContentType {
  179. value;
  180. constructor(value = "") {
  181. this.value = value;
  182. }
  183. toString() {
  184. return this.value;
  185. }
  186. };
  187. __decorate([
  188. AsnProp({ type: AsnPropTypes.ObjectIdentifier })
  189. ], ContentType.prototype, "value", void 0);
  190. ContentType = __decorate([
  191. AsnType({ type: AsnTypeTypes.Choice })
  192. ], ContentType);
  193. export { ContentType };
  194. export class MessageDigest extends OctetString {
  195. }
  196. let SigningTime = class SigningTime extends x509.Time {
  197. };
  198. SigningTime = __decorate([
  199. AsnType({ type: AsnTypeTypes.Choice })
  200. ], SigningTime);
  201. export { SigningTime };
  202. export class RandomNonce extends OctetString {
  203. }
  204. let SequenceNumber = class SequenceNumber {
  205. value;
  206. constructor(value = 0) {
  207. this.value = value;
  208. }
  209. toString() {
  210. return this.value.toString();
  211. }
  212. };
  213. __decorate([
  214. AsnProp({ type: AsnPropTypes.Integer })
  215. ], SequenceNumber.prototype, "value", void 0);
  216. SequenceNumber = __decorate([
  217. AsnType({ type: AsnTypeTypes.Choice })
  218. ], SequenceNumber);
  219. export { SequenceNumber };
  220. let CounterSignature = class CounterSignature extends cms.SignerInfo {
  221. };
  222. CounterSignature = __decorate([
  223. AsnType({ type: AsnTypeTypes.Sequence })
  224. ], CounterSignature);
  225. export { CounterSignature };
  226. let ChallengePassword = class ChallengePassword extends x509.DirectoryString {
  227. };
  228. ChallengePassword = __decorate([
  229. AsnType({ type: AsnTypeTypes.Choice })
  230. ], ChallengePassword);
  231. export { ChallengePassword };
  232. let ExtensionRequest = ExtensionRequest_1 = class ExtensionRequest extends x509.Extensions {
  233. constructor(items) {
  234. super(items);
  235. Object.setPrototypeOf(this, ExtensionRequest_1.prototype);
  236. }
  237. };
  238. ExtensionRequest = ExtensionRequest_1 = __decorate([
  239. AsnType({ type: AsnTypeTypes.Sequence })
  240. ], ExtensionRequest);
  241. export { ExtensionRequest };
  242. let ExtendedCertificateAttributes = ExtendedCertificateAttributes_1 = class ExtendedCertificateAttributes extends AsnArray {
  243. constructor(items) {
  244. super(items);
  245. Object.setPrototypeOf(this, ExtendedCertificateAttributes_1.prototype);
  246. }
  247. };
  248. ExtendedCertificateAttributes = ExtendedCertificateAttributes_1 = __decorate([
  249. AsnType({
  250. type: AsnTypeTypes.Set, itemType: cms.Attribute,
  251. })
  252. ], ExtendedCertificateAttributes);
  253. export { ExtendedCertificateAttributes };
  254. let FriendlyName = class FriendlyName {
  255. value;
  256. constructor(value = "") {
  257. this.value = value;
  258. }
  259. toString() {
  260. return this.value;
  261. }
  262. };
  263. __decorate([
  264. AsnProp({ type: AsnPropTypes.BmpString })
  265. ], FriendlyName.prototype, "value", void 0);
  266. FriendlyName = __decorate([
  267. AsnType({ type: AsnTypeTypes.Choice })
  268. ], FriendlyName);
  269. export { FriendlyName };
  270. export class LocalKeyId extends OctetString {
  271. }
  272. export class SigningDescription extends x509.DirectoryString {
  273. }
  274. let SMIMECapability = class SMIMECapability extends x509.AlgorithmIdentifier {
  275. };
  276. SMIMECapability = __decorate([
  277. AsnType({ type: AsnTypeTypes.Sequence })
  278. ], SMIMECapability);
  279. export { SMIMECapability };
  280. let SMIMECapabilities = SMIMECapabilities_1 = class SMIMECapabilities extends AsnArray {
  281. constructor(items) {
  282. super(items);
  283. Object.setPrototypeOf(this, SMIMECapabilities_1.prototype);
  284. }
  285. };
  286. SMIMECapabilities = SMIMECapabilities_1 = __decorate([
  287. AsnType({
  288. type: AsnTypeTypes.Sequence, itemType: SMIMECapability,
  289. })
  290. ], SMIMECapabilities);
  291. export { SMIMECapabilities };