protected virtual X509Certificate2 ReadAuthenticationCertificateFromStore(X509Store store) { X509Certificate2Collection certificates = store.Certificates; RmsUtil.ThrowIfCertificateCollectionIsNullOrEmpty(certificates, "X509Store returned a null or empty certificate collection; unable to load the RMS Online authentication certificate"); X509Certificate2Collection x509Certificate2Collection = certificates.Find(X509FindType.FindBySubjectDistinguishedName, this.AuthenticationCertificateSubjectDistinguishedName, this.AcceptValidAuthenticationCertificateOnly); RmsUtil.ThrowIfCertificateCollectionIsNullOrEmpty(x509Certificate2Collection, string.Format("X509Store was unable to find the RMS Online authentication certificate with distinguished name '{0}'", this.AuthenticationCertificateSubjectDistinguishedName)); return(x509Certificate2Collection[0]); }