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)
创建
PBEKeySpec PBE算法没有密钥的概念,密钥在其它对称加密算法中是经过算法计算得出来的,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
DESedeKeySpec
DESedeKeySpec
SecretKeySpec
algorithm
- 算法key
- 密钥KeySpec
public static PBEKeySpec createPBEKeySpec(char[] password)
PBEKeySpec
password
- 口令PBEKeySpec
public static PBEParameterSpec createPBEParameterSpec(byte[] salt, int iterationCount)
salt
- 加盐值iterationCount
- 摘要次数PBEParameterSpec
public 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格式密钥字符串RSAPrivateCrtKeySpec
Copyright © 2025. All rights reserved.