'Swift - Signing JWT with private key
I'm trying to do something like https://jwt.io/ does: {header}.{payload}.{privateKey}
I have a header, a payload, and a private key ( ----BEGIN PRIVATE KEY--- CODE ----END PRIVATE KEY---- ).
I know header and payload, we need to encrypt it as base64, like this:
let token = [header.toBase64(), payload.toBase64()].joined(separator: ".")
BUT, what about the private key? How can I generate this last part of this JWT using that BEGIN PRIVATE KEY file/string ?
I want to do that without external libs, can I?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
