Package java.security

Examples of java.security.SecureRandom$StrongPatternHolder


        {
            byte[]  iv = new byte[8];

      if (random == null)
      {
                random = new SecureRandom();
      }

            random.nextBytes(iv);

            AlgorithmParameters params;
View Full Code Here


        {
            byte[]  iv = new byte[8];

      if (random == null)
      {
                random = new SecureRandom();
      }

            random.nextBytes(iv);

            AlgorithmParameters params;
View Full Code Here

     */
    public UID() {
 
  synchronized (lock) {
      if (!hostUniqueSet) {
    hostUnique = (new SecureRandom()).nextInt();
    hostUniqueSet = true;
      }
      unique = hostUnique;
      if (lastCount == Short.MAX_VALUE) {
    boolean interrupted = Thread.interrupted();
View Full Code Here

import javax.crypto.spec.DESKeySpec;

public class DESFactory {

  public DESFactory(byte encKey[], byte desKey[]) throws Exception {
    SecureRandom sr = new SecureRandom();
    byte rawKeyData[] = encKey;
    DESKeySpec dks = new DESKeySpec(rawKeyData);
    SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
    javax.crypto.SecretKey key = keyFactory.generateSecret(dks);
    enCipher = Cipher.getInstance("DES");
View Full Code Here

  public DESDecrypt(byte desKey[]) {
    this.desKey = desKey;
  }

  public byte[] doDecrypt(byte encryptText[]) throws Exception {
    SecureRandom sr = new SecureRandom();
    byte rawKeyData[] = desKey;
    DESKeySpec dks = new DESKeySpec(rawKeyData);
    SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
    javax.crypto.SecretKey key = keyFactory.generateSecret(dks);
    Cipher cipher = Cipher.getInstance("DES");
View Full Code Here

  public DESEncrypt(byte desKey[]) {
    this.desKey = desKey;
  }

  public byte[] doEncrypt(byte plainText[]) throws Exception {
    SecureRandom sr = new SecureRandom();
    byte rawKeyData[] = desKey;
    DESKeySpec dks = new DESKeySpec(rawKeyData);
    SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
    javax.crypto.SecretKey key = keyFactory.generateSecret(dks);
    Cipher cipher = Cipher.getInstance("DES");
View Full Code Here

  }

  public SymmetricEncryptHelper(byte[] key, String algorithm) {
    this.algorithm = algorithm;
    // DES算法要求有一个可信任的随机数源
    SecureRandom sr = new SecureRandom();
    try {
      // 从原始密匙数据创建DESKeySpec对象
      DESKeySpec dks = new DESKeySpec(key);
      // 创建一个密匙工厂,然后用它把DESKeySpec转换成
      // 一个SecretKey对象
View Full Code Here

    BigInteger e = new BigInteger("15");
    BigInteger phi;

    byte[] nonce = new byte[(nbBits / 16) + 1];

    SecureRandom rand;
    try {
      rand = SecureRandom.getInstance("SHA1PRNG");
      rand.nextBytes(nonce);
    } catch (Exception ex) {
      System.err.println("Can't happen...");
      ex.printStackTrace();
    }
View Full Code Here

      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

         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

TOP

Related Classes of java.security.SecureRandom$StrongPatternHolder

Copyright © 2018 www.massapicom. 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.