java.security.NoSuchAlgorithmException: AES KeyGenerator not available

异常信息

Caused by: Java.lang.IllegalStateException: Unable to acquire AES algorithm.  This is required to function.
at org.apache.shiro.crypto.AbstractSymmetricCipherService.generateNewKey(AbstractSymmetricCipherService.java:59)
at org.apache.shiro.crypto.AbstractSymmetricCipherService.generateNewKey(AbstractSymmetricCipherService.java:43)
at org.apache.shiro.mgt.AbstractRememberMeManager.<init>(AbstractRememberMeManager.java:99)
at org.apache.shiro.web.mgt.CookieRememberMeManager.<init>(CookieRememberMeManager.java:87)
at org.apache.shiro.web.mgt.DefaultWebSecurityManager.<init>(DefaultWebSecurityManager.java:75)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
... 34 more
Caused by: java.security.NoSuchAlgorithmException: AES KeyGenerator not available
at javax.crypto.KeyGenerator.<init>(KeyGenerator.java:158)
at javax.crypto.KeyGenerator.getInstance(KeyGenerator.java:207)
at org.apache.shiro.crypto.AbstractSymmetricCipherService.generateNewKey(AbstractSymmetricCipherService.java:56)
... 43 more

解决方法:

修改项目 jdk指向路径

由原先的C:\Program Files\Java\jdk1.7.0_67  改为  C:\Program Files\Java\jre7  ,重启 eclipse  完成
时间: 2024-11-01 19:45:39

java.security.NoSuchAlgorithmException: AES KeyGenerator not available的相关文章

java.security.NoSuchAlgorithmException: Cannot find any provider supporting DESede/CBC/PKCS5Padding

最近在做3DES加密,在本地window下面运行ok的程序,放到linux环境上竟然报错: at javax.crypto.Cipher.getInstance(Cipher.java:524) at com.haha.encrypt.ThreeDES.encryptMode(ThreeDES.java:30) at com.haha.encrypt.ThreeDES.encryptString(ThreeDES.java:101) at com.haha.mina.MinaServerHand

java.security.NoSuchAlgorithmException: SHA1PRNG SecureRandom not available

q好久没有使用MyEclipse10了,今天打开看了以前大学的项目,在Tomcat7中发布启动,我嚓嘞,报错: SEVERE: Exception initializing random number generator using algorithm [SHA1PRNG] java.security.NoSuchAlgorithmException: SHA1PRNG SecureRandom not available at sun.security.jca.GetInstance.getI

java util - MD5/AES/RSA快速调用工具

测试代码 package cn.java.security; import java.security.Key; import java.util.Base64; import org.junit.Assert; import cn.java.codec.hex.HexUtil; import cn.java.security.SecurityUtil.RsaUtil.RsaKeyPair; public class Test { public static void main(String[]

Java Base64、AES、SHA1、MD5加密算法

package com.example.decript;   import java.io.UnsupportedEncodingException; import java.security.InvalidKeyException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import javax.c

Java Base64、AES、SHA1、MD5加密算法(转载)

1 package com.example.decript; 2 3 import java.io.UnsupportedEncodingException; 4 import java.security.InvalidKeyException; 5 import java.security.MessageDigest; 6 import java.security.NoSuchAlgorithmException; 7 import java.security.SecureRandom; 8

Java中的AES加解密

直接上代码,Base64使用的是Java8的方法,如没有,替换即可 KEY:即密码 IV:即偏移量,可自订,十六位 加密方式:AES/CBC/PKCS5Padding,128位加密 如果想用256位和PKCS7Padding需要额外导入包 import javax.crypto.*; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import java.security.Inva

Java MD5,base64,AES加密工具类

import java.io.UnsupportedEncodingException; import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.util.regex.Matcher; import java.util.regex.Pat

Java security MD5加密算法

利用java.security对字符串进行MD5加密: 1 import java.security.MessageDigest; 2 import java.security.NoSuchAlgorithmException; 3 4 public class MD5 { 5 public static final String MD5CODE = ""; 6 7 private static MessageDigest messageDigest = null; 8 9 publi

利用Java自带的MD5加密java.security.MessageDigest;

MD5加密算法,即"Message-Digest Algorithm 5(信息-摘要算法)",它由MD2.MD3.MD4发展而来的一种单向函数算法(也就是HASH算法),它是国际著名的公钥加密算法标准RSA的第一设计者R.Rivest于上个世纪90年代初开发出来的.MD5的最大作用在于,将不同格式的大容量文件信息在用数字签名软件来签署私人密钥前"压缩"成一种保密的格式,关键之处在于——这种"压缩"是不可逆的. Java JDK已经自带了MD5的实