Package java.security

Examples of java.security.SecureRandom.nextInt()


    }

    private static void testLoop() throws Exception {
        Random random = new SecureRandom();
        while (true) {
            runOneTest(random.nextInt());
        }
    }

    private static Connection openConnection() throws Exception {
        Class.forName(DRIVER);
View Full Code Here


     * @return the random long value
     */
    public static int secureRandomInt(int lowerThan) {
        SecureRandom sr = getSecureRandom();
        synchronized (sr) {
            return sr.nextInt(lowerThan);
        }
    }

}
View Full Code Here

         
        sig.update(rawEphemeralPubkey);
         
        final byte[] rawSign = sig.sign();
       
        final byte[] pad = new byte[random.nextInt(32)];
       
        random.nextBytes(pad);
       
        putBytes( buffer, rawMyPubkey, 65535 );
       
View Full Code Here

        if ( sharedSecret == null ){
         
          throw( new CryptoManagerException( "phase error: keys not received" ));
        }
       
        final byte[] IV = new byte[20 + random.nextInt(32)];
       
        random.nextBytes(IV);

        sig.update(IV);
       
View Full Code Here

         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

         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

            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

            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;
               }
View Full Code Here

               else
               {
                  drm._add(keys[pos], nodeName, "");
                  added[pos] = true;
               }
               sleepThread(random.nextInt(30));
            }
         }
         catch (Exception e)
         {
            e.printStackTrace();
View Full Code Here

        db.runWriteTransaction(new ISqlJetTransaction() {
            public Object run(SqlJetDb db) throws SqlJetException {

                try {
                    t.insert(rnd.nextInt(2048), blob);
                } catch (SqlJetException e) {
                    if (!SqlJetErrorCode.CONSTRAINT.equals(e.getErrorCode())) {
                        throw e;
                    }
                }
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.