Exemplo 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;
   }
 }
Exemplo 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;
   }
 }
Exemplo 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;
   }
 }
Exemplo 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;
   }
 }
Exemplo 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;
   }
 }
Exemplo 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;
   }
 }
Exemplo 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;
   }
 }
Exemplo 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;
   }
 }
Exemplo 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;
   }
 }
Exemplo 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;
   }
 }
Exemplo 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;
   }
 }
Exemplo 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;
   }
 }
Exemplo 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;
   }
 }
Exemplo 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;
   }
 }
Exemplo 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;
   }
 }
Exemplo 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;
    }
  }
Exemplo 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);
    }
  }