Exemplo n.º 1
0
 static void VerifyTrusted(IEnumerable <DirectAddress> addresses, TrustEnforcementStatus minStatus)
 {
     foreach (DirectAddress address in addresses)
     {
         VerifyTrusted(address, minStatus);
     }
 }
Exemplo n.º 2
0
 internal virtual void CategorizeRecipientsByTrust(TrustEnforcementStatus minTrustStatus)
 {
     m_rejectedRecipients = DirectAddressCollection.Create(Recipients.GetUntrusted(minTrustStatus));
     if (this.HasRecipients)
     {
         this.Recipients.RemoveUntrusted(minTrustStatus);
     }
     if (this.HasDomainRecipients)
     {
         this.DomainRecipients.RemoveUntrusted(minTrustStatus);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a DirectAgent instance, specifying private, external and trust anchor certificate stores, and
        /// trust and cryptography models.
        /// </summary>
        /// <param name="domainResolver">
        /// An <see cref="IDomainResolver"/> instance providing array of local domain name managed by this agent.
        /// </param>
        /// <param name="privateCerts">
        /// An <see cref="ICertificateResolver"/> instance providing private certificates
        /// for senders of outgoing messages and receivers of incoming messages.
        /// </param>
        /// <param name="publicCerts">
        /// An <see cref="ICertificateResolver"/> instance providing public certificates
        /// for receivers of outgoing messages and senders of incoming messages.
        /// </param>
        /// <param name="anchors">
        /// An <see cref="ITrustAnchorResolver"/> instance providing trust anchors.
        /// </param>
        /// <param name="trustModel">
        /// An instance or subclass of <see cref="SMIMECryptographer"/> providing a custom trust model.
        /// </param>
        /// <param name="cryptographer">
        /// An instance or subclass of <see cref="Health.Direct.Agent"/> providing a custom cryptography model.
        /// </param>
        /// <param name="certPolicyResolvers">Certificate <see cref="ICertPolicyResolvers">policy container</see></param>
        public DirectAgent(IDomainResolver domainResolver,
                           ICertificateResolver privateCerts,
                           ICertificateResolver publicCerts,
                           ITrustAnchorResolver anchors,
                           TrustModel trustModel,
                           ISmimeCryptographer cryptographer,
                           ICertPolicyResolvers certPolicyResolvers)
        {
            m_managedDomains = new AgentDomains(domainResolver);

            if (privateCerts == null)
            {
                throw new ArgumentNullException("privateCerts");
            }
            if (publicCerts == null)
            {
                throw new ArgumentNullException("publicCerts");
            }
            if (anchors == null)
            {
                throw new ArgumentNullException("anchors");
            }
            if (trustModel == null)
            {
                throw new ArgumentNullException("trustModel");
            }
            if (cryptographer == null)
            {
                throw new ArgumentNullException("cryptographer");
            }

            m_privateCertResolver = privateCerts;
            m_publicCertResolver  = publicCerts;
            m_cryptographer       = cryptographer;
            m_trustAnchors        = anchors;
            m_trustModel          = trustModel;
            if (!m_trustModel.CertChainValidator.HasCertificateResolver)
            {
                m_trustModel.CertChainValidator.IssuerResolver = m_publicCertResolver;
            }

            m_minTrustRequirement = TrustEnforcementStatus.Success;

            m_privatePolicyResolver = certPolicyResolvers.PrivateResolver;
            m_publicPolicyResolver  = certPolicyResolvers.PublicResolver;
        }
Exemplo n.º 4
0
 /// <summary>
 /// Get the trusted members of this collection with a specified trust status.
 /// </summary>
 /// <param name="minTrustStatus">The <see cref="TrustEnforcementStatus"/> defined as minimally trustworthy.</param>
 /// <returns>An enumeration of the <see cref="DirectAddress"/> instances that are trusted</returns>
 public IEnumerable <DirectAddress> GetTrusted(TrustEnforcementStatus minTrustStatus)
 {
     return(from address in this
            where address.IsTrusted(minTrustStatus)
            select address);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Removes untrusted addresses from this collection
 /// </summary>
 /// <param name="minTrustStatus">The <see cref="TrustEnforcementStatus"/> defined as minimally trustworthy.</param>
 public void RemoveUntrusted(TrustEnforcementStatus minTrustStatus)
 {
     // Remove anybody who is not trusted
     this.RemoveExcept(x => x.IsTrusted(minTrustStatus));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Does this collection of DirectAddress contain only trustworthy addresses?
 /// </summary>
 /// <param name="minTrustStatus">The <see cref="TrustEnforcementStatus"/> defined as minimally trustworthy.</param>
 /// <returns><c>true</c> if all the addresses are trusted, <c>false</c> if the collection is empty or at least one is untrusted</returns>
 public bool IsTrusted(TrustEnforcementStatus minTrustStatus)
 {
     return(this.Count > 0 && this.All(x => x.IsTrusted(minTrustStatus)));
 }
Exemplo n.º 7
0
 /// <summary>
 /// Returns <c>true</c> if the trust status for this address meets minimal trust, <c>false</c> if not.
 /// </summary>
 /// <param name="minTrustStatus">The <see cref="TrustEnforcementStatus"/> treated as minimally trustworthy</param>
 /// <returns><c>true</c> if trusted, <c>false</c> if not</returns>
 public bool IsTrusted(TrustEnforcementStatus minTrustStatus)
 {
     return (this.m_trustStatus >= minTrustStatus);
 }        
Exemplo n.º 8
0
 /// <summary>
 /// Returns <c>true</c> if the trust status for this address meets minimal trust, <c>false</c> if not.
 /// </summary>
 /// <param name="minTrustStatus">The <see cref="TrustEnforcementStatus"/> treated as minimally trustworthy</param>
 /// <returns><c>true</c> if trusted, <c>false</c> if not</returns>
 public bool IsTrusted(TrustEnforcementStatus minTrustStatus)
 {
     return(this.m_trustStatus >= minTrustStatus);
 }
Exemplo n.º 9
0
        /// <summary>
        /// Creates a DirectAgent instance, specifying private, external and trust anchor certificate stores, and 
        /// trust and cryptography models.
        /// </summary>
        /// <param name="domainResolver">
        /// An <see cref="IDomainResolver"/> instance providing array of local domain name managed by this agent.
        /// </param>
        /// <param name="privateCerts">
        /// An <see cref="ICertificateResolver"/> instance providing private certificates
        /// for senders of outgoing messages and receivers of incoming messages.
        /// </param>
        /// <param name="publicCerts">
        /// An <see cref="ICertificateResolver"/> instance providing public certificates 
        /// for receivers of outgoing messages and senders of incoming messages. 
        /// </param>
        /// <param name="anchors">
        /// An <see cref="ITrustAnchorResolver"/> instance providing trust anchors.
        /// </param>
        /// <param name="trustModel">
        /// An instance or subclass of <see cref="SMIMECryptographer"/> providing a custom trust model.
        /// </param>
        /// <param name="cryptographer">
        /// An instance or subclass of <see cref="Health.Direct.Agent"/> providing a custom cryptography model.
        /// </param>
        public DirectAgent(IDomainResolver domainResolver, ICertificateResolver privateCerts, ICertificateResolver publicCerts, ITrustAnchorResolver anchors, TrustModel trustModel, SMIMECryptographer cryptographer)
        {
            m_managedDomains = new AgentDomains(domainResolver);

            if (privateCerts == null)
            {
                throw new ArgumentNullException("privateCerts");
            }
            if (publicCerts == null)
            {
                throw new ArgumentNullException("publicCerts");
            }
            if (anchors == null)
            {
                throw new ArgumentNullException("anchors");
            }
            if (trustModel == null)
            {
                throw new ArgumentNullException("trustModel");
            }
            if (cryptographer == null)
            {
                throw new ArgumentNullException("cryptographer");
            }

            m_privateCertResolver = privateCerts;
            m_publicCertResolver = publicCerts;
            m_cryptographer = cryptographer;
            m_trustAnchors = anchors;
            m_trustModel = trustModel;
            if (!m_trustModel.CertChainValidator.HasCertificateResolver)
            {
                m_trustModel.CertChainValidator.IssuerResolver = m_publicCertResolver;
            }
            
            m_minTrustRequirement = TrustEnforcementStatus.Success;
        }
Exemplo n.º 10
0
 internal virtual void CategorizeRecipientsByTrust(TrustEnforcementStatus minTrustStatus)
 {
     m_rejectedRecipients = DirectAddressCollection.Create(Recipients.GetUntrusted(minTrustStatus));
     if (this.HasRecipients)
     {
         this.Recipients.RemoveUntrusted(minTrustStatus);
     }
     if (this.HasDomainRecipients)
     {
         this.DomainRecipients.RemoveUntrusted(minTrustStatus);
     }
 }
Exemplo n.º 11
0
 static void VerifyTrusted(DirectAddress address, TrustEnforcementStatus minStatus)
 {
     Assert.True(address.IsTrusted(minStatus));
 }
Exemplo n.º 12
0
 static void VerifyTrusted(IEnumerable<DirectAddress> addresses, TrustEnforcementStatus minStatus)
 {
     foreach (DirectAddress address in addresses)
     {
         VerifyTrusted(address, minStatus);
     }
 }
Exemplo n.º 13
0
 static void VerifyTrusted(DirectAddress address, TrustEnforcementStatus minStatus)
 {
     Assert.True(address.IsTrusted(minStatus));
 }