summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2013-08-09 11:08:41 +0200
committerArne Schwabe <arne@rfc2549.org>2013-08-09 11:08:41 +0200
commitc5bd9f110c84f0d3b0a29295337cf724eb2bdbfb (patch)
treed46d69b6592999f9da447881ad8d1aa1437f1f19
parentf7afba629cfb1e40daf32fb25801c562e113d084 (diff)
Guess if a certificate is stored in hardware
-rwxr-xr-xres/values/strings.xml1
-rw-r--r--src/de/blinkt/openvpn/fragments/Settings_Basic.java12
2 files changed, 10 insertions, 3 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index a41f04fd..d754772b 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -437,5 +437,6 @@
<string name="appbehaviour">Application behaviour</string>
<string name="vpnbehaviour">VPN behaviour</string>
<string name="allow_vpn_changes">Allow changes to VPN Profiles</string>
+ <string name="hwkeychain">Hardware Keystore:</string>
</resources> \ No newline at end of file
diff --git a/src/de/blinkt/openvpn/fragments/Settings_Basic.java b/src/de/blinkt/openvpn/fragments/Settings_Basic.java
index 28c2ca38..a93cc833 100644
--- a/src/de/blinkt/openvpn/fragments/Settings_Basic.java
+++ b/src/de/blinkt/openvpn/fragments/Settings_Basic.java
@@ -6,6 +6,7 @@ import android.app.AlertDialog.Builder;
import android.app.Fragment;
import android.content.ActivityNotFoundException;
import android.content.Intent;
+import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Handler.Callback;
@@ -82,12 +83,17 @@ public class Settings_Basic extends Fragment implements View.OnClickListener, On
{
new Thread() {
public void run() {
- String certstr;
+ String certstr="";
try {
+ X509Certificate cert = KeyChain.getCertificateChain(getActivity(), mProfile.mAlias)[0];
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
+ String algorithm= KeyChain.getPrivateKey(getActivity(),mProfile.mAlias).getAlgorithm();
+ if (KeyChain.isBoundKeyAlgorithm(algorithm))
+ certstr+=getString(R.string.hwkeychain);
+ }
- X509Certificate cert = KeyChain.getCertificateChain(getActivity(), mProfile.mAlias)[0];
- certstr=X509Utils.getCertificateFriendlyName(cert);
+ certstr+=X509Utils.getCertificateFriendlyName(cert);
} catch (Exception e) {
certstr="Could not get certificate from Keystore";
}