Une MAJ de sécurité est nécessaire sur notre version actuelle. Elle sera effectuée lundi 02/08 entre 12h30 et 13h. L'interruption de service devrait durer quelques minutes (probablement moins de 5 minutes).

Commit cf9f3693 authored by Cypres TAC's avatar Cypres TAC
Browse files

Merge branch 'fix/base64Url-padding' into 'master'

Fix/base64 url padding

See merge request !35
parents efe52c64 02971032
Pipeline #240574 passed with stages
in 9 minutes and 43 seconds
......@@ -189,14 +189,12 @@ static void to_base64(uint8_t *in, uint8_t *out, uint8_t n)
if (end - start == 1)
{
*pos++ = base64_table[(start[0] & 0x03) << 4];
*pos++ = '=';
}
else
{
*pos++ = base64_table[((start[0] & 0x03) << 4) | (start[1] >> 4)];
*pos++ = base64_table[(start[1] & 0x0f) << 2];
}
*pos++ = '=';
}
// Add terminal zero to string
......
......@@ -34,7 +34,7 @@ uint8_t LSP_base64[LSP_BASE64_SIZE];
void display_qrcode(int width, int height)
{
uint8_t content[24 + sizeof(LSP_base64)] = "http://tac.gouv.fr?v=0#";
uint8_t content[24 + sizeof(LSP_base64)] = "https://tac.gouv.fr?v=0#";
uint8_t qr[qrcodegen_BUFFER_LEN_MAX];
uint8_t tempBuffer[qrcodegen_BUFFER_LEN_MAX];
bool ok;
......
......@@ -43,7 +43,7 @@ void usage(char *s, char *err)
printf("ERROR: %s\n\n", err);
printf("Usage: %s staff CRIexp venueType venueCategory1 venueCategory2 periodDuration PK_SA PK_MCTA SK_L [locationPhone locationRegion locationPin]\n\n", s);
printf("locationPhone: 15-digit-max international phone number\n");
printf("locationPin: 8-digit-max pin code\n");
printf("locationPin: 6-digit-max pin code\n");
exit(1);
}
......
......@@ -77,7 +77,7 @@ public class Location {
* @throws CleaEncryptionException
*/
public String getLocationSpecificPartEncryptedBase64() throws CleaCryptoException {
return Base64.getUrlEncoder().encodeToString(this.getLocationSpecificPartEncrypted());
return Base64.getUrlEncoder().withoutPadding().encodeToString(this.getLocationSpecificPartEncrypted());
}
protected byte[] getLocationSpecificPartEncrypted() throws CleaCryptoException {
......
......@@ -80,6 +80,7 @@ public class LocationSpecificPartDecoder {
* @throws CleaEncodingException
*/
public LocationSpecificPart decrypt(String lspBase64) throws CleaEncryptionException, CleaEncodingException {
/* The decoder is compliant with or without padding */
byte[] encryptedLocationSpecificPart = Base64.getUrlDecoder().decode(lspBase64);
log.debug("Base 64 decoded LSP: {}", encryptedLocationSpecificPart);
return this.decrypt(encryptedLocationSpecificPart);
......
......@@ -193,6 +193,25 @@ class LocationSpecificPartTest {
MatrixToImageWriter.writeToStream(bitMatrix, imageFormat, fileOutputStream);
fileOutputStream.close();
}
/**
* Testing the decoding of a LSP in base64 (encoded by C lib)
* using several type of padding
*/
@Test
public void testDecodingInBase64withPadding() throws Exception {
final String serverAuthoritySecretKey = "3108f08b1485adb6f72cfba1b55c7484c906a2a3a0a027c78dcd991ca64c97bd";
/* message encrypted, from C package with different padding */
String lspBase64Pad0 = "AMSXLACY_zHatRP_ikRhFsR2sQW2hIaN7ZfvfHhYL02sYoxXnk4VAi-nqTeA2f312xVRYHCFgQOviOfT1yOlrBh0Wp7xVAEghYzqwhoCm9dWjMl6G4IM4rEHPmiLOkCxYp75_aIWavRSA-1NB6E";
final String Pad = "=";
LocationSpecificPartDecoder decoder = new LocationSpecificPartDecoder(serverAuthoritySecretKey);
LocationSpecificPart lsp0 = decoder.decrypt(lspBase64Pad0);
LocationSpecificPart lsp = decoder.decrypt(lspBase64Pad0+Pad);
assertThat(lsp0).isEqualTo(lsp);
}
/**
* Testing the decoding of a LSP in base64 (encoded by C lib)
......
staff, LTId, CRIexp, venueType, venueCat1, venueCat2, periodDuration, ct_periodStart, t_qrStart, LTKey, SK_SA, PK_SA, lsp_base64
0, 752cf111-bf98-8a11-c403-1ed0fe0790f1, 5, 12, 0, 0, 3, 1063143, 3827314380, f4ac94549068cfdcb2a071dc49ad63e7acca8786204fb90d2e80685582f4f5d6, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, AHUs8RG_mIoRxAMe0P4HkPECFz4EBvSjNNgHa2uyOppCfMETmZjLlAglrFyz98ml7GLc2uRfr10oPjV5plbsdu-YDXq7hf6D7CFUKeAeDyc7bIkCsgBbbksvqsbYnTMTTsUYdO-NvFOQXYpHjijLY2Pt-q7Erw-RV-r0BQnJYJi62LiZnbNO5XgFAPzn5wP4RMjigfoLVzZilqOd-3gFUqQWDbSCq4m0nGY0SOsp7Q==
1, 752cf111-bf98-8a11-c403-1ed0fe0790f1, 31, 31, 15, 15, 255, 1063143, 3827314380, f4ac94549068cfdcb2a071dc49ad63e7acca8786204fb90d2e80685582f4f5d6, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, AHUs8RG_mIoRxAMe0P4HkPFkvrpvj3rk-NHLqb19HZb31epwPoaEWaK8tnI1vvPi8rRxh0eQOTpSp4V2l7qwyRJWnzrrwE391OzyEGH-Og379Or0WVr8PT9gfsdhiv_VxJ3cd7au-LgZP1A7IHlQrEL3rgJAD-dWIV9ydQT9UqYR5-y6j1sIj_4ij95tqAMVpPHge_4nOsI1ret0xvHsBn4hjr8v9WWmf5U4rn_wgA==
1, 752cf111-bf98-8a11-c403-1ed0fe0790f1, 31, 31, 15, 15, 255, 1063143, 3827314380, f4ac94549068cfdcb2a071dc49ad63e7acca8786204fb90d2e80685582f4f5d6, 3108f08b1485adb6f72cfba1b55c7484c906a2a3a0a027c78dcd991ca64c97bd, 045f802c016b2d14ef4d7ef01617c67c7506c0cd08aed3e4bcaf34ef5ffaddebb70a073d82c37bc874ce6705cec8b1c4a03b2ccd8f28b0c5034fb8774f2e97b1a4, AHUs8RG_mIoRxAMe0P4HkPHyclaFICuuvhq2JIKzQZzoiXQbSh1zyDaJk4_yr7VWcmHn6GQ492a03ojxGOL_o86rcmHHICl8jMTKBlYChEv52Ky_0u6BoAPOCVgIuOfhJcAKCKzJBGG6uvjZYR4=
0, 752cf111-bf98-8a11-c403-1ed0fe0790f1, 5, 10, 3, 3, 5, 1063143, 3827314380, f4ac94549068cfdcb2a071dc49ad63e7acca8786204fb90d2e80685582f4f5d6, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, AHUs8RG_mIoRxAMe0P4HkPHh6YxTkEqiG5b1OCT95jwnOBjIqk9uw-wwclaBBJQpfK_AF627JRRkvKi-jXCJhEdh0SrUzz7pq5_Q4AN2jJhzXZBg5EYwjsJ-e8oPuiITuR7dl3MIcGKOnsoE8ZAgB0WYtEnzIfliaKt7nn10yGKbTKHoUBgLfgB8U1YmXANIb8seOOCztqid_qOPp2BqtWSczt9XhM1AAHmP58rl4w==
1, 752cf111-bf98-8a11-c403-1ed0fe0790f1, 5, 31, 3, 1, 10, 1063143, 3827314380, f4ac94549068cfdcb2a071dc49ad63e7acca8786204fb90d2e80685582f4f5d6, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, AHUs8RG_mIoRxAMe0P4HkPEkCDCBdXLuAOuFMJw4ZwnAjCJAwfQK6cXy89BMN2PPfN63YaAULsy7LILYtkGtLintzA7kwEhGHwRfOCnXM1XZaLnquVl3XdJ47wKoX52QJyL82iKh5fiNpFUcMqvIO8jtLQwTwFanPFDBUBWaIHX2mdtY6gO97iwChRQp1wPiKjb61p376VgqKt4JIjK3O1k_PwnLr-asXuY5CkHSZw==
0, e3baa3ab-eb07-3d89-b78e-c9744a2f2c94, 5, 12, 0, 0, 3, 1063142, 3827311200, 00a9e6c03fbf6d523bf3a107d7f92b90a7ea2dda4f0c600d0bf788b1b4803ef1, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, AOO6o6vrBz2Jt47JdEovLJRIahZO-f9VdaNOcqlBrSggHNDPUb7tQ-US3mfslvxpcrw2nXXMbONs84MnvbkCDJvM-UW0ExHkZ2E-cfzpk2bbJJl1HOrUudq1DCTawOFGohH8ylErxos_J0xw606IRGZSpYl0JCHeJLsnGAiWAllhmE4Im-wzpqGlg-p8igLPpwRHnv9TF99ip89CPnXq8jDz7Aw_CSSQM3CsEDCu9A==
1, e3baa3ab-eb07-3d89-b78e-c9744a2f2c94, 31, 31, 15, 15, 255, 1063142, 3827311200, 00a9e6c03fbf6d523bf3a107d7f92b90a7ea2dda4f0c600d0bf788b1b4803ef1, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, AOO6o6vrBz2Jt47JdEovLJQY3mKy48JWJLpGM5RCcPjdSQZ-vEnNz0J056p1r-yIilQg32PjF6UShs-KI8e9FsZJarzIHGS1z1Rk9kKabWoFQ-Hk_AI3TD-kVEBMkPVi5tVpMjyjsdGTq_58FDyoSyKfiRvQI6Di-9APQfH--ZRrohCfgCPiuYsKe6vbdQPyzKWmLLF1X6W-5d7Qk0-zzkbLp3u2fH-L7qBtswmWhA==
1, e3baa3ab-eb07-3d89-b78e-c9744a2f2c94, 31, 31, 15, 15, 255, 1063142, 3827311200, 00a9e6c03fbf6d523bf3a107d7f92b90a7ea2dda4f0c600d0bf788b1b4803ef1, 3108f08b1485adb6f72cfba1b55c7484c906a2a3a0a027c78dcd991ca64c97bd, 045f802c016b2d14ef4d7ef01617c67c7506c0cd08aed3e4bcaf34ef5ffaddebb70a073d82c37bc874ce6705cec8b1c4a03b2ccd8f28b0c5034fb8774f2e97b1a4, AOO6o6vrBz2Jt47JdEovLJQQeh4d8fhXELncLYvzmHt0Vv59KvOTo7Xgle6nU-PgC9Yc5-Wuw6pBa_GJVja4iiVIdsi5jtPocuSvmPUDoNpABcRuycrPx4C5pUi1NH8dAYAZXk7gvIF8sUpbBho=
0, e3baa3ab-eb07-3d89-b78e-c9744a2f2c94, 5, 10, 3, 3, 5, 1063142, 3827311200, 00a9e6c03fbf6d523bf3a107d7f92b90a7ea2dda4f0c600d0bf788b1b4803ef1, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, AOO6o6vrBz2Jt47JdEovLJRMrtQSHtdIw4SWwjpZwgaaP0hss3e7tb1o1K91trODOtgJr8sH_MqP3l41KqPiTKD3uL45qafgFDRDJd12x5vTDNYX4jfknjJk5gZcwIz6-8pivqGoZNCZCxsQWf6jU5ABy0UqkkMRhBQUiAVvWZhpyP_vAcyvDvAXcYSRhQNEhzcT0h8R5h7oYQ__kmsyyrANYpQIjAPG0dphWyh9iw==
1, e3baa3ab-eb07-3d89-b78e-c9744a2f2c94, 5, 31, 3, 1, 10, 1063142, 3827311200, 00a9e6c03fbf6d523bf3a107d7f92b90a7ea2dda4f0c600d0bf788b1b4803ef1, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, AOO6o6vrBz2Jt47JdEovLJRObq-OEyPnRRSZaitQqH_IlvGvnQ6OpVmGlpiEEc8ww2ZPoZ_9iPXlxCfOuK6jkZB4YyEoL787Uwvmt20f6fYovxhuAR83Dzu4CEOoaDYyUaJF3pt74zwF4yels2k-sv01MKTsRvmc-42SUQV7zE7E0OKjU1hyNixUTmh3nwPWFZ39RLamBX14cTxjrtqgwisPsBSX2NA5f9Oi02u-eA==
0, 00a0d621-c6cc-eec4-b002-724b46b0b288, 5, 12, 0, 0, 3, 1063212, 3827564186, 5011f33849cb4edeb3113500ed0d4cc28380e70f50831ce5d72fa0eddb62cf47, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, AACg1iHGzO7EsAJyS0awsoih09G5zg2Q1Q9grDt3azi2Zql57Sg0PhM3P1tutih63YSFHmAx-Zf-A08-qcpzD9NEpm5iAE2th3JPvlAaGdUBPcqUavPVkg7gilWOrgdoZAIQzgyOfXmWO7OZ5GTPLsGHj7n-_8Ks6ywJ65od6OLFwH0WdR3Ie0P0Zp5f0AMmoQ8r2vEOIjQseKi5UVJSe170BudqYCm2V0mfrxl2FQ
1, 00a0d621-c6cc-eec4-b002-724b46b0b288, 31, 31, 15, 15, 255, 1063212, 3827564186, 5011f33849cb4edeb3113500ed0d4cc28380e70f50831ce5d72fa0eddb62cf47, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, AACg1iHGzO7EsAJyS0awsoitwWngdkyDWAb8lxfyFm2zB3ixSJpzUBqNZGjKVU7fSWVcdEXN_wx5Ee0SBKk66uncxhYsEawY2H1-zKlG8VuKZWDPDRNBWMdBkvrDpZ_ljnSKtlxOa-gLnx4XcQi27VBczXDSw-8Vg2ENsD7URA_OpJ43smtjBw1qY2BeuAMuSyHovyCNbO0qsYs70hxeiYyfgdn5rPo5TM8ItwjgLg
1, 00a0d621-c6cc-eec4-b002-724b46b0b288, 31, 31, 15, 15, 255, 1063212, 3827564186, 5011f33849cb4edeb3113500ed0d4cc28380e70f50831ce5d72fa0eddb62cf47, 3108f08b1485adb6f72cfba1b55c7484c906a2a3a0a027c78dcd991ca64c97bd, 045f802c016b2d14ef4d7ef01617c67c7506c0cd08aed3e4bcaf34ef5ffaddebb70a073d82c37bc874ce6705cec8b1c4a03b2ccd8f28b0c5034fb8774f2e97b1a4, AACg1iHGzO7EsAJyS0awsoihFgNUBa3MQ1fTk_y8NVkSQWR2ksg_y3qWd3qVWi6tnctNBQuVmNWujjFP-r04kDnINr3xY-1bPj2RKPUD_Tdm3u-qYgFBpsTfSc5_CkK-ot0uFly0d2CWhHaD_lI
0, 00a0d621-c6cc-eec4-b002-724b46b0b288, 5, 10, 3, 3, 5, 1063212, 3827564186, 5011f33849cb4edeb3113500ed0d4cc28380e70f50831ce5d72fa0eddb62cf47, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, AACg1iHGzO7EsAJyS0awsogi9c8olYAfHA0CCnWRVyLix5Yj4moGWQ58ecTTYTcvpli-nNyo8e6o0JoejdJsiofxn2gmWmbr6m1BZgF6ng4KOfyxT9v2GtMfwzIw3NZiPvNV88h-EgxgCxwBIxpEMxfzA5NDeV-h28dtEkAZt_wc0AL6frUP9xOJPJ6F-ALb5Hy0vbOucHTxB0eHwK3EdmaBPGS_tfQVkmuq1LE8gw
1, 00a0d621-c6cc-eec4-b002-724b46b0b288, 5, 31, 3, 1, 10, 1063212, 3827564186, 5011f33849cb4edeb3113500ed0d4cc28380e70f50831ce5d72fa0eddb62cf47, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, AACg1iHGzO7EsAJyS0awsohqvt_SCerZLHlKl6GsDDiS-eh9r7zBSjHNAmXrzkgYKfDV40p7SeAD17JvWMMgAx0wucXO48Upgoj2b0VMKAgtrbVYEwBwfnUZ-OEbWq4iGiHPMy_TjSF6_Ory2BzJOA9WtH-wn1oYjskTgqeGlVcrYt6sOVHYzs9tvMvIigJSbg7_l7xaQZv1EdcbqIQlhM5_6omKlVRYy7nomaSF1w
0, 6b96e28a-157d-3600-b332-a67d164f58eb, 5, 12, 0, 0, 3, 1063212, 3827563200, bcd9341f00496154e4ec6bdd13beabdd00b74d7e91d8bb669c1018aa4a930f63, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, AGuW4ooVfTYAszKmfRZPWOv7BLhJjJAE-0lqcmI0hf2wsJkIi3QAmkn2Fioe-0UQjxMo_Jjnqls_3qrbMQp5iN2MA84YKDs4-hY9nJzzTee8rHGRAUf6XusjeGK7NIg8kMCzNKQ_9fdb8GUcbBdpQOTHur0YkOonsQPITtyroybS9fPaOrZ02_iGa5zg8wOfJYDm_uUClL3rnd2EHq4ympZER8xzZDTpZgndjL4bpQ
1, 6b96e28a-157d-3600-b332-a67d164f58eb, 31, 31, 15, 15, 255, 1063212, 3827563200, bcd9341f00496154e4ec6bdd13beabdd00b74d7e91d8bb669c1018aa4a930f63, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, AGuW4ooVfTYAszKmfRZPWOsXyGWAibSNuzALNdX_sQIKFLKhDF4nCky5NMS1nHzeGx5lifa0h0ZK14ezUO8juKOTe4U8wqt21voXm79l2kUg2sxfXe4UvGMsoMGf5Wwdqamt1peUJR_H6MDhJ69qJggPJAzIWI60H79FrVgc08rYmTD8tGaEXE0AlyOEpQJDOo62IkX8pX0_RA0imZvXYwwifPUMb6l2VvgXXK0U3A
1, 6b96e28a-157d-3600-b332-a67d164f58eb, 31, 31, 15, 15, 255, 1063212, 3827563200, bcd9341f00496154e4ec6bdd13beabdd00b74d7e91d8bb669c1018aa4a930f63, 3108f08b1485adb6f72cfba1b55c7484c906a2a3a0a027c78dcd991ca64c97bd, 045f802c016b2d14ef4d7ef01617c67c7506c0cd08aed3e4bcaf34ef5ffaddebb70a073d82c37bc874ce6705cec8b1c4a03b2ccd8f28b0c5034fb8774f2e97b1a4, AGuW4ooVfTYAszKmfRZPWOtWao7_Vquza6Sq4-Xz9FGUboaK66fqjBxLbIkSmG7oS7_sX71gBQyjVqag0Vky8mYQJoBdVW0T4k5s0NkDfCRXJVwzzSI8MmPDsS0KpZNiULUb_PahOGSha-FuPM0
0, 6b96e28a-157d-3600-b332-a67d164f58eb, 5, 10, 3, 3, 5, 1063212, 3827563200, bcd9341f00496154e4ec6bdd13beabdd00b74d7e91d8bb669c1018aa4a930f63, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, AGuW4ooVfTYAszKmfRZPWOunuK3BK5ru_o4lL2wkx2fOu38wU_Jdrl34U_VduSGz2XHQdVzeXrqD7VKlPTQ36iD3DLl4cllJS9noJMcmTk8Npxia6LsDZfjo7w9Bj63Q1QPMtNj-P9Iv09iHOlCxJEirQhTcwXC6Fg-gh1ZI2WRYnRXYueydGghI478hqgKG4v6tpG6WBHOPQN3SC_JGblXkJsZ7N9ewoNxib4AAJw
1, 6b96e28a-157d-3600-b332-a67d164f58eb, 5, 31, 3, 1, 10, 1063212, 3827563200, bcd9341f00496154e4ec6bdd13beabdd00b74d7e91d8bb669c1018aa4a930f63, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, AGuW4ooVfTYAszKmfRZPWOtU5FgwFm_ynQ_yv-8QceVe4zPEQoqJNVxa_dSZ7QANnG5xNV7YsRg9Nfp-ahQWI7OcpTYM6rlUrA9h8wj2CNLe48v9B8IlT4vXbkO1y6sTRNNi0UNc1vWXh_Vg-kcsMkmwhWbJtup1AWIfVNoRt3DvUueHddNxhtQnuaq3gAOOu2WV1YHzIJhvX0zrwlS_v0eOjimklVFVPRjba-NFeA
locationPhone, locationRegion, locationPin, t_periodStart, SK_SA, PK_SA, SK_MCTA, PK_MCTA, lsp_base64
3380013000, 1, 012345, 3827314800, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, 3108f08b1485adb6f72cfba1b55c7484c906a2a3a0a027c78dcd991ca64c97bd, 045f802c016b2d14ef4d7ef01617c67c7506c0cd08aed3e4bcaf34ef5ffaddebb70a073d82c37bc874ce6705cec8b1c4a03b2ccd8f28b0c5034fb8774f2e97b1a4, AHUs8RG_mIoRxAMe0P4HkPECFz4EBvSjNNgHa2uyOppCfMETmZjLlAglrFyz98ml7GLc2uRfr10oPjV5plbsdu-YDXq7hf6D7CFUKeAeDyc7bIkCsgBbbksvqsbYnTMTTsUYdO-NvFOQXYpHjijLY2Pt-q7Erw-RV-r0BQnJYJi62LiZnbNO5XgFAPzn5wP4RMjigfoLVzZilqOd-3gFUqQWDbSCq4m0nGY0SOsp7Q==
001122334455667, 255, 012345, 3827314800, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, 3108f08b1485adb6f72cfba1b55c7484c906a2a3a0a027c78dcd991ca64c97bd, 045f802c016b2d14ef4d7ef01617c67c7506c0cd08aed3e4bcaf34ef5ffaddebb70a073d82c37bc874ce6705cec8b1c4a03b2ccd8f28b0c5034fb8774f2e97b1a4, AHUs8RG_mIoRxAMe0P4HkPFkvrpvj3rk-NHLqb19HZb31epwPoaEWaK8tnI1vvPi8rRxh0eQOTpSp4V2l7qwyRJWnzrrwE391OzyEGH-Og379Or0WVr8PT9gfsdhiv_VxJ3cd7au-LgZP1A7IHlQrEL3rgJAD-dWIV9ydQT9UqYR5-y6j1sIj_4ij95tqAMVpPHge_4nOsI1ret0xvHsBn4hjr8v9WWmf5U4rn_wgA==
33800130000, 21, 012345, 3827314800, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, 3108f08b1485adb6f72cfba1b55c7484c906a2a3a0a027c78dcd991ca64c97bd, 045f802c016b2d14ef4d7ef01617c67c7506c0cd08aed3e4bcaf34ef5ffaddebb70a073d82c37bc874ce6705cec8b1c4a03b2ccd8f28b0c5034fb8774f2e97b1a4, AHUs8RG_mIoRxAMe0P4HkPHh6YxTkEqiG5b1OCT95jwnOBjIqk9uw-wwclaBBJQpfK_AF627JRRkvKi-jXCJhEdh0SrUzz7pq5_Q4AN2jJhzXZBg5EYwjsJ-e8oPuiITuR7dl3MIcGKOnsoE8ZAgB0WYtEnzIfliaKt7nn10yGKbTKHoUBgLfgB8U1YmXANIb8seOOCztqid_qOPp2BqtWSczt9XhM1AAHmP58rl4w==
33800130000, 12, 543210, 3827314800, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, 3108f08b1485adb6f72cfba1b55c7484c906a2a3a0a027c78dcd991ca64c97bd, 045f802c016b2d14ef4d7ef01617c67c7506c0cd08aed3e4bcaf34ef5ffaddebb70a073d82c37bc874ce6705cec8b1c4a03b2ccd8f28b0c5034fb8774f2e97b1a4, AHUs8RG_mIoRxAMe0P4HkPEkCDCBdXLuAOuFMJw4ZwnAjCJAwfQK6cXy89BMN2PPfN63YaAULsy7LILYtkGtLintzA7kwEhGHwRfOCnXM1XZaLnquVl3XdJ47wKoX52QJyL82iKh5fiNpFUcMqvIO8jtLQwTwFanPFDBUBWaIHX2mdtY6gO97iwChRQp1wPiKjb61p376VgqKt4JIjK3O1k_PwnLr-asXuY5CkHSZw==
3380013000, 1, 012345, 3827311200, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, 3108f08b1485adb6f72cfba1b55c7484c906a2a3a0a027c78dcd991ca64c97bd, 045f802c016b2d14ef4d7ef01617c67c7506c0cd08aed3e4bcaf34ef5ffaddebb70a073d82c37bc874ce6705cec8b1c4a03b2ccd8f28b0c5034fb8774f2e97b1a4, AOO6o6vrBz2Jt47JdEovLJRIahZO-f9VdaNOcqlBrSggHNDPUb7tQ-US3mfslvxpcrw2nXXMbONs84MnvbkCDJvM-UW0ExHkZ2E-cfzpk2bbJJl1HOrUudq1DCTawOFGohH8ylErxos_J0xw606IRGZSpYl0JCHeJLsnGAiWAllhmE4Im-wzpqGlg-p8igLPpwRHnv9TF99ip89CPnXq8jDz7Aw_CSSQM3CsEDCu9A==
001122334455667, 255, 012345, 3827311200, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, 3108f08b1485adb6f72cfba1b55c7484c906a2a3a0a027c78dcd991ca64c97bd, 045f802c016b2d14ef4d7ef01617c67c7506c0cd08aed3e4bcaf34ef5ffaddebb70a073d82c37bc874ce6705cec8b1c4a03b2ccd8f28b0c5034fb8774f2e97b1a4, AOO6o6vrBz2Jt47JdEovLJQY3mKy48JWJLpGM5RCcPjdSQZ-vEnNz0J056p1r-yIilQg32PjF6UShs-KI8e9FsZJarzIHGS1z1Rk9kKabWoFQ-Hk_AI3TD-kVEBMkPVi5tVpMjyjsdGTq_58FDyoSyKfiRvQI6Di-9APQfH--ZRrohCfgCPiuYsKe6vbdQPyzKWmLLF1X6W-5d7Qk0-zzkbLp3u2fH-L7qBtswmWhA==
33800130000, 21, 012345, 3827311200, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, 3108f08b1485adb6f72cfba1b55c7484c906a2a3a0a027c78dcd991ca64c97bd, 045f802c016b2d14ef4d7ef01617c67c7506c0cd08aed3e4bcaf34ef5ffaddebb70a073d82c37bc874ce6705cec8b1c4a03b2ccd8f28b0c5034fb8774f2e97b1a4, AOO6o6vrBz2Jt47JdEovLJRMrtQSHtdIw4SWwjpZwgaaP0hss3e7tb1o1K91trODOtgJr8sH_MqP3l41KqPiTKD3uL45qafgFDRDJd12x5vTDNYX4jfknjJk5gZcwIz6-8pivqGoZNCZCxsQWf6jU5ABy0UqkkMRhBQUiAVvWZhpyP_vAcyvDvAXcYSRhQNEhzcT0h8R5h7oYQ__kmsyyrANYpQIjAPG0dphWyh9iw==
33800130000, 12, 543210, 3827311200, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, 3108f08b1485adb6f72cfba1b55c7484c906a2a3a0a027c78dcd991ca64c97bd, 045f802c016b2d14ef4d7ef01617c67c7506c0cd08aed3e4bcaf34ef5ffaddebb70a073d82c37bc874ce6705cec8b1c4a03b2ccd8f28b0c5034fb8774f2e97b1a4, AOO6o6vrBz2Jt47JdEovLJRObq-OEyPnRRSZaitQqH_IlvGvnQ6OpVmGlpiEEc8ww2ZPoZ_9iPXlxCfOuK6jkZB4YyEoL787Uwvmt20f6fYovxhuAR83Dzu4CEOoaDYyUaJF3pt74zwF4yels2k-sv01MKTsRvmc-42SUQV7zE7E0OKjU1hyNixUTmh3nwPWFZ39RLamBX14cTxjrtqgwisPsBSX2NA5f9Oi02u-eA==
3380013000, 1, 012345, 3827563200, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, 3108f08b1485adb6f72cfba1b55c7484c906a2a3a0a027c78dcd991ca64c97bd, 045f802c016b2d14ef4d7ef01617c67c7506c0cd08aed3e4bcaf34ef5ffaddebb70a073d82c37bc874ce6705cec8b1c4a03b2ccd8f28b0c5034fb8774f2e97b1a4, AACg1iHGzO7EsAJyS0awsoih09G5zg2Q1Q9grDt3azi2Zql57Sg0PhM3P1tutih63YSFHmAx-Zf-A08-qcpzD9NEpm5iAE2th3JPvlAaGdUBPcqUavPVkg7gilWOrgdoZAIQzgyOfXmWO7OZ5GTPLsGHj7n-_8Ks6ywJ65od6OLFwH0WdR3Ie0P0Zp5f0AMmoQ8r2vEOIjQseKi5UVJSe170BudqYCm2V0mfrxl2FQ
001122334455667, 255, 012345, 3827563200, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, 3108f08b1485adb6f72cfba1b55c7484c906a2a3a0a027c78dcd991ca64c97bd, 045f802c016b2d14ef4d7ef01617c67c7506c0cd08aed3e4bcaf34ef5ffaddebb70a073d82c37bc874ce6705cec8b1c4a03b2ccd8f28b0c5034fb8774f2e97b1a4, AACg1iHGzO7EsAJyS0awsoitwWngdkyDWAb8lxfyFm2zB3ixSJpzUBqNZGjKVU7fSWVcdEXN_wx5Ee0SBKk66uncxhYsEawY2H1-zKlG8VuKZWDPDRNBWMdBkvrDpZ_ljnSKtlxOa-gLnx4XcQi27VBczXDSw-8Vg2ENsD7URA_OpJ43smtjBw1qY2BeuAMuSyHovyCNbO0qsYs70hxeiYyfgdn5rPo5TM8ItwjgLg
33800130000, 21, 012345, 3827563200, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, 3108f08b1485adb6f72cfba1b55c7484c906a2a3a0a027c78dcd991ca64c97bd, 045f802c016b2d14ef4d7ef01617c67c7506c0cd08aed3e4bcaf34ef5ffaddebb70a073d82c37bc874ce6705cec8b1c4a03b2ccd8f28b0c5034fb8774f2e97b1a4, AACg1iHGzO7EsAJyS0awsogi9c8olYAfHA0CCnWRVyLix5Yj4moGWQ58ecTTYTcvpli-nNyo8e6o0JoejdJsiofxn2gmWmbr6m1BZgF6ng4KOfyxT9v2GtMfwzIw3NZiPvNV88h-EgxgCxwBIxpEMxfzA5NDeV-h28dtEkAZt_wc0AL6frUP9xOJPJ6F-ALb5Hy0vbOucHTxB0eHwK3EdmaBPGS_tfQVkmuq1LE8gw
33800130000, 12, 543210, 3827563200, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, 3108f08b1485adb6f72cfba1b55c7484c906a2a3a0a027c78dcd991ca64c97bd, 045f802c016b2d14ef4d7ef01617c67c7506c0cd08aed3e4bcaf34ef5ffaddebb70a073d82c37bc874ce6705cec8b1c4a03b2ccd8f28b0c5034fb8774f2e97b1a4, AACg1iHGzO7EsAJyS0awsohqvt_SCerZLHlKl6GsDDiS-eh9r7zBSjHNAmXrzkgYKfDV40p7SeAD17JvWMMgAx0wucXO48Upgoj2b0VMKAgtrbVYEwBwfnUZ-OEbWq4iGiHPMy_TjSF6_Ory2BzJOA9WtH-wn1oYjskTgqeGlVcrYt6sOVHYzs9tvMvIigJSbg7_l7xaQZv1EdcbqIQlhM5_6omKlVRYy7nomaSF1w
3380013000, 1, 012345, 3827563200, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, 3108f08b1485adb6f72cfba1b55c7484c906a2a3a0a027c78dcd991ca64c97bd, 045f802c016b2d14ef4d7ef01617c67c7506c0cd08aed3e4bcaf34ef5ffaddebb70a073d82c37bc874ce6705cec8b1c4a03b2ccd8f28b0c5034fb8774f2e97b1a4, AGuW4ooVfTYAszKmfRZPWOv7BLhJjJAE-0lqcmI0hf2wsJkIi3QAmkn2Fioe-0UQjxMo_Jjnqls_3qrbMQp5iN2MA84YKDs4-hY9nJzzTee8rHGRAUf6XusjeGK7NIg8kMCzNKQ_9fdb8GUcbBdpQOTHur0YkOonsQPITtyroybS9fPaOrZ02_iGa5zg8wOfJYDm_uUClL3rnd2EHq4ympZER8xzZDTpZgndjL4bpQ
001122334455667, 255, 012345, 3827563200, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, 3108f08b1485adb6f72cfba1b55c7484c906a2a3a0a027c78dcd991ca64c97bd, 045f802c016b2d14ef4d7ef01617c67c7506c0cd08aed3e4bcaf34ef5ffaddebb70a073d82c37bc874ce6705cec8b1c4a03b2ccd8f28b0c5034fb8774f2e97b1a4, AGuW4ooVfTYAszKmfRZPWOsXyGWAibSNuzALNdX_sQIKFLKhDF4nCky5NMS1nHzeGx5lifa0h0ZK14ezUO8juKOTe4U8wqt21voXm79l2kUg2sxfXe4UvGMsoMGf5Wwdqamt1peUJR_H6MDhJ69qJggPJAzIWI60H79FrVgc08rYmTD8tGaEXE0AlyOEpQJDOo62IkX8pX0_RA0imZvXYwwifPUMb6l2VvgXXK0U3A
33800130000, 21, 012345, 3827563200, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, 3108f08b1485adb6f72cfba1b55c7484c906a2a3a0a027c78dcd991ca64c97bd, 045f802c016b2d14ef4d7ef01617c67c7506c0cd08aed3e4bcaf34ef5ffaddebb70a073d82c37bc874ce6705cec8b1c4a03b2ccd8f28b0c5034fb8774f2e97b1a4, AGuW4ooVfTYAszKmfRZPWOunuK3BK5ru_o4lL2wkx2fOu38wU_Jdrl34U_VduSGz2XHQdVzeXrqD7VKlPTQ36iD3DLl4cllJS9noJMcmTk8Npxia6LsDZfjo7w9Bj63Q1QPMtNj-P9Iv09iHOlCxJEirQhTcwXC6Fg-gh1ZI2WRYnRXYueydGghI478hqgKG4v6tpG6WBHOPQN3SC_JGblXkJsZ7N9ewoNxib4AAJw
33800130000, 12, 543210, 3827563200, 34af7f978c5a17772867d929e0b800dd2db74608322d73f2f0cfd19cdcaeccc8, 04c14d9db89a3dd8da8a366cf26cd67f1de468fb5dc15f240b0d2b96dbdb5f39af962cb0bdc0bafcc9e523bf5cd4eba420c51758f987457954d32f1003bbaaf1c5, 3108f08b1485adb6f72cfba1b55c7484c906a2a3a0a027c78dcd991ca64c97bd, 045f802c016b2d14ef4d7ef01617c67c7506c0cd08aed3e4bcaf34ef5ffaddebb70a073d82c37bc874ce6705cec8b1c4a03b2ccd8f28b0c5034fb8774f2e97b1a4, AGuW4ooVfTYAszKmfRZPWOtU5FgwFm_ynQ_yv-8QceVe4zPEQoqJNVxa_dSZ7QANnG5xNV7YsRg9Nfp-ahQWI7OcpTYM6rlUrA9h8wj2CNLe48v9B8IlT4vXbkO1y6sTRNNi0UNc1vWXh_Vg-kcsMkmwhWbJtup1AWIfVNoRt3DvUueHddNxhtQnuaq3gAOOu2WV1YHzIJhvX0zrwlS_v0eOjimklVFVPRjba-NFeA
......@@ -118,7 +118,7 @@ export async function cleaRenewLSP(config) {
let output = await encrypt(header, msg, config.PK_SA);
// Convert output to Base64
return btoa((Array.from(new Uint8Array(output))).map(ch => String.fromCharCode(ch)).join('')).replace(/\+/g, '-').replace(/\//g, '_');
return btoa((Array.from(new Uint8Array(output))).map(ch => String.fromCharCode(ch)).join('')).replace(/\+/g, '-').replace(/\//g, '_').replace(/={1,2}$/, '');
}
......
......@@ -101,7 +101,7 @@ describe('cleaRenewLSP()', function () {
let result = await clea.cleaRenewLSP(conf);
logEncodingDataAndResult(conf, result);
expect([148, 236]).to.include(result.length);
expect([147, 234]).to.include(result.length);
expect(result.startsWith('AAAAAAAAAAAAAAAAAAAAAA')).to.be.true;
})
......@@ -110,13 +110,13 @@ describe('cleaRenewLSP()', function () {
describe('cleaStartNewPeriod()', function () {
describe('test suite for cleaStartNewPeriod()', function () {
runs.forEach(function (run) {
it('should return a result with 148 length', async () => {
it('should return a result with 147 length', async () => {
let conf = configurationFromRun(run);
let result = await clea.cleaStartNewPeriod(conf);
logEncodingDataAndResult(conf, result);
expect([148, 236]).to.include(result.length);
expect([147, 234]).to.include(result.length);
});
});
});
......
......@@ -70,35 +70,39 @@ async function got_content(data)
{
$("#qrcode_content").html(data);
var lsp_base64 = data.split("http://tac.gouv.fr?v=0#").join('');
lsp_base64 = lsp_base64.replace(/_/g, '/').replace(/-/g, '+');
var lsp = Uint8Array.from(atob(lsp_base64), c => c.charCodeAt(0));
var sk_sa = new Uint8Array($("#sk_sa").val().match(/.{1,2}/g).map(b => parseInt(b, 16)));
var sk_mcta = new Uint8Array($("#sk_mcta").val().match(/.{1,2}/g).map(b => parseInt(b, 16)));
var decoded =
try
{
version: -1,
lspType: -1,
LTId: "",
staff: false,
CRIexp: -1,
venueType: -1,
venueCategory1: -1,
venueCategory2: -1,
periodDuration: -1,
ct_periodStart: -1,
t_qrStart: -1,
LTKey: "",
locationMsg: null
}
var lsp_base64 = data.split("https://tac.gouv.fr?v=0#").join('');
if (data==lsp_base64) {
console.error("Bad url base" );
}
decoded.version = lsp[0] >>> 5;
decoded.lspType = (lsp[0] >>> 2) & 0x7;
decoded.LTId = buf2bn(lsp.slice(1, 17)).toString(16);
lsp_base64 = lsp_base64.replace(/_/g, '/').replace(/-/g, '+').replace(/={1,2}$/, '');
var lsp = Uint8Array.from(atob(lsp_base64), c => c.charCodeAt(0));
var sk_sa = new Uint8Array($("#sk_sa").val().match(/.{1,2}/g).map(b => parseInt(b, 16)));
var sk_mcta = new Uint8Array($("#sk_mcta").val().match(/.{1,2}/g).map(b => parseInt(b, 16)));
var decoded =
{
version: -1,
lspType: -1,
LTId: "",
staff: false,
CRIexp: -1,
venueType: -1,
venueCategory1: -1,
venueCategory2: -1,
periodDuration: -1,
ct_periodStart: -1,
t_qrStart: -1,
LTKey: "",
locationMsg: null
}
decoded.version = lsp[0] >>> 5;
decoded.lspType = (lsp[0] >>> 2) & 0x7;
decoded.LTId = buf2bn(lsp.slice(1, 17)).toString(16);
try
{
var dec = await decode(lsp.slice(0, 17), lsp.slice(17), sk_sa);
decoded.staff = ((dec[0] & 0x80) >>> 7);
......
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