Class VOMSACUtils

  • All Implemented Interfaces:
    VOMSConstants

    public class VOMSACUtils
    extends java.lang.Object
    implements VOMSConstants
    A set of VOMS AC handling utilities.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private VOMSACUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.security.cert.X509Certificate[] deserializeACCerts​(org.bouncycastle.cert.X509AttributeCertificateHolder ac)
      Deserializes the VOMS ACCerts extension
      private static java.util.List<java.lang.String> deserializeACTargets​(org.bouncycastle.cert.X509AttributeCertificateHolder ac)  
      private static java.util.List<java.lang.String> deserializeFQANs​(org.bouncycastle.asn1.x509.IetfAttrSyntax attr)
      Deserializes the FQANs contained in a IetfAttrSyntax object
      private static java.util.List<VOMSGenericAttribute> deserializeGAs​(org.bouncycastle.cert.X509AttributeCertificateHolder ac)
      Deserializes the VOMS generic attributes
      static java.util.List<VOMSAttribute> deserializeVOMSAttributes​(java.util.List<org.bouncycastle.asn1.x509.AttributeCertificate> acs)
      Deserializes the information in a list of VOMS attribute certificates.
      static VOMSAttribute deserializeVOMSAttributes​(org.bouncycastle.asn1.x509.AttributeCertificate ac)
      Deserializes the information in a VOMS attribute certificate.
      static java.util.List<org.bouncycastle.asn1.x509.AttributeCertificate> getACsFromCertificate​(java.security.cert.X509Certificate cert)
      Deserializes the VOMS Attribute certificates, if present, in a given certificate passed as argument
      static java.util.List<org.bouncycastle.asn1.x509.AttributeCertificate> getACsFromVOMSExtension​(byte[] vomsExtension)
      Deserializes the VOMS Attribute certificates in a given certificate extension
      static byte[] getVOMSExtensionFromCertificate​(java.security.cert.X509Certificate cert)
      Returns the VOMS extension, if present, in a given certificate
      private static java.lang.String policyAuthoritySanityChecks​(org.bouncycastle.asn1.x509.IetfAttrSyntax attr)
      Peforms some sanity checks on the format of the policy authority field found in a VOMS extension.
      private static void raiseACNonConformantError​(java.lang.String errorString)  
      • Methods inherited from class java.lang.Object

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

      • POLICY_AUTHORITY_SEP

        public static final java.lang.String POLICY_AUTHORITY_SEP
        See Also:
        Constant Field Values
    • Constructor Detail

      • VOMSACUtils

        private VOMSACUtils()
    • Method Detail

      • getVOMSExtensionFromCertificate

        public static byte[] getVOMSExtensionFromCertificate​(java.security.cert.X509Certificate cert)
        Returns the VOMS extension, if present, in a given certificate
        Parameters:
        cert - the X509Certificate where the extension will be searched
        Returns:
        the DER-encoded octet string of the extension value or null if it is not present.
      • getACsFromVOMSExtension

        public static java.util.List<org.bouncycastle.asn1.x509.AttributeCertificate> getACsFromVOMSExtension​(byte[] vomsExtension)
                                                                                                       throws java.io.IOException
        Deserializes the VOMS Attribute certificates in a given certificate extension
        Parameters:
        vomsExtension - the VOMS extension
        Returns:
        the possibly empty List of AttributeCertificate extracted from a given extension
        Throws:
        java.io.IOException - in case of deserialization errors
      • getACsFromCertificate

        public static java.util.List<org.bouncycastle.asn1.x509.AttributeCertificate> getACsFromCertificate​(java.security.cert.X509Certificate cert)
                                                                                                     throws java.io.IOException
        Deserializes the VOMS Attribute certificates, if present, in a given certificate passed as argument
        Parameters:
        cert - the X509Certificate where the ACs will be searched
        Returns:
        the possibly empty List of AttributeCertificate objects extracted from the VOMS extension
        Throws:
        java.io.IOException - in case of deserialization errors
      • deserializeFQANs

        private static java.util.List<java.lang.String> deserializeFQANs​(org.bouncycastle.asn1.x509.IetfAttrSyntax attr)
        Deserializes the FQANs contained in a IetfAttrSyntax object
        Parameters:
        attr - the IetfAttrSyntax attribute syntax object containing the VOMS extension
        Returns:
        a List of FQANs
      • deserializeACTargets

        private static java.util.List<java.lang.String> deserializeACTargets​(org.bouncycastle.cert.X509AttributeCertificateHolder ac)
      • raiseACNonConformantError

        private static void raiseACNonConformantError​(java.lang.String errorString)
      • policyAuthoritySanityChecks

        private static java.lang.String policyAuthoritySanityChecks​(org.bouncycastle.asn1.x509.IetfAttrSyntax attr)
        Peforms some sanity checks on the format of the policy authority field found in a VOMS extension. The enforced format is: vo://host:port
        Parameters:
        attr - the IetfAttrSyntax attribute syntax object containing the VOMS extension
        Returns:
        the validated policy authority as a String
      • deserializeVOMSAttributes

        public static java.util.List<VOMSAttribute> deserializeVOMSAttributes​(java.util.List<org.bouncycastle.asn1.x509.AttributeCertificate> acs)
        Deserializes the information in a list of VOMS attribute certificates.
        Parameters:
        acs - a List of VOMS acs
        Returns:
        a possibly empty list of VOMSAttribute
      • deserializeVOMSAttributes

        public static VOMSAttribute deserializeVOMSAttributes​(org.bouncycastle.asn1.x509.AttributeCertificate ac)
        Deserializes the information in a VOMS attribute certificate.
        Parameters:
        ac - a VOMS AttributeCertificate
        Returns:
        a VOMSAttribute object which provides more convenient access to the VOMS authorization information
      • deserializeGAs

        private static java.util.List<VOMSGenericAttribute> deserializeGAs​(org.bouncycastle.cert.X509AttributeCertificateHolder ac)
        Deserializes the VOMS generic attributes
        Parameters:
        ac - the VOMS X509AttributeCertificateHolder
        Returns:
        the List of VOMSGenericAttribute contained in the ac
      • deserializeACCerts

        private static java.security.cert.X509Certificate[] deserializeACCerts​(org.bouncycastle.cert.X509AttributeCertificateHolder ac)
        Deserializes the VOMS ACCerts extension
        Parameters:
        ac - the VOMS X509AttributeCertificateHolder
        Returns:
        the parsed array of X509Certificate