Commit 01ebab20 authored by Cypres TAC's avatar Cypres TAC
Browse files

java padding update

parent 87b3e733
Pipeline #238285 passed with stages
in 9 minutes and 52 seconds
......@@ -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,10 @@ public class LocationSpecificPartDecoder {
* @throws CleaEncodingException
*/
public LocationSpecificPart decrypt(String lspBase64) throws CleaEncryptionException, CleaEncodingException {
/* Change eventual safe url padding */
lspBase64 = lspBase64.replace("%3D", "=");
lspBase64 = lspBase64.replace("%3d", "=");
/* 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);
......
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