-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from youngmonkeys/dev
Dev SSL
- Loading branch information
Showing
32 changed files
with
835 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...oid/socket/src/main/java/com/tvd12/ezyfoxerver/client/proxy/EzyGenerateKeyPairMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.tvd12.ezyfoxerver.client.proxy; | ||
|
||
import com.tvd12.ezyfoxerver.client.EzyMethodNames; | ||
import com.tvd12.ezyfoxserver.client.EzyClient; | ||
import com.tvd12.ezyfoxserver.client.constant.EzyConnectionStatus; | ||
import com.tvd12.ezyfoxserver.client.sercurity.EzyKeysGenerator; | ||
|
||
import java.security.KeyPair; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* Created by tavandung12 on 10/25/18. | ||
*/ | ||
|
||
public class EzyGenerateKeyPairMethod extends EzyMethodProxy { | ||
@Override | ||
public Object invoke(Map params) { | ||
KeyPair keyPair = EzyKeysGenerator.builder() | ||
.build() | ||
.generate(); | ||
byte[] publicKey = keyPair.getPublic().getEncoded(); | ||
byte[] privateKey = keyPair.getPrivate().getEncoded(); | ||
Map<String, byte[]> answer = new HashMap<>(); | ||
answer.put("publicKey", publicKey); | ||
answer.put("privateKey", privateKey); | ||
return answer; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return EzyMethodNames.METHOD_GENERATE_KEY_PAIR; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
android/socket/src/main/java/com/tvd12/ezyfoxerver/client/proxy/EzyLogMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.tvd12.ezyfoxerver.client.proxy; | ||
|
||
import com.tvd12.ezyfoxerver.client.EzyMethodNames; | ||
import com.tvd12.ezyfoxserver.client.logger.EzyLogger; | ||
import com.tvd12.ezyfoxserver.client.sercurity.EzyAsyCrypt; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Created by tavandung12 on 10/25/18. | ||
*/ | ||
|
||
public class EzyLogMethod extends EzyMethodProxy { | ||
@Override | ||
public Object invoke(Map params) throws Exception { | ||
String level = (String)params.getOrDefault("level", "i"); | ||
String message = (String)params.get("message"); | ||
if(level.equals("w")) { | ||
EzyLogger.warn(message); | ||
} | ||
else if(level.equals("e")) { | ||
EzyLogger.error(message); | ||
} | ||
else if(level.equals("d")) { | ||
EzyLogger.debug(message); | ||
} | ||
else { | ||
EzyLogger.info(message); | ||
} | ||
return Boolean.TRUE; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return EzyMethodNames.METHOD_LOG; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
android/socket/src/main/java/com/tvd12/ezyfoxerver/client/proxy/EzyRsaDecryptMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.tvd12.ezyfoxerver.client.proxy; | ||
|
||
import com.tvd12.ezyfoxerver.client.EzyMethodNames; | ||
import com.tvd12.ezyfoxserver.client.sercurity.EzyAsyCrypt; | ||
import com.tvd12.ezyfoxserver.client.sercurity.EzyKeysGenerator; | ||
|
||
import java.security.KeyPair; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* Created by tavandung12 on 10/25/18. | ||
*/ | ||
|
||
public class EzyRsaDecryptMethod extends EzyMethodProxy { | ||
@Override | ||
public Object invoke(Map params) throws Exception { | ||
byte[] message = (byte[])params.get("message"); | ||
byte[] privateKey = (byte[])params.get("privateKey"); | ||
return EzyAsyCrypt.builder() | ||
.privateKey(privateKey) | ||
.build() | ||
.decrypt(message); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return EzyMethodNames.METHOD_RSA_DECRYPT; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
android/socket/src/main/java/com/tvd12/ezyfoxerver/client/proxy/EzySetSessionKeyMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.tvd12.ezyfoxerver.client.proxy; | ||
|
||
import com.tvd12.ezyfoxerver.client.EzyMethodNames; | ||
import com.tvd12.ezyfoxserver.client.EzyClient; | ||
import com.tvd12.ezyfoxserver.client.logger.EzyLogger; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Created by tavandung12 on 10/25/18. | ||
*/ | ||
|
||
public class EzySetSessionKeyMethod extends EzyMethodProxy { | ||
@Override | ||
public Object invoke(Map params) throws Exception { | ||
EzyClient client = getClient(params); | ||
byte[] sessionKey = (byte[])params.get("sessionKey"); | ||
client.setSessionKey(sessionKey); | ||
return Boolean.TRUE; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return EzyMethodNames.METHOD_SET_SESSION_KEY; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.