PKCSObjectIdentifiers.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs
  5. {
  6. public abstract class PkcsObjectIdentifiers
  7. {
  8. //
  9. // pkcs-1 OBJECT IDENTIFIER ::= {
  10. // iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 1 }
  11. //
  12. public const string Pkcs1 = "1.2.840.113549.1.1";
  13. internal static readonly DerObjectIdentifier Pkcs1Oid = new DerObjectIdentifier(Pkcs1);
  14. public static readonly DerObjectIdentifier RsaEncryption = Pkcs1Oid.Branch("1");
  15. public static readonly DerObjectIdentifier MD2WithRsaEncryption = Pkcs1Oid.Branch("2");
  16. public static readonly DerObjectIdentifier MD4WithRsaEncryption = Pkcs1Oid.Branch("3");
  17. public static readonly DerObjectIdentifier MD5WithRsaEncryption = Pkcs1Oid.Branch("4");
  18. public static readonly DerObjectIdentifier Sha1WithRsaEncryption = Pkcs1Oid.Branch("5");
  19. public static readonly DerObjectIdentifier SrsaOaepEncryptionSet = Pkcs1Oid.Branch("6");
  20. public static readonly DerObjectIdentifier IdRsaesOaep = Pkcs1Oid.Branch("7");
  21. public static readonly DerObjectIdentifier IdMgf1 = Pkcs1Oid.Branch("8");
  22. public static readonly DerObjectIdentifier IdPSpecified = Pkcs1Oid.Branch("9");
  23. public static readonly DerObjectIdentifier IdRsassaPss = Pkcs1Oid.Branch("10");
  24. public static readonly DerObjectIdentifier Sha256WithRsaEncryption = Pkcs1Oid.Branch("11");
  25. public static readonly DerObjectIdentifier Sha384WithRsaEncryption = Pkcs1Oid.Branch("12");
  26. public static readonly DerObjectIdentifier Sha512WithRsaEncryption = Pkcs1Oid.Branch("13");
  27. public static readonly DerObjectIdentifier Sha224WithRsaEncryption = Pkcs1Oid.Branch("14");
  28. /** PKCS#1: 1.2.840.113549.1.1.15 */
  29. public static readonly DerObjectIdentifier Sha512_224WithRSAEncryption = Pkcs1Oid.Branch("15");
  30. /** PKCS#1: 1.2.840.113549.1.1.16 */
  31. public static readonly DerObjectIdentifier Sha512_256WithRSAEncryption = Pkcs1Oid.Branch("16");
  32. //
  33. // pkcs-3 OBJECT IDENTIFIER ::= {
  34. // iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 3 }
  35. //
  36. public const string Pkcs3 = "1.2.840.113549.1.3";
  37. public static readonly DerObjectIdentifier DhKeyAgreement = new DerObjectIdentifier(Pkcs3 + ".1");
  38. //
  39. // pkcs-5 OBJECT IDENTIFIER ::= {
  40. // iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 5 }
  41. //
  42. public const string Pkcs5 = "1.2.840.113549.1.5";
  43. public static readonly DerObjectIdentifier PbeWithMD2AndDesCbc = new DerObjectIdentifier(Pkcs5 + ".1");
  44. public static readonly DerObjectIdentifier PbeWithMD2AndRC2Cbc = new DerObjectIdentifier(Pkcs5 + ".4");
  45. public static readonly DerObjectIdentifier PbeWithMD5AndDesCbc = new DerObjectIdentifier(Pkcs5 + ".3");
  46. public static readonly DerObjectIdentifier PbeWithMD5AndRC2Cbc = new DerObjectIdentifier(Pkcs5 + ".6");
  47. public static readonly DerObjectIdentifier PbeWithSha1AndDesCbc = new DerObjectIdentifier(Pkcs5 + ".10");
  48. public static readonly DerObjectIdentifier PbeWithSha1AndRC2Cbc = new DerObjectIdentifier(Pkcs5 + ".11");
  49. public static readonly DerObjectIdentifier IdPbeS2 = new DerObjectIdentifier(Pkcs5 + ".13");
  50. public static readonly DerObjectIdentifier IdPbkdf2 = new DerObjectIdentifier(Pkcs5 + ".12");
  51. //
  52. // encryptionAlgorithm OBJECT IDENTIFIER ::= {
  53. // iso(1) member-body(2) us(840) rsadsi(113549) 3 }
  54. //
  55. public const string EncryptionAlgorithm = "1.2.840.113549.3";
  56. public static readonly DerObjectIdentifier DesEde3Cbc = new DerObjectIdentifier(EncryptionAlgorithm + ".7");
  57. public static readonly DerObjectIdentifier RC2Cbc = new DerObjectIdentifier(EncryptionAlgorithm + ".2");
  58. public static readonly DerObjectIdentifier rc4 = new DerObjectIdentifier(EncryptionAlgorithm + ".4");
  59. //
  60. // object identifiers for digests
  61. //
  62. public const string DigestAlgorithm = "1.2.840.113549.2";
  63. //
  64. // md2 OBJECT IDENTIFIER ::=
  65. // {iso(1) member-body(2) US(840) rsadsi(113549) DigestAlgorithm(2) 2}
  66. //
  67. public static readonly DerObjectIdentifier MD2 = new DerObjectIdentifier(DigestAlgorithm + ".2");
  68. //
  69. // md4 OBJECT IDENTIFIER ::=
  70. // {iso(1) member-body(2) US(840) rsadsi(113549) DigestAlgorithm(2) 4}
  71. //
  72. public static readonly DerObjectIdentifier MD4 = new DerObjectIdentifier(DigestAlgorithm + ".4");
  73. //
  74. // md5 OBJECT IDENTIFIER ::=
  75. // {iso(1) member-body(2) US(840) rsadsi(113549) DigestAlgorithm(2) 5}
  76. //
  77. public static readonly DerObjectIdentifier MD5 = new DerObjectIdentifier(DigestAlgorithm + ".5");
  78. public static readonly DerObjectIdentifier IdHmacWithSha1 = new DerObjectIdentifier(DigestAlgorithm + ".7");
  79. public static readonly DerObjectIdentifier IdHmacWithSha224 = new DerObjectIdentifier(DigestAlgorithm + ".8");
  80. public static readonly DerObjectIdentifier IdHmacWithSha256 = new DerObjectIdentifier(DigestAlgorithm + ".9");
  81. public static readonly DerObjectIdentifier IdHmacWithSha384 = new DerObjectIdentifier(DigestAlgorithm + ".10");
  82. public static readonly DerObjectIdentifier IdHmacWithSha512 = new DerObjectIdentifier(DigestAlgorithm + ".11");
  83. //
  84. // pkcs-7 OBJECT IDENTIFIER ::= {
  85. // iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 7 }
  86. //
  87. public const string Pkcs7 = "1.2.840.113549.1.7";
  88. public static readonly DerObjectIdentifier Data = new DerObjectIdentifier(Pkcs7 + ".1");
  89. public static readonly DerObjectIdentifier SignedData = new DerObjectIdentifier(Pkcs7 + ".2");
  90. public static readonly DerObjectIdentifier EnvelopedData = new DerObjectIdentifier(Pkcs7 + ".3");
  91. public static readonly DerObjectIdentifier SignedAndEnvelopedData = new DerObjectIdentifier(Pkcs7 + ".4");
  92. public static readonly DerObjectIdentifier DigestedData = new DerObjectIdentifier(Pkcs7 + ".5");
  93. public static readonly DerObjectIdentifier EncryptedData = new DerObjectIdentifier(Pkcs7 + ".6");
  94. //
  95. // pkcs-9 OBJECT IDENTIFIER ::= {
  96. // iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 9 }
  97. //
  98. public const string Pkcs9 = "1.2.840.113549.1.9";
  99. public static readonly DerObjectIdentifier Pkcs9AtEmailAddress = new DerObjectIdentifier(Pkcs9 + ".1");
  100. public static readonly DerObjectIdentifier Pkcs9AtUnstructuredName = new DerObjectIdentifier(Pkcs9 + ".2");
  101. public static readonly DerObjectIdentifier Pkcs9AtContentType = new DerObjectIdentifier(Pkcs9 + ".3");
  102. public static readonly DerObjectIdentifier Pkcs9AtMessageDigest = new DerObjectIdentifier(Pkcs9 + ".4");
  103. public static readonly DerObjectIdentifier Pkcs9AtSigningTime = new DerObjectIdentifier(Pkcs9 + ".5");
  104. public static readonly DerObjectIdentifier Pkcs9AtCounterSignature = new DerObjectIdentifier(Pkcs9 + ".6");
  105. public static readonly DerObjectIdentifier Pkcs9AtChallengePassword = new DerObjectIdentifier(Pkcs9 + ".7");
  106. public static readonly DerObjectIdentifier Pkcs9AtUnstructuredAddress = new DerObjectIdentifier(Pkcs9 + ".8");
  107. public static readonly DerObjectIdentifier Pkcs9AtExtendedCertificateAttributes = new DerObjectIdentifier(Pkcs9 + ".9");
  108. public static readonly DerObjectIdentifier Pkcs9AtSigningDescription = new DerObjectIdentifier(Pkcs9 + ".13");
  109. public static readonly DerObjectIdentifier Pkcs9AtExtensionRequest = new DerObjectIdentifier(Pkcs9 + ".14");
  110. public static readonly DerObjectIdentifier Pkcs9AtSmimeCapabilities = new DerObjectIdentifier(Pkcs9 + ".15");
  111. public static readonly DerObjectIdentifier IdSmime = new DerObjectIdentifier(Pkcs9 + ".16");
  112. public static readonly DerObjectIdentifier Pkcs9AtFriendlyName = new DerObjectIdentifier(Pkcs9 + ".20");
  113. public static readonly DerObjectIdentifier Pkcs9AtLocalKeyID = new DerObjectIdentifier(Pkcs9 + ".21");
  114. public static readonly DerObjectIdentifier X509CertType = new DerObjectIdentifier(Pkcs9 + ".22.1");
  115. public const string CertTypes = Pkcs9 + ".22";
  116. public static readonly DerObjectIdentifier X509Certificate = new DerObjectIdentifier(CertTypes + ".1");
  117. public static readonly DerObjectIdentifier SdsiCertificate = new DerObjectIdentifier(CertTypes + ".2");
  118. public const string CrlTypes = Pkcs9 + ".23";
  119. public static readonly DerObjectIdentifier X509Crl = new DerObjectIdentifier(CrlTypes + ".1");
  120. public static readonly DerObjectIdentifier IdAlg = IdSmime.Branch("3");
  121. public static readonly DerObjectIdentifier IdAlgEsdh = IdAlg.Branch("5");
  122. public static readonly DerObjectIdentifier IdAlgCms3DesWrap = IdAlg.Branch("6");
  123. public static readonly DerObjectIdentifier IdAlgCmsRC2Wrap = IdAlg.Branch("7");
  124. public static readonly DerObjectIdentifier IdAlgPwriKek = IdAlg.Branch("9");
  125. public static readonly DerObjectIdentifier IdAlgSsdh = IdAlg.Branch("10");
  126. /*
  127. * <pre>
  128. * -- RSA-KEM Key Transport Algorithm
  129. *
  130. * id-rsa-kem OID ::= {
  131. * iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1)
  132. * pkcs-9(9) smime(16) alg(3) 14
  133. * }
  134. * </pre>
  135. */
  136. public static readonly DerObjectIdentifier IdRsaKem = IdAlg.Branch("14");
  137. /**
  138. * <pre>
  139. * id-alg-AEADChaCha20Poly1305 OBJECT IDENTIFIER ::=
  140. * { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1)
  141. * pkcs9(9) smime(16) alg(3) 18 }
  142. *
  143. * AEADChaCha20Poly1305Nonce ::= OCTET STRING (SIZE(12))
  144. * </pre>
  145. */
  146. public static readonly DerObjectIdentifier IdAlgAeadChaCha20Poly1305 = IdAlg.Branch("18");
  147. //
  148. // SMIME capability sub oids.
  149. //
  150. public static readonly DerObjectIdentifier PreferSignedData = Pkcs9AtSmimeCapabilities.Branch("1");
  151. public static readonly DerObjectIdentifier CannotDecryptAny = Pkcs9AtSmimeCapabilities.Branch("2");
  152. public static readonly DerObjectIdentifier SmimeCapabilitiesVersions = Pkcs9AtSmimeCapabilities.Branch("3");
  153. //
  154. // other SMIME attributes
  155. //
  156. public static readonly DerObjectIdentifier IdAAReceiptRequest = IdSmime.Branch("2.1");
  157. //
  158. // id-ct OBJECT IDENTIFIER ::= {iso(1) member-body(2) usa(840)
  159. // rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) ct(1)}
  160. //
  161. public const string IdCT = "1.2.840.113549.1.9.16.1";
  162. public static readonly DerObjectIdentifier IdCTAuthData = new DerObjectIdentifier(IdCT + ".2");
  163. public static readonly DerObjectIdentifier IdCTTstInfo = new DerObjectIdentifier(IdCT + ".4");
  164. public static readonly DerObjectIdentifier IdCTCompressedData = new DerObjectIdentifier(IdCT + ".9");
  165. public static readonly DerObjectIdentifier IdCTAuthEnvelopedData = new DerObjectIdentifier(IdCT + ".23");
  166. public static readonly DerObjectIdentifier IdCTTimestampedData = new DerObjectIdentifier(IdCT + ".31");
  167. //
  168. // id-cti OBJECT IDENTIFIER ::= {iso(1) member-body(2) usa(840)
  169. // rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) cti(6)}
  170. //
  171. public const string IdCti = "1.2.840.113549.1.9.16.6";
  172. public static readonly DerObjectIdentifier IdCtiEtsProofOfOrigin = new DerObjectIdentifier(IdCti + ".1");
  173. public static readonly DerObjectIdentifier IdCtiEtsProofOfReceipt = new DerObjectIdentifier(IdCti + ".2");
  174. public static readonly DerObjectIdentifier IdCtiEtsProofOfDelivery = new DerObjectIdentifier(IdCti + ".3");
  175. public static readonly DerObjectIdentifier IdCtiEtsProofOfSender = new DerObjectIdentifier(IdCti + ".4");
  176. public static readonly DerObjectIdentifier IdCtiEtsProofOfApproval = new DerObjectIdentifier(IdCti + ".5");
  177. public static readonly DerObjectIdentifier IdCtiEtsProofOfCreation = new DerObjectIdentifier(IdCti + ".6");
  178. //
  179. // id-aa OBJECT IDENTIFIER ::= {iso(1) member-body(2) usa(840)
  180. // rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) attributes(2)}
  181. //
  182. public const string IdAA = "1.2.840.113549.1.9.16.2";
  183. public static readonly DerObjectIdentifier IdAAOid = new DerObjectIdentifier(IdAA);
  184. public static readonly DerObjectIdentifier IdAAContentHint = new DerObjectIdentifier(IdAA + ".4"); // See RFC 2634
  185. public static readonly DerObjectIdentifier IdAAMsgSigDigest = new DerObjectIdentifier(IdAA + ".5");
  186. public static readonly DerObjectIdentifier IdAAContentReference = new DerObjectIdentifier(IdAA + ".10");
  187. /*
  188. * id-aa-encrypKeyPref OBJECT IDENTIFIER ::= {id-aa 11}
  189. *
  190. */
  191. public static readonly DerObjectIdentifier IdAAEncrypKeyPref = new DerObjectIdentifier(IdAA + ".11");
  192. public static readonly DerObjectIdentifier IdAASigningCertificate = new DerObjectIdentifier(IdAA + ".12");
  193. public static readonly DerObjectIdentifier IdAASigningCertificateV2 = new DerObjectIdentifier(IdAA + ".47");
  194. public static readonly DerObjectIdentifier IdAAContentIdentifier = new DerObjectIdentifier(IdAA + ".7"); // See RFC 2634
  195. /*
  196. * RFC 3126
  197. */
  198. public static readonly DerObjectIdentifier IdAASignatureTimeStampToken = new DerObjectIdentifier(IdAA + ".14");
  199. public static readonly DerObjectIdentifier IdAAEtsSigPolicyID = new DerObjectIdentifier(IdAA + ".15");
  200. public static readonly DerObjectIdentifier IdAAEtsCommitmentType = new DerObjectIdentifier(IdAA + ".16");
  201. public static readonly DerObjectIdentifier IdAAEtsSignerLocation = new DerObjectIdentifier(IdAA + ".17");
  202. public static readonly DerObjectIdentifier IdAAEtsSignerAttr = new DerObjectIdentifier(IdAA + ".18");
  203. public static readonly DerObjectIdentifier IdAAEtsOtherSigCert = new DerObjectIdentifier(IdAA + ".19");
  204. public static readonly DerObjectIdentifier IdAAEtsContentTimestamp = new DerObjectIdentifier(IdAA + ".20");
  205. public static readonly DerObjectIdentifier IdAAEtsCertificateRefs = new DerObjectIdentifier(IdAA + ".21");
  206. public static readonly DerObjectIdentifier IdAAEtsRevocationRefs = new DerObjectIdentifier(IdAA + ".22");
  207. public static readonly DerObjectIdentifier IdAAEtsCertValues = new DerObjectIdentifier(IdAA + ".23");
  208. public static readonly DerObjectIdentifier IdAAEtsRevocationValues = new DerObjectIdentifier(IdAA + ".24");
  209. public static readonly DerObjectIdentifier IdAAEtsEscTimeStamp = new DerObjectIdentifier(IdAA + ".25");
  210. public static readonly DerObjectIdentifier IdAAEtsCertCrlTimestamp = new DerObjectIdentifier(IdAA + ".26");
  211. public static readonly DerObjectIdentifier IdAAEtsArchiveTimestamp = new DerObjectIdentifier(IdAA + ".27");
  212. /** PKCS#9: 1.2.840.113549.1.9.16.2.37 - <a href="https://tools.ietf.org/html/rfc4108#section-2.2.5">RFC 4108</a> */
  213. public static readonly DerObjectIdentifier IdAADecryptKeyID = IdAAOid.Branch("37");
  214. /** PKCS#9: 1.2.840.113549.1.9.16.2.38 - <a href="https://tools.ietf.org/html/rfc4108#section-2.2.6">RFC 4108</a> */
  215. public static readonly DerObjectIdentifier IdAAImplCryptoAlgs = IdAAOid.Branch("38");
  216. /** PKCS#9: 1.2.840.113549.1.9.16.2.54 <a href="https://tools.ietf.org/html/rfc7030">RFC7030</a>*/
  217. public static readonly DerObjectIdentifier IdAAAsymmDecryptKeyID = IdAAOid.Branch("54");
  218. /** PKCS#9: 1.2.840.113549.1.9.16.2.43 <a href="https://tools.ietf.org/html/rfc7030">RFC7030</a>*/
  219. public static readonly DerObjectIdentifier IdAAImplCompressAlgs = IdAAOid.Branch("43");
  220. /** PKCS#9: 1.2.840.113549.1.9.16.2.40 <a href="https://tools.ietf.org/html/rfc7030">RFC7030</a>*/
  221. public static readonly DerObjectIdentifier IdAACommunityIdentifiers = IdAAOid.Branch("40");
  222. public static readonly DerObjectIdentifier IdAASigPolicyID = IdAAEtsSigPolicyID;
  223. public static readonly DerObjectIdentifier IdAACommitmentType = IdAAEtsCommitmentType;
  224. public static readonly DerObjectIdentifier IdAASignerLocation = IdAAEtsSignerLocation;
  225. public static readonly DerObjectIdentifier IdAAOtherSigCert = IdAAEtsOtherSigCert;
  226. //
  227. // id-spq OBJECT IDENTIFIER ::= {iso(1) member-body(2) usa(840)
  228. // rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) id-spq(5)}
  229. //
  230. public const string IdSpq = "1.2.840.113549.1.9.16.5";
  231. public static readonly DerObjectIdentifier IdSpqEtsUri = new DerObjectIdentifier(IdSpq + ".1");
  232. public static readonly DerObjectIdentifier IdSpqEtsUNotice = new DerObjectIdentifier(IdSpq + ".2");
  233. //
  234. // pkcs-12 OBJECT IDENTIFIER ::= {
  235. // iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 12 }
  236. //
  237. public const string Pkcs12 = "1.2.840.113549.1.12";
  238. public const string BagTypes = Pkcs12 + ".10.1";
  239. public static readonly DerObjectIdentifier KeyBag = new DerObjectIdentifier(BagTypes + ".1");
  240. public static readonly DerObjectIdentifier Pkcs8ShroudedKeyBag = new DerObjectIdentifier(BagTypes + ".2");
  241. public static readonly DerObjectIdentifier CertBag = new DerObjectIdentifier(BagTypes + ".3");
  242. public static readonly DerObjectIdentifier CrlBag = new DerObjectIdentifier(BagTypes + ".4");
  243. public static readonly DerObjectIdentifier SecretBag = new DerObjectIdentifier(BagTypes + ".5");
  244. public static readonly DerObjectIdentifier SafeContentsBag = new DerObjectIdentifier(BagTypes + ".6");
  245. public const string Pkcs12PbeIds = Pkcs12 + ".1";
  246. public static readonly DerObjectIdentifier PbeWithShaAnd128BitRC4 = new DerObjectIdentifier(Pkcs12PbeIds + ".1");
  247. public static readonly DerObjectIdentifier PbeWithShaAnd40BitRC4 = new DerObjectIdentifier(Pkcs12PbeIds + ".2");
  248. public static readonly DerObjectIdentifier PbeWithShaAnd3KeyTripleDesCbc = new DerObjectIdentifier(Pkcs12PbeIds + ".3");
  249. public static readonly DerObjectIdentifier PbeWithShaAnd2KeyTripleDesCbc = new DerObjectIdentifier(Pkcs12PbeIds + ".4");
  250. public static readonly DerObjectIdentifier PbeWithShaAnd128BitRC2Cbc = new DerObjectIdentifier(Pkcs12PbeIds + ".5");
  251. public static readonly DerObjectIdentifier PbewithShaAnd40BitRC2Cbc = new DerObjectIdentifier(Pkcs12PbeIds + ".6");
  252. }
  253. }
  254. #pragma warning restore
  255. #endif