Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message not encrypted #21

Open
voznesenskym opened this issue Mar 6, 2015 · 13 comments
Open

Message not encrypted #21

voznesenskym opened this issue Mar 6, 2015 · 13 comments

Comments

@voznesenskym
Copy link

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?

@chrisballinger
Copy link
Member

@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.

@voznesenskym
Copy link
Author

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
#21 (comment).

@chrisballinger
Copy link
Member

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

@voznesenskym
Copy link
Author

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
#21 (comment).

@voznesenskym
Copy link
Author

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...

@kasas
Copy link

kasas commented May 11, 2015

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]

@chrisballinger
Copy link
Member

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
#21 (comment).

@kasas
Copy link

kasas commented May 11, 2015

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
Copy link

kasas commented Jul 10, 2015

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??

@chrisballinger
Copy link
Member

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
#21 (comment)

@sansuba
Copy link

sansuba commented Apr 12, 2016

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.

@jevonch
Copy link

jevonch commented Aug 11, 2016

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

@chrisballinger
Copy link
Member

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
#21 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAfqHyjlIs6BzGz3X67uTAGU261CtheZks5qe1LDgaJpZM4DqY2x
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants