Examples of SecureRandom


Examples of java.security.SecureRandom

      byte[] kbytes = key.getEncoded();
      System.out.println("key.Algorithm = "+key.getAlgorithm());
      System.out.println("key.Format = "+key.getFormat());
      System.out.println("key.Encoded Size = "+kbytes.length);
     
      SecureRandom rnd = SecureRandom.getInstance("SHA1PRNG");
      BigInteger bi = new BigInteger(320, rnd);
      byte[] k2bytes = bi.toByteArray();
      SecretKeySpec keySpec = new SecretKeySpec(k2bytes, "Blowfish");
      System.out.println("key2.Algorithm = "+key.getAlgorithm());
      System.out.println("key2.Format = "+key.getFormat());
View Full Code Here

Examples of java.security.SecureRandom

         drm.startService();
        
         CachingListener listener = new CachingListener();
         drm.registerListener("TEST", listener);
        
         SecureRandom random = new SecureRandom();
         boolean[] added = new boolean[nodes.length];
         List lookup = null;
         for (int i = 0; i < 10; i++)
         {
            int node = random.nextInt(nodes.length);
            if (added[node])
            {
               if (node == 2)
                  drm.remove("TEST");
               else
View Full Code Here

Examples of java.security.SecureRandom

         drm.startService();
        
         CachingListener listener = new CachingListener();
         drm.registerListener("TEST", listener);
        
         SecureRandom random = new SecureRandom();
         boolean[] added = new boolean[nodes.length];
         List lookup = null;
         List<ClusterNode> lookupReplicantsNodes = null;
         for (int i = 0; i < 10; i++)
         {
            int node = random.nextInt(nodes.length);
            if (added[node])
            {
               if (node == 2)
                  drm.remove("TEST");
               else
View Full Code Here

Examples of java.security.SecureRandom

         try
         {
            acquired = semaphore.attempt(60000);
            if (!acquired)
               throw new Exception("Cannot acquire semaphore");
            SecureRandom random = new SecureRandom();
            for (count = 0; count < LOOP_COUNT; count++)
            {
               deployer.deploy(key, "JGroups", listener);

               sleepThread(random.nextInt(50));
               deployer.undeploy(key, listener);
            }
         }
         catch (Exception e)
         {
View Full Code Here

Examples of java.security.SecureRandom

         {
            acquired = semaphore.attempt(60000);
            if (!acquired)
               throw new Exception("Cannot acquire semaphore");
            boolean[] added = new boolean[keys.length];
            SecureRandom random = new SecureRandom();
           
            for (count = 0; count < weightFactor * LOOP_COUNT; count++)
            {
               int pos = random.nextInt(keys.length);
               if (added[pos])
               {
                  drm._remove(keys[pos], nodeName);
                  added[pos] = false;
               }
               else
               {
                  drm._add(keys[pos], nodeName, "");
                  added[pos] = true;
               }
               sleepThread(random.nextInt(30));
            }
         }
         catch (Exception e)
         {
            e.printStackTrace();
View Full Code Here

Examples of java.security.SecureRandom

   * @return  an encoded salt value
   */
  public static String gensalt(int log_rounds) {
    StringBuffer rs = new StringBuffer();
    byte rnd[] = new byte[BCRYPT_SALT_LEN];
    SecureRandom random = new SecureRandom();

    random.nextBytes(rnd);

    rs.append("$2a$");
    if (log_rounds < 10)
      rs.append("0");
    rs.append(Integer.toString(log_rounds));
View Full Code Here

Examples of java.security.SecureRandom

      }
      keepAliveHdrParams = "timeout=" + timeoutKeepAliveSec + ", max=" + maxAliveConnUse;

      expiredIn = arguments.get(ARG_SESSION_TIMEOUT) != null ? ((Integer) arguments.get(ARG_SESSION_TIMEOUT))
              .intValue() : DEF_SESSION_TIMEOUT;
      srandom = new SecureRandom((arguments.get(ARG_SESSION_SEED) == null ? "TJWS" + new Date() : (String) arguments.get(ARG_SESSION_SEED)).getBytes());
      try
      {
         gzipInStreamConstr = Class.forName("java.util.zip.GZIPInputStream").getConstructor(new Class[]{InputStream.class});
      }
      catch (ClassNotFoundException cne)
View Full Code Here

Examples of java.security.SecureRandom

   * hashing to apply - the work factor therefore increases as
   * 2**log_rounds.
   * @return  an encoded salt value
   */
  public static String gensalt(int log_rounds) {
    return gensalt(log_rounds, new SecureRandom());
  }
View Full Code Here

Examples of java.security.SecureRandom

          
            //SecureRandom random = SecureRandom.getInstance("SHA1PRNG",
            // "SUN");
            //initialize(int keysize, SecureRandom random)

            generator.initialize(SOSKeyGenerator.keyLenght, new SecureRandom());
            //generator.initialize(this.keyLenght);

            KeyPair keys = generator.generateKeyPair();

            return keys;
View Full Code Here

Examples of java.security.SecureRandom

  @SuppressWarnings("unchecked")
  private ResourceManager() {
    // resources = new HashMap<String, IResource>();
    resources = new ReferenceMap(AbstractReferenceMap.SOFT,
        AbstractReferenceMap.SOFT, true);
    random = new SecureRandom();
  }
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.