Tabnine Logo
KeyInfo.isInsideSecureHardware
Code IndexAdd Tabnine to your IDE (free)

How to use
isInsideSecureHardware
method
in
android.security.keystore.KeyInfo

Best Java code snippets using android.security.keystore.KeyInfo.isInsideSecureHardware (Showing top 4 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew ArrayList()
  • Codota Iconnew LinkedList()
  • Smart code suggestions by Tabnine
}
origin: commonsguy/cw-omnibus

 private void isInsideSecureHardware() {
  try {
   createKeyForTimeout();
  }
  catch (Exception e) {
   Toast.makeText(this, "Could not create the key", Toast.LENGTH_LONG).show();
   Log.e(getClass().getSimpleName(), "Exception creating key", e);
   return;
  }

  try {
   SecretKey key=(SecretKey)ks.getKey(KEY_NAME, null);
   KeyInfo info=
    (KeyInfo)SecretKeyFactory.getInstance(key.getAlgorithm(), KEYSTORE)
     .getKeySpec(key, KeyInfo.class);

   if (info.isInsideSecureHardware()) {
    Toast.makeText(this, "Key is inside secure hardware", Toast.LENGTH_LONG).show();
   }
   else {
    Toast.makeText(this, "Key is only secured by software", Toast.LENGTH_LONG).show();
   }
  }
  catch (Exception e) {
   Toast.makeText(this, "Well, *that* didn't work...", Toast.LENGTH_LONG).show();
   Log.e(getClass().getSimpleName(), "Exception getting key info", e);
  }
 }
}
origin: androidthings/sensorhub-cloud-iot

private boolean isInSecureHardware() {
  try {
    KeyFactory factory = KeyFactory.getInstance(privateKey.getAlgorithm(), keystoreName);
    KeyInfo keyInfo = factory.getKeySpec(privateKey, KeyInfo.class);
    return keyInfo.isInsideSecureHardware();
  } catch (GeneralSecurityException e) {
    Log.w(TAG, "Could not determine if private key is in secure hardware or not");
  }
  return false;
}
origin: LxxCaroline/FingerprintSample

  public boolean isKeyProtectedEnforcedBySecureHardware() {
    try {
      //这里随便生成一个key,检查是不是受保护即可
      generateKey("temp");
      final SecretKey key = (SecretKey) mStore.getKey("temp", null);
      if (key == null) {
        return false;
      }
      SecretKeyFactory factory = SecretKeyFactory.getInstance(KeyProperties.KEY_ALGORITHM_AES, "AndroidKeyStore");
      KeyInfo keyInfo;
      keyInfo = (KeyInfo) factory.getKeySpec(key, KeyInfo.class);
      return keyInfo.isInsideSecureHardware() && keyInfo.isUserAuthenticationRequirementEnforcedBySecureHardware();
    } catch (Exception e) {
      // Not an Android KeyStore key.
      return false;
    }
  }
}
origin: termux/termux-api

out.name("inside_secure_hardware").value(keyInfo.isInsideSecureHardware());
android.security.keystoreKeyInfoisInsideSecureHardware

Popular methods of KeyInfo

  • isUserAuthenticationRequirementEnforcedBySecureHardware
  • getKeySize
  • getUserAuthenticationValidityDurationSeconds
  • isUserAuthenticationRequired

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (ScheduledExecutorService)
  • startActivity (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • JCheckBox (javax.swing)
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now