Code example for KeyGenerator

Methods: init

0
    } catch (NoSuchAlgorithmException nsa) {
      throw new IllegalArgumentException("Can't find " + DEFAULT_HMAC_ALGORITHM +
      " algorithm."); 
    } 
  } 
 
  /** 
   * Generate a new random secret key. 
   * @return the new key 
   */ 
  protected SecretKey generateSecret() {
    SecretKey key;
    synchronized (keyGen) {
      key = keyGen.generateKey();
    } 
    return key;
  } 
 
  /** 
   * Compute HMAC of the identifier using the secret key and return the  
   * output as password