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