Comments (9)
The encrypted block has to be a multiple of 16, in your case being 17 bytes it adds 15 bytes of padding to make it 32 (16*2).
I'll look into a solution asap.
from qt-aes.
I could add 2 info:
1- If I use PKCS5Padding in Java, after 17 corrects bytes, 15 bytes @ 0xff are added at the byte array
2- the problem is present also when I send from qt to Java ...
Thank’s again for all
from qt-aes.
Let me understand, AES says that the lenght of the block to decipher has to be a multiple of 16, you can handle the padding yourself by adding something to match this requirement or let the software do it (if you are using a string with termination char let the class handle it works well).
I don't use Java since a while, if you cipher the string in java, how many bytes in total you end up with? 32 or 17?
from qt-aes.
I try to explain better:
in Java I could init Chiper in this way:
m_encChiper = Cipher.getInstance("AES/CFB/NoPadding");
so no padding is managed and if I crypt something that out of the encrypt function result an array of 17 bytes, this is my result.
If I pass this array to java decrypt function I obtain the original String.
If I pass this array to your
encryption->decode(xMsg, hashKey, iv)
where xMsg is the 17 lenght byte array, I have my original string followed by 15bytes of non sense added as I indicated in the initial post.
So I could not find a way to manage padding in your library so I try to init my java Chiper to:
m_encChiper = Cipher.getInstance("AES/CFB/PKCS5PADDING");
I'm not sure CFB with padding have sense.. but I tried and when I decode in Qt the result is my original String followed bt 15 bytes all at 0x00ff.
I don't handle padding by myself, Java api did it for me .. but in NoPadding mode, the result of encrypt is not an array with a lenght multiple of 16 bytes.
Is there a way to set your library to NoPadding??
Thank's again.
from qt-aes.
Can't you tell Java to use a zero-filled padding?
I think I can add PKCS5PADDING and other form of padding.
from qt-aes.
Thank's very much, very nice suggestion,
initializing Chiper as following:
m_encChiper = Cipher.getInstance("AES/CFB/ZeroBytePadding");
java pad the coded string in the way in witch your library works!
Thank's againg, probably padd management could be added to your wonderful work!
Bye
from qt-aes.
Happy that it worked.
Please remember that my AES code is not audited or tested.
from qt-aes.
Yes for sure, I’ve used it to study a server simulator that works behind my app... first tests works, If can my experience with it contribute to test I’m happy..
from qt-aes.
I added PKCS7 and ISO padding, can you check them against Java?
from qt-aes.
Related Issues (20)
- Can't run in 32bit Qt HOT 5
- Suggestion: Function to check validity of encoded data OR make the decode() method not crash app on invalid data HOT 12
- compatibility with openssl issue HOT 4
- use HOT 2
- It will crash in MinGW32 HOT 1
- Supporting GCM HOT 1
- Regarding the problem that the padding is not removed after decryption HOT 2
- Support protocol buffers (protobuf) HOT 1
- AES implementation is really slow for big data HOT 1
- Decrpytion with AES-NI not working HOT 5
- AES CFB Without padding HOT 3
- Convert QByteArray to QString HOT 1
- App broken with msvc compiler in last version HOT 3
- suggest to add more check to decode() method paremeters
- <Suggestion: Expand beyond Qt-AES> HOT 2
- AES-NI вопрос? AES-NI question? HOT 1
- QAESEncryption Level is not working HOT 3
- Question about qt-secret usage. HOT 2
- Adding Salt ?
- Question about : Heap corruption detected: after normal block..... HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qt-aes.