Commit 658eb93b authored by zengtianlai3's avatar zengtianlai3

鉴权,Linux服务器本地动态库加载

parent ca00070b
......@@ -38,8 +38,8 @@ public class DeviceManager {
@PostConstruct
public void init() {
// startTcpService();
// initDevices();
startTcpService();
initDevices();
}
private void startTcpService() {
......
......@@ -156,17 +156,11 @@ public class DeviceServerHandler extends SimpleChannelInboundHandler<Object> {
private boolean handlerLicense(SocketChannel channel, String remoteIp, int remotePort, DeviceProtocol protocol) {
// TODO 先统一放行,部署需要在公网服务器放置动态库
if (1 == 1) {
return true;
}
byte[] bytes = null;
//TODO 正式代码要放开
// byte[] bytes = safety.decodeExtendedPayload(protocol.getContent(), 0, protocol.getContent().length);
// if(bytes==null){
// return false;
// }
byte[] bytes = safety.decodeExtendedPayload(protocol.getContent(), 0, protocol.getContent().length);
if (bytes == null) {
return false;
}
String decodeInfo = new String(bytes, 0, bytes.length);
......
......@@ -4,9 +4,10 @@ import org.springframework.stereotype.Component;
@Component
public class Safety {
// static {
// System.loadLibrary("IdReaderSafetyLib");
// }
//
// public native byte[] decodeExtendedPayload(byte[] data, int offset, int length);
static {
// System.load("C:\\Program Files\\Java\\jdk1.8.0_231\\jre\\bin\\IdReaderSafetyLib.dll");//Windwos
System.load("/home/acc/server/license/file/libs/IdReaderSafetyLib.so");//Linux
}
public native byte[] decodeExtendedPayload(byte[] data, int offset, int length);
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment