作者:天涯使者2602921991 | 来源:互联网 | 2023-05-18 03:34
Iamusingbouncycastlelibraryforencryptionanddecryptioninc#andIwaswonderinghowtodeal
I am using bouncy castle library for encryption and decryption in c# and I was wondering how to deal with plain text smaller than block size?
我在c#中使用充气城堡库进行加密和解密,我想知道如何处理小于块大小的纯文本?
here is what I have done so far:
这是我到目前为止所做的:
AesFastEngine engine = new AesFastEngine();
GcmBlockCipher cipher = new GcmBlockCipher(engine);
AeadParameters param = new AeadParameters(new KeyParameters(key), 128, iv, null);
cipher.Init(true, parameters);
byte[] encData = new byte[plain.Length];
cipher.ProcessBytes(plain, 0, plain.Length, encData, 0);
when the plain data is smaller then block size it does nothing.
当普通数据小于块大小时,它什么都不做。
1 个解决方案