Ejemplo n.º 1
0
        public HsmCryptographer Create()
        {
            var cryptographer = new HsmCryptographer();

            cryptographer.Error += Error;
            cryptographer.Init(this);

            return(cryptographer);
        }
Ejemplo n.º 2
0
        public void Init(TokenResolverSettings resolverSettings)
        {
            try
            {
                IPropertyManager client           = resolverSettings.ClientSettings.CreatePropertyManagerClient();
                Property[]       properties       = client.GetProperties(new [] { "TokenSettings" });
                string           tokenSettingsXml = properties.SingleOrDefault().Value;
                var tokenSettings = tokenSettingsXml.FromXml <TokenSettings>();

                m_innerSoftwareCryptographer = new SMIMECryptographer(
                    tokenSettings.DefaultEncryption,
                    tokenSettings.DefaultDigest);

                tokenSettings.Error    += ProxyError;
                m_innerHsmCryptographer = tokenSettings.Create();
            }
            catch (Exception ex)
            {
                ProxyError.NotifyEvent(this, ex);
                // Do not remove. Exceptions here can cause the Direct Project to not bind to SMTP.
            }
        }