public class ECKeyUtil extends Object
Constructor and Description |
---|
ECKeyUtil() |
Modifier and Type | Method and Description |
---|---|
static KeySpec |
createOpenSSHPrivateKeySpec(byte[] key)
创建
OpenSSHPrivateKeySpec |
static KeySpec |
createOpenSSHPublicKeySpec(byte[] key)
创建
OpenSSHPublicKeySpec |
static org.bouncycastle.crypto.params.ECPrivateKeyParameters |
decodePrivateKeyParams(byte[] privateKeyBytes)
尝试解析转换各种类型私钥为
ECPrivateKeyParameters ,支持包括:
D值
PKCS#8
PKCS#1
|
static org.bouncycastle.crypto.params.ECPublicKeyParameters |
decodePublicKeyParams(byte[] publicKeyBytes)
尝试解析转换各种类型公钥为
ECPublicKeyParameters ,支持包括:
Q值
X.509
PKCS#1
|
static org.bouncycastle.crypto.params.ECPublicKeyParameters |
getPublicParams(org.bouncycastle.crypto.params.ECPrivateKeyParameters privateKeyParameters)
根据私钥参数获取公钥参数
|
static org.bouncycastle.crypto.params.AsymmetricKeyParameter |
toParams(Key key)
密钥转换为AsymmetricKeyParameter
|
static org.bouncycastle.crypto.params.ECPrivateKeyParameters |
toPrivateParams(BigInteger d,
org.bouncycastle.crypto.params.ECDomainParameters domainParameters)
转换为 ECPrivateKeyParameters
|
static org.bouncycastle.crypto.params.ECPrivateKeyParameters |
toPrivateParams(byte[] d,
org.bouncycastle.crypto.params.ECDomainParameters domainParameters)
转换为 ECPrivateKeyParameters
|
static org.bouncycastle.crypto.params.ECPrivateKeyParameters |
toPrivateParams(PrivateKey privateKey)
私钥转换为
ECPrivateKeyParameters |
static org.bouncycastle.crypto.params.ECPrivateKeyParameters |
toPrivateParams(String d,
org.bouncycastle.crypto.params.ECDomainParameters domainParameters)
转换为 ECPrivateKeyParameters
|
static org.bouncycastle.crypto.params.ECPublicKeyParameters |
toPublicParams(BigInteger x,
BigInteger y,
org.bouncycastle.crypto.params.ECDomainParameters domainParameters)
转换为ECPublicKeyParameters
|
static org.bouncycastle.crypto.params.ECPublicKeyParameters |
toPublicParams(byte[] xBytes,
byte[] yBytes,
org.bouncycastle.crypto.params.ECDomainParameters domainParameters)
转换为ECPublicKeyParameters
|
static org.bouncycastle.crypto.params.ECPublicKeyParameters |
toPublicParams(byte[] pointEncoded,
org.bouncycastle.crypto.params.ECDomainParameters domainParameters)
转换为ECPublicKeyParameters
|
static org.bouncycastle.crypto.params.ECPublicKeyParameters |
toPublicParams(org.bouncycastle.math.ec.ECPoint point,
org.bouncycastle.crypto.params.ECDomainParameters domainParameters)
转换为ECPublicKeyParameters
|
static org.bouncycastle.crypto.params.ECPublicKeyParameters |
toPublicParams(PublicKey publicKey)
公钥转换为
ECPublicKeyParameters |
static org.bouncycastle.crypto.params.ECPublicKeyParameters |
toPublicParams(String pointEncoded,
org.bouncycastle.crypto.params.ECDomainParameters domainParameters)
转换为ECPublicKeyParameters
|
static org.bouncycastle.crypto.params.ECPublicKeyParameters |
toPublicParams(String x,
String y,
org.bouncycastle.crypto.params.ECDomainParameters domainParameters)
转换为ECPublicKeyParameters
|
static PrivateKey |
toSm2PrivateKey(org.bouncycastle.asn1.sec.ECPrivateKey privateKey)
将SM2算法的
ECPrivateKey 转换为 PrivateKey |
static org.bouncycastle.crypto.params.ECPrivateKeyParameters |
toSm2PrivateParams(BigInteger d)
转换为 ECPrivateKeyParameters
|
static org.bouncycastle.crypto.params.ECPrivateKeyParameters |
toSm2PrivateParams(byte[] d)
转换为 ECPrivateKeyParameters
|
static org.bouncycastle.crypto.params.ECPrivateKeyParameters |
toSm2PrivateParams(String d)
转换为 ECPrivateKeyParameters
|
static org.bouncycastle.crypto.params.ECPublicKeyParameters |
toSm2PublicParams(byte[] q)
转换为 ECPublicKeyParameters
|
static org.bouncycastle.crypto.params.ECPublicKeyParameters |
toSm2PublicParams(byte[] xBytes,
byte[] yBytes)
转换为SM2的ECPublicKeyParameters
|
static org.bouncycastle.crypto.params.ECPublicKeyParameters |
toSm2PublicParams(String q)
转换为 ECPublicKeyParameters
|
static org.bouncycastle.crypto.params.ECPublicKeyParameters |
toSm2PublicParams(String x,
String y)
转换为SM2的ECPublicKeyParameters
|
public static org.bouncycastle.crypto.params.AsymmetricKeyParameter toParams(Key key)
key
- PrivateKey或者PublicKeypublic static org.bouncycastle.crypto.params.ECPublicKeyParameters getPublicParams(org.bouncycastle.crypto.params.ECPrivateKeyParameters privateKeyParameters)
privateKeyParameters
- 私钥参数public static org.bouncycastle.crypto.params.ECPublicKeyParameters toSm2PublicParams(byte[] q)
q
- 公钥Q值public static org.bouncycastle.crypto.params.ECPublicKeyParameters toSm2PublicParams(String q)
q
- 公钥Q值public static org.bouncycastle.crypto.params.ECPublicKeyParameters toSm2PublicParams(String x, String y)
x
- 公钥Xy
- 公钥Ypublic static org.bouncycastle.crypto.params.ECPublicKeyParameters toSm2PublicParams(byte[] xBytes, byte[] yBytes)
xBytes
- 公钥XyBytes
- 公钥Ypublic static org.bouncycastle.crypto.params.ECPublicKeyParameters toPublicParams(String x, String y, org.bouncycastle.crypto.params.ECDomainParameters domainParameters)
x
- 公钥Xy
- 公钥YdomainParameters
- ECDomainParametersnull
则返回null
public static org.bouncycastle.crypto.params.ECPublicKeyParameters toPublicParams(byte[] xBytes, byte[] yBytes, org.bouncycastle.crypto.params.ECDomainParameters domainParameters)
xBytes
- 公钥XyBytes
- 公钥YdomainParameters
- ECDomainParameters曲线参数public static org.bouncycastle.crypto.params.ECPublicKeyParameters toPublicParams(BigInteger x, BigInteger y, org.bouncycastle.crypto.params.ECDomainParameters domainParameters)
x
- 公钥Xy
- 公钥YdomainParameters
- ECDomainParameterspublic static org.bouncycastle.crypto.params.ECPublicKeyParameters toPublicParams(String pointEncoded, org.bouncycastle.crypto.params.ECDomainParameters domainParameters)
pointEncoded
- 被编码的曲线坐标点domainParameters
- ECDomainParameterspublic static org.bouncycastle.crypto.params.ECPublicKeyParameters toPublicParams(byte[] pointEncoded, org.bouncycastle.crypto.params.ECDomainParameters domainParameters)
pointEncoded
- 被编码的曲线坐标点domainParameters
- ECDomainParameterspublic static org.bouncycastle.crypto.params.ECPublicKeyParameters toPublicParams(org.bouncycastle.math.ec.ECPoint point, org.bouncycastle.crypto.params.ECDomainParameters domainParameters)
point
- 曲线坐标点domainParameters
- ECDomainParameterspublic static org.bouncycastle.crypto.params.ECPublicKeyParameters toPublicParams(PublicKey publicKey)
ECPublicKeyParameters
publicKey
- 公钥,传入null返回nullECPublicKeyParameters
或nullpublic static org.bouncycastle.crypto.params.ECPrivateKeyParameters toSm2PrivateParams(String d)
d
- 私钥d值16进制字符串public static org.bouncycastle.crypto.params.ECPrivateKeyParameters toSm2PrivateParams(byte[] d)
d
- 私钥d值public static org.bouncycastle.crypto.params.ECPrivateKeyParameters toSm2PrivateParams(BigInteger d)
d
- 私钥d值public static org.bouncycastle.crypto.params.ECPrivateKeyParameters toPrivateParams(String d, org.bouncycastle.crypto.params.ECDomainParameters domainParameters)
d
- 私钥d值16进制字符串domainParameters
- ECDomainParameterspublic static org.bouncycastle.crypto.params.ECPrivateKeyParameters toPrivateParams(byte[] d, org.bouncycastle.crypto.params.ECDomainParameters domainParameters)
d
- 私钥d值domainParameters
- ECDomainParameterspublic static org.bouncycastle.crypto.params.ECPrivateKeyParameters toPrivateParams(BigInteger d, org.bouncycastle.crypto.params.ECDomainParameters domainParameters)
d
- 私钥d值domainParameters
- ECDomainParameterspublic static org.bouncycastle.crypto.params.ECPrivateKeyParameters toPrivateParams(PrivateKey privateKey)
ECPrivateKeyParameters
privateKey
- 私钥,传入null返回nullECPrivateKeyParameters
或nullpublic static PrivateKey toSm2PrivateKey(org.bouncycastle.asn1.sec.ECPrivateKey privateKey)
ECPrivateKey
转换为 PrivateKey
privateKey
- ECPrivateKey
PrivateKey
public static KeySpec createOpenSSHPrivateKeySpec(byte[] key)
OpenSSHPrivateKeySpec
key
- 私钥,需为PKCS#1格式OpenSSHPrivateKeySpec
public static KeySpec createOpenSSHPublicKeySpec(byte[] key)
OpenSSHPublicKeySpec
key
- 公钥,需为PKCS#1格式OpenSSHPublicKeySpec
public static org.bouncycastle.crypto.params.ECPrivateKeyParameters decodePrivateKeyParams(byte[] privateKeyBytes)
ECPrivateKeyParameters
,支持包括:
privateKeyBytes
- 私钥ECPrivateKeyParameters
public static org.bouncycastle.crypto.params.ECPublicKeyParameters decodePublicKeyParams(byte[] publicKeyBytes)
ECPublicKeyParameters
,支持包括:
publicKeyBytes
- 公钥ECPublicKeyParameters
Copyright © 2024. All rights reserved.