diff options
-rwxr-xr-x | res/values/strings.xml | 1 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/fragments/Settings_Basic.java | 12 |
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"; } |