der.js 1012 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. 'use strict';
  2. // Helper
  3. function reverse(map) {
  4. const res = {};
  5. Object.keys(map).forEach(function(key) {
  6. // Convert key to integer if it is stringified
  7. if ((key | 0) == key)
  8. key = key | 0;
  9. const value = map[key];
  10. res[value] = key;
  11. });
  12. return res;
  13. }
  14. exports.tagClass = {
  15. 0: 'universal',
  16. 1: 'application',
  17. 2: 'context',
  18. 3: 'private'
  19. };
  20. exports.tagClassByName = reverse(exports.tagClass);
  21. exports.tag = {
  22. 0x00: 'end',
  23. 0x01: 'bool',
  24. 0x02: 'int',
  25. 0x03: 'bitstr',
  26. 0x04: 'octstr',
  27. 0x05: 'null_',
  28. 0x06: 'objid',
  29. 0x07: 'objDesc',
  30. 0x08: 'external',
  31. 0x09: 'real',
  32. 0x0a: 'enum',
  33. 0x0b: 'embed',
  34. 0x0c: 'utf8str',
  35. 0x0d: 'relativeOid',
  36. 0x10: 'seq',
  37. 0x11: 'set',
  38. 0x12: 'numstr',
  39. 0x13: 'printstr',
  40. 0x14: 't61str',
  41. 0x15: 'videostr',
  42. 0x16: 'ia5str',
  43. 0x17: 'utctime',
  44. 0x18: 'gentime',
  45. 0x19: 'graphstr',
  46. 0x1a: 'iso646str',
  47. 0x1b: 'genstr',
  48. 0x1c: 'unistr',
  49. 0x1d: 'charstr',
  50. 0x1e: 'bmpstr'
  51. };
  52. exports.tagByName = reverse(exports.tag);