Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
WorkingWithThemisServer.xcworkspace
WorkingWithThemisServer
pics
Podfile
Podfile.lock
README.md

README.md

  1. Install Pods
  2. Run app, see that it's crashing on asserts. This is fine :)
  3. Open AppDelegate and select example to start: SecureMessage or SecureSession. Just uncomment one of the modes.

appdelegate

SecureSession mode

Let's assume you want to play with SecureSession.

  1. Open SSessionClient.m file.

Client key generation

  1. Find these lines:
// ---------------------- KEY GENERATION ---------------------------------------
    
//    // uncomment to re-generate keys
//    [self generateClientKeys];
//    return;
    
// ---------------------- END KEY GENERATION -----------------------------------
  1. Uncomment key generation and run example. You should see output in console, like this:
 ------------ running SSession Client example 
client private key "UkVDMgAAAC0lV2hOAKFJZyAOLFkzavGzxP8v0Byrs9r5N4u1rm4qYSTLqf+2";
client public key "VUVDMgAAAC1hdEZpAlxrxhaWHW23X9ILnXgeZRNHRJ2lt/w4e4tdzablr/WS";
  1. Copy keys to text file :)
  2. Comment key generation lines ([self generateClientKeys]) function, we don't need them anymore.
  3. Find client keys constants in code and paste generated keys, like this:
static NSString * kClientPrivateKey = @"UkVDMgAAAC0lV2hOAKFJZyAOLFkzavGzxP8v0Byrs9r5N4u1rm4qYSTLqf+2"
static NSString * kClientPublicKey = @"VUVDMgAAAC1hdEZpAlxrxhaWHW23X9ILnXgeZRNHRJ2lt/w4e4tdzablr/WS"

Server key generation

The idea is to let server know client public key, and let client know server id and public key.

  1. Open https://themis.cossacklabs.com/interactive-simulator/setup/
  • Copy User ID from server interface to kUserId in code.
  • Copy Server ID from server interface to kServerId in code.
  • Copy Server Key from server interface to kServerPublicKey in code.
  • Paste kClientPublicKey to Client public key in server interface.

sever dashboard

Code will look like this:

static NSString * kUserId = @"gUOosYEgpqbGXJf";
static NSString * kServerId = @"shfVaKYXvlbAMoD";
static NSString * kServerPublicKey = @"VUVDMgAAAC2TKF6QAyMjQXtKmAAfNOSeW6D1BeXKx6XIX8bWFG3Tfjo74ldm";

static NSString * kClientPrivateKey = @"UkVDMgAAAC0lV2hOAKFJZyAOLFkzavGzxP8v0Byrs9r5N4u1rm4qYSTLqf+2"
static NSString * kClientPublicKey = @"VUVDMgAAAC1hdEZpAlxrxhaWHW23X9ILnXgeZRNHRJ2lt/w4e4tdzablr/WS"

Start all the things!

  1. Start server in SecureSession mode (press corresponded button).
  2. Run app on SecureSession mode.
  • don't forget to uncomment SecureSession mode in AppDelegate
  • don't forget to comment out key generation
  1. Enjoy

Secure Message mode

Do the same steps as described above, but for SMessageClient.m file :) Run server in Secure Message mode.

Read more!

Read How Themis Server Simulator works: https://github.com/cossacklabs/themis/wiki/Using-Themis-Server