Comments (4)
back() function was introduced in Qt 5.10. you can replace with :
ret.remove(ret.length() - ret.at(ret.length()-1), ret.at(ret.length()-1));
from qt-aes.
QByteArray QAESEncryption::RemovePadding(const QByteArray &rawText, QAESEncryption::Padding padding)
{
if (rawText.isEmpty())
return rawText;
QByteArray ret(rawText);
switch (padding)
{
case Padding::ZERO:
//Works only if the last byte of the decoded array is not zero
while (ret.at(ret.length()-1) == 0x00)
ret.remove(ret.length()-1, 1);
break;
case Padding::PKCS7:
ret.remove(ret.length() - ret.back(), ret.back());//what is the fuction--"back()"?
break;
case Padding::ISO:
{
// Find the last byte which is not zero
int marker_index = ret.length() - 1;
for (; marker_index >= 0; --marker_index)
{
if (ret.at(marker_index) != 0x00)
{
break;
}
}
// And check if it's the byte for marking padding
if (ret.at(marker_index) == static_cast<char>(0x80))
{
ret.truncate(marker_index);
}
break;
}
default:
//do nothing
break;
}
return ret;
}
from qt-aes.
Thanks!
from qt-aes.
I should maybe add a check on Qt version to avoid this
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.