Questions tagged [block-cipher]

A block cipher is a keyed bijective function (also pseudo-random permutation). If your question is not directly related to programming, check if the question fits better on https://crypto.stackexchange.com/ or https://security.stackexchange.com/

136 questions
0
votes
1 answer

OutputLengthException in Rijndael impletation

I'm having a trouble with Rijndael encryption implementation with BouncyCastle API for Java. I'm getting the OutputLengthException when I execute cipher.doFinal(inputTextBytes, intOutOff);: org.bouncycastle.crypto.OutputLengthException: output…
TimeToCode
  • 901
  • 2
  • 16
  • 34
0
votes
1 answer

Is it possible to check for a specific cipher block mode support without providing a whole transform?

I have a unit test which passes in Java 8+ and fails on Java 7 because GCM mode doesn't seem to be supported in Java 7 and earlier. I know that I can attempt to Create a cipher with the transform e.g. AES/GCM/PKCS5Padding and catch…
Christopher Schultz
  • 20,221
  • 9
  • 60
  • 77
0
votes
0 answers

How to use Aria encryption algorithm in Bouncy Castle and C#

According to this and this page, Bouncy Castle library contains the implementation of Aria Cipher algorithm. but I could not find any documentation for how to use this algorithm in C# and the library? could someone please help me and describe how to…
0
votes
2 answers

How to control length of encrypted String (Cryptography - Encryption)

For example, i'd like to pass in a String "abc" then output encrypted string should be of 32 byte, and when I'd like to pass "abcdef" then output should be of 32 byte also. In other words I want fix length enrypted output. I know my upper limit.…
Asad Rao
  • 3,190
  • 1
  • 22
  • 26
0
votes
1 answer

Not able to initialize cipher.init()

I am trying to read a file of size 1KB, then encrypting and decrypting it with AES algorithm in CBC mode. When I am trying to initialize cipher it is throwing an error. Please find the code below. I could not find an init method in cipher class…
Siddharth Sinha
  • 578
  • 2
  • 15
  • 35
0
votes
2 answers

AES CTR without IV - same key for multiple messages - safe?

I want to make a web page in js that will encrypt plaintext, so I can send it to friend, who will use the same web page to decrypt it. We will share the same secret key and use it for multiple messages. I know that when using AES CBC- there needs to…
Adrian yo
  • 25
  • 2
  • 6
0
votes
0 answers

BouncyCastle Threefish - equal blocks ecnrypted equally

I am using Threefish of BouncyCastle directly, not via security API. byte[] key = new byte[1024]; ... byte[] tweak = new byte[16]; ... ThreefishEngine threefishEngine = new ThreefishEngine(1024); threefishEngine.init(true, new…
mentallurg
  • 4,967
  • 5
  • 28
  • 36
0
votes
1 answer

error in sign-in at Create Transaction blockcypher/php-client

here my code for create and sign and send $request = clone $tx; /// For Sample Purposes Only. $params = array( 'includeToSignTx' => 1, 'script_type'=>'mutlisig-n-of-m', ); $txClient = new…
Gaurav Gupta
  • 1,588
  • 2
  • 14
  • 21
0
votes
1 answer

bytes[] getIV() method is returning null value

I'm writing a code which will encrypt and decrypt the message(using DES algorithm), and both messages will be displayed in Dialog box. But when i run the code i got nullPointerException. And after debugging the code i realize the null data is…
pritam parab
  • 85
  • 2
  • 10
0
votes
1 answer

TDEA and CBC mode?

I am trying to get the hang of encryption diagrams and TDEA (Triple DES). I understand TDEA looks something like this: ciphertext = EK3(DK2(EK1(plaintext))) I also know a chain block cipher uses an IV to seed the encryption and the plain text before…
user427390
0
votes
2 answers

What's the purpose of the feedback loop while encrypting (DES)?

Does it make the encryption stronger? I thought it was used to make sure the ciphertext is more "random." It doesn't really make it any stronger, or so I think.
user427390
0
votes
0 answers

Key Interface & SecretKeySpec Concrete; Use Key or SecretKeySpec?

I've been writing javax.crypto.Cipher code and have had many questions answered by StackOverflow so I appreciate the information contained in this site. I did have a question I have not found an answer to on this site. The following code generates…
Mushy
  • 2,535
  • 10
  • 33
  • 54
0
votes
0 answers

AES Cipher - javax.crypto.IllegalBlockSizeException Input length must be multiple of 16 when decrypting with padded cipher

I created a class which encrypts and decrypts Strings using the AES Cipher. But when i run my encrypt method i get an javax.crypto.IllegalBlockSizeException error Complete Stack: javax.crypto.IllegalBlockSizeException: Input length must be multiple…
Error404
  • 719
  • 9
  • 30
0
votes
1 answer

cipher.doFinal(...) fails while cipher.update(...) succeeds

I am trying to decrypt a byte array using the following code. I left out exception handling and other practices for brevity: Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); byte[] key = getKey(); \\Assume it is implemented. byte[] iv =…
user181218
  • 1,655
  • 5
  • 28
  • 42
0
votes
2 answers

Getting keystream - Java Decryption

I am using Java's Cipher class for decryption. Couple of questions: Using DES decryption with OFB, for a multi-part decryption, is it possible to generate keystream in the first iteration but not use that keystream for the XORing but still feed…
Seb
  • 481
  • 2
  • 6
  • 18