Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simplified Crypto Libraries for iOS

I've worked with Java cryptography for many years. Now, we have a requirement to write an iOS application that will send encrypted payloads from the mobile device to a Java service. I've begun working with the iOS crypto support (CommonCrypto, etc.) and have found it a bit more difficult. The JCE has a very clean, concise API, so I've clearly gotten spoiled. In contrast, iOS cryptography is a far more difficult API to work with.

Are there any simplified crypto libraries or wrappers around CommonCrypto that provide a more concise API? In particular, we need:

  • Key generation (both symmetric and asymmetric)
  • Encryption/decryption of data
  • Digital signatures (SHA1withRSA, for example)
  • Hashing
  • RSA, 3DES, and AES support

I know I've seen a sample class or two that wraps AES encryption, for example. I'm looking for something a bit richer and more full-featured. Anyone have any suggestions?

like image 749
Shadowman Avatar asked Dec 22 '12 16:12

Shadowman


People also ask

What is Apple CryptoKit?

CryptoKit is a new Swift framework that makes it easier and safer than ever to perform cryptographic operations, whether you simply need to compute a hash or are implementing a more advanced authentication protocol.

What is CommonCrypto?

CommonCrypto is a C library, so that makes it a little bit unpalatable to use in Swift. It is part of System.

What is sodium in IOS?

Sodium is a modern, easy-to-use software library for encryption, decryption, signatures, password hashing, and more.

What is CryptoSwift?

CryptoSwift is a growing collection of standard and secure cryptographic algorithms implemented in Swift. View the Project on GitHub krzyzanowskim/CryptoSwift.


1 Answers

You can use openSSL inside your iOS app, for ease of use you can use the SSCrypto library by septicus.

From the septicus site:

SSCrypto.framework provides a simple wrapper around OpenSSL library functions for encryption, decryption (both symmetric and RSA) and checksums. It also encodes and decodes base64 data and can generate both private and public RSA keys. A test tool is included in the project. Click here to see the main.m file that comes with SSCrypto for examples of it's use.

like image 172
Frank Avatar answered Oct 21 '22 05:10

Frank