资源简介

等同于 C# 的AES 加密解密方法ECB/PKCS7Padding,如下:

            AesCryptoServiceProvider aes = new AesCryptoServiceProvider();
            aes.Key = Encoding.Default.GetBytes(key);
            aes.Mode = CipherMode.ECB;
            aes.Padding = PaddingMode.PKCS7;

资源截图

代码片段和文件信息


import java.security.Security;

import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;

import org.apache.commons.codec.binary.base64;
import org.apache.commons.codec.binary.Hex;

import javax.crypto.Cipher;
import javax.crypto.Mac;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;

import javax.crypto.Cipher;
import javax.crypto.Mac;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;


import javax.crypto.Cipher;
import javax.crypto.Mac;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;/**
 *
 * @author Ajit
 *
 *         AES 128 bit ECB PKCS7 padding example
 *
 */

public class AES128ECBwithPKCS7 {

    //add new bouncycastle ciphers
    static {

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-07-18 00:41  .idea\
     目录           0  2018-07-18 00:41  .idea\inspectionProfiles\
     目录           0  2018-07-18 00:29  .idea\libraries\
     文件         360  2018-07-18 00:29  .idea\libraries\commons_codec_commons_codec_1_1.xml
     文件         581  2018-07-18 00:25  .idea\libraries\org_bouncycastle_bcmail_jdk14_1_51.xml
     文件         454  2018-07-18 00:17  .idea\misc.xml
     文件         254  2018-07-18 00:39  .idea\modules.xml
     文件       39680  2018-07-18 00:41  .idea\workspace.xml
     文件         661  2018-07-18 00:29  AESDemo.iml
     目录           0  2018-07-18 00:06  out\
     目录           0  2018-07-18 00:06  out\production\
     目录           0  2018-07-18 00:39  out\production\KeyWordFilterDemo\
     文件        2487  2018-07-18 00:39  out\production\KeyWordFilterDemo\AES128ECBwithPKCS7.class
     目录           0  2018-07-18 00:39  src\
     文件        2897  2018-07-18 00:39  src\AES128ECBwithPKCS7.java

评论

共有 条评论