Patch code to use new Base64
This commit is contained in:
parent
20677d4be1
commit
1a8c40c02a
|
@ -5,22 +5,21 @@
|
||||||
|
|
||||||
package org.whispersystems.textsecuregcm.auth;
|
package org.whispersystems.textsecuregcm.auth;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.util.Base64;
|
||||||
import javax.ws.rs.WebApplicationException;
|
import javax.ws.rs.WebApplicationException;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.Response.Status;
|
import javax.ws.rs.core.Response.Status;
|
||||||
import org.whispersystems.textsecuregcm.util.Base64;
|
|
||||||
|
|
||||||
public class CombinedUnidentifiedSenderAccessKeys {
|
public class CombinedUnidentifiedSenderAccessKeys {
|
||||||
private final byte[] combinedUnidentifiedSenderAccessKeys;
|
private final byte[] combinedUnidentifiedSenderAccessKeys;
|
||||||
|
|
||||||
public CombinedUnidentifiedSenderAccessKeys(String header) {
|
public CombinedUnidentifiedSenderAccessKeys(String header) {
|
||||||
try {
|
try {
|
||||||
this.combinedUnidentifiedSenderAccessKeys = Base64.decode(header);
|
this.combinedUnidentifiedSenderAccessKeys = Base64.getDecoder().decode(header);
|
||||||
if (this.combinedUnidentifiedSenderAccessKeys == null || this.combinedUnidentifiedSenderAccessKeys.length != 16) {
|
if (this.combinedUnidentifiedSenderAccessKeys == null || this.combinedUnidentifiedSenderAccessKeys.length != 16) {
|
||||||
throw new WebApplicationException("Invalid combined unidentified sender access keys", Status.UNAUTHORIZED);
|
throw new WebApplicationException("Invalid combined unidentified sender access keys", Status.UNAUTHORIZED);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
throw new WebApplicationException(e, Response.Status.UNAUTHORIZED);
|
throw new WebApplicationException(e, Response.Status.UNAUTHORIZED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue