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