Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/main/java/com/tencentyun/TLSSigAPIv2.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,13 @@ public byte[] genUserBuf(String account, long dwAuthID, long dwExpTime,
int roomStrLength = RoomStr.length();
int offset = 0;
int bufLength = 1 + 2 + accountLength + 20 ;
if (roomStrLength > 0) {
bufLength = bufLength + 2 + roomStrLength;
}
byte[] userbuf = new byte[bufLength];

//cVer
if (roomStrLength > 0) {
bufLength = bufLength + 2 + roomStrLength;
userbuf[offset++] = 1;
} else {
userbuf[offset++] = 0;
Expand Down
6 changes: 6 additions & 0 deletions src/test/com/tencentyun/TLSSigAPITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ public void testGenSigWithUserBug() {
TLSSigAPIv2 api = new TLSSigAPIv2(1400000000, "5bd2850fff3ecb11d7c805251c51ee463a25727bddc2385f3fa8bfee1bb93b5e");
System.out.println(api.genPrivateMapKey("xiaojun", 180 * 86400, 10000, 255));
}
//使用userbuf和字符串房间号生产privatemapkey
@Test
public void testGenSigWithUserBug() {
TLSSigAPIv2 api = new TLSSigAPIv2(1400000000, "5bd2850fff3ecb11d7c805251c51ee463a25727bddc2385f3fa8bfee1bb93b5e");
System.out.println(api.genPrivateMapKeyWithStringRoomID("xiaojun", 180 * 86400, "100000000", 255));
}

/**
* Method: hmacsha256(String identifier, long currTime, long expire)
Expand Down
9 changes: 9 additions & 0 deletions tls-sig-api-v2-java.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/bin" />
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>