public static IX509Store Create(
            string type,
            IX509StoreParameters parameters)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            string[] parts = type.ToUpper(CultureInfo.InvariantCulture).Split('/');

            if (parts.Length < 2)
            {
                throw new ArgumentException("type");
            }


            switch (parts[0])
            {
            case "ATTRIBUTECERTIFICATE":
            case "CERTIFICATE":
            case "CERTIFICATEPAIR":
            case "CRL":
            {
                if (parts[1] == "COLLECTION")
                {
                    X509CollectionStoreParameters p = (X509CollectionStoreParameters)parameters;
                    return(new X509CollectionStore(p.GetCollection()));
                }
                break;
            }
            }

            throw new NoSuchStoreException("X.509 store type '" + type + "' not available.");
        }
Exemplo n.º 2
0
        public static IX509Store Create(
			string					type,
			IX509StoreParameters	parameters)
        {
            if (type == null)
                throw new ArgumentNullException("type");

            string[] parts = type.ToUpper(CultureInfo.InvariantCulture).Split('/');

            if (parts.Length < 2)
                throw new ArgumentException("type");

            switch (parts[0])
            {
                case "ATTRIBUTECERTIFICATE":
                case "CERTIFICATE":
                case "CERTIFICATEPAIR":
                case "CRL":
                {
                    if (parts[1] == "COLLECTION")
                    {
                        X509CollectionStoreParameters p = (X509CollectionStoreParameters) parameters;
                        return new X509CollectionStore(p.GetCollection());
                    }
                    break;
                }
            }

            throw new NoSuchStoreException("X.509 store type '" + type + "' not available.");
        }
Exemplo n.º 3
0
        public static IX509Store Create(string type, IX509StoreParameters parameters)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            string[] array = Platform.ToUpperInvariant(type).Split(new char[]
            {
                '/'
            });
            if (array.Length < 2)
            {
                throw new ArgumentException("type");
            }
            if (array[1] != "COLLECTION")
            {
                throw new NoSuchStoreException("X.509 store type '" + type + "' not available.");
            }
            X509CollectionStoreParameters x509CollectionStoreParameters = (X509CollectionStoreParameters)parameters;
            ICollection collection = x509CollectionStoreParameters.GetCollection();
            string      a;

            if ((a = array[0]) != null)
            {
                if (!(a == "ATTRIBUTECERTIFICATE"))
                {
                    if (!(a == "CERTIFICATE"))
                    {
                        if (!(a == "CERTIFICATEPAIR"))
                        {
                            if (!(a == "CRL"))
                            {
                                goto IL_F8;
                            }
                            X509StoreFactory.checkCorrectType(collection, typeof(X509Crl));
                        }
                        else
                        {
                            X509StoreFactory.checkCorrectType(collection, typeof(X509CertificatePair));
                        }
                    }
                    else
                    {
                        X509StoreFactory.checkCorrectType(collection, typeof(X509Certificate));
                    }
                }
                else
                {
                    X509StoreFactory.checkCorrectType(collection, typeof(IX509AttributeCertificate));
                }
                return(new X509CollectionStore(collection));
            }
IL_F8:
            throw new NoSuchStoreException("X.509 store type '" + type + "' not available.");
        }
Exemplo n.º 4
0
        public static IX509Store Create(
            string type,
            IX509StoreParameters parameters)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            string[] parts = Platform.ToUpperInvariant(type).Split('/');

            if (parts.Length < 2)
            {
                throw new ArgumentException("type");
            }

            if (parts[1] != "COLLECTION")
            {
                throw new NoSuchStoreException("X.509 store type '" + type + "' not available.");
            }

            X509CollectionStoreParameters p = (X509CollectionStoreParameters)parameters;
            ICollection coll = p.GetCollection();

            switch (parts[0])
            {
            case "ATTRIBUTECERTIFICATE":
                checkCorrectType(coll, typeof(IX509AttributeCertificate));
                break;

            case "CERTIFICATE":
                checkCorrectType(coll, typeof(X509Certificate));
                break;

            case "CERTIFICATEPAIR":
                checkCorrectType(coll, typeof(X509CertificatePair));
                break;

            case "CRL":
                checkCorrectType(coll, typeof(X509Crl));
                break;

            default:
                throw new NoSuchStoreException("X.509 store type '" + type + "' not available.");
            }

            return(new X509CollectionStore(coll));
        }
Exemplo n.º 5
0
        public static IX509Store Create(string type, IX509StoreParameters parameters)
        {
            //IL_0008: Unknown result type (might be due to invalid IL or missing references)
            //IL_0032: Unknown result type (might be due to invalid IL or missing references)
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            string[] array = Platform.ToUpperInvariant(type).Split(new char[1] {
                '/'
            });
            if (array.Length < 2)
            {
                throw new ArgumentException("type");
            }
            if (array[1] != "COLLECTION")
            {
                throw new NoSuchStoreException("X.509 store type '" + type + "' not available.");
            }
            X509CollectionStoreParameters x509CollectionStoreParameters = (X509CollectionStoreParameters)parameters;

            global::System.Collections.ICollection collection = x509CollectionStoreParameters.GetCollection();
            switch (array[0])
            {
            case "ATTRIBUTECERTIFICATE":
                checkCorrectType(collection, typeof(IX509AttributeCertificate));
                break;

            case "CERTIFICATE":
                checkCorrectType(collection, typeof(X509Certificate));
                break;

            case "CERTIFICATEPAIR":
                checkCorrectType(collection, typeof(X509CertificatePair));
                break;

            case "CRL":
                checkCorrectType(collection, typeof(X509Crl));
                break;

            default:
                throw new NoSuchStoreException("X.509 store type '" + type + "' not available.");
            }
            return(new X509CollectionStore(collection));
        }
Exemplo n.º 6
0
        public static IX509Store Create(string type, IX509StoreParameters parameters)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            string[] parts = type.ToUpperInvariant().Split('/');

            if (parts.Length < 2)
            {
                throw new ArgumentException("type");
            }

            if (parts[1] != "COLLECTION")
            {
                throw new NoSuchStoreException("X.509 store type '" + type + "' not available.");
            }

            var p = (X509CollectionStoreParameters) parameters;
            ICollection coll = p.GetCollection();

            switch (parts[0])
            {
                case "ATTRIBUTECERTIFICATE":
                    CheckCorrectType(coll, typeof (IX509AttributeCertificate));
                    break;
                case "CERTIFICATE":
                    CheckCorrectType(coll, typeof (X509Certificate));
                    break;
                case "CERTIFICATEPAIR":
                    CheckCorrectType(coll, typeof (X509CertificatePair));
                    break;
                case "CRL":
                    CheckCorrectType(coll, typeof (X509Crl));
                    break;
                default:
                    throw new NoSuchStoreException("X.509 store type '" + type + "' not available.");
            }

            return new X509CollectionStore(coll);
        }