AdditionalInformationSyntax.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X500;
  5. using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
  6. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.IsisMtt.X509
  7. {
  8. /**
  9. * Some other information of non-restrictive nature regarding the usage of this
  10. * certificate.
  11. *
  12. * <pre>
  13. * AdditionalInformationSyntax ::= DirectoryString (SIZE(1..2048))
  14. * </pre>
  15. */
  16. public class AdditionalInformationSyntax
  17. : Asn1Encodable
  18. {
  19. private readonly DirectoryString information;
  20. public static AdditionalInformationSyntax GetInstance(
  21. object obj)
  22. {
  23. if (obj is AdditionalInformationSyntax)
  24. return (AdditionalInformationSyntax) obj;
  25. if (obj is IAsn1String)
  26. return new AdditionalInformationSyntax(DirectoryString.GetInstance(obj));
  27. throw new ArgumentException("Unknown object in GetInstance: " + BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
  28. }
  29. private AdditionalInformationSyntax(
  30. DirectoryString information)
  31. {
  32. this.information = information;
  33. }
  34. /**
  35. * Constructor from a given details.
  36. *
  37. * @param information The describtion of the information.
  38. */
  39. public AdditionalInformationSyntax(
  40. string information)
  41. {
  42. this.information = new DirectoryString(information);
  43. }
  44. public virtual DirectoryString Information
  45. {
  46. get { return information; }
  47. }
  48. /**
  49. * Produce an object suitable for an Asn1OutputStream.
  50. * <p/>
  51. * Returns:
  52. * <p/>
  53. * <pre>
  54. * AdditionalInformationSyntax ::= DirectoryString (SIZE(1..2048))
  55. * </pre>
  56. *
  57. * @return an Asn1Object
  58. */
  59. public override Asn1Object ToAsn1Object()
  60. {
  61. return information.ToAsn1Object();
  62. }
  63. }
  64. }
  65. #pragma warning restore
  66. #endif