private X509Certificates(X509CertificateWithInfo primary, X509CertificateWithInfo secondary = null)
 {
     /* SRS_X509_CERTIFICATES_21_001: [The constructor shall store the provided primary and secondary certificates as X509CertificateWithInfo.] */
     /* SRS_X509_CERTIFICATES_21_002: [The constructor shall throw ArgumentException if the provided primary certificates is invalid.] */
     Primary   = primary ?? throw new ProvisioningServiceClientException("primary certificate cannot be null.");
     Secondary = secondary;
 }
        /// <summary>
        /// Getter for the secondary X509 certificate info.
        /// </summary>
        /// <remarks>
        /// This method is a getter for the information returned from the provisioning service for the provided
        ///     secondary certificate.
        /// </remarks>
        /// <returns>The <see cref="X509CertificateInfo"/> with the returned certificate information. it can be <code>null</code>.</returns>
        public X509CertificateInfo GetSecondaryX509CertificateInfo()
        {
            X509CertificateWithInfo secondaryCertificate = null;

            /* SRS_X509_ATTESTATION_21_012: [If the ClientCertificates is not null, and it contains Secondary key, the
             *                              GetSecondaryX509CertificateInfo shall return the info in the Secondary key
             *                              of the ClientCertificates.] */
            if (ClientCertificates != null)
            {
                secondaryCertificate = ClientCertificates.Secondary;
            }

            /* SRS_X509_ATTESTATION_21_013: [If the RootCertificates is not null, and it contains Secondary key, the
             *                              GetSecondaryX509CertificateInfo shall return the info in the Secondary key
             *                              of the RootCertificates.] */
            else if (RootCertificates != null)
            {
                secondaryCertificate = RootCertificates.Secondary;
            }

            if (secondaryCertificate != null)
            {
                return(secondaryCertificate.Info);
            }
            return(null);
        }
Ejemplo n.º 3
0
        internal X509Certificates(string primary, string secondary = null)
        {
            Primary = new X509CertificateWithInfo(primary);

            Secondary = secondary == null
                ? null
                : new X509CertificateWithInfo(secondary);
        }
Ejemplo n.º 4
0
        internal X509Certificates(X509Certificate2 primary, X509Certificate2 secondary = null)
        {
            Primary = new X509CertificateWithInfo(primary);

            Secondary = secondary == null
                ? null
                : new X509CertificateWithInfo(secondary);
        }
 /// <summary>
 /// CONSTRUCTOR
 /// </summary>
 /// <remarks>
 /// Creates a new instance of the <code>X509Certificates</code> using the provided set of <see cref="X509Certificate2"/>.
 /// </remarks>
 /// <param name="primary">the <code>X509Certificate2</code> with the provisioning certificate and info. It cannot be <code>null</code>.</param>
 /// <param name="secondary">the <code>X509Certificate2</code> with the provisioning certificate and info. It can be <code>null</code>.</param>
 /// <exception cref="ArgumentException">if the provided certificate is <code>null</code>.</exception>
 /// <exception cref="CryptographicException">if the provided certificate is invalid.</exception>
 internal X509Certificates(X509Certificate2 primary, X509Certificate2 secondary = null)
 {
     /* SRS_X509_CERTIFICATES_21_001: [The constructor shall store the provided primary and secondary certificates as X509CertificateWithInfo.] */
     /* SRS_X509_CERTIFICATES_21_002: [The constructor shall throw ArgumentException if the provided primary certificates is invalid.] */
     Primary = new X509CertificateWithInfo(primary);
     if (secondary != null)
     {
         Secondary = new X509CertificateWithInfo(secondary);
     }
     else
     {
         Secondary = null;
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Getter for the secondary X509 certificate info.
        /// </summary>
        /// <remarks>
        /// This method is a getter for the information returned from the provisioning service for the provided
        /// secondary certificate.
        /// </remarks>
        /// <returns>The <see cref="X509CertificateInfo"/> with the returned certificate information. it can be <c>null</c>.</returns>
        public X509CertificateInfo GetSecondaryX509CertificateInfo()
        {
            X509CertificateWithInfo secondaryCertificate = null;

            if (ClientCertificates != null)
            {
                secondaryCertificate = ClientCertificates.Secondary;
            }
            else if (RootCertificates != null)
            {
                secondaryCertificate = RootCertificates.Secondary;
            }

            return(secondaryCertificate?.Info);
        }
Ejemplo n.º 7
0
 private X509Certificates(X509CertificateWithInfo primary, X509CertificateWithInfo secondary = null)
 {
     Primary   = primary ?? throw new ProvisioningServiceClientException("Primary certificate cannot be null.");
     Secondary = secondary;
 }