ContentIdentifier.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
  5. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Ess
  6. {
  7. public class ContentIdentifier
  8. : Asn1Encodable
  9. {
  10. private Asn1OctetString value;
  11. public static ContentIdentifier GetInstance(
  12. object o)
  13. {
  14. if (o == null || o is ContentIdentifier)
  15. {
  16. return (ContentIdentifier) o;
  17. }
  18. if (o is Asn1OctetString)
  19. {
  20. return new ContentIdentifier((Asn1OctetString) o);
  21. }
  22. throw new ArgumentException(
  23. "unknown object in 'ContentIdentifier' factory : "
  24. + BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.GetTypeName(o) + ".");
  25. }
  26. /**
  27. * Create from OCTET STRING whose octets represent the identifier.
  28. */
  29. public ContentIdentifier(
  30. Asn1OctetString value)
  31. {
  32. this.value = value;
  33. }
  34. /**
  35. * Create from byte array representing the identifier.
  36. */
  37. public ContentIdentifier(
  38. byte[] value)
  39. : this(new DerOctetString(value))
  40. {
  41. }
  42. public Asn1OctetString Value
  43. {
  44. get { return value; }
  45. }
  46. /**
  47. * The definition of ContentIdentifier is
  48. * <pre>
  49. * ContentIdentifier ::= OCTET STRING
  50. * </pre>
  51. * id-aa-contentIdentifier OBJECT IDENTIFIER ::= { iso(1)
  52. * member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
  53. * smime(16) id-aa(2) 7 }
  54. */
  55. public override Asn1Object ToAsn1Object()
  56. {
  57. return value;
  58. }
  59. }
  60. }
  61. #pragma warning restore
  62. #endif