View previous topic :: View next topic |
Author |
Message |
zile Advanced Cheater
Reputation: 0
Joined: 11 Jul 2009 Posts: 75
|
Posted: Mon Jun 27, 2011 11:01 am Post subject: RSA Encryption |
|
|
Im trying to emulate an RSA encryption of a password in C++
i logged that everytime i enter a password, the encrypted string will be different 256 characters, but the decryption routine is the same :
Code: | public final static String decryptRSA(final String EncryptedPassword) {
try {
Cipher cipher = Cipher.getInstance("RSA/NONE/OAEPPadding", "BC");
BigInteger modulus = new BigInteger("107657795738756861764863218740655861479186575385923787150128619142132921674398952720882614694082036467689482295621654506166910217557126105160228025353603544726428541751588805629215516978192030682053419499436785335057001573080195806844351954026120773768050428451512387703488216884037312069441551935633523181351");
BigInteger privateExponent = new BigInteger("5550691850424331841608142211646492148529402295329912519344562675759756203942720314385192411176941288498447604817211202470939921344057999440566557786743767752684118754789131428284047255370747277972770485804010629706937510833543525825792410474569027516467052693380162536113699974433283374142492196735301185337");
RSAPrivateKeySpec privKey1 = new RSAPrivateKeySpec(modulus, privateExponent);
PrivateKey privKey = RSAKeyFactory.generatePrivate(privKey1);
byte[] bytes = Hex.decode(EncryptedPassword);
cipher.init(Cipher.DECRYPT_MODE, privKey);
return new String(cipher.doFinal(bytes));
|
then i used olly to check the encryption function which is :
Quote: | push address to be written 256byte result[edx]
push realpass [eax]
push randomstringnumbers[ebp] ->778506580
push 320 bytes rsa key[ecx]
call RSAEncryptString |
320 bytes rsa key is always
Code: | 30819D300D06092A864886F70D010101050003818B0030818702818100A9A1F30427BCC7DAE19417DCD9B213882FE055FCB0FEAAD247B7AE8C8812D9C4B4AC3968E176ED97F8D299AA0DCECA52824030D892BE8F662BAC100C201B6D8DD175EFB42CC8E118F4200CE50A09D985A59E9E5484A901470F40EF5BF6C4F18C9F741ECCDB2540CCDC48C249F2E1FD3415E8A2B75CF52759FC4C81A0D70439C1020111 |
but the randomstringnumbers will always be different->althought if i change it to the previous number, it will still show login success
any help on encryptiong string with rsa on c++? |
|
Back to top |
|
 |
AhMunRa Grandmaster Cheater Supreme
Reputation: 27
Joined: 06 Aug 2010 Posts: 1117
|
Posted: Tue Jun 28, 2011 11:36 am Post subject: |
|
|
I'm not sure I fully understand what you are trying to accomplish. Are you trying to figure out why the previous key is still valid, or why the key never changes.
Could you please post the RSA package you are using and the calling code. _________________
<Wiccaan> Bah that was supposed to say 'not saying its dead' lol. Fixing >.> |
|
Back to top |
|
 |
zile Advanced Cheater
Reputation: 0
Joined: 11 Jul 2009 Posts: 75
|
Posted: Wed Jun 29, 2011 4:28 am Post subject: |
|
|
When i login, a packet is sent to the server with login id and encrypted password. the encrypted password string is always different everytime i login, but it will always be 256 characters ( even though my pass is only 5 characters long )
from what ive debugged it uses RSA encryption,
Code: | push address<to be written 256byte result>[edx]
push realpass<String> [eax]
push randomnumbers<String>[ebp] ->778506580(example)
push 320charactersKey<String>[ecx] ->the string is in first post
call RSAEncryptString |
how do i emulate this in C++ for example using Miracl? as in i want my program to be able to encrypt it the same way, although i dont mind if the encrypted string is always same..
:: the java code above is the decryption function i found for the encrypted string:: |
|
Back to top |
|
 |
AhMunRa Grandmaster Cheater Supreme
Reputation: 27
Joined: 06 Aug 2010 Posts: 1117
|
Posted: Wed Jun 29, 2011 10:38 am Post subject: |
|
|
Try this link for what you are wanting to do.
http://www.example-code.com/vcpp/rsa.asp _________________
<Wiccaan> Bah that was supposed to say 'not saying its dead' lol. Fixing >.> |
|
Back to top |
|
 |
zile Advanced Cheater
Reputation: 0
Joined: 11 Jul 2009 Posts: 75
|
Posted: Wed Jun 29, 2011 6:30 pm Post subject: |
|
|
thanks, will look into it.
edit: passwords are usually what base? |
|
Back to top |
|
 |
|