public class PublicKeyTool extends Base
BC, ecDomainParameters, ecParameterSpec, rootGMPrivateKey, rootGMX509Certificate, rootRSAPrivateKey, rootRSAX509Certificate, x9ECParameters| 构造器和说明 |
|---|
PublicKeyTool() |
| 限定符和类型 | 方法和说明 |
|---|---|
static byte[] |
certificateChainToP7b(byte[][] certificateChain,
boolean isCheckChain)
证书列表转换证书链
|
static byte[] |
certificateChainToP7b(X509Certificate[] certificateChain,
boolean isCheckChain)
证书列表转换证书链
|
static byte[] |
getPublicKeyByte(PublicKey publicKey)
获取公钥byte
|
static X509Certificate |
getX509Certificate(PublicKeyInfo pki,
PublicKey pk)
生成公钥证书
|
static X509Certificate[] |
loadP7bToChain(byte[] p7b,
boolean isCheckChain)
获取p7b证书链上所有证书
|
static X509Certificate |
loadP7bToX509Certificate(byte[] p7b,
boolean isCheckChain)
获取p7b证书链上的证书
|
static X509Certificate |
loadX509Certificate(byte[] x509Certificate)
加载X509证书
|
static PublicKey |
toGMPublicKey(byte[] P)
GM公钥生成publicKey
|
static PublicKey |
toRSAPublicKey(byte[] N)
RSA公钥生成公钥证书 参数N 65537
|
static PublicKey |
toRSAPublicKey(byte[] N,
byte[] E)
RSA公钥生成公钥证书
|
static PublicKey |
x509CertificateToPublicKey(byte[] x509Certificate)
x509获取PublicKey
|
getRootGMPrivateKey, getRootGMX509Certificate, getRootRSAPrivateKey, getRootRSAX509Certificate, getSm1ext, getSm4ext, setGMroot, setRSAroot, setSm1ext, setSm4extpublic static PublicKey x509CertificateToPublicKey(byte[] x509Certificate) throws IOException
x509Certificate - X509Certificate bytesIOExceptionpublic static X509Certificate loadX509Certificate(byte[] x509Certificate) throws CertificateException, IOException
x509Certificate - X509Certificate bytesCertificateExceptionIOExceptionpublic static X509Certificate[] loadP7bToChain(byte[] p7b, boolean isCheckChain) throws org.bouncycastle.cms.CMSException, CertificateException, org.bouncycastle.operator.OperatorCreationException, org.bouncycastle.cert.CertException, EncryptionAndDecryptionException
p7b - p7b p7c bytesisCheckChain - 是否校验证书链org.bouncycastle.cms.CMSExceptionCertificateExceptionorg.bouncycastle.operator.OperatorCreationExceptionorg.bouncycastle.cert.CertExceptionEncryptionAndDecryptionException - 证书链校验失败public static X509Certificate loadP7bToX509Certificate(byte[] p7b, boolean isCheckChain) throws org.bouncycastle.cms.CMSException, CertificateException, org.bouncycastle.operator.OperatorCreationException, org.bouncycastle.cert.CertException, EncryptionAndDecryptionException
p7b - p7b p7c bytesisCheckChain - 是否校验证书链org.bouncycastle.cms.CMSExceptionCertificateExceptionorg.bouncycastle.operator.OperatorCreationExceptionorg.bouncycastle.cert.CertExceptionEncryptionAndDecryptionException - 证书链校验失败public static byte[] certificateChainToP7b(X509Certificate[] certificateChain, boolean isCheckChain) throws org.bouncycastle.cms.CMSException, IOException, org.bouncycastle.operator.OperatorCreationException, CertificateException, org.bouncycastle.cert.CertException, EncryptionAndDecryptionException
certificateChain - 证书列表isCheckChain - 是否校验证书链org.bouncycastle.cms.CMSExceptionorg.bouncycastle.operator.OperatorCreationExceptionCertificateExceptionorg.bouncycastle.cert.CertExceptionEncryptionAndDecryptionException - 证书链校验失败IOExceptionpublic static byte[] certificateChainToP7b(byte[][] certificateChain,
boolean isCheckChain)
throws org.bouncycastle.cms.CMSException,
IOException,
org.bouncycastle.operator.OperatorCreationException,
CertificateException,
org.bouncycastle.cert.CertException,
EncryptionAndDecryptionException
certificateChain - [i][证书bytes]isCheckChain - org.bouncycastle.cms.CMSExceptionIOExceptionorg.bouncycastle.operator.OperatorCreationExceptionCertificateExceptionorg.bouncycastle.cert.CertExceptionEncryptionAndDecryptionExceptionpublic static X509Certificate getX509Certificate(PublicKeyInfo pki, PublicKey pk) throws org.bouncycastle.operator.OperatorCreationException, IOException, CertificateException
pki - 公钥信息pk - 公钥org.bouncycastle.operator.OperatorCreationExceptionIOExceptionCertificateExceptionpublic static PublicKey toGMPublicKey(byte[] P)
P - 04|x|ypublic static PublicKey toRSAPublicKey(byte[] N)
N - 公钥public static PublicKey toRSAPublicKey(byte[] N, byte[] E)
E - 公钥N - 公钥参数public static byte[] getPublicKeyByte(PublicKey publicKey) throws EncryptionAndDecryptionException
publicKey - 公钥EncryptionAndDecryptionExceptionCopyright © 2021. All rights reserved.