Class BCUtil


  • public final class BCUtil
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean constantTimeAreEqual​(char[] expected, char[] supplied)
      A constant time equals comparison - does not terminate early if test will fail.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.