<div dir="ltr">Hello,<div><br></div><div>I have been working on integrating OTR to my XMPP client for BlackBerry 10. </div><div><br></div><div>I managed to get many things work, but I still have some trouble to send encrypted messages. So I was wondering if someone could help me to locate what I am missing. </div><div><br></div><div>What I am able to do is to:</div><div>- initiate the OTR protocol, and got up to the point where "gone_secure" is called, and I have the fingerprint of the recipient. </div><div>- If the other client (Adium) is sending me encrypted messages, I am able to decrypt them.</div><div><br></div><div>But when I try to send messages, "otrl_message_sending" replace my message by a new OTR request:</div><div><br></div><div>-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</div><div><p style="margin:0px;font-size:11px;font-family:Monaco">"?OTRv2?</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><b><a href="mailto:amonchakai2@jabber.de">amonchakai2@jabber.de</a></b> has requested an <a href="<a href="https://otr.cypherpunks.ca/">https://otr.cypherpunks.ca/</a>">Off-the-Record private conversation</a>. However, you do not have a plugin to support that.</p>
<p style="margin:0px;font-size:11px;font-family:Monaco">See <a href="<a href="https://otr.cypherpunks.ca/">https://otr.cypherpunks.ca/</a>"><a href="https://otr.cypherpunks.ca/">https://otr.cypherpunks.ca/</a></a> for more information." </p></div><div><br></div><div>-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br></div><div><br></div><div>And if I send that, I can see the exchange of keys, and back to square 1. And if I try to send again my message, otrl_message_sending keep replacing my message by the initialization request.</div><div><br></div><div><br></div><div>For the moment my functions</div><div>- myotr_new_fingerprint</div><div>- myotr_write_fingerprint</div><div>- myotr_gone_secure</div><div><br></div><div>Do nothing, and I was wondering if somehow I need to accept fingerprint? In some example I saw on the web such as there:</div><div><a href="https://github.com/monkeyiq/otr/blob/master/main.cpp">https://github.com/monkeyiq/otr/blob/master/main.cpp</a><br></div><div><br></div><div>They just stop the conversation if the fingerprint is not accepted, so I assumed that, for now, I did not have to do something particular. </div><div><br></div><div>Do I need to do something in particular to acknowledge that the connection is established, so it can start encrypting when sending messages? </div><div><br></div><div><br></div><div>Thanks</div><div><br></div><div>Best,</div><div>Pierre</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div>I will avoid to put all the code, to make this email readable. </div><div><div><br></div><div>Basically I defined these functions:</div><div><br></div><div><br></div><div>// =====================================================================================================</div><div><br></div><div>static OtrlMessageAppOps ui_ops = {</div><div> myotr_policy,</div><div> NULL,</div><div> NULL,</div><div> myotr_inject_message,</div><div> NULL,</div><div> myotr_new_fingerprint,</div><div> myotr_write_fingerprint,</div><div> myotr_gone_secure,</div><div> myotr_gone_insecure,</div><div> NULL,</div><div> NULL,</div><div> NULL,</div><div> NULL,</div><div> NULL,</div><div> NULL,</div><div> NULL,</div><div> NULL,</div><div> NULL</div><div>};</div><div><br></div><div><br></div><div><br></div><div>the policy is:</div><div><br></div><div><br></div><div><div>static OtrlPolicy myotr_policy(void *opdata, ConnContext *context)</div><div>{</div><div> return OTRL_POLICY_ALLOW_V2</div><div> | OTRL_POLICY_REQUIRE_ENCRYPTION;</div><div>}</div></div><div><br></div><div><br></div><div>// =====================================================================================================</div><div><br></div><div><br></div><div><div>void message_received(const QString& ourAccount, const QString& account, const QString& protocol, const QString& message) {</div><div> uint32_t ignore = 0;</div><div> char *new_message = NULL;</div><div> OtrlTLV *tlvs = NULL;</div><div><br></div><div><br></div><div> ignore = otrl_message_receiving(us, &ui_ops, NULL, ourAccount.toAscii(), protocol.toAscii(), account.toAscii(), message.toAscii(), &new_message, &tlvs, NULL, NULL, NULL);</div><div><br></div><div> // if ignore == 1, then it is a core message from OTR. We don't want to display that.</div><div> if(ignore == 0) {</div><div><br></div><div> if (new_message) {</div><div> QString ourm(new_message);</div><div> otrl_message_free(new_message);</div><div><br></div><div> qDebug() << "encrypted message: " << ourm;</div><div> } else {</div><div><br></div><div> qDebug() << "message not encrypted: " << message;</div><div> }</div><div> }</div><div><br></div><div> if(tlvs) {</div><div> qDebug() << "there are side info!";</div><div> otrl_tlv_free(tlvs);</div><div> }</div><div>}</div><div><br></div><div><br></div><div>void send_message (const QString& ourAccount, const QString& account, const QString& protocol, const QString& message) {</div><div> char *new_message = NULL;</div><div> gcry_error_t err;</div><div><br></div><div> err = otrl_message_sending(us, &ui_ops, NULL, ourAccount.toAscii(), protocol.toAscii(), account.toAscii(), OTRL_INSTAG_BEST, message.toAscii(), NULL, &new_message,</div><div> OTRL_FRAGMENT_SEND_SKIP, NULL, NULL, NULL);</div><div><br></div><div> qDebug() << "error code: " << err;</div><div><br></div><div> if (new_message) {</div><div> QString ourm(new_message);</div><div> otrl_message_free(new_message);</div><div> qDebug() << "encrypted message: " << ourm;</div><div><br></div><div> XMPP::get()->sendXMPPMessageTo(account, ourm);</div><div> }</div><div><br></div><div> if (err) {</div><div> qDebug() << "plouf!";</div><div> }</div><div>}</div></div><div><br></div><div><br></div></div></div>