FileDocCategorySizeDatePackage
UnifiedX509TrustManager.javaAPI DocGlassfish v2 API4407Fri May 04 22:35:36 BST 2007com.sun.enterprise.security.ssl

UnifiedX509TrustManager

public class UnifiedX509TrustManager extends Object implements X509TrustManager
This class combines an array of X509TrustManagers into one.
author
Shing Wai Chan

Fields Summary
private X509TrustManager[]
mgrs
private X509Certificate[]
issuers
Constructors Summary
public UnifiedX509TrustManager(X509TrustManager[] mgrs)


       
        if (mgrs == null) {
            throw new IllegalArgumentException("Null array of X509TrustManagers");
        }
        this.mgrs = mgrs;

        HashSet tset = new HashSet(); //for uniqueness
        for (int i = 0; i < mgrs.length; i++) {
            X509Certificate[] tcerts = mgrs[i].getAcceptedIssuers();
            if (tcerts != null && tcerts.length > 0) {
                for (int j = 0; j < tcerts.length; j++) {
                    tset.add(tcerts[j]);
                }
            }
        }
        issuers = new X509Certificate[tset.size()];
        Iterator iter = tset.iterator();
        for (int i = 0; iter.hasNext(); i++) {
            issuers[i] = (X509Certificate)iter.next();
        }
    
Methods Summary
public voidcheckClientTrusted(java.security.cert.X509Certificate[] chain, java.lang.String authType)

        CertificateException cex = null;
        for (int i = 0; i < mgrs.length; i++) {
            try {
                cex = null; //reset exception status
                mgrs[i].checkClientTrusted(chain, authType);
                break;
            } catch(CertificateException ex) {
                cex = ex;
            }
        }
        if (cex != null) {
            throw cex;
        }
    
public voidcheckServerTrusted(java.security.cert.X509Certificate[] chain, java.lang.String authType)

        CertificateException cex = null;
        for (int i = 0; i < mgrs.length; i++) {
            try {
                cex = null; //reset exception status
                mgrs[i].checkServerTrusted(chain, authType);
                break;
            } catch(CertificateException ex) {
                cex = ex;
            }
        }
        if (cex != null) {
            throw cex;
        }
    
public java.security.cert.X509Certificate[]getAcceptedIssuers()

        return issuers;