public class SM4Util extends GMBaseUtil
DEFAULT_ENCODING, INIT_SM4_KEY, SERIALIZE_KEY_PAIR, SM2KEY_PRIVATE_KEY, SM2KEY_PUBLIC_KEY, SM4_GROUP_BYTES, SM4KEY| 构造器和说明 |
|---|
SM4Util() |
| 限定符和类型 | 方法和说明 |
|---|---|
static byte[] |
decryptCbcNoPadding(byte[] key,
byte[] iv,
byte[] cipherText) |
static byte[] |
decryptCbcPadding(byte[] key,
byte[] iv,
byte[] cipherText) |
static byte[] |
decryptEcbNoPadding(byte[] key,
byte[] cipherText) |
static byte[] |
decryptEcbPadding(byte[] key,
byte[] cipherText) |
static byte[] |
encryptCbcNoPadding(byte[] key,
byte[] iv,
byte[] data) |
static byte[] |
encryptCbcPadding(byte[] key,
byte[] iv,
byte[] data) |
static byte[] |
encryptEcbNoPadding(byte[] key,
byte[] data) |
static byte[] |
encryptEcbPadding(byte[] key,
byte[] data) |
static byte[] |
generateKey()
生成密钥
|
static byte[] |
generateKey(int keySize) |
decryptString, decryptToken, encryptString, getSign, getToken, initSmKeyValue, pwToCipherPassword, verifyBySignpublic static byte[] generateKey()
throws NoSuchAlgorithmException,
NoSuchProviderException
NoSuchAlgorithmExceptionNoSuchProviderExceptionpublic static byte[] generateKey(int keySize)
throws NoSuchAlgorithmException,
NoSuchProviderException
keySize - 密钥大小NoSuchAlgorithmExceptionNoSuchProviderExceptionpublic static byte[] encryptEcbPadding(byte[] key,
byte[] data)
throws InvalidKeyException,
NoSuchAlgorithmException,
NoSuchProviderException,
NoSuchPaddingException,
IllegalBlockSizeException,
BadPaddingException
key - 密钥data - 加密数据InvalidKeyExceptionNoSuchAlgorithmExceptionNoSuchProviderExceptionNoSuchPaddingExceptionIllegalBlockSizeExceptionBadPaddingExceptionpublic static byte[] decryptEcbPadding(byte[] key,
byte[] cipherText)
throws IllegalBlockSizeException,
BadPaddingException,
InvalidKeyException,
NoSuchAlgorithmException,
NoSuchProviderException,
NoSuchPaddingException
key - 密钥cipherText - 密文IllegalBlockSizeExceptionBadPaddingExceptionInvalidKeyExceptionNoSuchAlgorithmExceptionNoSuchProviderExceptionNoSuchPaddingExceptionpublic static byte[] encryptEcbNoPadding(byte[] key,
byte[] data)
throws InvalidKeyException,
NoSuchAlgorithmException,
NoSuchProviderException,
NoSuchPaddingException,
IllegalBlockSizeException,
BadPaddingException
public static byte[] decryptEcbNoPadding(byte[] key,
byte[] cipherText)
throws IllegalBlockSizeException,
BadPaddingException,
InvalidKeyException,
NoSuchAlgorithmException,
NoSuchProviderException,
NoSuchPaddingException
public static byte[] encryptCbcPadding(byte[] key,
byte[] iv,
byte[] data)
throws InvalidKeyException,
NoSuchAlgorithmException,
NoSuchProviderException,
NoSuchPaddingException,
IllegalBlockSizeException,
BadPaddingException,
InvalidAlgorithmParameterException
public static byte[] decryptCbcPadding(byte[] key,
byte[] iv,
byte[] cipherText)
throws IllegalBlockSizeException,
BadPaddingException,
InvalidKeyException,
NoSuchAlgorithmException,
NoSuchProviderException,
NoSuchPaddingException,
InvalidAlgorithmParameterException
public static byte[] encryptCbcNoPadding(byte[] key,
byte[] iv,
byte[] data)
throws InvalidKeyException,
NoSuchAlgorithmException,
NoSuchProviderException,
NoSuchPaddingException,
IllegalBlockSizeException,
BadPaddingException,
InvalidAlgorithmParameterException
public static byte[] decryptCbcNoPadding(byte[] key,
byte[] iv,
byte[] cipherText)
throws IllegalBlockSizeException,
BadPaddingException,
InvalidKeyException,
NoSuchAlgorithmException,
NoSuchProviderException,
NoSuchPaddingException,
InvalidAlgorithmParameterException
Copyright © 2019-Now–2020. All rights reserved.