Commit 0503cb2a by luozhenzhen

防作弊项目提交

parents
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
mongodb
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="mongodb" />
</profile>
</annotationProcessing>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
</component>
</project>
\ No newline at end of file
<component name="libraryTable">
<library name="reyunCrypto">
<CLASSES>
<root url="jar://$USER_HOME$/Desktop/reyunCrypto.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>springboot</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/java/com/mao2080/T.java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
## 在服务器上重新编译openssl
## 在服务器上重新编译openssl
参考[Linux系统下编译Openssl](https://www.jianshu.com/p/4328c3675389)
1. 把编译好的libcrypto.a替换加密库libs/下相同的文件
2. 将openssl生成目录下的include/openssl替换加密库的include/openssl
## 确保服务器的libstdc++.so.xx ;xx在24以上
没有可以在网上下载一个
\ No newline at end of file
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com</groupId>
<artifactId>mongodb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RELEASE</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Finchley.RC1</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.54</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>reyun</groupId>
<artifactId>crypto</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/reyunCrypto.jar</systemPath>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<resources>
<resource>
<directory>lib</directory>
<targetPath>BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:1.4.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:1.4.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:1.4.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:1.4.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:1.4.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.1.7" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.1.7" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.21" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.21" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.21" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:log4j-over-slf4j:1.7.21" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:4.3.2.RELEASE" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.17" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:1.4.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:8.5.4" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:8.5.4" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:8.5.4" level="project" />
<orderEntry type="library" name="Maven: org.hibernate:hibernate-validator:5.2.4.Final" level="project" />
<orderEntry type="library" name="Maven: javax.validation:validation-api:1.1.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.0.Final" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.8.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.8.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.8.1" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:4.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:4.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:4.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:4.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:4.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:4.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.10" level="project" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:1.4.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:1.4.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:1.4.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:1.4.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:1.4.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.1.7" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.1.7" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.21" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.21" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.21" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:log4j-over-slf4j:1.7.21" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:4.3.2.RELEASE" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.17" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:1.4.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:8.5.4" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:8.5.4" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:8.5.4" level="project" />
<orderEntry type="library" name="Maven: org.hibernate:hibernate-validator:5.2.4.Final" level="project" />
<orderEntry type="library" name="Maven: javax.validation:validation-api:1.1.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.0.Final" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.8.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.8.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.8.1" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:4.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:4.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:4.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:4.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:4.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:4.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:6.0.4" level="project" />
<orderEntry type="library" name="Maven: redis.clients:jedis:2.9.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.4.2" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.10" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.6" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.5" level="project" />
</component>
</module>
\ No newline at end of file
package com;
import com.reyun.Algorithm;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication(scanBasePackages = "com")
@EnableAutoConfiguration
public class Application {
public static void main(String[] args) throws Exception {
SpringApplication.run(Application.class, args);
}
}
package com.demo.common;
import com.demo.util.SecretUtil;
import com.reyun.Algorithm;
/**
* 用于特殊处理加密
*/
public class SpecialSecret {
public static final String dllPath = "/data/application/deviceCheck/crypto/libcrypto.so";
static {
System.load(dllPath);
// Algorithm.InitCrypto();
}
/**
*
* 解密数据
* @param secretData
* @param key
* @return
*/
public static String getData(String secretData, String key){
Algorithm alg = new Algorithm();
return alg.aes256Decode(secretData, key);
}
/**
* aes加密data
* @param data
* @param key
* @return
*/
public static String aesData(String data, String key){
Algorithm alg = new Algorithm();
return alg.aes256Encode(data, key);
}
/**
*
*
* 对于AES密钥的处理
* 6字节随机数+真实密钥+8字节随机数->反转
* 然后拿私钥钥进行RSA加密
* @param str
* @param privateKey
* @return
*/
public static String getSecretAesStr(String str, String privateKey) throws Exception{
Algorithm alg = new Algorithm();
String aesStr = SecretUtil.getRandNum(6) + str + SecretUtil.getRandNum(8);
str = reverseString(aesStr);
return alg.rsaPrivateEncode(str, privateKey);
}
/**
*
* 对于RSA 公钥的处理
*da
* 6字节随机数+真实密钥+8字节随机数->反转
* @param str
* @return
*/
public static String getSecretRSAStr(String str){
String rsaStr = SecretUtil.getRandNum(6) + str + SecretUtil.getRandNum(8);
return reverseString(rsaStr);
}
private static String reverseString(String str) {
StringBuffer buffer = new StringBuffer(str);
return buffer.reverse().toString();
}
// public static void main(String args[]) throws Exception{
//
//// System.out.println("开始测试-----------");
////// System.load("C:\\eclipseWorkSpace\\mongodb-demo\\lib\\crypto.dll");
////// DllAddUtil.addLibraryDir("C:\\eclipseWorkSpace\\mongodb-demo\\lib\\crypto.dll");
////
//// String dllPath = System.getProperty("user.dir") + "/lib/crypto.dll";
//// System.out.println(System.getProperty("user.dir"));
////
//// DllAddUtil.addLibraryDir("dllPath");
////// System.out.println(System.getProperty("java.library.path"));
////// System.loadLibrary("crypto");
//// System.load(dllPath);
//// Algorithm alg = new Algorithm();
//// String txt = "小红帽123";
//// String pubkey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCLtMtk2fLimNPRK5rG0jVBeX8kSO8CP8aMkeu7" +
//// "N94ieqQqhbBArhdA7b5/kd6durfY5dq7NWAPQAK8+/P3XE92qdkshcgX9bYqO9dvE1fSgtLZN1OK" +
//// "Pgm1quNZT5fqxOMQZwancRdqgt53aEjvjANtIoOCNV2QkPsl0a0icGmTXQIDAQAB";
//// String privateKey = "MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAIu0y2TZ8uKY09ErmsbSNUF5fyRI" +
//// "7wI/xoyR67s33iJ6pCqFsECuF0Dtvn+R3p26t9jl2rs1YA9AArz78/dcT3ap2SyFyBf1tio7128T" +
//// "V9KC0tk3U4o+CbWq41lPl+rE4xBnBqdxF2qC3ndoSO+MA20ig4I1XZCQ+yXRrSJwaZNdAgMBAAEC" +
//// "gYBJ2EGeSDnDHobvzD2elCQEPMVAl7CGHtHDIapZplkrHmpB87JLLfoqnsAPzDnAY56j7jMkuzzQ" +
//// "MsR/wimdeVSimfqlgpTe1KNIdOkZnppAbEijqhngJhUXFNJMmhUyHSaRd1AQ5aYZoIsIyndP13TM" +
//// "RQyX883sbKISIEX7qajxPQJBANZi58PWH9Xg5nrNi6zm0bDvmQe9QIQR03Mv4pWcPmzIcbNCWDeK" +
//// "Nlp9Wqr66jDc7YUkxfAjnDuLsE8g9OzpGBMCQQCm0vORg+BF1QFcLpdG7lilqFZbqjl/hLFzeCAp" +
//// "4L4GrMqSFhYs6h/pWg9FYpPvSY8grZo4qgX97t+QAvHAr/TPAkAPvA6alvqbLfh8ht17gS1euRcY" +
//// "NFGp380PJTKSHHeQcF239GSZHvHCTnT7G5NYpr5gCUTlzRdIX4Y/KIIRaUI1AkARFIwnm+78d2Ca" +
//// "RZLrij+9Rk0BOZ6FddqNTgFNCFusZ0ieSHCgzJ/Tzoq9uegXmdpzqBKgNphCdZCiOAr0hY91AkAt" +
//// "tN1h4g3LA1fhq0MvwgtNb9fVdSDoqCOSELQjKsqQach99kaMApo3uBLpCypAyi2X99i31SDEH/XO" +
//// "ytCzS3IG";
//// String str = alg.rsaPrivateEncode(txt,privateKey);
//// System.out.println("rsa加密后:"+str);
////
//// System.out.println("rsa解密后:"+alg.rsaPublicDecode(str,pubkey));
////
////
//// System.out.println("结束测试-----------");
////
//// System.out.println("开始测试SHA-----------");
//// String shaStr = alg.sha1(txt);
//// System.out.println("sha加密后:"+str);
////
//// System.out.println("结束测试SHA-----------");
//
//
//// System.out.println("开始测试aes-----------");
//// txt="123";
//// String aesKey = "5662e7c3d61fd5e0e67acd8bace6d1b0";
//// String aesStr = alg.aes256Encode(txt,aesKey);
//// System.out.println("aes加密后:"+aesStr);
//// String aesdecodeStr = alg.aes256Decode(aesStr,aesKey);
//// System.out.println("aes解密后:"+aesdecodeStr);
//
//// System.out.println("结束测试aes-----------");
//
// String data = "ajTGaaaaqJ1ymOOGL5UCvY0Q2CKsla==";
// String aesKey = "5662e7c3d61fd5e0e67acd8bace6d1b0ef9907bd408411d3732fe2959c3e6cc8";
// String result = SpecialSecret.aesData(data, aesKey);
// System.out.println("result is "+ result);
//
//
//
// }
}
package com.demo.constant;
public enum OSEnum {
IOS("ios"),
ANDROID("android");
OSEnum(String val) {
this.val = val;
}
/**
* 根据传入的os获取对应枚举
* @param os
* @return
*/
public static OSEnum getOS(String os){
os = os.toLowerCase();
for(OSEnum osEnum : OSEnum.values()) {
if(os.equals(osEnum.getVal())){
return osEnum;
}
}
return null;
}
private String val;
public String getVal() {
return val;
}
public void setVal(String val) {
this.val = val;
}
}
package com.demo.constant;
public enum ResultStatus {
SUCCESS(0,"success"),
FAIL(-200,"failed");
private int code;
private String desc;
ResultStatus() {
}
ResultStatus(int code, String desc) {
this.code = code;
this.desc = desc;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
package com.demo.dao;
import com.demo.entity.po.DeviceConf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Repository;
@Repository
public class DeviceConfDao {
@Autowired
private MongoTemplate mongoTemplate;
public DeviceConf findEnable(String os){
Query query = Query.query(Criteria.where("status").is(true).and("os").is(os));
DeviceConf deviceConf = mongoTemplate.findOne(query, DeviceConf.class);
return deviceConf;
}
}
package com.demo.dao;
import com.demo.entity.po.DeviceInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Repository;
@Repository
public class DeviceInfoDao {
@Autowired
private MongoTemplate mongoTemplate;
public void insert(DeviceInfo deviceInfo){
mongoTemplate.insert(deviceInfo);
}
}
package com.demo.dao;
import com.demo.entity.po.Secret;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Repository;
@Repository
public class SecretDao {
@Autowired
private MongoTemplate mongoTemplate;
public Secret findEnableSecret(String gorganization){
Query query = Query.query(Criteria.where("status").is(true).and("gorganization").is(gorganization));
Secret secret = mongoTemplate.findOne(query, Secret.class);
return secret;
}
public void insert(Secret secret){
mongoTemplate.insert(secret);
}
}
package com.demo.dao;
import com.demo.entity.po.SensorInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Repository;
@Repository
public class SensorInfoDao {
@Autowired
private MongoTemplate mongoTemplate;
public void insert(SensorInfo sensorInfoIos){
mongoTemplate.insert(sensorInfoIos);
}
}
//package com.demo.dao.bak;
//
//import com.demo.entity.po.DeviceConf;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.mongodb.core.MongoTemplate;
//import org.springframework.data.mongodb.core.query.Criteria;
//import org.springframework.data.mongodb.core.query.Query;
//import org.springframework.stereotype.Repository;
//
//
//@Repository
//public class DeviceConfDao {
// @Autowired
// private MongoTemplate mongoTemplate;
//
// public DeviceConf findEnable(){
// Query query = Query.query(Criteria.where("status").is(1));
// DeviceConf deviceConf = mongoTemplate.findOne(query, DeviceConf.class);
// return deviceConf;
// }
//
//}
package com.demo.dao.bak;
import com.demo.entity.po.bak.DeviceInfoAndroid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Repository;
@Repository
public class DeviceInfoAndroidDao {
@Autowired
private MongoTemplate mongoTemplate;
public void insert(DeviceInfoAndroid deviceInfoAndroid){
mongoTemplate.insert(deviceInfoAndroid);
}
}
package com.demo.dao.bak;
import com.demo.entity.po.bak.DeviceInfoIos;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Repository;
@Repository
public class DeviceInfoIosDao {
@Autowired
private MongoTemplate mongoTemplate;
public void insert(DeviceInfoIos deviceInfoIos){
mongoTemplate.insert(deviceInfoIos);
}
}
//package com.demo.dao.bak;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.mongodb.core.MongoTemplate;
//import org.springframework.data.mongodb.core.query.Criteria;
//import org.springframework.data.mongodb.core.query.Query;
//import org.springframework.stereotype.Repository;
//
//import java.util.List;
//
//@Repository
//public class RiskAppDao {
// @Autowired
// private MongoTemplate mongoTemplate;
//
// public List<RiskApp> findAll(String os){
// Query query = Query.query(Criteria.where("os").is(os));
// List<RiskApp> riskApps = mongoTemplate.find(query, RiskApp.class);
// return riskApps;
// }
//
//
//}
//package com.demo.dao.bak;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.mongodb.core.MongoTemplate;
//import org.springframework.data.mongodb.core.query.Criteria;
//import org.springframework.data.mongodb.core.query.Query;
//import org.springframework.stereotype.Repository;
//
//import java.util.List;
//
//@Repository
//public class RiskDirDao {
// @Autowired
// private MongoTemplate mongoTemplate;
//
// public List<RiskDir> findAll(String os){
// Query query = Query.query(Criteria.where("os").is(os));
// List<RiskDir> riskDirs = mongoTemplate.find(query, RiskDir.class);
// return riskDirs;
// }
//
//
//}
//package com.demo.dao.bak;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.mongodb.core.MongoTemplate;
//import org.springframework.data.mongodb.core.query.Criteria;
//import org.springframework.data.mongodb.core.query.Query;
//import org.springframework.stereotype.Repository;
//
//import java.util.List;
//
//@Repository
//public class RiskFileDao {
// @Autowired
// private MongoTemplate mongoTemplate;
//
// public List<RiskFile> findAll(String os){
// Query query = Query.query(Criteria.where("os").is(os));
// List<RiskFile> riskFiles = mongoTemplate.find(query, RiskFile.class);
// return riskFiles;
// }
//
//
//}
//package com.demo.dao.bak;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.mongodb.core.MongoTemplate;
//import org.springframework.stereotype.Repository;
//
//
//@Repository
//public class SensorInfoAndroidDao {
// @Autowired
// private MongoTemplate mongoTemplate;
//
// public void insert(SensorInfoAndroid sensorInfoAndroid){
// mongoTemplate.insert(sensorInfoAndroid);
// }
//
//
//}
//package com.demo.dao.bak;
//
//import com.demo.entity.po.SensorInfo;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.mongodb.core.MongoTemplate;
//import org.springframework.stereotype.Repository;
//
//
//@Repository
//public class SensorInfoIosDao {
// @Autowired
// private MongoTemplate mongoTemplate;
//
// public void insert(SensorInfo sensorInfoIos){
// mongoTemplate.insert(sensorInfoIos);
// }
//
//
//}
package com.demo.dao.bak;
import com.demo.entity.po.bak.UpdateInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Repository;
@Repository
public class UpdateInfoDao {
@Autowired
private MongoTemplate mongoTemplate;
public UpdateInfo findEnable(){
Query query = Query.query(Criteria.where("status").is(true));
UpdateInfo updateInfo = mongoTemplate.findOne(query, UpdateInfo.class);
return updateInfo;
}
}
package com.demo.entity;
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.Date;
@Document(collection="user")
public class User {
private String userId;
private String name;
private String uclass;
private String email;
private Date birthday;
private int age;
private int dataStatus;
public User() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUclass() {
return uclass;
}
public void setUclass(String uclass) {
this.uclass = uclass;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public int getDataStatus() {
return dataStatus;
}
public void setDataStatus(int dataStatus) {
this.dataStatus = dataStatus;
}
}
//package com.demo.entity.dto;
//
//import com.demo.entity.po.bak.UpdateInfo;
//
//import java.util.List;
//
///**
// * DevieceConfDto中 data传输值的具体内容
// */
//public class DeviceConfDataDto {
//
// private List<RiskApp> risk_apps;//有风险的app集合
// private List<RiskDir> risk_dirs;
// private Boolean risk_file_switch;
// private List<RiskFile> risk_files;
// private UpdateInfo update;
// private List<String> white_apps;
// private Integer period; //动态和传感器信息的上报周期(单位:秒)
//
//
// public DeviceConfDataDto() {
// }
//
// public DeviceConfDataDto(List<RiskApp> risk_apps, List<RiskDir> risk_dirs, Boolean risk_file_switch, List<RiskFile> risk_files,
// UpdateInfo update, List<String> white_apps, Integer period) {
// this.risk_apps = risk_apps;
// this.risk_dirs = risk_dirs;
// this.risk_file_switch = risk_file_switch;
// this.risk_files = risk_files;
// this.update = update;
// this.white_apps = white_apps;
// this.period = period;
// }
//
// public List<RiskApp> getRisk_apps() {
// return risk_apps;
// }
//
// public void setRisk_apps(List<RiskApp> risk_apps) {
// this.risk_apps = risk_apps;
// }
//
// public List<RiskDir> getRisk_dirs() {
// return risk_dirs;
// }
//
// public void setRisk_dirs(List<RiskDir> risk_dirs) {
// this.risk_dirs = risk_dirs;
// }
//
// public Boolean getRisk_file_switch() {
// return risk_file_switch;
// }
//
// public void setRisk_file_switch(Boolean risk_file_switch) {
// this.risk_file_switch = risk_file_switch;
// }
//
// public List<RiskFile> getRisk_files() {
// return risk_files;
// }
//
// public void setRisk_files(List<RiskFile> risk_files) {
// this.risk_files = risk_files;
// }
//
// public UpdateInfo getUpdate() {
// return update;
// }
//
// public void setUpdate(UpdateInfo update) {
// this.update = update;
// }
//
// public List<String> getWhite_apps() {
// return white_apps;
// }
//
// public void setWhite_apps(List<String> white_apps) {
// this.white_apps = white_apps;
// }
//
// public Integer getPeriod() {
// return period;
// }
//
// public void setPeriod(Integer period) {
// this.period = period;
// }
//}
package com.demo.entity.dto;
public class DeviceReturnDto {
private String data;
private int datelen;
private String akey; //RSA加密的AES密钥
private String pkey; //RSA公钥
public DeviceReturnDto() {
}
public DeviceReturnDto(String data, int datelen, String akey, String pkey) {
this.data = data;
this.datelen = datelen;
this.akey = akey;
this.pkey = pkey;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public int getDatelen() {
return datelen;
}
public void setDatelen(int datelen) {
this.datelen = datelen;
}
public String getAkey() {
return akey;
}
public void setAkey(String akey) {
this.akey = akey;
}
public String getPkey() {
return pkey;
}
public void setPkey(String pkey) {
this.pkey = pkey;
}
}
package com.demo.entity.dto;
/**
* 用于传感器ios参数接收
*/
public class SoftDto {
private String name;
private String pn;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPn() {
return pn;
}
public void setPn(String pn) {
this.pn = pn;
}
}
package com.demo.entity.po;
import org.springframework.data.mongodb.core.mapping.Document;
/**
* 设备的配置表
*/
@Document(collection = "DeviceConf")
public class DeviceConf {
private String confInfo;
private Boolean status;
private String os;
public DeviceConf() {
}
public DeviceConf(String confInfo, Boolean status, String os) {
this.confInfo = confInfo;
this.status = status;
this.os = os;
}
public String getConfInfo() {
return confInfo;
}
public void setConfInfo(String confInfo) {
this.confInfo = confInfo;
}
public Boolean getStatus() {
return status;
}
public void setStatus(Boolean status) {
this.status = status;
}
public String getOs() {
return os;
}
public void setOs(String os) {
this.os = os;
}
}
package com.demo.entity.po;
import org.springframework.data.mongodb.core.mapping.Document;
@Document(collection = "DeviceInfo")
public class DeviceInfo {
private String os;
private String info;
private String reyunId;
public DeviceInfo() {
}
public DeviceInfo(String os, String info, String reyunId) {
this.os = os;
this.info = info;
this.reyunId = reyunId;
}
public String getOs() {
return os;
}
public void setOs(String os) {
this.os = os;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public String getReyunId() {
return reyunId;
}
public void setReyunId(String reyunId) {
this.reyunId = reyunId;
}
}
package com.demo.entity.po;
import com.demo.entity.vo.common.BaseParam;
import org.springframework.data.mongodb.core.mapping.Document;
/**
* 用于记录上报的异常
*/
@Document(collection = "ExceptionRecord")
public class ExceptionRecord extends BaseParam {
private Integer errorcode;
private String errormsg;
public Integer getErrorcode() {
return errorcode;
}
public void setErrorcode(Integer errorcode) {
this.errorcode = errorcode;
}
public String getErrormsg() {
return errormsg;
}
public void setErrormsg(String errormsg) {
this.errormsg = errormsg;
}
}
package com.demo.entity.po;
import org.springframework.data.mongodb.core.mapping.Document;
@Document(collection="Secret")
public class Secret {
private String gorganization;
private String publicRsaKey;
private String privateRsaKey;
private String aesKey;
private long timestamp;
private Boolean status;//0不可用 1可用
public Secret() {
}
public Secret(String gorganization, String publicRsaKey, String privateRsaKey, String aesKey, long timestamp, Boolean status) {
this.gorganization = gorganization;
this.publicRsaKey = publicRsaKey;
this.privateRsaKey = privateRsaKey;
this.aesKey = aesKey;
this.timestamp = timestamp;
this.status = status;
}
public String getGorganization() {
return gorganization;
}
public void setGorganization(String gorganization) {
this.gorganization = gorganization;
}
public String getPublicRsaKey() {
return publicRsaKey;
}
public void setPublicRsaKey(String publicRsaKey) {
this.publicRsaKey = publicRsaKey;
}
public String getPrivateRsaKey() {
return privateRsaKey;
}
public void setPrivateRsaKey(String privateRsaKey) {
this.privateRsaKey = privateRsaKey;
}
public String getAesKey() {
return aesKey;
}
public void setAesKey(String aesKey) {
this.aesKey = aesKey;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
public Boolean getStatus() {
return status;
}
public void setStatus(Boolean status) {
this.status = status;
}
}
package com.demo.entity.po;
import org.springframework.data.mongodb.core.mapping.Document;
/**
* 传感器信息
*/
@Document(collection="SensorInfo")
public class SensorInfo {
private String reyunId;
private Long timestamp;
private String sensorInfo;
private String os;
public SensorInfo() {
}
public SensorInfo(String reyunId, Long timestamp, String sensorInfo, String os) {
this.reyunId = reyunId;
this.timestamp = timestamp;
this.sensorInfo = sensorInfo;
this.os = os;
}
public String getReyunId() {
return reyunId;
}
public void setReyunId(String reyunId) {
this.reyunId = reyunId;
}
public Long getTimestamp() {
return timestamp;
}
public void setTimestamp(Long timestamp) {
this.timestamp = timestamp;
}
public String getSensorInfo() {
return sensorInfo;
}
public void setSensorInfo(String sensorInfo) {
this.sensorInfo = sensorInfo;
}
public String getOs() {
return os;
}
public void setOs(String os) {
this.os = os;
}
}
package com.demo.entity.po.bak;
import org.springframework.data.mongodb.core.mapping.Document;
/**
* 设备的配置表
*/
@Document(collection = "DeviceConf")
public class DeviceConf {
private Boolean risk_file_switch;
private String white_apps;
private int period; //动态和传感器信息的上报周期(单位:秒)
private Boolean status;
private String os;
public Boolean getRisk_file_switch() {
return risk_file_switch;
}
public void setRisk_file_switch(Boolean risk_file_switch) {
this.risk_file_switch = risk_file_switch;
}
public String getWhite_apps() {
return white_apps;
}
public void setWhite_apps(String white_apps) {
this.white_apps = white_apps;
}
public int getPeriod() {
return period;
}
public void setPeriod(int period) {
this.period = period;
}
public Boolean getStatus() {
return status;
}
public void setStatus(Boolean status) {
this.status = status;
}
public String getOs() {
return os;
}
public void setOs(String os) {
this.os = os;
}
}
package com.demo.entity.po.bak;
import org.springframework.data.mongodb.core.mapping.Document;
@Document(collection = "DeviceInfoIos")
public class DeviceInfoIos {
private String platform;
private String reyunId;
private String idfa;
private String idfv;
private String model;//设备型号
private String networkType;//网络类型
private String phoneName;
private String osName;//当前系统名称
private String localizedModel;
private String osVer;//当前系统版本号
private String dmodel;//device_model字段
private String lastRestartDate;//设备重启时间
private String uuid;
private String cpuCoreNum;//CPU核数
private String cpuModel;//CPU型号
private String languages;//语言环境
private String screenResolution;//屏幕分辨率
private String isp;//运营商编号
private String ispName;//运营商编号
private String cpuName;//CPU名称
private String allBusFrequency;
private String batteryCapacityValue;//电池总电量
private String batteryLevel;
private String batteryVoltage;
private String canMakePhoneCall;
private String iPhoneCellIP;
private String initialFirmware;
public String getPlatform() {
return platform;
}
public void setPlatform(String platform) {
this.platform = platform;
}
public String getReyunId() {
return reyunId;
}
public void setReyunId(String reyunId) {
this.reyunId = reyunId;
}
public String getIdfa() {
return idfa;
}
public void setIdfa(String idfa) {
this.idfa = idfa;
}
public String getIdfv() {
return idfv;
}
public void setIdfv(String idfv) {
this.idfv = idfv;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getNetworkType() {
return networkType;
}
public void setNetworkType(String networkType) {
this.networkType = networkType;
}
public String getPhoneName() {
return phoneName;
}
public void setPhoneName(String phoneName) {
this.phoneName = phoneName;
}
public String getOsName() {
return osName;
}
public void setOsName(String osName) {
this.osName = osName;
}
public String getLocalizedModel() {
return localizedModel;
}
public void setLocalizedModel(String localizedModel) {
this.localizedModel = localizedModel;
}
public String getOsVer() {
return osVer;
}
public void setOsVer(String osVer) {
this.osVer = osVer;
}
public String getDmodel() {
return dmodel;
}
public void setDmodel(String dmodel) {
this.dmodel = dmodel;
}
public String getLastRestartDate() {
return lastRestartDate;
}
public void setLastRestartDate(String lastRestartDate) {
this.lastRestartDate = lastRestartDate;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getCpuCoreNum() {
return cpuCoreNum;
}
public void setCpuCoreNum(String cpuCoreNum) {
this.cpuCoreNum = cpuCoreNum;
}
public String getCpuModel() {
return cpuModel;
}
public void setCpuModel(String cpuModel) {
this.cpuModel = cpuModel;
}
public String getLanguages() {
return languages;
}
public void setLanguages(String languages) {
this.languages = languages;
}
public String getScreenResolution() {
return screenResolution;
}
public void setScreenResolution(String screenResolution) {
this.screenResolution = screenResolution;
}
public String getIsp() {
return isp;
}
public void setIsp(String isp) {
this.isp = isp;
}
public String getIspName() {
return ispName;
}
public void setIspName(String ispName) {
this.ispName = ispName;
}
public String getCpuName() {
return cpuName;
}
public void setCpuName(String cpuName) {
this.cpuName = cpuName;
}
public String getAllBusFrequency() {
return allBusFrequency;
}
public void setAllBusFrequency(String allBusFrequency) {
this.allBusFrequency = allBusFrequency;
}
public String getBatteryCapacityValue() {
return batteryCapacityValue;
}
public void setBatteryCapacityValue(String batteryCapacityValue) {
this.batteryCapacityValue = batteryCapacityValue;
}
public String getBatteryLevel() {
return batteryLevel;
}
public void setBatteryLevel(String batteryLevel) {
this.batteryLevel = batteryLevel;
}
public String getBatteryVoltage() {
return batteryVoltage;
}
public void setBatteryVoltage(String batteryVoltage) {
this.batteryVoltage = batteryVoltage;
}
public String getCanMakePhoneCall() {
return canMakePhoneCall;
}
public void setCanMakePhoneCall(String canMakePhoneCall) {
this.canMakePhoneCall = canMakePhoneCall;
}
public String getiPhoneCellIP() {
return iPhoneCellIP;
}
public void setiPhoneCellIP(String iPhoneCellIP) {
this.iPhoneCellIP = iPhoneCellIP;
}
public String getInitialFirmware() {
return initialFirmware;
}
public void setInitialFirmware(String initialFirmware) {
this.initialFirmware = initialFirmware;
}
}
package com.demo.entity.po.bak;
import org.springframework.data.mongodb.core.mapping.Document;
/**
* 有风险的app
*/
@Document(collection="RiskApp")
public class RiskApp {
private String name;
private String pn;
private String uri;
private String os;
public RiskApp() {
}
public RiskApp(String name, String pn, String uri, String os) {
this.name = name;
this.pn = pn;
this.uri = uri;
this.os = os;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPn() {
return pn;
}
public void setPn(String pn) {
this.pn = pn;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getOs() {
return os;
}
public void setOs(String os) {
this.os = os;
}
}
package com.demo.entity.po.bak;
import org.springframework.data.mongodb.core.mapping.Document;
/**
* 有风险的文件夹
*/
@Document(collection="RiskDir")
public class RiskDir {
private String name;
private String dir;
private String type;
private String os;
public RiskDir() {
}
public RiskDir(String name, String dir, String type, String os) {
this.name = name;
this.dir = dir;
this.type = type;
this.os = os;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDir() {
return dir;
}
public void setDir(String dir) {
this.dir = dir;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getOs() {
return os;
}
public void setOs(String os) {
this.os = os;
}
}
package com.demo.entity.po.bak;
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.List;
/**
* 有风险的文件
*/
@Document(collection="RiskFile")
public class RiskFile {
private String key;
private String type;
private String path;
private String option;
private List<String> words;
private String os;
public RiskFile() {
}
public RiskFile(String key, String type, String path, String option, List<String> words, String os) {
this.key = key;
this.type = type;
this.path = path;
this.option = option;
this.words = words;
this.os = os;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getOption() {
return option;
}
public void setOption(String option) {
this.option = option;
}
public List<String> getWords() {
return words;
}
public void setWords(List<String> words) {
this.words = words;
}
public String getOs() {
return os;
}
public void setOs(String os) {
this.os = os;
}
}
//package com.demo.entity.po.bak;
//
//import com.demo.entity.dto.DeviceConfDataDto;
//import com.demo.entity.dto.SoftDto;
//import org.springframework.data.mongodb.core.mapping.Document;
//
//import java.util.List;
//
///**
// * 传感器信息
// */
//@Document(collection="SensorInfo")
//public class SensorInfoAndroid {
//
// private String reyunId;
// private String wifiSsid;//WIFI名字
// private String wifiBssid; //WIFI地址
// private String intranetIp;//内网IP
// private String ip;//公网IP
// private String systemBootTime;//系统启动时间
// private String diskTotalSize;//磁盘总空间
// private String diskFreeSize;//磁盘剩余空间
// private String memoryTotalSize;//总内存大小
// private String memoryFreeSize;//内存剩余大小
// private Boolean isRoot;//是否root
// private Boolean isVpn;//是否开了VPN
// private Boolean isProxy;//是否开了代理
// private Boolean isUSBDebug;//是否开启了USB调试
// private String batteryStatus;///电池状态
// private String batteryPower;//电池电量
// private Boolean isCharging;//是否充电中
// private Boolean isHelper;//是否开启辅助功能
// private List<String> sensor;//传感器
// private DeviceConfDataDto risk;
// private List<SoftDto> softlist;
//
// public String getReyunId() {
// return reyunId;
// }
//
// public void setReyunId(String reyunId) {
// this.reyunId = reyunId;
// }
//
// public String getWifiSsid() {
// return wifiSsid;
// }
//
// public void setWifiSsid(String wifiSsid) {
// this.wifiSsid = wifiSsid;
// }
//
// public String getWifiBssid() {
// return wifiBssid;
// }
//
// public void setWifiBssid(String wifiBssid) {
// this.wifiBssid = wifiBssid;
// }
//
// public String getIntranetIp() {
// return intranetIp;
// }
//
// public void setIntranetIp(String intranetIp) {
// this.intranetIp = intranetIp;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public String getSystemBootTime() {
// return systemBootTime;
// }
//
// public void setSystemBootTime(String systemBootTime) {
// this.systemBootTime = systemBootTime;
// }
//
// public String getDiskTotalSize() {
// return diskTotalSize;
// }
//
// public void setDiskTotalSize(String diskTotalSize) {
// this.diskTotalSize = diskTotalSize;
// }
//
// public String getDiskFreeSize() {
// return diskFreeSize;
// }
//
// public void setDiskFreeSize(String diskFreeSize) {
// this.diskFreeSize = diskFreeSize;
// }
//
// public String getMemoryTotalSize() {
// return memoryTotalSize;
// }
//
// public void setMemoryTotalSize(String memoryTotalSize) {
// this.memoryTotalSize = memoryTotalSize;
// }
//
// public String getMemoryFreeSize() {
// return memoryFreeSize;
// }
//
// public void setMemoryFreeSize(String memoryFreeSize) {
// this.memoryFreeSize = memoryFreeSize;
// }
//
// public Boolean getRoot() {
// return isRoot;
// }
//
// public void setRoot(Boolean root) {
// isRoot = root;
// }
//
// public Boolean getVpn() {
// return isVpn;
// }
//
// public void setVpn(Boolean vpn) {
// isVpn = vpn;
// }
//
// public Boolean getProxy() {
// return isProxy;
// }
//
// public void setProxy(Boolean proxy) {
// isProxy = proxy;
// }
//
// public Boolean getUSBDebug() {
// return isUSBDebug;
// }
//
// public void setUSBDebug(Boolean USBDebug) {
// isUSBDebug = USBDebug;
// }
//
// public String getBatteryStatus() {
// return batteryStatus;
// }
//
// public void setBatteryStatus(String batteryStatus) {
// this.batteryStatus = batteryStatus;
// }
//
// public String getBatteryPower() {
// return batteryPower;
// }
//
// public void setBatteryPower(String batteryPower) {
// this.batteryPower = batteryPower;
// }
//
// public Boolean getCharging() {
// return isCharging;
// }
//
// public void setCharging(Boolean charging) {
// isCharging = charging;
// }
//
// public Boolean getHelper() {
// return isHelper;
// }
//
// public void setHelper(Boolean helper) {
// isHelper = helper;
// }
//
// public List<String> getSensor() {
// return sensor;
// }
//
// public void setSensor(List<String> sensor) {
// this.sensor = sensor;
// }
//
// public DeviceConfDataDto getRisk() {
// return risk;
// }
//
// public void setRisk(DeviceConfDataDto risk) {
// this.risk = risk;
// }
//
// public List<SoftDto> getSoftlist() {
// return softlist;
// }
//
// public void setSoftlist(List<SoftDto> softlist) {
// this.softlist = softlist;
// }
//}
//package com.demo.entity.po.bak;
//
//import com.demo.entity.dto.DeviceConfDataDto;
//import com.demo.entity.dto.SoftDto;
//import org.springframework.data.mongodb.core.mapping.Document;
//
//import java.util.List;
//
///**
// * 传感器信息
// */
//@Document(collection="SensorInfo")
//public class SensorInfoIos {
//
// private String reyunId;
// private String batteryPower;//电池电量
// private String batteryStatus;//电池状态
// private String intranetIp;//内网IP
// private String ip;//公网IP
// private String wifiBssid;//wifi标识
// private String diskTotalSize;//磁盘总空间
// private String diskFreeSize;//磁盘剩余空间
// private String memoryTotalSize;//总内存大小
// private String memoryFreeSize;//内存剩余大小
// private Boolean isRoot;//是否root
// private Boolean isVpn;//是否开了VPN
// private Boolean isProxy;//是否开了代理
// private String cpuUsage;//cpu负载
// private String activeMemoryValue;//已使用内存
// private String currentCountry;//国家
// private String gatewayAddress; //网关地址
// private String localDeviceIP;//内网IP
// private String networkIP; //外网IP
// private String perCPUUsage;//各个cpu负载
// private String purgableMemoryValue;
// private String latestFirmware;
// private String latestSystemUptime;
// private DeviceConfDataDto risk;
// private List<SoftDto> softlist;
//
//
// public String getReyunId() {
// return reyunId;
// }
//
// public void setReyunId(String reyunId) {
// this.reyunId = reyunId;
// }
//
// public String getBatteryPower() {
// return batteryPower;
// }
//
// public void setBatteryPower(String batteryPower) {
// this.batteryPower = batteryPower;
// }
//
// public String getBatteryStatus() {
// return batteryStatus;
// }
//
// public void setBatteryStatus(String batteryStatus) {
// this.batteryStatus = batteryStatus;
// }
//
// public String getIntranetIp() {
// return intranetIp;
// }
//
// public void setIntranetIp(String intranetIp) {
// this.intranetIp = intranetIp;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public String getWifiBssid() {
// return wifiBssid;
// }
//
// public void setWifiBssid(String wifiBssid) {
// this.wifiBssid = wifiBssid;
// }
//
// public String getDiskTotalSize() {
// return diskTotalSize;
// }
//
// public void setDiskTotalSize(String diskTotalSize) {
// this.diskTotalSize = diskTotalSize;
// }
//
// public String getDiskFreeSize() {
// return diskFreeSize;
// }
//
// public void setDiskFreeSize(String diskFreeSize) {
// this.diskFreeSize = diskFreeSize;
// }
//
// public String getMemoryTotalSize() {
// return memoryTotalSize;
// }
//
// public void setMemoryTotalSize(String memoryTotalSize) {
// this.memoryTotalSize = memoryTotalSize;
// }
//
// public String getMemoryFreeSize() {
// return memoryFreeSize;
// }
//
// public void setMemoryFreeSize(String memoryFreeSize) {
// this.memoryFreeSize = memoryFreeSize;
// }
//
// public Boolean getRoot() {
// return isRoot;
// }
//
// public void setRoot(Boolean root) {
// isRoot = root;
// }
//
// public Boolean getVpn() {
// return isVpn;
// }
//
// public void setVpn(Boolean vpn) {
// isVpn = vpn;
// }
//
// public Boolean getProxy() {
// return isProxy;
// }
//
// public void setProxy(Boolean proxy) {
// isProxy = proxy;
// }
//
// public String getCpuUsage() {
// return cpuUsage;
// }
//
// public void setCpuUsage(String cpuUsage) {
// this.cpuUsage = cpuUsage;
// }
//
// public String getActiveMemoryValue() {
// return activeMemoryValue;
// }
//
// public void setActiveMemoryValue(String activeMemoryValue) {
// this.activeMemoryValue = activeMemoryValue;
// }
//
// public String getCurrentCountry() {
// return currentCountry;
// }
//
// public void setCurrentCountry(String currentCountry) {
// this.currentCountry = currentCountry;
// }
//
// public String getGatewayAddress() {
// return gatewayAddress;
// }
//
// public void setGatewayAddress(String gatewayAddress) {
// this.gatewayAddress = gatewayAddress;
// }
//
// public String getLocalDeviceIP() {
// return localDeviceIP;
// }
//
// public void setLocalDeviceIP(String localDeviceIP) {
// this.localDeviceIP = localDeviceIP;
// }
//
// public String getNetworkIP() {
// return networkIP;
// }
//
// public void setNetworkIP(String networkIP) {
// this.networkIP = networkIP;
// }
//
// public String getPerCPUUsage() {
// return perCPUUsage;
// }
//
// public void setPerCPUUsage(String perCPUUsage) {
// this.perCPUUsage = perCPUUsage;
// }
//
// public String getPurgableMemoryValue() {
// return purgableMemoryValue;
// }
//
// public void setPurgableMemoryValue(String purgableMemoryValue) {
// this.purgableMemoryValue = purgableMemoryValue;
// }
//
// public String getLatestFirmware() {
// return latestFirmware;
// }
//
// public void setLatestFirmware(String latestFirmware) {
// this.latestFirmware = latestFirmware;
// }
//
// public String getLatestSystemUptime() {
// return latestSystemUptime;
// }
//
// public void setLatestSystemUptime(String latestSystemUptime) {
// this.latestSystemUptime = latestSystemUptime;
// }
//
// public DeviceConfDataDto getRisk() {
// return risk;
// }
//
// public void setRisk(DeviceConfDataDto risk) {
// this.risk = risk;
// }
//
// public List<SoftDto> getSoftlist() {
// return softlist;
// }
//
// public void setSoftlist(List<SoftDto> softlist) {
// this.softlist = softlist;
// }
//}
package com.demo.entity.po.bak;
import org.springframework.data.mongodb.core.mapping.Document;
/**
* 热更新部分
*/
@Document(collection="UpdateInfo")
public class UpdateInfo {
private Boolean isupdate;
private String jarurl; //jar下载地址
private String key; //解密jar包的key
private Boolean status;//0不可用 1可用
public Boolean getIsupdate() {
return isupdate;
}
public void setIsupdate(Boolean isupdate) {
this.isupdate = isupdate;
}
public String getJarurl() {
return jarurl;
}
public void setJarurl(String jarurl) {
this.jarurl = jarurl;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
}
package com.demo.entity.vo;
import com.demo.entity.vo.common.BaseParam;
/**
* 用于作为接口deviceconf的入参
*/
public class DeviceConfVo extends BaseParam {
}
package com.demo.entity.vo;
import com.demo.entity.vo.common.BaseParam;
/**
* 用于作为接口deviceid的入参
*/
public class DeviceIdVo extends BaseParam {
private String data; //base64加密数据
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
}
package com.demo.entity.vo;
import com.demo.entity.vo.common.BaseParam;
/**
* 用于作为接口dsensor的入参
*/
public class SensorVo extends BaseParam {
private String data; //base64加密数据
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
}
package com.demo.entity.vo.common;
public class BaseParam {
private String apppn; //app对应的包名
private String os; //ios还是android
private String sdkver; //sdk版本
private String gorganization; //公司名称
public String getApppn() {
return apppn;
}
public void setApppn(String apppn) {
this.apppn = apppn;
}
public String getOs() {
return os;
}
public void setOs(String os) {
this.os = os;
}
public String getSdkver() {
return sdkver;
}
public void setSdkver(String sdkver) {
this.sdkver = sdkver;
}
public String getGorganization() {
return gorganization;
}
public void setGorganization(String gorganization) {
gorganization = gorganization.toLowerCase();
this.gorganization = gorganization;
}
}
package com.demo.mongodb;
import com.alibaba.fastjson.JSONObject;
import com.demo.common.SpecialSecret;
import com.demo.constant.ResultStatus;
import com.demo.entity.dto.DeviceReturnDto;
import com.demo.entity.po.ExceptionRecord;
import com.demo.entity.vo.DeviceConfVo;
import com.demo.entity.vo.DeviceIdVo;
import com.demo.entity.vo.SensorVo;
import com.demo.service.DeviceService;
import com.demo.util.DeformedBase64;
import com.demo.util.ResultObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/")
public class DevicecheatController {
@Autowired
private MongoTemplate mongoTemplate;
@Autowired
private DeviceService deviceService;
/**
*该接口主要负责在SDK所在的APP启动时,由服务器想SDK下发配置信息,
* 包括风险软件列表、热更新、白名单等信息。
*
* @return
* @throws Exception
*/
@RequestMapping(value = "/deviceconf", method = RequestMethod.GET)
@ResponseBody
public ResultObject deviceconf(@ModelAttribute DeviceConfVo deviceConf) throws Exception {
String result = deviceService.getDeviceConf(deviceConf);
if(result == null){
return new ResultObject(ResultStatus.FAIL);
}
return new ResultObject(result);
}
/**
* 该接口主要负责在SDK所在的APP启动时,采集设备的硬件信息,
* 同时由服务器生成唯一ID并返回。
* @return
* @throws Exception
*/
@RequestMapping(value = "/deviceid",method = RequestMethod.POST)
@ResponseBody
public ResultObject deviceid(@RequestBody DeviceIdVo deviceIdVo) throws Exception {
String result = deviceService.getDeviceId(deviceIdVo);
if(result == null){
return new ResultObject(ResultStatus.FAIL);
}
return new ResultObject(result);
}
/**
* 传感器信息上报接口
* 该接口主要负责在APP运行期间,定时的上报设备传感器或者状态信息
* @return
* @throws Exception
*/
@RequestMapping(value = "/sensor", method = RequestMethod.POST)
@ResponseBody
public ResultObject sensor(@RequestBody SensorVo sensorVo) throws Exception {
boolean result = deviceService.reciveSensorInfo(sensorVo);
if(!result){
return new ResultObject(ResultStatus.FAIL);
}
return new ResultObject();
}
/**
* 异常日志上报接口
*
* 该接口主要功能是接收异常日志,帮助SDK开发者定位异常代码
* @return
* @throws Exception
*/
@RequestMapping(value = "/exception", method = RequestMethod.POST)
@ResponseBody
public ResultObject exception(@RequestBody ExceptionRecord exceptionRecord) throws Exception {
this.mongoTemplate.insert(exceptionRecord);
return new ResultObject(ResultStatus.SUCCESS);
}
}
package com.demo.mongodb;
import com.demo.common.SpecialSecret;
import com.demo.entity.vo.DeviceIdVo;
import com.demo.util.ResultObject;
import com.reyun.Algorithm;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/index")
public class IndexController {
@RequestMapping(value = "/testSo", method = RequestMethod.GET)
@ResponseBody
public ResultObject testSo(DeviceIdVo deviceIdVo) throws Exception{
// deviceIdVo = new DeviceIdVo();
// deviceIdVo.setData("ajT2aaaaGClM8q2TCEQVu192GxAjba==");
// Algorithm algorithm = new Algorithm();
// System.out.println("----------------3");
//
// //解密data
// String data = algorithm.aes256Decode(deviceIdVo.getData(), "53c3870eaeddbffda14267877b0ebdce");
// System.out.println("----------------4");
String key = "53c3870eaeddbffda14267877b0ebdce";
// String privateKey = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBALoHyZIIH7CW3R9+DYxC56yEHUr+c5TBuuXc+sTQfDDUXPJHnIh3lGNDYRL92wiSupQLprXApKIsobZYmnVuTozS5lW3n0ZqTzAySUOlskco/ccdCd0DwNJp7bRePs7E1OiIHG7dUjb/i833AR79WrGWspaJRSfdfxhuQiZPZuqbAgMBAAECgYEAlPkbgGglCIMnvMpzCvmhEVQTKTUvVdb2VpFp+CaE7Y2CiTqzrc0k9YDFwjGsL+dgpqHV9QK6VGyta5r0xkl5eIpu2a22MH85DHWWPnshZbv9HHvVQrX1PJKJyDupSr+N0xZxi555Md6KOGbj1f8+4lOvy2a4ZAFJiZbkOobZFcECQQDm8YIuCaujE9U1y/4Csf8ip+uQQYwY7Fho/A9Bs/a4DZljWrl5cb6yXbGD2Q9tU28d0Pz254QrmqvPCNXir0qxAkEAzjbQQbvvD5KhtlKeoapHyKpSBNPztwSAXZKj05Jkk7eKcATd3dbFZHxx7JC5w/aq0RAKpdlWp86dsPDwc81FCwJAIzXfKzW+PXbgovsfFzocNCR1/eCAg6xFLnx/tvzBOP6ZzFQgwytcb8VpMzj86SY3YsxiRSK3PA6w8zfdpFolgQJAFnqTKRc7cA8j4aQP9r+BI7atSilwn7q1431grmd+3ztas+tT5CLNUa7fHFKKbXouFKwS/RE8CP7U4bzh+T2fEQJBANFOhqryYmyp/XrXMhpGV53kzGhEtaYzzPuj/PFe0fVF2riRJX1khbtt3pmz9q0oqT/6P6KE2F9VCQQO13VV80Q=";
//
// String data = SpecialSecret.getSecretAesStr(key, privateKey);
String data = "{\"result\":123}";
data = SpecialSecret.aesData(data,key);
return new ResultObject(data);
}
}
//package com.demo.mongodb;
//
//import com.demo.entity.User;
//import com.demo.util.ResultObject;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.mongodb.core.MongoTemplate;
//import org.springframework.data.mongodb.core.query.Criteria;
//import org.springframework.data.mongodb.core.query.Query;
//import org.springframework.data.mongodb.core.query.Update;
//import org.springframework.web.bind.annotation.*;
//
//import javax.servlet.http.HttpServletResponse;
//import java.util.List;
//
//@RestController
//@RequestMapping("/mongodbController")
//public class MongodbController {
//
// @Autowired
// private MongoTemplate mongoTemplate;
//
// /**表名*/
// private static final String collectionName = "user";
//
// /**
// * 描述:新增
// * @author maochengyuan
// * @created 2018/9/1 20:17
// * @param user
// * @return ResultObject
// */
// @RequestMapping(value = "/insert", method = RequestMethod.POST)
// @ResponseBody
// public ResultObject insert(@ModelAttribute User user) throws ExceptionRecord {
// this.mongoTemplate.insert(user);
// return new ResultObject(HttpServletResponse.SC_OK);
// }
//
// /**
// * 描述:删除
// * @author maochengyuan
// * @created 2018/9/1 20:17
// * @param userId
// * @return ResultObject
// */
// @RequestMapping("/delete")
// @ResponseBody
// public ResultObject delete(@RequestParam("userId") String userId) throws ExceptionRecord {
// Query query = Query.query(Criteria.where("userId").is(userId));
// this.mongoTemplate.remove(query, collectionName);
// return new ResultObject(HttpServletResponse.SC_OK);
// }
//
// /**
// * 描述:修改
// * @author maochengyuan
// * @created 2018/9/1 20:17
// * @param user
// * @return ResultObject
// */
// @RequestMapping(value = "/update", method = RequestMethod.POST)
// @ResponseBody
// public ResultObject update(@ModelAttribute User user) throws ExceptionRecord {
// Query query = Query.query(Criteria.where("userId").is(user.getUserId()));
// Update update = new Update();
// update.set("age", user.getAge());
// update.set("name", user.getName());
// update.set("email", user.getEmail());
// this.mongoTemplate.updateFirst(query, update, collectionName);
// return new ResultObject(HttpServletResponse.SC_OK);
// }
//
// /**
// * 描述:查询
// * @author maochengyuan
// * @created 2018/9/1 20:17
// * @param
// * @return ResultObject
// */
// @RequestMapping("/query")
// @ResponseBody
// public ResultObject query() throws ExceptionRecord {
// Query query = Query.query(Criteria.where("dataStatus").is(1));
// List<User> users = this.mongoTemplate.find(query, User.class);
// return new ResultObject(HttpServletResponse.SC_OK, users);
// }
//
//}
package com.demo.util;
public class Algorithm {
public native String rsaPrivateEncode(String plantext,String privatekey);
public native String rsaPublicDecode(String ciphertext,String pubkey);
public native String rsaEncode(String plantext,String pubkey);
/**
* @param ciphertext
* @param privatekey
* @return
*/
public native String rsaDecode(String ciphertext,String privatekey);
public native String sha1(String plantext);
public native String aes256Encode(String plantext,String key);
public native String aes256Decode(String ciphertext,String key);
}
package com.demo.util;
import java.io.*;
public class DeformedBase64 {
public DeformedBase64() {
}
/**
* 功能:编码字符串
*
* @author jiangshuai
* @date 2016年10月03日
* @param data
* 源字符串
* @return String
*/
public static String encode(String data) {
return new String(encode(data.getBytes()));
}
/**
* 功能:解码字符串
*
* @author jiangshuai
* @date 2016年10月03日
* @param data
* 源字符串
* @return String
*/
public static String decode(String data) {
return new String(decode(data.toCharArray()));
}
/**
* 功能:编码byte[]
*
* @author zhangsy
* @date 2016年10月03日
* @param data
* 源
* @return char[]
*/
public static char[] encode(byte[] data) {
char[] out = new char[((data.length + 2) / 3) * 4];
for (int i = 0, index = 0; i < data.length; i += 3, index += 4) {
boolean quad = false;
boolean trip = false;
int val = (0xFF & (int) data[i]);
val <<= 8;
if ((i + 1) < data.length) {
val |= (0xFF & (int) data[i + 1]);
trip = true;
}
val <<= 8;
if ((i + 2) < data.length) {
val |= (0xFF & (int) data[i + 2]);
quad = true;
}
out[index + 3] = alphabet[(quad ? (val & 0x3F) : 64)];
val >>= 6;
out[index + 2] = alphabet[(trip ? (val & 0x3F) : 64)];
val >>= 6;
out[index + 1] = alphabet[val & 0x3F];
val >>= 6;
out[index + 0] = alphabet[val & 0x3F];
}
return out;
}
/**
* 功能:解码
*
* @author zhangsy
* @date 2016年10月03日
* @param data
* 编码后的字符数组
* @return byte[]
*/
public static byte[] decode(char[] data) {
int tempLen = data.length;
for (int ix = 0; ix < data.length; ix++) {
if ((data[ix] > 255) || codes[data[ix]] < 0) {
--tempLen; // ignore non-valid chars and padding
}
}
// calculate required length:
// -- 3 bytes for every 4 valid base64 chars
// -- plus 2 bytes if there are 3 extra base64 chars,
// or plus 1 byte if there are 2 extra.
int len = (tempLen / 4) * 3;
if ((tempLen % 4) == 3) {
len += 2;
}
if ((tempLen % 4) == 2) {
len += 1;
}
byte[] out = new byte[len];
int shift = 0; // # of excess bits stored in accum
int accum = 0; // excess bits
int index = 0;
// we now go through the entire array (NOT using the 'tempLen' value)
for (int ix = 0; ix < data.length; ix++) {
int value = (data[ix] > 255) ? -1 : codes[data[ix]];
if (value >= 0) { // skip over non-code
accum <<= 6; // bits shift up by 6 each time thru
shift += 6; // loop, with new bits being put in
accum |= value; // at the bottom.
if (shift >= 8) { // whenever there are 8 or more shifted in,
shift -= 8; // write them out (from the top, leaving any
out[index++] = // excess at the bottom for next iteration.
(byte) ((accum >> shift) & 0xff);
}
}
}
// if there is STILL something wrong we just have to throw up now!
if (index != out.length) {
throw new Error("Miscalculated data length (wrote " + index + " instead of " + out.length + ")");
}
return out;
}
/**
* 功能:编码文件
*
* @author jiangshuai
* @date 2016年10月03日
* @param file
* 源文件
*/
public static void encode(File file) throws IOException {
if (!file.exists()) {
System.exit(0);
}
else {
byte[] decoded = readBytes(file);
char[] encoded = encode(decoded);
writeChars(file, encoded);
}
file = null;
}
/**
* 功能:解码文件。
*
* @author zhangsy
* @date 2016年10月03日
* @param file
* 源文件
* @throws IOException
*/
public static void decode(File file) throws IOException {
if (!file.exists()) {
System.exit(0);
} else {
char[] encoded = readChars(file);
byte[] decoded = decode(encoded);
writeBytes(file, decoded);
}
file = null;
}
//
// code characters for values 0..63
//
// private static char[] alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".toCharArray();
private static char[] alphabet = "aI0wy/RG1K2+TNvJcQlMi5e3g8kmCYnWj4HzEpbZU7hx9BFdrXsfLPDSqotA6uVO=".toCharArray();
//
// lookup table for converting base64 characters to value in range 0..63
//
private static byte[] codes = new byte[256];
// static {
// for (int i = 0; i < 256; i++) {
// codes[i] = -1;
// // LoggerUtil.debug(i + "&" + codes[i] + " ");
// }
// for (int i = 'A'; i <= 'Z'; i++) {
// codes[i] = (byte) (i - 'A');
// // LoggerUtil.debug(i + "&" + codes[i] + " ");
// }
//
// for (int i = 'a'; i <= 'z'; i++) {
// codes[i] = (byte) (26 + i - 'a');
// // LoggerUtil.debug(i + "&" + codes[i] + " ");
// }
// for (int i = '0'; i <= '9'; i++) {
// codes[i] = (byte) (52 + i - '0');
// // LoggerUtil.debug(i + "&" + codes[i] + " ");
// }
// codes['+'] = 62;
// codes['/'] = 63;
// }
static {
for(int i=0;i<256;i++) {
codes[i] = -1;
}
for(int i=0;i<alphabet.length - 1;i++) {
codes[(byte)alphabet[i]] = (byte)i;
}
}
private static byte[] readBytes(File file) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] b = null;
InputStream fis = null;
InputStream is = null;
try {
fis = new FileInputStream(file);
is = new BufferedInputStream(fis);
int count = 0;
byte[] buf = new byte[16384];
while ((count = is.read(buf)) != -1) {
if (count > 0) {
baos.write(buf, 0, count);
}
}
b = baos.toByteArray();
} finally {
try {
if (fis != null)
fis.close();
if (is != null)
is.close();
if (baos != null)
baos.close();
} catch (Exception e) {
System.out.println(e);
}
}
return b;
}
private static char[] readChars(File file) throws IOException {
CharArrayWriter caw = new CharArrayWriter();
Reader fr = null;
Reader in = null;
try {
fr = new FileReader(file);
in = new BufferedReader(fr);
int count = 0;
char[] buf = new char[16384];
while ((count = in.read(buf)) != -1) {
if (count > 0) {
caw.write(buf, 0, count);
}
}
} finally {
try {
if (caw != null)
caw.close();
if (in != null)
in.close();
if (fr != null)
fr.close();
} catch (Exception e) {
System.out.println(e);
}
}
return caw.toCharArray();
}
private static void writeBytes(File file, byte[] data) throws IOException {
OutputStream fos = null;
OutputStream os = null;
try {
fos = new FileOutputStream(file);
os = new BufferedOutputStream(fos);
os.write(data);
} finally {
try {
if (os != null)
os.close();
if (fos != null)
fos.close();
} catch (Exception e) {
System.out.println(e);
}
}
}
private static void writeChars(File file, char[] data) throws IOException {
Writer fos = null;
Writer os = null;
try {
fos = new FileWriter(file);
os = new BufferedWriter(fos);
os.write(data);
} finally {
try {
if (os != null)
os.close();
if (fos != null)
fos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
// public static void main(String[] args) {
// String str = "测试字符串a";
// String ciphertext = encode(str);
// System.out.println(ciphertext);
// System.out.println(decode(ciphertext));
//
// System.out.println(decode("Cb5oYeoKQa=="));
// }
}
package com.demo.util;
import java.io.IOException;
import java.lang.reflect.Field;
public class DllAddUtil {
/**
*
* 注意:jvm实现不是用的变量usr_paths来保存java.library.path的值,需要去查看源码修改
* @param libraryPath
* @throws IOException
*/
public static void addLibraryDir(String libraryPath) throws IOException {
try {
Field field = ClassLoader.class.getDeclaredField("usr_paths");
field.setAccessible(true);
StringBuilder sb = new StringBuilder();
String[] paths = (String[]) field.get(null);
for (int i = 0; i < paths.length; i++) {
if (libraryPath.equals(paths[i])) {
return;
}
sb.append(paths[i]).append(';');
}
sb.append(libraryPath);
System.setProperty("java.library.path", sb.toString());
final Field sysPathsField = ClassLoader.class.getDeclaredField("sys_paths");
sysPathsField.setAccessible(true);
sysPathsField.set(null, null);
} catch (IllegalAccessException e) {
throw new IOException(
"Failedto get permissions to set library path");
} catch (NoSuchFieldException e) {
throw new IOException(
"Failedto get field handle to set library path");
}
}
}
package com.demo.util;
import org.springframework.util.StringUtils;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import java.security.Key;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.SecureRandom;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.util.HashMap;
import java.util.Map;
/**
* RSA 公钥与私钥的处理类
*/
public class RSAUtil {
public static final String KEY_ALGORITHM = "RSA";
private static final String PUBLIC_KEY = "RSAPublicKey";
private static final String PRIVATE_KEY = "RSAPrivateKey";
public static String getPublicKey(Map<String, Object> keyMap) throws Exception {
Key key = (Key) keyMap.get(PUBLIC_KEY);
byte[] publicKey = key.getEncoded();
String publicKeyStr = encryptBASE64(publicKey);
if(!StringUtils.isEmpty(publicKeyStr)){
publicKeyStr = publicKeyStr.replaceAll("\r", "");
publicKeyStr = publicKeyStr.replaceAll("\n", "");
}
return publicKeyStr;
}
public static String getPrivateKey(Map<String, Object> keyMap) throws Exception {
Key key = (Key) keyMap.get(PRIVATE_KEY);
byte[] privateKey =key.getEncoded();
String privateKeyStr = encryptBASE64(privateKey);
if(!StringUtils.isEmpty(privateKeyStr)){
privateKeyStr = privateKeyStr.replaceAll("\r", "");
privateKeyStr = privateKeyStr.replaceAll("\n", "");
}
return privateKeyStr;
}
public static byte[] decryptBASE64(String key) throws Exception {
return (new BASE64Decoder()).decodeBuffer(key);
}
public static String encryptBASE64(byte[] key) throws Exception {
return (new BASE64Encoder()).encodeBuffer(key);
}
/**
*
* 生成对应的公钥私钥
* @param password(加密种子 --/可以为空/---)
* @return
* @throws Exception
*/
public static Map<String, Object> initKey(String password) throws Exception {
KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance(KEY_ALGORITHM);
keyPairGen.initialize(1024, new SecureRandom(password.getBytes()));
KeyPair keyPair = keyPairGen.generateKeyPair();
RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
Map<String, Object> keyMap = new HashMap<String, Object>(2);
keyMap.put(PUBLIC_KEY, publicKey);
keyMap.put(PRIVATE_KEY, privateKey);
return keyMap;
}
// public static void main(String args[]) throws Exception{
//
// Map<String, Object> keyMap;
//
// try {
//
// keyMap = initKey("test234");
//
// String publicKey = getPublicKey(keyMap);
//
// System.out.println(publicKey);
//
// String privateKey = getPrivateKey(keyMap);
//
// System.out.println(privateKey);
//
// } catch (Exception e) {
//
// e.printStackTrace();
//
// }
//
//
// }
}
package com.demo.util;
import com.demo.constant.ResultStatus;
public class ResultObject {
private int code;
private String desc;
private Object data;
public ResultObject() {
}
public ResultObject(ResultStatus resultStatus) {
this.code = resultStatus.getCode();
this.desc = resultStatus.getDesc();
}
public ResultObject(Object data) {
this.code = ResultStatus.SUCCESS.getCode();
this.data = data;
this.desc = ResultStatus.SUCCESS.getDesc();
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
package com.demo.util;
import org.springframework.util.StringUtils;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import java.security.SecureRandom;
import java.util.Date;
import java.util.Random;
public class SecretUtil {
public static final String KEY_ALGORITHM = "AES";
/**
* 生成AES密钥
*
* @param length 长度
* @param password 密钥种子(指定的字符串 ---/ 可以为空 / ---)
* @return
* @throws Exception
*/
public static String generateAesKey(int length, String password) throws Exception {
//实例化
KeyGenerator kgen = null;
kgen = KeyGenerator.getInstance(KEY_ALGORITHM);
//设置密钥长度
if(StringUtils.isEmpty(password)){
kgen.init(length);
}else{
//SecureRandom是生成安全随机数序列,password.getBytes()是种子,只要种子相同,序列就一样,所以生成的秘钥就一样。
kgen.init(length, new SecureRandom(password.getBytes()));
}
//生成密钥
SecretKey skey = kgen.generateKey();
//返回密钥的二进制编码
byte[] skeyByte = skey.getEncoded();
return byteToHexString(skeyByte);
}
/**
* byte数组转化为16进制字符串
* @param bytes
* @return
*/
public static String byteToHexString(byte[] bytes){
StringBuffer sb = new StringBuffer();
for (int i = 0; i < bytes.length; i++) {
String strHex=Integer.toHexString(bytes[i]);
if(strHex.length() > 3){
sb.append(strHex.substring(6));
} else {
if(strHex.length() < 2){
sb.append("0" + strHex);
} else {
sb.append(strHex);
}
}
}
return sb.toString();
}
/**
* 生成随机的子节数
* @param len
* @return
*/
public static String getRandNum(int len) {
StringBuffer flag = new StringBuffer();
String sources = new Date().getTime() +""; // 加上一些字母,就可以生成pc站的验证码了
Random rand = new Random();
for (int j = 0; j < len; j++) {
flag.append(sources.charAt(rand.nextInt(9)) + "");
}
return flag.toString();
}
// public static void main(String args[]) throws Exception{
//
//// System.out.println( getRandNum(6));
// System.out.println(generateAesKey(128,"reyun"));
//
// }
}
\ No newline at end of file
server.port=8081
spring.data.mongodb.host=192.168.168.81
spring.data.mongodb.port=8763
spring.data.mongodb.database=device
server.ssl.key-store=classpath:keystore.p12
server.ssl.key-store-password=123456
server.ssl.key-store-type=PKCS12
server.ssl.key-alias= tomcat
\ No newline at end of file
server.port=10081
spring.data.mongodb.host=127.0.0.1
spring.data.mongodb.port=8983
spring.data.mongodb.database=device
server.ssl.key-store=classpath:keystore.p12
server.ssl.key-store-password=123456
server.ssl.key-store-type=PKCS12
server.ssl.key-alias= tomcat
\ No newline at end of file
spring.profiles.active=dev
\ No newline at end of file
server.port=8081
spring.data.mongodb.host=192.168.168.81
spring.data.mongodb.port=8763
spring.data.mongodb.database=device
server.ssl.key-store=classpath:keystore.p12
server.ssl.key-store-password=123456
server.ssl.key-store-type=PKCS12
server.ssl.key-alias= tomcat
\ No newline at end of file
server.port=10081
spring.data.mongodb.host=127.0.0.1
spring.data.mongodb.port=8983
spring.data.mongodb.database=device
server.ssl.key-store=classpath:keystore.p12
server.ssl.key-store-password=123456
server.ssl.key-store-type=PKCS12
server.ssl.key-alias= tomcat
\ No newline at end of file
spring.profiles.active=dev
\ 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