Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3ad5fd59 authored by Raphael Kim's avatar Raphael Kim
Browse files

Use hard-coded string to represent the ukey2 role when salting the authentication token.

Bug: 299498652
Test: Manually tested using CtsPermissionsSyncTestApp
Change-Id: I55adf01a4b303c04ff04b94ab00045abccf42273
parent 6eaafcd2
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -562,7 +562,8 @@ public class SecureChannel {
    private byte[] constructToken(D2DHandshakeContext.Role role, byte[] authValue)
            throws GeneralSecurityException {
        MessageDigest hash = MessageDigest.getInstance("SHA-256");
        byte[] roleUtf8 = role.name().getBytes(StandardCharsets.UTF_8);
        String roleName = role == Role.INITIATOR ? "Initiator" : "Responder";
        byte[] roleUtf8 = roleName.getBytes(StandardCharsets.UTF_8);
        int tokenLength = roleUtf8.length + authValue.length;
        return hash.digest(ByteBuffer.allocate(tokenLength)
                .put(roleUtf8)