123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
- #pragma warning disable
- using System;
- using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
- namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X500
- {
- public class DirectoryString
- : Asn1Encodable, IAsn1Choice, IAsn1String
- {
- private readonly DerStringBase str;
- public static DirectoryString GetInstance(object obj)
- {
- if (obj == null || obj is DirectoryString)
- return (DirectoryString) obj;
- if (obj is DerStringBase)
- {
- if (obj is DerT61String
- || obj is DerPrintableString
- || obj is DerUniversalString
- || obj is DerUtf8String
- || obj is DerBmpString)
- {
- return new DirectoryString((DerStringBase) obj);
- }
- }
- throw new ArgumentException("unknown object in factory: " + BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
- }
- public static DirectoryString GetInstance(
- Asn1TaggedObject obj,
- bool isExplicit)
- {
- if (!isExplicit)
- throw new ArgumentException("choice item must be explicitly tagged");
- return GetInstance(obj.GetObject());
- }
- private DirectoryString(
- DerStringBase str)
- {
- this.str = str;
- }
- public DirectoryString(
- string str)
- {
- this.str = new DerUtf8String(str);
- }
- public string GetString()
- {
- return str.GetString();
- }
- /**
- * <pre>
- * DirectoryString ::= CHOICE {
- * teletexString TeletexString (SIZE (1..MAX)),
- * printableString PrintableString (SIZE (1..MAX)),
- * universalString UniversalString (SIZE (1..MAX)),
- * utf8String UTF8String (SIZE (1..MAX)),
- * bmpString BMPString (SIZE (1..MAX)) }
- * </pre>
- */
- public override Asn1Object ToAsn1Object()
- {
- return str.ToAsn1Object();
- }
- }
- }
- #pragma warning restore
- #endif
|