Skip to content

fix: encode base64 string as a single line during encryption#4

Merged
tmknom merged 1 commit intomainfrom
fix/add-support-for-long-text
Jan 20, 2025
Merged

fix: encode base64 string as a single line during encryption#4
tmknom merged 1 commit intomainfrom
fix/add-support-for-long-text

Conversation

@tmknom
Copy link
Copy Markdown
Owner

@tmknom tmknom commented Jan 20, 2025

If the encrypted string is long, the following error may occur during decryption:

bad decrypt
40C795C66F7F0000:error:1C800064:Provider routines:ossl_cipher_unpadblock:bad decrypt:../providers/implementations/ciphers/ciphercommon_block.c:124:

To prevent this error, use the -A flag during decryption.
The -A flag ensures that the Base64-encoded string is written as a single line without line breaks.
For more details, refer to the following documentation:

The document notes:

These flags tell OpenSSL to apply Base64-encoding before or after the cryptographic operation.
The -a and -base64 are equivalent. If you want to decode a base64 file it is necessary to use the -d option.
By default the encoded file has a line break every 64 characters.
To suppress this you can use in addition to -base64 the -A flag.
This will produce a file with no line breaks at all. You can use these flags just for encoding Base64 without any ciphers involved.

If the encrypted string is long, the following error may occur during decryption:

```
bad decrypt
40C795C66F7F0000:error:1C800064:Provider routines:ossl_cipher_unpadblock:bad decrypt:../providers/implementations/ciphers/ciphercommon_block.c:124:
```

To prevent this error, use the -A flag during decryption.
The -A flag ensures that the Base64-encoded string is written as a single line without line breaks.
For more details, refer to the following documentation:

- [OpenSSL Base64 Encoding Documentation](https://wiki.openssl.org/index.php/Enc#Base64_Encoding)

The document notes:

> These flags tell OpenSSL to apply Base64-encoding before or after the cryptographic operation.
> The -a and -base64 are equivalent. If you want to decode a base64 file it is necessary to use the -d option.
> **By default the encoded file has a line break every 64 characters**.
> To suppress this you can use in addition to -base64 the -A flag.
> This will produce a file with no line breaks at all. You can use these flags just for encoding Base64 without any ciphers involved.
@github-actions github-actions Bot added bug Something isn't working test action workflows labels Jan 20, 2025
@tmknom tmknom merged commit f82452a into main Jan 20, 2025
@tmknom tmknom deleted the fix/add-support-for-long-text branch January 20, 2025 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action bug Something isn't working test workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant