public class Sm4Util extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
ALGORITHM_NAME |
static String |
ALGORITHM_NAME_CBC_PADDING |
static String |
ALGORITHM_NAME_ECB_PADDING |
static int |
DEFAULT_KEY_SIZE |
| 构造器和说明 |
|---|
Sm4Util() |
| 限定符和类型 | 方法和说明 |
|---|---|
static byte[] |
decrypt_Cbc_Padding(byte[] key,
byte[] iv,
byte[] cipherText) |
static byte[] |
decrypt_Ecb_Padding(byte[] key,
byte[] cipherText) |
static String |
decryptECB(String data,
String passwd) |
static byte[] |
encrypt_Cbc_Padding(byte[] key,
byte[] iv,
byte[] data) |
static byte[] |
encrypt_Ecb_Padding(byte[] key,
byte[] data) |
static String |
encryptECB(String data,
String passwd) |
static byte[] |
generateKey() |
static byte[] |
generateKey(int keySize) |
public static final int DEFAULT_KEY_SIZE
public static byte[] generateKey()
throws NoSuchAlgorithmException,
NoSuchProviderException
public static byte[] generateKey(int keySize)
throws NoSuchAlgorithmException,
NoSuchProviderException
public static byte[] encrypt_Ecb_Padding(byte[] key,
byte[] data)
throws InvalidKeyException,
NoSuchAlgorithmException,
NoSuchProviderException,
NoSuchPaddingException,
IllegalBlockSizeException,
BadPaddingException
public static byte[] decrypt_Ecb_Padding(byte[] key,
byte[] cipherText)
throws IllegalBlockSizeException,
BadPaddingException,
InvalidKeyException,
NoSuchAlgorithmException,
NoSuchProviderException,
NoSuchPaddingException
public static byte[] encrypt_Cbc_Padding(byte[] key,
byte[] iv,
byte[] data)
throws InvalidKeyException,
NoSuchAlgorithmException,
NoSuchProviderException,
NoSuchPaddingException,
IllegalBlockSizeException,
BadPaddingException,
InvalidAlgorithmParameterException
public static byte[] decrypt_Cbc_Padding(byte[] key,
byte[] iv,
byte[] cipherText)
throws IllegalBlockSizeException,
BadPaddingException,
InvalidKeyException,
NoSuchAlgorithmException,
NoSuchProviderException,
NoSuchPaddingException,
InvalidAlgorithmParameterException
public static String encryptECB(String data, String passwd)
data - passwd - Copyright © 2020. All Rights Reserved.