Questions tagged [cbc-mode]

CBC Mode is cipher block chaining.

CBC mode was originally specified by NIST in FIPS 81. The standard, issued in 1981, only offers confidentiality. Other modes, such as CCM and GCM, offer authenticated encryption which places an integrity assurance over the encrpyted data.

In CBC mode, an initialization vector must be used in the first block of plaintext. Then each subsequent block of plaintext is XORed with the previous ciphertext block before being encrypted thus making all the blocks dependent on all the previous blocks. This means that in order to find the plaintext of a particular block, you need to know the ciphertext, the key, and the ciphertext for the previous block.

247 questions
17
votes
4 answers

How to detect block cipher mode

How to detect if a message was crypt by CBC or ECB mode? I have made a function who encrypt in AES 128 CBC or ECB randomly, and I do hamming between clear text and cipher text, but seams not correlated to cipher mode. How can I detect the block…
Xantra
  • 223
  • 1
  • 3
  • 8
12
votes
1 answer

AES decryption padding with PKCS5 Python

I have been trying to implement AES CBC decryption in Python. Since the ciphered text is not a multiple of 16bytes, padding was necessary. Without padding, this error surfaced "TypeError: Odd-length string" But I could not find a proper reference…
empyreanphoenix
  • 301
  • 2
  • 3
  • 8
8
votes
2 answers

Does AES/CBC really require IV parameter?

I am writing a simple app to encrypt my message using AES / CBC (mode). As my understanding CBC mode requires IV parameter but I don't know why my code work without IV parameter used. Anyone can explain why? Thanks. The encrypted message printed:…
user3078555
6
votes
1 answer

What default parameters uses OpenSSL -pbkdf2?

I encrypted a file with this command: openssl enc -aes-192-cbc -e -pbkdf2 -in -out -pass pass: Now I'm trying to do decrypt it in c and to take advantage of pbkdf2 I'm using the function: int PKCS5_PBKDF2_HMAC (const…
Valerio Coretti
  • 147
  • 2
  • 8
6
votes
2 answers

Golang: How do I decrypt with DES, CBC, and PKCS7?

Currently trying to figure out why my decryption method is not working. I used DES, CBC, and PKCS7Padding to encrypt my string. My current code outputs panic: crypto/cipher: input not full blocks during decryption.
phil o.O
  • 406
  • 2
  • 4
  • 20
6
votes
2 answers

How to alter CBC encrypted text to change the message

I'm currently in the process of learning about encryption and i'm hoping to find more clarification on what I learned. Suppose the message "100 dollars should be moved from account 123456 to 555555" was encrypted using aes-128-cbc and a random IV.…
Katie Paige
  • 63
  • 1
  • 8
4
votes
1 answer

How to use AES Encryption and Decryption from Scala to Python

I have a code in scala where I have my encryption and decryption code, It works fine and the code is: import java.util.Base64 import javax.crypto.Cipher import javax.crypto.spec.{IvParameterSpec, SecretKeySpec} class Encryption { val key =…
Mohammad Rijwan
  • 335
  • 3
  • 17
4
votes
1 answer

Can I decrypt only part of file encrypted with AES/CBC in Java?

How would I go about this? I have code encrypting a file using AES/CBC/PKCS5Padding in Java and as I understand form this picture: Partial decryption should be possible having part of ciphertext used by preceding block and the key. I have not found…
ed22
  • 1,127
  • 2
  • 14
  • 30
4
votes
1 answer

AES-CBC 128, 192 and 256 encryption decryption in Python 3 using PKCS#7 padding

I have searched a lot on SO about complete encryption decryption example with my requirement. In fact, I've got many links and examples but None is working for me for AES-192-CBC mode and AES-256-CBC. I have got following example which is supposed…
Nilesh Vora
  • 191
  • 1
  • 3
  • 14
4
votes
1 answer

Does AES_cbc_encrypt add padding?

Consider the following snippet of C++ code: #include #include #define AES_KEY_LENGTH 32 using namespace std; int main() { AES_KEY encryption_key; AES_KEY decryption_key; unsigned char key[AES_KEY_LENGTH] =…
Matteo Monti
  • 8,362
  • 19
  • 68
  • 114
4
votes
1 answer

Java AES with CBC using passphrase

I want to implement 256 key AES with CBC encryption with Java. Recipient sent me 256 bit passphrase as a String 'absnfjtyrufjdngjvhfgksdfrtifghkv' and it perfectly works using this openssl command: echo test | openssl enc -aes-256-cbc -a -k…
Marina Sovic
  • 167
  • 2
  • 9
3
votes
1 answer

VBA AES CBC encryption

I have referred encryption in https://github.com/susam/aes.vbs and below is the code i endup with Function Min(a, b) Min = a If b < a Then Min = b End Function Function B64Encode(bytes) Dim result As String Dim b64Block() As Byte …
Pat
  • 535
  • 1
  • 16
  • 41
3
votes
1 answer

AES decrypt text in java, encrypted in C#

I have to decrypt text in JAVA, encrypted in C# (AES, RijndaelManaged). After several days of reading and searching solutions, and a lot of stackoverflow solutions tested, i still have a problem unsolved. I apply C# code here (which is working)…
Sali Manaf
  • 166
  • 1
  • 9
3
votes
0 answers

Python Implement AES in CBC encryption mode

I'm trying to complete this challenge online which asks to implement ourselves the AES CBC mode without using any library function that will do the job for me (ofc xD). I'm using python3.7 and PyCrypto for the AES modules (I'm a python beginner…
Cjdcoy
  • 317
  • 1
  • 2
  • 12
3
votes
1 answer

Is there any secure improvement if I hash IV value?

I generate randomly IV value everytime I encrypt when doing AES/CBC. private static IvParameterSpec getRandomIvParameterSpec() { byte[] iv = new byte[16]; new SecureRandom().nextBytes(iv); return new IvParameterSpec(iv); } And I concat…
hanjoonk
  • 163
  • 1
  • 1
  • 13
1
2 3
16 17