Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4288163

HMAC-MD5 always returns same result, even when initialized with different keys

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.2.1
    • jce1.2fcs
    • security-libs
    • None
    • 1.2.1ea
    • generic
    • generic

      > Greetings:
      >
      > In preparation for using the Mac class (specifically HMAC-MD5) I
      > grabbed the sample code from the JCE1.2 API Users Guide - to verify
      > that I at least could start from a known position (see attachment).
      >
      > Unfortunately, on running the app. I found that I was getting the
      > same results run after run - with different keys!
      >
      > $ java initMac
      > SecretKey:
      > F5:C6:28:DC:1A:C3:C2:CA:08:58:62:2B:DC:A6:1B:5A:30:43:7A:37:
      > 51:21:D3:5C:42:BF:72:BA:C9:0C:2B:67:A4:FB:4A:53:47:93:90:B7:
      > 4D:3B:FE:D3:8E:0B:5B:34:59:7B:A9:91:93:C3:14:EE:3F:74:4E:93:
      > 7C:DC:F2:A7
      > Result: 72:C3:3C:78:CA:C0:B7:A5:81:AC:26:3A:34:4E:D0:1D
      >
      > $ java initMac
      > SecretKey:
      > 8F:9A:F7:E9:8E:5E:1B:FA:10:D7:1A:7C:9D:EA:8B:CF:E5:2C:4D:F4:
      > C1:F9:15:A3:3D:FA:58:1C:FE:55:0B:4F:C3:1F:0C:95:FC:34:9F:74:
      > 94:75:F1:B6:66:CD:1C:D0:15:D3:ED:52:E1:39:A9:E6:D5:42:0C:56:
      > 79:45:6C:AE
      > Result: 72:C3:3C:78:CA:C0:B7:A5:81:AC:26:3A:34:4E:D0:1D
      >
      > Although the keys are different, the results are the same!
      > Where am I going wrong? Any help or suggestions would be
      > appreciated.
      >
      > Thanks,
      >
      > David Nochlin
      > Morgan Stanley Dean Witter
      >
      > - -
      > Version Info:
      > java version "1.2"
      > Solaris VM (build Solaris_JDK_1.2_01, native threads, sunwjit)
      >
      > Provider:
      > com.sun.crypto.provider.SunJCE (jce1.2)


            jlueheorcl Jan Luehe (Inactive)
            jlueheorcl Jan Luehe (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: