Triple DES Encryption
There is a key encrypted by Triple DES on C# 16 bytes. It must be decrypted in code written in Java, but Triple DES in java from the documentation follows:
Keysize must be equal to 112 or 168
Question is this real or not? It must be decrypted and encrypted.
0
1 answers
Well, that's right.
- The key in TripleDES is either 112 or 168 bits
- The block size is 64 bits (encryption is carried out in blocks of 64 bits)
- The original cipher is 2 bytes (128 bits)
- It follows that you have 2 blocks of 64 bits, so there is an encrypted key with a length of 112 bits.
I explain: 112 bits give 2 blocks of 64 bits, of which 64*2-112=16 bits are filled according to the chosen alignment algorithm.
You need to define the algorithm alignments - usually PKCS#5 or PKCS#7
Block chaining algorithm most likely ECB (on a small number of blocks, usually do not condescend to CBC)
Try this way:
Cipher c = Cipher.getInstance("TripleDES/ECB/PKCS5Padding");
0
Author: Barmaley, 2019-12-05 10:22:29