1package org.bouncycastle.x509;
2
3import java.io.IOException;
4import java.math.BigInteger;
5import java.security.InvalidKeyException;
6import java.security.NoSuchAlgorithmException;
7import java.security.NoSuchProviderException;
8import java.security.PublicKey;
9import java.security.SignatureException;
10import java.security.cert.CertificateException;
11import java.security.cert.CertificateExpiredException;
12import java.security.cert.CertificateNotYetValidException;
13import java.security.cert.X509Extension;
14import java.util.Date;
15
16/**
17 * Interface for an X.509 Attribute Certificate.
18 */
19public interface X509AttributeCertificate
20    extends X509Extension
21{
22    /**
23     * Return the version number for the certificate.
24     *
25     * @return the version number.
26     */
27    public int getVersion();
28
29    /**
30     * Return the serial number for the certificate.
31     *
32     * @return the serial number.
33     */
34    public BigInteger getSerialNumber();
35
36    /**
37     * Return the date before which the certificate is not valid.
38     *
39     * @return the "not valid before" date.
40     */
41    public Date getNotBefore();
42
43    /**
44     * Return the date after which the certificate is not valid.
45     *
46     * @return the "not valid afer" date.
47     */
48    public Date getNotAfter();
49
50    /**
51     * Return the holder of the certificate.
52     *
53     * @return the holder.
54     */
55    public AttributeCertificateHolder getHolder();
56
57    /**
58     * Return the issuer details for the certificate.
59     *
60     * @return the issuer details.
61     */
62    public AttributeCertificateIssuer getIssuer();
63
64    /**
65     * Return the attributes contained in the attribute block in the certificate.
66     *
67     * @return an array of attributes.
68     */
69    public X509Attribute[] getAttributes();
70
71    /**
72     * Return the attributes with the same type as the passed in oid.
73     *
74     * @param oid the object identifier we wish to match.
75     * @return an array of matched attributes, null if there is no match.
76     */
77    public X509Attribute[] getAttributes(String oid);
78
79    public boolean[] getIssuerUniqueID();
80
81    public void checkValidity()
82        throws CertificateExpiredException, CertificateNotYetValidException;
83
84    public void checkValidity(Date date)
85        throws CertificateExpiredException, CertificateNotYetValidException;
86
87    public byte[] getSignature();
88
89    public void verify(PublicKey key, String provider)
90            throws CertificateException, NoSuchAlgorithmException,
91            InvalidKeyException, NoSuchProviderException, SignatureException;
92
93    /**
94     * Return an ASN.1 encoded byte array representing the attribute certificate.
95     *
96     * @return an ASN.1 encoded byte array.
97     * @throws IOException if the certificate cannot be encoded.
98     */
99    public byte[] getEncoded()
100        throws IOException;
101}
102