Class KeyUsageBit

  • All Implemented Interfaces:
    java.io.Serializable

    public class KeyUsageBit
    extends java.lang.Object
    implements java.io.Serializable

    Class that represents a Key Usage Bit Identifier.

    Project:

    Library for the integration with the services of @Firma, eVisor and TS@.

    Version:
    1.1, 15/06/2021.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String NAME_CRLSIGN
      Constant attribute that represents the key usage name 'crlSign'.
      static java.lang.String NAME_DATAENCIPHERMENT
      Constant attribute that represents the key usage name 'dataEncipherment'.
      static java.lang.String NAME_DECIPHERONLY
      Constant attribute that represents the key usage name 'decipherOnly'.
      static java.lang.String NAME_DIGITALSIGNATURE
      Constant attribute that represents the key usage name 'digitalSignature'.
      static java.lang.String NAME_ENCIPHERONLY
      Constant attribute that represents the key usage name 'encipherOnly'.
      static java.lang.String NAME_KEYAGREEMENT
      Constant attribute that represents the key usage name 'keyAgreement'.
      static java.lang.String NAME_KEYCERTSIGN
      Constant attribute that represents the key usage name 'keyCertSign'.
      static java.lang.String NAME_KEYENCIPHERMENT
      Constant attribute that represents the key usage name 'keyEncipherment'.
      static java.lang.String NAME_NONREPUDATION
      Constant attribute that represents the key usage name 'nonRepudiation'.
    • Constructor Summary

      Constructors 
      Constructor Description
      KeyUsageBit​(java.lang.String keyUsageName, boolean keyUsageValue)
      Constructor method for the class KeyUsageBit.java.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean checkCertificate​(java.security.cert.X509Certificate cert)
      Checks if the input certificate has the KeyUsage set to the same value how this object.
      java.lang.String getName()
      Gets the value of the attribute name.
      boolean getValue()
      Gets the value of the attribute value.
      void setKeyUsage​(java.lang.String keyUsageName, boolean keyUsageValue)
      Sets the Key Usage.
      • Methods inherited from class java.lang.Object

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

      • NAME_DIGITALSIGNATURE

        public static final java.lang.String NAME_DIGITALSIGNATURE
        Constant attribute that represents the key usage name 'digitalSignature'.
        See Also:
        Constant Field Values
      • NAME_NONREPUDATION

        public static final java.lang.String NAME_NONREPUDATION
        Constant attribute that represents the key usage name 'nonRepudiation'.
        See Also:
        Constant Field Values
      • NAME_KEYENCIPHERMENT

        public static final java.lang.String NAME_KEYENCIPHERMENT
        Constant attribute that represents the key usage name 'keyEncipherment'.
        See Also:
        Constant Field Values
      • NAME_DATAENCIPHERMENT

        public static final java.lang.String NAME_DATAENCIPHERMENT
        Constant attribute that represents the key usage name 'dataEncipherment'.
        See Also:
        Constant Field Values
      • NAME_KEYAGREEMENT

        public static final java.lang.String NAME_KEYAGREEMENT
        Constant attribute that represents the key usage name 'keyAgreement'.
        See Also:
        Constant Field Values
      • NAME_KEYCERTSIGN

        public static final java.lang.String NAME_KEYCERTSIGN
        Constant attribute that represents the key usage name 'keyCertSign'.
        See Also:
        Constant Field Values
      • NAME_CRLSIGN

        public static final java.lang.String NAME_CRLSIGN
        Constant attribute that represents the key usage name 'crlSign'.
        See Also:
        Constant Field Values
      • NAME_ENCIPHERONLY

        public static final java.lang.String NAME_ENCIPHERONLY
        Constant attribute that represents the key usage name 'encipherOnly'.
        See Also:
        Constant Field Values
      • NAME_DECIPHERONLY

        public static final java.lang.String NAME_DECIPHERONLY
        Constant attribute that represents the key usage name 'decipherOnly'.
        See Also:
        Constant Field Values
    • Constructor Detail

      • KeyUsageBit

        public KeyUsageBit​(java.lang.String keyUsageName,
                           boolean keyUsageValue)
        Constructor method for the class KeyUsageBit.java.
        Parameters:
        keyUsageName - Key Usage name to assign.
        keyUsageValue - Key usage value to assign.
    • Method Detail

      • getName

        public final java.lang.String getName()
        Gets the value of the attribute name.
        Returns:
        the value of the attribute name.
      • getValue

        public final boolean getValue()
        Gets the value of the attribute value.
        Returns:
        the value of the attribute value.
      • setKeyUsage

        public final void setKeyUsage​(java.lang.String keyUsageName,
                                      boolean keyUsageValue)
        Sets the Key Usage.
        Parameters:
        keyUsageName - Key Usage name to assign.
        keyUsageValue - Key usage value to assign.
      • checkCertificate

        public final boolean checkCertificate​(java.security.cert.X509Certificate cert)
        Checks if the input certificate has the KeyUsage set to the same value how this object.
        Parameters:
        cert - Certificate X509v3 to check.
        Returns:
        true if the certificate has the KeyUsage set to the same value how this object, otherwise false.