コード例 #1
0
		/// <summary>
		/// Accesses the currently in use Curve25519 provider, according to the type requested.
		/// </summary>
		/// <param name="type">Type of provider requested.</param>
		/// <returns>Provider</returns>
		public static Curve25519 getInstance(Curve25519ProviderType type)
		{
			if (instance == null)
			{
				instance = new Curve25519();
				instance.provider = (ICurve25519Provider)new Curve25519NativeProvider();
			}
			return instance;
		}
コード例 #2
0
        /// <summary>
        /// Accesses the currently in use Curve25519 provider, according to the type requested.
        /// </summary>
        /// <param name="type">Type of provider requested.</param>
        /// <returns>Provider</returns>
        public static Curve25519 getInstance(Curve25519ProviderType type)
        {
            if (instance == null)
            {
                instance = new Curve25519();
                switch (type)
                {
                case Curve25519ProviderType.NATIVE:
                {
                    instance.provider = (ICurve25519Provider) new Curve25519NativeProvider();
                    break;
                }

                case Curve25519ProviderType.BEST:
                {
                    instance.provider = (ICurve25519Provider) new Curve25519ManagedProvider(
                        org.whispersystems.curve25519.Curve25519.BEST);
                    break;
                }
                }
            }
            return(instance);
        }