| 55 System.out.println("smpError"); |
55 System.out.println("smpError"); |
| 56 } |
56 } |
| 57 |
57 |
| 58 @Override |
58 @Override |
| 59 public void smpAborted(SessionID sid) throws OtrException { |
59 public void smpAborted(SessionID sid) throws OtrException { |
| 60 |
60 System.out.println("smpAborted"); |
| 61 } |
61 } |
| 62 |
62 |
| 63 @Override |
63 @Override |
| 64 public void finishedSessionMessage(SessionID sid, String string) throws OtrException { |
64 public void finishedSessionMessage(SessionID sid, String string) throws OtrException { |
| 65 System.out.println("finishedSessionMessage: " + sid); |
65 System.out.println("finishedSessionMessage: " + sid); |
| 70 System.out.println("requireEncryptedMessage"); |
70 System.out.println("requireEncryptedMessage"); |
| 71 } |
71 } |
| 72 |
72 |
| 73 @Override |
73 @Override |
| 74 public OtrPolicy getSessionPolicy(SessionID sid) { |
74 public OtrPolicy getSessionPolicy(SessionID sid) { |
| 75 return new OtrPolicyImpl(OtrPolicy.ALLOW_V2 | OtrPolicy.ALLOW_V3 | OtrPolicy.OPPORTUNISTIC); |
75 return new OtrPolicyImpl(OtrPolicy.ALLOW_V2 | OtrPolicy.ALLOW_V3 | OtrPolicy.OPPORTUNISTIC | OtrPolicy.ERROR_START_AKE); |
| 76 } |
76 } |
| 77 |
77 |
| 78 @Override |
78 @Override |
| 79 public FragmenterInstructions getFragmenterInstructions(SessionID sid) { |
79 public FragmenterInstructions getFragmenterInstructions(SessionID sid) { |
| 80 return new FragmenterInstructions(4096, 131072); |
80 return new FragmenterInstructions(16, 2048); |
| 81 } |
81 } |
| 82 |
82 |
| 83 @Override |
83 @Override |
| 84 public KeyPair getLocalKeyPair(SessionID sid) throws OtrException { |
84 public KeyPair getLocalKeyPair(SessionID sid) throws OtrException { |
| |
85 System.out.println("getLocalKeyPair"); |
| 85 // Check if a key pair already exists for the session |
86 // Check if a key pair already exists for the session |
| 86 if (keyPairCache.containsKey(sid)) { |
87 if (keyPairCache.containsKey(sid)) { |
| 87 return keyPairCache.get(sid); |
88 return keyPairCache.get(sid); |
| 88 } |
89 } |
| 89 |
90 |
| 107 } |
108 } |
| 108 } |
109 } |
| 109 |
110 |
| 110 @Override |
111 @Override |
| 111 public byte[] getLocalFingerprintRaw(SessionID sid) { |
112 public byte[] getLocalFingerprintRaw(SessionID sid) { |
| |
113 System.out.println("getLocalFingerprintRaw"); |
| 112 // code from DummyClient: https://github.com/jitsi/otr4j/blob/master/src/test/java/net/java/otr4j/session/DummyClient.java |
114 // code from DummyClient: https://github.com/jitsi/otr4j/blob/master/src/test/java/net/java/otr4j/session/DummyClient.java |
| 113 try { |
115 try { |
| 114 return new OtrCryptoEngineImpl() |
116 return new OtrCryptoEngineImpl() |
| 115 .getFingerprintRaw(getLocalKeyPair(sid) |
117 .getFingerprintRaw(getLocalKeyPair(sid) |
| 116 .getPublic()); |
118 .getPublic()); |