public class SpecUtil extends Object
KeySpec: 密钥规范AlgorithmParameterSpec: 参数规范| Constructor and Description |
|---|
SpecUtil() |
| Modifier and Type | Method and Description |
|---|---|
static KeySpec |
createKeySpec(String algorithm,
byte[] key)
|
static PBEKeySpec |
createPBEKeySpec(char[] password)
创建
PBEKeySpecPBE算法没有密钥的概念,密钥在其它对称加密算法中是经过算法计算得出来的,PBE算法则是使用口令替代了密钥。 |
static PBEParameterSpec |
createPBEParameterSpec(byte[] salt,
int iterationCount)
|
static RSAPrivateCrtKeySpec |
xmlToRSAPrivateCrtKeySpec(String xml)
将XML格式的密钥参数转化为
RSAPrivateCrtKeySpec,XML为C#生成格式,类似于:
<RSAKeyValue>
<Modulus>xx</Modulus>
<Exponent>xx</Exponent>
<P>xxxxxxxxx</P>
<Q>xxxxxxxxx</Q>
<DP>xxxxxxxx</DP>
<DQ>xxxxxxxx</DQ>
<InverseQ>xx</InverseQ>
<D>xxxxxxxxx</D>
</RSAKeyValue>
|
public static KeySpec createKeySpec(String algorithm, byte[] key)
KeySpec
DESedeKeySpecDESedeKeySpecSecretKeySpecalgorithm - 算法key - 密钥KeySpecpublic static PBEKeySpec createPBEKeySpec(char[] password)
PBEKeySpecpassword - 口令PBEKeySpecpublic static PBEParameterSpec createPBEParameterSpec(byte[] salt, int iterationCount)
salt - 加盐值iterationCount - 摘要次数PBEParameterSpecpublic static RSAPrivateCrtKeySpec xmlToRSAPrivateCrtKeySpec(String xml)
RSAPrivateCrtKeySpec,XML为C#生成格式,类似于:
<RSAKeyValue>
<Modulus>xx</Modulus>
<Exponent>xx</Exponent>
<P>xxxxxxxxx</P>
<Q>xxxxxxxxx</Q>
<DP>xxxxxxxx</DP>
<DQ>xxxxxxxx</DQ>
<InverseQ>xx</InverseQ>
<D>xxxxxxxxx</D>
</RSAKeyValue>
xml - xml格式密钥字符串RSAPrivateCrtKeySpecCopyright © 2025. All rights reserved.