From c5bd9f110c84f0d3b0a29295337cf724eb2bdbfb Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Fri, 9 Aug 2013 11:08:41 +0200 Subject: Guess if a certificate is stored in hardware --- src/de/blinkt/openvpn/fragments/Settings_Basic.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') 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"; } -- cgit v1.2.3