Merge change 26315 into eclair
* changes: VpnService: use Credentials instead of CertTool.
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
package com.android.server.vpn;
|
package com.android.server.vpn;
|
||||||
|
|
||||||
import android.net.vpn.L2tpIpsecProfile;
|
import android.net.vpn.L2tpIpsecProfile;
|
||||||
import android.security.CertTool;
|
import android.security.Credentials;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@@ -30,16 +30,18 @@ class L2tpIpsecService extends VpnService<L2tpIpsecProfile> {
|
|||||||
@Override
|
@Override
|
||||||
protected void connect(String serverIp, String username, String password)
|
protected void connect(String serverIp, String username, String password)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
L2tpIpsecProfile p = getProfile();
|
||||||
// IPSEC
|
// IPSEC
|
||||||
DaemonProxy ipsec = startDaemon(IPSEC);
|
DaemonProxy ipsec = startDaemon(IPSEC);
|
||||||
ipsec.sendCommand(serverIp, L2tpService.L2TP_PORT,
|
ipsec.sendCommand(serverIp, L2tpService.L2TP_PORT,
|
||||||
getUserkeyPath(), getUserCertPath(), getCaCertPath());
|
Credentials.USER_PRIVATE_KEY + p.getUserCertificate(),
|
||||||
|
Credentials.USER_CERTIFICATE + p.getUserCertificate(),
|
||||||
|
Credentials.CA_CERTIFICATE + p.getCaCertificate());
|
||||||
ipsec.closeControlSocket();
|
ipsec.closeControlSocket();
|
||||||
|
|
||||||
sleep(2000); // 2 seconds
|
sleep(2000); // 2 seconds
|
||||||
|
|
||||||
// L2TP
|
// L2TP
|
||||||
L2tpIpsecProfile p = getProfile();
|
|
||||||
MtpdHelper.sendCommand(this, L2tpService.L2TP_DAEMON, serverIp,
|
MtpdHelper.sendCommand(this, L2tpService.L2TP_DAEMON, serverIp,
|
||||||
L2tpService.L2TP_PORT,
|
L2tpService.L2TP_PORT,
|
||||||
(p.isSecretEnabled() ? p.getSecretString() : null),
|
(p.isSecretEnabled() ? p.getSecretString() : null),
|
||||||
@@ -51,19 +53,4 @@ class L2tpIpsecService extends VpnService<L2tpIpsecProfile> {
|
|||||||
stopDaemon(IPSEC);
|
stopDaemon(IPSEC);
|
||||||
stopDaemon(MtpdHelper.MTPD);
|
stopDaemon(MtpdHelper.MTPD);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getCaCertPath() {
|
|
||||||
return CertTool.getInstance().getCaCertificate(
|
|
||||||
getProfile().getCaCertificate());
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getUserCertPath() {
|
|
||||||
return CertTool.getInstance().getUserCertificate(
|
|
||||||
getProfile().getUserCertificate());
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getUserkeyPath() {
|
|
||||||
return CertTool.getInstance().getUserPrivateKey(
|
|
||||||
getProfile().getUserCertificate());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user