public void MSASCMD_S20_TC02_ValidateCert_InvalidSignature()
        {
            #region User calls ValidateCert command to verify the certificate with invalid signature
            Request.ValidateCert validateCert = new Request.ValidateCert
            {
                CheckCrl     = "1",
                Certificates = new byte[][] { Convert.FromBase64String("TUlJQ1lqQ0NBY3VnQXdJQkFnSVVZR3M4alpiWDBWeGpPYnU0bncwhQ==") }
            };

            ValidateCertRequest validateRequest = new ValidateCertRequest {
                RequestData = validateCert
            };

            ValidateCertResponse validateResponse = this.CMDAdapter.ValidateCert(validateRequest);

            XmlNodeList status = this.GetValidateCertStatusCode(validateResponse);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4479");

            // Verify MS-ASCMD requirement: MS-ASCMD_R4479
            Site.CaptureRequirementIfAreEqual <string>(
                "3",
                status[0].InnerText,
                4479,
                @"[In Status(ValidateCert)] [When the scope is Item], [the cause of the status value 3 is] The signature in the certificate is invalid.");

            #endregion
        }
        public void MSASCMD_S20_TC03_ValidateCert_LimitingSize()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(5671, this.Site), "[In Appendix A: Product Behavior] Implementation does limit the number of elements in command requests and return the specified error if the limit is exceeded. (<118> Section 3.1.5.8: Update Rollup 6 for Exchange 2010 SP2 and Exchange 2013 do limit the number of elements in command requests.)");

            #region User calls ValidateCert command to verify the number of certificate element is more than 100
            Request.ValidateCert validateCert = new Request.ValidateCert
            {
                CheckCrl     = "1",
                Certificates = new byte[101][]
            };

            for (int i = 0; i < validateCert.Certificates.Length; i++)
            {
                validateCert.Certificates[i] = Convert.FromBase64String("TUlJQ1lqQ0NBY3VnQXdJQkFnSVVZR3M4alpiWDBWeGpPYnU0bncwhQ==");
            }

            Site.Assert.IsTrue(validateCert.Certificates.Length > 100, "The number of certificate element is more than 100.");

            ValidateCertRequest validateRequest = new ValidateCertRequest {
                RequestData = validateCert
            };

            ValidateCertResponse validateResponse = this.CMDAdapter.ValidateCert(validateRequest);

            XmlNodeList status = this.GetValidateCertStatusCode(validateResponse);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5662");

            // Verify MS-ASCMD requirement: MS-ASCMD_R5662
            Site.CaptureRequirementIfAreEqual <string>(
                "2",
                status[0].InnerText,
                5662,
                @"[In Limiting Size of Command Requests] In ValidateCert (section 2.2.2.20) command request, when the limit value of Certificate element is bigger than 100 (minimum 1, maximum 2,147,483,647), the error returned by server is Status element (section 2.2.3.162.17) value of 2.");

            #endregion
        }
Esempio n. 3
0
 /// <summary>
 /// Create a ValidateCertRequest by specified the certificates in the byte[][] format
 /// </summary>
 /// <param name="certificates">Specified the certificates</param>
 /// <returns>A ValidateCertRequest instance</returns>
 public static ValidateCertRequest CreateValidateCertRequest(byte[][] certificates)
 {
     ValidateCertRequest request = new ValidateCertRequest();
     Request.ValidateCert requestData = new Request.ValidateCert { Certificates = certificates };
     request.RequestData = requestData;
     return request;
 }
Esempio n. 4
0
 /// <summary>
 /// Create an empty ValidateCertRequest instance
 /// </summary>
 /// <returns>An empty ValidateCertRequest instance</returns>
 public static ValidateCertRequest CreateValidateCertRequest()
 {
     ValidateCertRequest request = new ValidateCertRequest();
     Request.ValidateCert requestData = new Request.ValidateCert();
     request.RequestData = requestData;
     return request;
 }
        public void MSASCMD_S20_TC01_ValidateCert_Success()
        {
            #region Switch to User9 mail account, the inbox had received a S/MIME mail.

            this.SwitchUser(this.User9Information);

            #endregion

            #region Call method Sync to synchronize changes of Inbox folder in User9's mailbox between the client and the server, and get the body content of the email item.

            string emailSubject = Common.GetConfigurationPropertyValue("MIMEMailSubject", this.Site);

            Request.BodyPreference bodyPreference = new Request.BodyPreference
            {
                AllOrNone               = false,
                AllOrNoneSpecified      = true,
                TruncationSize          = 4294967295,
                TruncationSizeSpecified = true,
                Type = 4
            };

            Request.Options option = new Request.Options
            {
                Items            = new object[] { (byte)2, bodyPreference, (byte)8 },
                ItemsElementName = new Request.ItemsChoiceType1[]
                {
                    Request.ItemsChoiceType1.MIMESupport,
                    Request.ItemsChoiceType1.BodyPreference, Request.ItemsChoiceType1.MIMETruncation
                }
            };

            SyncResponse  syncResponse = this.CheckEmail(this.User9Information.InboxCollectionId, emailSubject, new Request.Options[] { option });
            Response.Body mailBody     = null;
            Response.SyncCollectionsCollectionCommandsAddApplicationData applicationData = TestSuiteBase.GetAddApplicationData(syncResponse, Response.ItemsChoiceType8.Subject1, emailSubject);
            for (int i = 0; i < applicationData.ItemsElementName.Length; i++)
            {
                if (applicationData.ItemsElementName[i] == Response.ItemsChoiceType8.Body)
                {
                    mailBody = applicationData.Items[i] as Response.Body;
                    break;
                }
            }

            Site.Assert.IsNotNull(mailBody, "The body of the received email should not be null.");

            string specifiedString = "MIME-Version: 1.0";
            string body            = mailBody.Data.Substring(
                mailBody.Data.IndexOf(specifiedString, StringComparison.CurrentCultureIgnoreCase) + specifiedString.Length);
            body = body.Replace("\r", string.Empty);
            body = body.Replace("\n", string.Empty);

            Request.ValidateCert validateCert = new Request.ValidateCert
            {
                CheckCrl     = "1",
                Certificates = new byte[][] { System.Text.Encoding.Default.GetBytes(body) }
            };

            ValidateCertRequest validateRequest = new ValidateCertRequest {
                RequestData = validateCert
            };

            ValidateCertResponse validateResponse = this.CMDAdapter.ValidateCert(validateRequest);

            XmlNodeList status = this.GetValidateCertStatusCode(validateResponse);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4474");

            // Verify MS-ASCMD requirement: MS-ASCMD_R4474
            Site.CaptureRequirementIfAreEqual <string>(
                "1",
                status[0].InnerText,
                4474,
                @"[In Status(ValidateCert)] [When the scope is Global], [the cause of the status value 1 is] Server successfully completed command.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5387");

            // Verify MS-ASCMD requirement: MS-ASCMD_R5387
            Site.CaptureRequirementIfAreEqual <string>(
                "1",
                status[0].InnerText,
                5387,
                @"[In Status(ValidateCert)] A value of 1 indicates success.");
            #endregion
        }
        public void MSASCMD_S20_TC01_ValidateCert_Success()
        {
            #region Switch to User9 mail account, the inbox had received a S/MIME mail.

            this.SwitchUser(this.User9Information);

            #endregion

            #region Call method Sync to synchronize changes of Inbox folder in User9's mailbox between the client and the server, and get the body content of the email item.

            string emailSubject = Common.GetConfigurationPropertyValue("MIMEMailSubject", this.Site);

            Request.BodyPreference bodyPreference = new Request.BodyPreference
            {
                AllOrNone = false,
                AllOrNoneSpecified = true,
                TruncationSize = 4294967295,
                TruncationSizeSpecified = true,
                Type = 4
            };

            Request.Options option = new Request.Options
            {
                Items = new object[] { (byte)2, bodyPreference, (byte)8 },
                ItemsElementName = new Request.ItemsChoiceType1[]
                {
                    Request.ItemsChoiceType1.MIMESupport,
                    Request.ItemsChoiceType1.BodyPreference, Request.ItemsChoiceType1.MIMETruncation
                }
            };

            SyncResponse syncResponse = this.CheckEmail(this.User9Information.InboxCollectionId, emailSubject, new Request.Options[] { option });
            Response.Body mailBody = null;
            Response.SyncCollectionsCollectionCommandsAddApplicationData applicationData = TestSuiteBase.GetAddApplicationData(syncResponse, Response.ItemsChoiceType8.Subject1, emailSubject);
            for (int i = 0; i < applicationData.ItemsElementName.Length; i++)
            {
                if (applicationData.ItemsElementName[i] == Response.ItemsChoiceType8.Body)
                {
                    mailBody = applicationData.Items[i] as Response.Body;
                    break;
                }
            }

            Site.Assert.IsNotNull(mailBody, "The body of the received email should not be null.");

            string specifiedString = "MIME-Version: 1.0";
            string body = mailBody.Data.Substring(
                mailBody.Data.IndexOf(specifiedString, StringComparison.CurrentCultureIgnoreCase) + specifiedString.Length);
            body = body.Replace("\r", string.Empty);
            body = body.Replace("\n", string.Empty);

            Request.ValidateCert validateCert = new Request.ValidateCert
            {
                CheckCrl = "1",
                Certificates = new byte[][] { System.Text.Encoding.Default.GetBytes(body) }
            };

            ValidateCertRequest validateRequest = new ValidateCertRequest { RequestData = validateCert };

            ValidateCertResponse validateResponse = this.CMDAdapter.ValidateCert(validateRequest);

            XmlNodeList status = this.GetValidateCertStatusCode(validateResponse);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4474");

            // Verify MS-ASCMD requirement: MS-ASCMD_R4474
            Site.CaptureRequirementIfAreEqual<string>(
                "1",
                status[0].InnerText,
                4474,
                @"[In Status(ValidateCert)] [When the scope is Global], [the cause of the status value 1 is] Server successfully completed command.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5387");

            // Verify MS-ASCMD requirement: MS-ASCMD_R5387
            Site.CaptureRequirementIfAreEqual<string>(
                "1",
                status[0].InnerText,
                5387,
                @"[In Status(ValidateCert)] A value of 1 indicates success.");
            #endregion
        }
        public void MSASCMD_S20_TC03_ValidateCert_LimitingSize()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(5671, this.Site), "[In Appendix A: Product Behavior] Implementation does limit the number of elements in command requests and return the specified error if the limit is exceeded. (<118> Section 3.1.5.8: Update Rollup 6 for Exchange 2010 SP2 and Exchange 2013 do limit the number of elements in command requests.)");
            
            #region User calls ValidateCert command to verify the number of certificate element is more than 100
            Request.ValidateCert validateCert = new Request.ValidateCert
            {
                CheckCrl = "1",
                Certificates = new byte[101][]
            };

            for (int i = 0; i < validateCert.Certificates.Length; i++)
            {
                validateCert.Certificates[i] = Convert.FromBase64String("TUlJQ1lqQ0NBY3VnQXdJQkFnSVVZR3M4alpiWDBWeGpPYnU0bncwhQ==");
            }

            Site.Assert.IsTrue(validateCert.Certificates.Length > 100, "The number of certificate element is more than 100.");

            ValidateCertRequest validateRequest = new ValidateCertRequest { RequestData = validateCert };

            ValidateCertResponse validateResponse = this.CMDAdapter.ValidateCert(validateRequest);

            XmlNodeList status = this.GetValidateCertStatusCode(validateResponse);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5662");

            // Verify MS-ASCMD requirement: MS-ASCMD_R5662
            Site.CaptureRequirementIfAreEqual<string>(
                "2",
                status[0].InnerText,
                5662,
                @"[In Limiting Size of Command Requests] In ValidateCert (section 2.2.2.20) command request, when the limit value of Certificate element is bigger than 100 (minimum 1, maximum 2,147,483,647), the error returned by server is Status element (section 2.2.3.162.17) value of 2.");

            #endregion
        }
        public void MSASCMD_S20_TC02_ValidateCert_InvalidSignature()
        {
            #region User calls ValidateCert command to verify the certificate with invalid signature
            Request.ValidateCert validateCert = new Request.ValidateCert
            {
                CheckCrl = "1",
                Certificates = new byte[][] { Convert.FromBase64String("TUlJQ1lqQ0NBY3VnQXdJQkFnSVVZR3M4alpiWDBWeGpPYnU0bncwhQ==") }
            };

            ValidateCertRequest validateRequest = new ValidateCertRequest { RequestData = validateCert };

            ValidateCertResponse validateResponse = this.CMDAdapter.ValidateCert(validateRequest);

            XmlNodeList status = this.GetValidateCertStatusCode(validateResponse);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4479");

            // Verify MS-ASCMD requirement: MS-ASCMD_R4479
            Site.CaptureRequirementIfAreEqual<string>(
                "3",
                status[0].InnerText,
                4479,
                @"[In Status(ValidateCert)] [When the scope is Item], [the cause of the status value 3 is] The signature in the certificate is invalid.");

            #endregion
        }