public Key generateNewKey(int keyBitSize) {
        KeyGenerator kg;
        try {
            kg = KeyGenerator.getInstance(getAlgorithmName());
        } catch (NoSuchAlgorithmException e) {
            String msg = "Unable to acquire " + getAlgorithmName() + " algorithm.  This is required to function.";
            throw new IllegalStateException(msg, e);
        }
        kg.init(keyBitSize);
        return kg.generateKey();
    }
Generates a new {@link Key Key} of the specified size suitable for this CipherService
(based on the {@link #getAlgorithmName() algorithmName} using the JDK {@link javax.crypto.KeyGenerator KeyGenerator}.

@param keyBitSize the bit size of the key to create
@return the created key suitable for use with this CipherService
src/main/java/org/apache/shiro/crypto/cipher/AbstractSymmetricCipherService.java