public class SecretKeyUtils extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
CACHE_SIZE |
static String |
KEY_AES
AES算法
java6支持56位密钥,bouncycastle支持64位
|
static String |
KEY_BASE64 |
static String |
KEY_DES |
static String |
KEY_DESEDE |
static String |
KEY_ECDSA |
static String |
KEY_RSA
RSA对称加密算法
|
static int |
KEY_SIZE
密钥大小
|
| 构造器和说明 |
|---|
SecretKeyUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static byte[] |
genBinarySecretKey(String algorithm) |
static byte[] |
genBinarySecretKey(String algorithm,
int keySize) |
static byte[] |
genBinarySecretKey(String seed,
String algorithm,
int keySize) |
static SecretKey |
genDESedeKey(byte[] key) |
static SecretKey |
genDESedeKey(String key) |
static SecretKey |
genDESKey(byte[] key) |
static SecretKey |
genDESKey(String key) |
static KeyPair |
genKeyPair(String algorithm) |
static KeyPair |
genKeyPair(String algorithm,
int keySize) |
static KeyPair |
genKeyPair(String seed,
String algorithm,
int keySize) |
static SecretKey |
genPBEKey(char[] password,
String algorithm) |
static SecretKey |
genPBEKey(String password,
String algorithm) |
static PrivateKey |
genPrivateKey(String algorithm,
byte[] prikeyBytes) |
static PublicKey |
genPublicKey(String algorithm,
byte[] pubKeyBytes) |
static byte[] |
genRandomKey(int keysize) |
static byte[] |
genRandomKey(String seed,
int keysize) |
static SecretKey |
genSecretKey(byte[] key,
String algorithm) |
static SecretKey |
genSecretKey(KeySpec keySpec,
String algorithm) |
static SecretKey |
genSecretKey(String algorithm) |
static SecretKey |
genSecretKey(String algorithm,
int keysize) |
static SecretKey |
genSecretKey(String key,
String algorithm) |
static SecretKey |
genSecretKey(String seed,
String algorithm,
int keySize)
根据秘钥种子生成随机密钥
|
static String |
genSecretKeyBase64(String algorithm,
int keySize) |
static String |
genSecretKeyHex(String algorithm,
int keySize) |
static String |
genSecretKeyHex(String seed,
String algorithm,
int keySize) |
static SecureRandom |
genSecureRandom() |
static SecureRandom |
genSecureRandom(String seed) |
static void |
main(String[] args) |
static SecretKey |
readKey(InputStream inStream) |
static void |
writeKey(Key key,
OutputStream outStream) |
public static final int KEY_SIZE
public static final int CACHE_SIZE
public static KeyPair genKeyPair(String algorithm) throws GeneralSecurityException
public static KeyPair genKeyPair(String algorithm, int keySize) throws GeneralSecurityException
public static KeyPair genKeyPair(String seed, String algorithm, int keySize) throws GeneralSecurityException
public static PublicKey genPublicKey(String algorithm, byte[] pubKeyBytes) throws GeneralSecurityException
public static PrivateKey genPrivateKey(String algorithm, byte[] prikeyBytes) throws GeneralSecurityException
public static SecretKey genSecretKey(String key, String algorithm) throws GeneralSecurityException
public static SecretKey genSecretKey(byte[] key, String algorithm) throws GeneralSecurityException
public static SecretKey genSecretKey(String seed, String algorithm, int keySize) throws GeneralSecurityException
根据秘钥种子生成随机密钥
seed - 密钥种子algorithm - 生成密匙的算法keySize - 密匙长度GeneralSecurityException - GeneralSecurityExceptionpublic static SecretKey genSecretKey(String algorithm, int keysize) throws GeneralSecurityException
public static SecretKey genSecretKey(String algorithm) throws GeneralSecurityException
public static byte[] genBinarySecretKey(String seed, String algorithm, int keySize) throws GeneralSecurityException
public static String genSecretKeyHex(String seed, String algorithm, int keySize) throws Exception
Exceptionpublic static byte[] genBinarySecretKey(String algorithm) throws GeneralSecurityException
public static byte[] genBinarySecretKey(String algorithm, int keySize) throws GeneralSecurityException
public static String genSecretKeyHex(String algorithm, int keySize) throws Exception
Exceptionpublic static String genSecretKeyBase64(String algorithm, int keySize) throws Exception
Exceptionpublic static SecretKey genSecretKey(KeySpec keySpec, String algorithm) throws GeneralSecurityException
public static SecretKey genPBEKey(String password, String algorithm) throws GeneralSecurityException
public static SecretKey genPBEKey(char[] password, String algorithm) throws GeneralSecurityException
public static SecretKey genDESKey(String key) throws GeneralSecurityException
public static SecretKey genDESKey(byte[] key) throws GeneralSecurityException
public static SecretKey genDESedeKey(String key) throws GeneralSecurityException
public static SecretKey genDESedeKey(byte[] key) throws GeneralSecurityException
public static SecureRandom genSecureRandom()
public static SecureRandom genSecureRandom(String seed)
public static byte[] genRandomKey(int keysize)
public static byte[] genRandomKey(String seed, int keysize)
public static SecretKey readKey(InputStream inStream)
public static void writeKey(Key key, OutputStream outStream)
Copyright © 2018. All rights reserved.