Sign in or 

| Developer Key | 1f7d14a2db95e2f1d150207ddef31e329e02941a |
| User ID | testuser |
| Current Time | 2008-05-02T12:00:00.000-08:00 |
| Secret | f2326ecc6ae62ad118a23829b3a979eeef3d3dc5 |
| cred.ts | 1209758400 |
| cred.sig | d2d6f6516bffe756557ca4cb77a0304d684f5fc8 |
wetpaint |
Latest page update: made by wetpaint
, May 13 2008, 4:50 PM EDT
(about this update
About This Update
Edited by wetpaint
view changes - complete history) |
|
Keyword tags:
None
More Info: links to this page
|
| Started By | Thread Subject | Replies | Last Post | ||
|---|---|---|---|---|---|
| cpatni | Test Data is matching | 3 | May 15 2008, 1:52 PM EDT by blake | ||
|
Thread started: May 14 2008, 11:11 PM EDT
Watch
I am getting df3490817aa209bb30bd27a8c0dd when I ran this test case.
@Test public void testSignatureHMac() throws DatatypeConfigurationException, NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException { String developerKey = "1f7d14a2db95e2f1d150207ddef31e329e02941a"; String userId = "testuser"; Date time = Wetpaint.xmlDate("2008-05-02T12:00:00.000-08:00"); String secret = "f2326ecc6ae62ad118a23829b3a979eeef3d3dc5"; int timestamp = 1209758400; Assert.assertEquals(time.getTime() /1000, 1209758400); String s = developerKey + userId + timestamp; SecretKeySpec sks = new SecretKeySpec(Strings.hex(secret), "HmacSHA1"); Mac mac = Mac.getInstance(sks.getAlgorithm()); mac.init(sks); String sig = Strings.hex(mac.doFinal(s.getBytes("UTF-8"))); Assert.assertEquals("d2d6f6516bffe756557ca4cb77a0304d684f5fc8", sig); } public static Date xmlDate(String text) throws DatatypeConfigurationException { XMLGregorianCalendar xgc = DatatypeFactory.newInstance().newXMLGregorianCalendar(text); return xgc.toGregorianCalendar().getTime(); }
Do you find this valuable?
Keyword tags:
XML:KEY:DATATYPE:
|
|||||