Class Pin

  • All Implemented Interfaces:

    
    public class Pin
    
                        

    Supports operations on pins for Secure Value Recovery

    This class provides hashing pins for local verification and for use with the remote SVR service. In either case, all pins are UTF-8 encoded bytes that must be normalized *before* being provided to this class. Normalizing a string pin requires the following steps:

    The string should be trimmed for leading and trailing whitespace. If the whole string consists of digits, then non-arabic digits must be replaced with their arabic 0-9 equivalents. The string must then be NKFD normalized
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static String localHash(Array<byte> pin) Create an encoded password hash string.
      static boolean verifyLocalHash(String encodedHash, Array<byte> pin) Verify an encoded password hash against a pin
      • Methods inherited from class java.lang.Object

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

    • Method Detail

      • localHash

         static String localHash(Array<byte> pin)

        Create an encoded password hash string.

        This creates a hashed pin that should be used for local pin verification only.

        Parameters:
        pin - A normalized, UTF-8 encoded byte representation of the pin
        Returns:

        A hashed pin string that can be verified later

      • verifyLocalHash

         static boolean verifyLocalHash(String encodedHash, Array<byte> pin)

        Verify an encoded password hash against a pin

        Parameters:
        encodedHash - An encoded string of the hash, as returned by localHash
        pin - A normalized, UTF-8 encoded byte representation of the pin to verify
        Returns:

        true if the pin matches the hash, false otherwise