|
|
|
RTC Crypt
|
|||
|---|---|---|---|
|
#18+
Привет всем. Кто небудь разрабатывал свои криптер плагин для RTC? Там в rtcPlugins.pas есть шаблон компонента для криптования, там две фукции где вставляем криптование и декриптование: Для криптования: Код: pascal 1. 2. 3. 4. 5. 6. Тут всё ясно, входяшие данные криптуется и помешается в OutData. И обратная - для декриптования: Код: pascal 1. 2. 3. 4. 5. 6. 7. 8. Тут тоже на половину всё ясно - беру InData декриптирую и помешаю в OutPlainText. И ето у меня частично работает - если персылаю фаил с клиента на сервер и/или обртатно ... А если вызиваю какую то серверную функцию, то полyчаю ексепшен: Bad response. Unknown object type specifier at 1 Если без криптования, как в демке, просто OutPlainText := InData, то всё работает, без криптования, конешно ... Подозреваю, что тут требуется чтот то класть в OutData, НО ЧТО ??? Не в форуме, не в демках НИЧЕГО про ето, единственное то что выше: OutData = data prepared by "decoder" for sending back to recipient (encoded data) А ЧТО ето такое ??? Кто в курсе? WBR Janex ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.02.2019, 20:55 |
|
||
|
RTC Crypt
|
|||
|---|---|---|---|
|
#18+
авторOutData = data prepared by "decoder" for sending back to recipient (encoded data) This was unclear and should be like this: OutData = data that will be sent back to the other party without been processed by the application, other party plugin will receive it as it will be sent back immediately. You will need this only if you are implementing something like SSL/TLS or other mechanism that require different data (e.g. negotiating a key for encryption) to be shared between only the rtcCryptPlugin and its layer, before sending the application real data (that might be encrypted). So in short, for only encryption and decryption the load sent and received by two applications utilizing the same cryptPlugin, just keep OutData empty ! Use TRtcDummyCryptPlugin and change it to this: Код: pascal 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. The simplest way for encryption is to use rtcCrypt.CryptEx and rtcCrypt.DeCryptEx, for testing or even shorter method you can try Mime_EncodeEx and Mime_DecodeEx. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 26.02.2019, 14:34 |
|
||
|
RTC Crypt
|
|||
|---|---|---|---|
|
#18+
K.Obaideen, >> OutData:=EncryptUsingSomeAlgorithm(InData); It correct works only if encoded OutData is the same length as InData :( ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 28.02.2019, 20:30 |
|
||
|
RTC Crypt
|
|||
|---|---|---|---|
|
#18+
Janex, авторIt correct works only if encoded OutData is the same length as InData :( Length does matter, please let me explain : RTC components build like this : When rctCrypt is added to HTTPComponent it will capture the traffic directly from the TCP socket layer and before passing it to the HTTP component to handle the requests or the responses, now while DataToSendEx is simple where you can send extra data or delay sending the actual data, DataReceivedEx has extra functionality that can send different data to the other party without involving the HTTP components, so if server received TCP traffic on its port, it will trigger DataReceivedEx and here you can decode and process the data before your application, on exit, in this event OutPlainText will be passed to the HTTP components (your application) while OutData will be send through TCP and in this case HTTP components will not know about it. only the client might trigger exception because it is unexpected or encrypted for the server not the client, after all this is well formatted HTTP request not a response, and extra byte will raise exception. If you are catching exceptions like "Bad response. Unknown object type specifier at 1" then most likely it is been triggered on the other party or the decryption was wrong, may be has data padding that corrupted the data or its length, the decrypted data should be same (same length too) as the other party encrypted inside DataToSendEx. And to make sure it has nothing to do with the length of encrypted data, try Mime_EncodeEx and Mime_DecodeEx or any simple Base64 Encoding. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 01.03.2019, 06:02 |
|
||
|
RTC Crypt
|
|||
|---|---|---|---|
|
#18+
After writing i think you already know all of that, and i think i figured where is your problem. Check what encryption algorithm you are using it might have padding and this padding should be removed, if you are using AES then the problem 100% is in the padding so try AES in CTR mode (not recommended) or even better prepare a buffer where Length(Buffer) = 4+Length(DataToSend) and in those reserved 4 first bytes fill the length of the original data, after that encrypt the whole buffer, that way you have the original data and padding doesn't matter as you will fix the size after decryption, this way you can use and switch between any encryption algorithm. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 01.03.2019, 06:05 |
|
||
|
|

start [/forum/topic.php?fid=58&msg=39780613&tid=2039743]: |
0ms |
get settings: |
8ms |
get forum list: |
10ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
167ms |
get topic data: |
8ms |
get forum data: |
2ms |
get page messages: |
34ms |
get tp. blocked users: |
1ms |
| others: | 221ms |
| total: | 455ms |

| 0 / 0 |
