OTRKit icon indicating copy to clipboard operation
OTRKit copied to clipboard

Message not encrypted

Open voznesenskym opened this issue 11 years ago • 13 comments

So - my goal is, in the least number of steps get a message encrypted with libotr on iOS

Currently, with OTRKit, I have a class as an OTR Delegate, and I call [[OTRKit sharedInstance] initiateEncryptionWithUsername:username accountName:accountname protocol:protocol];

and then, a little late on a button press:

[[OTRKit sharedInstance] encodeMessage:@"TEST" tlvs:nil username:username accountName:username protocol:protocol tag:nil];

And when I log the delegate method :

  • (void)otrKit:(OTRKit *)otrKit encodedMessage:(NSString *)encodedMessage wasEncrypted:(BOOL)wasEncrypted username:(NSString *)username accountName:(NSString *)accountName protocol:(NSString *)protocol tag:(id)tag error:(NSError *)error {

the encodedMessage does not appear encrypted.

What am I missing?

voznesenskym avatar Mar 06 '15 00:03 voznesenskym

@voznesenskym You'll need bi-directional communication for the key exchange before messages can be encrypted. The injectMessage and encodedMessage delegate methods are not optional, so in those methods you should be ensuring that data reaches the other peer and that on the other end all messages go through decodeMessage. Decoding messages also requires injectMessage to be implemented on the receiving end.

chrisballinger avatar Mar 06 '15 04:03 chrisballinger

Gotcha. So what method do I call to establish a connection to another peer? In what order does the API get called?

On Thursday, March 5, 2015, Chris Ballinger [email protected] wrote:

@voznesenskym https://github.com/voznesenskym You'll need bi-directional communication for the key exchange before messages can be encrypted. The injectMessage and encodedMessage delegate methods are not optional, so in those methods you should be ensuring that data reaches the other peer and that on the other end all messages go through decodeMessage. Decoding messages also requires injectMessage to be implemented on the receiving end.

— Reply to this email directly or view it on GitHub https://github.com/ChatSecure/OTRKit/issues/21#issuecomment-77504819.

voznesenskym avatar Mar 06 '15 04:03 voznesenskym

OTRKit doesn't rely on any specific network protocol. You can use it with XMPP, or whatever other protocol you prefer.

chrisballinger avatar Mar 06 '15 04:03 chrisballinger

I use http. So how do I ascertain that there was a connection? Where do I pass in or set details for another client? What is the flow?

I understand that client 1 connects to 2, they handshake, exchange keys, confirm from ui the connections validity and the conversation is encrypted... But how does all this happen??

On Thursday, March 5, 2015, Chris Ballinger [email protected] wrote:

OTRKit doesn't rely on any specific network protocol. You can use it with XMPP, or whatever other protocol you prefer.

— Reply to this email directly or view it on GitHub https://github.com/ChatSecure/OTRKit/issues/21#issuecomment-77506340.

voznesenskym avatar Mar 06 '15 04:03 voznesenskym

I do apologize for basically asking for a 'getting started' guide , but even something as simple as you writing out the basic steps of the flow would do wonders in me getting this working...

voznesenskym avatar Mar 06 '15 06:03 voznesenskym

I have the same problem using a XMPP connection through XMPPManager Framework. I can establish the OTR Connection (proved against Adium) the problem is that when I try to encrypt a message it is never done. Do you know why it can happen? I can see both fingerprints :S

I do the following:

  1. initiateEncryptionWithUsername:username
  2. Wait until updateState is called (ENCRYPTED STATUS)
  3. Send messages through encodeMessage from [OTRKit sharedInstance]

kasas avatar May 11 '15 19:05 kasas

Did you implement the injectMessage delegate method?

On Mon, May 11, 2015 at 12:26 PM, kasas [email protected] wrote:

I have the same problem using a XMPP connection through XMPPManager Framework. I can establish the OTR Connection (proved against Adium) the problem is that when I try to encrypt a message it is never done. Do you know why it can happen? I can see both fingerprints :S

— Reply to this email directly or view it on GitHub https://github.com/ChatSecure/OTRKit/issues/21#issuecomment-101024487.

chrisballinger avatar May 11 '15 19:05 chrisballinger

Yes All the process to get the session started has been made. But it seems not to encode the messages after the first... That's what I do in inject method:

  • (void)otrKit:(OTRKit *)otrKit injectMessage:(NSString *)message username:(NSString *)username accountName:(NSString *)accountName protocol:(NSString *)protocol tag:(id)tag{ NSLog(@"injectMessage"); //only otr protocol NCMessage * msg = [[NCMessage alloc] init]; [msg setSender:accountName]; [msg setTo:username]; [msg setBody:message];

    [[XMPPManager sharedInstance] sendPlainMessage:msg]; }

Just send the plain message through the XMPP channel

kasas avatar May 11 '15 21:05 kasas

Hi, I wanted to ask some help in order to be able to make OTR session in iOS. I have realized that if I start the session in Android or other system the messages are encoded well. The problem is when the session is started in iOS. Do you know any issue in starting sessions??

kasas avatar Jul 10 '15 16:07 kasas

I can almost 100% guarantee that you didn't implement injectMessage, or that incoming messages aren't being passed to decodeMessage

On Mon, Apr 11, 2016 at 7:40 AM, Subhash Sanjeewa [email protected] wrote:

everything is okay with android and audium please help to solve iOS to iOS issue

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/ChatSecure/OTRKit/issues/21#issuecomment-208379378

chrisballinger avatar Apr 11 '16 20:04 chrisballinger

Hi Chris, I can communicate well. OTR starting and communication is perfect. Thanks for pointing me your guesses. I have implemented them and only thing that I am not decoded ?OTRv2 from receiving side. from your point "that incoming messages aren't being passed to decodeMessage". It works. Thanks.

sansuba avatar Apr 12 '16 02:04 sansuba

@sansuba Have you sucessfully use this OTRKit for implementing yours? Please give me step by step solution..Im newbie in this case

jevonch avatar Aug 11 '16 16:08 jevonch

Not to be harsh, but if you don't know what you're doing and need step by step instructions, you probably shouldn't be implementing crypto code quite yet.

On Thu, Aug 11, 2016 at 9:50 AM, jevonch [email protected] wrote:

@sansuba https://github.com/sansuba Have you sucessfully use this OTRKit for implementing yours? Please give me step by step solution..Im newbie in this case

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ChatSecure/OTRKit/issues/21#issuecomment-239220516, or mute the thread https://github.com/notifications/unsubscribe-auth/AAfqHyjlIs6BzGz3X67uTAGU261CtheZks5qe1LDgaJpZM4DqY2x .

chrisballinger avatar Aug 11 '16 18:08 chrisballinger