Methods Summary |
---|
public void | addCRL(java.security.cert.X509CRL other)Add the CRLEntry objects contained in a previous CRL.
Set revocations = other.getRevokedCertificates();
Iterator it = revocations.iterator();
while (it.hasNext())
{
X509CRLEntry entry = (X509CRLEntry)it.next();
ASN1InputStream aIn = new ASN1InputStream(entry.getEncoded());
try
{
tbsGen.addCRLEntry(ASN1Sequence.getInstance(aIn.readObject()));
}
catch (IOException e)
{
throw new CRLException("exception processing encoding of CRL: " + e.toString());
}
}
|
public void | addCRLEntry(java.math.BigInteger userCertificate, java.util.Date revocationDate, int reason)Reason being as indicated by ReasonFlags, i.e. ReasonFlags.keyCompromise
or 0 if ReasonFlags are not to be used
tbsGen.addCRLEntry(new DERInteger(userCertificate), new Time(revocationDate), reason);
|
public void | addCRLEntry(java.math.BigInteger userCertificate, java.util.Date revocationDate, int reason, java.util.Date invalidityDate)Add a CRL entry with an Invalidity Date extension as well as a CRLReason extension.
Reason being as indicated by ReasonFlags, i.e. ReasonFlags.keyCompromise
or 0 if ReasonFlags are not to be used
tbsGen.addCRLEntry(new DERInteger(userCertificate), new Time(revocationDate), reason, new DERGeneralizedTime(invalidityDate));
|
public void | addCRLEntry(java.math.BigInteger userCertificate, java.util.Date revocationDate, org.bouncycastle.asn1.x509.X509Extensions extensions)Add a CRL entry with extensions.
tbsGen.addCRLEntry(new DERInteger(userCertificate), new Time(revocationDate), extensions);
|
public void | addExtension(java.lang.String OID, boolean critical, org.bouncycastle.asn1.DEREncodable value)add a given extension field for the standard extensions tag (tag 0)
this.addExtension(new DERObjectIdentifier(OID), critical, value);
|
public void | addExtension(org.bouncycastle.asn1.DERObjectIdentifier OID, boolean critical, org.bouncycastle.asn1.DEREncodable value)add a given extension field for the standard extensions tag (tag 0)
if (extensions == null)
{
extensions = new Hashtable();
extOrdering = new Vector();
}
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
DEROutputStream dOut = new DEROutputStream(bOut);
try
{
dOut.writeObject(value);
}
catch (IOException e)
{
throw new IllegalArgumentException("error encoding value: " + e);
}
this.addExtension(OID, critical, bOut.toByteArray());
|
public void | addExtension(java.lang.String OID, boolean critical, byte[] value)add a given extension field for the standard extensions tag (tag 0)
this.addExtension(new DERObjectIdentifier(OID), critical, value);
|
public void | addExtension(org.bouncycastle.asn1.DERObjectIdentifier OID, boolean critical, byte[] value)add a given extension field for the standard extensions tag (tag 0)
if (extensions == null)
{
extensions = new Hashtable();
extOrdering = new Vector();
}
extensions.put(OID, new X509Extension(critical, new DEROctetString(value)));
extOrdering.addElement(OID);
|
public java.security.cert.X509CRL | generateX509CRL(java.security.PrivateKey key)generate an X509 CRL, based on the current issuer and subject
using the default provider "BC".
try
{
return generateX509CRL(key, "BC", null);
}
catch (NoSuchProviderException e)
{
throw new SecurityException("BC provider not installed!");
}
|
public java.security.cert.X509CRL | generateX509CRL(java.security.PrivateKey key, java.security.SecureRandom random)generate an X509 CRL, based on the current issuer and subject
using the default provider "BC" and an user defined SecureRandom object as
source of randomness.
try
{
return generateX509CRL(key, "BC", random);
}
catch (NoSuchProviderException e)
{
throw new SecurityException("BC provider not installed!");
}
|
public java.security.cert.X509CRL | generateX509CRL(java.security.PrivateKey key, java.lang.String provider)generate an X509 certificate, based on the current issuer and subject
using the passed in provider for the signing.
return generateX509CRL(key, provider, null);
|
public java.security.cert.X509CRL | generateX509CRL(java.security.PrivateKey key, java.lang.String provider, java.security.SecureRandom random)generate an X509 CRL, based on the current issuer and subject,
using the passed in provider for the signing.
Signature sig = null;
try
{
sig = Signature.getInstance(sigOID.getId(), provider);
}
catch (NoSuchAlgorithmException ex)
{
try
{
sig = Signature.getInstance(signatureAlgorithm, provider);
}
catch (NoSuchAlgorithmException e)
{
throw new SecurityException("exception creating signature: " + e.toString());
}
}
if (random != null)
{
sig.initSign(key, random);
}
else
{
sig.initSign(key);
}
if (extensions != null)
{
tbsGen.setExtensions(new X509Extensions(extOrdering, extensions));
}
TBSCertList tbsCrl = tbsGen.generateTBSCertList();
try
{
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
DEROutputStream dOut = new DEROutputStream(bOut);
dOut.writeObject(tbsCrl);
sig.update(bOut.toByteArray());
}
catch (Exception e)
{
throw new SecurityException("exception encoding TBS cert - " + e);
}
// Construct the CRL
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(tbsCrl);
v.add(sigAlgId);
v.add(new DERBitString(sig.sign()));
try
{
return new X509CRLObject(new CertificateList(new DERSequence(v)));
}
catch (CRLException e)
{
throw new SecurityException("exception creating CRL: " + e.getMessage());
}
|
public java.util.Iterator | getSignatureAlgNames()Return an iterator of the signature names supported by the generator.
return X509Util.getAlgNames();
|
public void | reset()reset the generator
tbsGen = new V2TBSCertListGenerator();
|
public void | setIssuerDN(javax.security.auth.x500.X500Principal issuer)Set the issuer distinguished name - the issuer is the entity whose private key is used to sign the
certificate.
try
{
tbsGen.setIssuer(new X509Principal(issuer.getEncoded()));
}
catch (IOException e)
{
throw new IllegalArgumentException("can't process principal: " + e);
}
|
public void | setIssuerDN(org.bouncycastle.asn1.x509.X509Name issuer)Set the issuer distinguished name - the issuer is the entity whose private key is used to sign the
certificate.
tbsGen.setIssuer(issuer);
|
public void | setNextUpdate(java.util.Date date)
tbsGen.setNextUpdate(new Time(date));
|
public void | setSignatureAlgorithm(java.lang.String signatureAlgorithm)Set the signature algorithm. This can be either a name or an OID, names
are treated as case insensitive.
this.signatureAlgorithm = signatureAlgorithm;
try
{
sigOID = X509Util.getAlgorithmOID(signatureAlgorithm);
}
catch (Exception e)
{
throw new IllegalArgumentException("Unknown signature type requested");
}
sigAlgId = X509Util.getSigAlgID(sigOID);
tbsGen.setSignature(sigAlgId);
|
public void | setThisUpdate(java.util.Date date)
tbsGen.setThisUpdate(new Time(date));
|