Questions tagged [ecb]

ECB (Electronic Code Book) is a degenerate mode of operation for block ciphers.

Electronic Codebook mode (ECB) is a mode of operation for block ciphers that involves dividing the message into blocks and encrypting each block independently.

ECB mode encryption

It is the simplest mode of operation, but is considered very weak. Identical plaintext blocks are encrypted into identical ciphertext blocks, which makes it easy for an attacker to circumvent its security. As such, it is not recommended to be used for any secure system. Instead, a secure mode such as Cipher-Block Chaining (CBC) or Counter (CTR) mode should be chosen.

Why ECB is not secure?

ECB is not semantically secure because identical blocks of plaintext will be encrypted to the same ciphertext block. This vulnerability helps the attacker to find out plaintext patterns.

141 questions
1
vote
0 answers

MARS/ECB/NoPadding and IllegalBlockSizeException

I'm using IBM SDK Java Technology Edition and the code below: KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA"); SecureRandom random = SecureRandom.getInstance("IBMSecureRandom", "IBMJCE"); …
1
vote
2 answers

Matching PHP AES 128 ECB encryption with C#

I have the following PHP sample that I'm trying to mimic in C#. It is using AES 128bit ECB encryption with PKCS7 padding: $trust_jsonString="hello"; echo "input: '" . $trust_jsonString . "'\n"; echo "input (dump): " . var_dump($trust_jsonString) .…
1
vote
1 answer

Size of decrypted data with AES/ECB

Is there a way to figure out the original size of AES/ECB decrypted binary (0x00 is not the end) data without storing it explicitly?
andrey
  • 1,515
  • 5
  • 23
  • 39
1
vote
0 answers

Does openssl's low level API automatically add padding?

I know that block cipher mode such as ecb and cbc requires padding. I also know that openssl command line tool can switch between add padding/no padding. But does openssl's low level API automatically add padding? Specifically DES_ecb3_encrypt() /…
dhchen
  • 1,178
  • 2
  • 10
  • 24
1
vote
1 answer

How to implement Blowfish ECB algorithm PKCS5 Padding in iOS

I have googled a lot but enable to get Blowfish ECB algorithm with PKCS5 padding in Objective-C. I have tried code from here but it is not giving me proper encrypted data. Even I have tried codes from here but it is not with PKSC5…
Chetan Koli
  • 178
  • 15
1
vote
1 answer

ios decrypt base64 encoded string using des ecb

I am trying to decrypt a string that was first encrypted using des in ecb mode, and then encoded in base64. This is my code: + (NSString *)decrypt:(NSString *)encryptedText { NSString *key = @"12345678"; NSData *decodedData = [[NSData…
Atul Bhatia
  • 1,633
  • 5
  • 25
  • 50
1
vote
2 answers

Simple DES ECB encryption and decryption in C#

I am trying to do an exercise which includes to decrypt a given encrypted session key with a given shared key. I have decrypted the session key and printed the byte array on screen. (Same result is printed when ever I run the program). Then to…
user2307236
  • 665
  • 4
  • 19
  • 44
1
vote
1 answer

Electronic Code Book(ECB) Mode applications

In most of the places there are descriptions of what is ECB, but not the actual usage of it. I'm unable to find the uses of ECB. What are the useful applications of ECB mode? (Real time applications or any other)
prime
  • 14,464
  • 14
  • 99
  • 131
1
vote
1 answer

Is ECB a safe option if you don't expect duplicate results?

I want to encrypt long paragraphs of text using Rijndael-256 (the text has been compressed and converted to base64 before this). It is very unlikely for the two to be the same. But if they happen to be, would adding a random key to the start or end…
Anon
  • 45
  • 1
  • 6
1
vote
0 answers

Is ECB safe if you don't expect duplicate results?

I want to encrypt long paragraphs of text using Rijndael-256 (the text has been compressed and converted to base64 before this). It is very unlikely for the two to be the same. But if they happen to be, would adding a random key to the start or end…
Anon
  • 45
  • 1
  • 6
1
vote
1 answer

Wrong encryption/decryption for specific string using PHP mcrypt_encrypt

I came across a strange problem with encryption/decryption in PHP. Look at the code below:
keepkimi
  • 373
  • 3
  • 12
1
vote
2 answers

DES ECB C# encryption/decryption

I have a problem with decryption of data previously encrypted. I am using the sequential encrypt-decrypt-encrypt with three different keys to get triple des effect. The encryption function works correctly (returns 8-byte array), but the decryption…
user1421600
  • 11
  • 1
  • 2
0
votes
1 answer

BadPaddingException when reading CipherInputStream during decryption

I'm new to Java cryptography and don't know why I keep getting BadPaddingException when attempting to decrypt a file that I have successfully encrypted, using the same key and IV for both. I am adding the 16-byte IV to the beginning of the…
iceyjc
  • 3
  • 3
0
votes
1 answer

Trying to encrypt communication with ESP32 (PlatformIO). esp_aes_crypt_ecb fails on the last block

I am trying to encrypt data from ESP32 to an Internet webpage. The plain text is 31 characters long and will need 3 blocks of 16 characters. The 2 first blocks encrypts fine, but the last one fails. The last block is terminated by a 0 in spec for…
Geir
  • 3
  • 2
0
votes
0 answers

How to fix HTTP error 407 when using ECB package in R?

I am using currently the package "ecb", which leverages the package "curl" in order to retrieve data from the ECB Data Warehouse website. The called function is df <- get_data("MIR.M.AT.B.L21.A.R.A.2230.EUR.N") but I am getting the following…