Class MechanismInfo


  • public class MechanismInfo
    extends Object
    Objects of this class provide information about a certain mechanism that a token implements.
    Author:
    Karl Scheibelhofer (SIC), Lijun Liao (xipki)
    • Constructor Detail

      • MechanismInfo

        public MechanismInfo​(CK_MECHANISM_INFO ckMechanismInfo)
        Constructor taking a CK_MECHANISM_INFO object as data source.
        Parameters:
        ckMechanismInfo - The CK_MECHANISM_INFO object that provides the data.
      • MechanismInfo

        public MechanismInfo​(long minKeySize,
                             long maxKeySize,
                             long flags)
        Parameters:
        minKeySize - The minimum key length supported by this mechanism.
        maxKeySize - The maximum key length supported by this mechanism.
        flags - The flag bit(s).
    • Method Detail

      • getMinKeySize

        public long getMinKeySize()
        Get the minimum key length supported by this mechanism.
        Returns:
        The minimum key length supported by this mechanism.
      • getMaxKeySize

        public long getMaxKeySize()
        Get the maximum key length supported by this mechanism.
        Returns:
        The maximum key length supported by this mechanism.
      • hasFlagBit

        public boolean hasFlagBit​(long flagMask)
      • setFlagBit

        public void setFlagBit​(long flagMask)
        Set the given feature flag.
        Parameters:
        flagMask - The mask of the flag bit(s).
      • clearFlagBit

        public void clearFlagBit​(long flagMask)
        Clear the given feature flag.
        Parameters:
        flagMask - The mask of the flag bit(s).
      • supports

        public boolean supports​(MechanismInfo requiredFeatures)
        Check, if this mechanism info has those flags set to true, which are set in the given mechanism info. This may be used as a simple check, if some operations are supported. This also checks the key length range, if they are specified in the given mechanism object; i.e. if they are not zero.
        Parameters:
        requiredFeatures - The required features.
        Returns:
        True, if the required features are supported.
      • toString

        public String toString()
        Returns the string representation of this object.
        Overrides:
        toString in class Object
        Returns:
        the string representation of this object