http://bugzilla.novell.com/show_bug.cgi?id=552177


           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: [email protected]
        ReportedBy: [email protected]
         QAContact: [email protected]
          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.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to