org.bouncycastle.its.bc.BcITSExplicitCertificateBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcpkix-jdk15to18 Show documentation
Show all versions of bcpkix-jdk15to18 Show documentation
The Bouncy Castle Java APIs for CMS, PKCS, EAC, TSP, CMP, CRMF, OCSP, and certificate generation. This jar contains APIs for JDK 1.5 to JDK 1.8. The APIs can be used in conjunction with a JCE/JCA provider such as the one provided with the Bouncy Castle Cryptography APIs.
package org.bouncycastle.its.bc;
import org.bouncycastle.crypto.params.ECPublicKeyParameters;
import org.bouncycastle.its.ITSCertificate;
import org.bouncycastle.its.ITSExplicitCertificateBuilder;
import org.bouncycastle.its.ITSPublicEncryptionKey;
import org.bouncycastle.its.operator.ITSContentSigner;
import org.bouncycastle.oer.its.ieee1609dot2.CertificateId;
import org.bouncycastle.oer.its.ieee1609dot2.ToBeSignedCertificate;
public class BcITSExplicitCertificateBuilder
extends ITSExplicitCertificateBuilder
{
/**
* Base constructor for an ITS certificate.
*
* @param signer the content signer to be used to generate the signature validating the certificate.
* @param tbsCertificate
*/
public BcITSExplicitCertificateBuilder(ITSContentSigner signer, ToBeSignedCertificate.Builder tbsCertificate)
{
super(signer, tbsCertificate);
}
public ITSCertificate build(
CertificateId certificateId,
ECPublicKeyParameters verificationKey)
{
return build(certificateId, verificationKey, null);
}
public ITSCertificate build(
CertificateId certificateId,
ECPublicKeyParameters verificationKey,
ECPublicKeyParameters encryptionKey)
{
ITSPublicEncryptionKey publicEncryptionKey = null;
if (encryptionKey != null)
{
publicEncryptionKey = new BcITSPublicEncryptionKey(encryptionKey);
}
return super.build(certificateId, new BcITSPublicVerificationKey(verificationKey), publicEncryptionKey);
}
}