ConvertValueToObject() public static method

If conversion is not possible.
public static ConvertValueToObject ( X509Extension ext ) : Asn1Object
ext X509Extension The extension to parse.
return Asn1Object
Beispiel #1
0
        public static SubjectKeyIdentifier GetInstance(
            object obj)
        {
            if (obj is SubjectKeyIdentifier)
            {
                return((SubjectKeyIdentifier)obj);
            }

            if (obj is SubjectPublicKeyInfo)
            {
                return(new SubjectKeyIdentifier((SubjectPublicKeyInfo)obj));
            }

            if (obj is Asn1OctetString)
            {
                return(new SubjectKeyIdentifier((Asn1OctetString)obj));
            }

            if (obj is X509Extension)
            {
                return(GetInstance(X509Extension.ConvertValueToObject((X509Extension)obj)));
            }

            throw new ArgumentException("Invalid SubjectKeyIdentifier: " + obj.GetType().Name);
        }
Beispiel #2
0
 public static KeyUsage GetInstance(object obj)
 {
     if (obj is KeyUsage)
     {
         return((KeyUsage)obj);
     }
     if (obj is X509Extension)
     {
         return(GetInstance(X509Extension.ConvertValueToObject((X509Extension)obj)));
     }
     return(new KeyUsage(DerBitString.GetInstance(obj)));
 }
Beispiel #3
0
 public static BasicConstraints GetInstance(object obj)
 {
     if ((obj == null) || (obj is BasicConstraints))
     {
         return((BasicConstraints)obj);
     }
     if (obj is Asn1Sequence)
     {
         return(new BasicConstraints((Asn1Sequence)obj));
     }
     if (!(obj is X509Extension))
     {
         throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj");
     }
     return(GetInstance(X509Extension.ConvertValueToObject((X509Extension)obj)));
 }
 public static BasicConstraints GetInstance(object obj)
 {
     if (obj is BasicConstraints)
     {
         return((BasicConstraints)obj);
     }
     if (obj is X509Extension)
     {
         return(GetInstance(X509Extension.ConvertValueToObject((X509Extension)obj)));
     }
     if (obj == null)
     {
         return(null);
     }
     return(new BasicConstraints(Asn1Sequence.GetInstance(obj)));
 }
 public static PrivateKeyUsagePeriod GetInstance(object obj)
 {
     if (obj is PrivateKeyUsagePeriod)
     {
         return((PrivateKeyUsagePeriod)obj);
     }
     if (obj is Asn1Sequence)
     {
         return(new PrivateKeyUsagePeriod((Asn1Sequence)obj));
     }
     if (obj is X509Extension)
     {
         return(PrivateKeyUsagePeriod.GetInstance(X509Extension.ConvertValueToObject((X509Extension)obj)));
     }
     throw new ArgumentException("unknown object in GetInstance: " + obj.GetType().FullName, "obj");
 }
 public static AuthorityKeyIdentifier GetInstance(object obj)
 {
     if (obj is AuthorityKeyIdentifier)
     {
         return((AuthorityKeyIdentifier)obj);
     }
     if (obj is X509Extension)
     {
         return(GetInstance(X509Extension.ConvertValueToObject((X509Extension)obj)));
     }
     if (obj == null)
     {
         return(null);
     }
     return(new AuthorityKeyIdentifier(Asn1Sequence.GetInstance(obj)));
 }
 public static ExtendedKeyUsage GetInstance(object obj)
 {
     if (obj is ExtendedKeyUsage)
     {
         return((ExtendedKeyUsage)obj);
     }
     if (obj is Asn1Sequence)
     {
         return(new ExtendedKeyUsage((Asn1Sequence)obj));
     }
     if (obj is X509Extension)
     {
         return(ExtendedKeyUsage.GetInstance(X509Extension.ConvertValueToObject((X509Extension)obj)));
     }
     throw new ArgumentException("Invalid ExtendedKeyUsage: " + obj.GetType().Name);
 }
Beispiel #8
0
 public static AuthorityKeyIdentifier GetInstance(object obj)
 {
     if (obj is AuthorityKeyIdentifier)
     {
         return((AuthorityKeyIdentifier)obj);
     }
     if (obj is Asn1Sequence)
     {
         return(new AuthorityKeyIdentifier((Asn1Sequence)obj));
     }
     if (obj is X509Extension)
     {
         return(AuthorityKeyIdentifier.GetInstance(X509Extension.ConvertValueToObject((X509Extension)obj)));
     }
     throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj");
 }
 public static BasicConstraints GetInstance(object obj)
 {
     if (obj == null || obj is BasicConstraints)
     {
         return((BasicConstraints)obj);
     }
     if (obj is Asn1Sequence)
     {
         return(new BasicConstraints((Asn1Sequence)obj));
     }
     if (obj is X509Extension)
     {
         return(GetInstance(X509Extension.ConvertValueToObject((X509Extension)obj)));
     }
     throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj");
 }
Beispiel #10
0
 public static PrivateKeyUsagePeriod GetInstance(object obj)
 {
     //IL_0051: Unknown result type (might be due to invalid IL or missing references)
     if (obj is PrivateKeyUsagePeriod)
     {
         return((PrivateKeyUsagePeriod)obj);
     }
     if (obj is Asn1Sequence)
     {
         return(new PrivateKeyUsagePeriod((Asn1Sequence)obj));
     }
     if (obj is X509Extension)
     {
         return(GetInstance(X509Extension.ConvertValueToObject((X509Extension)obj)));
     }
     throw new ArgumentException("unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj");
 }
 public static ExtendedKeyUsage GetInstance(object obj)
 {
     //IL_004c: Unknown result type (might be due to invalid IL or missing references)
     if (obj is ExtendedKeyUsage)
     {
         return((ExtendedKeyUsage)obj);
     }
     if (obj is Asn1Sequence)
     {
         return(new ExtendedKeyUsage((Asn1Sequence)obj));
     }
     if (obj is X509Extension)
     {
         return(GetInstance(X509Extension.ConvertValueToObject((X509Extension)obj)));
     }
     throw new ArgumentException("Invalid ExtendedKeyUsage: " + Platform.GetTypeName(obj));
 }
 public static ExtendedKeyUsage GetInstance(
     object obj)
 {
     if (obj is ExtendedKeyUsage)
     {
         return((ExtendedKeyUsage)obj);
     }
     if (obj is X509Extension)
     {
         return(GetInstance(X509Extension.ConvertValueToObject((X509Extension)obj)));
     }
     if (obj == null)
     {
         return(null);
     }
     return(new ExtendedKeyUsage(Asn1Sequence.GetInstance(obj)));
 }
Beispiel #13
0
 public static AuthorityKeyIdentifier GetInstance(object obj)
 {
     //IL_0051: Unknown result type (might be due to invalid IL or missing references)
     if (obj is AuthorityKeyIdentifier)
     {
         return((AuthorityKeyIdentifier)obj);
     }
     if (obj is Asn1Sequence)
     {
         return(new AuthorityKeyIdentifier((Asn1Sequence)obj));
     }
     if (obj is X509Extension)
     {
         return(GetInstance(X509Extension.ConvertValueToObject((X509Extension)obj)));
     }
     throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj");
 }
 public static BasicConstraints GetInstance(object obj)
 {
     //IL_0054: Unknown result type (might be due to invalid IL or missing references)
     if (obj == null || obj is BasicConstraints)
     {
         return((BasicConstraints)obj);
     }
     if (obj is Asn1Sequence)
     {
         return(new BasicConstraints((Asn1Sequence)obj));
     }
     if (obj is X509Extension)
     {
         return(GetInstance(X509Extension.ConvertValueToObject((X509Extension)obj)));
     }
     throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj");
 }
        public static AuthorityInformationAccess GetInstance(
            object obj)
        {
            if (obj is AuthorityInformationAccess)
            {
                return((AuthorityInformationAccess)obj);
            }

            if (obj is Asn1Sequence)
            {
                return(new AuthorityInformationAccess((Asn1Sequence)obj));
            }

            if (obj is X509Extension)
            {
                return(GetInstance(X509Extension.ConvertValueToObject((X509Extension)obj)));
            }

            throw new ArgumentException("unknown object in factory");
        }
Beispiel #16
0
 public static SubjectKeyIdentifier GetInstance(object obj)
 {
     if (obj is SubjectKeyIdentifier)
     {
         return((SubjectKeyIdentifier)obj);
     }
     if (obj is SubjectPublicKeyInfo)
     {
         return(new SubjectKeyIdentifier((SubjectPublicKeyInfo)obj));
     }
     if (obj is X509Extension)
     {
         return(GetInstance(X509Extension.ConvertValueToObject((X509Extension)obj)));
     }
     if (obj == null)
     {
         return(null);
     }
     return(new SubjectKeyIdentifier(Asn1OctetString.GetInstance(obj)));
 }
        public static BasicConstraints GetInstance(
            object obj)
        {
            if (obj == null || obj is BasicConstraints)
            {
                return((BasicConstraints)obj);
            }

            if (obj is Asn1Sequence)
            {
                return(new BasicConstraints((Asn1Sequence)obj));
            }

            if (obj is X509Extension)
            {
                return(GetInstance(X509Extension.ConvertValueToObject((X509Extension)obj)));
            }

            throw new ArgumentException("unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
        }
 public static SubjectKeyIdentifier GetInstance(object obj)
 {
     //IL_0060: Unknown result type (might be due to invalid IL or missing references)
     if (obj is SubjectKeyIdentifier)
     {
         return((SubjectKeyIdentifier)obj);
     }
     if (obj is SubjectPublicKeyInfo)
     {
         return(new SubjectKeyIdentifier((SubjectPublicKeyInfo)obj));
     }
     if (obj is Asn1OctetString)
     {
         return(new SubjectKeyIdentifier((Asn1OctetString)obj));
     }
     if (obj is X509Extension)
     {
         return(GetInstance(X509Extension.ConvertValueToObject((X509Extension)obj)));
     }
     throw new ArgumentException("Invalid SubjectKeyIdentifier: " + Platform.GetTypeName(obj));
 }
Beispiel #19
0
 public Asn1Encodable GetParsedValue()
 {
     return(X509Extension.ConvertValueToObject(this));
 }