mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-20 19:42:45 +00:00
Move Base64 encoding responsibilities out to the CryptoProviders for Android
This commit is contained in:
parent
6a92ea74fc
commit
890ee846f7
@ -4,6 +4,5 @@
|
|||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="lib" path="libs/xpp3-1.1.4c.jar"/>
|
<classpathentry kind="lib" path="libs/xpp3-1.1.4c.jar"/>
|
||||||
<classpathentry kind="lib" path="libs/tinyrtsp.jar"/>
|
<classpathentry kind="lib" path="libs/tinyrtsp.jar"/>
|
||||||
<classpathentry kind="lib" path="libs/commons-codec-1.9.jar"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
Binary file not shown.
@ -7,4 +7,5 @@ public interface LimelightCryptoProvider {
|
|||||||
public X509Certificate getClientCertificate();
|
public X509Certificate getClientCertificate();
|
||||||
public RSAPrivateKey getClientPrivateKey();
|
public RSAPrivateKey getClientPrivateKey();
|
||||||
public byte[] getPemEncodedClientCertificate();
|
public byte[] getPemEncodedClientCertificate();
|
||||||
|
public String encodeBase64String(byte[] data);
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@ import java.util.Stack;
|
|||||||
|
|
||||||
import javax.crypto.SecretKey;
|
import javax.crypto.SecretKey;
|
||||||
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
import org.xmlpull.v1.XmlPullParserFactory;
|
import org.xmlpull.v1.XmlPullParserFactory;
|
||||||
@ -25,6 +24,7 @@ import org.xmlpull.v1.XmlPullParserFactory;
|
|||||||
public class NvHTTP {
|
public class NvHTTP {
|
||||||
private String uniqueId;
|
private String uniqueId;
|
||||||
private PairingManager pm;
|
private PairingManager pm;
|
||||||
|
private LimelightCryptoProvider cryptoProvider;
|
||||||
|
|
||||||
public static final int PORT = 47984;
|
public static final int PORT = 47984;
|
||||||
public static final int CONNECTION_TIMEOUT = 5000;
|
public static final int CONNECTION_TIMEOUT = 5000;
|
||||||
@ -35,6 +35,7 @@ public class NvHTTP {
|
|||||||
|
|
||||||
public NvHTTP(InetAddress host, String uniqueId, String deviceName, LimelightCryptoProvider cryptoProvider) {
|
public NvHTTP(InetAddress host, String uniqueId, String deviceName, LimelightCryptoProvider cryptoProvider) {
|
||||||
this.uniqueId = uniqueId;
|
this.uniqueId = uniqueId;
|
||||||
|
this.cryptoProvider = cryptoProvider;
|
||||||
|
|
||||||
String safeAddress;
|
String safeAddress;
|
||||||
if (host instanceof Inet6Address) {
|
if (host instanceof Inet6Address) {
|
||||||
@ -200,14 +201,14 @@ public class NvHTTP {
|
|||||||
"/launch?uniqueid=" + uniqueId +
|
"/launch?uniqueid=" + uniqueId +
|
||||||
"&appid=" + appId +
|
"&appid=" + appId +
|
||||||
"&mode=" + width + "x" + height + "x" + refreshRate +
|
"&mode=" + width + "x" + height + "x" + refreshRate +
|
||||||
"&additionalStates=1&sops=1&rikey="+Base64.encodeBase64String(inputKey.getEncoded()));
|
"&additionalStates=1&sops=1&rikey="+cryptoProvider.encodeBase64String(inputKey.getEncoded()));
|
||||||
String gameSession = getXmlString(in, "gamesession");
|
String gameSession = getXmlString(in, "gamesession");
|
||||||
return Integer.parseInt(gameSession);
|
return Integer.parseInt(gameSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean resumeApp(SecretKey inputKey) throws IOException, XmlPullParserException {
|
public boolean resumeApp(SecretKey inputKey) throws IOException, XmlPullParserException {
|
||||||
InputStream in = openHttpConnection(baseUrl + "/resume?uniqueid=" + uniqueId +
|
InputStream in = openHttpConnection(baseUrl + "/resume?uniqueid=" + uniqueId +
|
||||||
"&rikey="+Base64.encodeBase64String(inputKey.getEncoded()));
|
"&rikey="+cryptoProvider.encodeBase64String(inputKey.getEncoded()));
|
||||||
String resume = getXmlString(in, "resume");
|
String resume = getXmlString(in, "resume");
|
||||||
return Integer.parseInt(resume) != 0;
|
return Integer.parseInt(resume) != 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user