Top Description Fields Constructors Methods
org.bouncycastle.x509

public Class X509V1CertificateGenerator

extends Object
Class Inheritance
Imports
java.io.ByteArrayInputStream, .IOException, java.math.BigInteger, java.security.GeneralSecurityException, .InvalidKeyException, .NoSuchAlgorithmException, .NoSuchProviderException, .PrivateKey, .PublicKey, .SecureRandom, .SignatureException, java.security.cert.CertificateEncodingException, .X509Certificate, java.util.Date, .Iterator, javax.security.auth.x500.X500Principal, org.bouncycastle.asn1.ASN1EncodableVector, .ASN1Encoding, .ASN1Integer, .ASN1ObjectIdentifier, .DERBitString, .DERSequence, org.bouncycastle.asn1.x509.AlgorithmIdentifier, .SubjectPublicKeyInfo, .TBSCertificate, .Time, .V1TBSCertificateGenerator, .X509Name, org.bouncycastle.jcajce.provider.asymmetric.x509.CertificateFactory, org.bouncycastle.jcajce.util.BCJcaJceHelper, .JcaJceHelper, org.bouncycastle.jce.X509Principal

Deprecated

use org.bouncycastle.cert.X509v1CertificateBuilder.

class to produce an X.509 Version 1 certificate.

Field Summary

Modifier and TypeField and Description
private final JcaJceHelper
private final CertificateFactory
private AlgorithmIdentifier
private String
private ASN1ObjectIdentifier
private V1TBSCertificateGenerator

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public X509Certificate
generate(PrivateKey key)

generate an X509 certificate, based on the current issuer and subject using the default provider.

public X509Certificate
generate(PrivateKey key, SecureRandom random)

generate an X509 certificate, based on the current issuer and subject using the default provider and the passed in source of randomness

Note

this differs from the deprecated method in that the default provider is used - not "BC".

public X509Certificate
generate(PrivateKey key, String provider)

generate an X509 certificate, based on the current issuer and subject, using the passed in provider for the signing, and the passed in source of randomness (if required).

public X509Certificate
generate(PrivateKey key, String provider, SecureRandom random)

generate an X509 certificate, based on the current issuer and subject, using the passed in provider for the signing, and the passed in source of randomness (if required).

private X509Certificate
generateJcaObject(TBSCertificate tbsCert, byte[] signature)

public X509Certificate
generateX509Certificate(PrivateKey key)

Deprecated use generate(key, "BC")
generate an X509 certificate, based on the current issuer and subject using the default provider "BC".
public X509Certificate
generateX509Certificate(PrivateKey key, SecureRandom random)

Deprecated use generate(key, random, "BC")
generate an X509 certificate, based on the current issuer and subject using the default provider "BC" and the passed in source of randomness
public X509Certificate
generateX509Certificate(PrivateKey key, String provider)

Deprecated use generate()
generate an X509 certificate, based on the current issuer and subject, using the passed in provider for the signing, and the passed in source of randomness (if required).
public X509Certificate
generateX509Certificate(PrivateKey key, String provider, SecureRandom random)

Deprecated use generate()
generate an X509 certificate, based on the current issuer and subject, using the passed in provider for the signing, and the passed in source of randomness (if required).
public Iterator<E>

Returns:

an iterator containing recognised names.
getSignatureAlgNames
()

Return an iterator of the signature names supported by the generator.

public void
reset()

reset the generator

public void
setIssuerDN(X500Principal issuer)

Set the issuer distinguished name - the issuer is the entity whose private key is used to sign the certificate.

public void
setIssuerDN(X509Name issuer)

Deprecated as a consequence of X509Name being deprecated.
Set the issuer distinguished name - the issuer is the entity whose private key is used to sign the certificate.
public void
public void
public void
public void
setSerialNumber(BigInteger serialNumber)

set the serial number for the certificate.

public void
setSignatureAlgorithm(String
string representation of the algorithm name.
signatureAlgorithm
)

Set the signature algorithm.

public void
setSubjectDN(X500Principal subject)

Set the subject distinguished name.

public void
setSubjectDN(X509Name subject)

Deprecated as a consequence of X509Name being deprecated.
Set the subject distinguished name.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bcHelperback to summary
private final JcaJceHelper bcHelper
certificateFactoryback to summary
private final CertificateFactory certificateFactory
sigAlgIdback to summary
private AlgorithmIdentifier sigAlgId
signatureAlgorithmback to summary
private String signatureAlgorithm
sigOIDback to summary
private ASN1ObjectIdentifier sigOID
tbsGenback to summary
private V1TBSCertificateGenerator tbsGen

Constructor Detail

X509V1CertificateGeneratorback to summary
public X509V1CertificateGenerator()

Method Detail

generateback to summary
public X509Certificate generate(PrivateKey key) throws CertificateEncodingException, IllegalStateException, NoSuchAlgorithmException, SignatureException, InvalidKeyException

generate an X509 certificate, based on the current issuer and subject using the default provider.

Note

this differs from the deprecated method in that the default provider is used - not "BC".

generateback to summary
public X509Certificate generate(PrivateKey key, SecureRandom random) throws CertificateEncodingException, IllegalStateException, NoSuchAlgorithmException, SignatureException, InvalidKeyException

generate an X509 certificate, based on the current issuer and subject using the default provider and the passed in source of randomness

Note

this differs from the deprecated method in that the default provider is used - not "BC".

generateback to summary
public X509Certificate generate(PrivateKey key, String provider) throws CertificateEncodingException, IllegalStateException, NoSuchProviderException, NoSuchAlgorithmException, SignatureException, InvalidKeyException

generate an X509 certificate, based on the current issuer and subject, using the passed in provider for the signing, and the passed in source of randomness (if required).

generateback to summary
public X509Certificate generate(PrivateKey key, String provider, SecureRandom random) throws CertificateEncodingException, IllegalStateException, NoSuchProviderException, NoSuchAlgorithmException, SignatureException, InvalidKeyException

generate an X509 certificate, based on the current issuer and subject, using the passed in provider for the signing, and the passed in source of randomness (if required).

generateJcaObjectback to summary
private X509Certificate generateJcaObject(TBSCertificate tbsCert, byte[] signature) throws CertificateEncodingException
generateX509Certificateback to summary
public X509Certificate generateX509Certificate(PrivateKey key) throws SecurityException, SignatureException, InvalidKeyException

Deprecated

use generate(key, "BC")

generate an X509 certificate, based on the current issuer and subject using the default provider "BC".

generateX509Certificateback to summary
public X509Certificate generateX509Certificate(PrivateKey key, SecureRandom random) throws SecurityException, SignatureException, InvalidKeyException

Deprecated

use generate(key, random, "BC")

generate an X509 certificate, based on the current issuer and subject using the default provider "BC" and the passed in source of randomness

generateX509Certificateback to summary
public X509Certificate generateX509Certificate(PrivateKey key, String provider) throws NoSuchProviderException, SecurityException, SignatureException, InvalidKeyException

Deprecated

use generate()

generate an X509 certificate, based on the current issuer and subject, using the passed in provider for the signing, and the passed in source of randomness (if required).

generateX509Certificateback to summary
public X509Certificate generateX509Certificate(PrivateKey key, String provider, SecureRandom random) throws NoSuchProviderException, SecurityException, SignatureException, InvalidKeyException

Deprecated

use generate()

generate an X509 certificate, based on the current issuer and subject, using the passed in provider for the signing, and the passed in source of randomness (if required).

getSignatureAlgNamesback to summary
public Iterator<E> getSignatureAlgNames()

Return an iterator of the signature names supported by the generator.

Returns:Iterator<E>

an iterator containing recognised names.

resetback to summary
public void reset()

reset the generator

setIssuerDNback to summary
public void setIssuerDN(X500Principal issuer)

Set the issuer distinguished name - the issuer is the entity whose private key is used to sign the certificate.

setIssuerDNback to summary
public void setIssuerDN(X509Name issuer)

Deprecated

as a consequence of X509Name being deprecated. See corresponding docs for further information.

Set the issuer distinguished name - the issuer is the entity whose private key is used to sign the certificate.

setNotAfterback to summary
public void setNotAfter(Date date)
setNotBeforeback to summary
public void setNotBefore(Date date)
setPublicKeyback to summary
public void setPublicKey(PublicKey key)
setSerialNumberback to summary
public void setSerialNumber(BigInteger serialNumber)

set the serial number for the certificate.

setSignatureAlgorithmback to summary
public void setSignatureAlgorithm(String signatureAlgorithm)

Set the signature algorithm. This can be either a name or an OID, names are treated as case insensitive.

Parameters
signatureAlgorithm:String

string representation of the algorithm name.

setSubjectDNback to summary
public void setSubjectDN(X500Principal subject)

Set the subject distinguished name. The subject describes the entity associated with the public key.

setSubjectDNback to summary
public void setSubjectDN(X509Name subject)

Deprecated

as a consequence of X509Name being deprecated. See corresponding docs for further information.

Set the subject distinguished name. The subject describes the entity associated with the public key.