Class BCUtil


  • public final class BCUtil
    extends Object
    • Method Detail

      • constantTimeAreEqual

        public static boolean constantTimeAreEqual​(char[] expected,
                                                   char[] supplied)
        A constant time equals comparison - does not terminate early if test will fail. For best results always pass the expected value as the first parameter. TODO: This method was proposed as a patch to BC: https://github.com/bcgit/bc-java/pull/1141 Replace usage of this method with upstream eventually. Remove once BC 172 gets released, given it contains the patch.
        Parameters:
        expected - first array
        supplied - second array
        Returns:
        true if arrays equal, false otherwise.