Swiftpack.co - pisalcoding/HybridCrypto as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by pisalcoding.
pisalcoding/HybridCrypto 1.0.1
Swift HybridCrypto is simple customizable implementation of hybrid cryptography (AES+RSA+Hash) recommended by OWASP.
⭐️ 2
🕓 1 year ago
.package(url: "https://github.com/pisalcoding/HybridCrypto.git", from: "1.0.1")

HybridCrypto (Swift)

HybridCrypto is simple implementation of hybrid cryptography following recommendations by OWASP.


  • Minimum iOS SDK: 10.0


Step 1: Add this package to our Swift project via Swift Package Manager (SPM)


Step 2: Import package to classes you need to work with encryption

import HybridCrypto

Step 3: Initialize HybridCrypto in your AppDelegate

let publicKeyPlain = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvTtZxoq7IKTwRkADtWix\n" +
"Ryv/CHKK+skNlMMV5G+om75HgHUo8AOzHnj9yUvhcm8Maz46ukxiZsvDPgExu9N1\n" +
"agEm9HHJEZg1VN+2dT+JojODuC3qkF7o94duchQX44gPjyIBEE/113E6fS51SGGm\n" +
"WYrCapSYjNRubB97O1WPm/2nK+A/m9KTtCuIZMp4i/qe4mXCLMRepFO2ORBLD5Ac\n" +
"RU+/tF15IruvaBhZezY+IX571yRao3ZLlVBJtZKU7SHp5udxQ0daRxtsVc9aloC3\n" +
"TRRL8RvFjHyg7V+uSHkg6cN4IIMrTnkwVkn+7BE9KrT7tY8yEkSE8W4WVCDChIRf\n" +
HybridCrypto.initialize(with: Configuration.defaultCofig, publicKeyPlain: publicKeyPlain)

Step 4 (Final): Use it wherever you want

do {
    let result = try HybridCrypto.shared.encrypt(message: "Hello")
} catch  let err {
    print("Error: \(err)")


Once encryption is successful, you'll get a Http-friendly result object

public struct HttpFriendlyResult : Codable {
    let requestPassword: String
    let iv: String
    let salt: String
    let responsePassword: String
    let encryptedData: String
    let signature: String


Stars: 2
Last commit: 3 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

Change package name
1 year ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics