Class X500PrincipalUtil

    • Field Detail

      • NO_STRINGS

        private static final String[] NO_STRINGS
      • X500_NAME_CLASS

        private static final Class<?> X500_NAME_CLASS
      • AS_X500_PRINCIPAL_HANDLE

        private static final MethodHandle AS_X500_PRINCIPAL_HANDLE
    • Constructor Detail

      • X500PrincipalUtil

        private X500PrincipalUtil()
    • Method Detail

      • getAttributeValues

        public static String[] getAttributeValues​(X500Principal principal,
                                                  String oid)
        Get all the values of the attribute with the given OID in the given principal. This includes occurrences within multi-valued RDNs.
        Parameters:
        principal - the principal to examine
        oid - the OID whose values are to be returned
        Returns:
        the list of values associated with the OID
      • getAttributeValues

        public static String[] getAttributeValues​(X500Principal principal,
                                                  String oid,
                                                  boolean reverse)
        Get all the values of the attribute with the given OID in the given principal. This includes occurrences within multi-valued RDNs.
        Parameters:
        principal - the principal to examine
        oid - the OID whose values are to be returned
        reverse - true if the values in the returned list should be in reverse order
        Returns:
        the list of values associated with the OID
      • containsAllAttributes

        public static boolean containsAllAttributes​(X500Principal principal,
                                                    String... oids)
        Determine if the given principal contains all of the attributes specified by the given OIDs. This includes occurrences within multi-valued RDNs.
        Parameters:
        principal - the principal to examine
        oids - the OIDs of the attributes that must be present in the given principal (must not be null, cannot have null elements)
        Returns:
        true if the given principal contains all of the attributes specified by the given OIDs, false otherwise
      • asX500Principal

        public static X500Principal asX500Principal​(Principal principal)
        Attempt to convert the given principal to an X.500 principal.
        Parameters:
        principal - the original principal
        Returns:
        the X.500 principal or null if the principal can not be converted.
      • asX500Principal

        public static X500Principal asX500Principal​(Principal principal,
                                                    boolean convert)
        Attempt to convert the given principal to an X.500 principal.
        Parameters:
        principal - the original principal
        convert - true if the principal should be converted to a X500Principal if not one already.
        Returns:
        the X.500 principal or null if the principal can not be converted.