Giter Site home page Giter Site logo

aescrypt-objc's Introduction

AESCrypt-ObjC - Simple AES encryption / decryption for iOS and OS X

AESCrypt is a simple to use, opinionated AES encryption / decryption Objective-C class that just works.

AESCrypt uses the AES-256-CBC cipher and encodes the encrypted data with base64.

A corresponding gem to easily handle AES encryption / decryption in Ruby is available at http://github.com/Gurpartap/aescrypt.

Installation

Add this line to your class:

#import "AESCrypt.h"

Usage

NSString *message = @"top secret message";
NSString *password = @"p4ssw0rd";

Encrypting

NSString *encryptedData = [AESCrypt encrypt:message password:password];

Decrypting

NSString *message = [AESCrypt decrypt:encryptedData password:password];

Common sense

AESCrypt includes Base64 and Crypto extensions for NSData and NSString classes. If you're already using an extension that provides these, there is no need to use the included classes. Change the code in the AESCrypt class to correspond to your existing implementation of these extensions.

Corresponding usage in Ruby

The AESCrypt Ruby gem, available at http://github.com/Gurpartap/aescrypt, understands what you're talking about in your Objective-C code. The purpose of the Ruby gem and Objective-C class is to have something that works out of the box across the server (Ruby) and client (Objective-C). However, a standard encryption technique is implemented, which ensures that you can handle the data with any AES compatible library available across the web. So, you're not locked-in.

Here's how you would use the Ruby gem:

message = "top secret message"
password = "p4ssw0rd"

Encrypting

encrypted_data = AESCrypt.encrypt(message, password)

Decrypting

message = AESCrypt.decrypt(encrypted_data, password)

See the Ruby gem README at http://github.com/Gurpartap/aescrypt for more details.

License

NSData+CommonCrypto is Copyright (c) 2008-2009, Jim Dovey

AESCrypt is Copyright (c) 2012 Gurpartap Singh

See LICENSE for license terms.

aescrypt-objc's People

Contributors

gurpartap avatar benoitsan avatar yoiang avatar

Watchers

kdelay avatar James Cloos 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.