oids.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /**
  2. * Object IDs for ASN.1.
  3. *
  4. * @author Dave Longley
  5. *
  6. * Copyright (c) 2010-2013 Digital Bazaar, Inc.
  7. */
  8. var forge = require('./forge');
  9. forge.pki = forge.pki || {};
  10. var oids = module.exports = forge.pki.oids = forge.oids = forge.oids || {};
  11. // set id to name mapping and name to id mapping
  12. function _IN(id, name) {
  13. oids[id] = name;
  14. oids[name] = id;
  15. }
  16. // set id to name mapping only
  17. function _I_(id, name) {
  18. oids[id] = name;
  19. }
  20. // algorithm OIDs
  21. _IN('1.2.840.113549.1.1.1', 'rsaEncryption');
  22. // Note: md2 & md4 not implemented
  23. //_IN('1.2.840.113549.1.1.2', 'md2WithRSAEncryption');
  24. //_IN('1.2.840.113549.1.1.3', 'md4WithRSAEncryption');
  25. _IN('1.2.840.113549.1.1.4', 'md5WithRSAEncryption');
  26. _IN('1.2.840.113549.1.1.5', 'sha1WithRSAEncryption');
  27. _IN('1.2.840.113549.1.1.7', 'RSAES-OAEP');
  28. _IN('1.2.840.113549.1.1.8', 'mgf1');
  29. _IN('1.2.840.113549.1.1.9', 'pSpecified');
  30. _IN('1.2.840.113549.1.1.10', 'RSASSA-PSS');
  31. _IN('1.2.840.113549.1.1.11', 'sha256WithRSAEncryption');
  32. _IN('1.2.840.113549.1.1.12', 'sha384WithRSAEncryption');
  33. _IN('1.2.840.113549.1.1.13', 'sha512WithRSAEncryption');
  34. _IN('1.2.840.10040.4.3', 'dsa-with-sha1');
  35. _IN('1.3.14.3.2.7', 'desCBC');
  36. _IN('1.3.14.3.2.26', 'sha1');
  37. _IN('2.16.840.1.101.3.4.2.1', 'sha256');
  38. _IN('2.16.840.1.101.3.4.2.2', 'sha384');
  39. _IN('2.16.840.1.101.3.4.2.3', 'sha512');
  40. _IN('1.2.840.113549.2.5', 'md5');
  41. // pkcs#7 content types
  42. _IN('1.2.840.113549.1.7.1', 'data');
  43. _IN('1.2.840.113549.1.7.2', 'signedData');
  44. _IN('1.2.840.113549.1.7.3', 'envelopedData');
  45. _IN('1.2.840.113549.1.7.4', 'signedAndEnvelopedData');
  46. _IN('1.2.840.113549.1.7.5', 'digestedData');
  47. _IN('1.2.840.113549.1.7.6', 'encryptedData');
  48. // pkcs#9 oids
  49. _IN('1.2.840.113549.1.9.1', 'emailAddress');
  50. _IN('1.2.840.113549.1.9.2', 'unstructuredName');
  51. _IN('1.2.840.113549.1.9.3', 'contentType');
  52. _IN('1.2.840.113549.1.9.4', 'messageDigest');
  53. _IN('1.2.840.113549.1.9.5', 'signingTime');
  54. _IN('1.2.840.113549.1.9.6', 'counterSignature');
  55. _IN('1.2.840.113549.1.9.7', 'challengePassword');
  56. _IN('1.2.840.113549.1.9.8', 'unstructuredAddress');
  57. _IN('1.2.840.113549.1.9.14', 'extensionRequest');
  58. _IN('1.2.840.113549.1.9.20', 'friendlyName');
  59. _IN('1.2.840.113549.1.9.21', 'localKeyId');
  60. _IN('1.2.840.113549.1.9.22.1', 'x509Certificate');
  61. // pkcs#12 safe bags
  62. _IN('1.2.840.113549.1.12.10.1.1', 'keyBag');
  63. _IN('1.2.840.113549.1.12.10.1.2', 'pkcs8ShroudedKeyBag');
  64. _IN('1.2.840.113549.1.12.10.1.3', 'certBag');
  65. _IN('1.2.840.113549.1.12.10.1.4', 'crlBag');
  66. _IN('1.2.840.113549.1.12.10.1.5', 'secretBag');
  67. _IN('1.2.840.113549.1.12.10.1.6', 'safeContentsBag');
  68. // password-based-encryption for pkcs#12
  69. _IN('1.2.840.113549.1.5.13', 'pkcs5PBES2');
  70. _IN('1.2.840.113549.1.5.12', 'pkcs5PBKDF2');
  71. _IN('1.2.840.113549.1.12.1.1', 'pbeWithSHAAnd128BitRC4');
  72. _IN('1.2.840.113549.1.12.1.2', 'pbeWithSHAAnd40BitRC4');
  73. _IN('1.2.840.113549.1.12.1.3', 'pbeWithSHAAnd3-KeyTripleDES-CBC');
  74. _IN('1.2.840.113549.1.12.1.4', 'pbeWithSHAAnd2-KeyTripleDES-CBC');
  75. _IN('1.2.840.113549.1.12.1.5', 'pbeWithSHAAnd128BitRC2-CBC');
  76. _IN('1.2.840.113549.1.12.1.6', 'pbewithSHAAnd40BitRC2-CBC');
  77. // hmac OIDs
  78. _IN('1.2.840.113549.2.7', 'hmacWithSHA1');
  79. _IN('1.2.840.113549.2.8', 'hmacWithSHA224');
  80. _IN('1.2.840.113549.2.9', 'hmacWithSHA256');
  81. _IN('1.2.840.113549.2.10', 'hmacWithSHA384');
  82. _IN('1.2.840.113549.2.11', 'hmacWithSHA512');
  83. // symmetric key algorithm oids
  84. _IN('1.2.840.113549.3.7', 'des-EDE3-CBC');
  85. _IN('2.16.840.1.101.3.4.1.2', 'aes128-CBC');
  86. _IN('2.16.840.1.101.3.4.1.22', 'aes192-CBC');
  87. _IN('2.16.840.1.101.3.4.1.42', 'aes256-CBC');
  88. // certificate issuer/subject OIDs
  89. _IN('2.5.4.3', 'commonName');
  90. _IN('2.5.4.5', 'serialName');
  91. _IN('2.5.4.6', 'countryName');
  92. _IN('2.5.4.7', 'localityName');
  93. _IN('2.5.4.8', 'stateOrProvinceName');
  94. _IN('2.5.4.10', 'organizationName');
  95. _IN('2.5.4.11', 'organizationalUnitName');
  96. // X.509 extension OIDs
  97. _IN('2.16.840.1.113730.1.1', 'nsCertType');
  98. _I_('2.5.29.1', 'authorityKeyIdentifier'); // deprecated, use .35
  99. _I_('2.5.29.2', 'keyAttributes'); // obsolete use .37 or .15
  100. _I_('2.5.29.3', 'certificatePolicies'); // deprecated, use .32
  101. _I_('2.5.29.4', 'keyUsageRestriction'); // obsolete use .37 or .15
  102. _I_('2.5.29.5', 'policyMapping'); // deprecated use .33
  103. _I_('2.5.29.6', 'subtreesConstraint'); // obsolete use .30
  104. _I_('2.5.29.7', 'subjectAltName'); // deprecated use .17
  105. _I_('2.5.29.8', 'issuerAltName'); // deprecated use .18
  106. _I_('2.5.29.9', 'subjectDirectoryAttributes');
  107. _I_('2.5.29.10', 'basicConstraints'); // deprecated use .19
  108. _I_('2.5.29.11', 'nameConstraints'); // deprecated use .30
  109. _I_('2.5.29.12', 'policyConstraints'); // deprecated use .36
  110. _I_('2.5.29.13', 'basicConstraints'); // deprecated use .19
  111. _IN('2.5.29.14', 'subjectKeyIdentifier');
  112. _IN('2.5.29.15', 'keyUsage');
  113. _I_('2.5.29.16', 'privateKeyUsagePeriod');
  114. _IN('2.5.29.17', 'subjectAltName');
  115. _IN('2.5.29.18', 'issuerAltName');
  116. _IN('2.5.29.19', 'basicConstraints');
  117. _I_('2.5.29.20', 'cRLNumber');
  118. _I_('2.5.29.21', 'cRLReason');
  119. _I_('2.5.29.22', 'expirationDate');
  120. _I_('2.5.29.23', 'instructionCode');
  121. _I_('2.5.29.24', 'invalidityDate');
  122. _I_('2.5.29.25', 'cRLDistributionPoints'); // deprecated use .31
  123. _I_('2.5.29.26', 'issuingDistributionPoint'); // deprecated use .28
  124. _I_('2.5.29.27', 'deltaCRLIndicator');
  125. _I_('2.5.29.28', 'issuingDistributionPoint');
  126. _I_('2.5.29.29', 'certificateIssuer');
  127. _I_('2.5.29.30', 'nameConstraints');
  128. _IN('2.5.29.31', 'cRLDistributionPoints');
  129. _IN('2.5.29.32', 'certificatePolicies');
  130. _I_('2.5.29.33', 'policyMappings');
  131. _I_('2.5.29.34', 'policyConstraints'); // deprecated use .36
  132. _IN('2.5.29.35', 'authorityKeyIdentifier');
  133. _I_('2.5.29.36', 'policyConstraints');
  134. _IN('2.5.29.37', 'extKeyUsage');
  135. _I_('2.5.29.46', 'freshestCRL');
  136. _I_('2.5.29.54', 'inhibitAnyPolicy');
  137. // extKeyUsage purposes
  138. _IN('1.3.6.1.4.1.11129.2.4.2', 'timestampList');
  139. _IN('1.3.6.1.5.5.7.1.1', 'authorityInfoAccess');
  140. _IN('1.3.6.1.5.5.7.3.1', 'serverAuth');
  141. _IN('1.3.6.1.5.5.7.3.2', 'clientAuth');
  142. _IN('1.3.6.1.5.5.7.3.3', 'codeSigning');
  143. _IN('1.3.6.1.5.5.7.3.4', 'emailProtection');
  144. _IN('1.3.6.1.5.5.7.3.8', 'timeStamping');