Esempio n. 1
0
 public boolean password(String password) {
   try {
     return mBinder.password(password) == NO_ERROR;
   } catch (RemoteException e) {
     Log.w(TAG, "Cannot connect to keystore", e);
     return false;
   }
 }
Esempio n. 2
0
 public boolean lock() {
   try {
     return mBinder.lock() == NO_ERROR;
   } catch (RemoteException e) {
     Log.w(TAG, "Cannot connect to keystore", e);
     return false;
   }
 }
Esempio n. 3
0
 public String[] saw(String prefix, int uid) {
   try {
     return mBinder.saw(prefix, uid);
   } catch (RemoteException e) {
     Log.w(TAG, "Cannot connect to keystore", e);
     return null;
   }
 }
Esempio n. 4
0
 public boolean importKey(String keyName, byte[] key, int uid, int flags) {
   try {
     return mBinder.import_key(keyName, key, uid, flags) == NO_ERROR;
   } catch (RemoteException e) {
     Log.w(TAG, "Cannot connect to keystore", e);
     return false;
   }
 }
Esempio n. 5
0
 public boolean clearUid(int uid) {
   try {
     return mBinder.clear_uid(uid) == NO_ERROR;
   } catch (RemoteException e) {
     Log.w(TAG, "Cannot connect to keystore", e);
     return false;
   }
 }
Esempio n. 6
0
 public boolean duplicate(String srcKey, int srcUid, String destKey, int destUid) {
   try {
     return mBinder.duplicate(srcKey, srcUid, destKey, destUid) == NO_ERROR;
   } catch (RemoteException e) {
     Log.w(TAG, "Cannot connect to keystore", e);
     return false;
   }
 }
Esempio n. 7
0
 public boolean isHardwareBacked(String keyType) {
   try {
     return mBinder.is_hardware_backed(keyType.toUpperCase(Locale.US)) == NO_ERROR;
   } catch (RemoteException e) {
     Log.w(TAG, "Cannot connect to keystore", e);
     return false;
   }
 }
Esempio n. 8
0
 public boolean ungrant(String key, int uid) {
   try {
     return mBinder.ungrant(key, uid) == NO_ERROR;
   } catch (RemoteException e) {
     Log.w(TAG, "Cannot connect to keystore", e);
     return false;
   }
 }
Esempio n. 9
0
 public byte[] sign(String key, byte[] data) {
   try {
     return mBinder.sign(key, data);
   } catch (RemoteException e) {
     Log.w(TAG, "Cannot connect to keystore", e);
     return null;
   }
 }
Esempio n. 10
0
 public boolean verify(String key, byte[] data, byte[] signature) {
   try {
     return mBinder.verify(key, data, signature) == NO_ERROR;
   } catch (RemoteException e) {
     Log.w(TAG, "Cannot connect to keystore", e);
     return false;
   }
 }
Esempio n. 11
0
 public byte[] getPubkey(String key) {
   try {
     return mBinder.get_pubkey(key);
   } catch (RemoteException e) {
     Log.w(TAG, "Cannot connect to keystore", e);
     return null;
   }
 }
Esempio n. 12
0
 public boolean put(String key, byte[] value, int uid, int flags) {
   try {
     return mBinder.insert(key, value, uid, flags) == NO_ERROR;
   } catch (RemoteException e) {
     Log.w(TAG, "Cannot connect to keystore", e);
     return false;
   }
 }
Esempio n. 13
0
 public boolean generate(String key, int uid, int keyType, int keySize, int flags, byte[][] args) {
   try {
     return mBinder.generate(key, uid, keyType, keySize, flags, args) == NO_ERROR;
   } catch (RemoteException e) {
     Log.w(TAG, "Cannot connect to keystore", e);
     return false;
   }
 }
Esempio n. 14
0
 public boolean isEmpty() {
   try {
     return mBinder.zero() == KEY_NOT_FOUND;
   } catch (RemoteException e) {
     Log.w(TAG, "Cannot connect to keystore", e);
     return false;
   }
 }
Esempio n. 15
0
 public boolean unlock(String password) {
   try {
     mError = mBinder.unlock(password);
     return mError == NO_ERROR;
   } catch (RemoteException e) {
     Log.w(TAG, "Cannot connect to keystore", e);
     return false;
   }
 }
Esempio n. 16
0
  /**
   * Returns the last modification time of the key in milliseconds since the epoch. Will return -1L
   * if the key could not be found or other error.
   */
  public long getmtime(String key) {
    try {
      final long millis = mBinder.getmtime(key);
      if (millis == -1L) {
        return -1L;
      }

      return millis * 1000L;
    } catch (RemoteException e) {
      Log.w(TAG, "Cannot connect to keystore", e);
      return -1L;
    }
  }
Esempio n. 17
0
  public State state() {
    final int ret;
    try {
      ret = mBinder.test();
    } catch (RemoteException e) {
      Log.w(TAG, "Cannot connect to keystore", e);
      throw new AssertionError(e);
    }

    switch (ret) {
      case NO_ERROR:
        return State.UNLOCKED;
      case LOCKED:
        return State.LOCKED;
      case UNINITIALIZED:
        return State.UNINITIALIZED;
      default:
        throw new AssertionError(mError);
    }
  }