Giter Club home page Giter Club logo

mihcrypto's Introduction

MIHCrypto

Build Status Version Platform

OpenSSL is the most powerful SSL and TLS library available which wraps a full cryptographic library. The library is written in pure C and due to its endless size and not-so-well-designed C interface it is very hard for beginners to step into it.

The aim of the MIHCrypto library is to provide an object-oriented interface which allows developers to write simple and clean code by still using the power of the OpenSSL libCrypto library. OpenSSL is a very large library so (yet) not the whole library is wrapped by MIHCrypto. Since I am developing the library because personal needs focus of the functionallity is on modern cryptographic apporaches, but everybody is welcome to contribute other parts to the library.

How To Get Started

Installation with CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like MIHCrypto in your projects.

platform :ios, '6.0'
pod "MIHCrypto", "~> 0.4.1"

Sample Code

MIHCrypto is based on some less protocol declarations (in MIHCrypto/Core) and all ciphers are implementing these. So you have to use only a few interfaces for encrypting and decrypting with different cryptographic approaches.

id<MIHSymmetricKey> symmetricKey = ...
NSError *encryptionError = nil;
NSData *messageData = [@"My top secret message" dataByUsingEncoding:NSUTF8Encoding];
NSData *encryptedData = [symmetricKey encrypt:messageData error:&encryptionError];

These keys are either loaded from a file or generated by using an implementation of MIHKeyFactory.

MIHAESKeyFactory *factory = [[MIHAESKeyFactory alloc] init];
id<MIHSymmetricKey> aesKey = [factory generateKey];

If you need more sample code have a look at the unit tests or have a look at the docs.

Architecture

MIHCrypto is based on 5 core protocols which are implemented by various algorithms and approaches.

  • MIHKeyFactory - used to generate new keys
  • MIHSymmetricKey - represents a symmetric key (like AES or DES) and can be used to encrypt and decrypt data
  • MIHPublicKey - represents a public key (like RSA PUBKEY) and can be used to encrypt data and to verify a signature
  • MIHPrivateKey - represents a private key (like RSA private key) and can used to decrypt data and to sign a message
  • MIHHashAlgorithm - represents a hash funtion and only has one method to create the hash sum of the passed data

Requirements

MIHCrypto requires Xcode 4 and above, targeting either iOS 6.0 and above, or Mac OS 10.9 Mavericks (64-bit with modern Cocoa runtime) and above.

About

As already mentioned OpenSSL is very powerful and large project so this library doesn't support all functionallity of it yet and new functions are added as needed. At the moment following cryptographic approaches are supported:

  • AES (block cipher)
  • BIGNUM (discrete mathematics)
  • DES (block cipher)
  • MD5 (hash algorithm)
  • RSA (public-key cryptography)
  • ECC (public-key cryptography)
  • SHA, SHA256, SHA384, SHA512 (hash algorithm)

Anybody is welcome to add additional support for other approaches.

Contributors

License

MIHCrypto is available under the MIT license. See the LICENSE file for more info.

mihcrypto's People

Contributors

hohl avatar lolgear avatar matanelgabsi avatar akhilstanis avatar 4ndrey avatar hqsiswiliam avatar sven-straubinger 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.