/aes-everywhere-swift

AES Everywhere - Swift implementation

Primary LanguageSwiftOtherNOASSERTION

AES Everywhere - Cross Language Encryption Library

AES Everywhere is Cross Language Encryption Library which provides the ability to encrypt and decrypt data using a single algorithm in different programming languages and on different platforms.

This is an implementation of the AES algorithm, specifically CBC mode, with 256 bits key length and PKCS7 padding. It implements OpenSSL compatible cryptography with random generated salt

Swift implementation

Swift implementation uses BlueCryptor which provides swift cross-platform crypto library derived from IDZSwiftCommonCrypto. On macOS and iOS, BlueCryptor uses the Apple provided CommonCrypto library. On Linux, it uses libcrypto from the OpenSSL project.

Current repo is a part of AES-everywhere project separated due to the requirements of Swift Package Manager

Including in your project

Using Swift Package Manager:
In your Package.swift add dependency to github url

  dependencies: [
    .package(url: "https://github.com/mervick/aes-everywhere-swift.git", from: "1.2.0")
  ],

and in target dependencies add "AesEverywhere":

  targets: [
    .target(
      name: "your-project-name",
      dependencies: [
        "AesEverywhere"
      ])
  ]

Using Carthage:

To include AesEverywhere in a project using Carthage, add a line to your Cartfile:

  github "mervick/aes-everywhere-swift" ~> 1.2

Using CocoaPods:

@TODO: publish pod, add docs

Usage

import AesEverywhere

let crypted = try! AES256.encrypt(input: "TEST", passphrase: "PASS")
print(crypted)

let decrypted = try! AES256.decrypt(input: crypted, passphrase: "PASS")
print(decrypted)