internal KeyManagerDelegate(X509KeyManager keyManager, PrivateKeyStrategy aliasStrategy
                             ) : base()
 {
     this.keyManager    = keyManager;
     this.aliasStrategy = aliasStrategy;
 }
        /// <exception cref="Sharpen.NoSuchAlgorithmException"></exception>
        /// <exception cref="Sharpen.KeyStoreException"></exception>
        /// <exception cref="Sharpen.UnrecoverableKeyException"></exception>
        public virtual Apache.Http.Conn.Ssl.SSLContextBuilder LoadKeyMaterial(KeyStore keystore
                                                                              , char[] keyPassword, PrivateKeyStrategy aliasStrategy)
        {
            KeyManagerFactory kmfactory = KeyManagerFactory.GetInstance(KeyManagerFactory.GetDefaultAlgorithm
                                                                            ());

            kmfactory.Init(keystore, keyPassword);
            KeyManager[] kms = kmfactory.GetKeyManagers();
            if (kms != null)
            {
                if (aliasStrategy != null)
                {
                    for (int i = 0; i < kms.Length; i++)
                    {
                        KeyManager km = kms[i];
                        if (km is X509KeyManager)
                        {
                            kms[i] = new SSLContextBuilder.KeyManagerDelegate((X509KeyManager)km, aliasStrategy
                                                                              );
                        }
                    }
                }
                for (int i_1 = 0; i_1 < kms.Length; i_1++)
                {
                    keymanagers.AddItem(kms[i_1]);
                }
            }
            return(this);
        }