English 中文(简体)
我的加密逻辑有什么错误?
原标题:What s wrong with my encryption logic?

我认为,我有几类加密,但出现了问题。

My client/server model is simple. The client connects to the server, sends any messages in the message queue and then disconnects.

发出的第一个电文是绝对的,但在发出后发出的任何电文似乎都是错误的(第16条示意图)。 奇怪的是,所有其他区块似乎都属于罚款,这非常奇怪,因为我是CBC。

生态环境:

encryptionAlgorithm = "AES";
encryptionBitCount = 256;
encryptionMessageLength = 176;
hashingAlgorithm = "PBEWithSHA256And256BitAES-CBC-BC";
hashingCount = //some number;
cipherTransformation = "AES/CBC/PKCS7Padding";
salt = //some bytes;

我的客户逻辑如下:

  • Init cipher via: cipher.init(Cipher.ENCRYPT_MODE, cipherInitKey);
  • Connect to server

每一信息都是信息查询。

  • Generate and write IV to socket via: stream.write(cipher.getParameters().getParameterSpec(IvParameterSpec.class).getIV());
  • Generate a write ciphertext to socket via: stream.write(cipher.doFinal(message));

结束

  • Disconnect

我的服务器工程逻辑如下:

收到的每 message

  • Read IV from socket (16 bytes).
  • Init the cipher by: cipher.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(iv));
  • Read the message from socket (its a fixed size). (176bytes)
  • Decipher message via cipher.doFinal(message)

结束

奇怪的是,它在当地与一家java客户和服务器完全合作。 但是,当我把服务器放在我的甚高频中,并有一个自发的客户时,它就会中断。

<>Update: 看来,在信息一开始,我实际上可能会遇到额外的障碍——进行更多的测试。

最佳回答

你们可能首先获得四位。 你们应当把首批 by作为四,然后与钥匙和特定的四条脱节。 这是一种常见的做法,将像你所描述的那样,确切表明问题。 你甚至可能跳出第一个产出组,而只是把以下各块作为平原案文(尽管这称作 ha)。 一件事是肯定的:如果你的第一辆汽车是垃圾,那那儿是四肢。

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签