{"id":18340342,"url":"https://github.com/dimensiondev/dmsopenpgp","last_synced_at":"2025-04-06T05:32:30.828Z","repository":{"id":50591092,"uuid":"189545609","full_name":"DimensionDev/DMSOpenPGP","owner":"DimensionDev","description":"Swift wrapper for Bouncy Castle OpenPGP","archived":false,"fork":false,"pushed_at":"2019-09-04T06:18:52.000Z","size":98,"stargazers_count":6,"open_issues_count":5,"forks_count":0,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-21T18:37:48.682Z","etag":null,"topics":["pgp","swift"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DimensionDev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-31T07:08:23.000Z","updated_at":"2024-07-03T17:08:35.000Z","dependencies_parsed_at":"2022-09-13T01:00:20.432Z","dependency_job_id":null,"html_url":"https://github.com/DimensionDev/DMSOpenPGP","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DimensionDev%2FDMSOpenPGP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DimensionDev%2FDMSOpenPGP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DimensionDev%2FDMSOpenPGP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DimensionDev%2FDMSOpenPGP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DimensionDev","download_url":"https://codeload.github.com/DimensionDev/DMSOpenPGP/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247440711,"owners_count":20939223,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pgp","swift"],"created_at":"2024-11-05T20:22:12.306Z","updated_at":"2025-04-06T05:32:30.287Z","avatar_url":"https://github.com/DimensionDev.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DMSOpenPGP\n\n\u003c!--[![CI Status](https://img.shields.io/travis/MainasuK\u003c!--/DMSOpenPGP.svg?style=flat)](https://travis-ci.org/MainasuK/DMSOpenPGP)--\u003e\n[![Version](https://img.shields.io/cocoapods/v/DMSOpenPGP.svg?style=flat)](https://cocoapods.org/pods/DMSOpenPGP)\n[![License](https://img.shields.io/cocoapods/l/DMSOpenPGP.svg?style=flat)](https://cocoapods.org/pods/DMSOpenPGP)\n[![Platform](https://img.shields.io/cocoapods/p/DMSOpenPGP.svg?style=flat)](https://cocoapods.org/pods/DMSOpenPGP)\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n\u003c!--## Requirements--\u003e\n\n## Installation\n\nDMSOpenPGP is available through [CocoaPods](https://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'DMSOpenPGP'\n```\n\n## Usage\n\n### Setup\n\n```swift\nimport BouncyCastle_ObjC\n\nfunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -\u003e Bool {\n\n    // Add provider before use DMSOpenPGP (also add to extension if have)\n    JavaSecuritySecurity.addProvider(with: BCJceProviderBouncyCastleProvider())\n\n    return true\n}\n```\n\n### Keygen\n```swift\ndo {\n    let generateKeyData = GenerateKeyData(name: \"Hello\", email: \"alice@alice.pgp\", password: \"Alice\",\n                                          masterKey: KeyData(), subkey: KeyData())\n    let alice = try DMSPGPKeyRingFactory(generateKeyData: generateKeyData).keyRing\n    let armoredPublicKey = alice.publicKeyRing.armored()\n    let armoredSecretKey = alice.secretKeyRing.armored()\n} catch {\n    …\n}\n```\n\n### Encrypt \u0026 Sign\n```swift\n// encrypt\nguard let secretKeyRing = alice.secretKeyRing else {\n    return\n}\n\ndo {\n    // with signature\n    let encryptor = try DMSPGPEncryptor(publicKeyRings: [alice.publicKeyRing, bob.publicKeyRing, eve.publicKeyRing],\n                                        secretKeyRing: secretKeyRing,\n                                        password: \"Alice\")\n    let encryptedWithSignatureMessage = try encryptor.encrypt(message: \"Message\")\n    \n    // without signature\n    let encryptor2 = try DMSPGPEncryptor(publicKeyRings: [alice.publicKeyRing, bob.publicKeyRing, eve.publicKeyRing])\n    let encryptedWithoutSignatureMessage = try encryptr2.encrypt(message: \"Message\")\n\n} catch {\n   …\n}\n```\n\n```swift\n// Sign\nguard let secretKeyRing = alice.secretKeyRing else {\n    return\n}\n\ndo {\n    let encryptor = try DMSPGPEncryptor(secretKeyRing: secretKeyRing, password: \"Alice\")\n    let cleartext = try encryptor.encrypt(message: \"Message\")\n    // or\n    let signer = try  DMSPGPSigner(secretKeyRing: keyRing.secretKeyRing, password: password)\n    let cleartext2 = signer.sign(message: \"Message\")\n} catch {\n    …\n}\n```\n\n### Decrypt \u0026 Verify\n```swift\ndo {\n    let decryptor = try DMSPGPDecryptor(armoredMessage: encryptedMessage)\n    // decryptor.encryptingKeyIDs contains all decryptable secret keys' keyID   \n    let decryptKey = decryptor.encryptingKeyIDs.compactMap { keyID in\n        return alice.secretKeyRing?.getDecryptingSecretKey(keyID: keyID)\n    }.first\n    \n    guard let secretKey = decryptKey else { \n        return\n    }\n\n    let message = try decryptor.decrypt(secretKey: secretKey, password: \"Alice\")\n    let signatureVerifier = DMSPGPSignatureVerifier(message: message, onePassSignatureList: decryptor.onePassSignatureList, signatureList: decryptor.signatureList)\n    let verifyResult = signatureVerifier.verifySignature(use: alice.publicKeyRing)\n}\n```\n\nPlease check DMSOpenPGP/Tests/DMSOpenPGPTests.swift in Example Pods unit tests to see more details.\n\n\n## Dependencies\n- [BouncyCastle-ObjC](https://github.com/DimensionDev/BouncyCastle-ObjC)\n\n## License\n\nDMSOpenPGP is available under the AGPL license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimensiondev%2Fdmsopenpgp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdimensiondev%2Fdmsopenpgp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimensiondev%2Fdmsopenpgp/lists"}