summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/VpnProfile.java
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2013-05-20 09:55:50 +0200
committerArne Schwabe <arne@rfc2549.org>2013-05-20 09:55:50 +0200
commit2a9037c749d3395ac65105604ab4936c4af0fc56 (patch)
treeee7672009ac3575f8aeac6c37ac91b7590334f28 /src/de/blinkt/openvpn/VpnProfile.java
parentffcd37e623136697da66e0c23bddc92b01ff0e41 (diff)
Add certificate CN print
Need to fix string for email and order --HG-- extra : rebase_source : c3d5858d53d2f8f340b0d4a07434021f194a247a
Diffstat (limited to 'src/de/blinkt/openvpn/VpnProfile.java')
-rw-r--r--src/de/blinkt/openvpn/VpnProfile.java21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java
index 9d183897..03fcbc1b 100644
--- a/src/de/blinkt/openvpn/VpnProfile.java
+++ b/src/de/blinkt/openvpn/VpnProfile.java
@@ -45,6 +45,7 @@ import de.blinkt.openvpn.R;
import de.blinkt.openvpn.core.NativeUtils;
import de.blinkt.openvpn.core.OpenVPN;
import de.blinkt.openvpn.core.OpenVpnService;
+import de.blinkt.openvpn.core.X509Utils;
public class VpnProfile implements Serializable{
// Note that this class cannot be moved to core where it belongs since
@@ -52,7 +53,7 @@ public class VpnProfile implements Serializable{
// The Serializable documentation mentions that class name change are possible
// but the how is unclear
//
-
+
private static final long serialVersionUID = 7085688938959334563L;
public static final int TYPE_CERTIFICATES=0;
public static final int TYPE_PKCS12=1;
@@ -79,7 +80,7 @@ public class VpnProfile implements Serializable{
public transient String mTransientPW=null;
public transient String mTransientPCKS12PW=null;
private transient PrivateKey mPrivateKey;
-
+
// variable named wrong and should haven beeen transient
// but needs to keep wrong name to guarante loading of old
// profiles
@@ -590,7 +591,7 @@ public class VpnProfile implements Serializable{
if(nonNull(mCaFilename)) {
try {
- Certificate cacert = getCacertFromFile();
+ Certificate cacert = X509Utils.getCertificateFromFile(mCaFilename);
X509Certificate[] newcachain = new X509Certificate[cachain.length+1];
for(int i=0;i<cachain.length;i++)
newcachain[i]=cachain[i];
@@ -645,18 +646,6 @@ public class VpnProfile implements Serializable{
}
return null;
}
- private Certificate getCacertFromFile() throws FileNotFoundException, CertificateException {
- CertificateFactory certFact = CertificateFactory.getInstance("X.509");
-
- InputStream inStream;
-
- if(mCaFilename.startsWith(INLINE_TAG))
- inStream = new ByteArrayInputStream(mCaFilename.replace(INLINE_TAG,"").getBytes());
- else
- inStream = new FileInputStream(mCaFilename);
-
- return certFact.generateCertificate(inStream);
- }
//! Return an error if somethign is wrong
@@ -681,6 +670,8 @@ public class VpnProfile implements Serializable{
}
+
+
//! Openvpn asks for a "Private Key", this should be pkcs12 key
//
public String getPasswordPrivateKey() {