Patch code to use new Base64

This commit is contained in:
Ehren Kret 2021-04-28 10:09:32 -05:00
parent 20677d4be1
commit 1a8c40c02a
1 changed files with 3 additions and 4 deletions

View File

@ -5,22 +5,21 @@
package org.whispersystems.textsecuregcm.auth;
import java.io.IOException;
import java.util.Base64;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.whispersystems.textsecuregcm.util.Base64;
public class CombinedUnidentifiedSenderAccessKeys {
private final byte[] combinedUnidentifiedSenderAccessKeys;
public CombinedUnidentifiedSenderAccessKeys(String header) {
try {
this.combinedUnidentifiedSenderAccessKeys = Base64.decode(header);
this.combinedUnidentifiedSenderAccessKeys = Base64.getDecoder().decode(header);
if (this.combinedUnidentifiedSenderAccessKeys == null || this.combinedUnidentifiedSenderAccessKeys.length != 16) {
throw new WebApplicationException("Invalid combined unidentified sender access keys", Status.UNAUTHORIZED);
}
} catch (IOException e) {
} catch (IllegalArgumentException e) {
throw new WebApplicationException(e, Response.Status.UNAUTHORIZED);
}
}