Attention une mise à jour du service Gitlab va être effectuée le mardi 14 décembre entre 13h30 et 14h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes.

Commit 4834ce65 authored by calocedre TAC's avatar calocedre TAC
Browse files

public qrcode header decoding

parent 11a1186b
Pipeline #227777 passed with stage
in 1 minute and 34 seconds
package fr.inria.clea.lsp;
/**
* Generic Clea exception thrown when the layout of the message
* is not respected.
*/
public class CleaEncodingException extends Exception {
private static final long serialVersionUID = 1L;
public CleaEncodingException(String message) {
super(message);
}
}
......@@ -36,7 +36,10 @@ public class LocationSpecificPartDecoder {
* Unpack the data decrypted header (binary format):
* | version | LSPtype | pad | LTId | to extract parameters
*/
private EncryptedLocationSpecificPart decodeHeader(byte[] binaryLocationSpecificPart) {
public EncryptedLocationSpecificPart decodeHeader(byte[] binaryLocationSpecificPart) throws CleaEncodingException {
if (binaryLocationSpecificPart.length < CleaEciesEncoder.HEADER_BYTES_SIZE + CleaEciesEncoder.MSG_BYTES_SIZE) {
throw new CleaEncodingException("Bad message length: " + binaryLocationSpecificPart.length);
}
byte[] headerBinary = Arrays.copyOfRange(binaryLocationSpecificPart, 0, CleaEciesEncoder.HEADER_BYTES_SIZE);
BitUtils header = new BitUtils(headerBinary);
......@@ -61,8 +64,9 @@ public class LocationSpecificPartDecoder {
*
* @param lspBase64 Location Specific Part in base64
* @throws CleaEncryptionException
* @throws CleaEncodingException
*/
public EncryptedLocationSpecificPart decrypt(String lspBase64) throws CleaEncryptionException {
public EncryptedLocationSpecificPart decrypt(String lspBase64) throws CleaEncryptionException, CleaEncodingException {
byte[] encryptedLocationSpecificPart = Base64.getDecoder().decode(lspBase64);
log.debug("Base 64 decoded LSP: {}", encryptedLocationSpecificPart);
byte[] binaryLocationSpecificPart;
......
......@@ -37,7 +37,7 @@ public class LocationSpecificPartEncoder {
*
* @return data header in binary format
*/
private byte[] binaryEncodedHeader(LocationSpecificPart locationSpecificPart) {
public byte[] binaryEncodedHeader(LocationSpecificPart locationSpecificPart) {
BitUtils header = new BitUtils(8 * CleaEciesEncoder.HEADER_BYTES_SIZE);
/* version (3 bits) */
header.setNextInteger(locationSpecificPart.getVersion(), 3);
......@@ -62,7 +62,7 @@ public class LocationSpecificPartEncoder {
* @throws CleaEncryptionException
* @throws Exception
*/
private byte[] binaryEncodedMessage(LocationSpecificPart locationSpecificPart) throws CleaEncryptionException {
public byte[] binaryEncodedMessage(LocationSpecificPart locationSpecificPart) throws CleaEncryptionException {
BitUtils message = new BitUtils(8 * CleaEciesEncoder.MSG_BYTES_SIZE);
/* staff (1 bit) */
......
......@@ -27,7 +27,7 @@ public class LspEncoderDecoder {
}
}
protected static void decodeLsp(String[] args) throws CleaEncryptionException {
protected static void decodeLsp(String[] args) throws CleaEncryptionException, CleaEncodingException {
String lspBase64 = args[1];
String serverAuthoritySecretKey = args[2];
String manualContactTracingAuthoritySecretKey = args[3];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment