Swiftpack.co - Package - vapor/open-crypto

⚠️ This library has been deprecated in favor of https://github.com/apple/swift-crypto


CryptoKit

API Docs Team Chat MIT License Continuous Integration Swift 5


OpenCrypto is a drop-in replacement for Apple's CryptoKit built on OpenSSL.

This package is meant for use on platforms where CryptoKit is not available, like Linux. Most features from CryptoKit are available, but some are still missing:

  • ✅ MD5
  • ✅ SHA1
  • ✅ SHA2 (256, 384, 512)
  • ✅ HMAC
  • ✅ AES GCM (128, 192, 256)
  • ✅ ChaChaPoly (1305)
  • ❌ Curve25519
  • ❌ NIST P (256, 384, 521)

Github

link
Stars: 111

Dependencies

Releases

Crypto 3.4.1 - 2020-06-15 20:04:43

Fixes a compile error when using OpenSSL 1.1 introduced in 3.4.0.

Crypto 3.4.0 - 2020-06-15 16:07:42

Add support for DER encoded x509 certificate.

import Crypto

let rsa = try RSAKey.public(der: urlEncodedDer)

OpenCrypto 4.0.0 Beta 2 - 2019-12-09 14:56:19

  • Enabled test discovery on Linux. (#98)

OpenCrypto 4.0.0 Alpha 2 - 2019-08-01 18:57:36

CryptoKit is now called OpenCrypto.

OpenCrypto is a drop-in replacement for Apple's CryptoKit built on OpenSSL.

This package is meant for use on platforms where CryptoKit is not available, like Linux. Most features from CryptoKit are available, but some are still missing:

  • ✅ MD5
  • ✅ SHA1
  • ✅ SHA2 (256, 384, 512)
  • ✅ HMAC
  • ✅ AES GCM (128, 192, 256)
  • ✅ ChaChaPoly (1305)
  • ❌ Curve25519
  • ❌ NIST P (256, 384, 521)

CryptoKit 4.0.0 Alpha 1 - 2019-05-28 17:46:50

More information on Vapor 4 alpha releases:

https://medium.com/@codevapor/vapor-4-alpha-1-releases-begin-94a4bc79dd9a

API Docs:

https://api.vapor.codes/crypto-kit/master/CryptoKit/index.html

Crypto 3.3.3 - 2019-04-22 19:41:47

Fixed:

  • Trying to parse a malformed RSA key no longer causes a fatalError (#87 - #88)

Crypto 3.3.2 - 2019-02-12 20:58:10

Fixed:

  • Removed dependency on private CNIOOpenSSL package. (#81)

Crypto 3.3.1 - 2019-01-17 18:13:00

Fixed:

  • Fixed a crash that could happen when using RSA with incorrect key type. (#79, #78)
  • Fixed an issue causing OpenSSL error messages to always yield "unknown error". (#79)

Crypto 3.3.0 - 2018-09-25 19:49:08

New:

  • OpenSSL 1.1 support. (#74, #75)
  • AES GCM now properly supports tags. (#68, #71)
  • TOTP and HOTP support have been added. (#72)
import Crypto

let code = TOTP.SHA1.generate(secret: "hi")
print(code) "123456"

Fixed:

  • This package's private C libraries have been renamed and updated. (#75)

Crypto 3.2.0 - 2018-05-31 16:46:11

New:

  • RSA now has encrypt and decrypt static methods (#64).
  • New secureCompare(to:) method on Collection (#67).

Fixed:

  • Default AES mode is no longer ECB (#59, #66).
  • New AES cipher modes have been added (#60).
  • Fixed some incorrect usages of withUnsafeBuffer (#64).
  • BCryptDigest now uses secure compare when verifying hashes (#67).
  • CryptoRandom and OSRandom are now structs (#65).

Crypto 2.1.3 - 2018-05-30 00:44:09

Fixed:

  • Eliminate warnings for Swift 4.1 (#63).

Crypto 3.1.2 - 2018-05-07 16:44:30

Fixed:

  • Fixed a typo in error messages regarding IV length (#61).

Milestone: 3.1.2

Crypto 3.1.1 - 2018-04-26 02:16:20

Fixed:

  • BCrypt.hash(...) will now throw a more helpful error if the cost value is invalid (#58).

Milestone: 3.1.1

Crypto 3.1.0 - 2018-04-20 18:23:43

New:

  • BCrypt is now based on a C implementation meaning BCrypt hashes won't take longer for debug builds. (#55)

Fixed:

  • ⚠️ BCrypt.hash(...) now returns a String. Previously it returned Data which was a bug. BCrypt hashes are formatted as UTF-8 encoded Strings and should be returned as such. (#55)

Milestone: 3.1.0

Crypto 3.0.1 - 2018-04-12 22:29:46

New:

  • Added RSAKey.components(...), a method for creating RSA keys from component values. (#51)
  • DigestAlgorithm now conforms to Equatable (#49)

Fixed:

  • Updated to latest LosslessDataConvertible. (#52)

API Docs: https://api.vapor.codes/crypto/latest/Crypto

Milestone: 3.0.1

Crypto 3.0.0 - 2018-04-03 01:54:43

New:

  • Added Cipher class for encrypting and decrypting data.
  • Refactored BCrypt to make more consistent with other types and minimize API surface.

Docs: https://docs.vapor.codes/3.0/crypto/getting-started/

API Docs: https://api.vapor.codes/crypto/3.0.0/Crypto https://api.vapor.codes/crypto/3.0.0/Random

Milestone: 3.0.0

Crypto 3.0.0 RC 3 - 2018-03-23 21:25:50

New:

API Docs: https://api.vapor.codes/crypto/3.0.0-rc.3/Crypto

Milestone: 3.0.0-rc.3

Crypto 3.0.0 RC 2 - 2018-03-21 20:08:51

New:

  • Vapor is now running on Swift NIO!
  • Crypto now relies on NIO OpenSSL for RSA. (Planning on rolling this out to other crypto in this package to lower maintenance burden going forward)
  • RSA can now parse x509-formatted public key certificates.

On macOS, you must run:

brew install libressl

On Linux, you must run:

apt-get install libssl-dev

Fixed:

  • RSA now correctly parses DER-encoded PEM files.

Milestone

Crypto 3.0.0 RC 1.1.1 - 2018-02-28 02:49:13

Fixed:

  • Throws a nicer error when attempting to create RSA signature with a public key on Linux.

Crypto 3.0.0 RC 1.1 - 2018-02-28 02:03:25

New:

  • Support for RSA signing and verification.
import Crypto

let privateKey: Data = ...
let publicKey: Data = ...
let plaintext = Data("vapor".utf8)

// sign with private key
let privateRSA = RSA(key: .private2048(privateKey))
let signature = try privateRSA.sign(plaintext)

// verify with public key
let publicRSA = RSA(key: .public2048(publicKey))
if try publicRSA.verify(signature, signs: plaintext) { 
    print("signature verified") 
}

Milestone

Crypto 3.0.0 RC 1 - 2018-02-23 02:58:38

Crypto 3.0.0 Beta 1.2 - 2018-02-21 01:53:47

Fixed:

  • Expand core dependency to next major.

Crypto 3.0.0 Beta 1.1 - 2018-02-15 00:52:46

Crypto 3.0.0 Beta 1 - 2018-02-10 00:31:27

Crypto 2.1.2 - 2017-12-21 01:13:38

Fixed:

  • Remove Swift warnings.

Milestone

Crypto 2.1.1 - 2017-08-30 19:09:03

Fixed:

  • CTLS target dep added for Swift 4.

Crypto 2.1 - 2017-08-07 13:02:35

New:

  • prelim swift 4 support –Aug 1

Milestone

Crypto 2.0 - 2017-05-17 16:00:40

🎉

Crypto 2.0 has all the same functionality with a bit of cleanup, and the newly linked ssl. Check out the full diff here

Crypto 2.0 Beta 1 - 2017-03-27 12:45:31

Beta candidate.

Crypto 2.0 Alpha 4 - 2017-03-08 11:38:18

New:

  • Use CTLS