1. /*
  2. * @(#)CertStoreSpi.java 1.7 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.security.cert;
  8. import java.security.InvalidAlgorithmParameterException;
  9. import java.util.Collection;
  10. /**
  11. * The <i>Service Provider Interface</i> (<b>SPI</b>)
  12. * for the {@link CertStore CertStore} class. All <code>CertStore</code>
  13. * implementations must include a class (the SPI class) that extends
  14. * this class (<code>CertStoreSpi</code>), provides a constructor with
  15. * a single argument of type <code>CertStoreParameters</code>, and implements
  16. * all of its methods. In general, instances of this class should only be
  17. * accessed through the <code>CertStore</code> class.
  18. * For details, see the Java Cryptography Architecture.
  19. * <p>
  20. * <b>Concurrent Access</b>
  21. * <p>
  22. * The public methods of all <code>CertStoreSpi</code> objects must be
  23. * thread-safe. That is, multiple threads may concurrently invoke these
  24. * methods on a single <code>CertStoreSpi</code> object (or more than one)
  25. * with no ill effects. This allows a <code>CertPathBuilder</code> to search
  26. * for a CRL while simultaneously searching for further certificates, for
  27. * instance.
  28. * <p>
  29. * Simple <code>CertStoreSpi</code> implementations will probably ensure
  30. * thread safety by adding a <code>synchronized</code> keyword to their
  31. * <code>engineGetCertificates</code> and <code>engineGetCRLs</code> methods.
  32. * More sophisticated ones may allow truly concurrent access.
  33. *
  34. * @version 1.7 12/19/03
  35. * @since 1.4
  36. * @author Steve Hanna
  37. */
  38. public abstract class CertStoreSpi {
  39. /**
  40. * The sole constructor.
  41. *
  42. * @param params the initialization parameters (may be <code>null</code>)
  43. * @throws InvalidAlgorithmParameterException if the initialization
  44. * parameters are inappropriate for this <code>CertStoreSpi</code>
  45. */
  46. public CertStoreSpi(CertStoreParameters params)
  47. throws InvalidAlgorithmParameterException { }
  48. /**
  49. * Returns a <code>Collection</code> of <code>Certificate</code>s that
  50. * match the specified selector. If no <code>Certificate</code>s
  51. * match the selector, an empty <code>Collection</code> will be returned.
  52. * <p>
  53. * For some <code>CertStore</code> types, the resulting
  54. * <code>Collection</code> may not contain <b>all</b> of the
  55. * <code>Certificate</code>s that match the selector. For instance,
  56. * an LDAP <code>CertStore</code> may not search all entries in the
  57. * directory. Instead, it may just search entries that are likely to
  58. * contain the <code>Certificate</code>s it is looking for.
  59. * <p>
  60. * Some <code>CertStore</code> implementations (especially LDAP
  61. * <code>CertStore</code>s) may throw a <code>CertStoreException</code>
  62. * unless a non-null <code>CertSelector</code> is provided that includes
  63. * specific criteria that can be used to find the certificates. Issuer
  64. * and/or subject names are especially useful criteria.
  65. *
  66. * @param selector A <code>CertSelector</code> used to select which
  67. * <code>Certificate</code>s should be returned. Specify <code>null</code>
  68. * to return all <code>Certificate</code>s (if supported).
  69. * @return A <code>Collection</code> of <code>Certificate</code>s that
  70. * match the specified selector (never <code>null</code>)
  71. * @throws CertStoreException if an exception occurs
  72. */
  73. public abstract Collection<? extends Certificate> engineGetCertificates
  74. (CertSelector selector) throws CertStoreException;
  75. /**
  76. * Returns a <code>Collection</code> of <code>CRL</code>s that
  77. * match the specified selector. If no <code>CRL</code>s
  78. * match the selector, an empty <code>Collection</code> will be returned.
  79. * <p>
  80. * For some <code>CertStore</code> types, the resulting
  81. * <code>Collection</code> may not contain <b>all</b> of the
  82. * <code>CRL</code>s that match the selector. For instance,
  83. * an LDAP <code>CertStore</code> may not search all entries in the
  84. * directory. Instead, it may just search entries that are likely to
  85. * contain the <code>CRL</code>s it is looking for.
  86. * <p>
  87. * Some <code>CertStore</code> implementations (especially LDAP
  88. * <code>CertStore</code>s) may throw a <code>CertStoreException</code>
  89. * unless a non-null <code>CRLSelector</code> is provided that includes
  90. * specific criteria that can be used to find the CRLs. Issuer names
  91. * and/or the certificate to be checked are especially useful.
  92. *
  93. * @param selector A <code>CRLSelector</code> used to select which
  94. * <code>CRL</code>s should be returned. Specify <code>null</code>
  95. * to return all <code>CRL</code>s (if supported).
  96. * @return A <code>Collection</code> of <code>CRL</code>s that
  97. * match the specified selector (never <code>null</code>)
  98. * @throws CertStoreException if an exception occurs
  99. */
  100. public abstract Collection<? extends CRL> engineGetCRLs
  101. (CRLSelector selector) throws CertStoreException;
  102. }