Class Answers


  • public final class Answers
    extends Object
    Utility methods for hashing and normalising answers to KBA questions.
    Since:
    0.9.0
    • Method Detail

      • hashAnswer

        public static org.forgerock.json.JsonValue hashAnswer​(CryptoService cryptoService,
                                                              org.forgerock.json.JsonValue answer)
                                                       throws org.forgerock.json.resource.InternalServerErrorException
        Hashes the given answer. If already hashed, it is returned unchanged. Throws InternalServerErrorException if the provided answer is not a String or cannot be hashed.
        Parameters:
        cryptoService - an instance of the CryptoService to perform the hashing
        answer - the value to be hashed.
        Returns:
        the hashed string value.
        Throws:
        org.forgerock.json.resource.InternalServerErrorException - if the provided answer is not a String or cannot be hashed
      • normaliseAnswer

        public static String normaliseAnswer​(String answer)
        Normalises the given answer.
        Parameters:
        answer - the string value to be normalised.
        Returns:
        normalised string value.