Enum KeyFlag

    • Enum Constant Detail

      • CERTIFY_OTHER

        public static final KeyFlag CERTIFY_OTHER
        This key may be used to certify other keys.
      • SIGN_DATA

        public static final KeyFlag SIGN_DATA
        This key may be used to sign data.
      • ENCRYPT_COMMS

        public static final KeyFlag ENCRYPT_COMMS
        This key may be used to encrypt communications.
      • SPLIT

        public static final KeyFlag SPLIT
        The private component of this key may have been split by a secret-sharing mechanism.
      • SHARED

        public static final KeyFlag SHARED
        The private component of this key may be in the possession of more than one person.
    • Method Detail

      • values

        public static KeyFlag[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (KeyFlag c : KeyFlag.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static KeyFlag valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • getFlag

        public int getFlag()
        Return the numeric id of the KeyFlag.
        Returns:
        numeric id
      • fromBitmask

        public static List<KeyFlagfromBitmask​(int bitmask)
        Convert a bitmask into a list of KeyFlags.
        Parameters:
        bitmask - bitmask
        Returns:
        list of key flags encoded by the bitmask
      • toBitmask

        public static int toBitmask​(KeyFlag... flags)
        Encode a list of KeyFlags into a bitmask.
        Parameters:
        flags - list of flags
        Returns:
        bitmask
      • hasKeyFlag

        public static boolean hasKeyFlag​(int mask,
                                         KeyFlag flag)
        Return true if the provided bitmask has the bit for the provided flag set. Return false if the mask does not contain the flag.
        Parameters:
        mask - bitmask
        flag - flag to be tested for
        Returns:
        true if flag is set, false otherwise