'Openssl 'bad decrypt' error because of 'nopad' option - when encrypting

I am executing an openssl (v1.0.2g) command to ENCRYPT ONLY using the -iv and -K options.

The text to encode is exactly 32 characters long. It successfully encodes using aes-256-cbc.

Then : when I make single change to the command line, adding the -nopad option, I get this error:

bad decrypt 140406084495000:error:0607F08A:digital envelope routines:EVP_EncryptFinal_ex:data not multiple of block length:evp_enc.c:425:

IF the incoming text is 32 characters long (a multiple of 16), why do I get this error?

Looking at the openssl source I can see that the "bad decrpt" error can be generated by both encrypt and decrypt.

My main question is, why does "-nopad" make openssl not like the length of my text, if that is what is happening?


The commands:

echo "0123456789ABCDEF0123456789ABCDEF" | openssl aes-256-cbc -e -iv "30313233343536373839414243444546" -K "3031323334353637383941424344454630313233343536373839414243444546" | xxd

00000000: ab0b 2101 074b ea27 96fe 5f46 8df6 f1db
00000010: 2169 e9ad 8052 2817 7d2f bf07 9bc0 a340
00000020: 2151 1aa6 0f1e 47aa 66cb da8e 8be9 bd0c


This is where I add "-nopad"

echo "0123456789ABCDEF0123456789ABCDEF" | openssl aes-256-cbc -e -nopad -iv "30313233343536373839414243444546" -K "3031323334353637383941424344454630313233343536373839414243444546" | xxd

bad decrypt

140406084495000:error:0607F08A:digital envelope routines:EVP_EncryptFinal_ex:data not multiple of block length:evp_enc.c:425:

00000000: ab0b 2101 074b ea27 96fe 5f46 8df6 f1db
00000010: 2169 e9ad 8052 2817 7d2f bf07 9bc0 a340



Solution 1:[1]

  1. Open your inspector via right click "inspect".
  2. Then select the element you are targeting.
  3. Next look at the classes it has
  4. search if bootstrap has those classes to via their documentation or via google

Manual labor required. Sorry.

Solution 2:[2]

I don't know if VSCode has a built in check but you can always just type in the class at the search bar at https://getbootstrap.com/docs/5.1/getting-started/introduction/ and if it shows something there it is a bootstrap class.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Frizzant
Solution 2 compsi