java.lang.Object
org.eclipse.keyple.card.calypso.crypto.legacysam.LegacySamUtil

public final class LegacySamUtil extends Object
Util to help with Legacy SAM specificities.
Since:
0.4.0
  • Method Details

    • buildPowerOnDataFilter

      public static String buildPowerOnDataFilter(org.eclipse.keypop.calypso.crypto.legacysam.sam.LegacySam.ProductType productType, String serialNumberRegex)
      Create a regular expression to be used as "Power on data" filter in the selection process.

      Two criteria are available:

      • A filter to target SAMs having a specific LegacySam.ProductType.
      • A filter to target SAMs having a serial number matching a specific regular expression.

      Concerning the serial number, the regular expression is based on a hexadecimal representation of the number.

      Example:

      • A filter targeting all SAMs having an 8-byte serial number starting with A0h would be "^A0.{6}$".
      • A filter targeting a SAM having the exact serial number 12345678h would be "12345678".

      Both argument are optional and can be null.

      Parameters:
      productType - The target SAM product type.
      serialNumberRegex - A regular expression matching the SAM serial number.
      Returns:
      A not empty string containing a regular
      Throws:
      IllegalArgumentException - If productType is null.
      IllegalArgumentException - If serialNumberRegex is null, empty or invalid.
      Since:
      0.4.0