![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
|
i'm trying to do TripleDES with no padding in the CryptoAPI going off this article here: http://www.di-mgt.com.au/cryptopad.html#example3des which lists these expected results: Example using Triple DES with key 0x0123456789ABCDEFFEDCBA987654321089ABCDEF01234567 3DES INPUT BLOCKS: 12345376 06666665 55551205 3DES OUTPUT: 7ADE45981580DB32 421E3D90B5B47D5B 1175FA3DD8B932D7 using an 8 byte IV of all zero. if i take the 1st block and encrypt it with the CryptoAPI. then i get 7ADE45981580DB32 (as expected) plus 8 more bytes of padding. ok, so if i want to encrypt with no padding, i just do that for 8 block chunks and strip off the trailing 8 each time. so that should be compatible with the desktop. but the problem is when i try to decrypt with the CryptoAPI. if i take the result 7ADE45981580DB32 and append 8 bytes of padding: 0808080808080808, when i try to decrypt, i get BAD DATA. what else do i need to do? Thank you, casey |
#2
| |||
| |||
|
|
You might try calling CryptEncrypt/CryptDecrypt without the 'final' flag. That way, the function won't know that it's the final block and thus won't add/remove any padding. This approach will probably work with most or all CSPs that are out there. Regards, John Banes [Microsoft Security Developer] This posting is provided "AS IS" with no warranties, and confers no rights. Please do not send email directly to this alias. This alias is for newsgroup purposes only. "casey chesnut" <casey (AT) braSPAMins-N-braSPAMwn (DOT) com> wrote in message news:OjHGGfIVEHA.2360 (AT) TK2MSFTNGP10 (DOT) phx.gbl... i'm trying to do TripleDES with no padding in the CryptoAPI going off this article here: http://www.di-mgt.com.au/cryptopad.html#example3des which lists these expected results: Example using Triple DES with key 0x0123456789ABCDEFFEDCBA987654321089ABCDEF01234567 3DES INPUT BLOCKS: 12345376 06666665 55551205 3DES OUTPUT: 7ADE45981580DB32 421E3D90B5B47D5B 1175FA3DD8B932D7 using an 8 byte IV of all zero. if i take the 1st block and encrypt it with the CryptoAPI. then i get 7ADE45981580DB32 (as expected) plus 8 more bytes of padding. ok, so if i want to encrypt with no padding, i just do that for 8 block chunks and strip off the trailing 8 each time. so that should be compatible with the desktop. but the problem is when i try to decrypt with the CryptoAPI. if i take the result 7ADE45981580DB32 and append 8 bytes of padding: 0808080808080808, when i try to decrypt, i get BAD DATA. what else do i need to do? Thank you, casey |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |