krzyzanowskim / OpenSSL

OpenSSL package for SwiftPM, CocoaPod, and Carthage, multiplatform
https://swift.best
Other
920 stars 340 forks source link

Sign JWT? #34

Closed grosch closed 3 years ago

grosch commented 6 years ago

Can you show an example of how to use this to sign a JWT header please? In PHP I'd do it like so:

$pkey = openssl_pkey_get_private('file://' . AUTH_KEY_PATH);
openssl_sign("$header.$claims", $signature, $pkey, 'sha256');

and then the signed string is available as $signature.

Thanks!