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; } }
public boolean lock() { try { return mBinder.lock() == NO_ERROR; } catch (RemoteException e) { Log.w(TAG, "Cannot connect to keystore", e); return false; } }
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; } }
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; } }
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; } }
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; } }
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; } }
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; } }
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; } }
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; } }
public byte[] getPubkey(String key) { try { return mBinder.get_pubkey(key); } catch (RemoteException e) { Log.w(TAG, "Cannot connect to keystore", e); return null; } }
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; } }
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; } }
public boolean isEmpty() { try { return mBinder.zero() == KEY_NOT_FOUND; } catch (RemoteException e) { Log.w(TAG, "Cannot connect to keystore", e); return false; } }
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; } }
/** * 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; } }
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); } }