Esempio n. 1
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, ICertificateFilter certificateFilter)
        {
            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");
            }
            if (certificateFilter == null)
            {
                throw new ArgumentNullException("certificateFilter");
            }

            m_certificateFilter   = certificateFilter;
            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;
        }
Esempio n. 2
0
 public DirectAgent(string domain, ICertificateResolver privateCerts, ICertificateResolver publicCerts, ITrustAnchorResolver anchors, ICertificateFilter certificateFilter)
     : this(new StaticDomainResolver(domain), privateCerts, publicCerts, anchors, TrustModel.Default, SMIMECryptographer.Default, certificateFilter)
 {
 }