private X509Attestation(
            X509Certificates clientCertificates, X509Certificates rootCertificates, X509CAReferences caReferences)
        {
            /* SRS_X509_ATTESTATION_21_014: [The constructor shall throws ArgumentException if `clientCertificates`,
             *                              `rootCertificates`, and `caReferences` are null.] */
            if ((clientCertificates == null) && (rootCertificates == null) && (caReferences == null))
            {
                throw new ProvisioningServiceClientException("Attestation shall receive one no null Certificate");
            }

            /* SRS_X509_ATTESTATION_21_015: [The constructor shall throws ArgumentException if more than one
             *                              certificate type are not null.] */
            if (((clientCertificates != null) && ((rootCertificates != null) || (caReferences != null))) ||
                ((rootCertificates != null) && (caReferences != null)))
            {
                throw new ProvisioningServiceClientException("Attestation cannot receive more than one certificate together");
            }

            /* SRS_X509_ATTESTATION_21_016: [The constructor shall store the provided `clientCertificates`,
             *                              `rootCertificates`, and `caReferences`.] */

            try
            {
                ClientCertificates = clientCertificates;
                RootCertificates   = rootCertificates;
                CAReferences       = caReferences;
            }
            catch (ArgumentException e)
            {
                throw new ProvisioningServiceClientException(e);
            }
        }
Exemple #2
0
        private X509Attestation(
            X509Certificates clientCertificates, X509Certificates rootCertificates, X509CAReferences caReferences)
        {
            if (clientCertificates == null &&
                rootCertificates == null &&
                caReferences == null)
            {
                throw new ProvisioningServiceClientException("Attestation shall receive one no null certificate.");
            }

            if (clientCertificates != null &&
                (rootCertificates != null ||
                 caReferences != null) ||
                rootCertificates != null &&
                caReferences != null)
            {
                throw new ProvisioningServiceClientException("Attestation cannot receive more than one certificate together.");
            }

            try
            {
                ClientCertificates = clientCertificates;
                RootCertificates   = rootCertificates;
                CAReferences       = caReferences;
            }
            catch (ArgumentException e)
            {
                throw new ProvisioningServiceClientException(e);
            }
        }