Inheritance: java.lang.Object, java.io.Serializable
Beispiel #1
0
        private SecureRandom(SecureRandomSpi secureRandomSpi, Provider provider, String algorithm) : base(0)
        {
            this.SecureRandomSpi_Renamed = secureRandomSpi;
            this.Provider_Renamed        = provider;
            this.Algorithm_Renamed       = algorithm;

            if (!SkipDebug && Pdebug != null)
            {
                Pdebug.println("SecureRandom." + algorithm + " algorithm from: " + this.Provider_Renamed.Name);
            }
        }
Beispiel #2
0
        private void GetDefaultPRNG(bool setSeed, sbyte[] seed)
        {
            String prng = PrngAlgorithm;

            if (prng == null)
            {
                // bummer, get the SUN implementation
                prng = "SHA1PRNG";
                this.SecureRandomSpi_Renamed = new sun.security.provider.SecureRandom();
                this.Provider_Renamed        = Providers.SunProvider;
                if (setSeed)
                {
                    this.SecureRandomSpi_Renamed.EngineSetSeed(seed);
                }
            }
            else
            {
                try
                {
                    SecureRandom random = SecureRandom.GetInstance(prng);
                    this.SecureRandomSpi_Renamed = random.SecureRandomSpi;
                    this.Provider_Renamed        = random.Provider;
                    if (setSeed)
                    {
                        this.SecureRandomSpi_Renamed.EngineSetSeed(seed);
                    }
                }
                catch (NoSuchAlgorithmException nsae)
                {
                    // never happens, because we made sure the algorithm exists
                    throw new RuntimeException(nsae);
                }
            }
            // JDK 1.1 based implementations subclass SecureRandom instead of
            // SecureRandomSpi. They will also go through this code path because
            // they must call a SecureRandom constructor as it is their superclass.
            // If we are dealing with such an implementation, do not set the
            // algorithm value as it would be inaccurate.
            if (this.GetType() == typeof(SecureRandom))
            {
                this.Algorithm_Renamed = prng;
            }
        }
Beispiel #3
0
 /// <summary>
 /// Creates a SecureRandom object.
 /// </summary>
 /// <param name="secureRandomSpi"> the SecureRandom implementation. </param>
 /// <param name="provider"> the provider. </param>
 protected internal SecureRandom(SecureRandomSpi secureRandomSpi, Provider provider) : this(secureRandomSpi, provider, null)
 {
 }