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.

213 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
  • 191
  • 1
  • 2
  • 8
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
5
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
4
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
  • 376
  • 3
  • 17
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
  • 513
  • 8
  • 29
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
  • 7
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
  • 307
  • 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
  • 12
3
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
  • 181
  • 1
  • 2
  • 14
3
votes
0 answers

Using CBC DES encryption in java card

I am trying to encrypt data using Cipher class . I want to specify the initial vector so I use the following functions : try { cipherCBC = Cipher.getInstance(Cipher.ALG_DES_CBC_NOPAD, false); cipherCBC.init(k,…
Sara Sara
  • 259
  • 1
  • 5
  • 13
3
votes
1 answer

Bad crypto practice in Git-encrypt?

Comments on https://gist.github.com/shadowhand/873637 state "ECB mode encryption is a relatively simple method of encryption that provides a high level of obfuscation (or a low level of encryption). This method is not very secure and should not be…
Daniel
  • 1,446
  • 1
  • 20
  • 35
3
votes
1 answer

Decrypt MCRYPT_RIJNDAEL_256 with 32-byte initialization vectors with PyCrypto

I have data that was encrypted in PHP as follows: mcrypt_encrypt(MCRYPT_RIJNDAEL_256, SECRET, $data, MCRYPT_MODE_CBC, $iv) I need to decrypt this data in a Python 3 application. I am trying to use PyCrypto but I am open to other libraries. I expect…
gavinmh
  • 257
  • 3
  • 9
3
votes
3 answers

c++ to php translation, decryption function

So, I'm trying to translate a piece of C++ code to php. The C++ is from a external source, and my knowledge of both C++ and decryption is lacking, to say the least. The source C++ is: void parser_t::decrypt(buffer_t &replay_data, const unsigned char…
Cerbrus
  • 60,471
  • 15
  • 115
  • 132
1
2 3
14 15