Skip to content

Commit

Permalink
修复 userbuf 接口问题
Browse files Browse the repository at this point in the history
  • Loading branch information
weijunyi committed Jun 19, 2019
1 parent 86f54c1 commit fcc4b3d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/main/java/com/tencentyun/TLSSigAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ private String genSig(String identifier, long expire, byte[] userbuf) {
String base64UserBuf = null;
if (null != userbuf) {
base64UserBuf = new BASE64Encoder().encode(userbuf);
sigDoc.put("TLS.userbuf", base64UserBuf);
}
String sig = hmacsha256(identifier, currTime, expire, base64UserBuf);
if (sig.length() == 0) {
Expand Down
7 changes: 3 additions & 4 deletions src/test/com/tencentyun/TLSSigAPITest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package test.com.tencentyun;
package com.tencentyun;

import com.tencentyun.TLSSigAPI;
import org.junit.Test;
import org.junit.Before;
import org.junit.After;
Expand Down Expand Up @@ -28,14 +27,14 @@ public void after() throws Exception {
*
*/
@Test
public void testGenSig() throws Exception {
public void testGenSig() {
TLSSigAPI api = new TLSSigAPI(1400000000, "5bd2850fff3ecb11d7c805251c51ee463a25727bddc2385f3fa8bfee1bb93b5e");
System.out.print(api.genSig("xiaojun", 180*86400));
}


@Test
public void testGenSigWithUserBug() throws Exception {
public void testGenSigWithUserBug() {
TLSSigAPI api = new TLSSigAPI(1400000000, "5bd2850fff3ecb11d7c805251c51ee463a25727bddc2385f3fa8bfee1bb93b5e");
System.out.println(api.genSigWithUserBuf("xiaojun", 180*86400, "abc".getBytes()));
}
Expand Down

0 comments on commit fcc4b3d

Please sign in to comment.