本文整理汇总了Java中org.bouncycastle.util.io.pem.PemObjectGenerator类的典型用法代码示例。如果您正苦于以下问题:Java PemObjectGenerator类的具体用法?Java PemObjectGenerator怎么用?Java PemObjectGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PemObjectGenerator类属于org.bouncycastle.util.io.pem包,在下文中一共展示了PemObjectGenerator类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createSigningRequest
import org.bouncycastle.util.io.pem.PemObjectGenerator; //导入依赖的package包/类
/**
* Creates and returns the content of a new singing request for the specified certificate. Signing
* requests are required by Certificate Authorities as part of their signing process. The signing request
* contains information about the certificate issuer, subject DN, subject alternative names and public key.
* Private keys are not included. After the Certificate Authority verified and signed the certificate a new
* certificate is going to be returned.
*
* @param cert the certificate to create a signing request.
* @param privKey the private key of the certificate.
* @return the content of a new singing request for the specified certificate.
*/
public static String createSigningRequest(X509Certificate cert, PrivateKey privKey) throws OperatorCreationException, IOException {
JcaPKCS10CertificationRequestBuilder csrBuilder = new JcaPKCS10CertificationRequestBuilder( //
cert.getSubjectX500Principal(), //
cert.getPublicKey() //
);
String signatureAlgorithm = "SHA256WITH" + cert.getPublicKey().getAlgorithm();
ContentSigner signer = new JcaContentSignerBuilder(signatureAlgorithm).build(privKey);
PKCS10CertificationRequest csr = csrBuilder.build(signer);
StringWriter string = new StringWriter();
PemWriter pemWriter = new PemWriter(string);
PemObjectGenerator objGen = new MiscPEMGenerator(csr);
pemWriter.writeObject(objGen);
pemWriter.close();
return string.toString();
}
开发者ID:igniterealtime,项目名称:Openfire,代码行数:33,代码来源:CertificateManager.java
示例2: writeObject
import org.bouncycastle.util.io.pem.PemObjectGenerator; //导入依赖的package包/类
public void writeObject(
PemObjectGenerator obj)
throws IOException
{
super.writeObject(obj);
}
开发者ID:Appdome,项目名称:ipack,代码行数:7,代码来源:PEMWriter.java
注:本文中的org.bouncycastle.util.io.pem.PemObjectGenerator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论