Class ProxyHelper


  • public class ProxyHelper
    extends java.lang.Object
    Various helpers for handling proxy certificates
    Author:
    J. Hahkala, K. Benedyczak
    • Constructor Summary

      Constructors 
      Constructor Description
      ProxyHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getLastCN​(javax.security.auth.x500.X500Principal principal)  
      static java.lang.String getLastCN​(org.bouncycastle.asn1.x500.X500Name x500Name)  
      static int getProxyPathLimit​(java.security.cert.X509Certificate cert)
      Returns the proxy path limit of the proxy.
      static ExtendedProxyType getProxyType​(java.security.cert.X509Certificate certificate)
      Checks if the certificate is a proxy and if so return its type.
      static boolean isLimited​(java.security.cert.X509Certificate cert)
      Checks if the certificate is a limited proxy in Globus sense, i.e.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ProxyHelper

        public ProxyHelper()
    • Method Detail

      • getProxyType

        public static ExtendedProxyType getProxyType​(java.security.cert.X509Certificate certificate)
        Checks if the certificate is a proxy and if so return its type.
        Parameters:
        certificate - to be checked
        Returns:
        the proxy type or info that it is a normal certificate.
      • getLastCN

        public static java.lang.String getLastCN​(javax.security.auth.x500.X500Principal principal)
                                          throws java.lang.IllegalArgumentException
        Throws:
        java.lang.IllegalArgumentException
      • getLastCN

        public static java.lang.String getLastCN​(org.bouncycastle.asn1.x500.X500Name x500Name)
                                          throws java.lang.IllegalArgumentException
        Throws:
        java.lang.IllegalArgumentException
      • getProxyPathLimit

        public static int getProxyPathLimit​(java.security.cert.X509Certificate cert)
                                     throws java.io.IOException
        Returns the proxy path limit of the proxy. The argument is not checked if is a real proxy.
        Parameters:
        cert - certificate
        Returns:
        path limit as set for the DRAFT and RFC proxies. In case of legacy proxies or unlimited proxies Integer.MAX_VALUE is returned.
        Throws:
        java.io.IOException - if the extension can not be parsed
      • isLimited

        public static boolean isLimited​(java.security.cert.X509Certificate cert)
                                 throws java.io.IOException
        Checks if the certificate is a limited proxy in Globus sense, i.e. if its last CN is equal to 'limited proxy' (in case of legacy proxies) or if the special limited proxy policy is used.
        Parameters:
        cert - certificate
        Returns:
        true only if the parameter is a limited proxy
        Throws:
        java.io.IOException - IO exception