All work

 
28 of 28

Encrypt issue using Base64, invalid character [=] in base64 string at position

Fixed

Description

regression caused by [LDEV-3818]

lucee/Lucee/blob/5.3/core/src/main/java/lucee/commons/digest/Base64Encoder.java#L126

 

lucee.runtime.exp.NativeException: invalid character [=] in base64 string at position [23]
at lucee.commons.digest.Base64Encoder.decode(Base64Encoder.java:126)
at lucee.runtime.coder.Base64Coder.decode(Base64Coder.java:75)
at lucee.runtime.coder.Coder.decode(Coder.java:62)
at lucee.runtime.crypt.Cryptor._crypt(Cryptor.java:117)
at lucee.runtime.crypt.Cryptor.crypt(Cryptor.java:64)
at lucee.runtime.crypt.Cryptor.encrypt(Cryptor.java:150)
at lucee.runtime.crypt.Cryptor.encrypt(Cryptor.java:165)
at lucee.runtime.functions.other.Encrypt.invoke(Encrypt.java:70)
at lucee.runtime.functions.other.Encrypt.call(Encrypt.java:47)

 

As discussed on dev.lucee.org

 

TryCF to replicate the issue:

Running that code in 4.5 works. Running it in 5 does not.

Anyone with base64 keys generated in 4.5 may have issues decrypting after upgrading. Issue arose between Lucee Version 5.3.8.201 and 5.3.9.141

Update there is a new precise argument, defaulting to true in 6, if you are encountering this problem, set precise to false

https://docs.lucee.org/reference/functions/encrypt.html#argument-precise

Environment

Windows 2019 Server
Apache Tomcat/9.0.40
Java 11.0.11 (AdoptOpenJDK) 64bit
Lucee Version 5.3.8.201 vs 5.3.9.141

Details

Assignee

Reporter

Priority

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Affects versions

Created 26 July 2022 at 22:11
Updated 7 May 2025 at 12:03
Resolved 8 August 2022 at 12:25

Activity

Zac Spitzer 
7 May 2025 at 11:49
(edited)

Pothys - MitrahSoft 
9 August 2022 at 07:40

Zac Spitzer 
8 August 2022 at 12:32

Pothys - MitrahSoft 
8 August 2022 at 12:25

I checked this ticket with the lucee fixed versions. Now using precise argument, encrypt(), decrypt(), encryptBinary(), decryptBinary() works fine as expected.

Pothys - MitrahSoft 
8 August 2022 at 12:06

I added a tests to Encrypt(), Decrypt(), encryptBinary(), decryptBinary() with precise argument
Pull Request: