Examples of SecureRandom


Examples of com.googlecode.gwt.crypto.util.SecureRandom

     */
    public static AsymmetricCipherKeyPair makeKeypairSlow(Strength strength) {
        RSAKeyPairGenerator generator = new RSAKeyPairGenerator();

        // see https://code.google.com/p/gwt-crypto/issues/detail?id=25
        SecureRandom random = SecureRandom.getInstance(null);
        BigInteger exponent = BigInteger.valueOf(65537);
        RSAKeyGenerationParameters params = new RSAKeyGenerationParameters(
                exponent,
                random,
                strength.strength,
View Full Code Here

Examples of com.zaranux.client.crypto.SecureRandom

        // we use double checked locking to minimize synchronization
        // works because we use a volatile reference
      //Saman
      if(secureRandom == null)
      {
        secureRandom = new SecureRandom();
      }

        return secureRandom;
    }
View Full Code Here

Examples of java.security.SecureRandom

        return retval;
    }


    protected static byte[] generateRandomBytes() {
        SecureRandom ng=numberGenerator;
        if(ng == null)
            numberGenerator=ng=new SecureRandom();

        byte[] randomBytes=new byte[16];
        ng.nextBytes(randomBytes);
        return randomBytes;
    }
View Full Code Here

Examples of java.security.SecureRandom

    TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
    tmf.init(keystore);      
    TrustManager[] trustManagers = tmf.getTrustManagers();
   
    SSLContext ctx = SSLContext.getInstance(sslContext);
    SecureRandom securerandom = SecureRandom.getInstance("SHA1PRNG");
//    SecureRandom securerandom = null;
    ctx.init(kmf.getKeyManagers(),trustManagers,securerandom);
   
    return ctx.getSocketFactory();
  }
View Full Code Here

Examples of java.security.SecureRandom

     * The {@code UUID} is generated using a cryptographically strong pseudo
     * random number generator.
     * @return  A randomly generated {@code UUID}
     */
    public static UUID randomUUID() {
        SecureRandom ng=numberGenerator;
        if(ng == null)
            numberGenerator=ng=new SecureRandom();

        byte[] randomBytes=new byte[16];
        ng.nextBytes(randomBytes);
        return new UUID(randomBytes);
    }
View Full Code Here

Examples of java.security.SecureRandom

        TrustManagerFactory trustManagerFactory=TrustManagerFactory.getInstance(_sslTrustManagerFactoryAlgorithm);
        trustManagerFactory.init(trustStore);
        trustManagers=trustManagerFactory.getTrustManagers();

        SecureRandom secureRandom=_secureRandomAlgorithm==null?null:SecureRandom.getInstance(_secureRandomAlgorithm);
        SSLContext context=_provider==null?SSLContext.getInstance(_protocol):SSLContext.getInstance(_protocol,_provider);
        context.init(keyManagers,trustManagers,secureRandom);
        return context;
    }
View Full Code Here

Examples of java.security.SecureRandom

    // TIPS: By adding option '-Djava.security.egd=file:/dev/./urandom'
    //       SHA1PRNG will be used instead of NativePRNG.
    // On MacOSX, 'new SecureRandom()' will use NativePRNG algorithm and
    // it is also slower than SHA1PRNG.
    // On Windows, 'new SecureRandom()' will use SHA1PRNG algorithm.
    random=new SecureRandom();

    /*
    try{
      random=SecureRandom.getInstance("SHA1PRNG");
      return;
View Full Code Here

Examples of java.security.SecureRandom

    TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
    tmf.init(keystore);      
    TrustManager[] trustManagers = tmf.getTrustManagers();

    SSLContext ctx = SSLContext.getInstance(sslContext);
    SecureRandom securerandom = SecureRandom.getInstance("SHA1PRNG");
    //    SecureRandom securerandom = null;
    ctx.init(kmf.getKeyManagers(),trustManagers,securerandom);

    return ctx.getServerSocketFactory();
  }
View Full Code Here

Examples of java.security.SecureRandom

    public void setPayload(String payload) {
        this.payload=payload;
    }

    protected static byte[] generateRandomBytes() {
        SecureRandom ng=numberGenerator;
        if(ng == null)
            numberGenerator=ng=new SecureRandom();

        byte[] randomBytes=new byte[16];
        ng.nextBytes(randomBytes);
        return randomBytes;
    }
View Full Code Here

Examples of java.security.SecureRandom

        return super.toString() + "(" + printDetails() + ")";
    }

   
    protected static byte[] generateRandomBytes() {
        SecureRandom ng=numberGenerator;
        if(ng == null)
            numberGenerator=ng=new SecureRandom();

        byte[] randomBytes=new byte[16];
        ng.nextBytes(randomBytes);
        return randomBytes;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.