ITeye博客

BouncyCastleProvider加密的时候千万别乱new BouncyCastleProvider 切记

lyjilu · 2015-07-21 14:47 · java · 算法 · 编程语言 · Markdown

BouncyCastleProvider加密的时候千万别乱new BouncyCastleProvider 切记

应该用:

static{

if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME) == null){

System.out.println("security provider BC not found");

Security.addProvider(new BouncyCastleProvider());

}

}

 

Cipher cipher = Cipher.getInstance(ALGORITHM_PADDING,"BC");

下面这种方式有问题:

Cipher cipher = Cipher.getInstance(ALGORITHM_PADDING,new BouncyCastleProvider());

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。