summaryrefslogtreecommitdiff
path: root/cmds/am
diff options
context:
space:
mode:
authorPaul Crowley <paulcrowley@google.com>2016-02-08 15:58:29 +0000
committerPaul Crowley <paulcrowley@google.com>2016-02-08 15:58:29 +0000
commitfaeb3eb0ba190e6d6cfe2b82ce20af587848de57 (patch)
treeeb611cc0e57ef8467dfd575dc6a0d274f98d7277 /cmds/am
parente64f3da729ae6a00fb627f00b8a97e7c5feb8bcb (diff)
Password security for FBE disk encryption keys
Add the means to protect FBE keys with a combination of an auth token from Gatekeeper, and a hash of the password. Both of these must be passed to unlock_user_key. Keys are created unprotected, and change_user_key changes the way they are protected. Bug: 22950892 Change-Id: Ie13bc6f82059ce941b0e664a5b60355e52b45f30
Diffstat (limited to 'cmds/am')
-rw-r--r--cmds/am/src/com/android/commands/am/Am.java17
1 files changed, 11 insertions, 6 deletions
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index acc68cffaa98..6206323a89f5 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -1126,14 +1126,19 @@ public class Am extends BaseCommand {
}
}
+ private byte[] argToBytes(String arg) {
+ if (arg.equals("!")) {
+ return null;
+ } else {
+ return HexDump.hexStringToByteArray(arg);
+ }
+ }
+
private void runUnlockUser() throws Exception {
int userId = Integer.parseInt(nextArgRequired());
- String tokenHex = nextArg();
- byte[] token = null;
- if (tokenHex != null) {
- token = HexDump.hexStringToByteArray(tokenHex);
- }
- boolean success = mAm.unlockUser(userId, token);
+ byte[] token = argToBytes(nextArgRequired());
+ byte[] secret = argToBytes(nextArgRequired());
+ boolean success = mAm.unlockUser(userId, token, secret);
if (success) {
System.out.println("Success: user unlocked");
} else {