Comments (5)
I did't get padding bytes using System.Security.Cryptography of .NET Framework with those code
var rijndaelManaged = new RijndaelManaged();
rijndaelManaged.Mode = CipherMode.CBC;
rijndaelManaged.IV = s_EmptyIv16;
rijndaelManaged.Key = GeneratePkgListKey(flag, fileName);
var decryptor = rijndaelManaged.CreateDecryptor();
var outBuffer = decryptor.TransformFinalBlock(inBuffer, 0, inBuffer.Length);
I guess you just misconfigured crypto options.
from uncso2.
Or your could remove the extra padding by hand:
uint32_t GetRealBufferSize(uint8_t* pOutBuffer, size_t iBufferSize)
{
uint8_t currentByte = 0;
int paddingLength = 0;
for (int i = iBufferSize - 16; i < iBufferSize; i++)
{
if (pOutBuffer[i] != currentByte)
{
currentByte = pOutBuffer[i];
paddingLength = 1;
}
else
{
paddingLength++;
}
}
return iBufferSize - paddingLength;
}
if ( !DecryptEncFile( targetFile, pBuffer, iBufferSize ) ) { /* ... */ }
iBufferSize = GetRealBufferSize(pBuffer, iBufferSize);
That's working.
from uncso2.
Wouldn't that not work if the padding bytes are different? What if a file for ends with ////////////////
?
from uncso2.
Wouldn't that not work if the padding bytes are different? What if a file for ends with
////////////////
?
The game is using PKCS7 padding mode, after some searching I find that all the padding byte will be the length of padding data, That function is not needed anymore.
iBufferSize -= pOutBuffer[iBufferSize - 1] ;
The padding modes I searched on internet: (DD is random data, after that is padding bytes, 05 is size of padding bytes)
ANSI X.923
| DD DD DD DD DD DD DD DD | DD DD DD 00 00 00 00 05 |
ISO 10126
| DD DD DD DD DD DD DD DD | DD DD DD 95 81 28 A7 05 |
PKCS7
| DD DD DD DD DD DD DD DD | DD DD DD 05 05 05 05 05 |
But the Zero mode is padding with 0 and ISO/IEC 7816-4 is using the 0x80 as mark of start, then padding with 0:
ISO/IEC 7816-4
| DD DD DD DD DD DD DD DD | DD DD DD 80 00 00 00 00 |
Zero padding
| DD DD DD DD DD DD DD DD | DD DD DD 00 00 00 00 00 |
from uncso2.
Should be fixed in Release v2.0.4
from uncso2.
Related Issues (12)
- Translate Client HOT 2
- The program crashes when I install the .txt file HOT 6
- Decrypt TFO data HOT 11
- UnCSO2 Crashing when attempting to open .pkg files HOT 6
- [Linux] AppImage and build errors. HOT 5
- 1.4.4 does not works on Nexon server files
- Program crash / Exit, no error. HOT 2
- Compatibility with Taiwanese client HOT 1
- Possibility to support Titanfall Online (Nexon)? HOT 8
- When will we be able to repack these files? Is there still a way to do it? HOT 13
- Problems when loading TFO data HOT 9
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 uncso2.