[Mono-bugs] [Bug 552177] New: HMACMD5 NullReferenceException

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Nov 3 10:01:02 EST 2009


           Summary: HMACMD5 NullReferenceException
    Classification: Mono
           Product: MonoTouch
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Class Libraries
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: galbitz at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

Created an attachment (id=325322)
 --> (http://bugzilla.novell.com/attachment.cgi?id=325322)
Sample code

I created a new iPhone Monotouch solution and inserted the following code in
the FinishedLaunching method:

byte[] key = System.Text.Encoding.ASCII.GetBytes("alma");
byte[] data = System.Text.Encoding.ASCII.GetBytes("korte");

HMACMD5 hmac = new HMACMD5(key);            
byte[] hashb = hmac.ComputeHash(data);

The code throws and exception although it runs on mono.

Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object
  at System.Security.Cryptography.HMAC.Initialize () [0x00000] 
  at System.Security.Cryptography.HMAC.HashCore (System.Byte[] rgb, Int32 ib,
Int32 cb) [0x00000] 
  at System.Security.Cryptography.HashAlgorithm.ComputeHash (System.Byte[]
buffer, Int32 offset, Int32 count) [0x00000] 
  at System.Security.Cryptography.HashAlgorithm.ComputeHash (System.Byte[]
buffer) [0x00000] 
  at iPhoneHash.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication
app, MonoTouch.Foundation.NSDictionary options) [0x00000] 
  at (wrapper managed-to-native)
MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String
principalClassName, System.String delegateClassName) [0x00000] 
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args) [0x00000] 
  at iPhoneHash.Application.Main (System.String[] args) [0x00000] 

Other algorithms like HMACSHA1 are working.
Full project source is attached.

Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list