{"id":1961,"url":"https://github.com/airsidemobile/JOSESwift","last_synced_at":"2025-08-06T14:31:30.501Z","repository":{"id":30300066,"uuid":"100590109","full_name":"airsidemobile/JOSESwift","owner":"airsidemobile","description":"A framework for the JOSE standards JWS, JWE, and JWK written in Swift.","archived":false,"fork":false,"pushed_at":"2024-10-29T23:35:29.000Z","size":1017,"stargazers_count":201,"open_issues_count":13,"forks_count":113,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-10-30T01:52:43.873Z","etag":null,"topics":["encryption","ios","jose","jwe","jwk","jws","signing","swift"],"latest_commit_sha":null,"homepage":"https://www.airsidemobile.com","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/airsidemobile.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-17T10:08:11.000Z","updated_at":"2024-10-29T23:35:32.000Z","dependencies_parsed_at":"2024-09-09T04:46:47.874Z","dependency_job_id":"021917ee-1ed8-416f-aa92-f00be39f311e","html_url":"https://github.com/airsidemobile/JOSESwift","commit_stats":{"total_commits":159,"total_committers":31,"mean_commits":5.129032258064516,"dds":0.4968553459119497,"last_synced_commit":"f308de16698a18d74d93779bca4d702ba9186d7a"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/airsidemobile%2FJOSESwift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/airsidemobile%2FJOSESwift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/airsidemobile%2FJOSESwift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/airsidemobile%2FJOSESwift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/airsidemobile","download_url":"https://codeload.github.com/airsidemobile/JOSESwift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228905550,"owners_count":17989782,"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":["encryption","ios","jose","jwe","jwk","jws","signing","swift"],"created_at":"2024-01-05T20:15:59.975Z","updated_at":"2025-08-06T14:31:30.423Z","avatar_url":"https://github.com/airsidemobile.png","language":"Swift","funding_links":[],"categories":["Security","Libs","Swift","Security [🔝](#readme)"],"sub_categories":["Encryption","Security"],"readme":"![JOSESwift](logo/JOSESwift-full.svg)\n\n\u003cbr\u003e\n\n**JOSESwift** is a modular and extensible framework for the [JOSE](https://datatracker.ietf.org/wg/jose/about/) standards [**JWS**](https://tools.ietf.org/html/rfc7515), [**JWE**](https://tools.ietf.org/html/rfc7516), and [**JWK**](https://tools.ietf.org/html/rfc7517) written in Swift.\n\n[![CircleCI](https://circleci.com/gh/airsidemobile/JOSESwift/tree/master.svg?style=svg)](https://circleci.com/gh/airsidemobile/JOSESwift/tree/master)\n\n\u003e :bulb: Please note that this implementation of the JOSE standards is not fully complete yet. For example, there is only a limited set of supported algorithms available at the moment. Moreover we currently only support compact serialization of JOSE types. If you are missing a specific feature, algorithm, or serialization, feel free to [submit a pull request](#contributing).\n\n## Contents\n\n- [Features](#features)\n- [Installation](#installation)\n\t- [CocoaPods](#cocoapods)\n\t- [Carthage](#carthage)\n\t- [Swift Package Manager](#swift-package-manager)\n- [Usage](#usage)\n\t- [JWS: Digital Signatures](#jws-digital-signatures)\n\t- [JWE: Encryption and Decryption](#jwe-encryption-and-decryption)\n\t- [JWK: Representing Keys](#jwk-representing-keys)\n- [Security](#security)\n- [Contributing](#contributing)\n- [Resources](#resources)\n- [Contact](#contact)\n- [Credits](#credits)\n- [License](#license)\n\n## Features\n\n- **JWS**: Digitally signing and verifying arbitrary data using the JWS standard.\n- **JWE**: Encrypting and decrypting arbitrary data using the JWE standard.\n- **JWK**: Encoding and decoding cryptographic keys.\n\nIf you are missing a specific feature, algorithm, or serialization, feel free to [submit a pull request](#contributing).\n\n### Cryptographic Algorithms\n\n\u003ctable\u003e\n\t\u003ctr\u003e\n\t\t\u003cth colspan=\"2\"\u003e:lock_with_ink_pen: JWS\u003c/th\u003e\n\t\t\u003cth rowspan=\"19\"\u003e\u003c/th\u003e\n\t\t\u003cth colspan=\"4\"\u003e:closed_lock_with_key: JWE\u003c/th\u003e\n\t\t\u003cth rowspan=\"19\"\u003e\u003c/th\u003e\n\t\t\u003cth colspan=\"2\"\u003e:key: JWK\u003c/th\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003cth colspan=\"2\"\u003e\u003ca href=\"https://tools.ietf.org/html/rfc7518#section-3\"\u003eDigital Signatures and MACs\u003c/a\u003e\u003c/th\u003e\n\t\t\u003cth colspan=\"2\"\u003e\u003ca href=\"https://tools.ietf.org/html/rfc7518#section-4\"\u003eKey Management\u003c/a\u003e\u003c/th\u003e\n\t\t\u003cth colspan=\"2\"\u003e\u003ca href=\"https://tools.ietf.org/html/rfc7518#section-5\"\u003eContent Encryption\u003c/a\u003e\u003c/th\u003e\n\t\t\u003cth colspan=\"2\"\u003e\u003ca href=\"https://tools.ietf.org/html/rfc7518#section-6\"\u003eKeys\u003c/a\u003e\u003c/th\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\u003ctd\u003e\u003ccode\u003eHS256\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e                   \u003ctd\u003e\u003ccode\u003eRSA1_5\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e       \u003ctd\u003e\u003ccode\u003eA128CBC-HS256\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e \u003ctd\u003e\u003ccode\u003eRSA\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e\u003c/tr\u003e\n\t\u003ctr\u003e\u003ctd\u003e\u003ccode\u003eHS384\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e                   \u003ctd\u003e\u003ccode\u003eRSA-OAEP\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e     \u003ctd\u003e\u003ccode\u003eA192CBC-HS384\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e                   \u003ctd\u003e\u003ccode\u003eEC\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e\u003c/tr\u003e\n\t\u003ctr\u003e\u003ctd\u003e\u003ccode\u003eHS512\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e                   \u003ctd\u003e\u003ccode\u003eRSA-OAEP-256\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e \u003ctd\u003e\u003ccode\u003eA256CBC-HS512\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e \u003ctd\u003e\u003ccode\u003eoct\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e\u003c/tr\u003e\n\t\u003ctr\u003e\u003ctd\u003e\u003ccode\u003eRS256\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e \u003ctd\u003e\u003ccode\u003eA128KW\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e       \u003ctd\u003e\u003ccode\u003eA128GCM\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e                         \u003cth rowspan=\"14\"\u003e\u003c/th\u003e\u003cth rowspan=\"14\"\u003e\u003c/th\u003e\u003c/tr\u003e\n\t\u003ctr\u003e\u003ctd\u003e\u003ccode\u003eRS384\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e \u003ctd\u003e\u003ccode\u003eA192KW\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e       \u003ctd\u003e\u003ccode\u003eA192GCM\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e\n\t\u003ctr\u003e\u003ctd\u003e\u003ccode\u003eRS512\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e \u003ctd\u003e\u003ccode\u003eA256KW\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e       \u003ctd\u003e\u003ccode\u003eA256GCM\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e\n\t\u003ctr\u003e\u003ctd\u003e\u003ccode\u003eES256\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e \u003ctd\u003e\u003ccode\u003edir\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e          \u003cth rowspan=\"11\"\u003e\u003c/th\u003e\u003cth rowspan=\"11\"\u003e\u003c/th\u003e\u003c/tr\u003e\n\t\u003ctr\u003e\u003ctd\u003e\u003ccode\u003eES384\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e \u003ctd\u003e\u003ccode\u003eECDH-ES\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e\u003c/tr\u003e\n\t\u003ctr\u003e\u003ctd\u003e\u003ccode\u003eES512\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e \u003ctd\u003e\u003ccode\u003eECDH-ES+A128KW\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e\u003c/tr\u003e\n\t\u003ctr\u003e\u003ctd\u003e\u003ccode\u003ePS256\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e \u003ctd\u003e\u003ccode\u003eECDH-ES+A192KW\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e\u003c/tr\u003e\n\t\u003ctr\u003e\u003ctd\u003e\u003ccode\u003ePS384\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e \u003ctd\u003e\u003ccode\u003eECDH-ES+A256KW\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e\u003c/tr\u003e\n\t\u003ctr\u003e\u003ctd\u003e\u003ccode\u003ePS512\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e \u003ctd\u003e\u003ccode\u003eA128GCMKW\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003c/td\u003e\u003c/tr\u003e\n\t\u003ctr\u003e\u003cth rowspan=\"5\"\u003e\u003c/th\u003e\u003cth rowspan=\"5\"\u003e\u003c/th\u003e             \u003ctd\u003e\u003ccode\u003eA192GCMKW\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003c/td\u003e\u003c/tr\u003e\n\t\u003ctr\u003e                                                       \u003ctd\u003e\u003ccode\u003eA256GCMKW\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003c/td\u003e\u003c/tr\u003e\n\t\u003ctr\u003e                                                       \u003ctd\u003e\u003ccode\u003ePBES2-HS256+A128KW\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e\u003c/tr\u003e\n\t\u003ctr\u003e                                                       \u003ctd\u003e\u003ccode\u003ePBES2-HS384+A192KW\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e\u003c/tr\u003e\n\t\u003ctr\u003e                                                       \u003ctd\u003e\u003ccode\u003ePBES2-HS512+A256KW\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e:white_check_mark:\u003c/td\u003e\u003c/tr\u003e\n\u003c/table\u003e\n\n### Serializations\n\nFor interchangeability JOSESwift currently supports compact serialization [for JWS](https://tools.ietf.org/html/rfc7515#section-3.1) and [for JWE](https://tools.ietf.org/html/rfc7516#section-3.1).\n\n| Compact Serialization | JSON Serialization |\n| :-------------------: | :----------------: |\n| :white_check_mark:    |                    |\n\n### Compression Algorithms\n\nJOSESwift supports the [DEFLATE](https://tools.ietf.org/html/rfc1951) compression algorithm [for JWE](https://tools.ietf.org/html/rfc7516#section-4.1.3).\n\n## Installation\n\nJOSESwift integrates nicely into your iOS and macOS projects. We support the following package managers:\n\n### CocoaPods\n\nTo integrate JOSESwift into your Xcode project, include it in your `Podfile`:\n\n``` ruby\nsource 'https://cdn.cocoapods.org/'\nplatform :ios, '13.0'\nuse_frameworks!\n\ntarget '\u003cYour Target Name\u003e' do\n    pod 'JOSESwift', '~\u003e 3.0'\nend\n```\n\nThen install it by running `pod install`. More documentation on using CocoaPods can be found [here](https://cocoapods.org).\n\n### Carthage\n\nTo integrate JOSESwift in your Xcode project, include it in your `Cartfile`:\n\n```\ngithub \"airsidemobile/JOSESwift\" ~\u003e 3.0\n```\n\nThen build it by running `carthage update` and drag the built framework into your Xcode project. More documentation on using Carthage can be found [here](https://github.com/Carthage/Carthage).\n\n### Swift Package Manager\n\nTo integrate JOSESwift in your Xcode project as a Swift package, follow Apple's article on how to [add package dependencies to your app](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app).\n\nAlternatively, when using Swift Package Manager manually include the following dependency in your `Package.swift` file. See [Apple's documentation](https://developer.apple.com/documentation/swift_packages/package/dependency) for more details on specifying dependency version requirements.\n\n``` swift\n.package(url: \"https://github.com/airsidemobile/JOSESwift.git\", from: \"3.0.0\")\n```\n\n## Usage\n\nJOSESwift covers three functional aspects:\n\n1. [JWS: Digital Signatures](#jws-digital-signatures)\n\t- [Signing data](#signing-data)\n\t- [Verifying data](#verifying-data)\n2. [JWE: Encryption and Decryption](#jwe-encryption-and-decryption)\n\t- [Encrypting data](#encrypting-data)\n\t- [Decrypting data](#decrypting-data)\n3. [JWK: Representing Keys](#jwk-representing-keys)\n\t- [Encoding RSA Public Keys](#encoding-rsa-public-keys)\n\t- [Decoding RSA Public Keys](#decoding-rsa-public-keys)\n\n****\n\n### JWS: Digital Signatures\n\nA `JWS` encapsulates and secures data using a digital signature which can be verified by the receiver of the `JWS`.\n\n#### Signing Data\n\nIn order to construct a JWS we need to provide the following parts:\n\n1. Header\n2. Payload\n3. Signer\n\n##### Header\n\n``` swift\nvar header = JWSHeader(algorithm: .RS512)\n```\n\nYou can set [registered header parameters](https://tools.ietf.org/html/rfc7515#section-4.1) via convenient accessors:\n\n``` swift\nheader.kid = \"2018-10-08\"\n\nheader.typ = \"JWS\"\n```\n\n[Public](https://tools.ietf.org/html/rfc7515#section-4.2) and [private](https://tools.ietf.org/html/rfc7515#section-4.3) header parameters can be set and read like so:\n\n``` swift\ntry header.set(\"rice\", forParameter: \"meal\")\nlet meal = header.get(parameter: \"meal\") // \"rice\"\nheader.remove(parameter: \"meal\")\n```\n\n##### Payload\n\n``` swift\nlet message = \"Summer ⛱, Sun ☀️, Cactus 🌵\".data(using: .utf8)!\n\nlet payload = Payload(message)\n```\n\n##### Signer\n\nThe signer algorithm must match the header algorithm.\n\n``` swift\nlet privateKey: SecKey = /* ... */\n\nlet signer = Signer(signatureAlgorithm: .RS512, key: privateKey)!\n```\n\n##### Serializing\n\nThe JWS compact serialization is a URL-safe string that can easily be transmitted to a third party using a method of your choice.\n\n``` swift\nguard let jws = try? JWS(header: header, payload: payload, signer: signer) else { ... }\n\nprint(jws.compactSerializedString) // ey (...) J9.U3 (...) LU.na (...) 1A\n```\n\nMore details about constructing a JWS can be found [in the wiki](../../wiki/jws).\n\n#### Verifying Data\n\n``` swift\nlet publicKey: SecKey = /* ... */\n\nlet serialization = \"ey (..) n0.HK (..) pQ.yS (..) PA.AK (..) Jx.hB (..) 7w\"\n```\n\n``` swift\ndo {\n    let jws = try JWS(compactSerialization: serialization)\n    let verifier = Verifier(signatureAlgorithm: .RS512, publicKey: publicKey)!\n    let payload = try jws.validate(using: verifier).payload\n    let message = String(data: payload.data(), encoding: .utf8)!\n\n    print(message) // Summer ⛱, Sun ☀️, Cactus 🌵\n}\n```\n\nMore details about verifying an existing, serialized JWS can be found [in the wiki](../../wiki/jws).\n\n****\n\n### JWE: Encryption and Decryption\n\nA JWE encapsulates and secures data by encrypting it. It can be decrypted by the receiver of the JWE.\n\n#### Encrypting Data\n\nIn order to construct a JWE we need to provide the following parts:\n\n1. Header\n2. Payload\n3. Encrypter\n\n##### Header\n\n``` swift\nvar header = JWEHeader(keyManagementAlgorithm: .RSA1_5, contentEncryptionAlgorithm: .A256CBCHS512)\n```\n\nYou can set [registered header parameters](https://tools.ietf.org/html/rfc7516#section-4.1):\n\n``` swift\nheader.kid = \"2018-10-08\"\n\nheader.typ = \"JWE\"\n```\n\n[Public](https://tools.ietf.org/html/rfc7515#section-4.2) and [private](https://tools.ietf.org/html/rfc7515#section-4.3) header parameters can be set and read like so:\n\n``` swift\ntry header.set(\"rice\", forParameter: \"meal\")\nlet meal = header.get(parameter: \"meal\") // \"rice\"\nheader.remove(parameter: \"meal\")\n```\n\n##### Payload\n\n``` swift\nlet message = \"Summer ⛱, Sun ☀️, Cactus 🌵\".data(using: .utf8)!\n\nlet payload = Payload(message)\n```\n\n##### Encrypter\n\nThe encrypter algorithms must match the header algorithms.\n\n``` swift\nlet publicKey: SecKey = /* ... */\n\nlet encrypter = Encrypter(keyManagementAlgorithm: .RSA1_5, contentEncryptionAlgorithm: .A256CBCHS512, encryptionKey: publicKey)!\n```\n\nNote that the type of the provided encryption key must match the specified key management algorithm as shown in the following table.\n\n| Key Management Algorithm | Encryption Key Type |\n|:-------------------------|:--------------------|\n| RSA1_5                   | `SecKey`            |\n| RSAOAEP                  | `SecKey`            |\n| RSAOAEP256               | `SecKey`            |\n| A128KW                   | `Data`              |\n| A192KW                   | `Data`              |\n| A256KW                   | `Data`              |\n| direct                   | `Data`              |\n\n##### Serialization\n\nThe JWE compact serialization is a URL-safe string that can easily be transmitted to a third party using a method of your choice.\n\n``` swift\nguard let jwe = try? JWE(header: header, payload: payload, encrypter: encrypter) else { ... }\n\nprint(jwe.compactSerializedString) // ey (..) n0.HK (..) pQ.yS (..) PA.AK (..) Jx.hB (..) 7w\n```\n\nMore details about constructing a JWE can be found [in the wiki](../../wiki/jwe).\n\n#### Decrypting Data\n\n``` swift\nlet privateKey: SecKey = /* ... */\n\nlet serialization = \"ey (..) n0.HK (..) pQ.yS (..) PA.AK (..) Jx.hB (..) 7w\"\n```\n\n``` swift\ndo {\n    let jwe = try JWE(compactSerialization: serialization)\n    let decrypter = Decrypter(keyManagementAlgorithm: .RSA1_5, contentEncryptionAlgorithm: .A256CBCHS512, decryptionKey: privateKey)!\n    let payload = try jwe.decrypt(using: decrypter)\n    let message = String(data: payload.data(), encoding: .utf8)!\n\n    print(message) // Summer ⛱, Sun ☀️, Cactus 🌵\n}\n```\n\nMore details about decrypting an existing, serialized JWE can be found [in the wiki](../../wiki/jwe).\n\nNote that the type of the provided decryption key must match the specified key management algorithm as shown in the following table.\n\n| Key Management Algorithm | Decryption Key Type |\n|:-------------------------|:--------------------|\n| RSA1_5                   | `SecKey`            |\n| RSAOAEP                  | `SecKey`            |\n| RSAOAEP256               | `SecKey`            |\n| A128KW                   | `Data`              |\n| A192KW                   | `Data`              |\n| A256KW                   | `Data`              |\n| direct                   | `Data`              |\n\n****\n\n### JWK: Representing Keys\n\nA JWK is a JSON data structure that represents a cryptographic key. You could use it, for instance, as the payload of a JWS or a JWE to transmit your public key to a server.\n\n#### Encoding RSA Public Keys\n\n``` swift\nlet publicKey: SecKey = /* ... */\n\nlet jwk = try! RSAPublicKey(publicKey: publicKey)\n\nlet json = jwk.jsonString()! // {\"kty\":\"RSA\",\"n\":\"MHZ4L...uS2d3\",\"e\":\"QVFBQg\"}\n```\n\nMore details about encoding RSA public keys can be found [in the wiki](../../wiki/jwk).\n\n#### Decoding RSA Public Keys\n\n``` swift\nlet json: Data = /* ... */\n\nlet jwk = try! RSAPublicKey(data: json)\n\nlet publicKey: SecKey = try! jwk.converted(to: SecKey.self)\n```\n\nMore details about decoding RSA public keys can be found [in the wiki](../../wiki/jwk).\n\n:warning: We currently ignore the key parameters [`\"key_ops\"`](https://tools.ietf.org/html/rfc7517#section-4.3) and [`\"x5c\"`](https://tools.ietf.org/html/rfc7517#section-4.7) when decoding. This is due to a bug in our decoding implementation. See [#117](https://github.com/airsidemobile/JOSESwift/issues/117) for details.\n\n## Security\n\nJOSESwift uses [Apple's Security framework](https://developer.apple.com/documentation/security), [Apple’s CommonCrypto](https://opensource.apple.com//source/CommonCrypto/), and [Apples's CryptoKit](https://developer.apple.com/documentation/cryptokit/) for cryptography.\n\nFor security disclosures or related matters, please contact \u003cjoseswift@airsidemobile.com\u003e.\n\nSee our [security policy](SECURITY.md) for more information.\n\n## Contributing\n\nContributions to the project are encouraged and more than welcome. :nerd_face:\n\nIf you want to contribute, please submit a pull request.\nFor feature requests, discussions, or bug reports, just open an issue.\n\nSee our [contributing guidelines](.github/CONTRIBUTING.md) for more information.\n\n## Resources\n\nYou can find detailed information about the relevant JOSE standards in the respective RFCs:\n\n- [RFC-7515:](https://tools.ietf.org/html/rfc7515) JSON Web Signature (JWS)\n- [RFC-7516:](https://tools.ietf.org/html/rfc7516) JSON Web Encryption (JWE)\n- [RFC-7517:](https://tools.ietf.org/html/rfc7517) JSON Web Key (JWK)\n- [RFC-7518:](https://tools.ietf.org/html/rfc7518) JSON Web Algorithms (JWA)\n\nDon’t forget to check our [our wiki](https://github.com/mohemian/jose-ios/wiki) for more detailed documentation.\n\n## Contact\n\nFeel free to contact the project maintainers at \u003cjoseswift@airsidemobile.com\u003e.\n\n## Credits\n\nJOSESwift is maintained by [Airside Mobile](https://www.airsidemobile.com).\n\n### Project Maintainers\n\n[@daniel-moh](https://github.com/daniel-moh),\n[@haeser](https://github.com/haeser)\n\n### Logo\n\nThe logo was designed by Ivan Leuzzi.\n\n### Thanks\n\nTo the following projects, which served us as reference and inspiration during development:\n\n- [Heimdall](https://github.com/henrinormak/Heimdall)\n- [Nimbus JOSE + JWT](https://connect2id.com/products/nimbus-jose-jwt)\n\n## License\n\nJOSESwift is licensed under the Apache License 2.0. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fairsidemobile%2FJOSESwift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fairsidemobile%2FJOSESwift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fairsidemobile%2FJOSESwift/lists"}