Esempio n. 1
0
        /// <summary>Returns a configured SSLEngine.</summary>
        /// <returns>the configured SSLEngine.</returns>
        /// <exception cref="GeneralSecurityException">
        /// thrown if the SSL engine could not
        /// be initialized.
        /// </exception>
        /// <exception cref="System.IO.IOException">
        /// thrown if and IO error occurred while loading
        /// the server keystore.
        /// </exception>
        public virtual SSLEngine CreateSSLEngine()
        {
            SSLEngine sslEngine = context.CreateSSLEngine();

            if (mode == SSLFactory.Mode.Client)
            {
                sslEngine.SetUseClientMode(true);
            }
            else
            {
                sslEngine.SetUseClientMode(false);
                sslEngine.SetNeedClientAuth(requireClientCert);
            }
            sslEngine.SetEnabledProtocols(enabledProtocols);
            return(sslEngine);
        }
Esempio n. 2
0
        protected override void OnCreate(Bundle bundle)
        {
            try
            {
                base.OnCreate(bundle);
                InputDialog.DisplayDialog += OnDisplayDialog;
                AndroidEnvironment.UnhandledExceptionRaiser += HandleUnhandledException;

                global::Xamarin.Forms.Forms.Init(this, bundle);

                context = ApplicationContext; // or activity.getApplicationContext()
                PackageManager packageManager = context.PackageManager;
                string         packageName    = context.PackageName;
                AppData.Version = new OnSiteVersion(string.Format("{0}", packageManager.GetPackageInfo(packageName, 0).VersionName));

                LoadApplication(new App());

                //AppContext.AppContext.ShowInput = () =>
                //{
                //    InputMethodManager showinput = (InputMethodManager)GetSystemService(InputMethodService);
                //    showinput.ToggleSoftInput(ShowFlags.Forced, 0);
                //};


                if (Build.VERSION.SdkInt <= BuildVersionCodes.Kitkat)
                {
                    ProviderInstaller.InstallIfNeeded(ApplicationContext);
                }
                SSLContext sslContext = SSLContext.GetInstance("TLSv1.2");
                sslContext.Init(null, null, null);
                SSLEngine engine = sslContext.CreateSSLEngine();
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }