Code Monkey home page Code Monkey logo

keychain_manager's Introduction

//// Github AsciiDoc renderer sucks bad!

Ruby Gem Mac OS X Keychain Manager

This gem aids your ruby scripts by providing access to the Mac OS X Keychain Access.

Purpose

I needed a way to generate 100+ Apple push notification certificates for my iOS apps. Using the Mac OS X command security, I was able to automate the generation of certificates. This gem simply wraps openssl and security command line utilities.

As of now, this gem only contains code relevant to the generation of keys and certificates for iOS development. Of course, this could easily be expanded to include other areas.

Testing

Verify that the tests pass on your machine. This was tested on Mac OS X 10.7 (Lion) using Ruby 1.9.2.

ruby test/keychain_test.rb

Usage

Install:
gem install keychain_manager

Reminder, this gem was used to automate the creation of Apple iOS push notification certificates. The following demonstrates this process.

//// [source,ruby] must comment for Github’s crappy renderer.

USER = '[email protected]'
KEYCHAIN = 'apple_push_keychain' #this can be anything, we just don't want to pollute the 'login' keychain
YOUR_DOWNLOADS_DIR = '' # you must set this, this is where the file aps_production_identity.cer exists

RSA_FILE = '/tmp/myrsa.key'
KeychainManager.generate_rsa_key(RSA_FILE)

CERT_FILE = '/tmp/CertificateSigningRequest.certSigningRequest'
KeychainManager.generate_cert_request(USER, 'US', CERT_FILE) #'US' is the country abbreviation.

kcm = KeychainManager.new(KEYCHAIN)
kcm.delete if kcm.exists?
kcm.create

kcm.import_rsa_key(RSA_FILE)

#now from your browser, you'll have downloaded a file from Apple typically named: aps_production_identity.cer
kcm.import_apple_cert(File.join(YOUR_DOWNLOADS_DIR, '/aps_production_identity.cer'))

P12_FILE = '/tmp/push_prod.p12'
kcm.export_identites(P12_FILE)

PEM_FILE = '/tmp/push_prod.pem'
KeychainManager.convert_p12_to_pem(P12_FILE, PEM_FILE)

kcm.delete

#Now upload the PEM_FILE to your server.
Note
You must upload the PEM_FILE to your server so that our backend push notification app can access it.

License

Copyright (c) 2011, JP Richardson

Tri-licensed: GPL v2, LGPL v2, MIT

keychain_manager's People

Contributors

jprichardson avatar varuzhnikov avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

rainkinz

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.