Home | History | Annotate | Download | only in recoverablekeystore

Lines Matching refs:userId

78      * A new instance operating on behalf of {@code userId}, storing its prefs in the location
111 * @param userId The ID of the user to whose lock screen the platform key must be bound.
115 public int getGenerationId(int userId) {
116 return mDatabase.getPlatformKeyGenerationId(userId);
123 * @param userId The ID of the user to whose lock screen the platform key must be bound.
127 public boolean isAvailable(int userId) {
128 return mContext.getSystemService(KeyguardManager.class).isDeviceSecure(userId);
135 * @param userId The ID of the user to whose lock screen the platform key must be bound.
140 public void invalidatePlatformKey(int userId, int generationId) {
143 mKeyStore.deleteEntry(getEncryptAlias(userId, generationId));
144 mKeyStore.deleteEntry(getDecryptAlias(userId, generationId));
156 * @param userId The ID of the user to whose lock screen the platform key must be bound.
165 void regenerate(int userId)
167 if (!isAvailable(userId)) {
169 Locale.US, "%d does not have a lock screen set.", userId));
172 int generationId = getGenerationId(userId);
177 invalidatePlatformKey(userId, generationId);
180 generateAndLoadKey(userId, nextId);
187 * @param userId The ID of the user to whose lock screen the platform key must be bound.
196 public PlatformEncryptionKey getEncryptKey(int userId) throws KeyStoreException,
198 init(userId);
202 getDecryptKeyInternal(userId);
203 return getEncryptKeyInternal(userId);
207 userId));
208 regenerate(userId);
209 return getEncryptKeyInternal(userId);
216 * @param userId The ID of the user to whose lock screen the platform key must be bound.
224 private PlatformEncryptionKey getEncryptKeyInternal(int userId) throws KeyStoreException,
226 int generationId = getGenerationId(userId);
227 String alias = getEncryptAlias(userId, generationId);
228 if (!isKeyLoaded(userId, generationId)) {
240 * @param userId The ID of the user to whose lock screen the platform key must be bound.
249 public PlatformDecryptionKey getDecryptKey(int userId) throws KeyStoreException,
251 init(userId);
253 return getDecryptKeyInternal(userId);
257 userId));
258 regenerate(userId);
259 return getDecryptKeyInternal(userId);
266 * @param userId The ID of the user to whose lock screen the platform key must be bound.
274 private PlatformDecryptionKey getDecryptKeyInternal(int userId) throws KeyStoreException,
276 int generationId = getGenerationId(userId);
277 String alias = getDecryptAlias(userId, generationId);
278 if (!isKeyLoaded(userId, generationId)) {
290 * @param userId The ID of the user to whose lock screen the platform key must be bound.
297 void init(int userId)
299 if (!isAvailable(userId)) {
301 Locale.US, "%d does not have a lock screen set.", userId));
304 int generationId = getGenerationId(userId);
305 if (isKeyLoaded(userId, generationId)) {
320 generateAndLoadKey(userId, generationId);
330 * @param userId The ID of the user to whose lock screen the platform key must be bound.
334 private String getEncryptAlias(int userId, int generationId) {
335 return KEY_ALIAS_PREFIX + userId + "/" + generationId + "/" + ENCRYPT_KEY_ALIAS_SUFFIX;
345 * @param userId The ID of the user to whose lock screen the platform key must be bound.
349 private String getDecryptAlias(int userId, int generationId) {
350 return KEY_ALIAS_PREFIX + userId + "/" + generationId + "/" + DECRYPT_KEY_ALIAS_SUFFIX;
357 private void setGenerationId(int userId, int generationId) throws IOException {
358 long updatedRows = mDatabase.setPlatformKeyGenerationId(userId, generationId);
370 private boolean isKeyLoaded(int userId, int generationId) throws KeyStoreException {
371 return mKeyStore.containsAlias(getEncryptAlias(userId, generationId))
372 && mKeyStore.containsAlias(getDecryptAlias(userId, generationId));
384 private void generateAndLoadKey(int userId, int generationId)
386 String encryptAlias = getEncryptAlias(userId, generationId);
387 String decryptAlias = getDecryptAlias(userId, generationId);
402 .setBoundToSpecificSecureUserId(userId)
412 setGenerationId(userId, generationId);