Bouncy Castle Cryptography Library 1.45

## org.bouncycastle.x509
Class X509V2AttributeCertificateGenerator

    java.lang.Object
      org.bouncycastle.x509.X509V2AttributeCertificateGenerator

    public class X509V2AttributeCertificateGenerator

extends java.lang.Object

class to produce an X.509 Version 2 AttributeCertificate.

Constructor Summary
`X509V2AttributeCertificateGenerator()`

Method Summary
`void` `addAttribute(X509Attribute attribute)` add an attribute
`void` `addExtension(java.lang.String oid, boolean critical, ASN1Encodable value)` add a given extension field for the standard extensions tag
`void` `addExtension(java.lang.String oid, boolean critical, byte[] value)` add a given extension field for the standard extensions tag The value parameter becomes the contents of the octet string associated with the extension.
`X509AttributeCertificate` `generate(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.
`X509AttributeCertificate` `generate(java.security.PrivateKey key, java.lang.String provider, java.security.SecureRandom random)` generate an X509 certificate, based on the current issuer and subject, using the passed in provider for the signing and the supplied source of randomness, if required.
`X509AttributeCertificate` `generateCertificate(java.security.PrivateKey key, java.lang.String provider)` Deprecated. use generate()
`X509AttributeCertificate` `generateCertificate(java.security.PrivateKey key, java.lang.String provider, java.security.SecureRandom random)` Deprecated. use generate()
`java.util.Iterator` `getSignatureAlgNames()` Return an iterator of the signature names supported by the generator.
`void` `reset()` reset the generator
`void` `setHolder(AttributeCertificateHolder holder)` Set the Holder of this Attribute Certificate
`void` `setIssuer(AttributeCertificateIssuer issuer)` Set the issuer
`void` `setIssuerUniqueId(boolean[] iui)`
`void` `setNotAfter(java.util.Date date)`
`void` `setNotBefore(java.util.Date date)`
`void` `setSerialNumber(java.math.BigInteger serialNumber)` set the serial number for the certificate.
`void` `setSignatureAlgorithm(java.lang.String signatureAlgorithm)` Set the signature algorithm.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### X509V2AttributeCertificateGenerator

    public X509V2AttributeCertificateGenerator()

Method Detail

### reset

    public void reset()

  reset the generator

### setHolder

    public void setHolder(AttributeCertificateHolder holder)

  Set the Holder of this Attribute Certificate

### setIssuer

    public void setIssuer(AttributeCertificateIssuer issuer)

  Set the issuer

### setSerialNumber

    public void setSerialNumber(java.math.BigInteger serialNumber)

  set the serial number for the certificate.

### setNotBefore

    public void setNotBefore(java.util.Date date)

### setNotAfter

    public void setNotAfter(java.util.Date date)

### setSignatureAlgorithm

    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.

  Parameters:
    `signatureAlgorithm` - string representation of the algorithm name.

### addAttribute

    public void addAttribute(X509Attribute attribute)

  add an attribute

### setIssuerUniqueId

    public void setIssuerUniqueId(boolean[] iui)

### addExtension

    public void addExtension(java.lang.String oid,
                             boolean critical,
                             ASN1Encodable value)
                      throws java.io.IOException

  add a given extension field for the standard extensions tag

  Throws:
    `java.io.IOException`

### addExtension

    public void addExtension(java.lang.String oid,
                             boolean critical,
                             byte[] value)

  add a given extension field for the standard extensions tag The value parameter becomes the contents of the octet string associated with the extension.

### generateCertificate

    public X509AttributeCertificate generateCertificate(java.security.PrivateKey key,
                                                        java.lang.String provider)
                                                 throws java.security.NoSuchProviderException,
                                                        java.lang.SecurityException,
                                                        java.security.SignatureException,
                                                        java.security.InvalidKeyException

  Deprecated. use generate()

  generate an X509 certificate, based on the current issuer and subject, using the passed in provider for the signing.

  Throws:
    `java.security.NoSuchProviderException`
    `java.lang.SecurityException`
    `java.security.SignatureException`
    `java.security.InvalidKeyException`

### generateCertificate

    public X509AttributeCertificate generateCertificate(java.security.PrivateKey key,
                                                        java.lang.String provider,
                                                        java.security.SecureRandom random)
                                                 throws java.security.NoSuchProviderException,
                                                        java.lang.SecurityException,
                                                        java.security.SignatureException,
                                                        java.security.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 supplied source of randomness, if required.

  Throws:
    `java.security.NoSuchProviderException`
    `java.lang.SecurityException`
    `java.security.SignatureException`
    `java.security.InvalidKeyException`

### generate

    public X509AttributeCertificate generate(java.security.PrivateKey key,
                                             java.lang.String provider)
                                      throws java.security.cert.CertificateEncodingException,
                                             java.lang.IllegalStateException,
                                             java.security.NoSuchProviderException,
                                             java.security.SignatureException,
                                             java.security.InvalidKeyException,
                                             java.security.NoSuchAlgorithmException

  generate an X509 certificate, based on the current issuer and subject, using the passed in provider for the signing.

  Throws:
    `java.security.cert.CertificateEncodingException`
    `java.lang.IllegalStateException`
    `java.security.NoSuchProviderException`
    `java.security.SignatureException`
    `java.security.InvalidKeyException`
    `java.security.NoSuchAlgorithmException`

### generate

    public X509AttributeCertificate generate(java.security.PrivateKey key,
                                             java.lang.String provider,
                                             java.security.SecureRandom random)
                                      throws java.security.cert.CertificateEncodingException,
                                             java.lang.IllegalStateException,
                                             java.security.NoSuchProviderException,
                                             java.security.NoSuchAlgorithmException,
                                             java.security.SignatureException,
                                             java.security.InvalidKeyException

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

  Throws:
    `java.security.cert.CertificateEncodingException`
    `java.lang.IllegalStateException`
    `java.security.NoSuchProviderException`
    `java.security.NoSuchAlgorithmException`
    `java.security.SignatureException`
    `java.security.InvalidKeyException`

### getSignatureAlgNames

    public java.util.Iterator getSignatureAlgNames()

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

  Returns:
    an iterator containing recognised names.

Bouncy Castle Cryptography Library 1.45