1. /*
  2. * @(#)CertPathHelperImpl.java 1.4 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.util.*;
  9. import javax.security.auth.x500.X500Principal;
  10. import sun.security.provider.certpath.CertPathHelper;
  11. import sun.security.x509.GeneralNameInterface;
  12. /**
  13. * Helper class that allows the Sun CertPath provider to access
  14. * implementation dependent APIs in CertPath framework.
  15. *
  16. * @author Andreas Sterbenz
  17. * @version 1.4, 12/19/03
  18. */
  19. class CertPathHelperImpl extends CertPathHelper {
  20. private CertPathHelperImpl() {
  21. // empty
  22. }
  23. /**
  24. * Initialize the helper framework. This method must be called from
  25. * the static initializer of each class that is the target of one of
  26. * the methods in this class. This ensures that the helper if initialized
  27. * prior to a tunneled call from the Sun provider.
  28. */
  29. synchronized static void initialize() {
  30. if (CertPathHelper.instance == null) {
  31. CertPathHelper.instance = new CertPathHelperImpl();
  32. }
  33. }
  34. protected void implSetSubject(X509CertSelector sel, X500Principal subject) {
  35. sel.setSubject(subject);
  36. }
  37. protected X500Principal implGetSubject(X509CertSelector sel) {
  38. return sel.getSubject();
  39. }
  40. protected void implSetIssuer(X509CertSelector sel, X500Principal issuer) {
  41. sel.setIssuer(issuer);
  42. }
  43. protected X500Principal implGetIssuer(X509CertSelector sel) {
  44. return sel.getIssuer();
  45. }
  46. protected X500Principal implGetCA(TrustAnchor anchor) {
  47. return anchor.getCA();
  48. }
  49. protected void implSetPathToNames(X509CertSelector sel,
  50. Set<GeneralNameInterface> names) {
  51. sel.setPathToNamesInternal(names);
  52. }
  53. protected void implAddIssuer(X509CRLSelector sel, X500Principal name) {
  54. sel.addIssuer(name);
  55. }
  56. protected Collection<X500Principal> implGetIssuers(X509CRLSelector sel) {
  57. return sel.getIssuers();
  58. }
  59. }