Class LabelUtils

java.lang.Object
com.ibm.crypto.hdwrCCA.provider.LabelUtils

public final class LabelUtils extends Object
This class provides common processing for symmetric keys (types AES, DES, DESede).
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    protected static String
    Generates a label for an entry in the CCA key repository.
    protected static boolean
    isLabel(byte[] label, Charset encoding)
    This method determines if the byte array contains a key label.
    protected static byte[]
    padLabel(byte[] label, Charset encoding)
    This method pads label to 64 characters using blank characters.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LabelUtils

      public LabelUtils()
      Constructor
  • Method Details

    • genLabelName

      protected static String genLabelName()
      Generates a label for an entry in the CCA key repository.
      Returns:
      the generated label for an entry in the CCA key repository.
    • isLabel

      protected static boolean isLabel(byte[] label, Charset encoding)
      This method determines if the byte array contains a key label.
      Parameters:
      label - The byte array to check if it contains a label. The key label must be in the encoding defined by the argument encoding.
      encoding - The encoding that the label is in. Options are IBM1047 or IS0-8859-1 character sets. If a different character set is passed in besides these two values the method will return false.
      Returns:
      true if the label is a key label, false otherwise.
    • padLabel

      protected static byte[] padLabel(byte[] label, Charset encoding)
      This method pads label to 64 characters using blank characters. The label must be passed in the encoding specified by the argument encoding.
      Parameters:
      label - The byte array to pad. This label must be in the encoding as specified by the encoding argument.
      encoding - The character encoding that the label argument and the padded return byte array is encoded in.
      Returns:
      A new byte array containing the label passed in padded with blank characters for a total length of 64 characters. This label will be in the encoding as defined by the encoding argument.
      Throws:
      RuntimeException - when the encoding is not specified as PlatformUtilities.CHARSET_IBM_1047 or PlatformUtilities.CHARSET_ISO_8859_1 or the label is greater than 64 characters.