Giter Club home page Giter Club logo

socketkit's Introduction

SocketKit

SocketKit allows the programmer to use an assortment of TCP-based Objective-C classes to connect to TCP servers, and host a TCP server. The SKSocket and SKSocketServer class are used only as abstractions for other socket classes such as SKTCPSocket and SKTCPSocketServer. To use OpenSSL with sockets, there is a simple SKSocket subclass called SKTCPSSLSocket that wraps a TCPSocket for SSL encrypted data communication.

Using SocketKit

To use SocketKit with your Objective-C (iOS or Mac OS X) application, you simply need to copy the SK group (with source code) into your project. Since SocketKit uses OpenSSL, you have to set a few compiler flags through Xcode. To do this, go into Target Info > Build Settings > Other Linker Flags. Add the following flags to this list (exactly as follows.)

-lssl
-lcrypto

Testing

Step 1: Run SocketKit. Once run, you will need to press the 1 key, and hit enter. If Mac OS X asks if you would like SocketKit to be able to accept incoming network connections, click Allow.

Step 2: Run SSLClient in another Xcode client. If SSLClient and SocketKit both print out a string saying "Message: [anything]" then the two clients managed to communicate.

Using Different OpenSSL Keys and Certificates.

To generate a new OpenSSL key and certificate file, run this command in Terminal:

openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem

To use the generated certificate, use this code to create a TCP SSL Socket:

NSString * pemFile = @"/path/to/mycert.pem";
SKTCPSSLSocket * sslSocket = [[[SKTCPSSLSocket alloc] initWithServerTCPSocket:aSocket publicKey:pemFile privateKey:pemFile] autorelease];

In the SocketKit Xcode project included with this repository, SSLServerTest has code similar to this in SSLServerTest.m.

socketkit's People

Contributors

unixpickle avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.