本文介绍了加密文本AES / CBC / PKCS7Padding的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个使用java 6加密一些文本的Web应用程序。



我必须做的加密是使用PKCS7的CBC模式的AES(Rijndael)填充和一个128位密钥。



我看到一篇文章解释了如何加密,就像我必须做的一样,但是使用PKCS5填充。



文章的链接在这里:





我更改

  private final static String cI =AES / CBC / PKCS5Padding; 

  private final static String cI =AES / CBC / PKCS7Padding; 

但是Java找不到这个提供者。



有人可以告诉我我该怎么做?

解决方案

Java只提供PKCS#5填充,但是与PKCS#7填充相同。在Crypto.SE上看到这个问题:





它们可以互换常见的块密码如AES和DES。


I am developing a web application to encrypt some texts with java 6.

The encrypted that I have to do is a AES (Rijndael) in CBC mode with PKCS7 padding and a 128-bit key.

I saw an article that explains how to encrypt in the same way I have to do, but with PKCS5 padding.

The link of the article is here:

https://bit502.wordpress.com/2014/06/27/codigo-java-encriptar-y-desencriptar-texto-usando-el-algoritmo-aes-con-cifrado-por-bloques-cbc-de-128-bits/

I change

private final static String cI = "AES/CBC/PKCS5Padding";

To

private final static String cI = "AES/CBC/PKCS7Padding";

But Java couldn't find a provider for this.

Could someone tell me how I have to do?

解决方案

Java only provides PKCS#5 padding, but it is the same as PKCS#7 padding. See this question on Crypto.SE:

What is the difference between PKCS#5 padding and PKCS#7 padding

They are interchangeable for the common block ciphers like AES and DES.

这篇关于加密文本AES / CBC / PKCS7Padding的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 06:42